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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (350) 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.js +1 -1
  26. package/lib/commands/app-config/delete.js +1 -1
  27. package/lib/commands/app-config/get.js +1 -1
  28. package/lib/commands/app-config/index.js +1 -1
  29. package/lib/commands/app-config/list.js +1 -1
  30. package/lib/commands/app-config/set.js +1 -1
  31. package/lib/commands/app-config/shared.js +1 -1
  32. package/lib/commands/auth/index.js +1 -1
  33. package/lib/commands/bff/create.js +1 -1
  34. package/lib/commands/bff/delete.js +1 -1
  35. package/lib/commands/bff/detail.js +1 -1
  36. package/lib/commands/bff/index.js +1 -1
  37. package/lib/commands/bff/list.js +1 -1
  38. package/lib/commands/bff/pull.js +1 -1
  39. package/lib/commands/bff/push.js +1 -1
  40. package/lib/commands/bff/status.js +1 -1
  41. package/lib/commands/cli-skill/index.js +1 -1
  42. package/lib/commands/cli-update.js +1 -1
  43. package/lib/commands/codegen/index.js +1 -1
  44. package/lib/commands/codegen/sdk.js +1 -1
  45. package/lib/commands/codegen/sql.js +1 -1
  46. package/lib/commands/common/app-registry.js +1 -1
  47. package/lib/commands/common/app-selector.js +1 -1
  48. package/lib/commands/common/async-task.js +1 -1
  49. package/lib/commands/common/dry-run.js +1 -1
  50. package/lib/commands/common/flags.js +1 -1
  51. package/lib/commands/common/local-file.js +1 -1
  52. package/lib/commands/common/validate.js +1 -1
  53. package/lib/commands/config/delete.js +1 -1
  54. package/lib/commands/config/get.js +1 -1
  55. package/lib/commands/config/index.js +1 -1
  56. package/lib/commands/config/init.js +1 -1
  57. package/lib/commands/config/list.js +1 -1
  58. package/lib/commands/config/set.js +1 -1
  59. package/lib/commands/config/shared.js +1 -1
  60. package/lib/commands/dataset/business-group-update.js +1 -1
  61. package/lib/commands/dataset/business-groups.js +1 -1
  62. package/lib/commands/dataset/capability.js +1 -1
  63. package/lib/commands/dataset/delete.js +1 -1
  64. package/lib/commands/dataset/detail.js +1 -1
  65. package/lib/commands/dataset/extend-update.js +1 -1
  66. package/lib/commands/dataset/field-restore.js +1 -1
  67. package/lib/commands/dataset/field-update.js +1 -1
  68. package/lib/commands/dataset/generate.js +1 -1
  69. package/lib/commands/dataset/index.js +1 -1
  70. package/lib/commands/dataset/list.js +1 -1
  71. package/lib/commands/dataset/operations.js +1 -1
  72. package/lib/commands/dataset/relation-audit.js +1 -1
  73. package/lib/commands/dataset/relation-create.js +1 -1
  74. package/lib/commands/dataset/relation-delete.js +1 -1
  75. package/lib/commands/dataset/relation-shared.js +1 -1
  76. package/lib/commands/dataset/relation-update.js +1 -1
  77. package/lib/commands/dataset/relations.js +1 -1
  78. package/lib/commands/dataset/rename.js +1 -1
  79. package/lib/commands/dataset/restore.js +1 -1
  80. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  81. package/lib/commands/db/analysis-batching.js +1 -1
  82. package/lib/commands/db/analyze-batch-plan.js +1 -1
  83. package/lib/commands/db/analyze-cancel.js +1 -1
  84. package/lib/commands/db/analyze-start.js +1 -1
  85. package/lib/commands/db/analyze-status.js +1 -1
  86. package/lib/commands/db/create.js +1 -1
  87. package/lib/commands/db/delete.js +1 -1
  88. package/lib/commands/db/detail.js +1 -1
  89. package/lib/commands/db/diff-refresh-start.js +1 -1
  90. package/lib/commands/db/diff-refresh-status.js +1 -1
  91. package/lib/commands/db/diff.js +1 -1
  92. package/lib/commands/db/index.js +1 -1
  93. package/lib/commands/db/list.js +1 -1
  94. package/lib/commands/db/shared.js +1 -1
  95. package/lib/commands/db/table-diff-shared.js +1 -1
  96. package/lib/commands/db/tables.js +1 -1
  97. package/lib/commands/db/test.js +1 -1
  98. package/lib/commands/db/update.js +1 -1
  99. package/lib/commands/deployment/auto-sync.js +1 -1
  100. package/lib/commands/deployment/index.js +1 -1
  101. package/lib/commands/deployment/sync-all.js +1 -1
  102. package/lib/commands/deployment/sync-jobs.js +1 -1
  103. package/lib/commands/deployment/sync-status.js +1 -1
  104. package/lib/commands/deployment/sync.js +1 -1
  105. package/lib/commands/doctor.js +1 -1
  106. package/lib/commands/file/index.js +1 -1
  107. package/lib/commands/instant-api-policy/current.js +1 -1
  108. package/lib/commands/instant-api-policy/index.js +1 -1
  109. package/lib/commands/instant-api-policy/init.js +1 -1
  110. package/lib/commands/instant-api-policy/publish.js +1 -1
  111. package/lib/commands/instant-api-policy/pull.js +1 -1
  112. package/lib/commands/instant-api-policy/revision.js +1 -1
  113. package/lib/commands/instant-api-policy/revisions.js +1 -1
  114. package/lib/commands/instant-api-policy/rollback.js +1 -1
  115. package/lib/commands/instant-api-policy/shared.js +1 -1
  116. package/lib/commands/instant-api-policy/validate.js +1 -1
  117. package/lib/commands/issue/index.js +1 -1
  118. package/lib/commands/issue/nudge.js +1 -1
  119. package/lib/commands/issue/report.js +1 -1
  120. package/lib/commands/issue/shared.js +1 -1
  121. package/lib/commands/kb/create.js +1 -1
  122. package/lib/commands/kb/delete.js +1 -1
  123. package/lib/commands/kb/detail.js +1 -1
  124. package/lib/commands/kb/index.js +1 -1
  125. package/lib/commands/kb/list.js +1 -1
  126. package/lib/commands/kb/search.js +1 -1
  127. package/lib/commands/kb/shared.js +1 -1
  128. package/lib/commands/kb/update.js +1 -1
  129. package/lib/commands/logs/index.js +1 -1
  130. package/lib/commands/menu/asset-update.js +1 -1
  131. package/lib/commands/menu/delete.js +1 -1
  132. package/lib/commands/menu/external-link-create.js +1 -1
  133. package/lib/commands/menu/external-link-update.js +1 -1
  134. package/lib/commands/menu/group-create.js +1 -1
  135. package/lib/commands/menu/group-update.js +1 -1
  136. package/lib/commands/menu/index.js +1 -1
  137. package/lib/commands/menu/list.js +1 -1
  138. package/lib/commands/menu/move.js +1 -1
  139. package/lib/commands/menu/regroup-start.js +1 -1
  140. package/lib/commands/menu/rename.js +1 -1
  141. package/lib/commands/menu/shared/compare-table.js +1 -1
  142. package/lib/commands/menu/shared/delete-plan.js +1 -1
  143. package/lib/commands/menu/shared/facts.js +1 -1
  144. package/lib/commands/menu/shared/index.js +1 -1
  145. package/lib/commands/menu/shared/inquirer.js +1 -1
  146. package/lib/commands/menu/shared/local-pages.js +1 -1
  147. package/lib/commands/menu/shared/logic.js +1 -1
  148. package/lib/commands/menu/shared/mutations.js +1 -1
  149. package/lib/commands/menu/shared/service.js +1 -1
  150. package/lib/commands/menu/shared/sync-core.js +1 -1
  151. package/lib/commands/menu/shared/update-core.js +1 -1
  152. package/lib/commands/menu/shared/valid-url.js +1 -1
  153. package/lib/commands/menu/sync.js +1 -1
  154. package/lib/commands/menu/visibility-update.js +1 -1
  155. package/lib/commands/notification/config-create.js +1 -1
  156. package/lib/commands/notification/config-delete.js +1 -1
  157. package/lib/commands/notification/config-list.js +1 -1
  158. package/lib/commands/notification/config-update.js +1 -1
  159. package/lib/commands/notification/index.js +1 -1
  160. package/lib/commands/notification/shared.js +1 -1
  161. package/lib/commands/ocr/index.js +1 -1
  162. package/lib/commands/page/create.js +1 -1
  163. package/lib/commands/page/custom/detail.js +1 -1
  164. package/lib/commands/page/custom/list.js +1 -1
  165. package/lib/commands/page/custom/publish.js +1 -1
  166. package/lib/commands/page/custom/shared.d.ts +0 -8
  167. package/lib/commands/page/custom/shared.js +1 -1
  168. package/lib/commands/page/custom/syntax.js +1 -1
  169. package/lib/commands/page/custom/update.js +1 -1
  170. package/lib/commands/page/data-list-status.js +1 -1
  171. package/lib/commands/page/generate-start.js +1 -1
  172. package/lib/commands/page/generate-status.js +1 -1
  173. package/lib/commands/page/index.js +1 -1
  174. package/lib/commands/page/pull.js +1 -1
  175. package/lib/commands/page/push.js +1 -1
  176. package/lib/commands/page/relation-audit.js +1 -1
  177. package/lib/commands/page/restore.js +1 -1
  178. package/lib/commands/page/shared.js +1 -1
  179. package/lib/commands/page/sync.js +1 -1
  180. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  181. package/lib/commands/project/create/format-elapsed.js +1 -1
  182. package/lib/commands/project/create/main.js +1 -1
  183. package/lib/commands/project/create/materialize-project-template.js +1 -1
  184. package/lib/commands/project/create/project-name.js +1 -1
  185. package/lib/commands/project/create/project-template-archive.js +1 -1
  186. package/lib/commands/project/create/project-template-path.js +1 -1
  187. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  188. package/lib/commands/project/create/use-format-code.js +1 -1
  189. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  190. package/lib/commands/project/domain-routing-sync.js +1 -1
  191. package/lib/commands/project/index.js +1 -1
  192. package/lib/commands/project/upgrade.js +1 -1
  193. package/lib/commands/registry.js +1 -1
  194. package/lib/commands/role/delete.js +1 -1
  195. package/lib/commands/role/detail.js +1 -1
  196. package/lib/commands/role/index.js +1 -1
  197. package/lib/commands/role/list.js +1 -1
  198. package/lib/commands/role/shared.js +1 -1
  199. package/lib/commands/role/update.js +1 -1
  200. package/lib/commands/role/user-add.js +1 -1
  201. package/lib/commands/role/user-remove.js +1 -1
  202. package/lib/commands/role/user-resolve.js +1 -1
  203. package/lib/commands/rule/get.js +1 -1
  204. package/lib/commands/rule/index.js +1 -1
  205. package/lib/commands/rule/list.js +1 -1
  206. package/lib/commands/rule/set.js +1 -1
  207. package/lib/commands/rule/shared.js +1 -1
  208. package/lib/commands/run/index.d.ts +4 -0
  209. package/lib/commands/run/index.js +1 -1
  210. package/lib/commands/schema.js +1 -1
  211. package/lib/commands/sql/create.js +1 -1
  212. package/lib/commands/sql/delete.js +1 -1
  213. package/lib/commands/sql/detail.js +1 -1
  214. package/lib/commands/sql/exec.js +1 -1
  215. package/lib/commands/sql/index.js +1 -1
  216. package/lib/commands/sql/list.js +1 -1
  217. package/lib/commands/sql/pull.js +1 -1
  218. package/lib/commands/sql/push.js +1 -1
  219. package/lib/commands/sql/shared.js +1 -1
  220. package/lib/commands/sql/status.js +1 -1
  221. package/lib/commands/sql/validate.js +1 -1
  222. package/lib/commands/task/index.js +1 -1
  223. package/lib/commands/task/status.js +1 -1
  224. package/lib/commands/tenant/index.js +1 -1
  225. package/lib/commands/tenant/members-list.js +1 -1
  226. package/lib/commands/tenant/shared.js +1 -1
  227. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  228. package/lib/commands/user-account/index.js +1 -1
  229. package/lib/commands/workspace/add.js +1 -1
  230. package/lib/commands/workspace/index.js +1 -1
  231. package/lib/commands/workspace/remove.js +1 -1
  232. package/lib/config/domain-config.js +1 -1
  233. package/lib/config/project-domain-routing.d.ts +5 -1
  234. package/lib/config/project-domain-routing.js +1 -1
  235. package/lib/config/schema.js +1 -1
  236. package/lib/constant/cdn.js +1 -1
  237. package/lib/constant/cli.js +1 -1
  238. package/lib/constant/defaults.js +1 -1
  239. package/lib/constant/domain.js +1 -1
  240. package/lib/constant/env.js +1 -1
  241. package/lib/constant/output.js +1 -1
  242. package/lib/constant/paths.js +1 -1
  243. package/lib/constant/region.js +1 -1
  244. package/lib/constant/risk.js +1 -1
  245. package/lib/constant/routing-profile.js +1 -1
  246. package/lib/context/app-resolver.js +1 -1
  247. package/lib/context/auth-resolver.js +1 -1
  248. package/lib/context/config-loader.js +1 -1
  249. package/lib/context.js +1 -1
  250. package/lib/core/alias-resolver.js +1 -1
  251. package/lib/core/api-client.d.ts +0 -26
  252. package/lib/core/api-client.js +1 -1
  253. package/lib/core/bff/config.js +1 -1
  254. package/lib/core/bff/file-system.js +1 -1
  255. package/lib/core/bff/hash.js +1 -1
  256. package/lib/core/bff/lock.js +1 -1
  257. package/lib/core/bff/utils.js +1 -1
  258. package/lib/core/db-resolver.js +1 -1
  259. package/lib/core/instant-api-policy/config.js +1 -1
  260. package/lib/core/kb-search-client.js +1 -1
  261. package/lib/core/page/file-system.d.ts +43 -0
  262. package/lib/core/page/file-system.js +1 -1
  263. package/lib/core/page/hash.js +1 -1
  264. package/lib/core/page/lock.js +1 -1
  265. package/lib/core/sql-index-auditor.js +1 -1
  266. package/lib/core/sql-sync/config.js +1 -1
  267. package/lib/core/sql-sync/file-system.js +1 -1
  268. package/lib/core/sql-sync/hash.js +1 -1
  269. package/lib/core/sql-sync/lock.js +1 -1
  270. package/lib/core/sql-sync/utils.js +1 -1
  271. package/lib/core/sql-validator.js +1 -1
  272. package/lib/errors.js +1 -1
  273. package/lib/framework/build-all-flags.js +1 -1
  274. package/lib/framework/error-output.js +1 -1
  275. package/lib/framework/explicit-yes.js +1 -1
  276. package/lib/framework/flags.js +1 -1
  277. package/lib/framework/help.js +1 -1
  278. package/lib/framework/index.js +1 -1
  279. package/lib/framework/output.js +1 -1
  280. package/lib/framework/response.js +1 -1
  281. package/lib/framework/runner-alias.js +1 -1
  282. package/lib/framework/runner.js +1 -1
  283. package/lib/framework/schema-export.js +1 -1
  284. package/lib/framework/supported-flags.js +1 -1
  285. package/lib/framework/types.js +1 -1
  286. package/lib/generated/build-info.d.ts +4 -4
  287. package/lib/generated/build-info.js +1 -1
  288. package/lib/generated/official-routing.js +1 -1
  289. package/lib/generated/routing-contract.js +1 -1
  290. package/lib/help.js +1 -1
  291. package/lib/postinstall.js +1 -1
  292. package/lib/runtime/confirmation.js +1 -1
  293. package/lib/runtime/event.js +1 -1
  294. package/lib/runtime/index.js +1 -1
  295. package/lib/runtime/queue.js +1 -1
  296. package/lib/runtime/resolve.js +1 -1
  297. package/lib/skills/builtin-skill.js +1 -1
  298. package/lib/skills/main.js +1 -1
  299. package/lib/skills/npx-skills-add.js +1 -1
  300. package/lib/skills/skill-presence.js +1 -1
  301. package/lib/telemetry/cli-command-trace.js +1 -1
  302. package/lib/telemetry/cli-help-trace.js +1 -1
  303. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  304. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  305. package/lib/telemetry/send-cli-trace-log.js +1 -1
  306. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  307. package/lib/utils/ai_config.js +1 -1
  308. package/lib/utils/apply-jq-filter.js +1 -1
  309. package/lib/utils/cdn-config.js +1 -1
  310. package/lib/utils/check-sdk-version.js +1 -1
  311. package/lib/utils/cli-version-check.js +1 -1
  312. package/lib/utils/cli-version-policy.js +1 -1
  313. package/lib/utils/config.js +1 -1
  314. package/lib/utils/entity-with-id.js +1 -1
  315. package/lib/utils/file-utils.js +1 -1
  316. package/lib/utils/guides-cdn.js +1 -1
  317. package/lib/utils/http-client.js +1 -1
  318. package/lib/utils/is-non-interactive.js +1 -1
  319. package/lib/utils/logger.js +1 -1
  320. package/lib/utils/params.js +1 -1
  321. package/lib/utils/platform.d.ts +6 -5
  322. package/lib/utils/platform.js +1 -1
  323. package/lib/utils/sleep.js +1 -1
  324. package/lib/utils/template-replacer.js +1 -1
  325. package/lib/utils/update-notice.js +1 -1
  326. package/lib/utils/version.js +1 -1
  327. package/lib/utils/with-active-cookie.js +1 -1
  328. package/lib/utils/write-cli-side-channel.js +1 -1
  329. package/package.json +2 -1
  330. package/skills/rabetbase/SKILL.md +5 -5
  331. package/skills/rabetbase/guides/custom-page-workflow.md +35 -17
  332. package/skills/rabetbase/guides/page-development-workflow.md +1 -1
  333. package/skills/rabetbase/knowledge/components.md +292 -0
  334. package/skills/rabetbase/knowledge/custom-page/generation-standards.md +74 -4
  335. package/skills/rabetbase/knowledge/custom-page/page-templates.md +68 -0
  336. package/skills/rabetbase/references/rabetbase-page-create.md +21 -9
  337. package/skills/rabetbase/references/rabetbase-page-custom-detail.md +1 -1
  338. package/skills/rabetbase/references/rabetbase-page-custom-update.md +13 -9
  339. package/skills/rabetbase/references/rabetbase-project-create.md +5 -2
  340. package/skills/rabetbase/references/rabetbase-project-domain-routing-sync.md +2 -2
  341. package/skills/rabetbase/references/rabetbase-run.md +1 -0
  342. package/skills/rabetbase.manifest.json +5 -4
  343. package/templates/README.md +10 -4
  344. package/templates/custom-pages/blank.json +5 -0
  345. package/templates/custom-pages/dashboard.json +5 -0
  346. package/templates/custom-pages/onepage.json +5 -0
  347. package/templates/generate-api/api.ts.tpl +1 -1
  348. package/lib/commands/page/custom/template.d.ts +0 -8
  349. package/lib/commands/page/custom/template.js +0 -1
  350. package/skills/rabetbase/knowledge/custom-page/components.md +0 -225
@@ -1 +1 @@
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
+ const a206_0x4caa08=a206_0x2cc3;function a206_0x3882(){const _0x3b3784=['8nuFong','scripts','.bin','\x22\x20not\x20found\x20in\x20package.json.','validation','186AciGYm','push','--watch','node_modules','bool','No\x20scripts\x20defined\x20in\x20package.json.','\x0a\x20\x20Usage:\x20','yarn.lock','package.json','build','pnpm-lock.yaml','error','Domain\x20routing\x20synchronized:\x20','\x20run\x20<script>\x0a','dev','yarn','\x20run\x20','changed','path','Run\x20a\x20package.json\x20script','join','Available:\x20','bun.lockb','224300Yimjkr','needsUpgrade','npm','length','952514DhlhLc','\x20\x20\x20\x20','cwd','keys','Script\x20name\x20defined\x20in\x20package.json','parse','run','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','args','\x20run\x20preview\x20--watch','\x20run\x20start','vite','watch','1416108RcXiHd','start','Enable\x20watch\x20mode\x20for\x20preview','log','pnpm','preview','vite\x20preview\x20exited\x20with\x20code\x20','inherit','70qWxSnB','belowMinimum','all','1221486CMLapL','close','26838955eHYDrz','has','1396863EmzSQR','5tgJgVf','(none)','script','slice','Script\x20\x22','utf-8','26690VFdHyr'];a206_0x3882=function(){return _0x3b3784;};return a206_0x3882();}(function(_0x260d1a,_0x51b061){const _0x5a092e=a206_0x2cc3,_0x2730c2=_0x260d1a();while(!![]){try{const _0xbc4650=parseInt(_0x5a092e(0xb4))/0x1+-parseInt(_0x5a092e(0xd7))/0x2*(-parseInt(_0x5a092e(0xdd))/0x3)+-parseInt(_0x5a092e(0xb0))/0x4+-parseInt(_0x5a092e(0xd1))/0x5*(-parseInt(_0x5a092e(0xc1))/0x6)+parseInt(_0x5a092e(0xcc))/0x7*(parseInt(_0x5a092e(0xd8))/0x8)+parseInt(_0x5a092e(0xd0))/0x9*(parseInt(_0x5a092e(0xc9))/0xa)+-parseInt(_0x5a092e(0xce))/0xb;if(_0xbc4650===_0x51b061)break;else _0x2730c2['push'](_0x2730c2['shift']());}catch(_0x7d8c04){_0x2730c2['push'](_0x2730c2['shift']());}}}(a206_0x3882,0xbea59));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{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';function a206_0x2cc3(_0x1a5f23,_0x7c289a){_0x1a5f23=_0x1a5f23-0x9d;const _0x388247=a206_0x3882();let _0x2cc355=_0x388247[_0x1a5f23];return _0x2cc355;}import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.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',a206_0x4caa08(0xa7)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a206_0x4caa08(0xc2),a206_0x4caa08(0xa7),a206_0x4caa08(0xa2),'preview']);export function syncProjectDomainRoutingBeforeScript(_0x572fa8,_0x35b9a9){const _0x20a2d0=a206_0x4caa08;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x20a2d0(0xcf)](_0x35b9a9))return null;const _0x3fb225=findProjectRootDirectory(_0x572fa8);if(!resolveConfigPath(_0x3fb225))return null;const _0x23abf3=writeProjectDomainRoutingManifest(_0x3fb225);return{'path':_0x23abf3[_0x20a2d0(0xab)],'changed':_0x23abf3['changed']};}function readPackageScripts(_0x118a30){const _0x52b738=a206_0x4caa08,_0x3802b3=resolve(_0x118a30,_0x52b738(0xa1));if(!existsSync(_0x3802b3))return null;try{const _0x5b2896=JSON[_0x52b738(0xb9)](readFileSync(_0x3802b3,_0x52b738(0xd6)));return _0x5b2896[_0x52b738(0xd9)]??{};}catch{return null;}}function detectPackageManager(_0x3a11d7){const _0x35cda9=a206_0x4caa08;if(existsSync(resolve(_0x3a11d7,_0x35cda9(0xaf)))||existsSync(resolve(_0x3a11d7,'bun.lock')))return'bun';if(existsSync(resolve(_0x3a11d7,_0x35cda9(0xa3))))return _0x35cda9(0xc5);if(existsSync(resolve(_0x3a11d7,_0x35cda9(0xa0))))return _0x35cda9(0xa8);return _0x35cda9(0xb2);}async function versionCheck(_0x46177f){const _0xad66fe=a206_0x4caa08,_0x4b628c=await checkCliVersion();(_0x4b628c[_0xad66fe(0xb1)]||_0x4b628c[_0xad66fe(0xca)])&&(printCliUpgradeWarning(_0x4b628c),assertCliVersionSupported(_0x4b628c));const _0x309deb=await checkSdkVersion(_0x46177f);if(_0x309deb[_0xad66fe(0xb1)])printSdkUpgradeWarning(_0x309deb);}function spawnScript(_0x4e24f8,_0x3a70b3,_0x5bbdd8,_0x1e0116){return new Promise((_0x3128a1,_0x407a27)=>{const _0x55955d=a206_0x2cc3,_0x353a03=[_0x55955d(0xba),_0x3a70b3,..._0x5bbdd8],_0x5652d9=spawn(_0x4e24f8,_0x353a03,{'cwd':_0x1e0116,'stdio':_0x55955d(0xc8),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1e0116,_0x55955d(0xe0),'.bin')+delimiter+process.env.PATH}});_0x5652d9['on'](_0x55955d(0xcd),_0x19437c=>{const _0x5b7cab=_0x55955d;if(_0x19437c===0x0||_0x19437c===null)_0x3128a1();else _0x407a27(new Error(_0x4e24f8+_0x5b7cab(0xa9)+_0x3a70b3+'\x20exited\x20with\x20code\x20'+_0x19437c));}),_0x5652d9['on'](_0x55955d(0xa4),_0x407a27);});}function spawnViteBuildWatch(_0x54b6b4){return new Promise((_0x1f0a06,_0x1b978c)=>{const _0x4f10eb=a206_0x2cc3,_0x41cbe4=spawn(_0x4f10eb(0xbf),[_0x4f10eb(0xa2),_0x4f10eb(0xdf)],{'cwd':_0x54b6b4,'stdio':_0x4f10eb(0xc8),'shell':!![],'env':{...process.env,'PATH':''+join(_0x54b6b4,_0x4f10eb(0xe0),_0x4f10eb(0xda))+delimiter+process.env.PATH}});_0x41cbe4['on']('close',_0x5f173a=>{const _0x50c230=_0x4f10eb;if(_0x5f173a===0x0||_0x5f173a===null)_0x1f0a06();else _0x1b978c(new Error(_0x50c230(0xbb)+_0x5f173a));}),_0x41cbe4['on'](_0x4f10eb(0xa4),_0x1b978c);});}function spawnVitePreview(_0xf5f52c){return new Promise((_0x226f21,_0x290c10)=>{const _0x10458c=a206_0x2cc3,_0xc259ed=spawn(_0x10458c(0xbf),[_0x10458c(0xc6)],{'cwd':_0xf5f52c,'stdio':_0x10458c(0xc8),'shell':!![],'env':{...process.env,'PATH':''+join(_0xf5f52c,'node_modules',_0x10458c(0xda))+delimiter+process.env.PATH}});_0xc259ed['on'](_0x10458c(0xcd),_0xa9508f=>{const _0x4bb160=_0x10458c;if(_0xa9508f===0x0||_0xa9508f===null)_0x226f21();else _0x290c10(new Error(_0x4bb160(0xc7)+_0xa9508f));}),_0xc259ed['on'](_0x10458c(0xa4),_0x290c10);});}const runFlags=[{'name':a206_0x4caa08(0xc0),'type':'boolean','description':a206_0x4caa08(0xc3),'default':![]}];export const runDefinition={'service':a206_0x4caa08(0xba),'command':a206_0x4caa08(0xba),'description':a206_0x4caa08(0xac),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a206_0x4caa08(0xd3),'description':a206_0x4caa08(0xb8),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x265383=a206_0x4caa08,_0x34c9e6=[];return _0x34c9e6[_0x265383(0xde)]('\x20\x20EXAMPLES'),_0x34c9e6[_0x265383(0xde)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x265383(0xbe)),_0x34c9e6[_0x265383(0xde)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20build'),_0x34c9e6[_0x265383(0xde)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20preview'),_0x34c9e6['push'](_0x265383(0xb5)+CLI_BIN_NAME+_0x265383(0xbd)),_0x34c9e6[_0x265383(0xad)]('\x0a');},async 'execute'(_0x567fef){const _0x21ba02=a206_0x4caa08,_0x5633bc=process[_0x21ba02(0xb6)](),_0x1657b3=_0x567fef[_0x21ba02(0xbc)][0x0],_0xc4fdd9=_0x567fef[_0x21ba02(0xbc)][_0x21ba02(0xd4)](0x1),_0x2d4244=readPackageScripts(_0x5633bc);if(!_0x2d4244)throw CliErrors[_0x21ba02(0xdc)]('No\x20package.json\x20found\x20in\x20current\x20directory.');if(!_0x1657b3){const _0x5afa0e=Object['keys'](_0x2d4244);if(_0x5afa0e[_0x21ba02(0xb3)]===0x0)console[_0x21ba02(0xc4)](_0x21ba02(0x9e));else{console['log']('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x4d7b4b of _0x5afa0e){console[_0x21ba02(0xc4)]('\x20\x20\x20\x20'+_0x4d7b4b);}console[_0x21ba02(0xc4)](_0x21ba02(0x9f)+CLI_BIN_NAME+_0x21ba02(0xa6));}return{'ok':!![]};}if(!_0x2d4244[_0x1657b3])throw CliErrors[_0x21ba02(0xdc)](_0x21ba02(0xd5)+_0x1657b3+_0x21ba02(0xdb),_0x21ba02(0xae)+(Object[_0x21ba02(0xb7)](_0x2d4244)[_0x21ba02(0xad)](',\x20')||_0x21ba02(0xd2)));const _0x241bdf=detectPackageManager(_0x5633bc),_0x443dfc=syncProjectDomainRoutingBeforeScript(_0x5633bc,_0x1657b3);_0x443dfc?.[_0x21ba02(0xaa)]&&console['error'](_0x21ba02(0xa5)+_0x443dfc[_0x21ba02(0xab)]);VERSION_CHECK_SCRIPTS[_0x21ba02(0xcf)](_0x1657b3)&&await versionCheck(_0x5633bc);if(_0x1657b3===_0x21ba02(0xc6)&&_0x567fef[_0x21ba02(0x9d)](_0x21ba02(0xc0)))return await Promise[_0x21ba02(0xcb)]([spawnViteBuildWatch(_0x5633bc),spawnVitePreview(_0x5633bc)]),{'ok':!![]};return await spawnScript(_0x241bdf,_0x1657b3,_0xc4fdd9,_0x5633bc),{'ok':!![]};}};
@@ -1 +1 @@
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
+ function a207_0x2764(_0x46a7db,_0x223b00){_0x46a7db=_0x46a7db-0x173;const _0x355205=a207_0x3552();let _0x276497=_0x355205[_0x46a7db];return _0x276497;}const a207_0x503620=a207_0x2764;(function(_0x2390da,_0x29e31d){const _0x34b24b=a207_0x2764,_0x35b9fa=_0x2390da();while(!![]){try{const _0x3752f3=parseInt(_0x34b24b(0x173))/0x1*(parseInt(_0x34b24b(0x175))/0x2)+parseInt(_0x34b24b(0x17b))/0x3+parseInt(_0x34b24b(0x180))/0x4*(parseInt(_0x34b24b(0x17f))/0x5)+-parseInt(_0x34b24b(0x17a))/0x6+-parseInt(_0x34b24b(0x178))/0x7+-parseInt(_0x34b24b(0x17c))/0x8*(-parseInt(_0x34b24b(0x17e))/0x9)+parseInt(_0x34b24b(0x181))/0xa*(-parseInt(_0x34b24b(0x17d))/0xb);if(_0x3752f3===_0x29e31d)break;else _0x35b9fa['push'](_0x35b9fa['shift']());}catch(_0x3d7266){_0x35b9fa['push'](_0x35b9fa['shift']());}}}(a207_0x3552,0x9f774));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x5b170d){const _0x44dbac=await buildSchemaPayload();return{'ok':!![],'data':_0x44dbac};}export const schemaDefinition={'service':a207_0x503620(0x177),'command':a207_0x503620(0x174),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a207_0x503620(0x179),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a207_0x503620(0x176),'flags':[],'execute':execute};function a207_0x3552(){const _0x4a8ad0=['2231940eutoRf','1892728HBfcqu','180543VrbGDD','36vULbEe','2661665zKVNRC','4SndSNK','120MAzoDi','3PahyuA','export','463218eyVUlX','json','schema','8036133ByjULB','read','5516142AvvIMP'];a207_0x3552=function(){return _0x4a8ad0;};return a207_0x3552();}
@@ -1 +1 @@
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
+ const a208_0x724297=a208_0x2969;(function(_0x4382d4,_0x30aa30){const _0x59b950=a208_0x2969,_0x38a1b2=_0x4382d4();while(!![]){try{const _0x4ad06f=-parseInt(_0x59b950(0x184))/0x1+-parseInt(_0x59b950(0x173))/0x2*(parseInt(_0x59b950(0x182))/0x3)+-parseInt(_0x59b950(0x18f))/0x4*(-parseInt(_0x59b950(0x158))/0x5)+-parseInt(_0x59b950(0x187))/0x6+parseInt(_0x59b950(0x161))/0x7*(-parseInt(_0x59b950(0x15f))/0x8)+-parseInt(_0x59b950(0x172))/0x9+-parseInt(_0x59b950(0x17a))/0xa*(-parseInt(_0x59b950(0x15b))/0xb);if(_0x4ad06f===_0x30aa30)break;else _0x38a1b2['push'](_0x38a1b2['shift']());}catch(_0x22d5e5){_0x38a1b2['push'](_0x38a1b2['shift']());}}}(a208_0x2144,0x91d41));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a208_0x2969(_0x10ccce,_0x561392){_0x10ccce=_0x10ccce-0x153;const _0x2144e5=a208_0x2144();let _0x2969c5=_0x2144e5[_0x10ccce];return _0x2969c5;}function a208_0x2144(){const _0x176bd9=['1027330NbzuOf','dbName','number','737mSvVud','Select\x20the\x20target\x20database:','nonInteractive','name','8mqHNJz','Invalid\x20database\x20selection\x20payload:\x20','7565579MoFdUH','sql','<server-generated-sqlCode>','SELECT\x201\x20AS\x20id;','map','Select\x20the\x20local\x20SQL\x20mode:','appCode','Created\x20SQL\x20query\x20','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','Target\x20database\x20ID','sqlCode','validation','description','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','length','dbId','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','5535972jhaYPf','4RszgIW','mybatisXml','sqls','dbId\x20cannot\x20be\x20empty','join','trim','__manual__','596450RhrkCb','SQL\x20query\x20display\x20name','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','mode','catch','toISOString','MyBatis\x20XML\x20(mybatisXml)','/smartapi/custom/saveUserCustomSql','774546BoTTVH','write','1043183gUNzbL','parse','</select>','5791884KUbQZw','POST','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','str','dbId\x20must\x20be\x20a\x20positive\x20integer','flagMissing','Local\x20SQL\x20file\x20mode','16xrAHuP','sqlName','string','lockFilePath','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','sqlRootDir','isFinite','db-id','Plain\x20SQL\x20(sql)'];a208_0x2144=function(){return _0x176bd9;};return a208_0x2144();}import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x34c575){const _0x31c698=a208_0x2969;if(_0x34c575==='mybatisXml')return[_0x31c698(0x16e),'\x20\x20SELECT\x201\x20AS\x20id',_0x31c698(0x186),''][_0x31c698(0x177)]('\x0a');return[_0x31c698(0x164),''][_0x31c698(0x177)]('\x0a');}export const sqlCreate={'service':a208_0x724297(0x162),'command':'create','description':a208_0x724297(0x153),'risk':a208_0x724297(0x183),'flags':[{'name':a208_0x724297(0x15e),'type':a208_0x724297(0x191),'description':a208_0x724297(0x17b)},{'name':a208_0x724297(0x156),'type':a208_0x724297(0x15a),'description':a208_0x724297(0x16a)},{'name':'mode','type':'string','enum':[a208_0x724297(0x162),a208_0x724297(0x174)],'description':a208_0x724297(0x18e)}],async 'validate'(_0x5b9105){const _0x362260=a208_0x724297;if(!_0x5b9105[_0x362260(0x15d)])return;if(!_0x5b9105[_0x362260(0x18b)]('name')[_0x362260(0x178)]())throw CliErrors[_0x362260(0x18d)]('name',_0x362260(0x18a));const _0x278bae=resolveProvidedDbId(_0x5b9105);if(typeof _0x278bae!=='number'||!Number['isFinite'](_0x278bae)||_0x278bae<=0x0)throw CliErrors[_0x362260(0x18d)](_0x362260(0x156),_0x362260(0x17c));if(!_0x5b9105[_0x362260(0x18b)](_0x362260(0x17d))[_0x362260(0x178)]())throw CliErrors[_0x362260(0x18d)](_0x362260(0x17d),_0x362260(0x171));},async 'dryRun'(_0x18af31){const _0x2b7aef=a208_0x724297,_0x59ea6d=loadSqlProjectConfig(_0x18af31[_0x2b7aef(0x167)]),{sqlName:_0x1b3b58,dbId:_0x1b8275,dbName:_0x38c680,mode:_0x5b327a}=await resolveSqlNewInputs(_0x18af31),_0x1ace55=buildSqlRelativePath(_0x2b7aef(0x163),_0x1b3b58,_0x38c680,_0x5b327a,_0x1b8275),_0x435c01=_0x59ea6d[_0x2b7aef(0x154)]+'/'+_0x1ace55;return{'method':_0x2b7aef(0x188),'url':_0x2b7aef(0x181),'body':{'appCode':_0x18af31[_0x2b7aef(0x167)],'sqlName':_0x1b3b58,'dbId':_0x1b8275,'mode':_0x5b327a,'localPath':_0x435c01},'description':_0x2b7aef(0x189)+_0x59ea6d[_0x2b7aef(0x154)]};},async 'execute'(_0x4b2c5b){const _0x40ff65=a208_0x724297,_0x4f6953=loadSqlProjectConfig(_0x4b2c5b[_0x40ff65(0x167)]),{sqlName:_0x216ec9,dbId:_0xa38c1f,dbName:_0x1f6b85,mode:_0x57df19}=await resolveSqlNewInputs(_0x4b2c5b),_0x5ed8a1=generateSqlTemplate(_0x57df19),_0x46d4a4=await createSqlQuery({'appCode':_0x4b2c5b[_0x40ff65(0x167)],'sqlName':_0x216ec9,'dbId':_0xa38c1f,'sqlContent':_0x5ed8a1}),_0x503c00=ensureRemoteSqlContent(_0x46d4a4),_0x3db0d5=_0x1f6b85||await getDbName(_0x4b2c5b['appCode'],_0xa38c1f)[_0x40ff65(0x17e)](()=>undefined),_0xd53b4c=buildSqlRelativePath(_0x46d4a4[_0x40ff65(0x16b)],_0x46d4a4[_0x40ff65(0x190)],_0x3db0d5,_0x57df19,_0xa38c1f),_0x30bd61=_0x4f6953[_0x40ff65(0x154)]+'/'+_0xd53b4c,_0x3e8bc0=buildLocalSqlFileContent({'sqlCode':_0x46d4a4['sqlCode'],'sqlName':_0x46d4a4[_0x40ff65(0x190)],'dbId':_0x46d4a4[_0x40ff65(0x170)]},_0x503c00,{'dbName':_0x3db0d5,'mode':_0x57df19,'syncedAt':new Date()[_0x40ff65(0x17f)](),'description':_0x46d4a4[_0x40ff65(0x16d)]});if(await fileExists(_0x30bd61))throw CliErrors[_0x40ff65(0x16c)]('File\x20already\x20exists:\x20'+_0x30bd61);await ensureParentDirectory(_0x30bd61),await writeFile(_0x30bd61,_0x3e8bc0,'utf8');const _0x4f4430=await readSqlLockFile(_0x4f6953[_0x40ff65(0x192)]),{lockData:_0x18ccf5,appLock:_0x239b49}=ensureSqlLockScope(_0x4f4430??createEmptySqlLock(),_0x4f6953[_0x40ff65(0x167)],_0x4f6953['sqlRoot'],'new');return _0x239b49[_0x40ff65(0x175)][_0x46d4a4[_0x40ff65(0x16b)]]={...buildSqlLockEntry(_0x46d4a4,_0x503c00,computeSqlContentHash(_0x3e8bc0),{'dbName':_0x3db0d5}),'path':_0xd53b4c,'mode':_0x57df19},_0x239b49['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x4f6953[_0x40ff65(0x192)],_0x18ccf5),{'ok':!![],'data':{'id':_0x46d4a4['id'],'sqlCode':_0x46d4a4[_0x40ff65(0x16b)],'sqlName':_0x46d4a4[_0x40ff65(0x190)],'dbId':_0x46d4a4['dbId'],'path':_0x30bd61,'mode':_0x57df19},'message':_0x40ff65(0x168)+_0x46d4a4['sqlCode']};}};async function resolveSqlNewInputs(_0x8affd0){const _0x399f03=await resolveSqlNameInput(_0x8affd0),{dbId:_0xa30e3c,dbName:_0x2d01c1}=await resolveDbSelection(_0x8affd0),_0x1f9393=await resolveSqlModeInput(_0x8affd0);return{'sqlName':_0x399f03,'dbId':_0xa30e3c,'dbName':_0x2d01c1,'mode':_0x1f9393};}async function resolveSqlNameInput(_0x5c6870){const _0x2a9024=a208_0x724297,_0x28a9c1=_0x5c6870[_0x2a9024(0x18b)]('name')[_0x2a9024(0x178)]();if(_0x28a9c1)return _0x28a9c1;if(_0x5c6870['nonInteractive'])throw CliErrors[_0x2a9024(0x18d)](_0x2a9024(0x15e),_0x2a9024(0x18a));return(await input({'message':'SQL\x20name:','validate':_0x34707e=>_0x34707e[_0x2a9024(0x178)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))['trim']();}async function resolveDbSelection(_0x3bbe88){const _0x1396b3=a208_0x724297,_0x4e912a=resolveProvidedDbId(_0x3bbe88);if(typeof _0x4e912a==='number'&&Number['isFinite'](_0x4e912a)&&_0x4e912a>0x0)return{'dbId':_0x4e912a,'dbName':await getDbName(_0x3bbe88[_0x1396b3(0x167)],_0x4e912a)[_0x1396b3(0x17e)](()=>undefined)};if(_0x3bbe88[_0x1396b3(0x15d)])throw CliErrors[_0x1396b3(0x18d)](_0x1396b3(0x156),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x18bd9e=await listDatabases(_0x3bbe88[_0x1396b3(0x167)])[_0x1396b3(0x17e)](()=>[]);if(_0x18bd9e[_0x1396b3(0x16f)]===0x1)return{'dbId':_0x18bd9e[0x0]['dbId'],'dbName':_0x18bd9e[0x0][_0x1396b3(0x159)]};if(_0x18bd9e['length']>0x1){const _0x1e20ea=await select({'message':_0x1396b3(0x15c),'choices':[..._0x18bd9e[_0x1396b3(0x165)](_0x3539bc=>({'name':_0x3539bc['dbName']+'\x20('+_0x3539bc['dbId']+')','value':serializeDbSelection(_0x3539bc)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':_0x1396b3(0x179)}]});if(_0x1e20ea!==_0x1396b3(0x179))return deserializeDbSelection(_0x1e20ea);}const _0x155947=await input({'message':'Target\x20database\x20dbId:','validate':_0x56a922=>{const _0x3fb0f8=_0x1396b3,_0x57a605=_0x56a922[_0x3fb0f8(0x178)]();if(!_0x57a605)return _0x3fb0f8(0x176);const _0x3ec7d5=Number(_0x57a605);if(!Number['isInteger'](_0x3ec7d5)||_0x3ec7d5<=0x0)return _0x3fb0f8(0x18c);return!![];}});return{'dbId':Number(_0x155947[_0x1396b3(0x178)]())};}async function resolveSqlModeInput(_0x47a6ea){const _0x2ccfc9=a208_0x724297,_0x19759c=_0x47a6ea[_0x2ccfc9(0x18b)]('mode')[_0x2ccfc9(0x178)]();if(_0x19759c===_0x2ccfc9(0x162)||_0x19759c===_0x2ccfc9(0x174))return _0x19759c;if(_0x47a6ea[_0x2ccfc9(0x15d)])throw CliErrors[_0x2ccfc9(0x18d)](_0x2ccfc9(0x17d),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x2ccfc9(0x166),'choices':[{'name':_0x2ccfc9(0x157),'value':_0x2ccfc9(0x162),'description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x2ccfc9(0x180),'value':_0x2ccfc9(0x174),'description':_0x2ccfc9(0x169)}]});}function serializeDbSelection(_0x565e1f){const _0x361107=a208_0x724297;return JSON['stringify']({'dbId':_0x565e1f[_0x361107(0x170)],'dbName':_0x565e1f[_0x361107(0x159)]});}function deserializeDbSelection(_0x57c3f8){const _0x1aa886=a208_0x724297;try{const _0x44e398=JSON[_0x1aa886(0x185)](_0x57c3f8);if(typeof _0x44e398[_0x1aa886(0x170)]==='number'&&Number[_0x1aa886(0x155)](_0x44e398[_0x1aa886(0x170)]))return{'dbId':_0x44e398[_0x1aa886(0x170)],'dbName':_0x44e398[_0x1aa886(0x159)]};}catch{}throw CliErrors[_0x1aa886(0x16c)](_0x1aa886(0x160)+_0x57c3f8);}function resolveProvidedDbId(_0x27a69f){const _0x32318d=a208_0x724297,_0x4f2f71=_0x27a69f['flag'](_0x32318d(0x156));if(typeof _0x4f2f71==='number'&&Number[_0x32318d(0x155)](_0x4f2f71))return _0x4f2f71;return undefined;}
@@ -1 +1 @@
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
+ const a209_0x2a60cc=a209_0x4e16;(function(_0x5896d2,_0x44c490){const _0x7eda22=a209_0x4e16,_0x22af1d=_0x5896d2();while(!![]){try{const _0x25d091=-parseInt(_0x7eda22(0x196))/0x1*(-parseInt(_0x7eda22(0x182))/0x2)+-parseInt(_0x7eda22(0x19a))/0x3*(-parseInt(_0x7eda22(0x184))/0x4)+-parseInt(_0x7eda22(0x1a0))/0x5*(parseInt(_0x7eda22(0x199))/0x6)+-parseInt(_0x7eda22(0x18c))/0x7*(parseInt(_0x7eda22(0x1a7))/0x8)+parseInt(_0x7eda22(0x191))/0x9+parseInt(_0x7eda22(0x18b))/0xa+parseInt(_0x7eda22(0x1aa))/0xb*(-parseInt(_0x7eda22(0x189))/0xc);if(_0x25d091===_0x44c490)break;else _0x22af1d['push'](_0x22af1d['shift']());}catch(_0x43f3e7){_0x22af1d['push'](_0x22af1d['shift']());}}}(a209_0x2a0e,0x444a6));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';function a209_0x4e16(_0x1e17e6,_0x40d2a1){_0x1e17e6=_0x1e17e6-0x182;const _0x2a0e94=a209_0x2a0e();let _0x4e1649=_0x2a0e94[_0x1e17e6];return _0x4e1649;}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':'sql','command':'delete','description':a209_0x2a60cc(0x1a4),'risk':a209_0x2a60cc(0x183),'flags':[SQLCODE_FLAG],async 'validate'(_0x18ec69){const _0x1c198e=a209_0x2a60cc,_0x336d06=loadSqlProjectConfig(_0x18ec69[_0x1c198e(0x197)]),_0x1ad879=await readSqlLockFile(_0x336d06[_0x1c198e(0x1a5)]);if(!_0x1ad879)throw CliErrors[_0x1c198e(0x1a2)](_0x1c198e(0x19b));},async 'dryRun'(_0x1faaa6){const _0xa839a3=a209_0x2a60cc,_0x519912=loadSqlProjectConfig(_0x1faaa6[_0xa839a3(0x197)]),_0x1a807c=await readSqlLockFile(_0x519912['lockFilePath']);if(!_0x1a807c)throw CliErrors[_0xa839a3(0x1a2)](_0xa839a3(0x19b));const {appLock:_0x4d24a5}=ensureSqlLockScope(_0x1a807c,_0x1faaa6['appCode'],_0x519912['sqlRoot'],_0xa839a3(0x18a)),_0x117479=_0x1faaa6['str']('sqlcode'),_0xbab0a8=_0x4d24a5['sqls'][_0x117479];if(!_0xbab0a8)throw CliErrors['validation']('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x117479+'\x22.');return{'method':_0xa839a3(0x18d),'url':_0xa839a3(0x195),'body':{'sqlCode':_0x117479,'id':_0xbab0a8['remoteId'],'localPath':resolveLocalSqlFilePath(_0x519912,_0x117479,_0xbab0a8)},'description':_0xa839a3(0x186)+_0x117479+_0xa839a3(0x1a9)+_0x519912[_0xa839a3(0x18e)]};},async 'execute'(_0x261222){const _0x13f9f5=a209_0x2a60cc,_0x3d1a6e=loadSqlProjectConfig(_0x261222['appCode']),_0x482de6=await readSqlLockFile(_0x3d1a6e[_0x13f9f5(0x1a5)]);if(!_0x482de6)throw CliErrors['validation'](_0x13f9f5(0x188));const {lockData:_0xdbdb8f,appLock:_0x3e872a}=ensureSqlLockScope(_0x482de6,_0x261222[_0x13f9f5(0x197)],_0x3d1a6e[_0x13f9f5(0x1a6)],_0x13f9f5(0x18a)),_0x1d79d1=_0x261222[_0x13f9f5(0x19c)](_0x13f9f5(0x193)),_0x423614=_0x3e872a[_0x13f9f5(0x190)][_0x1d79d1];if(!_0x423614)throw CliErrors[_0x13f9f5(0x1a2)](_0x13f9f5(0x1a8)+_0x1d79d1+'\x22.');await deleteSqlQuery({'id':_0x423614[_0x13f9f5(0x1a3)],'sqlCode':_0x1d79d1}),_0x3e872a[_0x13f9f5(0x190)]=Object[_0x13f9f5(0x19d)](Object['entries'](_0x3e872a[_0x13f9f5(0x190)])[_0x13f9f5(0x19e)](([_0x18fdd6])=>_0x18fdd6!==_0x1d79d1)),_0x3e872a[_0x13f9f5(0x192)]=new Date()['toISOString'](),await writeSqlLockFile(_0x3d1a6e['lockFilePath'],_0xdbdb8f);const _0x1f9f52=resolveLocalSqlFilePath(_0x3d1a6e,_0x1d79d1,_0x423614);let _0x19f31e;await fileExists(_0x1f9f52)&&(_0x19f31e=await moveToTrash(_0x3d1a6e[_0x13f9f5(0x194)],_0x3d1a6e[_0x13f9f5(0x18e)],_0x1f9f52),await cleanupEmptyDirectories(dirname(_0x1f9f52),_0x3d1a6e['sqlRootDir']));const _0x4a4d8d={'deleted':_0x1d79d1,'remoteId':_0x423614['remoteId']};if(_0x19f31e)_0x4a4d8d['trashedTo']=_0x19f31e;return{'ok':!![],'data':_0x4a4d8d,'message':_0x13f9f5(0x1a1)+_0x1d79d1+(_0x19f31e?_0x13f9f5(0x198):'')};}};async function moveToTrash(_0x110024,_0x305458,_0x10cc50){const _0x11d7f8=a209_0x2a60cc,_0x39bbb5=new Date()[_0x11d7f8(0x18f)]()[_0x11d7f8(0x187)](/[:.]/g,'-'),_0x3cb110=relative(_0x110024,_0x10cc50),_0x4f51fb=join(_0x305458,_0x39bbb5,_0x3cb110);return await mkdir(dirname(_0x4f51fb),{'recursive':!![]}),await rename(_0x10cc50,_0x4f51fb),_0x4f51fb;}async function cleanupEmptyDirectories(_0x5a7e1c,_0x2b801a){const _0x57e65a=a209_0x2a60cc;let _0x2365ef=resolve(_0x5a7e1c);const _0x48dc71=resolve(_0x2b801a);while(_0x2365ef[_0x57e65a(0x185)](''+_0x48dc71+sep)||_0x2365ef===_0x48dc71){if(_0x2365ef===_0x48dc71)return;try{const _0x5e3474=await readdir(_0x2365ef);if(_0x5e3474[_0x57e65a(0x19f)]>0x0)return;await rmdir(_0x2365ef);}catch{return;}_0x2365ef=dirname(_0x2365ef);}}function a209_0x2a0e(){const _0x2e9fc7=['/smartapi/custom/deleteUserCustomSql','10931vmWsKp','appCode','\x20(local\x20file\x20moved\x20to\x20trash)','8412RCsrDg','1155AfftzL','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','str','fromEntries','filter','length','160oxAtAE','Deleted\x20','validation','remoteId','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','lockFilePath','sqlRoot','1477552WXFtjy','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','11QOPuLv','68dqZuQv','high-risk-write','5700TzBzRi','startsWith','Would\x20delete\x20SQL\x20','replace','SQL\x20lock\x20file\x20not\x20found.','9448092ushajr','delete','5079350aJcwag','21wmcoLP','POST','trashDir','toISOString','sqls','2140119HecBKG','lastSync','sqlcode','projectRoot'];a209_0x2a0e=function(){return _0x2e9fc7;};return a209_0x2a0e();}
@@ -1 +1 @@
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
+ const a210_0x5432dd=a210_0x2937;function a210_0x2937(_0x486e66,_0x31ec6c){_0x486e66=_0x486e66-0x165;const _0x1fd218=a210_0x1fd2();let _0x293742=_0x1fd218[_0x486e66];return _0x293742;}(function(_0x338944,_0x5b2b03){const _0x424a1f=a210_0x2937,_0xdbd7ff=_0x338944();while(!![]){try{const _0x10dd88=parseInt(_0x424a1f(0x16d))/0x1*(-parseInt(_0x424a1f(0x177))/0x2)+parseInt(_0x424a1f(0x171))/0x3*(parseInt(_0x424a1f(0x172))/0x4)+-parseInt(_0x424a1f(0x166))/0x5+parseInt(_0x424a1f(0x179))/0x6*(-parseInt(_0x424a1f(0x16a))/0x7)+parseInt(_0x424a1f(0x174))/0x8+-parseInt(_0x424a1f(0x16c))/0x9*(-parseInt(_0x424a1f(0x173))/0xa)+parseInt(_0x424a1f(0x178))/0xb*(parseInt(_0x424a1f(0x175))/0xc);if(_0x10dd88===_0x5b2b03)break;else _0xdbd7ff['push'](_0xdbd7ff['shift']());}catch(_0x4d0a56){_0xdbd7ff['push'](_0xdbd7ff['shift']());}}}(a210_0x1fd2,0x81cb2));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a210_0x1fd2(){const _0x26409b=['106590ZjAabX','1672WEMexv','9750CVuTvN','sqlCode','verbose','boolean','bool','sqlContent','4743835wpjGfZ','detail','str','appCode','3871bFCaGQ','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','9pwHtDp','14msNYKy','dbId','sqlcode','read','3ptlGtR','1187400epiqTe','913830UMKaTv','8170392wcAlRD','135444TMUxOT','sql'];a210_0x1fd2=function(){return _0x26409b;};return a210_0x1fd2();}export const sqlDetail={'service':a210_0x5432dd(0x176),'command':a210_0x5432dd(0x167),'description':a210_0x5432dd(0x16b),'risk':a210_0x5432dd(0x170),'flags':[SQLCODE_FLAG,{'name':a210_0x5432dd(0x17b),'type':a210_0x5432dd(0x17c),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0xc8104f){const _0x476e02=a210_0x5432dd,_0x4eb4e6=await getSqlQueryInfo(_0xc8104f[_0x476e02(0x169)],_0xc8104f[_0x476e02(0x168)](_0x476e02(0x16f))),_0x4b6637=_0xc8104f[_0x476e02(0x17d)](_0x476e02(0x17b));if(_0x4b6637)return{'ok':!![],'data':_0x4eb4e6};const _0x37d055=_0x4eb4e6['dbId']?await getDbName(_0xc8104f[_0x476e02(0x169)],_0x4eb4e6[_0x476e02(0x16e)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x4eb4e6[_0x476e02(0x17a)],'sqlName':_0x4eb4e6['sqlName'],'db':_0x37d055?_0x37d055+'\x20('+_0x4eb4e6['dbId']+')':_0x4eb4e6['dbId']??'','description':_0x4eb4e6['description']??'','sqlContent':_0x4eb4e6[_0x476e02(0x165)]??''}};}};
@@ -1 +1 @@
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
+ const a211_0xc04b8e=a211_0x39e2;(function(_0x362f98,_0x4d173f){const _0x464f50=a211_0x39e2,_0x596329=_0x362f98();while(!![]){try{const _0x469ff7=-parseInt(_0x464f50(0xe7))/0x1+parseInt(_0x464f50(0xeb))/0x2+parseInt(_0x464f50(0xed))/0x3+-parseInt(_0x464f50(0xec))/0x4*(-parseInt(_0x464f50(0xe2))/0x5)+parseInt(_0x464f50(0xe1))/0x6*(parseInt(_0x464f50(0xee))/0x7)+parseInt(_0x464f50(0xdc))/0x8+-parseInt(_0x464f50(0xe6))/0x9;if(_0x469ff7===_0x4d173f)break;else _0x596329['push'](_0x596329['shift']());}catch(_0x3ca0a6){_0x596329['push'](_0x596329['shift']());}}}(a211_0x411d,0xea9ef));import{executeSql}from'../../core/api-client.js';function a211_0x39e2(_0x1d8c39,_0x261b1c){_0x1d8c39=_0x1d8c39-0xd9;const _0x411d0e=a211_0x411d();let _0x39e297=_0x411d0e[_0x1d8c39];return _0x39e297;}function a211_0x411d(){const _0x5ed8cb=['sql','1970304vTbibo','execResult','exec','params','execError','3804DIUlZj','113340EoPaVD','str','SQL\x20execution\x20failed','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','23758695HvWLGC','1332617djFMEk','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','string','sqlcode','1449082JvWgod','324hRwIyU','4471920pCWjEi','7021snumLC','execSuccess','now','isArray'];a211_0x411d=function(){return _0x5ed8cb;};return a211_0x411d();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a211_0xc04b8e(0xdb),'command':a211_0xc04b8e(0xde),'description':a211_0xc04b8e(0xe5),'risk':'read','flags':[SQLCODE_FLAG,{'name':a211_0xc04b8e(0xdf),'type':a211_0xc04b8e(0xe9),'description':a211_0xc04b8e(0xe8)}],async 'execute'(_0x57de62){const _0x3a55d4=a211_0xc04b8e,_0x1d7d6a=parseJsonParams(_0x57de62[_0x3a55d4(0xe3)](_0x3a55d4(0xdf))),_0x1c9e5e=Date[_0x3a55d4(0xd9)](),_0x228e75=await executeSql(_0x57de62['appCode'],_0x57de62[_0x3a55d4(0xe3)](_0x3a55d4(0xea)),_0x1d7d6a),_0x1853cb=Date[_0x3a55d4(0xd9)]()-_0x1c9e5e,_0x52ae47=_0x228e75?.[_0x3a55d4(0xdd)]??_0x228e75,_0x9a9408=_0x228e75?.[_0x3a55d4(0xef)]??!![];if(!_0x9a9408)return{'ok':![],'data':{'error':_0x228e75?.[_0x3a55d4(0xe0)]||_0x3a55d4(0xe4),'elapsed':_0x1853cb},'message':_0x3a55d4(0xe4)};const _0x50b3b1=Array[_0x3a55d4(0xda)](_0x52ae47)?_0x52ae47:[];return{'ok':!![],'data':{'rows':_0x50b3b1,'rowCount':_0x50b3b1['length'],'elapsed':_0x1853cb},'message':'Returned\x20'+_0x50b3b1['length']+'\x20row(s)\x20in\x20'+_0x1853cb+'ms'};}};
@@ -1 +1 @@
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
+ function a212_0x36b6(){const _0x21481f=['264337qkOOGf','336110fjsBXa','4718872WerVJV','1003135Oiwvps','6xFajKo','24xcuQhc','10eJGMDX','625167JrqNIx','1928928TPFLql','92790pIgBQP'];a212_0x36b6=function(){return _0x21481f;};return a212_0x36b6();}(function(_0x1b702f,_0x4a2e5c){const _0x1ca4ba=a212_0x2fe4,_0x563a7c=_0x1b702f();while(!![]){try{const _0x2664e0=-parseInt(_0x1ca4ba(0x11d))/0x1+-parseInt(_0x1ca4ba(0x122))/0x2*(parseInt(_0x1ca4ba(0x11c))/0x3)+parseInt(_0x1ca4ba(0x11b))/0x4+-parseInt(_0x1ca4ba(0x11e))/0x5+parseInt(_0x1ca4ba(0x121))/0x6*(-parseInt(_0x1ca4ba(0x120))/0x7)+parseInt(_0x1ca4ba(0x11f))/0x8+-parseInt(_0x1ca4ba(0x11a))/0x9*(-parseInt(_0x1ca4ba(0x119))/0xa);if(_0x2664e0===_0x4a2e5c)break;else _0x563a7c['push'](_0x563a7c['shift']());}catch(_0x4eac3b){_0x563a7c['push'](_0x563a7c['shift']());}}}(a212_0x36b6,0x4826a));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';import{sqlPull}from'../../commands/sql/pull.js';function a212_0x2fe4(_0x1b9742,_0x1e3400){_0x1b9742=_0x1b9742-0x119;const _0x36b6ab=a212_0x36b6();let _0x2fe4e8=_0x36b6ab[_0x1b9742];return _0x2fe4e8;}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 +1 @@
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
+ const a213_0x10bc24=a213_0x5eda;(function(_0x919be,_0x10c35a){const _0x11fa90=a213_0x5eda,_0xf5734b=_0x919be();while(!![]){try{const _0x4caf0c=parseInt(_0x11fa90(0x1a7))/0x1+parseInt(_0x11fa90(0x1b7))/0x2+parseInt(_0x11fa90(0x1c7))/0x3+parseInt(_0x11fa90(0x1ae))/0x4+parseInt(_0x11fa90(0x1a8))/0x5+parseInt(_0x11fa90(0x1bc))/0x6+-parseInt(_0x11fa90(0x1b0))/0x7*(parseInt(_0x11fa90(0x1bd))/0x8);if(_0x4caf0c===_0x10c35a)break;else _0xf5734b['push'](_0xf5734b['shift']());}catch(_0x50584c){_0xf5734b['push'](_0xf5734b['shift']());}}}(a213_0x3c93,0x2997a));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a213_0x10bc24(0x1bb),'command':a213_0x10bc24(0x1c4),'description':a213_0x10bc24(0x1b8),'risk':a213_0x10bc24(0x1ad),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a213_0x10bc24(0x1a4),'description':'Filter\x20by\x20SQL\x20name'},{'name':a213_0x10bc24(0x1c0),'type':a213_0x10bc24(0x1a6),'description':a213_0x10bc24(0x1ba),'default':0x1},{'name':a213_0x10bc24(0x1b6),'type':a213_0x10bc24(0x1a6),'description':a213_0x10bc24(0x1c1)},{'name':a213_0x10bc24(0x1b3),'type':a213_0x10bc24(0x1b9),'description':a213_0x10bc24(0x1c2)}],async 'execute'(_0x12477d){const _0x14dab5=a213_0x10bc24,_0x35928c=await listSqlQueries(_0x12477d[_0x14dab5(0x1be)],{'sqlCode':_0x12477d['str'](_0x14dab5(0x1c3))||undefined,'sqlName':_0x12477d['str'](_0x14dab5(0x1bf))||undefined,'currentPage':_0x12477d['num']('page'),'pageSize':_0x12477d['num']('pagesize',0x32)}),_0xbf056=_0x12477d[_0x14dab5(0x1ac)]('verbose'),_0x354fd6=_0x35928c['tableData']??[],_0x58c9af=_0x35928c[_0x14dab5(0x1b5)]?.[_0x14dab5(0x1c6)]??_0x354fd6[_0x14dab5(0x1a9)];let _0x1cd877;return _0xbf056?_0x1cd877=_0x354fd6:_0x1cd877=await Promise[_0x14dab5(0x1b1)](_0x354fd6[_0x14dab5(0x1af)](async _0x45c4b8=>{const _0x28312c=_0x14dab5;let _0x5ac944;try{_0x5ac944=_0x45c4b8['dbId']?await getDbName(_0x12477d[_0x28312c(0x1be)],_0x45c4b8[_0x28312c(0x1c5)]):undefined;}catch{}return{'sqlCode':_0x45c4b8['sqlCode'],'sqlName':_0x45c4b8[_0x28312c(0x1b4)],'description':_0x45c4b8[_0x28312c(0x1ab)]??'','db':_0x5ac944?_0x5ac944+'\x20('+_0x45c4b8[_0x28312c(0x1c5)]+')':_0x45c4b8[_0x28312c(0x1c5)]??''};})),{'ok':!![],'data':_0x1cd877,'message':_0x354fd6[_0x14dab5(0x1a9)]===0x0?_0x14dab5(0x1a5):_0x14dab5(0x1b2)+_0x354fd6[_0x14dab5(0x1a9)]+_0x14dab5(0x1aa)+_0x58c9af+').'};}};function a213_0x5eda(_0x540df0,_0x1089b3){_0x540df0=_0x540df0-0x1a4;const _0x3c9316=a213_0x3c93();let _0x5eda85=_0x3c9316[_0x540df0];return _0x5eda85;}function a213_0x3c93(){const _0x5416da=['1660260KtXxLW','length','\x20SQL\x20queries\x20(total:\x20','description','bool','read','858960sHPCwD','map','7qBRgvv','all','Found\x20','verbose','sqlName','paging','pagesize','486692Lqddzh','List\x20custom\x20SQL\x20queries','boolean','Page\x20number','sql','1270452DYBkcg','9435472mNQLXL','appCode','name','page','Page\x20size','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','sqlcode','list','dbId','totalCount','677553rJgAVn','string','No\x20custom\x20SQL\x20queries\x20found.','number','122065RxmOJO'];a213_0x3c93=function(){return _0x5416da;};return a213_0x3c93();}
@@ -1 +1 @@
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
+ function a214_0x53e4(_0x2bf5a5,_0x2c43d9){_0x2bf5a5=_0x2bf5a5-0x153;const _0x5cf1c3=a214_0x5cf1();let _0x53e4b7=_0x5cf1c3[_0x2bf5a5];return _0x53e4b7;}const a214_0x6a568a=a214_0x53e4;(function(_0x2309d1,_0x2a0fae){const _0x249ad3=a214_0x53e4,_0x384cbf=_0x2309d1();while(!![]){try{const _0x39de40=parseInt(_0x249ad3(0x175))/0x1*(parseInt(_0x249ad3(0x188))/0x2)+parseInt(_0x249ad3(0x174))/0x3+parseInt(_0x249ad3(0x15f))/0x4+parseInt(_0x249ad3(0x161))/0x5*(parseInt(_0x249ad3(0x16e))/0x6)+-parseInt(_0x249ad3(0x171))/0x7+parseInt(_0x249ad3(0x16c))/0x8*(-parseInt(_0x249ad3(0x18a))/0x9)+parseInt(_0x249ad3(0x17c))/0xa;if(_0x39de40===_0x2a0fae)break;else _0x384cbf['push'](_0x384cbf['shift']());}catch(_0x2a5016){_0x384cbf['push'](_0x384cbf['shift']());}}}(a214_0x5cf1,0x5ffe5));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x29b4a2,_0x390fd8){const _0x411e5c=a214_0x53e4,_0x4aaf9b=[];let _0x2f2498=0x1;while(!![]){const _0x472d57=await listSqlQueries(_0x29b4a2,{'currentPage':_0x2f2498,'pageSize':PAGE_SIZE,'sqlCode':_0x390fd8['sqlCode'],'sqlName':_0x390fd8[_0x411e5c(0x167)]}),_0x2afd3a=_0x472d57[_0x411e5c(0x178)]??[];_0x4aaf9b[_0x411e5c(0x157)](..._0x2afd3a);if(_0x2afd3a['length']===0x0)break;const _0x4710cc=_0x472d57[_0x411e5c(0x17e)]?.[_0x411e5c(0x164)];if(_0x4710cc!=null?_0x4aaf9b['length']>=_0x4710cc:_0x2afd3a[_0x411e5c(0x186)]<PAGE_SIZE)break;_0x2f2498++;}return _0x4aaf9b;}function a214_0x5cf1(){const _0x261b1f=['8VdwCSz','pull','3426ELMUZC','sqls','sql','1356005YmaJdE','would_pull','lastSync','605754BRwuqh','1jxRSYX','\x20failed','force','tableData','Pull\x20complete:\x20','Force\x20overwrite\x20local\x20unsynced\x20changes','No\x20remote\x20SQL\x20queries\x20matched.','2073980OFzNJB','sqlRoot','paging','name','cancelled','\x20written,\x20','mybatisXml','path','sqlContent','test','length','dbId','49994jPrlDj','conflict','3806811EoZtvd','boolean','filter','Filter\x20by\x20SQL\x20display\x20name','catch','Would\x20pull\x20','join','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','push','bool','str','sqlRootDir','sqlcode','sqlCode','skipped','description','1587388FtaWoV','trimStart','1565BADsgM','POST','message','totalCount','string','appCode','sqlName','read','toISOString','lockFilePath','utf8'];a214_0x5cf1=function(){return _0x261b1f;};return a214_0x5cf1();}async function ensureSqlContent(_0x2cfe1f){const _0x4fa8de=a214_0x53e4;if(_0x2cfe1f[_0x4fa8de(0x184)]!=null&&String(_0x2cfe1f[_0x4fa8de(0x184)])[_0x4fa8de(0x186)]>0x0)return _0x2cfe1f;return getSqlQueryDetail(_0x2cfe1f[_0x4fa8de(0x15c)]);}export const sqlPull={'service':'sql','command':a214_0x6a568a(0x16d),'description':a214_0x6a568a(0x156),'risk':a214_0x6a568a(0x168),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a214_0x6a568a(0x17f),'type':a214_0x6a568a(0x165),'description':a214_0x6a568a(0x18d)},{'name':a214_0x6a568a(0x177),'type':a214_0x6a568a(0x18b),'description':a214_0x6a568a(0x17a)}],async 'dryRun'(_0x184fe9){const _0xab2f67=a214_0x6a568a,_0x1dd23e=loadSqlProjectConfig(_0x184fe9[_0xab2f67(0x166)]),_0x359d21=await readSqlLockFile(_0x1dd23e[_0xab2f67(0x16a)]),{appLock:_0x55caec}=ensureSqlLockScope(_0x359d21??createEmptySqlLock(),_0x1dd23e[_0xab2f67(0x166)],_0x1dd23e[_0xab2f67(0x17d)],_0xab2f67(0x16d)),_0x3c923f=await fetchAllSqlQueries(_0x184fe9[_0xab2f67(0x166)],{'sqlCode':_0x184fe9[_0xab2f67(0x159)]('sqlcode')||undefined,'sqlName':_0x184fe9[_0xab2f67(0x159)](_0xab2f67(0x17f))||undefined}),_0x42212d=[];for(const _0x1f269d of _0x3c923f){const _0x585a43=await ensureSqlContent(_0x1f269d),_0x3a7154=ensureRemoteSqlContent(_0x585a43),_0x4d0190=detectModeFromSql(_0x585a43),_0x503252=_0x585a43[_0xab2f67(0x187)]?await getDbName(_0x184fe9[_0xab2f67(0x166)],Number(_0x585a43[_0xab2f67(0x187)]))[_0xab2f67(0x153)](()=>undefined):undefined,_0x223b42=buildLocalSqlFileContent({'sqlCode':_0x585a43[_0xab2f67(0x15c)],'sqlName':_0x585a43[_0xab2f67(0x167)],'dbId':_0x585a43[_0xab2f67(0x187)]},_0x3a7154,{'dbName':_0x503252,'mode':_0x4d0190,'syncedAt':new Date()['toISOString'](),'description':_0x585a43['description']}),_0x35f98b=buildSqlLockEntry(_0x585a43,_0x3a7154,'',{'dbName':_0x503252}),_0x40aa6f=resolveLocalSqlFilePath(_0x1dd23e,_0x585a43[_0xab2f67(0x15c)],_0x35f98b);let _0x343e23=_0xab2f67(0x172),_0x21ffaa;if(await fileExists(_0x40aa6f)){const _0x97f614=await readFile(_0x40aa6f,_0xab2f67(0x16b));isEquivalentPulledSqlFile(_0x97f614,_0x223b42,_0x4d0190)?(_0x343e23=_0xab2f67(0x15d),_0x21ffaa='unchanged'):(_0x343e23=_0xab2f67(0x189),_0x21ffaa='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x42212d[_0xab2f67(0x157)]({'sqlCode':_0x585a43[_0xab2f67(0x15c)],'sqlName':_0x585a43['sqlName'],'filePath':_0x40aa6f,'status':_0x343e23,'reason':_0x21ffaa});}return{'method':_0xab2f67(0x162),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x184fe9[_0xab2f67(0x166)],'sqlCode':_0x184fe9[_0xab2f67(0x159)](_0xab2f67(0x15b))||null,'sqlName':_0x184fe9[_0xab2f67(0x159)](_0xab2f67(0x17f))||null,'files':_0x42212d},'description':_0xab2f67(0x154)+_0x42212d[_0xab2f67(0x186)]+'\x20SQL\x20file(s)\x20into\x20'+_0x1dd23e['sqlRootDir']};},async 'execute'(_0x40b112){const _0x3fb342=a214_0x6a568a,_0x3b98f1=loadSqlProjectConfig(_0x40b112['appCode']),_0x1a21d5=await readSqlLockFile(_0x3b98f1['lockFilePath']),{lockData:_0x3417be,appLock:_0x312358}=ensureSqlLockScope(_0x1a21d5??createEmptySqlLock(),_0x3b98f1['appCode'],_0x3b98f1[_0x3fb342(0x17d)],'pull'),_0x2fb802=_0x40b112[_0x3fb342(0x158)](_0x3fb342(0x177)),_0x4cc0a9=await fetchAllSqlQueries(_0x40b112['appCode'],{'sqlCode':_0x40b112[_0x3fb342(0x159)](_0x3fb342(0x15b))||undefined,'sqlName':_0x40b112['str']('name')||undefined});if(_0x4cc0a9[_0x3fb342(0x186)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x3fb342(0x17b)};const _0x2b1175=[],_0x4f383d=[];for(const _0x29b9b2 of _0x4cc0a9){try{_0x2b1175[_0x3fb342(0x157)](await ensureSqlContent(_0x29b9b2));}catch(_0x359255){_0x4f383d[_0x3fb342(0x157)]({'sqlCode':_0x29b9b2['sqlCode'],'error':_0x359255 instanceof Error?_0x359255[_0x3fb342(0x163)]:String(_0x359255)});}}if(_0x2fb802&&!_0x40b112['nonInteractive']){let _0x3197dd=![];for(const _0x342073 of _0x2b1175){const _0x17b6bf=detectModeFromSql(_0x342073),_0x182e0b=_0x342073[_0x3fb342(0x187)]?await getDbName(_0x40b112[_0x3fb342(0x166)],Number(_0x342073[_0x3fb342(0x187)]))['catch'](()=>undefined):undefined,_0x380780=buildLocalSqlFileContent({'sqlCode':_0x342073[_0x3fb342(0x15c)],'sqlName':_0x342073[_0x3fb342(0x167)],'dbId':_0x342073[_0x3fb342(0x187)]},ensureRemoteSqlContent(_0x342073),{'dbName':_0x182e0b,'mode':_0x17b6bf,'syncedAt':new Date()['toISOString'](),'description':_0x342073[_0x3fb342(0x15e)]}),_0x5ce533=resolveLocalSqlFilePath(_0x3b98f1,_0x342073[_0x3fb342(0x15c)],buildSqlLockEntry(_0x342073,ensureRemoteSqlContent(_0x342073),'',{'dbName':_0x182e0b}));if(await fileExists(_0x5ce533)){const _0x226b96=await readFile(_0x5ce533,_0x3fb342(0x16b));if(!isEquivalentPulledSqlFile(_0x226b96,_0x380780,_0x17b6bf)){_0x3197dd=!![];break;}}}if(_0x3197dd){const _0x5085fd=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x5085fd)throw CliErrors[_0x3fb342(0x180)]('Force\x20pull\x20cancelled.');}}const _0x9d034e=cloneSqlLockData(_0x3417be),_0x4decdf=_0x9d034e['apps'][_0x3b98f1[_0x3fb342(0x166)]],_0xaaab6b=[],_0x4b8d2f=[];for(const _0x528d64 of _0x2b1175){const _0x4a4589=_0x4decdf[_0x3fb342(0x16f)][_0x528d64[_0x3fb342(0x15c)]],_0x540ba7=ensureRemoteSqlContent(_0x528d64),_0x554766=detectModeFromSql(_0x528d64),_0x4019d5=_0x528d64[_0x3fb342(0x187)]?await getDbName(_0x40b112[_0x3fb342(0x166)],Number(_0x528d64[_0x3fb342(0x187)]))[_0x3fb342(0x153)](()=>undefined):undefined,_0x506000=buildLocalSqlFileContent({'sqlCode':_0x528d64[_0x3fb342(0x15c)],'sqlName':_0x528d64[_0x3fb342(0x167)],'dbId':_0x528d64[_0x3fb342(0x187)]},_0x540ba7,{'dbName':_0x4019d5,'mode':_0x554766,'syncedAt':new Date()[_0x3fb342(0x169)](),'description':_0x528d64[_0x3fb342(0x15e)]}),_0x3a4024=buildSqlLockEntry(_0x528d64,_0x540ba7,computeSqlContentHash(_0x506000),{'dbName':_0x4019d5}),_0x41832a=_0x3a4024[_0x3fb342(0x183)],_0x19d420=join(_0x3b98f1[_0x3fb342(0x15a)],_0x41832a);try{if(await fileExists(_0x19d420)){const _0x38038a=await readFile(_0x19d420,_0x3fb342(0x16b));if(isEquivalentPulledSqlFile(_0x38038a,_0x506000,_0x554766)){_0x4b8d2f['push']({'sqlCode':_0x528d64[_0x3fb342(0x15c)],'reason':'unchanged'}),_0x4decdf[_0x3fb342(0x16f)][_0x528d64[_0x3fb342(0x15c)]]={..._0x3a4024,'hash':computeSqlContentHash(_0x38038a),'path':_0x41832a};continue;}if(!_0x2fb802){_0x4b8d2f[_0x3fb342(0x157)]({'sqlCode':_0x528d64[_0x3fb342(0x15c)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x2ee98c=_0x4a4589?.[_0x3fb342(0x183)]?join(_0x3b98f1[_0x3fb342(0x15a)],_0x4a4589[_0x3fb342(0x183)]):undefined;_0x2ee98c&&_0x2ee98c!==_0x19d420&&await fileExists(_0x2ee98c)&&await rm(_0x2ee98c,{'force':!![]}),await ensureParentDirectory(_0x19d420),await writeFile(_0x19d420,_0x506000,'utf8'),_0x4decdf[_0x3fb342(0x16f)][_0x528d64[_0x3fb342(0x15c)]]={..._0x3a4024,'path':_0x41832a},_0xaaab6b['push']({'sqlCode':_0x528d64[_0x3fb342(0x15c)],'filePath':_0x19d420});}catch(_0x8cc868){_0x4f383d[_0x3fb342(0x157)]({'sqlCode':_0x528d64[_0x3fb342(0x15c)],'error':_0x8cc868 instanceof Error?_0x8cc868['message']:String(_0x8cc868)});}}return _0x4decdf[_0x3fb342(0x173)]=new Date()['toISOString'](),await writeSqlLockFile(_0x3b98f1[_0x3fb342(0x16a)],_0x9d034e),{'ok':_0x4f383d[_0x3fb342(0x186)]===0x0,'data':{'pulled':_0xaaab6b,'skipped':_0x4b8d2f,'failed':_0x4f383d},'message':_0x3fb342(0x179)+_0xaaab6b[_0x3fb342(0x186)]+_0x3fb342(0x181)+_0x4b8d2f['length']+'\x20skipped,\x20'+_0x4f383d[_0x3fb342(0x186)]+_0x3fb342(0x176)};}};function detectModeFromSql(_0x3bcabd){const _0x1d1f67=a214_0x6a568a,_0x1d471a=ensureRemoteSqlContent(_0x3bcabd),_0x58922a=stripLocalSqlMetadata(_0x1d471a,_0x1d1f67(0x182))[_0x1d1f67(0x160)]();if(/^<(select|insert|update|delete)\b/i[_0x1d1f67(0x185)](_0x58922a))return _0x1d1f67(0x182);return _0x1d1f67(0x170);}function isEquivalentPulledSqlFile(_0x26527c,_0x357c3,_0x716c){return normalizePullComparableContent(_0x26527c,_0x716c)===normalizePullComparableContent(_0x357c3,_0x716c);}function normalizePullComparableContent(_0x375e3e,_0x56f717){const _0x133c90=a214_0x6a568a,_0x332d45=_0x375e3e['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x239025=_0x332d45[_0x133c90(0x18c)](_0x34c143=>!isSyncedAtMetadataLine(_0x34c143,_0x56f717));return _0x239025[_0x133c90(0x155)]('\x0a');}function isSyncedAtMetadataLine(_0x55d55d,_0x43e066){const _0x2beab5=a214_0x6a568a;if(_0x43e066===_0x2beab5(0x182))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x2beab5(0x185)](_0x55d55d);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x2beab5(0x185)](_0x55d55d);}
@@ -1 +1 @@
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
+ const a215_0x31c2e8=a215_0x4868;(function(_0x2dc4c5,_0x227741){const _0x489aa2=a215_0x4868,_0x55d4ec=_0x2dc4c5();while(!![]){try{const _0x7480b4=parseInt(_0x489aa2(0x1d9))/0x1+-parseInt(_0x489aa2(0x1cd))/0x2*(-parseInt(_0x489aa2(0x1b9))/0x3)+parseInt(_0x489aa2(0x1b8))/0x4*(parseInt(_0x489aa2(0x1d8))/0x5)+parseInt(_0x489aa2(0x1cc))/0x6+-parseInt(_0x489aa2(0x1a7))/0x7+-parseInt(_0x489aa2(0x1d6))/0x8*(-parseInt(_0x489aa2(0x1a8))/0x9)+-parseInt(_0x489aa2(0x1b1))/0xa*(parseInt(_0x489aa2(0x1de))/0xb);if(_0x7480b4===_0x227741)break;else _0x55d4ec['push'](_0x55d4ec['shift']());}catch(_0x4a4f4b){_0x55d4ec['push'](_0x55d4ec['shift']());}}}(a215_0x34a5,0x5b73d));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';function a215_0x4868(_0x1ce8c8,_0x40f55d){_0x1ce8c8=_0x1ce8c8-0x19f;const _0x34a520=a215_0x34a5();let _0x48681b=_0x34a520[_0x1ce8c8];return _0x48681b;}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(_0x2bc8d4,_0x3e1850,_0x42fc2e){const _0x325674=a215_0x4868,_0x4708f2=await scanLocalSqlQueries(_0x2bc8d4),_0x2b3cc2=new Map();for(const _0x512407 of _0x4708f2){if(_0x42fc2e&&_0x512407[_0x325674(0x1e3)]!==_0x42fc2e)continue;const _0x5ea111=_0x2b3cc2[_0x325674(0x1ca)](_0x512407[_0x325674(0x1e3)])??[];_0x5ea111[_0x325674(0x1e1)](_0x512407),_0x2b3cc2[_0x325674(0x1c9)](_0x512407['sqlCode'],_0x5ea111);}if(_0x42fc2e&&!_0x2b3cc2[_0x325674(0x1d1)](_0x42fc2e))throw CliErrors[_0x325674(0x1cb)](_0x325674(0x1bd)+_0x42fc2e);const _0x47c639=[];for(const [_0x2921cf,_0x742bed]of _0x2b3cc2[_0x325674(0x1a2)]()){if(_0x742bed['length']===0x1){_0x47c639[_0x325674(0x1e1)](_0x742bed[0x0]);continue;}const _0x1ad56b=_0x3e1850[_0x325674(0x1e2)][_0x2921cf],_0x1ee796=_0x1ad56b?.[_0x325674(0x1d0)],_0x5a75ca=_0x1ee796?_0x742bed[_0x325674(0x1dc)](_0x3fbc56=>_0x3fbc56[_0x325674(0x1b0)]!==_0x1ee796):_0x742bed;if(_0x1ad56b&&_0x5a75ca[_0x325674(0x1a9)]===0x1){_0x47c639['push'](_0x5a75ca[0x0]);continue;}throw CliErrors[_0x325674(0x1cb)](_0x325674(0x1bc)+_0x2921cf+_0x325674(0x1b7));}return _0x47c639;}export const sqlPush={'service':a215_0x31c2e8(0x1a0),'command':a215_0x31c2e8(0x1e1),'description':a215_0x31c2e8(0x1d3),'risk':a215_0x31c2e8(0x1c8),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a215_0x31c2e8(0x1bb),'type':a215_0x31c2e8(0x1cf),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x4649d1){const _0x2b469a=a215_0x31c2e8,_0x37f7f9=loadSqlProjectConfig(_0x4649d1[_0x2b469a(0x1a1)]),_0x2f42bf=await readSqlLockFile(_0x37f7f9['lockFilePath']),{appLock:_0x9b5889}=ensureSqlLockScope(_0x2f42bf??createEmptySqlLock(),_0x4649d1[_0x2b469a(0x1a1)],_0x37f7f9[_0x2b469a(0x1c3)],'push'),_0x128f88=await getTargetSqlQueries(_0x37f7f9,_0x9b5889,_0x4649d1[_0x2b469a(0x1be)]('sqlcode')||undefined),_0x251d7d=[];for(const _0x432634 of _0x128f88){const _0x5e6185=await computeSqlFileHash(_0x432634[_0x2b469a(0x1ae)]),_0xc4088a=_0x9b5889[_0x2b469a(0x1e2)][_0x432634[_0x2b469a(0x1e3)]],_0x2bc431=!!_0xc4088a&&(_0xc4088a['path']!==_0x432634[_0x2b469a(0x1b0)]||!!_0x432634[_0x2b469a(0x1db)]&&_0xc4088a['sqlName']!==_0x432634['sqlName']);if(!_0x4649d1['bool']('force')&&_0xc4088a&&_0xc4088a[_0x2b469a(0x1ac)]===_0x5e6185&&!_0x2bc431)continue;_0x251d7d['push'](_0x432634[_0x2b469a(0x1e3)]);}return{'method':'POST','url':_0x2b469a(0x1a6),'deploymentSync':buildAutomaticDeploymentSyncPreview(_0x2b469a(0x1a0),_0x251d7d),'body':{'sqlCodes':_0x251d7d,'appCode':_0x4649d1['appCode']},'description':'Would\x20push\x20'+_0x251d7d['length']+_0x2b469a(0x1d5)};},async 'execute'(_0x287201){const _0xba15d7=a215_0x31c2e8,_0x796cdf=loadSqlProjectConfig(_0x287201[_0xba15d7(0x1a1)]),_0x520d27=await readSqlLockFile(_0x796cdf[_0xba15d7(0x1af)]),{lockData:_0xf91bb7,appLock:_0x31b35a}=ensureSqlLockScope(_0x520d27??createEmptySqlLock(),_0x287201[_0xba15d7(0x1a1)],_0x796cdf[_0xba15d7(0x1c3)],_0xba15d7(0x1e1)),_0x58de31=await getTargetSqlQueries(_0x796cdf,_0x31b35a,_0x287201[_0xba15d7(0x1be)](_0xba15d7(0x1b5))||undefined);if(_0x58de31[_0xba15d7(0x1a9)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x127ee6=[],_0x1501c8=[],_0x14b73d=[];for(const _0x12adc8 of _0x58de31){const _0x1d610a=_0x31b35a[_0xba15d7(0x1e2)][_0x12adc8[_0xba15d7(0x1e3)]];if(!_0x1d610a){_0x14b73d[_0xba15d7(0x1e1)]({'sqlCode':_0x12adc8['sqlCode'],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x7dd259=await computeSqlFileHash(_0x12adc8[_0xba15d7(0x1ae)]),_0x514135=_0x1d610a[_0xba15d7(0x1d0)]!==_0x12adc8['relativePath']||!!_0x12adc8[_0xba15d7(0x1db)]&&_0x1d610a['sqlName']!==_0x12adc8[_0xba15d7(0x1db)];if(!_0x287201['bool'](_0xba15d7(0x1bb))&&_0x1d610a[_0xba15d7(0x1ac)]===_0x7dd259&&!_0x514135){_0x1501c8[_0xba15d7(0x1e1)]({'sqlCode':_0x12adc8[_0xba15d7(0x1e3)],'reason':_0xba15d7(0x1ce)});continue;}if(_0x1d610a[_0xba15d7(0x19f)]==null){_0x14b73d[_0xba15d7(0x1e1)]({'sqlCode':_0x12adc8[_0xba15d7(0x1e3)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x49556c=await readFile(_0x12adc8[_0xba15d7(0x1ae)],_0xba15d7(0x1b3)),_0x4b3183=stripLocalSqlMetadata(_0x49556c,_0x12adc8[_0xba15d7(0x1d4)]),_0x3398a6=_0x12adc8[_0xba15d7(0x1db)]||_0x1d610a[_0xba15d7(0x1db)],_0x25e3cb=await resolveTargetDbBinding(_0x287201[_0xba15d7(0x1a1)],_0x12adc8,_0x1d610a),_0xb1ad70=await updateSqlQuery({'id':_0x1d610a[_0xba15d7(0x1c4)],'appCode':_0x287201[_0xba15d7(0x1a1)],'sqlCode':_0x12adc8[_0xba15d7(0x1e3)],'sqlName':_0x3398a6,'dbId':_0x25e3cb['dbId'],'version':_0x1d610a['version'],'sqlContent':_0x4b3183,'sqlConfig':_0x1d610a[_0xba15d7(0x1c0)]??undefined}),_0x764a1c=_0xb1ad70[_0xba15d7(0x1d2)]?await getDbName(_0x287201[_0xba15d7(0x1a1)],Number(_0xb1ad70[_0xba15d7(0x1d2)]))['catch'](()=>_0x25e3cb['dbName']):_0x25e3cb[_0xba15d7(0x1a5)];_0x31b35a[_0xba15d7(0x1e2)][_0x12adc8[_0xba15d7(0x1e3)]]={...buildSqlLockEntry(_0xb1ad70,_0x4b3183,_0x7dd259,{'dbName':_0x764a1c}),'path':_0x12adc8[_0xba15d7(0x1b0)],'mode':_0x1d610a[_0xba15d7(0x1d4)]},await archivePreviousSqlFileIfNeeded(_0x796cdf,_0x1d610a[_0xba15d7(0x1d0)],_0x12adc8[_0xba15d7(0x1b0)]),_0x127ee6[_0xba15d7(0x1e1)]({'sqlCode':_0x12adc8[_0xba15d7(0x1e3)],'remoteId':_0x1d610a[_0xba15d7(0x1c4)]});}catch(_0x2364d1){_0x14b73d[_0xba15d7(0x1e1)]({'sqlCode':_0x12adc8[_0xba15d7(0x1e3)],'error':_0x2364d1 instanceof Error?_0x2364d1['message']:String(_0x2364d1)});}}_0x31b35a[_0xba15d7(0x1ab)]=new Date()['toISOString'](),await writeSqlLockFile(_0x796cdf[_0xba15d7(0x1af)],_0xf91bb7);const _0xed3123=_0x14b73d[_0xba15d7(0x1a9)]===0x0,_0x2f5d66=await runAutomaticDeploymentSync(_0x287201,_0xba15d7(0x1a0),_0x127ee6[_0xba15d7(0x1ba)](_0x31b51e=>_0x31b51e[_0xba15d7(0x1e3)]),_0xed3123),_0x4722ca=_0xed3123&&automaticDeploymentSyncSucceeded(_0x2f5d66),_0x4493fc=_0xba15d7(0x1df)+_0x2f5d66[_0xba15d7(0x1bf)];return{'ok':_0x4722ca,'data':{'pushed':_0x127ee6,'skipped':_0x1501c8,'failed':_0x14b73d,'deploymentSync':_0x2f5d66},'message':_0xba15d7(0x1d7)+_0x127ee6[_0xba15d7(0x1a9)]+_0xba15d7(0x1da)+_0x1501c8[_0xba15d7(0x1a9)]+'\x20skipped,\x20'+_0x14b73d[_0xba15d7(0x1a9)]+_0xba15d7(0x1a4)+_0x4493fc};}};async function archivePreviousSqlFileIfNeeded(_0x1fa366,_0x29cd5a,_0x322df4){const _0x702b86=a215_0x31c2e8;if(!_0x29cd5a||_0x29cd5a===_0x322df4)return;const _0x1766cf=join(_0x1fa366[_0x702b86(0x1c7)],_0x29cd5a);if(!await fileExists(_0x1766cf))return;const _0x178d8d=await moveToTrash(_0x1fa366[_0x702b86(0x1b4)],_0x1fa366[_0x702b86(0x1c6)],_0x1766cf);await cleanupEmptyDirectories(dirname(_0x1766cf),_0x1fa366['sqlRootDir']),void _0x178d8d;}async function moveToTrash(_0xdf67eb,_0x1a97a1,_0x178966){const _0x4b021f=a215_0x31c2e8,_0x4a6944=new Date()[_0x4b021f(0x1b6)]()[_0x4b021f(0x1e4)](/[:.]/g,'-'),_0xd7d610=relative(_0xdf67eb,_0x178966),_0x5608fb=join(_0x1a97a1,_0x4a6944,_0xd7d610);return await mkdir(dirname(_0x5608fb),{'recursive':!![]}),await rename(_0x178966,_0x5608fb),_0x5608fb;}function a215_0x34a5(){const _0x3925a8=['\x20failed','dbName','/smartapi/custom/updateUserCustomSql','3470761nOEuAy','100728hUGQJM','length','Local\x20directory\x20\x22','lastSync','hash','startsWith','filePath','lockFilePath','relativePath','100FndJoW','isFinite','utf8','projectRoot','sqlcode','toISOString','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','41176Prnqrd','3BPrcDK','map','force','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','Local\x20SQL\x20not\x20found:\x20','str','status','sqlConfig','exec','catch','sqlRoot','remoteId','join','trashDir','sqlRootDir','write','set','get','validation','2633070AZqFGK','659084gwRvJa','unchanged','boolean','path','has','dbId','Push\x20local\x20SQL\x20files\x20to\x20remote','mode','\x20SQL\x20file(s)','240XAvhdU','Push\x20complete:\x20','5AcruCt','108281uugEbg','\x20pushed,\x20','sqlName','filter','No\x20database\x20matches\x20local\x20directory\x20\x22','387541uYgtYI',',\x20deployment\x20sync\x20','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','push','sqls','sqlCode','replace','version','sql','appCode','entries','\x22\x20for\x20sqlCode\x20'];a215_0x34a5=function(){return _0x3925a8;};return a215_0x34a5();}async function cleanupEmptyDirectories(_0x2b750e,_0x3ddb6a){const _0x57dd5c=a215_0x31c2e8;let _0x1f4c9d=resolve(_0x2b750e);const _0x51b7e0=resolve(_0x3ddb6a);while(_0x1f4c9d[_0x57dd5c(0x1ad)](''+_0x51b7e0+sep)||_0x1f4c9d===_0x51b7e0){if(_0x1f4c9d===_0x51b7e0)return;try{const _0x182ddc=await readdir(_0x1f4c9d);if(_0x182ddc['length']>0x0)return;await rmdir(_0x1f4c9d);}catch{return;}_0x1f4c9d=dirname(_0x1f4c9d);}}async function resolveTargetDbBinding(_0x5efff6,_0x14706a,_0x4987f1){const _0x30635f=a215_0x31c2e8,_0x13f170=_0x14706a['dbDirectory'];if(!_0x13f170)return{'dbId':_0x4987f1[_0x30635f(0x1d2)],'dbName':_0x4987f1[_0x30635f(0x1a5)]};const _0xe70962=buildDbDirectoryName(_0x4987f1[_0x30635f(0x1a5)],_0x4987f1[_0x30635f(0x1d2)]);if(_0x13f170===_0xe70962)return{'dbId':_0x4987f1[_0x30635f(0x1d2)],'dbName':_0x4987f1[_0x30635f(0x1a5)]};const _0x5341ff=parseExplicitDbDirectory(_0x13f170);if(_0x5341ff!=null)return{'dbId':_0x5341ff,'dbName':await getDbName(_0x5efff6,_0x5341ff)[_0x30635f(0x1c2)](()=>undefined)};const _0x13e4f5=await listDatabases(_0x5efff6),_0x3565b6=_0x13e4f5[_0x30635f(0x1dc)](_0x451843=>buildDbDirectoryName(_0x451843[_0x30635f(0x1a5)],_0x451843['dbId'])===_0x13f170);if(_0x3565b6[_0x30635f(0x1a9)]===0x1)return{'dbId':_0x3565b6[0x0][_0x30635f(0x1d2)],'dbName':_0x3565b6[0x0]['dbName']};if(_0x3565b6['length']===0x0)throw CliErrors[_0x30635f(0x1cb)](_0x30635f(0x1dd)+_0x13f170+_0x30635f(0x1a3)+_0x14706a[_0x30635f(0x1e3)]+'.');const _0x463a77=_0x3565b6[_0x30635f(0x1ba)](_0x2ef35a=>_0x2ef35a[_0x30635f(0x1a5)]+'\x20('+_0x2ef35a[_0x30635f(0x1d2)]+')')[_0x30635f(0x1c5)](',\x20');throw CliErrors[_0x30635f(0x1cb)](_0x30635f(0x1aa)+_0x13f170+_0x30635f(0x1e0)+_0x14706a[_0x30635f(0x1e3)]+':\x20'+_0x463a77);}function parseExplicitDbDirectory(_0x410b79){const _0x5e8bfb=a215_0x31c2e8,_0x181963=/^db-(\d+)$/[_0x5e8bfb(0x1c1)](_0x410b79);if(!_0x181963)return null;const _0x1f8431=Number(_0x181963[0x1]);return Number[_0x5e8bfb(0x1b2)](_0x1f8431)&&_0x1f8431>0x0?_0x1f8431:null;}
@@ -1 +1 @@
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
+ const a216_0x2dafe7=a216_0x342a;(function(_0x53b932,_0x335528){const _0x1d07f3=a216_0x342a,_0x1a2354=_0x53b932();while(!![]){try{const _0xf53a7e=parseInt(_0x1d07f3(0x125))/0x1+-parseInt(_0x1d07f3(0x10a))/0x2+-parseInt(_0x1d07f3(0x128))/0x3+-parseInt(_0x1d07f3(0x101))/0x4+parseInt(_0x1d07f3(0x12c))/0x5*(parseInt(_0x1d07f3(0x11b))/0x6)+-parseInt(_0x1d07f3(0x129))/0x7*(parseInt(_0x1d07f3(0x10b))/0x8)+parseInt(_0x1d07f3(0x104))/0x9;if(_0xf53a7e===_0x335528)break;else _0x1a2354['push'](_0x1a2354['shift']());}catch(_0x243176){_0x1a2354['push'](_0x1a2354['shift']());}}}(a216_0x156f,0xa9b45));import{createInterface}from'node:readline';import{join}from'node:path';function a216_0x156f(){const _0x384947=['stdin','trim','close','question','join','length','1118247FHfNMM','\x20[y/N]\x20','stderr','3928872KUpwGy','1618057SrbrMS','dbName','mybatisXml','4144490CAJtjP','toLowerCase','syncedAt','<!--\x20@lovrabet.','4205980aCjZam','apps','yes','21185001NofNjt','map','mode','description','sqls','filter','1102706meDmEH','24vPCObx','.rabetbase/sql','sqlRoot','replace','push','lastSync','fromEntries','sqlConfig','entries','split','test','sqlName','trimStart','dbId','path','endsWith','6doRect','sqlCode','sqlContent','version'];a216_0x156f=function(){return _0x384947;};return a216_0x156f();}import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a216_0x2dafe7(0x10c);function a216_0x342a(_0x26e708,_0x246408){_0x26e708=_0x26e708-0x100;const _0x156f29=a216_0x156f();let _0x342a00=_0x156f29[_0x26e708];return _0x342a00;}export function buildSqlLockEntry(_0x3bad30,_0x48f8f9,_0x2ca3b1,_0x37b175){const _0x20e02b=a216_0x2dafe7,_0x2216f2=detectSqlMode(_0x48f8f9);return{'path':buildSqlRelativePath(_0x3bad30[_0x20e02b(0x11c)],_0x3bad30[_0x20e02b(0x116)],_0x37b175?.[_0x20e02b(0x12a)],_0x2216f2,_0x3bad30[_0x20e02b(0x118)]),'hash':_0x2ca3b1,'remoteId':_0x3bad30['id'],'version':_0x3bad30[_0x20e02b(0x11e)],'dbId':Number(_0x3bad30[_0x20e02b(0x118)]),'dbName':_0x37b175?.[_0x20e02b(0x12a)],'sqlName':_0x3bad30[_0x20e02b(0x116)],'sqlConfig':_0x3bad30[_0x20e02b(0x112)]??undefined,'mode':_0x2216f2};}export function cloneSqlLockData(_0x58dae5){const _0x2db198=a216_0x2dafe7;return{'apps':Object[_0x2db198(0x111)](Object[_0x2db198(0x113)](_0x58dae5[_0x2db198(0x102)])[_0x2db198(0x105)](([_0x369f13,_0x488e79])=>[_0x369f13,{'sqlRoot':_0x488e79[_0x2db198(0x10d)],'lastSync':_0x488e79[_0x2db198(0x110)],'sqls':{..._0x488e79[_0x2db198(0x108)]}}]))};}export function ensureRemoteSqlContent(_0xb76538){const _0x3fd711=a216_0x2dafe7;return _0xb76538[_0x3fd711(0x11d)]??'';}export function buildLocalSqlFileContent(_0x272aca,_0x2d986c,_0x5dfc8c){const _0x13cf3a=a216_0x2dafe7,_0x4a3418=_0x5dfc8c?.[_0x13cf3a(0x106)]??detectSqlMode(_0x2d986c),_0x2534d1=stripLocalSqlMetadata(_0x2d986c,_0x4a3418)[_0x13cf3a(0x120)](),_0x13cf03=[...buildMetadataHeaderLines({'sqlCode':_0x272aca[_0x13cf3a(0x11c)],'sqlName':_0x272aca[_0x13cf3a(0x116)],'dbId':_0x272aca[_0x13cf3a(0x118)],'dbName':_0x5dfc8c?.['dbName'],'mode':_0x4a3418,'syncedAt':_0x5dfc8c?.['syncedAt'],'description':_0x5dfc8c?.[_0x13cf3a(0x107)]},_0x4a3418),'',_0x2534d1],_0x305cbb=_0x13cf03[_0x13cf3a(0x123)]('\x0a');return _0x305cbb[_0x13cf3a(0x11a)]('\x0a')?_0x305cbb:_0x305cbb+'\x0a';}export function stripLocalSqlMetadata(_0x1d6e88,_0x4d1b70){const _0x60cfc9=a216_0x2dafe7,_0x40cd5d=_0x1d6e88[_0x60cfc9(0x10e)](/\r\n/g,'\x0a')[_0x60cfc9(0x114)]('\x0a'),_0x3151b8=[];let _0xab0ddb=0x0;if(_0x4d1b70===_0x60cfc9(0x12b))while(_0xab0ddb<_0x40cd5d['length']){const _0x3ff60d=_0x40cd5d[_0xab0ddb]??'';if(/^\s*<!--\s*@lovrabet\./[_0x60cfc9(0x115)](_0x3ff60d)){_0xab0ddb++;continue;}if(_0x3ff60d['trim']()===''&&_0xab0ddb>0x0){_0xab0ddb++;continue;}break;}else while(_0xab0ddb<_0x40cd5d[_0x60cfc9(0x124)]){const _0xe4438a=_0x40cd5d[_0xab0ddb]??'';if(/^\s*--\s*@lovrabet\./[_0x60cfc9(0x115)](_0xe4438a)){_0xab0ddb++;continue;}if(_0xe4438a[_0x60cfc9(0x120)]()===''&&_0xab0ddb>0x0){_0xab0ddb++;continue;}break;}for(;_0xab0ddb<_0x40cd5d[_0x60cfc9(0x124)];_0xab0ddb++){_0x3151b8[_0x60cfc9(0x10f)](_0x40cd5d[_0xab0ddb]);}return _0x3151b8['join']('\x0a')[_0x60cfc9(0x117)]();}export function resolveSqlMode(_0x73e6c0,_0x167131){const _0x3a1948=a216_0x2dafe7;if(_0x167131?.[_0x3a1948(0x106)])return _0x167131[_0x3a1948(0x106)];return detectSqlMode(_0x73e6c0);}export function resolveSqlFileName(_0x51ecf4,_0x557b3c,_0x26a71a){const _0xb19ce1=a216_0x2dafe7;if(_0x26a71a?.[_0xb19ce1(0x119)])return _0x26a71a[_0xb19ce1(0x119)];if(_0x26a71a?.[_0xb19ce1(0x116)]||_0x26a71a?.[_0xb19ce1(0x12a)])return buildSqlRelativePath(_0x51ecf4,_0x26a71a?.[_0xb19ce1(0x116)],_0x26a71a?.['dbName'],resolveSqlMode(_0x557b3c,_0x26a71a),_0x26a71a?.['dbId']);return buildDefaultSqlFileName(_0x51ecf4,resolveSqlMode(_0x557b3c,_0x26a71a));}export function resolveSqlLocalDir(_0x191b86,_0x2600af){return join(_0x191b86,SQL_LOCAL_REL_DIR,_0x2600af);}export async function confirmForceOverwrite(_0xb8fa34){const _0x351799=a216_0x2dafe7,_0x526a12=createInterface({'input':process[_0x351799(0x11f)],'output':process[_0x351799(0x127)]}),_0x11a90a=await new Promise(_0x2d9262=>{const _0x150815=_0x351799;_0x526a12[_0x150815(0x122)](_0xb8fa34+_0x150815(0x126),_0x2d9262);});return _0x526a12[_0x351799(0x121)](),['y',_0x351799(0x103)]['includes'](_0x11a90a[_0x351799(0x120)]()[_0x351799(0x12d)]());}export function findSqlLockScope(_0x3f3be6,_0x14299a){const _0x3def1e=a216_0x2dafe7;return _0x3f3be6[_0x3def1e(0x102)][_0x14299a];}function buildMetadataHeaderLines(_0x21cd24,_0x234568){const _0x26e42e=a216_0x2dafe7,_0x17f206=[['sqlCode',_0x21cd24[_0x26e42e(0x11c)]],[_0x26e42e(0x116),_0x21cd24[_0x26e42e(0x116)]],[_0x26e42e(0x118),_0x21cd24[_0x26e42e(0x118)]],[_0x26e42e(0x12a),_0x21cd24[_0x26e42e(0x12a)]],[_0x26e42e(0x106),_0x21cd24[_0x26e42e(0x106)]],['syncedAt',_0x21cd24[_0x26e42e(0x12e)]],[_0x26e42e(0x107),_0x21cd24[_0x26e42e(0x107)]]];if(_0x234568===_0x26e42e(0x12b))return _0x17f206[_0x26e42e(0x109)](([,_0x2e64cd])=>_0x2e64cd!==undefined&&_0x2e64cd!==null&&String(_0x2e64cd)[_0x26e42e(0x120)]()!=='')[_0x26e42e(0x105)](([_0x436001,_0x512eaa])=>_0x26e42e(0x100)+_0x436001+':\x20'+String(_0x512eaa)+'\x20-->');return _0x17f206['filter'](([,_0x2fb1a8])=>_0x2fb1a8!==undefined&&_0x2fb1a8!==null&&String(_0x2fb1a8)[_0x26e42e(0x120)]()!=='')[_0x26e42e(0x105)](([_0x34cb33,_0x12fc64])=>'--\x20@lovrabet.'+_0x34cb33+':\x20'+String(_0x12fc64));}
@@ -1 +1 @@
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):'')};}};
1
+ const a217_0x592408=a217_0x5201;(function(_0x3489c3,_0x4ac661){const _0x3f4f27=a217_0x5201,_0x5bc6a7=_0x3489c3();while(!![]){try{const _0x1fd831=parseInt(_0x3f4f27(0x19b))/0x1+parseInt(_0x3f4f27(0x198))/0x2+parseInt(_0x3f4f27(0x1a7))/0x3+parseInt(_0x3f4f27(0x1b2))/0x4+parseInt(_0x3f4f27(0x1b1))/0x5+-parseInt(_0x3f4f27(0x19c))/0x6*(parseInt(_0x3f4f27(0x1a1))/0x7)+-parseInt(_0x3f4f27(0x1b6))/0x8*(parseInt(_0x3f4f27(0x19a))/0x9);if(_0x1fd831===_0x4ac661)break;else _0x5bc6a7['push'](_0x5bc6a7['shift']());}catch(_0x168e93){_0x5bc6a7['push'](_0x5bc6a7['shift']());}}}(a217_0x8ce2,0xd0a25));import{listSqlQueries}from'../../core/api-client.js';function a217_0x5201(_0x10a78d,_0x45613f){_0x10a78d=_0x10a78d-0x197;const _0x8ce21e=a217_0x8ce2();let _0x520103=_0x8ce21e[_0x10a78d];return _0x520103;}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(_0x4ccb60){const _0x33cb17=a217_0x5201,_0x457863=[];let _0x5091ea=0x1;while(!![]){const _0x2bd36d=await listSqlQueries(_0x4ccb60,{'currentPage':_0x5091ea,'pageSize':PAGE_SIZE}),_0x203863=_0x2bd36d['tableData']??[];_0x457863[_0x33cb17(0x1b7)](..._0x203863[_0x33cb17(0x1a9)](_0x4d444f=>_0x4d444f[_0x33cb17(0x19e)]));if(_0x203863['length']===0x0)break;const _0x5985fe=_0x2bd36d[_0x33cb17(0x1aa)]?.[_0x33cb17(0x199)];if(_0x5985fe!=null?_0x457863[_0x33cb17(0x1b4)]>=_0x5985fe:_0x203863[_0x33cb17(0x1b4)]<PAGE_SIZE)break;_0x5091ea++;}return _0x457863;}function a217_0x8ce2(){const _0x10f82c=['1371254KxgwUs','totalCount','17773785DOFVcM','162494jKwtmq','12wMqwOf','sqls','sqlCode','remote','boolean','4989530YTGsgf','\x20added,\x20','\x20unchanged','All\x20SQL\x20queries\x20are\x20in\x20sync.','sqlName','status','2261157EaAwst','hash','map','paging','has','sqlRoot','lockFilePath','relativePath','filePath','read','5582685RMzbLH','6146532FZKHAf','bool','length','lockKey','8DzEfzc','push','path','appCode'];a217_0x8ce2=function(){return _0x10f82c;};return a217_0x8ce2();}export const sqlStatus={'service':'sql','command':a217_0x592408(0x1a6),'description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a217_0x592408(0x1b0),'flags':[{'name':'remote','type':a217_0x592408(0x1a0),'description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0x56b3a6){const _0x543fe5=a217_0x592408,_0x566ae1=loadSqlProjectConfig(_0x56b3a6[_0x543fe5(0x197)]),_0x29f2c6=await readSqlLockFile(_0x566ae1[_0x543fe5(0x1ad)]),{appLock:_0x257d13}=ensureSqlLockScope(_0x29f2c6??createEmptySqlLock(),_0x566ae1[_0x543fe5(0x197)],_0x566ae1[_0x543fe5(0x1ac)],_0x543fe5(0x1a6)),_0x49380d=await scanLocalSqlQueries(_0x566ae1),_0x28ddb2=[],_0x2a8618=[],_0x3b5543=[],_0x5dfc69=[],_0x5c5c15=new Set(_0x49380d[_0x543fe5(0x1a9)](_0x1aa2e5=>_0x1aa2e5[_0x543fe5(0x1b5)]));for(const _0x473a1d of _0x49380d){const _0x1d4823=await computeSqlFileHash(_0x473a1d[_0x543fe5(0x1af)]),_0x2f0ada=_0x257d13[_0x543fe5(0x19d)][_0x473a1d[_0x543fe5(0x1b5)]],_0x5ddb3e=!!_0x2f0ada&&_0x2f0ada[_0x543fe5(0x1b8)]!==_0x473a1d[_0x543fe5(0x1ae)],_0x4224c5=!!_0x2f0ada&&!!_0x473a1d[_0x543fe5(0x1a5)]&&_0x2f0ada[_0x543fe5(0x1a5)]!==_0x473a1d[_0x543fe5(0x1a5)];if(!_0x2f0ada)_0x28ddb2[_0x543fe5(0x1b7)](_0x473a1d[_0x543fe5(0x1b5)]);else _0x2f0ada[_0x543fe5(0x1a8)]!==_0x1d4823||_0x5ddb3e||_0x4224c5?_0x2a8618[_0x543fe5(0x1b7)](_0x473a1d[_0x543fe5(0x1b5)]):_0x3b5543[_0x543fe5(0x1b7)](_0x473a1d[_0x543fe5(0x1b5)]);}for(const _0x7d93fd of Object['keys'](_0x257d13[_0x543fe5(0x19d)])){!_0x5c5c15[_0x543fe5(0x1ab)](_0x7d93fd)&&_0x5dfc69[_0x543fe5(0x1b7)](_0x7d93fd);}const _0x43409f=[];if(_0x56b3a6[_0x543fe5(0x1b3)](_0x543fe5(0x19f))){const _0x5c321d=await fetchAllSqlCodes(_0x56b3a6[_0x543fe5(0x197)]);for(const _0x308a1d of _0x5c321d){!_0x5c5c15[_0x543fe5(0x1ab)](_0x308a1d)&&!_0x257d13[_0x543fe5(0x19d)][_0x308a1d]&&_0x43409f[_0x543fe5(0x1b7)](_0x308a1d);}}const _0x285640=_0x28ddb2[_0x543fe5(0x1b4)]===0x0&&_0x2a8618[_0x543fe5(0x1b4)]===0x0&&_0x5dfc69[_0x543fe5(0x1b4)]===0x0&&_0x43409f[_0x543fe5(0x1b4)]===0x0;return{'ok':!![],'data':{'added':_0x28ddb2,'modified':_0x2a8618,'missing':_0x5dfc69,'unchanged':_0x3b5543,'remoteOnly':_0x43409f},'message':_0x285640?_0x543fe5(0x1a4):_0x28ddb2[_0x543fe5(0x1b4)]+_0x543fe5(0x1a2)+_0x2a8618['length']+'\x20modified,\x20'+_0x5dfc69['length']+'\x20missing,\x20'+_0x3b5543['length']+_0x543fe5(0x1a3)+(_0x43409f[_0x543fe5(0x1b4)]>0x0?',\x20'+_0x43409f[_0x543fe5(0x1b4)]+'\x20remote-only':'')};}};