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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (348) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/fetch-model-list.js +1 -1
  3. package/lib/api/generate-api-file.d.ts +1 -1
  4. package/lib/api/generate-api-file.js +1 -1
  5. package/lib/api/generate-sdk-config-file.d.ts +2 -1
  6. package/lib/api/generate-sdk-config-file.js +1 -1
  7. package/lib/auth/auth-server-ui.js +1 -1
  8. package/lib/auth/auth-server.js +1 -1
  9. package/lib/auth/constant.js +1 -1
  10. package/lib/auth/get-cookie.js +1 -1
  11. package/lib/auth/get-session-user.js +1 -1
  12. package/lib/auth/is-session-valid.js +1 -1
  13. package/lib/auth/login-success-html.js +1 -1
  14. package/lib/auth/logout.js +1 -1
  15. package/lib/cli-flags.js +1 -1
  16. package/lib/cli.js +1 -1
  17. package/lib/commands/api/generate.js +1 -1
  18. package/lib/commands/api/index.js +1 -1
  19. package/lib/commands/api/list.js +1 -1
  20. package/lib/commands/api/pull.js +1 -1
  21. package/lib/commands/api/shared.js +1 -1
  22. package/lib/commands/app/index.js +1 -1
  23. package/lib/commands/app/list.js +1 -1
  24. package/lib/commands/app/members-list.js +1 -1
  25. package/lib/commands/app/remote-directory.js +1 -1
  26. package/lib/commands/app/shared.js +1 -1
  27. package/lib/commands/app-config/delete.js +1 -1
  28. package/lib/commands/app-config/get.js +1 -1
  29. package/lib/commands/app-config/index.js +1 -1
  30. package/lib/commands/app-config/list.js +1 -1
  31. package/lib/commands/app-config/set.js +1 -1
  32. package/lib/commands/app-config/shared.js +1 -1
  33. package/lib/commands/auth/index.js +1 -1
  34. package/lib/commands/bff/create.js +1 -1
  35. package/lib/commands/bff/delete.js +1 -1
  36. package/lib/commands/bff/detail.js +1 -1
  37. package/lib/commands/bff/index.js +1 -1
  38. package/lib/commands/bff/list.js +1 -1
  39. package/lib/commands/bff/pull.js +1 -1
  40. package/lib/commands/bff/push.js +1 -1
  41. package/lib/commands/bff/status.js +1 -1
  42. package/lib/commands/cli-skill/index.js +1 -1
  43. package/lib/commands/cli-update.js +1 -1
  44. package/lib/commands/codegen/index.js +1 -1
  45. package/lib/commands/codegen/sdk.js +1 -1
  46. package/lib/commands/codegen/sql.js +1 -1
  47. package/lib/commands/common/app-registry.js +1 -1
  48. package/lib/commands/common/app-selector.js +1 -1
  49. package/lib/commands/common/async-task.js +1 -1
  50. package/lib/commands/common/dry-run.js +1 -1
  51. package/lib/commands/common/flags.js +1 -1
  52. package/lib/commands/common/local-file.js +1 -1
  53. package/lib/commands/common/validate.js +1 -1
  54. package/lib/commands/config/delete.js +1 -1
  55. package/lib/commands/config/get.js +1 -1
  56. package/lib/commands/config/index.js +1 -1
  57. package/lib/commands/config/init.js +1 -1
  58. package/lib/commands/config/list.js +1 -1
  59. package/lib/commands/config/set.js +1 -1
  60. package/lib/commands/config/shared.js +1 -1
  61. package/lib/commands/dataset/business-group-update.js +1 -1
  62. package/lib/commands/dataset/business-groups.js +1 -1
  63. package/lib/commands/dataset/capability.js +1 -1
  64. package/lib/commands/dataset/delete.js +1 -1
  65. package/lib/commands/dataset/detail.js +1 -1
  66. package/lib/commands/dataset/extend-update.js +1 -1
  67. package/lib/commands/dataset/field-restore.js +1 -1
  68. package/lib/commands/dataset/field-update.js +1 -1
  69. package/lib/commands/dataset/generate.js +1 -1
  70. package/lib/commands/dataset/index.js +1 -1
  71. package/lib/commands/dataset/list.js +1 -1
  72. package/lib/commands/dataset/operations.js +1 -1
  73. package/lib/commands/dataset/relation-audit.js +1 -1
  74. package/lib/commands/dataset/relation-create.js +1 -1
  75. package/lib/commands/dataset/relation-delete.js +1 -1
  76. package/lib/commands/dataset/relation-shared.js +1 -1
  77. package/lib/commands/dataset/relation-update.js +1 -1
  78. package/lib/commands/dataset/relations.js +1 -1
  79. package/lib/commands/dataset/rename.js +1 -1
  80. package/lib/commands/dataset/restore.js +1 -1
  81. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  82. package/lib/commands/db/analysis-batching.js +1 -1
  83. package/lib/commands/db/analyze-batch-plan.js +1 -1
  84. package/lib/commands/db/analyze-cancel.js +1 -1
  85. package/lib/commands/db/analyze-start.js +1 -1
  86. package/lib/commands/db/analyze-status.js +1 -1
  87. package/lib/commands/db/create.js +1 -1
  88. package/lib/commands/db/delete.js +1 -1
  89. package/lib/commands/db/detail.js +1 -1
  90. package/lib/commands/db/diff-refresh-start.js +1 -1
  91. package/lib/commands/db/diff-refresh-status.js +1 -1
  92. package/lib/commands/db/diff.js +1 -1
  93. package/lib/commands/db/index.js +1 -1
  94. package/lib/commands/db/list.js +1 -1
  95. package/lib/commands/db/shared.js +1 -1
  96. package/lib/commands/db/table-diff-shared.js +1 -1
  97. package/lib/commands/db/tables.js +1 -1
  98. package/lib/commands/db/test.js +1 -1
  99. package/lib/commands/db/update.js +1 -1
  100. package/lib/commands/deployment/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/doctor.js +1 -1
  105. package/lib/commands/file/index.js +1 -1
  106. package/lib/commands/instant-api-policy/current.js +1 -1
  107. package/lib/commands/instant-api-policy/index.js +1 -1
  108. package/lib/commands/instant-api-policy/init.js +1 -1
  109. package/lib/commands/instant-api-policy/publish.js +1 -1
  110. package/lib/commands/instant-api-policy/pull.js +1 -1
  111. package/lib/commands/instant-api-policy/revision.js +1 -1
  112. package/lib/commands/instant-api-policy/revisions.js +1 -1
  113. package/lib/commands/instant-api-policy/rollback.js +1 -1
  114. package/lib/commands/instant-api-policy/shared.js +1 -1
  115. package/lib/commands/instant-api-policy/validate.js +1 -1
  116. package/lib/commands/issue/index.js +1 -1
  117. package/lib/commands/issue/nudge.js +1 -1
  118. package/lib/commands/issue/report.js +1 -1
  119. package/lib/commands/issue/shared.js +1 -1
  120. package/lib/commands/kb/create.js +1 -1
  121. package/lib/commands/kb/delete.js +1 -1
  122. package/lib/commands/kb/detail.js +1 -1
  123. package/lib/commands/kb/index.js +1 -1
  124. package/lib/commands/kb/list.js +1 -1
  125. package/lib/commands/kb/search.js +1 -1
  126. package/lib/commands/kb/shared.js +1 -1
  127. package/lib/commands/kb/update.js +1 -1
  128. package/lib/commands/logs/index.js +1 -1
  129. package/lib/commands/menu/asset-update.js +1 -1
  130. package/lib/commands/menu/delete.js +1 -1
  131. package/lib/commands/menu/external-link-create.js +1 -1
  132. package/lib/commands/menu/external-link-update.js +1 -1
  133. package/lib/commands/menu/group-create.js +1 -1
  134. package/lib/commands/menu/group-update.js +1 -1
  135. package/lib/commands/menu/index.js +1 -1
  136. package/lib/commands/menu/list.js +1 -1
  137. package/lib/commands/menu/move.js +1 -1
  138. package/lib/commands/menu/regroup-start.js +1 -1
  139. package/lib/commands/menu/rename.js +1 -1
  140. package/lib/commands/menu/shared/compare-table.js +1 -1
  141. package/lib/commands/menu/shared/delete-plan.js +1 -1
  142. package/lib/commands/menu/shared/facts.js +1 -1
  143. package/lib/commands/menu/shared/index.js +1 -1
  144. package/lib/commands/menu/shared/inquirer.js +1 -1
  145. package/lib/commands/menu/shared/local-pages.js +1 -1
  146. package/lib/commands/menu/shared/logic.js +1 -1
  147. package/lib/commands/menu/shared/mutations.js +1 -1
  148. package/lib/commands/menu/shared/service.js +1 -1
  149. package/lib/commands/menu/shared/sync-core.js +1 -1
  150. package/lib/commands/menu/shared/update-core.js +1 -1
  151. package/lib/commands/menu/shared/valid-url.js +1 -1
  152. package/lib/commands/menu/sync.js +1 -1
  153. package/lib/commands/menu/visibility-update.js +1 -1
  154. package/lib/commands/notification/config-create.js +1 -1
  155. package/lib/commands/notification/config-delete.js +1 -1
  156. package/lib/commands/notification/config-list.js +1 -1
  157. package/lib/commands/notification/config-update.js +1 -1
  158. package/lib/commands/notification/index.js +1 -1
  159. package/lib/commands/notification/shared.js +1 -1
  160. package/lib/commands/ocr/index.js +1 -1
  161. package/lib/commands/page/create.js +1 -1
  162. package/lib/commands/page/custom/detail.js +1 -1
  163. package/lib/commands/page/custom/list.js +1 -1
  164. package/lib/commands/page/custom/publish.js +1 -1
  165. package/lib/commands/page/custom/shared.js +1 -1
  166. package/lib/commands/page/custom/syntax.js +1 -1
  167. package/lib/commands/page/custom/update.js +1 -1
  168. package/lib/commands/page/data-list-status.js +1 -1
  169. package/lib/commands/page/generate-start.js +1 -1
  170. package/lib/commands/page/generate-status.js +1 -1
  171. package/lib/commands/page/index.js +1 -1
  172. package/lib/commands/page/pull.js +1 -1
  173. package/lib/commands/page/push.js +1 -1
  174. package/lib/commands/page/relation-audit.js +1 -1
  175. package/lib/commands/page/restore.js +1 -1
  176. package/lib/commands/page/shared.js +1 -1
  177. package/lib/commands/page/sync.js +1 -1
  178. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  179. package/lib/commands/project/create/format-elapsed.js +1 -1
  180. package/lib/commands/project/create/main.js +1 -1
  181. package/lib/commands/project/create/materialize-project-template.js +1 -1
  182. package/lib/commands/project/create/project-name.js +1 -1
  183. package/lib/commands/project/create/project-template-archive.js +1 -1
  184. package/lib/commands/project/create/project-template-path.js +1 -1
  185. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  186. package/lib/commands/project/create/use-format-code.js +1 -1
  187. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  188. package/lib/commands/project/domain-routing-sync.js +1 -1
  189. package/lib/commands/project/index.js +1 -1
  190. package/lib/commands/project/upgrade.js +1 -1
  191. package/lib/commands/registry.js +1 -1
  192. package/lib/commands/role/delete.js +1 -1
  193. package/lib/commands/role/detail.js +1 -1
  194. package/lib/commands/role/index.js +1 -1
  195. package/lib/commands/role/list.js +1 -1
  196. package/lib/commands/role/shared.js +1 -1
  197. package/lib/commands/role/update.js +1 -1
  198. package/lib/commands/role/user-add.js +1 -1
  199. package/lib/commands/role/user-remove.js +1 -1
  200. package/lib/commands/role/user-resolve.js +1 -1
  201. package/lib/commands/rule/get.js +1 -1
  202. package/lib/commands/rule/index.js +1 -1
  203. package/lib/commands/rule/list.js +1 -1
  204. package/lib/commands/rule/set.js +1 -1
  205. package/lib/commands/rule/shared.js +1 -1
  206. package/lib/commands/run/index.js +1 -1
  207. package/lib/commands/schema.js +1 -1
  208. package/lib/commands/sql/create.js +1 -1
  209. package/lib/commands/sql/delete.js +1 -1
  210. package/lib/commands/sql/detail.js +1 -1
  211. package/lib/commands/sql/exec.js +1 -1
  212. package/lib/commands/sql/index.js +1 -1
  213. package/lib/commands/sql/list.js +1 -1
  214. package/lib/commands/sql/pull.js +1 -1
  215. package/lib/commands/sql/push.js +1 -1
  216. package/lib/commands/sql/shared.js +1 -1
  217. package/lib/commands/sql/status.js +1 -1
  218. package/lib/commands/sql/validate.js +1 -1
  219. package/lib/commands/task/index.js +1 -1
  220. package/lib/commands/task/status.js +1 -1
  221. package/lib/commands/tenant/index.js +1 -1
  222. package/lib/commands/tenant/members-list.js +1 -1
  223. package/lib/commands/tenant/shared.js +1 -1
  224. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  225. package/lib/commands/user-account/index.js +1 -1
  226. package/lib/commands/workspace/add.js +1 -1
  227. package/lib/commands/workspace/index.js +1 -1
  228. package/lib/commands/workspace/remove.js +1 -1
  229. package/lib/config/domain-config.js +1 -1
  230. package/lib/config/project-domain-routing.js +1 -1
  231. package/lib/config/region-config.d.ts +23 -0
  232. package/lib/config/region-config.js +1 -0
  233. package/lib/config/schema.d.ts +15 -0
  234. package/lib/config/schema.js +1 -1
  235. package/lib/constant/cdn.js +1 -1
  236. package/lib/constant/cli.js +1 -1
  237. package/lib/constant/defaults.js +1 -1
  238. package/lib/constant/domain.js +1 -1
  239. package/lib/constant/env.js +1 -1
  240. package/lib/constant/output.js +1 -1
  241. package/lib/constant/paths.js +1 -1
  242. package/lib/constant/region.js +1 -1
  243. package/lib/constant/risk.js +1 -1
  244. package/lib/constant/routing-profile.js +1 -1
  245. package/lib/context/app-resolver.d.ts +6 -0
  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.d.ts +13 -0
  250. package/lib/context.js +1 -1
  251. package/lib/core/alias-resolver.js +1 -1
  252. package/lib/core/api-client.d.ts +2 -0
  253. package/lib/core/api-client.js +1 -1
  254. package/lib/core/bff/config.js +1 -1
  255. package/lib/core/bff/file-system.js +1 -1
  256. package/lib/core/bff/hash.js +1 -1
  257. package/lib/core/bff/lock.js +1 -1
  258. package/lib/core/bff/utils.js +1 -1
  259. package/lib/core/db-resolver.js +1 -1
  260. package/lib/core/instant-api-policy/config.js +1 -1
  261. package/lib/core/kb-search-client.js +1 -1
  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/page/lr-smart-jsx.d.ts +6 -0
  266. package/lib/core/page/lr-smart-jsx.js +1 -0
  267. package/lib/core/sql-index-auditor.js +1 -1
  268. package/lib/core/sql-sync/config.js +1 -1
  269. package/lib/core/sql-sync/file-system.js +1 -1
  270. package/lib/core/sql-sync/hash.js +1 -1
  271. package/lib/core/sql-sync/lock.js +1 -1
  272. package/lib/core/sql-sync/utils.js +1 -1
  273. package/lib/core/sql-validator.js +1 -1
  274. package/lib/errors.js +1 -1
  275. package/lib/framework/build-all-flags.js +1 -1
  276. package/lib/framework/error-output.js +1 -1
  277. package/lib/framework/explicit-yes.js +1 -1
  278. package/lib/framework/flags.js +1 -1
  279. package/lib/framework/help.js +1 -1
  280. package/lib/framework/index.js +1 -1
  281. package/lib/framework/output.js +1 -1
  282. package/lib/framework/response.js +1 -1
  283. package/lib/framework/runner-alias.js +1 -1
  284. package/lib/framework/runner.js +1 -1
  285. package/lib/framework/schema-export.js +1 -1
  286. package/lib/framework/supported-flags.js +1 -1
  287. package/lib/framework/types.js +1 -1
  288. package/lib/generated/build-info.d.ts +4 -4
  289. package/lib/generated/build-info.js +1 -1
  290. package/lib/generated/official-routing.js +1 -1
  291. package/lib/generated/routing-contract.js +1 -1
  292. package/lib/help.js +1 -1
  293. package/lib/postinstall.js +1 -1
  294. package/lib/runtime/confirmation.js +1 -1
  295. package/lib/runtime/event.js +1 -1
  296. package/lib/runtime/index.js +1 -1
  297. package/lib/runtime/queue.js +1 -1
  298. package/lib/runtime/resolve.js +1 -1
  299. package/lib/skills/builtin-skill.js +1 -1
  300. package/lib/skills/main.js +1 -1
  301. package/lib/skills/npx-skills-add.js +1 -1
  302. package/lib/skills/skill-presence.js +1 -1
  303. package/lib/telemetry/cli-command-trace.js +1 -1
  304. package/lib/telemetry/cli-help-trace.js +1 -1
  305. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  306. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  307. package/lib/telemetry/send-cli-trace-log.js +1 -1
  308. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  309. package/lib/types/index.d.ts +1 -1
  310. package/lib/utils/ai_config.js +1 -1
  311. package/lib/utils/apply-jq-filter.js +1 -1
  312. package/lib/utils/cdn-config.js +1 -1
  313. package/lib/utils/check-sdk-version.js +1 -1
  314. package/lib/utils/cli-version-check.js +1 -1
  315. package/lib/utils/cli-version-policy.js +1 -1
  316. package/lib/utils/config.d.ts +2 -8
  317. package/lib/utils/config.js +1 -1
  318. package/lib/utils/entity-with-id.js +1 -1
  319. package/lib/utils/file-utils.js +1 -1
  320. package/lib/utils/guides-cdn.js +1 -1
  321. package/lib/utils/http-client.js +1 -1
  322. package/lib/utils/is-non-interactive.js +1 -1
  323. package/lib/utils/logger.js +1 -1
  324. package/lib/utils/params.js +1 -1
  325. package/lib/utils/platform.js +1 -1
  326. package/lib/utils/sleep.js +1 -1
  327. package/lib/utils/template-replacer.d.ts +2 -1
  328. package/lib/utils/template-replacer.js +1 -1
  329. package/lib/utils/update-notice.js +1 -1
  330. package/lib/utils/version.js +1 -1
  331. package/lib/utils/with-active-cookie.js +1 -1
  332. package/lib/utils/write-cli-side-channel.js +1 -1
  333. package/package.json +1 -1
  334. package/skills/rabetbase/SKILL.md +6 -5
  335. package/skills/rabetbase/guides/page-development-workflow.md +3 -0
  336. package/skills/rabetbase/guides/sdk-client-generation.md +5 -5
  337. package/skills/rabetbase/knowledge/page-schema/LrSmartJsx.md +11 -3
  338. package/skills/rabetbase/references/rabetbase-api-pull.md +5 -4
  339. package/skills/rabetbase/references/rabetbase-app-list.md +3 -0
  340. package/skills/rabetbase/references/rabetbase-bff-list.md +1 -1
  341. package/skills/rabetbase/references/rabetbase-bff-pull.md +2 -0
  342. package/skills/rabetbase/references/rabetbase-bff-status.md +2 -0
  343. package/skills/rabetbase/references/rabetbase-config.md +10 -9
  344. package/skills/rabetbase/references/rabetbase-doctor.md +2 -2
  345. package/skills/rabetbase/references/rabetbase-page-push.md +5 -1
  346. package/skills/rabetbase/references/rabetbase-workspace.md +4 -2
  347. package/skills/rabetbase.manifest.json +3 -3
  348. package/templates/generate-api/client.ts.tpl +1 -1
@@ -1 +1 @@
1
- const a204_0x540963=a204_0xab91;(function(_0xef1f1d,_0x3b212a){const _0x4a5e91=a204_0xab91,_0x52c6ed=_0xef1f1d();while(!![]){try{const _0x5a0809=parseInt(_0x4a5e91(0x79))/0x1+-parseInt(_0x4a5e91(0x94))/0x2*(-parseInt(_0x4a5e91(0x9d))/0x3)+parseInt(_0x4a5e91(0xa5))/0x4*(-parseInt(_0x4a5e91(0x8e))/0x5)+parseInt(_0x4a5e91(0xaa))/0x6*(-parseInt(_0x4a5e91(0x7d))/0x7)+parseInt(_0x4a5e91(0x9e))/0x8+-parseInt(_0x4a5e91(0x8d))/0x9*(-parseInt(_0x4a5e91(0x9a))/0xa)+-parseInt(_0x4a5e91(0x83))/0xb;if(_0x5a0809===_0x3b212a)break;else _0x52c6ed['push'](_0x52c6ed['shift']());}catch(_0x4b80e5){_0x52c6ed['push'](_0x52c6ed['shift']());}}}(a204_0x4a9c,0x56740));import{readFileSync,existsSync}from'node:fs';function a204_0xab91(_0x49b0d0,_0x540329){_0x49b0d0=_0x49b0d0-0x76;const _0x4a9c69=a204_0x4a9c();let _0xab9139=_0x4a9c69[_0x49b0d0];return _0xab9139;}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';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([a204_0x540963(0x89),a204_0x540963(0xa6)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set(['start',a204_0x540963(0xa6),a204_0x540963(0x8b),a204_0x540963(0x7e)]);export function syncProjectDomainRoutingBeforeScript(_0x4e999f,_0x4107a3){const _0x3d6d00=a204_0x540963;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x3d6d00(0x96)](_0x4107a3))return null;const _0x273a01=findProjectRootDirectory(_0x4e999f);if(!resolveConfigPath(_0x273a01))return null;const _0x147261=writeProjectDomainRoutingManifest(_0x273a01);return{'path':_0x147261[_0x3d6d00(0xb9)],'changed':_0x147261[_0x3d6d00(0x99)]};}function readPackageScripts(_0x49d43a){const _0x4ea66e=a204_0x540963,_0x5d9ab8=resolve(_0x49d43a,_0x4ea66e(0xb3));if(!existsSync(_0x5d9ab8))return null;try{const _0x1b56a6=JSON['parse'](readFileSync(_0x5d9ab8,_0x4ea66e(0xad)));return _0x1b56a6[_0x4ea66e(0x76)]??{};}catch{return null;}}function detectPackageManager(_0x5dd17d){const _0x481571=a204_0x540963;if(existsSync(resolve(_0x5dd17d,_0x481571(0xae)))||existsSync(resolve(_0x5dd17d,_0x481571(0x88))))return _0x481571(0x77);if(existsSync(resolve(_0x5dd17d,_0x481571(0xaf))))return _0x481571(0x91);if(existsSync(resolve(_0x5dd17d,'yarn.lock')))return'yarn';return'npm';}async function versionCheck(_0x59260c){const _0x5c70da=a204_0x540963,_0x157839=await checkCliVersion();(_0x157839[_0x5c70da(0x97)]||_0x157839[_0x5c70da(0xa7)])&&(printCliUpgradeWarning(_0x157839),assertCliVersionSupported(_0x157839));const _0x5373f7=await checkSdkVersion(_0x59260c);if(_0x5373f7['needsUpgrade'])printSdkUpgradeWarning(_0x5373f7);}function spawnScript(_0x218aee,_0x31cec8,_0x2dcf02,_0x2e8fa5){return new Promise((_0x54199e,_0x160e54)=>{const _0xba4776=a204_0xab91,_0x485727=[_0xba4776(0x95),_0x31cec8,..._0x2dcf02],_0x4a3b24=spawn(_0x218aee,_0x485727,{'cwd':_0x2e8fa5,'stdio':_0xba4776(0xb6),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2e8fa5,_0xba4776(0xb4),'.bin')+delimiter+process.env.PATH}});_0x4a3b24['on'](_0xba4776(0xb2),_0x4766e5=>{const _0x318f4d=_0xba4776;if(_0x4766e5===0x0||_0x4766e5===null)_0x54199e();else _0x160e54(new Error(_0x218aee+_0x318f4d(0x9c)+_0x31cec8+_0x318f4d(0xb0)+_0x4766e5));}),_0x4a3b24['on']('error',_0x160e54);});}function spawnViteBuildWatch(_0xc393fe){return new Promise((_0x468ea9,_0x2028de)=>{const _0x30409d=a204_0xab91,_0x2d829a=spawn(_0x30409d(0x7f),[_0x30409d(0x8b),_0x30409d(0x90)],{'cwd':_0xc393fe,'stdio':_0x30409d(0xb6),'shell':!![],'env':{...process.env,'PATH':''+join(_0xc393fe,'node_modules',_0x30409d(0x9f))+delimiter+process.env.PATH}});_0x2d829a['on'](_0x30409d(0xb2),_0x17c462=>{if(_0x17c462===0x0||_0x17c462===null)_0x468ea9();else _0x2028de(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x17c462));}),_0x2d829a['on']('error',_0x2028de);});}function a204_0x4a9c(){const _0x28fa18=['validation','3609puOxZu','10Zhioyl','Script\x20\x22','--watch','pnpm','boolean','error','953222qfBZVH','run','has','needsUpgrade','No\x20scripts\x20defined\x20in\x20package.json.','changed','13980ILPQSw','cwd','\x20run\x20','3BCcTdv','5437696UjPtVe','.bin','log','vite\x20preview\x20exited\x20with\x20code\x20','Domain\x20routing\x20synchronized:\x20','watch','push','82308cqVJJz','dev','belowMinimum','\x22\x20not\x20found\x20in\x20package.json.','all','1104Bzgebx','\x20run\x20preview\x20--watch','\x20\x20\x20\x20','utf-8','bun.lockb','pnpm-lock.yaml','\x20exited\x20with\x20code\x20','length','close','package.json','node_modules','write','inherit','No\x20package.json\x20found\x20in\x20current\x20directory.','Script\x20name\x20defined\x20in\x20package.json','path','scripts','bun','\x20\x20EXAMPLES','475775dnbBNJ','\x20run\x20start','\x0a\x20\x20Available\x20scripts:\x0a','\x20run\x20preview','4844VxvRSE','preview','vite','(none)','script','bool','18371122tAChfs','args','slice','join','Enable\x20watch\x20mode\x20for\x20preview','bun.lock','start','keys','build'];a204_0x4a9c=function(){return _0x28fa18;};return a204_0x4a9c();}function spawnVitePreview(_0x4ea746){return new Promise((_0x47bfd4,_0x22ab4c)=>{const _0x2cd0b5=a204_0xab91,_0xc0d0fc=spawn(_0x2cd0b5(0x7f),[_0x2cd0b5(0x7e)],{'cwd':_0x4ea746,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x4ea746,_0x2cd0b5(0xb4),'.bin')+delimiter+process.env.PATH}});_0xc0d0fc['on']('close',_0x3856ee=>{const _0x43dd43=_0x2cd0b5;if(_0x3856ee===0x0||_0x3856ee===null)_0x47bfd4();else _0x22ab4c(new Error(_0x43dd43(0xa1)+_0x3856ee));}),_0xc0d0fc['on'](_0x2cd0b5(0x93),_0x22ab4c);});}const runFlags=[{'name':a204_0x540963(0xa3),'type':a204_0x540963(0x92),'description':a204_0x540963(0x87),'default':![]}];export const runDefinition={'service':'run','command':a204_0x540963(0x95),'description':'Run\x20a\x20package.json\x20script','risk':a204_0x540963(0xb5),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a204_0x540963(0x81),'description':a204_0x540963(0xb8),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x5be92c=a204_0x540963,_0x22ead8=[];return _0x22ead8[_0x5be92c(0xa4)](_0x5be92c(0x78)),_0x22ead8[_0x5be92c(0xa4)](_0x5be92c(0xac)+CLI_BIN_NAME+_0x5be92c(0x7a)),_0x22ead8['push'](_0x5be92c(0xac)+CLI_BIN_NAME+'\x20run\x20build'),_0x22ead8[_0x5be92c(0xa4)](_0x5be92c(0xac)+CLI_BIN_NAME+_0x5be92c(0x7c)),_0x22ead8[_0x5be92c(0xa4)](_0x5be92c(0xac)+CLI_BIN_NAME+_0x5be92c(0xab)),_0x22ead8[_0x5be92c(0x86)]('\x0a');},async 'execute'(_0x396885){const _0x2be0b3=a204_0x540963,_0x84a863=process[_0x2be0b3(0x9b)](),_0x5e0e79=_0x396885['args'][0x0],_0x5a7bb3=_0x396885[_0x2be0b3(0x84)][_0x2be0b3(0x85)](0x1),_0x1d02e9=readPackageScripts(_0x84a863);if(!_0x1d02e9)throw CliErrors[_0x2be0b3(0x8c)](_0x2be0b3(0xb7));if(!_0x5e0e79){const _0x348d77=Object[_0x2be0b3(0x8a)](_0x1d02e9);if(_0x348d77[_0x2be0b3(0xb1)]===0x0)console[_0x2be0b3(0xa0)](_0x2be0b3(0x98));else{console[_0x2be0b3(0xa0)](_0x2be0b3(0x7b));for(const _0xf2e704 of _0x348d77){console[_0x2be0b3(0xa0)](_0x2be0b3(0xac)+_0xf2e704);}console['log']('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x1d02e9[_0x5e0e79])throw CliErrors[_0x2be0b3(0x8c)](_0x2be0b3(0x8f)+_0x5e0e79+_0x2be0b3(0xa8),'Available:\x20'+(Object[_0x2be0b3(0x8a)](_0x1d02e9)[_0x2be0b3(0x86)](',\x20')||_0x2be0b3(0x80)));const _0x54b48f=detectPackageManager(_0x84a863),_0x293095=syncProjectDomainRoutingBeforeScript(_0x84a863,_0x5e0e79);_0x293095?.[_0x2be0b3(0x99)]&&console[_0x2be0b3(0x93)](_0x2be0b3(0xa2)+_0x293095[_0x2be0b3(0xb9)]);VERSION_CHECK_SCRIPTS['has'](_0x5e0e79)&&await versionCheck(_0x84a863);if(_0x5e0e79===_0x2be0b3(0x7e)&&_0x396885[_0x2be0b3(0x82)]('watch'))return await Promise[_0x2be0b3(0xa9)]([spawnViteBuildWatch(_0x84a863),spawnVitePreview(_0x84a863)]),{'ok':!![]};return await spawnScript(_0x54b48f,_0x5e0e79,_0x5a7bb3,_0x84a863),{'ok':!![]};}};
1
+ const a204_0x350ae7=a204_0x3b74;(function(_0x55f378,_0x319c71){const _0x156d6a=a204_0x3b74,_0x2ad812=_0x55f378();while(!![]){try{const _0x378de1=parseInt(_0x156d6a(0x216))/0x1+parseInt(_0x156d6a(0x1fe))/0x2*(parseInt(_0x156d6a(0x209))/0x3)+-parseInt(_0x156d6a(0x1ec))/0x4*(-parseInt(_0x156d6a(0x1e9))/0x5)+-parseInt(_0x156d6a(0x221))/0x6*(-parseInt(_0x156d6a(0x21d))/0x7)+-parseInt(_0x156d6a(0x202))/0x8+parseInt(_0x156d6a(0x208))/0x9+-parseInt(_0x156d6a(0x20f))/0xa*(parseInt(_0x156d6a(0x206))/0xb);if(_0x378de1===_0x319c71)break;else _0x2ad812['push'](_0x2ad812['shift']());}catch(_0x323386){_0x2ad812['push'](_0x2ad812['shift']());}}}(a204_0x3dd8,0x9b898));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';function a204_0x3b74(_0x2485d6,_0x32f9fe){_0x2485d6=_0x2485d6-0x1e1;const _0x3dd86a=a204_0x3dd8();let _0x3b742f=_0x3dd86a[_0x2485d6];return _0x3b742f;}import{resolve,delimiter,join}from'node:path';function a204_0x3dd8(){const _0x122de0=['No\x20scripts\x20defined\x20in\x20package.json.','No\x20package.json\x20found\x20in\x20current\x20directory.','build','push','12VoQJYn','pnpm-lock.yaml','pnpm','needsUpgrade','9311960gbsGws','validation','.bin','preview','3286063NIeUBu','slice','1095543nwChmG','503445bSOaBl','\x20run\x20start','\x20run\x20build','watch','args','dev','50yYvrcW','Enable\x20watch\x20mode\x20for\x20preview','utf-8','close','parse','start','error','13361knVlJL','Script\x20\x22','bun','bun.lock','\x20run\x20preview','\x22\x20not\x20found\x20in\x20package.json.','changed','8464547ZzAMzl','\x20run\x20preview\x20--watch','\x20run\x20','has','6WRmLGh','bun.lockb','\x20exited\x20with\x20code\x20','join','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','bool','length','run','scripts','4717705LZuBgX','keys','log','4gtalMu','\x20\x20\x20\x20','vite','inherit','all','yarn','yarn.lock','boolean','belowMinimum','\x20run\x20<script>\x0a','cwd','write','path','\x0a\x20\x20Usage:\x20'];a204_0x3dd8=function(){return _0x122de0;};return a204_0x3dd8();}import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';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([a204_0x350ae7(0x214),a204_0x350ae7(0x20e)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a204_0x350ae7(0x214),'dev',a204_0x350ae7(0x1fc),a204_0x350ae7(0x205)]);export function syncProjectDomainRoutingBeforeScript(_0x1e29ca,_0x1da74b){const _0x352df5=a204_0x350ae7;if(!DOMAIN_ROUTING_SYNC_SCRIPTS['has'](_0x1da74b))return null;const _0x10047a=findProjectRootDirectory(_0x1e29ca);if(!resolveConfigPath(_0x10047a))return null;const _0x16c194=writeProjectDomainRoutingManifest(_0x10047a);return{'path':_0x16c194[_0x352df5(0x1f8)],'changed':_0x16c194[_0x352df5(0x21c)]};}function readPackageScripts(_0x578e5a){const _0x2bdd84=a204_0x350ae7,_0x5180e5=resolve(_0x578e5a,'package.json');if(!existsSync(_0x5180e5))return null;try{const _0x2b1c22=JSON[_0x2bdd84(0x213)](readFileSync(_0x5180e5,_0x2bdd84(0x211)));return _0x2b1c22[_0x2bdd84(0x1e8)]??{};}catch{return null;}}function detectPackageManager(_0x1c2896){const _0x5b854b=a204_0x350ae7;if(existsSync(resolve(_0x1c2896,_0x5b854b(0x1e1)))||existsSync(resolve(_0x1c2896,_0x5b854b(0x219))))return _0x5b854b(0x218);if(existsSync(resolve(_0x1c2896,_0x5b854b(0x1ff))))return _0x5b854b(0x200);if(existsSync(resolve(_0x1c2896,_0x5b854b(0x1f2))))return _0x5b854b(0x1f1);return'npm';}async function versionCheck(_0x3131cf){const _0x13f212=a204_0x350ae7,_0x912eb7=await checkCliVersion();(_0x912eb7[_0x13f212(0x201)]||_0x912eb7[_0x13f212(0x1f4)])&&(printCliUpgradeWarning(_0x912eb7),assertCliVersionSupported(_0x912eb7));const _0x475130=await checkSdkVersion(_0x3131cf);if(_0x475130[_0x13f212(0x201)])printSdkUpgradeWarning(_0x475130);}function spawnScript(_0x4c695e,_0x13ab62,_0x20bb32,_0xa24922){return new Promise((_0x1d6821,_0xaa7cd6)=>{const _0x2d0421=a204_0x3b74,_0x3dbd3d=['run',_0x13ab62,..._0x20bb32],_0x227608=spawn(_0x4c695e,_0x3dbd3d,{'cwd':_0xa24922,'stdio':_0x2d0421(0x1ef),'shell':!![],'env':{...process.env,'PATH':''+join(_0xa24922,'node_modules',_0x2d0421(0x204))+delimiter+process.env.PATH}});_0x227608['on'](_0x2d0421(0x212),_0x40d045=>{const _0x3fd81a=_0x2d0421;if(_0x40d045===0x0||_0x40d045===null)_0x1d6821();else _0xaa7cd6(new Error(_0x4c695e+_0x3fd81a(0x21f)+_0x13ab62+_0x3fd81a(0x1e2)+_0x40d045));}),_0x227608['on'](_0x2d0421(0x215),_0xaa7cd6);});}function spawnViteBuildWatch(_0x44b468){return new Promise((_0x31b7a7,_0x4bc308)=>{const _0x9b1084=a204_0x3b74,_0x2cc6c4=spawn(_0x9b1084(0x1ee),['build','--watch'],{'cwd':_0x44b468,'stdio':_0x9b1084(0x1ef),'shell':!![],'env':{...process.env,'PATH':''+join(_0x44b468,'node_modules',_0x9b1084(0x204))+delimiter+process.env.PATH}});_0x2cc6c4['on'](_0x9b1084(0x212),_0x54da08=>{const _0xc15ad4=_0x9b1084;if(_0x54da08===0x0||_0x54da08===null)_0x31b7a7();else _0x4bc308(new Error(_0xc15ad4(0x1e4)+_0x54da08));}),_0x2cc6c4['on']('error',_0x4bc308);});}function spawnVitePreview(_0x5a95b9){return new Promise((_0x20a19a,_0x22fcad)=>{const _0x1e5eb6=a204_0x3b74,_0x4d6aa0=spawn(_0x1e5eb6(0x1ee),['preview'],{'cwd':_0x5a95b9,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x5a95b9,'node_modules',_0x1e5eb6(0x204))+delimiter+process.env.PATH}});_0x4d6aa0['on']('close',_0x3b781f=>{if(_0x3b781f===0x0||_0x3b781f===null)_0x20a19a();else _0x22fcad(new Error('vite\x20preview\x20exited\x20with\x20code\x20'+_0x3b781f));}),_0x4d6aa0['on']('error',_0x22fcad);});}const runFlags=[{'name':a204_0x350ae7(0x20c),'type':a204_0x350ae7(0x1f3),'description':a204_0x350ae7(0x210),'default':![]}];export const runDefinition={'service':a204_0x350ae7(0x1e7),'command':a204_0x350ae7(0x1e7),'description':'Run\x20a\x20package.json\x20script','risk':a204_0x350ae7(0x1f7),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x5b089d=a204_0x350ae7,_0x2915e7=[];return _0x2915e7[_0x5b089d(0x1fd)]('\x20\x20EXAMPLES'),_0x2915e7[_0x5b089d(0x1fd)](_0x5b089d(0x1ed)+CLI_BIN_NAME+_0x5b089d(0x20a)),_0x2915e7['push'](_0x5b089d(0x1ed)+CLI_BIN_NAME+_0x5b089d(0x20b)),_0x2915e7[_0x5b089d(0x1fd)](_0x5b089d(0x1ed)+CLI_BIN_NAME+_0x5b089d(0x21a)),_0x2915e7[_0x5b089d(0x1fd)](_0x5b089d(0x1ed)+CLI_BIN_NAME+_0x5b089d(0x21e)),_0x2915e7[_0x5b089d(0x1e3)]('\x0a');},async 'execute'(_0x2195c9){const _0x5128cb=a204_0x350ae7,_0x5929d4=process[_0x5128cb(0x1f6)](),_0x3fb009=_0x2195c9[_0x5128cb(0x20d)][0x0],_0x5055b9=_0x2195c9[_0x5128cb(0x20d)][_0x5128cb(0x207)](0x1),_0x3eeaca=readPackageScripts(_0x5929d4);if(!_0x3eeaca)throw CliErrors['validation'](_0x5128cb(0x1fb));if(!_0x3fb009){const _0x538db9=Object[_0x5128cb(0x1ea)](_0x3eeaca);if(_0x538db9[_0x5128cb(0x1e6)]===0x0)console['log'](_0x5128cb(0x1fa));else{console['log']('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x37d324 of _0x538db9){console[_0x5128cb(0x1eb)](_0x5128cb(0x1ed)+_0x37d324);}console['log'](_0x5128cb(0x1f9)+CLI_BIN_NAME+_0x5128cb(0x1f5));}return{'ok':!![]};}if(!_0x3eeaca[_0x3fb009])throw CliErrors[_0x5128cb(0x203)](_0x5128cb(0x217)+_0x3fb009+_0x5128cb(0x21b),'Available:\x20'+(Object['keys'](_0x3eeaca)[_0x5128cb(0x1e3)](',\x20')||'(none)'));const _0x3575b7=detectPackageManager(_0x5929d4),_0x481382=syncProjectDomainRoutingBeforeScript(_0x5929d4,_0x3fb009);_0x481382?.['changed']&&console[_0x5128cb(0x215)]('Domain\x20routing\x20synchronized:\x20'+_0x481382[_0x5128cb(0x1f8)]);VERSION_CHECK_SCRIPTS[_0x5128cb(0x220)](_0x3fb009)&&await versionCheck(_0x5929d4);if(_0x3fb009===_0x5128cb(0x205)&&_0x2195c9[_0x5128cb(0x1e5)]('watch'))return await Promise[_0x5128cb(0x1f0)]([spawnViteBuildWatch(_0x5929d4),spawnVitePreview(_0x5929d4)]),{'ok':!![]};return await spawnScript(_0x3575b7,_0x3fb009,_0x5055b9,_0x5929d4),{'ok':!![]};}};
@@ -1 +1 @@
1
- const a205_0x2f3c79=a205_0x219f;function a205_0x219f(_0x5b4e82,_0x2f5ab9){_0x5b4e82=_0x5b4e82-0x109;const _0x56568f=a205_0x5656();let _0x219f89=_0x56568f[_0x5b4e82];return _0x219f89;}function a205_0x5656(){const _0x14fed5=['9163520CNtwTV','15YTOwCy','9403471RACogE','schema','436116PuLWcj','1422850UROebp','30vpghyF','945320EleTBW','18KnFLMb','240420GRFjde','export','2248821Jzrlyj'];a205_0x5656=function(){return _0x14fed5;};return a205_0x5656();}(function(_0x3b6b0a,_0x5f1a8f){const _0x50ac25=a205_0x219f,_0x5784a0=_0x3b6b0a();while(!![]){try{const _0xc06fac=-parseInt(_0x50ac25(0x10d))/0x1+-parseInt(_0x50ac25(0x112))/0x2+parseInt(_0x50ac25(0x10a))/0x3*(parseInt(_0x50ac25(0x110))/0x4)+-parseInt(_0x50ac25(0x10e))/0x5*(parseInt(_0x50ac25(0x111))/0x6)+parseInt(_0x50ac25(0x10b))/0x7+-parseInt(_0x50ac25(0x109))/0x8+parseInt(_0x50ac25(0x114))/0x9*(parseInt(_0x50ac25(0x10f))/0xa);if(_0xc06fac===_0x5f1a8f)break;else _0x5784a0['push'](_0x5784a0['shift']());}catch(_0x519961){_0x5784a0['push'](_0x5784a0['shift']());}}}(a205_0x5656,0xaf91e));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x3b24b1){const _0x25a614=await buildSchemaPayload();return{'ok':!![],'data':_0x25a614};}export const schemaDefinition={'service':a205_0x2f3c79(0x10c),'command':a205_0x2f3c79(0x113),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
1
+ const a205_0x5cce1c=a205_0x2e98;(function(_0x3f990b,_0x1708d8){const _0x58595e=a205_0x2e98,_0x46f729=_0x3f990b();while(!![]){try{const _0x5e0434=-parseInt(_0x58595e(0x187))/0x1*(-parseInt(_0x58595e(0x18a))/0x2)+parseInt(_0x58595e(0x18e))/0x3+parseInt(_0x58595e(0x18c))/0x4+parseInt(_0x58595e(0x185))/0x5+parseInt(_0x58595e(0x186))/0x6*(-parseInt(_0x58595e(0x18d))/0x7)+parseInt(_0x58595e(0x190))/0x8+parseInt(_0x58595e(0x184))/0x9*(-parseInt(_0x58595e(0x183))/0xa);if(_0x5e0434===_0x1708d8)break;else _0x46f729['push'](_0x46f729['shift']());}catch(_0x18ffa2){_0x46f729['push'](_0x46f729['shift']());}}}(a205_0x509f,0x87573));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0xc6f198){const _0x3828b6=await buildSchemaPayload();return{'ok':!![],'data':_0x3828b6};}function a205_0x2e98(_0x2322f8,_0x523387){_0x2322f8=_0x2322f8-0x183;const _0x509f9a=a205_0x509f();let _0x2e98a8=_0x509f9a[_0x2322f8];return _0x2e98a8;}function a205_0x509f(){const _0x4d2e85=['1672458DEyhSH','Export\x20machine-readable\x20command\x20schema\x20(JSON)','1177120LuaQgW','88340VKOFdQ','2806071QTTIoz','read','7958896GAwXsJ','83170PibBRt','2799eurDPy','5449070cIzVOg','480YCAmrw','1XzZWmX','json','schema'];a205_0x509f=function(){return _0x4d2e85;};return a205_0x509f();}export const schemaDefinition={'service':a205_0x5cce1c(0x189),'command':'export','description':a205_0x5cce1c(0x18b),'risk':a205_0x5cce1c(0x18f),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a205_0x5cce1c(0x188),'flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a206_0x1cf83b=a206_0x2785;(function(_0x17ed89,_0xc12730){const _0x1c7d0c=a206_0x2785,_0x274bb1=_0x17ed89();while(!![]){try{const _0x42261d=parseInt(_0x1c7d0c(0xb9))/0x1*(-parseInt(_0x1c7d0c(0x8b))/0x2)+parseInt(_0x1c7d0c(0xa5))/0x3*(parseInt(_0x1c7d0c(0xa0))/0x4)+-parseInt(_0x1c7d0c(0xbf))/0x5*(-parseInt(_0x1c7d0c(0xb5))/0x6)+-parseInt(_0x1c7d0c(0xb0))/0x7*(parseInt(_0x1c7d0c(0xa4))/0x8)+parseInt(_0x1c7d0c(0x82))/0x9+parseInt(_0x1c7d0c(0xb8))/0xa+parseInt(_0x1c7d0c(0x88))/0xb*(-parseInt(_0x1c7d0c(0x9a))/0xc);if(_0x42261d===_0xc12730)break;else _0x274bb1['push'](_0x274bb1['shift']());}catch(_0x319ab0){_0x274bb1['push'](_0x274bb1['shift']());}}}(a206_0xac97,0xc61cd));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 a206_0x2785(_0x291cfd,_0x46d54f){_0x291cfd=_0x291cfd-0x82;const _0xac97a1=a206_0xac97();let _0x2785e6=_0xac97a1[_0x291cfd];return _0x2785e6;}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 a206_0xac97(){const _0x114d4c=['SQL\x20name\x20cannot\x20be\x20empty','\x20\x20SELECT\x201\x20AS\x20id','string','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','isInteger','6223cmwTuL','toISOString','number','dbName','File\x20already\x20exists:\x20','209958JVKUjB','lastSync','utf8','10005940otdiCN','587464mnicGH','dbId\x20cannot\x20be\x20empty','sqlRootDir','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','str','sqlName','135gxBUzu','parse','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlCode','dbId','10835559ccIrYF','length','Target\x20database\x20dbId:','sqlRoot','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','/smartapi/custom/saveUserCustomSql','1117391SJnAar','flag','Plain\x20SQL\x20(sql)','2okYKAs','flagMissing','validation','trim','name','Select\x20the\x20target\x20database:','isFinite','catch','nonInteractive','mybatisXml','mode','appCode','Select\x20the\x20local\x20SQL\x20mode:','SELECT\x201\x20AS\x20id;','Created\x20SQL\x20query\x20','204pbQZMk','db-id','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','stringify','join','POST','334120oLEZoY','Invalid\x20database\x20selection\x20payload:\x20','create','Local\x20SQL\x20file\x20mode','9232hotoSY','36jqNiXY','</select>','sql','map','dbId\x20must\x20be\x20a\x20positive\x20integer','__manual__'];a206_0xac97=function(){return _0x114d4c;};return a206_0xac97();}function generateSqlTemplate(_0x3c4d60){const _0x1948fc=a206_0x2785;if(_0x3c4d60===_0x1948fc(0x94))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x1948fc(0xac),_0x1948fc(0xa6),''][_0x1948fc(0x9e)]('\x0a');return[_0x1948fc(0x98),''][_0x1948fc(0x9e)]('\x0a');}export const sqlCreate={'service':a206_0x1cf83b(0xa7),'command':a206_0x1cf83b(0xa2),'description':a206_0x1cf83b(0x9c),'risk':'write','flags':[{'name':a206_0x1cf83b(0x8f),'type':a206_0x1cf83b(0xad),'description':'SQL\x20query\x20display\x20name'},{'name':a206_0x1cf83b(0x9b),'type':a206_0x1cf83b(0xb2),'description':'Target\x20database\x20ID'},{'name':a206_0x1cf83b(0x95),'type':a206_0x1cf83b(0xad),'enum':[a206_0x1cf83b(0xa7),a206_0x1cf83b(0x94)],'description':a206_0x1cf83b(0xa3)}],async 'validate'(_0x6b9cc1){const _0x51025f=a206_0x1cf83b;if(!_0x6b9cc1[_0x51025f(0x93)])return;if(!_0x6b9cc1[_0x51025f(0xbd)](_0x51025f(0x8f))[_0x51025f(0x8e)]())throw CliErrors[_0x51025f(0x8c)](_0x51025f(0x8f),_0x51025f(0x86));const _0x1653fb=resolveProvidedDbId(_0x6b9cc1);if(typeof _0x1653fb!==_0x51025f(0xb2)||!Number[_0x51025f(0x91)](_0x1653fb)||_0x1653fb<=0x0)throw CliErrors[_0x51025f(0x8c)](_0x51025f(0x9b),_0x51025f(0xc1));if(!_0x6b9cc1[_0x51025f(0xbd)](_0x51025f(0x95))[_0x51025f(0x8e)]())throw CliErrors[_0x51025f(0x8c)](_0x51025f(0x95),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x57f7b0){const _0x2fa7d0=a206_0x1cf83b,_0x230aa7=loadSqlProjectConfig(_0x57f7b0[_0x2fa7d0(0x96)]),{sqlName:_0x5c94a5,dbId:_0x10b97b,dbName:_0x2ff289,mode:_0x2b8a35}=await resolveSqlNewInputs(_0x57f7b0),_0x240f76=buildSqlRelativePath('<server-generated-sqlCode>',_0x5c94a5,_0x2ff289,_0x2b8a35,_0x10b97b),_0x5f5d08=_0x230aa7[_0x2fa7d0(0xbb)]+'/'+_0x240f76;return{'method':_0x2fa7d0(0x9f),'url':_0x2fa7d0(0x87),'body':{'appCode':_0x57f7b0[_0x2fa7d0(0x96)],'sqlName':_0x5c94a5,'dbId':_0x10b97b,'mode':_0x2b8a35,'localPath':_0x5f5d08},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x230aa7[_0x2fa7d0(0xbb)]};},async 'execute'(_0x854fdd){const _0x59373f=a206_0x1cf83b,_0x5093a1=loadSqlProjectConfig(_0x854fdd[_0x59373f(0x96)]),{sqlName:_0x116725,dbId:_0x3c4cca,dbName:_0x15e635,mode:_0x393dee}=await resolveSqlNewInputs(_0x854fdd),_0x235b27=generateSqlTemplate(_0x393dee),_0x307192=await createSqlQuery({'appCode':_0x854fdd[_0x59373f(0x96)],'sqlName':_0x116725,'dbId':_0x3c4cca,'sqlContent':_0x235b27}),_0x180e6d=ensureRemoteSqlContent(_0x307192),_0x5e1d70=_0x15e635||await getDbName(_0x854fdd['appCode'],_0x3c4cca)[_0x59373f(0x92)](()=>undefined),_0x4bc693=buildSqlRelativePath(_0x307192['sqlCode'],_0x307192[_0x59373f(0xbe)],_0x5e1d70,_0x393dee,_0x3c4cca),_0x1945d2=_0x5093a1['sqlRootDir']+'/'+_0x4bc693,_0x3fa9bb=buildLocalSqlFileContent({'sqlCode':_0x307192['sqlCode'],'sqlName':_0x307192[_0x59373f(0xbe)],'dbId':_0x307192[_0x59373f(0xc3)]},_0x180e6d,{'dbName':_0x5e1d70,'mode':_0x393dee,'syncedAt':new Date()['toISOString'](),'description':_0x307192['description']});if(await fileExists(_0x1945d2))throw CliErrors[_0x59373f(0x8d)](_0x59373f(0xb4)+_0x1945d2);await ensureParentDirectory(_0x1945d2),await writeFile(_0x1945d2,_0x3fa9bb,_0x59373f(0xb7));const _0x13e06=await readSqlLockFile(_0x5093a1['lockFilePath']),{lockData:_0x498b90,appLock:_0x51a844}=ensureSqlLockScope(_0x13e06??createEmptySqlLock(),_0x5093a1[_0x59373f(0x96)],_0x5093a1[_0x59373f(0x85)],'new');return _0x51a844['sqls'][_0x307192[_0x59373f(0xc2)]]={...buildSqlLockEntry(_0x307192,_0x180e6d,computeSqlContentHash(_0x3fa9bb),{'dbName':_0x5e1d70}),'path':_0x4bc693,'mode':_0x393dee},_0x51a844[_0x59373f(0xb6)]=new Date()[_0x59373f(0xb1)](),await writeSqlLockFile(_0x5093a1['lockFilePath'],_0x498b90),{'ok':!![],'data':{'id':_0x307192['id'],'sqlCode':_0x307192[_0x59373f(0xc2)],'sqlName':_0x307192['sqlName'],'dbId':_0x307192[_0x59373f(0xc3)],'path':_0x1945d2,'mode':_0x393dee},'message':_0x59373f(0x99)+_0x307192[_0x59373f(0xc2)]};}};async function resolveSqlNewInputs(_0x59d710){const _0x3e4924=await resolveSqlNameInput(_0x59d710),{dbId:_0x3c29c1,dbName:_0x161e39}=await resolveDbSelection(_0x59d710),_0x113e21=await resolveSqlModeInput(_0x59d710);return{'sqlName':_0x3e4924,'dbId':_0x3c29c1,'dbName':_0x161e39,'mode':_0x113e21};}async function resolveSqlNameInput(_0x44de3f){const _0x3c7c10=a206_0x1cf83b,_0x2b777f=_0x44de3f[_0x3c7c10(0xbd)]('name')['trim']();if(_0x2b777f)return _0x2b777f;if(_0x44de3f[_0x3c7c10(0x93)])throw CliErrors[_0x3c7c10(0x8c)](_0x3c7c10(0x8f),_0x3c7c10(0x86));return(await input({'message':'SQL\x20name:','validate':_0xcb0d77=>_0xcb0d77[_0x3c7c10(0x8e)]()?!![]:_0x3c7c10(0xab)}))[_0x3c7c10(0x8e)]();}async function resolveDbSelection(_0x4afe76){const _0x4bc929=a206_0x1cf83b,_0xad18ba=resolveProvidedDbId(_0x4afe76);if(typeof _0xad18ba===_0x4bc929(0xb2)&&Number['isFinite'](_0xad18ba)&&_0xad18ba>0x0)return{'dbId':_0xad18ba,'dbName':await getDbName(_0x4afe76[_0x4bc929(0x96)],_0xad18ba)[_0x4bc929(0x92)](()=>undefined)};if(_0x4afe76[_0x4bc929(0x93)])throw CliErrors[_0x4bc929(0x8c)](_0x4bc929(0x9b),_0x4bc929(0xc1));const _0xa6ae1c=await listDatabases(_0x4afe76[_0x4bc929(0x96)])[_0x4bc929(0x92)](()=>[]);if(_0xa6ae1c['length']===0x1)return{'dbId':_0xa6ae1c[0x0]['dbId'],'dbName':_0xa6ae1c[0x0][_0x4bc929(0xb3)]};if(_0xa6ae1c[_0x4bc929(0x83)]>0x1){const _0xdd0523=await select({'message':_0x4bc929(0x90),'choices':[..._0xa6ae1c[_0x4bc929(0xa8)](_0x23526c=>({'name':_0x23526c['dbName']+'\x20('+_0x23526c[_0x4bc929(0xc3)]+')','value':serializeDbSelection(_0x23526c)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':_0x4bc929(0xaa)}]});if(_0xdd0523!==_0x4bc929(0xaa))return deserializeDbSelection(_0xdd0523);}const _0x236079=await input({'message':_0x4bc929(0x84),'validate':_0x2af753=>{const _0x154ca0=_0x4bc929,_0x5ea6d9=_0x2af753[_0x154ca0(0x8e)]();if(!_0x5ea6d9)return _0x154ca0(0xba);const _0x314b24=Number(_0x5ea6d9);if(!Number[_0x154ca0(0xaf)](_0x314b24)||_0x314b24<=0x0)return _0x154ca0(0xa9);return!![];}});return{'dbId':Number(_0x236079[_0x4bc929(0x8e)]())};}async function resolveSqlModeInput(_0x443e70){const _0x4acade=a206_0x1cf83b,_0x1d5223=_0x443e70[_0x4acade(0xbd)](_0x4acade(0x95))[_0x4acade(0x8e)]();if(_0x1d5223===_0x4acade(0xa7)||_0x1d5223===_0x4acade(0x94))return _0x1d5223;if(_0x443e70[_0x4acade(0x93)])throw CliErrors[_0x4acade(0x8c)](_0x4acade(0x95),_0x4acade(0xae));return await select({'message':_0x4acade(0x97),'choices':[{'name':_0x4acade(0x8a),'value':_0x4acade(0xa7),'description':_0x4acade(0xbc)},{'name':'MyBatis\x20XML\x20(mybatisXml)','value':_0x4acade(0x94),'description':'For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags'}]});}function serializeDbSelection(_0x3ea71){const _0x4c985a=a206_0x1cf83b;return JSON[_0x4c985a(0x9d)]({'dbId':_0x3ea71[_0x4c985a(0xc3)],'dbName':_0x3ea71[_0x4c985a(0xb3)]});}function deserializeDbSelection(_0x63e158){const _0x22d534=a206_0x1cf83b;try{const _0x3e2c16=JSON[_0x22d534(0xc0)](_0x63e158);if(typeof _0x3e2c16[_0x22d534(0xc3)]===_0x22d534(0xb2)&&Number['isFinite'](_0x3e2c16[_0x22d534(0xc3)]))return{'dbId':_0x3e2c16[_0x22d534(0xc3)],'dbName':_0x3e2c16['dbName']};}catch{}throw CliErrors['validation'](_0x22d534(0xa1)+_0x63e158);}function resolveProvidedDbId(_0x3ca68e){const _0x76087=a206_0x1cf83b,_0x5a26d2=_0x3ca68e[_0x76087(0x89)](_0x76087(0x9b));if(typeof _0x5a26d2===_0x76087(0xb2)&&Number['isFinite'](_0x5a26d2))return _0x5a26d2;return undefined;}
1
+ const a206_0x101467=a206_0x1cb3;(function(_0xd12e8c,_0x5939f0){const _0x3b8db7=a206_0x1cb3,_0x2c1c63=_0xd12e8c();while(!![]){try{const _0x77e8b9=-parseInt(_0x3b8db7(0xf0))/0x1*(-parseInt(_0x3b8db7(0xec))/0x2)+-parseInt(_0x3b8db7(0x115))/0x3*(-parseInt(_0x3b8db7(0x10e))/0x4)+parseInt(_0x3b8db7(0x11c))/0x5*(parseInt(_0x3b8db7(0x12a))/0x6)+-parseInt(_0x3b8db7(0x119))/0x7*(parseInt(_0x3b8db7(0x10d))/0x8)+-parseInt(_0x3b8db7(0x117))/0x9*(parseInt(_0x3b8db7(0x12b))/0xa)+-parseInt(_0x3b8db7(0xf8))/0xb+parseInt(_0x3b8db7(0x122))/0xc*(parseInt(_0x3b8db7(0x116))/0xd);if(_0x77e8b9===_0x5939f0)break;else _0x2c1c63['push'](_0x2c1c63['shift']());}catch(_0x162adc){_0x2c1c63['push'](_0x2c1c63['shift']());}}}(a206_0x71d5,0xda73f));import{writeFile}from'node:fs/promises';function a206_0x1cb3(_0x2edacc,_0x2aec67){_0x2edacc=_0x2edacc-0xe8;const _0x71d598=a206_0x71d5();let _0x1cb344=_0x71d598[_0x2edacc];return _0x1cb344;}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';function a206_0x71d5(){const _0x6019f4=['Select\x20the\x20target\x20database:','sqlRoot','mybatisXml','1317WRtUcs','13385047pwekQq','720RaNdLS','catch','166607Wkdtfx','length','flagMissing','80atYzHN','sqlName','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlRootDir','isFinite','name','12xUvMiq','Plain\x20SQL\x20(sql)','SELECT\x201\x20AS\x20id;','POST','nonInteractive','db-id','SQL\x20name\x20cannot\x20be\x20empty','join','594840iMWMmE','159170xxNdfY','mode','Select\x20the\x20local\x20SQL\x20mode:','SQL\x20query\x20display\x20name','lockFilePath','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','flag','39306iwvoft','trim','string','str','5WkSpzq','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','/smartapi/custom/saveUserCustomSql','new','✎\x20Enter\x20dbId\x20manually','</select>','dbName','appCode','7863339sgDzOj','isInteger','lastSync','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','utf8','Target\x20database\x20ID','Local\x20SQL\x20file\x20mode','__manual__','Invalid\x20database\x20selection\x20payload:\x20','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','stringify','dbId','\x20\x20SELECT\x201\x20AS\x20id','SQL\x20name:','sqlCode','toISOString','sql','write','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','create','parse','456TQJYtw','13900ypFjpD','dbId\x20must\x20be\x20a\x20positive\x20integer','MyBatis\x20XML\x20(mybatisXml)','number'];a206_0x71d5=function(){return _0x6019f4;};return a206_0x71d5();}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x38aa85){const _0x46a1c2=a206_0x1cb3;if(_0x38aa85===_0x46a1c2(0x114))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x46a1c2(0x104),_0x46a1c2(0xf5),''][_0x46a1c2(0x129)]('\x0a');return[_0x46a1c2(0x124),''][_0x46a1c2(0x129)]('\x0a');}export const sqlCreate={'service':a206_0x101467(0x108),'command':a206_0x101467(0x10b),'description':a206_0x101467(0x101),'risk':a206_0x101467(0x109),'flags':[{'name':a206_0x101467(0x121),'type':a206_0x101467(0xee),'description':a206_0x101467(0x12e)},{'name':a206_0x101467(0x127),'type':'number','description':a206_0x101467(0xfd)},{'name':a206_0x101467(0x12c),'type':'string','enum':[a206_0x101467(0x108),a206_0x101467(0x114)],'description':a206_0x101467(0xfe)}],async 'validate'(_0xccedca){const _0x304a0a=a206_0x101467;if(!_0xccedca['nonInteractive'])return;if(!_0xccedca['str']('name')['trim']())throw CliErrors['flagMissing'](_0x304a0a(0x121),_0x304a0a(0xe9));const _0x4446cd=resolveProvidedDbId(_0xccedca);if(typeof _0x4446cd!==_0x304a0a(0x111)||!Number[_0x304a0a(0x120)](_0x4446cd)||_0x4446cd<=0x0)throw CliErrors[_0x304a0a(0x11b)](_0x304a0a(0x127),_0x304a0a(0x11e));if(!_0xccedca['str']('mode')['trim']())throw CliErrors[_0x304a0a(0x11b)](_0x304a0a(0x12c),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x418813){const _0x233466=a206_0x101467,_0x5be692=loadSqlProjectConfig(_0x418813['appCode']),{sqlName:_0x2b9cf7,dbId:_0x562540,dbName:_0x26cb02,mode:_0x76cd25}=await resolveSqlNewInputs(_0x418813),_0x192a0c=buildSqlRelativePath('<server-generated-sqlCode>',_0x2b9cf7,_0x26cb02,_0x76cd25,_0x562540),_0x67dbcc=_0x5be692[_0x233466(0x11f)]+'/'+_0x192a0c;return{'method':_0x233466(0x125),'url':_0x233466(0xf2),'body':{'appCode':_0x418813[_0x233466(0xf7)],'sqlName':_0x2b9cf7,'dbId':_0x562540,'mode':_0x76cd25,'localPath':_0x67dbcc},'description':_0x233466(0xfb)+_0x5be692[_0x233466(0x11f)]};},async 'execute'(_0x379a8c){const _0xa60e21=a206_0x101467,_0x5a5da2=loadSqlProjectConfig(_0x379a8c[_0xa60e21(0xf7)]),{sqlName:_0x249418,dbId:_0x38f4d1,dbName:_0x3b5037,mode:_0x4dd1a8}=await resolveSqlNewInputs(_0x379a8c),_0x1c5506=generateSqlTemplate(_0x4dd1a8),_0x38590c=await createSqlQuery({'appCode':_0x379a8c['appCode'],'sqlName':_0x249418,'dbId':_0x38f4d1,'sqlContent':_0x1c5506}),_0x5efb9e=ensureRemoteSqlContent(_0x38590c),_0x2a1212=_0x3b5037||await getDbName(_0x379a8c['appCode'],_0x38f4d1)[_0xa60e21(0x118)](()=>undefined),_0x5c5f45=buildSqlRelativePath(_0x38590c[_0xa60e21(0x106)],_0x38590c[_0xa60e21(0x11d)],_0x2a1212,_0x4dd1a8,_0x38f4d1),_0x562088=_0x5a5da2[_0xa60e21(0x11f)]+'/'+_0x5c5f45,_0x39a475=buildLocalSqlFileContent({'sqlCode':_0x38590c[_0xa60e21(0x106)],'sqlName':_0x38590c[_0xa60e21(0x11d)],'dbId':_0x38590c[_0xa60e21(0x103)]},_0x5efb9e,{'dbName':_0x2a1212,'mode':_0x4dd1a8,'syncedAt':new Date()[_0xa60e21(0x107)](),'description':_0x38590c['description']});if(await fileExists(_0x562088))throw CliErrors['validation']('File\x20already\x20exists:\x20'+_0x562088);await ensureParentDirectory(_0x562088),await writeFile(_0x562088,_0x39a475,_0xa60e21(0xfc));const _0x133a78=await readSqlLockFile(_0x5a5da2['lockFilePath']),{lockData:_0x1049b2,appLock:_0x1fddcd}=ensureSqlLockScope(_0x133a78??createEmptySqlLock(),_0x5a5da2['appCode'],_0x5a5da2[_0xa60e21(0x113)],_0xa60e21(0xf3));return _0x1fddcd['sqls'][_0x38590c[_0xa60e21(0x106)]]={...buildSqlLockEntry(_0x38590c,_0x5efb9e,computeSqlContentHash(_0x39a475),{'dbName':_0x2a1212}),'path':_0x5c5f45,'mode':_0x4dd1a8},_0x1fddcd[_0xa60e21(0xfa)]=new Date()[_0xa60e21(0x107)](),await writeSqlLockFile(_0x5a5da2[_0xa60e21(0xe8)],_0x1049b2),{'ok':!![],'data':{'id':_0x38590c['id'],'sqlCode':_0x38590c[_0xa60e21(0x106)],'sqlName':_0x38590c[_0xa60e21(0x11d)],'dbId':_0x38590c[_0xa60e21(0x103)],'path':_0x562088,'mode':_0x4dd1a8},'message':'Created\x20SQL\x20query\x20'+_0x38590c[_0xa60e21(0x106)]};}};async function resolveSqlNewInputs(_0x1fba90){const _0x446c64=await resolveSqlNameInput(_0x1fba90),{dbId:_0x5872d4,dbName:_0x373e79}=await resolveDbSelection(_0x1fba90),_0x169c5f=await resolveSqlModeInput(_0x1fba90);return{'sqlName':_0x446c64,'dbId':_0x5872d4,'dbName':_0x373e79,'mode':_0x169c5f};}async function resolveSqlNameInput(_0x5d794c){const _0xb6c7db=a206_0x101467,_0x34e298=_0x5d794c[_0xb6c7db(0xef)]('name')['trim']();if(_0x34e298)return _0x34e298;if(_0x5d794c[_0xb6c7db(0x126)])throw CliErrors['flagMissing'](_0xb6c7db(0x121),_0xb6c7db(0xe9));return(await input({'message':_0xb6c7db(0x105),'validate':_0x2c3b89=>_0x2c3b89[_0xb6c7db(0xed)]()?!![]:_0xb6c7db(0x128)}))[_0xb6c7db(0xed)]();}async function resolveDbSelection(_0xd01abe){const _0x24d7a6=a206_0x101467,_0x436143=resolveProvidedDbId(_0xd01abe);if(typeof _0x436143==='number'&&Number['isFinite'](_0x436143)&&_0x436143>0x0)return{'dbId':_0x436143,'dbName':await getDbName(_0xd01abe[_0x24d7a6(0xf7)],_0x436143)[_0x24d7a6(0x118)](()=>undefined)};if(_0xd01abe[_0x24d7a6(0x126)])throw CliErrors['flagMissing'](_0x24d7a6(0x127),_0x24d7a6(0x11e));const _0x2dabe0=await listDatabases(_0xd01abe[_0x24d7a6(0xf7)])[_0x24d7a6(0x118)](()=>[]);if(_0x2dabe0['length']===0x1)return{'dbId':_0x2dabe0[0x0]['dbId'],'dbName':_0x2dabe0[0x0][_0x24d7a6(0xf6)]};if(_0x2dabe0[_0x24d7a6(0x11a)]>0x1){const _0x174386=await select({'message':_0x24d7a6(0x112),'choices':[..._0x2dabe0['map'](_0x1a27ff=>({'name':_0x1a27ff['dbName']+'\x20('+_0x1a27ff[_0x24d7a6(0x103)]+')','value':serializeDbSelection(_0x1a27ff)})),{'name':_0x24d7a6(0xf4),'value':_0x24d7a6(0xff)}]});if(_0x174386!==_0x24d7a6(0xff))return deserializeDbSelection(_0x174386);}const _0x1845ac=await input({'message':'Target\x20database\x20dbId:','validate':_0x553f54=>{const _0x2a57b8=_0x24d7a6,_0x3678a9=_0x553f54[_0x2a57b8(0xed)]();if(!_0x3678a9)return'dbId\x20cannot\x20be\x20empty';const _0x4f1d50=Number(_0x3678a9);if(!Number[_0x2a57b8(0xf9)](_0x4f1d50)||_0x4f1d50<=0x0)return _0x2a57b8(0x10f);return!![];}});return{'dbId':Number(_0x1845ac[_0x24d7a6(0xed)]())};}async function resolveSqlModeInput(_0x17e598){const _0x391c57=a206_0x101467,_0x168576=_0x17e598[_0x391c57(0xef)](_0x391c57(0x12c))[_0x391c57(0xed)]();if(_0x168576==='sql'||_0x168576==='mybatisXml')return _0x168576;if(_0x17e598['nonInteractive'])throw CliErrors[_0x391c57(0x11b)]('mode',_0x391c57(0xf1));return await select({'message':_0x391c57(0x12d),'choices':[{'name':_0x391c57(0x123),'value':_0x391c57(0x108),'description':_0x391c57(0xea)},{'name':_0x391c57(0x110),'value':_0x391c57(0x114),'description':_0x391c57(0x10a)}]});}function serializeDbSelection(_0x5d3f6a){const _0x2ebc82=a206_0x101467;return JSON[_0x2ebc82(0x102)]({'dbId':_0x5d3f6a[_0x2ebc82(0x103)],'dbName':_0x5d3f6a['dbName']});}function deserializeDbSelection(_0x2cadec){const _0x5d3d94=a206_0x101467;try{const _0x5440f6=JSON[_0x5d3d94(0x10c)](_0x2cadec);if(typeof _0x5440f6[_0x5d3d94(0x103)]===_0x5d3d94(0x111)&&Number[_0x5d3d94(0x120)](_0x5440f6[_0x5d3d94(0x103)]))return{'dbId':_0x5440f6[_0x5d3d94(0x103)],'dbName':_0x5440f6[_0x5d3d94(0xf6)]};}catch{}throw CliErrors['validation'](_0x5d3d94(0x100)+_0x2cadec);}function resolveProvidedDbId(_0xaa849f){const _0x2d4896=a206_0x101467,_0x20ac0e=_0xaa849f[_0x2d4896(0xeb)]('db-id');if(typeof _0x20ac0e===_0x2d4896(0x111)&&Number[_0x2d4896(0x120)](_0x20ac0e))return _0x20ac0e;return undefined;}
@@ -1 +1 @@
1
- const a207_0x18bdd4=a207_0x5c53;(function(_0x32b52a,_0xfb2514){const _0x2d4e88=a207_0x5c53,_0x30e67f=_0x32b52a();while(!![]){try{const _0x142381=-parseInt(_0x2d4e88(0x124))/0x1+-parseInt(_0x2d4e88(0x130))/0x2+parseInt(_0x2d4e88(0x113))/0x3+parseInt(_0x2d4e88(0x11d))/0x4*(parseInt(_0x2d4e88(0x114))/0x5)+parseInt(_0x2d4e88(0x11e))/0x6+-parseInt(_0x2d4e88(0x125))/0x7*(parseInt(_0x2d4e88(0x131))/0x8)+parseInt(_0x2d4e88(0x132))/0x9;if(_0x142381===_0xfb2514)break;else _0x30e67f['push'](_0x30e67f['shift']());}catch(_0x3fb2ee){_0x30e67f['push'](_0x30e67f['shift']());}}}(a207_0x4586,0x3a523));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a207_0x4586(){const _0x3d4cc9=['Deleted\x20','SQL\x20lock\x20file\x20not\x20found.','appCode','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','122084NEkwSn','325674ZhyuGk','sqlRootDir','remoteId','delete','/smartapi/custom/deleteUserCustomSql','sqlRoot','270033QhRrYj','735NvHiku','filter','Would\x20delete\x20SQL\x20','entries','trashDir','sqls','validation','str','length','fromEntries','\x20(local\x20file\x20moved\x20to\x20trash)','798836FBQnjn','21848NzxjVW','4971510cUvUkZ','POST','lockFilePath','1399008rhNjXq','20wPJkAo','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','sql','sqlcode','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'];a207_0x4586=function(){return _0x3d4cc9;};return a207_0x4586();}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 a207_0x5c53(_0x51b748,_0xbd3c0b){_0x51b748=_0x51b748-0x112;const _0x45863b=a207_0x4586();let _0x5c535c=_0x45863b[_0x51b748];return _0x5c535c;}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':a207_0x18bdd4(0x116),'command':'delete','description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x10dcc2){const _0x25a8e4=a207_0x18bdd4,_0x43564f=loadSqlProjectConfig(_0x10dcc2[_0x25a8e4(0x11b)]),_0x1a6315=await readSqlLockFile(_0x43564f[_0x25a8e4(0x112)]);if(!_0x1a6315)throw CliErrors[_0x25a8e4(0x12b)](_0x25a8e4(0x115));},async 'dryRun'(_0x3c348b){const _0x24db65=a207_0x18bdd4,_0x4dca53=loadSqlProjectConfig(_0x3c348b[_0x24db65(0x11b)]),_0x44ffb5=await readSqlLockFile(_0x4dca53[_0x24db65(0x112)]);if(!_0x44ffb5)throw CliErrors[_0x24db65(0x12b)](_0x24db65(0x115));const {appLock:_0x54bf7a}=ensureSqlLockScope(_0x44ffb5,_0x3c348b[_0x24db65(0x11b)],_0x4dca53[_0x24db65(0x123)],_0x24db65(0x121)),_0x383e6a=_0x3c348b[_0x24db65(0x12c)](_0x24db65(0x117)),_0x33874c=_0x54bf7a[_0x24db65(0x12a)][_0x383e6a];if(!_0x33874c)throw CliErrors[_0x24db65(0x12b)](_0x24db65(0x118)+_0x383e6a+'\x22.');return{'method':_0x24db65(0x133),'url':_0x24db65(0x122),'body':{'sqlCode':_0x383e6a,'id':_0x33874c['remoteId'],'localPath':resolveLocalSqlFilePath(_0x4dca53,_0x383e6a,_0x33874c)},'description':_0x24db65(0x127)+_0x383e6a+_0x24db65(0x11c)+_0x4dca53[_0x24db65(0x129)]};},async 'execute'(_0x214393){const _0x1456a8=a207_0x18bdd4,_0x1d05a5=loadSqlProjectConfig(_0x214393[_0x1456a8(0x11b)]),_0x5b6708=await readSqlLockFile(_0x1d05a5[_0x1456a8(0x112)]);if(!_0x5b6708)throw CliErrors[_0x1456a8(0x12b)](_0x1456a8(0x11a));const {lockData:_0x4cf8a1,appLock:_0x2beec7}=ensureSqlLockScope(_0x5b6708,_0x214393['appCode'],_0x1d05a5[_0x1456a8(0x123)],'delete'),_0x3ddaac=_0x214393['str']('sqlcode'),_0x15b761=_0x2beec7['sqls'][_0x3ddaac];if(!_0x15b761)throw CliErrors[_0x1456a8(0x12b)](_0x1456a8(0x118)+_0x3ddaac+'\x22.');await deleteSqlQuery({'id':_0x15b761[_0x1456a8(0x120)],'sqlCode':_0x3ddaac}),_0x2beec7[_0x1456a8(0x12a)]=Object[_0x1456a8(0x12e)](Object[_0x1456a8(0x128)](_0x2beec7[_0x1456a8(0x12a)])[_0x1456a8(0x126)](([_0x5a1eb9])=>_0x5a1eb9!==_0x3ddaac)),_0x2beec7['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x1d05a5[_0x1456a8(0x112)],_0x4cf8a1);const _0x29d272=resolveLocalSqlFilePath(_0x1d05a5,_0x3ddaac,_0x15b761);let _0x146c14;await fileExists(_0x29d272)&&(_0x146c14=await moveToTrash(_0x1d05a5['projectRoot'],_0x1d05a5[_0x1456a8(0x129)],_0x29d272),await cleanupEmptyDirectories(dirname(_0x29d272),_0x1d05a5[_0x1456a8(0x11f)]));const _0x51af28={'deleted':_0x3ddaac,'remoteId':_0x15b761[_0x1456a8(0x120)]};if(_0x146c14)_0x51af28['trashedTo']=_0x146c14;return{'ok':!![],'data':_0x51af28,'message':_0x1456a8(0x119)+_0x3ddaac+(_0x146c14?_0x1456a8(0x12f):'')};}};async function moveToTrash(_0x5a0001,_0x58f1d0,_0xb3637e){const _0x10e623=new Date()['toISOString']()['replace'](/[:.]/g,'-'),_0x19e184=relative(_0x5a0001,_0xb3637e),_0x376c59=join(_0x58f1d0,_0x10e623,_0x19e184);return await mkdir(dirname(_0x376c59),{'recursive':!![]}),await rename(_0xb3637e,_0x376c59),_0x376c59;}async function cleanupEmptyDirectories(_0x4722a2,_0x18f4ea){const _0x10a2f4=a207_0x18bdd4;let _0xf44302=resolve(_0x4722a2);const _0x37d6da=resolve(_0x18f4ea);while(_0xf44302['startsWith'](''+_0x37d6da+sep)||_0xf44302===_0x37d6da){if(_0xf44302===_0x37d6da)return;try{const _0x54da59=await readdir(_0xf44302);if(_0x54da59[_0x10a2f4(0x12d)]>0x0)return;await rmdir(_0xf44302);}catch{return;}_0xf44302=dirname(_0xf44302);}}
1
+ const a207_0x2805e8=a207_0x2b08;(function(_0x35937e,_0x3c14fa){const _0x41ae34=a207_0x2b08,_0x1bef8e=_0x35937e();while(!![]){try{const _0x3b4b49=parseInt(_0x41ae34(0x1a5))/0x1+-parseInt(_0x41ae34(0x1b9))/0x2+-parseInt(_0x41ae34(0x1bb))/0x3*(parseInt(_0x41ae34(0x1b2))/0x4)+parseInt(_0x41ae34(0x1ae))/0x5+parseInt(_0x41ae34(0x1c1))/0x6*(-parseInt(_0x41ae34(0x19e))/0x7)+-parseInt(_0x41ae34(0x1ac))/0x8*(parseInt(_0x41ae34(0x19f))/0x9)+-parseInt(_0x41ae34(0x19d))/0xa*(-parseInt(_0x41ae34(0x1bf))/0xb);if(_0x3b4b49===_0x3c14fa)break;else _0x1bef8e['push'](_0x1bef8e['shift']());}catch(_0x225ccb){_0x1bef8e['push'](_0x1bef8e['shift']());}}}(a207_0x5e9b,0xdfd46));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a207_0x5e9b(){const _0x188eb7=['sqlcode','fromEntries','8WIoNDq','lockFilePath','5682005QWKpMq','sqlRootDir','toISOString','str','772UupHeS','sqls','validation','\x20(local\x20file\x20moved\x20to\x20trash)','Would\x20delete\x20SQL\x20','sqlRoot','SQL\x20lock\x20file\x20not\x20found.','1355176eIZJQa','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','10065XNwLcG','entries','Deleted\x20','trashedTo','11oBgfGW','replace','42YwpAxn','24590110KLXLwU','659722bkVyaO','9598851UPcdaf','POST','length','delete','trashDir','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','372758VKaDUN','filter','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','remoteId','appCode'];a207_0x5e9b=function(){return _0x188eb7;};return a207_0x5e9b();}import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';function a207_0x2b08(_0x24841e,_0x207c84){_0x24841e=_0x24841e-0x19d;const _0x5e9b02=a207_0x5e9b();let _0x2b0845=_0x5e9b02[_0x24841e];return _0x2b0845;}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':a207_0x2805e8(0x1a2),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x2939f3){const _0x9e3eb0=a207_0x2805e8,_0x7be055=loadSqlProjectConfig(_0x2939f3[_0x9e3eb0(0x1a9)]),_0x3df3c1=await readSqlLockFile(_0x7be055[_0x9e3eb0(0x1ad)]);if(!_0x3df3c1)throw CliErrors[_0x9e3eb0(0x1b4)](_0x9e3eb0(0x1a4));},async 'dryRun'(_0xe5a63b){const _0xb7bc84=a207_0x2805e8,_0x461e03=loadSqlProjectConfig(_0xe5a63b[_0xb7bc84(0x1a9)]),_0x291e1f=await readSqlLockFile(_0x461e03[_0xb7bc84(0x1ad)]);if(!_0x291e1f)throw CliErrors[_0xb7bc84(0x1b4)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x23fab8}=ensureSqlLockScope(_0x291e1f,_0xe5a63b[_0xb7bc84(0x1a9)],_0x461e03[_0xb7bc84(0x1b7)],_0xb7bc84(0x1a2)),_0x1dd1db=_0xe5a63b[_0xb7bc84(0x1b1)]('sqlcode'),_0x334256=_0x23fab8[_0xb7bc84(0x1b3)][_0x1dd1db];if(!_0x334256)throw CliErrors[_0xb7bc84(0x1b4)](_0xb7bc84(0x1a7)+_0x1dd1db+'\x22.');return{'method':_0xb7bc84(0x1a0),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x1dd1db,'id':_0x334256[_0xb7bc84(0x1a8)],'localPath':resolveLocalSqlFilePath(_0x461e03,_0x1dd1db,_0x334256)},'description':_0xb7bc84(0x1b6)+_0x1dd1db+_0xb7bc84(0x1ba)+_0x461e03['trashDir']};},async 'execute'(_0x28dcc8){const _0x2e1bc8=a207_0x2805e8,_0x31cbcf=loadSqlProjectConfig(_0x28dcc8[_0x2e1bc8(0x1a9)]),_0x1bed23=await readSqlLockFile(_0x31cbcf[_0x2e1bc8(0x1ad)]);if(!_0x1bed23)throw CliErrors['validation'](_0x2e1bc8(0x1b8));const {lockData:_0xda5772,appLock:_0x1edbca}=ensureSqlLockScope(_0x1bed23,_0x28dcc8[_0x2e1bc8(0x1a9)],_0x31cbcf['sqlRoot'],_0x2e1bc8(0x1a2)),_0x42fbd5=_0x28dcc8[_0x2e1bc8(0x1b1)](_0x2e1bc8(0x1aa)),_0x44787e=_0x1edbca['sqls'][_0x42fbd5];if(!_0x44787e)throw CliErrors[_0x2e1bc8(0x1b4)](_0x2e1bc8(0x1a7)+_0x42fbd5+'\x22.');await deleteSqlQuery({'id':_0x44787e[_0x2e1bc8(0x1a8)],'sqlCode':_0x42fbd5}),_0x1edbca['sqls']=Object[_0x2e1bc8(0x1ab)](Object[_0x2e1bc8(0x1bc)](_0x1edbca['sqls'])[_0x2e1bc8(0x1a6)](([_0x157c8d])=>_0x157c8d!==_0x42fbd5)),_0x1edbca['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x31cbcf['lockFilePath'],_0xda5772);const _0x3d9e04=resolveLocalSqlFilePath(_0x31cbcf,_0x42fbd5,_0x44787e);let _0x1e9822;await fileExists(_0x3d9e04)&&(_0x1e9822=await moveToTrash(_0x31cbcf['projectRoot'],_0x31cbcf[_0x2e1bc8(0x1a3)],_0x3d9e04),await cleanupEmptyDirectories(dirname(_0x3d9e04),_0x31cbcf[_0x2e1bc8(0x1af)]));const _0x27bc2b={'deleted':_0x42fbd5,'remoteId':_0x44787e[_0x2e1bc8(0x1a8)]};if(_0x1e9822)_0x27bc2b[_0x2e1bc8(0x1be)]=_0x1e9822;return{'ok':!![],'data':_0x27bc2b,'message':_0x2e1bc8(0x1bd)+_0x42fbd5+(_0x1e9822?_0x2e1bc8(0x1b5):'')};}};async function moveToTrash(_0x5c9732,_0x426c65,_0x9cfc73){const _0x88eac1=a207_0x2805e8,_0x3762a7=new Date()[_0x88eac1(0x1b0)]()[_0x88eac1(0x1c0)](/[:.]/g,'-'),_0x2cf4d0=relative(_0x5c9732,_0x9cfc73),_0x276a9f=join(_0x426c65,_0x3762a7,_0x2cf4d0);return await mkdir(dirname(_0x276a9f),{'recursive':!![]}),await rename(_0x9cfc73,_0x276a9f),_0x276a9f;}async function cleanupEmptyDirectories(_0x23593c,_0x584513){const _0x4dfbd7=a207_0x2805e8;let _0x58f6e3=resolve(_0x23593c);const _0x21588d=resolve(_0x584513);while(_0x58f6e3['startsWith'](''+_0x21588d+sep)||_0x58f6e3===_0x21588d){if(_0x58f6e3===_0x21588d)return;try{const _0xb97260=await readdir(_0x58f6e3);if(_0xb97260[_0x4dfbd7(0x1a1)]>0x0)return;await rmdir(_0x58f6e3);}catch{return;}_0x58f6e3=dirname(_0x58f6e3);}}
@@ -1 +1 @@
1
- function a208_0x46ad(_0x26be09,_0x2484c7){_0x26be09=_0x26be09-0x183;const _0x314156=a208_0x3141();let _0x46adb8=_0x314156[_0x26be09];return _0x46adb8;}const a208_0x331d7a=a208_0x46ad;function a208_0x3141(){const _0x2e941a=['803016IWcPbh','bool','read','12456704JdEXLR','sqlContent','Return\x20full\x20raw\x20SQL\x20query\x20object','verbose','dbId','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','sqlcode','5iiYRtw','sql','str','1634zxxQuf','1898532aDEUNL','sqlName','3134782GkQwos','boolean','description','130089VlxCba','267xuSBbu','appCode','191790twkHVO','1160bnmBmL'];a208_0x3141=function(){return _0x2e941a;};return a208_0x3141();}(function(_0x5bd633,_0x2701dd){const _0x2cffce=a208_0x46ad,_0x17dc91=_0x5bd633();while(!![]){try{const _0xe37fb5=parseInt(_0x2cffce(0x183))/0x1+parseInt(_0x2cffce(0x195))/0x2*(parseInt(_0x2cffce(0x184))/0x3)+-parseInt(_0x2cffce(0x188))/0x4+parseInt(_0x2cffce(0x192))/0x5*(parseInt(_0x2cffce(0x196))/0x6)+-parseInt(_0x2cffce(0x198))/0x7+-parseInt(_0x2cffce(0x18b))/0x8+parseInt(_0x2cffce(0x186))/0x9*(parseInt(_0x2cffce(0x187))/0xa);if(_0xe37fb5===_0x2701dd)break;else _0x17dc91['push'](_0x17dc91['shift']());}catch(_0x104e2b){_0x17dc91['push'](_0x17dc91['shift']());}}}(a208_0x3141,0xbfc6c));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':a208_0x331d7a(0x193),'command':'detail','description':a208_0x331d7a(0x190),'risk':a208_0x331d7a(0x18a),'flags':[SQLCODE_FLAG,{'name':a208_0x331d7a(0x18e),'type':a208_0x331d7a(0x199),'description':a208_0x331d7a(0x18d)}],async 'execute'(_0x554acc){const _0x2306c9=a208_0x331d7a,_0x888628=await getSqlQueryInfo(_0x554acc[_0x2306c9(0x185)],_0x554acc[_0x2306c9(0x194)](_0x2306c9(0x191))),_0x2d777a=_0x554acc[_0x2306c9(0x189)](_0x2306c9(0x18e));if(_0x2d777a)return{'ok':!![],'data':_0x888628};const _0x2cd9c4=_0x888628[_0x2306c9(0x18f)]?await getDbName(_0x554acc[_0x2306c9(0x185)],_0x888628['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x888628['sqlCode'],'sqlName':_0x888628[_0x2306c9(0x197)],'db':_0x2cd9c4?_0x2cd9c4+'\x20('+_0x888628[_0x2306c9(0x18f)]+')':_0x888628[_0x2306c9(0x18f)]??'','description':_0x888628[_0x2306c9(0x19a)]??'','sqlContent':_0x888628[_0x2306c9(0x18c)]??''}};}};
1
+ function a208_0x51a4(){const _0x4e47cc=['str','76559BoEjdD','12VSVuAl','399530lUZWwi','193372vSJPzq','99pLnXdl','66kBbChL','dbId','707640upGvUI','27YTXbIp','826768CCkkUT','318424KsnbaX','appCode','bool','2334050QazWjw','Return\x20full\x20raw\x20SQL\x20query\x20object','description','verbose','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode'];a208_0x51a4=function(){return _0x4e47cc;};return a208_0x51a4();}const a208_0x359cf0=a208_0x6e40;(function(_0x38bb7d,_0x35be9b){const _0x7a28bd=a208_0x6e40,_0x1cb8a3=_0x38bb7d();while(!![]){try{const _0x5257b8=parseInt(_0x7a28bd(0x10d))/0x1+parseInt(_0x7a28bd(0x119))/0x2*(parseInt(_0x7a28bd(0x117))/0x3)+parseInt(_0x7a28bd(0x10a))/0x4+-parseInt(_0x7a28bd(0x110))/0x5+-parseInt(_0x7a28bd(0x108))/0x6*(parseInt(_0x7a28bd(0x116))/0x7)+-parseInt(_0x7a28bd(0x10c))/0x8*(-parseInt(_0x7a28bd(0x10b))/0x9)+-parseInt(_0x7a28bd(0x118))/0xa*(parseInt(_0x7a28bd(0x11a))/0xb);if(_0x5257b8===_0x35be9b)break;else _0x1cb8a3['push'](_0x1cb8a3['shift']());}catch(_0x3b7ea6){_0x1cb8a3['push'](_0x1cb8a3['shift']());}}}(a208_0x51a4,0x3beae));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a208_0x6e40(_0x2ccb6e,_0x1d34d5){_0x2ccb6e=_0x2ccb6e-0x108;const _0x51a4d9=a208_0x51a4();let _0x6e407a=_0x51a4d9[_0x2ccb6e];return _0x6e407a;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':'detail','description':a208_0x359cf0(0x114),'risk':'read','flags':[SQLCODE_FLAG,{'name':a208_0x359cf0(0x113),'type':'boolean','description':a208_0x359cf0(0x111)}],async 'execute'(_0x2eafcb){const _0x51c9c7=a208_0x359cf0,_0x399f82=await getSqlQueryInfo(_0x2eafcb[_0x51c9c7(0x10e)],_0x2eafcb[_0x51c9c7(0x115)]('sqlcode')),_0x3864bc=_0x2eafcb[_0x51c9c7(0x10f)]('verbose');if(_0x3864bc)return{'ok':!![],'data':_0x399f82};const _0x59667a=_0x399f82[_0x51c9c7(0x109)]?await getDbName(_0x2eafcb['appCode'],_0x399f82[_0x51c9c7(0x109)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x399f82['sqlCode'],'sqlName':_0x399f82['sqlName'],'db':_0x59667a?_0x59667a+'\x20('+_0x399f82[_0x51c9c7(0x109)]+')':_0x399f82[_0x51c9c7(0x109)]??'','description':_0x399f82[_0x51c9c7(0x112)]??'','sqlContent':_0x399f82['sqlContent']??''}};}};
@@ -1 +1 @@
1
- const a209_0x37dcb3=a209_0x4c19;(function(_0x32de7a,_0x5bd93c){const _0x386e4e=a209_0x4c19,_0xa71649=_0x32de7a();while(!![]){try{const _0x242e75=parseInt(_0x386e4e(0x19a))/0x1*(parseInt(_0x386e4e(0x1b2))/0x2)+parseInt(_0x386e4e(0x1ae))/0x3*(parseInt(_0x386e4e(0x19f))/0x4)+parseInt(_0x386e4e(0x1ab))/0x5*(-parseInt(_0x386e4e(0x1b7))/0x6)+-parseInt(_0x386e4e(0x1a1))/0x7*(-parseInt(_0x386e4e(0x1ac))/0x8)+parseInt(_0x386e4e(0x1a3))/0x9*(parseInt(_0x386e4e(0x1b6))/0xa)+-parseInt(_0x386e4e(0x1b5))/0xb*(-parseInt(_0x386e4e(0x1a6))/0xc)+parseInt(_0x386e4e(0x1af))/0xd*(-parseInt(_0x386e4e(0x19b))/0xe);if(_0x242e75===_0x5bd93c)break;else _0xa71649['push'](_0xa71649['shift']());}catch(_0x512b01){_0xa71649['push'](_0xa71649['shift']());}}}(a209_0x1dee,0xb1015));function a209_0x1dee(){const _0xaaa43f=['execError','88rTDuyS','967490nsSetV','66ftTXZQ','SQL\x20execution\x20failed','1ItQWor','14GLdwfi','execResult','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','sql','2416668KeObQP','str','35OHDHUD','read','99fkqqHE','sqlcode','length','1519140AHkBwF','string','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','\x20row(s)\x20in\x20','execSuccess','410995wVEIWe','993120ARyZJR','exec','3bBlOZA','28504099skcjzg','params','now','1039918rbXrLE','appCode'];a209_0x1dee=function(){return _0xaaa43f;};return a209_0x1dee();}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a209_0x4c19(_0x3ae206,_0x2c28ca){_0x3ae206=_0x3ae206-0x199;const _0x1dee07=a209_0x1dee();let _0x4c19a9=_0x1dee07[_0x3ae206];return _0x4c19a9;}export const sqlExec={'service':a209_0x37dcb3(0x19e),'command':a209_0x37dcb3(0x1ad),'description':a209_0x37dcb3(0x19d),'risk':a209_0x37dcb3(0x1a2),'flags':[SQLCODE_FLAG,{'name':a209_0x37dcb3(0x1b0),'type':a209_0x37dcb3(0x1a7),'description':a209_0x37dcb3(0x1a8)}],async 'execute'(_0x139c68){const _0x42c37c=a209_0x37dcb3,_0x232d15=parseJsonParams(_0x139c68[_0x42c37c(0x1a0)]('params')),_0x7f0ce9=Date[_0x42c37c(0x1b1)](),_0x4a3f7f=await executeSql(_0x139c68[_0x42c37c(0x1b3)],_0x139c68[_0x42c37c(0x1a0)](_0x42c37c(0x1a4)),_0x232d15),_0x59bd56=Date[_0x42c37c(0x1b1)]()-_0x7f0ce9,_0x57de52=_0x4a3f7f?.[_0x42c37c(0x19c)]??_0x4a3f7f,_0x5acd9b=_0x4a3f7f?.[_0x42c37c(0x1aa)]??!![];if(!_0x5acd9b)return{'ok':![],'data':{'error':_0x4a3f7f?.[_0x42c37c(0x1b4)]||_0x42c37c(0x199),'elapsed':_0x59bd56},'message':'SQL\x20execution\x20failed'};const _0x573a06=Array['isArray'](_0x57de52)?_0x57de52:[];return{'ok':!![],'data':{'rows':_0x573a06,'rowCount':_0x573a06['length'],'elapsed':_0x59bd56},'message':'Returned\x20'+_0x573a06[_0x42c37c(0x1a5)]+_0x42c37c(0x1a9)+_0x59bd56+'ms'};}};
1
+ const a209_0x50cf5e=a209_0x4979;function a209_0x1ab4(){const _0x5c5096=['appCode','now','2768700EGUOAQ','read','SQL\x20execution\x20failed','sqlcode','\x20row(s)\x20in\x20','176StkHbz','7dlHAVF','exec','params','262952DYMLSv','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','287631fzjzbd','execSuccess','Returned\x20','string','execError','str','682DDpvIx','execResult','66320RovpKb','234160rlkzYl','450753uoODyv','335eWujpZ','8910496sJlnyy','isArray','length','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'];a209_0x1ab4=function(){return _0x5c5096;};return a209_0x1ab4();}(function(_0x3459f9,_0x25d4c6){const _0x1182e7=a209_0x4979,_0x4e7513=_0x3459f9();while(!![]){try{const _0x3b2956=-parseInt(_0x1182e7(0xa6))/0x1*(-parseInt(_0x1182e7(0xa9))/0x2)+-parseInt(_0x1182e7(0xb5))/0x3+parseInt(_0x1182e7(0xb3))/0x4*(-parseInt(_0x1182e7(0xb6))/0x5)+parseInt(_0x1182e7(0xbd))/0x6+parseInt(_0x1182e7(0xb7))/0x7+parseInt(_0x1182e7(0xa5))/0x8*(parseInt(_0x1182e7(0xab))/0x9)+parseInt(_0x1182e7(0xb4))/0xa*(-parseInt(_0x1182e7(0xb1))/0xb);if(_0x3b2956===_0x25d4c6)break;else _0x4e7513['push'](_0x4e7513['shift']());}catch(_0x354c1f){_0x4e7513['push'](_0x4e7513['shift']());}}}(a209_0x1ab4,0x9d729));function a209_0x4979(_0x35a267,_0x4a1ab2){_0x35a267=_0x35a267-0xa1;const _0x1ab4b0=a209_0x1ab4();let _0x49791c=_0x1ab4b0[_0x35a267];return _0x49791c;}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':'sql','command':a209_0x50cf5e(0xa7),'description':a209_0x50cf5e(0xaa),'risk':a209_0x50cf5e(0xa1),'flags':[SQLCODE_FLAG,{'name':a209_0x50cf5e(0xa8),'type':a209_0x50cf5e(0xae),'description':a209_0x50cf5e(0xba)}],async 'execute'(_0x36e3a2){const _0x58b62b=a209_0x50cf5e,_0x47557b=parseJsonParams(_0x36e3a2['str'](_0x58b62b(0xa8))),_0x59e9fa=Date[_0x58b62b(0xbc)](),_0x1354b4=await executeSql(_0x36e3a2[_0x58b62b(0xbb)],_0x36e3a2[_0x58b62b(0xb0)](_0x58b62b(0xa3)),_0x47557b),_0x9755a2=Date[_0x58b62b(0xbc)]()-_0x59e9fa,_0x560e9f=_0x1354b4?.[_0x58b62b(0xb2)]??_0x1354b4,_0x1bcd80=_0x1354b4?.[_0x58b62b(0xac)]??!![];if(!_0x1bcd80)return{'ok':![],'data':{'error':_0x1354b4?.[_0x58b62b(0xaf)]||_0x58b62b(0xa2),'elapsed':_0x9755a2},'message':_0x58b62b(0xa2)};const _0x17442f=Array[_0x58b62b(0xb8)](_0x560e9f)?_0x560e9f:[];return{'ok':!![],'data':{'rows':_0x17442f,'rowCount':_0x17442f[_0x58b62b(0xb9)],'elapsed':_0x9755a2},'message':_0x58b62b(0xad)+_0x17442f[_0x58b62b(0xb9)]+_0x58b62b(0xa4)+_0x9755a2+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x2b3a83,_0x4b4b41){const _0x36dbd5=a210_0x4d20,_0xe9c25=_0x2b3a83();while(!![]){try{const _0x1bafdf=-parseInt(_0x36dbd5(0x1e0))/0x1+parseInt(_0x36dbd5(0x1e3))/0x2*(-parseInt(_0x36dbd5(0x1de))/0x3)+-parseInt(_0x36dbd5(0x1e8))/0x4*(parseInt(_0x36dbd5(0x1dd))/0x5)+-parseInt(_0x36dbd5(0x1e1))/0x6*(-parseInt(_0x36dbd5(0x1e2))/0x7)+-parseInt(_0x36dbd5(0x1df))/0x8*(parseInt(_0x36dbd5(0x1e7))/0x9)+-parseInt(_0x36dbd5(0x1e6))/0xa+-parseInt(_0x36dbd5(0x1e5))/0xb*(-parseInt(_0x36dbd5(0x1e4))/0xc);if(_0x1bafdf===_0x4b4b41)break;else _0xe9c25['push'](_0xe9c25['shift']());}catch(_0x3d602d){_0xe9c25['push'](_0xe9c25['shift']());}}}(a210_0x9b4e,0x37381));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';function a210_0x4d20(_0x144958,_0x117518){_0x144958=_0x144958-0x1dd;const _0x9b4e76=a210_0x9b4e();let _0x4d2019=_0x9b4e76[_0x144958];return _0x4d2019;}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 a210_0x9b4e(){const _0x9f803d=['9zgSAoX','492608bsIKKO','5tiAxMX','219vgKTyj','3184888QvDEMd','26336IxnNMt','6djNSKa','2872814rhNVps','3342hxMlVq','348qaPYhI','196603mIGEHc','329600zjSpyi'];a210_0x9b4e=function(){return _0x9f803d;};return a210_0x9b4e();}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(_0xce280c,_0x43101c){const _0x1f2839=a210_0x90cb,_0x2f1f5a=_0xce280c();while(!![]){try{const _0x5a96d8=parseInt(_0x1f2839(0x170))/0x1*(-parseInt(_0x1f2839(0x174))/0x2)+-parseInt(_0x1f2839(0x16f))/0x3+-parseInt(_0x1f2839(0x16d))/0x4+parseInt(_0x1f2839(0x172))/0x5*(-parseInt(_0x1f2839(0x173))/0x6)+parseInt(_0x1f2839(0x16e))/0x7*(parseInt(_0x1f2839(0x16c))/0x8)+parseInt(_0x1f2839(0x175))/0x9*(-parseInt(_0x1f2839(0x171))/0xa)+parseInt(_0x1f2839(0x176))/0xb;if(_0x5a96d8===_0x43101c)break;else _0x2f1f5a['push'](_0x2f1f5a['shift']());}catch(_0x125c1e){_0x2f1f5a['push'](_0x2f1f5a['shift']());}}}(a210_0x1d8b,0x501cd));import{sqlList}from'../../commands/sql/list.js';function a210_0x1d8b(){const _0xa58486=['30947TTlUvJ','1731168FZkcXD','103YimDRd','50yyoCRl','504805kGYrEv','30HYfSKz','2522oiNQwq','202437UWlPDA','18050109iENAXd','336RHltMs','697004ySCbbP'];a210_0x1d8b=function(){return _0xa58486;};return a210_0x1d8b();}function a210_0x90cb(_0x5612c3,_0x4c71ec){_0x5612c3=_0x5612c3-0x16c;const _0x1d8b6b=a210_0x1d8b();let _0x90cbd8=_0x1d8b6b[_0x5612c3];return _0x90cbd8;}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';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
- const a211_0x3fc1f8=a211_0x11ce;(function(_0x313e31,_0x129aeb){const _0x241cf8=a211_0x11ce,_0x818ae1=_0x313e31();while(!![]){try{const _0x285133=-parseInt(_0x241cf8(0x13a))/0x1+-parseInt(_0x241cf8(0x141))/0x2+-parseInt(_0x241cf8(0x124))/0x3*(-parseInt(_0x241cf8(0x130))/0x4)+parseInt(_0x241cf8(0x126))/0x5*(parseInt(_0x241cf8(0x128))/0x6)+parseInt(_0x241cf8(0x133))/0x7*(-parseInt(_0x241cf8(0x132))/0x8)+-parseInt(_0x241cf8(0x12d))/0x9*(-parseInt(_0x241cf8(0x121))/0xa)+parseInt(_0x241cf8(0x11e))/0xb;if(_0x285133===_0x129aeb)break;else _0x818ae1['push'](_0x818ae1['shift']());}catch(_0x25af62){_0x818ae1['push'](_0x818ae1['shift']());}}}(a211_0x19ac,0xafd3c));import{listSqlQueries}from'../../core/api-client.js';function a211_0x11ce(_0x106b26,_0x4e8bcf){_0x106b26=_0x106b26-0x11e;const _0x19ac6c=a211_0x19ac();let _0x11ce4f=_0x19ac6c[_0x106b26];return _0x11ce4f;}function a211_0x19ac(){const _0x4146c4=['Filter\x20by\x20SQL\x20name','length','1799608QVQANQ','\x20SQL\x20queries\x20(total:\x20','name','number','sqlCode','7872337OVsHmb','num','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','25030lEKCcM','description','page','9EaZKDk','pagesize','1255TrREdo','bool','31740rCJpYD','Page\x20number','sqlName','list','List\x20custom\x20SQL\x20queries','2763TcuKvU','all','boolean','185948BzujoB','totalCount','120DpsuXi','211274AbkEBj','appCode','read','string','sqlcode','map','str','878617ZmanoD','Found\x20','Page\x20size','verbose','dbId'];a211_0x19ac=function(){return _0x4146c4;};return a211_0x19ac();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a211_0x3fc1f8(0x12b),'description':a211_0x3fc1f8(0x12c),'risk':a211_0x3fc1f8(0x135),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a211_0x3fc1f8(0x143),'type':a211_0x3fc1f8(0x136),'description':a211_0x3fc1f8(0x13f)},{'name':a211_0x3fc1f8(0x123),'type':a211_0x3fc1f8(0x144),'description':a211_0x3fc1f8(0x129),'default':0x1},{'name':a211_0x3fc1f8(0x125),'type':a211_0x3fc1f8(0x144),'description':a211_0x3fc1f8(0x13c)},{'name':a211_0x3fc1f8(0x13d),'type':a211_0x3fc1f8(0x12f),'description':a211_0x3fc1f8(0x120)}],async 'execute'(_0x13bb99){const _0x13114e=a211_0x3fc1f8,_0x41cd38=await listSqlQueries(_0x13bb99[_0x13114e(0x134)],{'sqlCode':_0x13bb99[_0x13114e(0x139)](_0x13114e(0x137))||undefined,'sqlName':_0x13bb99[_0x13114e(0x139)](_0x13114e(0x143))||undefined,'currentPage':_0x13bb99[_0x13114e(0x11f)](_0x13114e(0x123)),'pageSize':_0x13bb99['num'](_0x13114e(0x125),0x32)}),_0x2bcd2e=_0x13bb99[_0x13114e(0x127)](_0x13114e(0x13d)),_0x46228b=_0x41cd38['tableData']??[],_0x38b851=_0x41cd38['paging']?.[_0x13114e(0x131)]??_0x46228b[_0x13114e(0x140)];let _0x28bb9f;return _0x2bcd2e?_0x28bb9f=_0x46228b:_0x28bb9f=await Promise[_0x13114e(0x12e)](_0x46228b[_0x13114e(0x138)](async _0x2b2552=>{const _0x58d09b=_0x13114e;let _0x23864a;try{_0x23864a=_0x2b2552[_0x58d09b(0x13e)]?await getDbName(_0x13bb99[_0x58d09b(0x134)],_0x2b2552[_0x58d09b(0x13e)]):undefined;}catch{}return{'sqlCode':_0x2b2552[_0x58d09b(0x145)],'sqlName':_0x2b2552[_0x58d09b(0x12a)],'description':_0x2b2552[_0x58d09b(0x122)]??'','db':_0x23864a?_0x23864a+'\x20('+_0x2b2552[_0x58d09b(0x13e)]+')':_0x2b2552['dbId']??''};})),{'ok':!![],'data':_0x28bb9f,'message':_0x46228b[_0x13114e(0x140)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x13114e(0x13b)+_0x46228b[_0x13114e(0x140)]+_0x13114e(0x142)+_0x38b851+').'};}};
1
+ function a211_0x57e3(_0x4c07c9,_0x707d29){_0x4c07c9=_0x4c07c9-0x1c0;const _0x2b7cf0=a211_0x2b7c();let _0x57e31a=_0x2b7cf0[_0x4c07c9];return _0x57e31a;}function a211_0x2b7c(){const _0x553959=['3sYvmFR','bool','dbId','68190QacANr','paging','3197200ytCYEw','pagesize','3147725mqaQlp','appCode','read','3478744ETqPxR','882587xpJsvr','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','979gfNBTK','tableData','name','number','str','page','boolean','List\x20custom\x20SQL\x20queries','totalCount','\x20SQL\x20queries\x20(total:\x20','sql','sqlcode','string','907118wSRFok','Page\x20number','Filter\x20by\x20SQL\x20name','107210LSYGNh','sqlCode','map','sqlName','469oIcIIW','Page\x20size','18mGaOLb','length','description'];a211_0x2b7c=function(){return _0x553959;};return a211_0x2b7c();}const a211_0x4557f2=a211_0x57e3;(function(_0x2e4cf0,_0x13284b){const _0x513cb2=a211_0x57e3,_0x91d9a5=_0x2e4cf0();while(!![]){try{const _0x1cfe97=-parseInt(_0x513cb2(0x1e5))/0x1+-parseInt(_0x513cb2(0x1ce))/0x2*(-parseInt(_0x513cb2(0x1da))/0x3)+parseInt(_0x513cb2(0x1e4))/0x4+parseInt(_0x513cb2(0x1e1))/0x5+parseInt(_0x513cb2(0x1dd))/0x6*(-parseInt(_0x513cb2(0x1d5))/0x7)+parseInt(_0x513cb2(0x1df))/0x8*(-parseInt(_0x513cb2(0x1d7))/0x9)+parseInt(_0x513cb2(0x1d1))/0xa*(parseInt(_0x513cb2(0x1c1))/0xb);if(_0x1cfe97===_0x13284b)break;else _0x91d9a5['push'](_0x91d9a5['shift']());}catch(_0x5389cf){_0x91d9a5['push'](_0x91d9a5['shift']());}}}(a211_0x2b7c,0x71301));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':a211_0x4557f2(0x1cb),'command':'list','description':a211_0x4557f2(0x1c8),'risk':a211_0x4557f2(0x1e3),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a211_0x4557f2(0x1c3),'type':a211_0x4557f2(0x1cd),'description':a211_0x4557f2(0x1d0)},{'name':'page','type':a211_0x4557f2(0x1c4),'description':a211_0x4557f2(0x1cf),'default':0x1},{'name':a211_0x4557f2(0x1e0),'type':a211_0x4557f2(0x1c4),'description':a211_0x4557f2(0x1d6)},{'name':'verbose','type':a211_0x4557f2(0x1c7),'description':a211_0x4557f2(0x1c0)}],async 'execute'(_0x135019){const _0x4fa5be=a211_0x4557f2,_0x425bcc=await listSqlQueries(_0x135019[_0x4fa5be(0x1e2)],{'sqlCode':_0x135019[_0x4fa5be(0x1c5)](_0x4fa5be(0x1cc))||undefined,'sqlName':_0x135019[_0x4fa5be(0x1c5)](_0x4fa5be(0x1c3))||undefined,'currentPage':_0x135019['num'](_0x4fa5be(0x1c6)),'pageSize':_0x135019['num'](_0x4fa5be(0x1e0),0x32)}),_0x45cf0a=_0x135019[_0x4fa5be(0x1db)]('verbose'),_0x38dc5c=_0x425bcc[_0x4fa5be(0x1c2)]??[],_0x5d884a=_0x425bcc[_0x4fa5be(0x1de)]?.[_0x4fa5be(0x1c9)]??_0x38dc5c[_0x4fa5be(0x1d8)];let _0x41b68d;return _0x45cf0a?_0x41b68d=_0x38dc5c:_0x41b68d=await Promise['all'](_0x38dc5c[_0x4fa5be(0x1d3)](async _0x3aa3c4=>{const _0x3b11e0=_0x4fa5be;let _0xb1e639;try{_0xb1e639=_0x3aa3c4['dbId']?await getDbName(_0x135019['appCode'],_0x3aa3c4[_0x3b11e0(0x1dc)]):undefined;}catch{}return{'sqlCode':_0x3aa3c4[_0x3b11e0(0x1d2)],'sqlName':_0x3aa3c4[_0x3b11e0(0x1d4)],'description':_0x3aa3c4[_0x3b11e0(0x1d9)]??'','db':_0xb1e639?_0xb1e639+'\x20('+_0x3aa3c4[_0x3b11e0(0x1dc)]+')':_0x3aa3c4[_0x3b11e0(0x1dc)]??''};})),{'ok':!![],'data':_0x41b68d,'message':_0x38dc5c[_0x4fa5be(0x1d8)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':'Found\x20'+_0x38dc5c['length']+_0x4fa5be(0x1ca)+_0x5d884a+').'};}};
@@ -1 +1 @@
1
- function a212_0x461c(){const _0x1f9351=['skipped','Filter\x20by\x20SQL\x20display\x20name','8MmeJie','message','push','split','str','Would\x20pull\x20','boolean','local\x20differs\x20from\x20remote','utf8','dbId','Force\x20pull\x20cancelled.','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','force','104FIVVvN','\x20skipped,\x20','trimStart','sqlContent','join','sqls','612378yZndHQ','602631ebXuRn','read','sqlRootDir','bool','\x20SQL\x20file(s)\x20into\x20','lockFilePath','sqlName','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','conflict','description','catch','replace','708rgiNFI','sqlcode','POST','535975wiTZnR','sqlCode','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sql','4kOEMwY','3614292bZEGJb','string','Force\x20overwrite\x20local\x20unsynced\x20changes','86884tEFbXy','sqlRoot','mybatisXml','pull','10347440lQZZKm','name','path','length','totalCount','2437195suMwaJ','tableData','nonInteractive','unchanged','toISOString','test','appCode','apps'];a212_0x461c=function(){return _0x1f9351;};return a212_0x461c();}const a212_0x14db3a=a212_0x41b1;(function(_0x409ab3,_0x102035){const _0x159406=a212_0x41b1,_0x5c6bce=_0x409ab3();while(!![]){try{const _0x54dd3d=parseInt(_0x159406(0x1be))/0x1*(parseInt(_0x159406(0x194))/0x2)+parseInt(_0x159406(0x195))/0x3+-parseInt(_0x159406(0x1ab))/0x4*(parseInt(_0x159406(0x1a1))/0x5)+-parseInt(_0x159406(0x18d))/0x6*(-parseInt(_0x159406(0x198))/0x7)+-parseInt(_0x159406(0x1b8))/0x8*(parseInt(_0x159406(0x1bf))/0x9)+-parseInt(_0x159406(0x19c))/0xa+-parseInt(_0x159406(0x190))/0xb;if(_0x54dd3d===_0x102035)break;else _0x5c6bce['push'](_0x5c6bce['shift']());}catch(_0x151dbe){_0x5c6bce['push'](_0x5c6bce['shift']());}}}(a212_0x461c,0xebaca));import{readFile,rm,writeFile}from'node:fs/promises';function a212_0x41b1(_0x108a42,_0x4a8133){_0x108a42=_0x108a42-0x184;const _0x461c83=a212_0x461c();let _0x41b131=_0x461c83[_0x108a42];return _0x41b131;}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(_0xb276a8,_0x324423){const _0x2a4837=a212_0x41b1,_0x247e87=[];let _0x54e2e3=0x1;while(!![]){const _0x221334=await listSqlQueries(_0xb276a8,{'currentPage':_0x54e2e3,'pageSize':PAGE_SIZE,'sqlCode':_0x324423[_0x2a4837(0x191)],'sqlName':_0x324423['sqlName']}),_0x32b9ec=_0x221334[_0x2a4837(0x1a2)]??[];_0x247e87[_0x2a4837(0x1ad)](..._0x32b9ec);if(_0x32b9ec[_0x2a4837(0x19f)]===0x0)break;const _0x3bae53=_0x221334['paging']?.[_0x2a4837(0x1a0)];if(_0x3bae53!=null?_0x247e87['length']>=_0x3bae53:_0x32b9ec[_0x2a4837(0x19f)]<PAGE_SIZE)break;_0x54e2e3++;}return _0x247e87;}async function ensureSqlContent(_0x3bc194){const _0x144ef5=a212_0x41b1;if(_0x3bc194[_0x144ef5(0x1bb)]!=null&&String(_0x3bc194[_0x144ef5(0x1bb)])[_0x144ef5(0x19f)]>0x0)return _0x3bc194;return getSqlQueryDetail(_0x3bc194[_0x144ef5(0x191)]);}export const sqlPull={'service':a212_0x14db3a(0x193),'command':'pull','description':a212_0x14db3a(0x192),'risk':a212_0x14db3a(0x1c0),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a212_0x14db3a(0x196),'description':a212_0x14db3a(0x1aa)},{'name':a212_0x14db3a(0x1b7),'type':a212_0x14db3a(0x1b1),'description':a212_0x14db3a(0x197)}],async 'dryRun'(_0x340c94){const _0x28fb8c=a212_0x14db3a,_0x7447f8=loadSqlProjectConfig(_0x340c94[_0x28fb8c(0x1a7)]),_0x3157bc=await readSqlLockFile(_0x7447f8[_0x28fb8c(0x186)]),{appLock:_0x418318}=ensureSqlLockScope(_0x3157bc??createEmptySqlLock(),_0x7447f8['appCode'],_0x7447f8[_0x28fb8c(0x199)],_0x28fb8c(0x19b)),_0x546317=await fetchAllSqlQueries(_0x340c94[_0x28fb8c(0x1a7)],{'sqlCode':_0x340c94[_0x28fb8c(0x1af)](_0x28fb8c(0x18e))||undefined,'sqlName':_0x340c94[_0x28fb8c(0x1af)](_0x28fb8c(0x19d))||undefined}),_0x42961c=[];for(const _0x1d2435 of _0x546317){const _0x42fab5=await ensureSqlContent(_0x1d2435),_0xf6723a=ensureRemoteSqlContent(_0x42fab5),_0x4d6fc0=detectModeFromSql(_0x42fab5),_0x35fda4=_0x42fab5['dbId']?await getDbName(_0x340c94[_0x28fb8c(0x1a7)],Number(_0x42fab5['dbId']))[_0x28fb8c(0x18b)](()=>undefined):undefined,_0x3f1921=buildLocalSqlFileContent({'sqlCode':_0x42fab5[_0x28fb8c(0x191)],'sqlName':_0x42fab5['sqlName'],'dbId':_0x42fab5[_0x28fb8c(0x1b4)]},_0xf6723a,{'dbName':_0x35fda4,'mode':_0x4d6fc0,'syncedAt':new Date()[_0x28fb8c(0x1a5)](),'description':_0x42fab5[_0x28fb8c(0x18a)]}),_0x4cdedc=buildSqlLockEntry(_0x42fab5,_0xf6723a,'',{'dbName':_0x35fda4}),_0x5443cb=resolveLocalSqlFilePath(_0x7447f8,_0x42fab5[_0x28fb8c(0x191)],_0x4cdedc);let _0x53554b='would_pull',_0xa73831;if(await fileExists(_0x5443cb)){const _0x46c183=await readFile(_0x5443cb,'utf8');isEquivalentPulledSqlFile(_0x46c183,_0x3f1921,_0x4d6fc0)?(_0x53554b=_0x28fb8c(0x1a9),_0xa73831=_0x28fb8c(0x1a4)):(_0x53554b=_0x28fb8c(0x189),_0xa73831='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x42961c[_0x28fb8c(0x1ad)]({'sqlCode':_0x42fab5[_0x28fb8c(0x191)],'sqlName':_0x42fab5['sqlName'],'filePath':_0x5443cb,'status':_0x53554b,'reason':_0xa73831});}return{'method':_0x28fb8c(0x18f),'url':_0x28fb8c(0x1b6),'body':{'appCode':_0x340c94[_0x28fb8c(0x1a7)],'sqlCode':_0x340c94[_0x28fb8c(0x1af)](_0x28fb8c(0x18e))||null,'sqlName':_0x340c94['str'](_0x28fb8c(0x19d))||null,'files':_0x42961c},'description':_0x28fb8c(0x1b0)+_0x42961c[_0x28fb8c(0x19f)]+_0x28fb8c(0x185)+_0x7447f8[_0x28fb8c(0x1c1)]};},async 'execute'(_0x53f97b){const _0x3f98ce=a212_0x14db3a,_0x19d223=loadSqlProjectConfig(_0x53f97b[_0x3f98ce(0x1a7)]),_0x233ec4=await readSqlLockFile(_0x19d223[_0x3f98ce(0x186)]),{lockData:_0x17bd43,appLock:_0x5ec5bc}=ensureSqlLockScope(_0x233ec4??createEmptySqlLock(),_0x19d223['appCode'],_0x19d223['sqlRoot'],_0x3f98ce(0x19b)),_0x32f602=_0x53f97b[_0x3f98ce(0x184)]('force'),_0x35a9c3=await fetchAllSqlQueries(_0x53f97b[_0x3f98ce(0x1a7)],{'sqlCode':_0x53f97b[_0x3f98ce(0x1af)]('sqlcode')||undefined,'sqlName':_0x53f97b['str'](_0x3f98ce(0x19d))||undefined});if(_0x35a9c3[_0x3f98ce(0x19f)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x40de1c=[],_0x579cbd=[];for(const _0x5d610c of _0x35a9c3){try{_0x40de1c['push'](await ensureSqlContent(_0x5d610c));}catch(_0x27bdc0){_0x579cbd[_0x3f98ce(0x1ad)]({'sqlCode':_0x5d610c['sqlCode'],'error':_0x27bdc0 instanceof Error?_0x27bdc0[_0x3f98ce(0x1ac)]:String(_0x27bdc0)});}}if(_0x32f602&&!_0x53f97b[_0x3f98ce(0x1a3)]){let _0x3bda49=![];for(const _0x2155e3 of _0x40de1c){const _0xcfaaa0=detectModeFromSql(_0x2155e3),_0x2ba70d=_0x2155e3[_0x3f98ce(0x1b4)]?await getDbName(_0x53f97b[_0x3f98ce(0x1a7)],Number(_0x2155e3['dbId']))[_0x3f98ce(0x18b)](()=>undefined):undefined,_0x9c7c76=buildLocalSqlFileContent({'sqlCode':_0x2155e3[_0x3f98ce(0x191)],'sqlName':_0x2155e3[_0x3f98ce(0x187)],'dbId':_0x2155e3['dbId']},ensureRemoteSqlContent(_0x2155e3),{'dbName':_0x2ba70d,'mode':_0xcfaaa0,'syncedAt':new Date()[_0x3f98ce(0x1a5)](),'description':_0x2155e3[_0x3f98ce(0x18a)]}),_0x48c904=resolveLocalSqlFilePath(_0x19d223,_0x2155e3['sqlCode'],buildSqlLockEntry(_0x2155e3,ensureRemoteSqlContent(_0x2155e3),'',{'dbName':_0x2ba70d}));if(await fileExists(_0x48c904)){const _0x4c84c8=await readFile(_0x48c904,_0x3f98ce(0x1b3));if(!isEquivalentPulledSqlFile(_0x4c84c8,_0x9c7c76,_0xcfaaa0)){_0x3bda49=!![];break;}}}if(_0x3bda49){const _0x2f9fe2=await confirmForceOverwrite(_0x3f98ce(0x188));if(!_0x2f9fe2)throw CliErrors['cancelled'](_0x3f98ce(0x1b5));}}const _0x52d1c0=cloneSqlLockData(_0x17bd43),_0x250be6=_0x52d1c0[_0x3f98ce(0x1a8)][_0x19d223[_0x3f98ce(0x1a7)]],_0x4f2f2d=[],_0x4e7f2a=[];for(const _0x16928b of _0x40de1c){const _0x5308fd=_0x250be6[_0x3f98ce(0x1bd)][_0x16928b[_0x3f98ce(0x191)]],_0x48925d=ensureRemoteSqlContent(_0x16928b),_0x2e92ed=detectModeFromSql(_0x16928b),_0x2c1752=_0x16928b[_0x3f98ce(0x1b4)]?await getDbName(_0x53f97b[_0x3f98ce(0x1a7)],Number(_0x16928b['dbId']))['catch'](()=>undefined):undefined,_0x773b6c=buildLocalSqlFileContent({'sqlCode':_0x16928b[_0x3f98ce(0x191)],'sqlName':_0x16928b[_0x3f98ce(0x187)],'dbId':_0x16928b[_0x3f98ce(0x1b4)]},_0x48925d,{'dbName':_0x2c1752,'mode':_0x2e92ed,'syncedAt':new Date()[_0x3f98ce(0x1a5)](),'description':_0x16928b['description']}),_0x2d9513=buildSqlLockEntry(_0x16928b,_0x48925d,computeSqlContentHash(_0x773b6c),{'dbName':_0x2c1752}),_0x2e9ef2=_0x2d9513[_0x3f98ce(0x19e)],_0x4d9643=join(_0x19d223[_0x3f98ce(0x1c1)],_0x2e9ef2);try{if(await fileExists(_0x4d9643)){const _0x390161=await readFile(_0x4d9643,_0x3f98ce(0x1b3));if(isEquivalentPulledSqlFile(_0x390161,_0x773b6c,_0x2e92ed)){_0x4e7f2a['push']({'sqlCode':_0x16928b['sqlCode'],'reason':_0x3f98ce(0x1a4)}),_0x250be6[_0x3f98ce(0x1bd)][_0x16928b[_0x3f98ce(0x191)]]={..._0x2d9513,'hash':computeSqlContentHash(_0x390161),'path':_0x2e9ef2};continue;}if(!_0x32f602){_0x4e7f2a[_0x3f98ce(0x1ad)]({'sqlCode':_0x16928b[_0x3f98ce(0x191)],'reason':_0x3f98ce(0x1b2)});continue;}}const _0x5305e8=_0x5308fd?.[_0x3f98ce(0x19e)]?join(_0x19d223[_0x3f98ce(0x1c1)],_0x5308fd[_0x3f98ce(0x19e)]):undefined;_0x5305e8&&_0x5305e8!==_0x4d9643&&await fileExists(_0x5305e8)&&await rm(_0x5305e8,{'force':!![]}),await ensureParentDirectory(_0x4d9643),await writeFile(_0x4d9643,_0x773b6c,_0x3f98ce(0x1b3)),_0x250be6[_0x3f98ce(0x1bd)][_0x16928b['sqlCode']]={..._0x2d9513,'path':_0x2e9ef2},_0x4f2f2d['push']({'sqlCode':_0x16928b[_0x3f98ce(0x191)],'filePath':_0x4d9643});}catch(_0x25afa6){_0x579cbd[_0x3f98ce(0x1ad)]({'sqlCode':_0x16928b['sqlCode'],'error':_0x25afa6 instanceof Error?_0x25afa6['message']:String(_0x25afa6)});}}return _0x250be6['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x19d223[_0x3f98ce(0x186)],_0x52d1c0),{'ok':_0x579cbd[_0x3f98ce(0x19f)]===0x0,'data':{'pulled':_0x4f2f2d,'skipped':_0x4e7f2a,'failed':_0x579cbd},'message':'Pull\x20complete:\x20'+_0x4f2f2d[_0x3f98ce(0x19f)]+'\x20written,\x20'+_0x4e7f2a[_0x3f98ce(0x19f)]+_0x3f98ce(0x1b9)+_0x579cbd[_0x3f98ce(0x19f)]+'\x20failed'};}};function detectModeFromSql(_0x44e4c8){const _0xe8940c=a212_0x14db3a,_0x1712ff=ensureRemoteSqlContent(_0x44e4c8),_0x585451=stripLocalSqlMetadata(_0x1712ff,_0xe8940c(0x19a))[_0xe8940c(0x1ba)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x585451))return _0xe8940c(0x19a);return'sql';}function isEquivalentPulledSqlFile(_0x4d6db5,_0x386159,_0x669bdf){return normalizePullComparableContent(_0x4d6db5,_0x669bdf)===normalizePullComparableContent(_0x386159,_0x669bdf);}function normalizePullComparableContent(_0x4de56a,_0x21fa5c){const _0x5be104=a212_0x14db3a,_0x53f46c=_0x4de56a[_0x5be104(0x18c)](/\r\n/g,'\x0a')[_0x5be104(0x1ae)]('\x0a'),_0x370b13=_0x53f46c['filter'](_0x15cd53=>!isSyncedAtMetadataLine(_0x15cd53,_0x21fa5c));return _0x370b13[_0x5be104(0x1bc)]('\x0a');}function isSyncedAtMetadataLine(_0x4c7baf,_0x504311){const _0x3ce4c9=a212_0x14db3a;if(_0x504311===_0x3ce4c9(0x19a))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x3ce4c9(0x1a6)](_0x4c7baf);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x3ce4c9(0x1a6)](_0x4c7baf);}
1
+ const a212_0x4ecddd=a212_0x44ae;(function(_0x20b2a5,_0x592fe6){const _0x55ac03=a212_0x44ae,_0x140f97=_0x20b2a5();while(!![]){try{const _0x5befc5=-parseInt(_0x55ac03(0x1c5))/0x1+parseInt(_0x55ac03(0x1a8))/0x2*(-parseInt(_0x55ac03(0x197))/0x3)+parseInt(_0x55ac03(0x1b7))/0x4*(parseInt(_0x55ac03(0x1af))/0x5)+parseInt(_0x55ac03(0x1be))/0x6*(parseInt(_0x55ac03(0x1a5))/0x7)+parseInt(_0x55ac03(0x199))/0x8+parseInt(_0x55ac03(0x1a6))/0x9+-parseInt(_0x55ac03(0x1c6))/0xa*(-parseInt(_0x55ac03(0x1b0))/0xb);if(_0x5befc5===_0x592fe6)break;else _0x140f97['push'](_0x140f97['shift']());}catch(_0x5940ab){_0x140f97['push'](_0x140f97['shift']());}}}(a212_0x56e2,0x89d1b));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';function a212_0x56e2(){const _0x1e9ff8=['string','name','bool','11435stkqRX','13376OARLYn','test','str','Pull\x20complete:\x20','Filter\x20by\x20SQL\x20display\x20name','push','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','580utOaHJ','filter','sqlcode','boolean','\x20skipped,\x20','toISOString','pull','1479522DvNDJt','paging','trimStart','mybatisXml','sqlCode','Would\x20pull\x20','catch','812852lGufFW','880BSitqz','replace','length','totalCount','lockFilePath','sql','sqls','POST','local\x20differs\x20from\x20remote','tableData','appCode','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','force','join','\x20failed','3bdjOyx','sqlName','2582304JognXd','lastSync','skipped','utf8','dbId','path','nonInteractive','unchanged','sqlRoot','\x20SQL\x20file(s)\x20into\x20','would_pull','description','7VDFLau','3750003vaESTE','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','94612HfjtyH','cancelled','sqlContent','sqlRootDir'];a212_0x56e2=function(){return _0x1e9ff8;};return a212_0x56e2();}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x190acd,_0x20fbbc){const _0x54249d=a212_0x44ae,_0x509cbd=[];let _0x3bf5dd=0x1;while(!![]){const _0x3488c6=await listSqlQueries(_0x190acd,{'currentPage':_0x3bf5dd,'pageSize':PAGE_SIZE,'sqlCode':_0x20fbbc[_0x54249d(0x1c2)],'sqlName':_0x20fbbc[_0x54249d(0x198)]}),_0x561d2c=_0x3488c6[_0x54249d(0x1cf)]??[];_0x509cbd[_0x54249d(0x1b5)](..._0x561d2c);if(_0x561d2c[_0x54249d(0x1c8)]===0x0)break;const _0x97d588=_0x3488c6[_0x54249d(0x1bf)]?.[_0x54249d(0x1c9)];if(_0x97d588!=null?_0x509cbd[_0x54249d(0x1c8)]>=_0x97d588:_0x561d2c[_0x54249d(0x1c8)]<PAGE_SIZE)break;_0x3bf5dd++;}return _0x509cbd;}async function ensureSqlContent(_0x187ee3){const _0x32ac69=a212_0x44ae;if(_0x187ee3[_0x32ac69(0x1aa)]!=null&&String(_0x187ee3['sqlContent'])['length']>0x0)return _0x187ee3;return getSqlQueryDetail(_0x187ee3[_0x32ac69(0x1c2)]);}export const sqlPull={'service':a212_0x4ecddd(0x1cb),'command':a212_0x4ecddd(0x1bd),'description':a212_0x4ecddd(0x1a7),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a212_0x4ecddd(0x1ac),'description':a212_0x4ecddd(0x1b4)},{'name':'force','type':a212_0x4ecddd(0x1ba),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x311e00){const _0x136296=a212_0x4ecddd,_0x59cd3a=loadSqlProjectConfig(_0x311e00[_0x136296(0x1d0)]),_0x3fb7bd=await readSqlLockFile(_0x59cd3a[_0x136296(0x1ca)]),{appLock:_0xe02317}=ensureSqlLockScope(_0x3fb7bd??createEmptySqlLock(),_0x59cd3a[_0x136296(0x1d0)],_0x59cd3a[_0x136296(0x1a1)],_0x136296(0x1bd)),_0xcee0ee=await fetchAllSqlQueries(_0x311e00[_0x136296(0x1d0)],{'sqlCode':_0x311e00[_0x136296(0x1b2)](_0x136296(0x1b9))||undefined,'sqlName':_0x311e00['str'](_0x136296(0x1ad))||undefined}),_0x4fa8ca=[];for(const _0x4c0df5 of _0xcee0ee){const _0x4bb91d=await ensureSqlContent(_0x4c0df5),_0x3409ce=ensureRemoteSqlContent(_0x4bb91d),_0x445686=detectModeFromSql(_0x4bb91d),_0x3d82ae=_0x4bb91d[_0x136296(0x19d)]?await getDbName(_0x311e00[_0x136296(0x1d0)],Number(_0x4bb91d[_0x136296(0x19d)]))[_0x136296(0x1c4)](()=>undefined):undefined,_0x50ee20=buildLocalSqlFileContent({'sqlCode':_0x4bb91d[_0x136296(0x1c2)],'sqlName':_0x4bb91d[_0x136296(0x198)],'dbId':_0x4bb91d['dbId']},_0x3409ce,{'dbName':_0x3d82ae,'mode':_0x445686,'syncedAt':new Date()[_0x136296(0x1bc)](),'description':_0x4bb91d[_0x136296(0x1a4)]}),_0x472490=buildSqlLockEntry(_0x4bb91d,_0x3409ce,'',{'dbName':_0x3d82ae}),_0x2e7687=resolveLocalSqlFilePath(_0x59cd3a,_0x4bb91d[_0x136296(0x1c2)],_0x472490);let _0x38a430=_0x136296(0x1a3),_0x3e0b62;if(await fileExists(_0x2e7687)){const _0x44555c=await readFile(_0x2e7687,_0x136296(0x19c));isEquivalentPulledSqlFile(_0x44555c,_0x50ee20,_0x445686)?(_0x38a430=_0x136296(0x19b),_0x3e0b62=_0x136296(0x1a0)):(_0x38a430='conflict',_0x3e0b62=_0x136296(0x1d1));}_0x4fa8ca[_0x136296(0x1b5)]({'sqlCode':_0x4bb91d[_0x136296(0x1c2)],'sqlName':_0x4bb91d['sqlName'],'filePath':_0x2e7687,'status':_0x38a430,'reason':_0x3e0b62});}return{'method':_0x136296(0x1cd),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x311e00[_0x136296(0x1d0)],'sqlCode':_0x311e00[_0x136296(0x1b2)](_0x136296(0x1b9))||null,'sqlName':_0x311e00[_0x136296(0x1b2)](_0x136296(0x1ad))||null,'files':_0x4fa8ca},'description':_0x136296(0x1c3)+_0x4fa8ca[_0x136296(0x1c8)]+_0x136296(0x1a2)+_0x59cd3a[_0x136296(0x1ab)]};},async 'execute'(_0x5a1998){const _0x1d7975=a212_0x4ecddd,_0x3a4f6c=loadSqlProjectConfig(_0x5a1998[_0x1d7975(0x1d0)]),_0x35a612=await readSqlLockFile(_0x3a4f6c[_0x1d7975(0x1ca)]),{lockData:_0x28e050,appLock:_0x53a53e}=ensureSqlLockScope(_0x35a612??createEmptySqlLock(),_0x3a4f6c['appCode'],_0x3a4f6c[_0x1d7975(0x1a1)],'pull'),_0x1a088c=_0x5a1998[_0x1d7975(0x1ae)](_0x1d7975(0x1d2)),_0x37f021=await fetchAllSqlQueries(_0x5a1998[_0x1d7975(0x1d0)],{'sqlCode':_0x5a1998[_0x1d7975(0x1b2)](_0x1d7975(0x1b9))||undefined,'sqlName':_0x5a1998[_0x1d7975(0x1b2)](_0x1d7975(0x1ad))||undefined});if(_0x37f021[_0x1d7975(0x1c8)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x54f0e1=[],_0x4c692f=[];for(const _0x2ecf6a of _0x37f021){try{_0x54f0e1[_0x1d7975(0x1b5)](await ensureSqlContent(_0x2ecf6a));}catch(_0x1c8246){_0x4c692f[_0x1d7975(0x1b5)]({'sqlCode':_0x2ecf6a[_0x1d7975(0x1c2)],'error':_0x1c8246 instanceof Error?_0x1c8246['message']:String(_0x1c8246)});}}if(_0x1a088c&&!_0x5a1998[_0x1d7975(0x19f)]){let _0x21bb85=![];for(const _0x4b2bad of _0x54f0e1){const _0xa06b17=detectModeFromSql(_0x4b2bad),_0x3a64bd=_0x4b2bad[_0x1d7975(0x19d)]?await getDbName(_0x5a1998['appCode'],Number(_0x4b2bad[_0x1d7975(0x19d)]))[_0x1d7975(0x1c4)](()=>undefined):undefined,_0x39d49a=buildLocalSqlFileContent({'sqlCode':_0x4b2bad['sqlCode'],'sqlName':_0x4b2bad[_0x1d7975(0x198)],'dbId':_0x4b2bad[_0x1d7975(0x19d)]},ensureRemoteSqlContent(_0x4b2bad),{'dbName':_0x3a64bd,'mode':_0xa06b17,'syncedAt':new Date()[_0x1d7975(0x1bc)](),'description':_0x4b2bad[_0x1d7975(0x1a4)]}),_0x45c87d=resolveLocalSqlFilePath(_0x3a4f6c,_0x4b2bad[_0x1d7975(0x1c2)],buildSqlLockEntry(_0x4b2bad,ensureRemoteSqlContent(_0x4b2bad),'',{'dbName':_0x3a64bd}));if(await fileExists(_0x45c87d)){const _0x1da928=await readFile(_0x45c87d,_0x1d7975(0x19c));if(!isEquivalentPulledSqlFile(_0x1da928,_0x39d49a,_0xa06b17)){_0x21bb85=!![];break;}}}if(_0x21bb85){const _0x172926=await confirmForceOverwrite(_0x1d7975(0x1b6));if(!_0x172926)throw CliErrors[_0x1d7975(0x1a9)]('Force\x20pull\x20cancelled.');}}const _0x3bcd87=cloneSqlLockData(_0x28e050),_0x96faaf=_0x3bcd87['apps'][_0x3a4f6c['appCode']],_0x1132dd=[],_0x4589a5=[];for(const _0xe25923 of _0x54f0e1){const _0xa173fe=_0x96faaf[_0x1d7975(0x1cc)][_0xe25923[_0x1d7975(0x1c2)]],_0x39612c=ensureRemoteSqlContent(_0xe25923),_0x5b03b3=detectModeFromSql(_0xe25923),_0x3d43a5=_0xe25923[_0x1d7975(0x19d)]?await getDbName(_0x5a1998[_0x1d7975(0x1d0)],Number(_0xe25923[_0x1d7975(0x19d)]))[_0x1d7975(0x1c4)](()=>undefined):undefined,_0x16c9e2=buildLocalSqlFileContent({'sqlCode':_0xe25923[_0x1d7975(0x1c2)],'sqlName':_0xe25923[_0x1d7975(0x198)],'dbId':_0xe25923[_0x1d7975(0x19d)]},_0x39612c,{'dbName':_0x3d43a5,'mode':_0x5b03b3,'syncedAt':new Date()[_0x1d7975(0x1bc)](),'description':_0xe25923['description']}),_0x3bd402=buildSqlLockEntry(_0xe25923,_0x39612c,computeSqlContentHash(_0x16c9e2),{'dbName':_0x3d43a5}),_0x18603a=_0x3bd402[_0x1d7975(0x19e)],_0x2d8e40=join(_0x3a4f6c[_0x1d7975(0x1ab)],_0x18603a);try{if(await fileExists(_0x2d8e40)){const _0x349cee=await readFile(_0x2d8e40,'utf8');if(isEquivalentPulledSqlFile(_0x349cee,_0x16c9e2,_0x5b03b3)){_0x4589a5[_0x1d7975(0x1b5)]({'sqlCode':_0xe25923['sqlCode'],'reason':_0x1d7975(0x1a0)}),_0x96faaf[_0x1d7975(0x1cc)][_0xe25923['sqlCode']]={..._0x3bd402,'hash':computeSqlContentHash(_0x349cee),'path':_0x18603a};continue;}if(!_0x1a088c){_0x4589a5[_0x1d7975(0x1b5)]({'sqlCode':_0xe25923['sqlCode'],'reason':_0x1d7975(0x1ce)});continue;}}const _0x118971=_0xa173fe?.[_0x1d7975(0x19e)]?join(_0x3a4f6c[_0x1d7975(0x1ab)],_0xa173fe[_0x1d7975(0x19e)]):undefined;_0x118971&&_0x118971!==_0x2d8e40&&await fileExists(_0x118971)&&await rm(_0x118971,{'force':!![]}),await ensureParentDirectory(_0x2d8e40),await writeFile(_0x2d8e40,_0x16c9e2,_0x1d7975(0x19c)),_0x96faaf['sqls'][_0xe25923[_0x1d7975(0x1c2)]]={..._0x3bd402,'path':_0x18603a},_0x1132dd[_0x1d7975(0x1b5)]({'sqlCode':_0xe25923[_0x1d7975(0x1c2)],'filePath':_0x2d8e40});}catch(_0x21d0e3){_0x4c692f[_0x1d7975(0x1b5)]({'sqlCode':_0xe25923[_0x1d7975(0x1c2)],'error':_0x21d0e3 instanceof Error?_0x21d0e3['message']:String(_0x21d0e3)});}}return _0x96faaf[_0x1d7975(0x19a)]=new Date()[_0x1d7975(0x1bc)](),await writeSqlLockFile(_0x3a4f6c['lockFilePath'],_0x3bcd87),{'ok':_0x4c692f['length']===0x0,'data':{'pulled':_0x1132dd,'skipped':_0x4589a5,'failed':_0x4c692f},'message':_0x1d7975(0x1b3)+_0x1132dd['length']+'\x20written,\x20'+_0x4589a5['length']+_0x1d7975(0x1bb)+_0x4c692f['length']+_0x1d7975(0x196)};}};function detectModeFromSql(_0x503a8b){const _0x280874=a212_0x4ecddd,_0x580395=ensureRemoteSqlContent(_0x503a8b),_0x4dbb32=stripLocalSqlMetadata(_0x580395,_0x280874(0x1c1))[_0x280874(0x1c0)]();if(/^<(select|insert|update|delete)\b/i[_0x280874(0x1b1)](_0x4dbb32))return _0x280874(0x1c1);return _0x280874(0x1cb);}function isEquivalentPulledSqlFile(_0x1d5f76,_0x5a3df8,_0x96a540){return normalizePullComparableContent(_0x1d5f76,_0x96a540)===normalizePullComparableContent(_0x5a3df8,_0x96a540);}function a212_0x44ae(_0x1192d0,_0xd4bfbe){_0x1192d0=_0x1192d0-0x195;const _0x56e22f=a212_0x56e2();let _0x44ae6e=_0x56e22f[_0x1192d0];return _0x44ae6e;}function normalizePullComparableContent(_0x266a75,_0x8a35d0){const _0x2b077b=a212_0x4ecddd,_0x5151b1=_0x266a75[_0x2b077b(0x1c7)](/\r\n/g,'\x0a')['split']('\x0a'),_0x417e0d=_0x5151b1[_0x2b077b(0x1b8)](_0x1c4fed=>!isSyncedAtMetadataLine(_0x1c4fed,_0x8a35d0));return _0x417e0d[_0x2b077b(0x195)]('\x0a');}function isSyncedAtMetadataLine(_0xb27144,_0x24b4e0){const _0x5ed7c8=a212_0x4ecddd;if(_0x24b4e0===_0x5ed7c8(0x1c1))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x5ed7c8(0x1b1)](_0xb27144);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0xb27144);}
@@ -1 +1 @@
1
- function a213_0x1c47(_0x32a822,_0x3d123b){_0x32a822=_0x32a822-0x157;const _0xff3c17=a213_0xff3c();let _0x1c4766=_0xff3c17[_0x32a822];return _0x1c4766;}const a213_0x479043=a213_0x1c47;(function(_0x498031,_0x588216){const _0x54b5b0=a213_0x1c47,_0x3503a9=_0x498031();while(!![]){try{const _0x1a18cb=-parseInt(_0x54b5b0(0x188))/0x1*(-parseInt(_0x54b5b0(0x181))/0x2)+-parseInt(_0x54b5b0(0x159))/0x3+-parseInt(_0x54b5b0(0x164))/0x4*(-parseInt(_0x54b5b0(0x19b))/0x5)+parseInt(_0x54b5b0(0x19c))/0x6*(parseInt(_0x54b5b0(0x18f))/0x7)+-parseInt(_0x54b5b0(0x17a))/0x8+parseInt(_0x54b5b0(0x191))/0x9+-parseInt(_0x54b5b0(0x15f))/0xa;if(_0x1a18cb===_0x588216)break;else _0x3503a9['push'](_0x3503a9['shift']());}catch(_0x41639f){_0x3503a9['push'](_0x3503a9['shift']());}}}(a213_0xff3c,0x597d0));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';function a213_0xff3c(){const _0x5b2eed=['927288xLEvgi','No\x20database\x20matches\x20local\x20directory\x20\x22','lastSync','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','remoteId','/smartapi/custom/updateUserCustomSql','5509920vPisjp','push','has','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','catch','58260IZhMSO','\x20pushed,\x20','get','relativePath','dbName','path','hash','lockFilePath','\x22\x20for\x20sqlCode\x20','dbId','Local\x20SQL\x20not\x20found:\x20','sqlcode','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','length','mode','boolean','startsWith','sqlRootDir','utf8','\x20failed','Push\x20local\x20SQL\x20files\x20to\x20remote','filter','1684232UCTbEF','Local\x20directory\x20\x22','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','message','filePath','sqlRoot','map','253714sCXYTF','str','sqlCode','sql','replace','sqls','toISOString','4QPvJpx','exec','No\x20local\x20SQL\x20files\x20found.','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','sqlName','projectRoot','dbDirectory','7DCWgvp','unchanged','5643045WkXPDE','isFinite','\x20skipped,\x20','appCode','entries','bool','force','Push\x20complete:\x20','validation','\x20SQL\x20file(s)','15pCDplB','1554198xqzpKj','version','Would\x20push\x20'];a213_0xff3c=function(){return _0x5b2eed;};return a213_0xff3c();}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x52015c,_0xf5e871,_0x1f15de){const _0x4fbac4=a213_0x1c47,_0x1e4707=await scanLocalSqlQueries(_0x52015c),_0x117351=new Map();for(const _0xc26864 of _0x1e4707){if(_0x1f15de&&_0xc26864['sqlCode']!==_0x1f15de)continue;const _0xc9af8b=_0x117351[_0x4fbac4(0x166)](_0xc26864[_0x4fbac4(0x183)])??[];_0xc9af8b[_0x4fbac4(0x160)](_0xc26864),_0x117351['set'](_0xc26864[_0x4fbac4(0x183)],_0xc9af8b);}if(_0x1f15de&&!_0x117351[_0x4fbac4(0x161)](_0x1f15de))throw CliErrors['validation'](_0x4fbac4(0x16e)+_0x1f15de);const _0x50b389=[];for(const [_0x28d3d2,_0x4bbb2c]of _0x117351[_0x4fbac4(0x195)]()){if(_0x4bbb2c[_0x4fbac4(0x171)]===0x1){_0x50b389[_0x4fbac4(0x160)](_0x4bbb2c[0x0]);continue;}const _0x310f4b=_0xf5e871[_0x4fbac4(0x186)][_0x28d3d2],_0x4aad03=_0x310f4b?.['path'],_0x210718=_0x4aad03?_0x4bbb2c[_0x4fbac4(0x179)](_0x3fc1bc=>_0x3fc1bc[_0x4fbac4(0x167)]!==_0x4aad03):_0x4bbb2c;if(_0x310f4b&&_0x210718[_0x4fbac4(0x171)]===0x1){_0x50b389['push'](_0x210718[0x0]);continue;}throw CliErrors['validation']('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x28d3d2+_0x4fbac4(0x18b));}return _0x50b389;}export const sqlPush={'service':a213_0x479043(0x184),'command':'push','description':a213_0x479043(0x178),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a213_0x479043(0x173),'description':a213_0x479043(0x170)}],async 'dryRun'(_0x93173e){const _0x5f5514=a213_0x479043,_0x38e851=loadSqlProjectConfig(_0x93173e[_0x5f5514(0x194)]),_0x57fe11=await readSqlLockFile(_0x38e851['lockFilePath']),{appLock:_0x68535d}=ensureSqlLockScope(_0x57fe11??createEmptySqlLock(),_0x93173e['appCode'],_0x38e851[_0x5f5514(0x17f)],_0x5f5514(0x160)),_0x27ff3b=await getTargetSqlQueries(_0x38e851,_0x68535d,_0x93173e[_0x5f5514(0x182)](_0x5f5514(0x16f))||undefined),_0x2da0c5=[];for(const _0x300489 of _0x27ff3b){const _0x2c95db=await computeSqlFileHash(_0x300489[_0x5f5514(0x17e)]),_0x51511d=_0x68535d[_0x5f5514(0x186)][_0x300489['sqlCode']],_0x1d8a8a=!!_0x51511d&&(_0x51511d[_0x5f5514(0x169)]!==_0x300489[_0x5f5514(0x167)]||!!_0x300489[_0x5f5514(0x18c)]&&_0x51511d['sqlName']!==_0x300489[_0x5f5514(0x18c)]);if(!_0x93173e[_0x5f5514(0x196)](_0x5f5514(0x197))&&_0x51511d&&_0x51511d[_0x5f5514(0x16a)]===_0x2c95db&&!_0x1d8a8a)continue;_0x2da0c5[_0x5f5514(0x160)](_0x300489[_0x5f5514(0x183)]);}return{'method':'POST','url':_0x5f5514(0x15e),'body':{'sqlCodes':_0x2da0c5,'appCode':_0x93173e[_0x5f5514(0x194)]},'description':_0x5f5514(0x158)+_0x2da0c5[_0x5f5514(0x171)]+_0x5f5514(0x19a)};},async 'execute'(_0x408d6e){const _0x333ce4=a213_0x479043,_0x5094df=loadSqlProjectConfig(_0x408d6e['appCode']),_0x3555f1=await readSqlLockFile(_0x5094df[_0x333ce4(0x16b)]),{lockData:_0x2c3096,appLock:_0x398920}=ensureSqlLockScope(_0x3555f1??createEmptySqlLock(),_0x408d6e[_0x333ce4(0x194)],_0x5094df[_0x333ce4(0x17f)],'push'),_0x259281=await getTargetSqlQueries(_0x5094df,_0x398920,_0x408d6e['str'](_0x333ce4(0x16f))||undefined);if(_0x259281[_0x333ce4(0x171)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x333ce4(0x18a)};const _0x3994df=[],_0x353021=[],_0xcd7b60=[];for(const _0x377615 of _0x259281){const _0x4785fb=_0x398920[_0x333ce4(0x186)][_0x377615[_0x333ce4(0x183)]];if(!_0x4785fb){_0xcd7b60[_0x333ce4(0x160)]({'sqlCode':_0x377615['sqlCode'],'error':_0x333ce4(0x17c)});continue;}try{const _0x921ba4=await computeSqlFileHash(_0x377615[_0x333ce4(0x17e)]),_0x356ff3=_0x4785fb[_0x333ce4(0x169)]!==_0x377615[_0x333ce4(0x167)]||!!_0x377615[_0x333ce4(0x18c)]&&_0x4785fb[_0x333ce4(0x18c)]!==_0x377615[_0x333ce4(0x18c)];if(!_0x408d6e[_0x333ce4(0x196)]('force')&&_0x4785fb[_0x333ce4(0x16a)]===_0x921ba4&&!_0x356ff3){_0x353021[_0x333ce4(0x160)]({'sqlCode':_0x377615[_0x333ce4(0x183)],'reason':_0x333ce4(0x190)});continue;}if(_0x4785fb[_0x333ce4(0x157)]==null){_0xcd7b60[_0x333ce4(0x160)]({'sqlCode':_0x377615[_0x333ce4(0x183)],'error':_0x333ce4(0x162)});continue;}const _0x1f4566=await readFile(_0x377615[_0x333ce4(0x17e)],_0x333ce4(0x176)),_0x1d9c76=stripLocalSqlMetadata(_0x1f4566,_0x377615[_0x333ce4(0x172)]),_0xf862df=_0x377615['sqlName']||_0x4785fb[_0x333ce4(0x18c)],_0x782fb2=await resolveTargetDbBinding(_0x408d6e[_0x333ce4(0x194)],_0x377615,_0x4785fb),_0x24951c=await updateSqlQuery({'id':_0x4785fb[_0x333ce4(0x15d)],'appCode':_0x408d6e['appCode'],'sqlCode':_0x377615[_0x333ce4(0x183)],'sqlName':_0xf862df,'dbId':_0x782fb2[_0x333ce4(0x16d)],'version':_0x4785fb['version'],'sqlContent':_0x1d9c76,'sqlConfig':_0x4785fb['sqlConfig']??undefined}),_0x18a1d3=_0x24951c[_0x333ce4(0x16d)]?await getDbName(_0x408d6e['appCode'],Number(_0x24951c[_0x333ce4(0x16d)]))[_0x333ce4(0x163)](()=>_0x782fb2[_0x333ce4(0x168)]):_0x782fb2[_0x333ce4(0x168)];_0x398920[_0x333ce4(0x186)][_0x377615[_0x333ce4(0x183)]]={...buildSqlLockEntry(_0x24951c,_0x1d9c76,_0x921ba4,{'dbName':_0x18a1d3}),'path':_0x377615['relativePath'],'mode':_0x4785fb[_0x333ce4(0x172)]},await archivePreviousSqlFileIfNeeded(_0x5094df,_0x4785fb[_0x333ce4(0x169)],_0x377615[_0x333ce4(0x167)]),_0x3994df['push']({'sqlCode':_0x377615[_0x333ce4(0x183)],'remoteId':_0x4785fb['remoteId']});}catch(_0x489d55){_0xcd7b60[_0x333ce4(0x160)]({'sqlCode':_0x377615[_0x333ce4(0x183)],'error':_0x489d55 instanceof Error?_0x489d55[_0x333ce4(0x17d)]:String(_0x489d55)});}}_0x398920[_0x333ce4(0x15b)]=new Date()[_0x333ce4(0x187)](),await writeSqlLockFile(_0x5094df[_0x333ce4(0x16b)],_0x2c3096);const _0x2a640e=_0xcd7b60[_0x333ce4(0x171)]===0x0;return{'ok':_0x2a640e,'data':{'pushed':_0x3994df,'skipped':_0x353021,'failed':_0xcd7b60},'message':_0x333ce4(0x198)+_0x3994df[_0x333ce4(0x171)]+_0x333ce4(0x165)+_0x353021['length']+_0x333ce4(0x193)+_0xcd7b60['length']+_0x333ce4(0x177)};}};async function archivePreviousSqlFileIfNeeded(_0x2927aa,_0x5be5d5,_0x1311c9){const _0xef4694=a213_0x479043;if(!_0x5be5d5||_0x5be5d5===_0x1311c9)return;const _0x238484=join(_0x2927aa[_0xef4694(0x175)],_0x5be5d5);if(!await fileExists(_0x238484))return;const _0x502d4c=await moveToTrash(_0x2927aa[_0xef4694(0x18d)],_0x2927aa['trashDir'],_0x238484);await cleanupEmptyDirectories(dirname(_0x238484),_0x2927aa['sqlRootDir']),void _0x502d4c;}async function moveToTrash(_0x504097,_0x30b3a4,_0x3db04f){const _0x29313c=a213_0x479043,_0x5d0fd2=new Date()[_0x29313c(0x187)]()[_0x29313c(0x185)](/[:.]/g,'-'),_0x9dfe70=relative(_0x504097,_0x3db04f),_0x583b3b=join(_0x30b3a4,_0x5d0fd2,_0x9dfe70);return await mkdir(dirname(_0x583b3b),{'recursive':!![]}),await rename(_0x3db04f,_0x583b3b),_0x583b3b;}async function cleanupEmptyDirectories(_0x48d328,_0x835b00){const _0x235ca5=a213_0x479043;let _0x471655=resolve(_0x48d328);const _0x4b3555=resolve(_0x835b00);while(_0x471655[_0x235ca5(0x174)](''+_0x4b3555+sep)||_0x471655===_0x4b3555){if(_0x471655===_0x4b3555)return;try{const _0x5615f0=await readdir(_0x471655);if(_0x5615f0['length']>0x0)return;await rmdir(_0x471655);}catch{return;}_0x471655=dirname(_0x471655);}}async function resolveTargetDbBinding(_0x2d2175,_0x40cec9,_0x3338b3){const _0x485261=a213_0x479043,_0x2380b8=_0x40cec9[_0x485261(0x18e)];if(!_0x2380b8)return{'dbId':_0x3338b3['dbId'],'dbName':_0x3338b3[_0x485261(0x168)]};const _0x2f2f00=buildDbDirectoryName(_0x3338b3['dbName'],_0x3338b3[_0x485261(0x16d)]);if(_0x2380b8===_0x2f2f00)return{'dbId':_0x3338b3[_0x485261(0x16d)],'dbName':_0x3338b3[_0x485261(0x168)]};const _0x48003d=parseExplicitDbDirectory(_0x2380b8);if(_0x48003d!=null)return{'dbId':_0x48003d,'dbName':await getDbName(_0x2d2175,_0x48003d)[_0x485261(0x163)](()=>undefined)};const _0x5e5d90=await listDatabases(_0x2d2175),_0x30e336=_0x5e5d90[_0x485261(0x179)](_0x19a753=>buildDbDirectoryName(_0x19a753['dbName'],_0x19a753[_0x485261(0x16d)])===_0x2380b8);if(_0x30e336[_0x485261(0x171)]===0x1)return{'dbId':_0x30e336[0x0]['dbId'],'dbName':_0x30e336[0x0][_0x485261(0x168)]};if(_0x30e336['length']===0x0)throw CliErrors[_0x485261(0x199)](_0x485261(0x15a)+_0x2380b8+_0x485261(0x16c)+_0x40cec9['sqlCode']+'.');const _0x31687f=_0x30e336[_0x485261(0x180)](_0x30e7df=>_0x30e7df[_0x485261(0x168)]+'\x20('+_0x30e7df['dbId']+')')['join'](',\x20');throw CliErrors['validation'](_0x485261(0x17b)+_0x2380b8+_0x485261(0x15c)+_0x40cec9[_0x485261(0x183)]+':\x20'+_0x31687f);}function parseExplicitDbDirectory(_0x4722a5){const _0x421fe3=a213_0x479043,_0x49213e=/^db-(\d+)$/[_0x421fe3(0x189)](_0x4722a5);if(!_0x49213e)return null;const _0x3ab8f1=Number(_0x49213e[0x1]);return Number[_0x421fe3(0x192)](_0x3ab8f1)&&_0x3ab8f1>0x0?_0x3ab8f1:null;}
1
+ const a213_0x1718bb=a213_0x4948;(function(_0x4fac46,_0x511c42){const _0x15b8a9=a213_0x4948,_0x98892e=_0x4fac46();while(!![]){try{const _0x5ac995=-parseInt(_0x15b8a9(0xdd))/0x1*(parseInt(_0x15b8a9(0xcf))/0x2)+parseInt(_0x15b8a9(0xb5))/0x3*(-parseInt(_0x15b8a9(0xac))/0x4)+-parseInt(_0x15b8a9(0xdc))/0x5*(-parseInt(_0x15b8a9(0xce))/0x6)+-parseInt(_0x15b8a9(0xb2))/0x7*(parseInt(_0x15b8a9(0xeb))/0x8)+parseInt(_0x15b8a9(0xe8))/0x9+parseInt(_0x15b8a9(0xd1))/0xa*(parseInt(_0x15b8a9(0xd2))/0xb)+parseInt(_0x15b8a9(0xc3))/0xc*(parseInt(_0x15b8a9(0xae))/0xd);if(_0x5ac995===_0x511c42)break;else _0x98892e['push'](_0x98892e['shift']());}catch(_0x22296c){_0x98892e['push'](_0x98892e['shift']());}}}(a213_0x1fdb,0x482a6));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';function a213_0x4948(_0x59642c,_0x564a5a){_0x59642c=_0x59642c-0xab;const _0x1fdbc4=a213_0x1fdb();let _0x4948c7=_0x1fdbc4[_0x59642c];return _0x4948c7;}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x86396,_0x161b8f,_0x2da1df){const _0x287cac=a213_0x4948,_0x5a06e4=await scanLocalSqlQueries(_0x86396),_0x36c084=new Map();for(const _0x195073 of _0x5a06e4){if(_0x2da1df&&_0x195073[_0x287cac(0xb7)]!==_0x2da1df)continue;const _0xe244e7=_0x36c084[_0x287cac(0xe7)](_0x195073[_0x287cac(0xb7)])??[];_0xe244e7[_0x287cac(0xd9)](_0x195073),_0x36c084[_0x287cac(0xd5)](_0x195073[_0x287cac(0xb7)],_0xe244e7);}if(_0x2da1df&&!_0x36c084[_0x287cac(0xe3)](_0x2da1df))throw CliErrors[_0x287cac(0xc0)](_0x287cac(0xc6)+_0x2da1df);const _0x1d6af4=[];for(const [_0x4a45e8,_0x478192]of _0x36c084[_0x287cac(0xb1)]()){if(_0x478192[_0x287cac(0xbf)]===0x1){_0x1d6af4[_0x287cac(0xd9)](_0x478192[0x0]);continue;}const _0x27bbe1=_0x161b8f[_0x287cac(0xd8)][_0x4a45e8],_0x420e21=_0x27bbe1?.[_0x287cac(0xe0)],_0x14bb19=_0x420e21?_0x478192[_0x287cac(0xc4)](_0xf022b6=>_0xf022b6[_0x287cac(0xba)]!==_0x420e21):_0x478192;if(_0x27bbe1&&_0x14bb19[_0x287cac(0xbf)]===0x1){_0x1d6af4[_0x287cac(0xd9)](_0x14bb19[0x0]);continue;}throw CliErrors[_0x287cac(0xc0)](_0x287cac(0xcd)+_0x4a45e8+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x1d6af4;}export const sqlPush={'service':a213_0x1718bb(0xd3),'command':a213_0x1718bb(0xd9),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a213_0x1718bb(0xe5),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a213_0x1718bb(0xc7),'type':'boolean','description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x5bf561){const _0x137d17=a213_0x1718bb,_0x13da32=loadSqlProjectConfig(_0x5bf561[_0x137d17(0xd4)]),_0x57cc3a=await readSqlLockFile(_0x13da32['lockFilePath']),{appLock:_0x228947}=ensureSqlLockScope(_0x57cc3a??createEmptySqlLock(),_0x5bf561[_0x137d17(0xd4)],_0x13da32[_0x137d17(0xcb)],_0x137d17(0xd9)),_0x435fa8=await getTargetSqlQueries(_0x13da32,_0x228947,_0x5bf561[_0x137d17(0xee)](_0x137d17(0xb6))||undefined),_0x40ce94=[];for(const _0x25a718 of _0x435fa8){const _0x26de85=await computeSqlFileHash(_0x25a718[_0x137d17(0xec)]),_0x42e991=_0x228947['sqls'][_0x25a718[_0x137d17(0xb7)]],_0x37ea75=!!_0x42e991&&(_0x42e991[_0x137d17(0xe0)]!==_0x25a718['relativePath']||!!_0x25a718['sqlName']&&_0x42e991[_0x137d17(0xe4)]!==_0x25a718['sqlName']);if(!_0x5bf561[_0x137d17(0xd6)]('force')&&_0x42e991&&_0x42e991['hash']===_0x26de85&&!_0x37ea75)continue;_0x40ce94[_0x137d17(0xd9)](_0x25a718[_0x137d17(0xb7)]);}return{'method':'POST','url':_0x137d17(0xc5),'body':{'sqlCodes':_0x40ce94,'appCode':_0x5bf561[_0x137d17(0xd4)]},'description':_0x137d17(0xe1)+_0x40ce94['length']+_0x137d17(0xc2)};},async 'execute'(_0x3b5b1e){const _0xe81cdc=a213_0x1718bb,_0x3451e7=loadSqlProjectConfig(_0x3b5b1e[_0xe81cdc(0xd4)]),_0x24f8ac=await readSqlLockFile(_0x3451e7[_0xe81cdc(0xca)]),{lockData:_0x242a64,appLock:_0x9cbb60}=ensureSqlLockScope(_0x24f8ac??createEmptySqlLock(),_0x3b5b1e['appCode'],_0x3451e7[_0xe81cdc(0xcb)],_0xe81cdc(0xd9)),_0x3f2387=await getTargetSqlQueries(_0x3451e7,_0x9cbb60,_0x3b5b1e[_0xe81cdc(0xee)](_0xe81cdc(0xb6))||undefined);if(_0x3f2387[_0xe81cdc(0xbf)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x3aa878=[],_0x134492=[],_0x4dce2f=[];for(const _0x5709a0 of _0x3f2387){const _0x40f053=_0x9cbb60[_0xe81cdc(0xd8)][_0x5709a0['sqlCode']];if(!_0x40f053){_0x4dce2f[_0xe81cdc(0xd9)]({'sqlCode':_0x5709a0[_0xe81cdc(0xb7)],'error':_0xe81cdc(0xbd)});continue;}try{const _0x425dc9=await computeSqlFileHash(_0x5709a0[_0xe81cdc(0xec)]),_0x181ce8=_0x40f053['path']!==_0x5709a0[_0xe81cdc(0xba)]||!!_0x5709a0[_0xe81cdc(0xe4)]&&_0x40f053[_0xe81cdc(0xe4)]!==_0x5709a0[_0xe81cdc(0xe4)];if(!_0x3b5b1e[_0xe81cdc(0xd6)](_0xe81cdc(0xc7))&&_0x40f053[_0xe81cdc(0xaf)]===_0x425dc9&&!_0x181ce8){_0x134492[_0xe81cdc(0xd9)]({'sqlCode':_0x5709a0[_0xe81cdc(0xb7)],'reason':_0xe81cdc(0xbe)});continue;}if(_0x40f053['version']==null){_0x4dce2f[_0xe81cdc(0xd9)]({'sqlCode':_0x5709a0[_0xe81cdc(0xb7)],'error':_0xe81cdc(0xd7)});continue;}const _0x5a706b=await readFile(_0x5709a0[_0xe81cdc(0xec)],'utf8'),_0x11cb0c=stripLocalSqlMetadata(_0x5a706b,_0x5709a0['mode']),_0x279fd8=_0x5709a0['sqlName']||_0x40f053[_0xe81cdc(0xe4)],_0x58c849=await resolveTargetDbBinding(_0x3b5b1e[_0xe81cdc(0xd4)],_0x5709a0,_0x40f053),_0x20cc13=await updateSqlQuery({'id':_0x40f053[_0xe81cdc(0xdf)],'appCode':_0x3b5b1e[_0xe81cdc(0xd4)],'sqlCode':_0x5709a0[_0xe81cdc(0xb7)],'sqlName':_0x279fd8,'dbId':_0x58c849['dbId'],'version':_0x40f053[_0xe81cdc(0xb9)],'sqlContent':_0x11cb0c,'sqlConfig':_0x40f053['sqlConfig']??undefined}),_0x1decc4=_0x20cc13[_0xe81cdc(0xbb)]?await getDbName(_0x3b5b1e[_0xe81cdc(0xd4)],Number(_0x20cc13[_0xe81cdc(0xbb)]))[_0xe81cdc(0xb3)](()=>_0x58c849[_0xe81cdc(0xe2)]):_0x58c849[_0xe81cdc(0xe2)];_0x9cbb60[_0xe81cdc(0xd8)][_0x5709a0['sqlCode']]={...buildSqlLockEntry(_0x20cc13,_0x11cb0c,_0x425dc9,{'dbName':_0x1decc4}),'path':_0x5709a0[_0xe81cdc(0xba)],'mode':_0x40f053[_0xe81cdc(0xe6)]},await archivePreviousSqlFileIfNeeded(_0x3451e7,_0x40f053[_0xe81cdc(0xe0)],_0x5709a0[_0xe81cdc(0xba)]),_0x3aa878[_0xe81cdc(0xd9)]({'sqlCode':_0x5709a0['sqlCode'],'remoteId':_0x40f053[_0xe81cdc(0xdf)]});}catch(_0x53270a){_0x4dce2f[_0xe81cdc(0xd9)]({'sqlCode':_0x5709a0[_0xe81cdc(0xb7)],'error':_0x53270a instanceof Error?_0x53270a['message']:String(_0x53270a)});}}_0x9cbb60[_0xe81cdc(0xb4)]=new Date()[_0xe81cdc(0xda)](),await writeSqlLockFile(_0x3451e7[_0xe81cdc(0xca)],_0x242a64);const _0x5e1bd1=_0x4dce2f[_0xe81cdc(0xbf)]===0x0;return{'ok':_0x5e1bd1,'data':{'pushed':_0x3aa878,'skipped':_0x134492,'failed':_0x4dce2f},'message':_0xe81cdc(0xc9)+_0x3aa878[_0xe81cdc(0xbf)]+_0xe81cdc(0xed)+_0x134492[_0xe81cdc(0xbf)]+_0xe81cdc(0xcc)+_0x4dce2f[_0xe81cdc(0xbf)]+_0xe81cdc(0xc1)};}};async function archivePreviousSqlFileIfNeeded(_0x1ccd96,_0xed159a,_0x2a481a){const _0x18f7f0=a213_0x1718bb;if(!_0xed159a||_0xed159a===_0x2a481a)return;const _0x1f8c6a=join(_0x1ccd96[_0x18f7f0(0xad)],_0xed159a);if(!await fileExists(_0x1f8c6a))return;const _0x24521c=await moveToTrash(_0x1ccd96[_0x18f7f0(0xdb)],_0x1ccd96[_0x18f7f0(0xe9)],_0x1f8c6a);await cleanupEmptyDirectories(dirname(_0x1f8c6a),_0x1ccd96[_0x18f7f0(0xad)]),void _0x24521c;}function a213_0x1fdb(){const _0x801744=['version','relativePath','dbId','No\x20database\x20matches\x20local\x20directory\x20\x22','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','unchanged','length','validation','\x20failed','\x20SQL\x20file(s)','24evAkcx','filter','/smartapi/custom/updateUserCustomSql','Local\x20SQL\x20not\x20found:\x20','force','\x22\x20for\x20sqlCode\x20','Push\x20complete:\x20','lockFilePath','sqlRoot','\x20skipped,\x20','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','2211504qjqHxt','2jYygBw','isFinite','970mspKIy','62414QcGxUl','sql','appCode','set','bool','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqls','push','toISOString','projectRoot','5PhAZUp','361770rdLwrU','replace','remoteId','path','Would\x20push\x20','dbName','has','sqlName','write','mode','get','2857950NOwvPU','trashDir','startsWith','8HjtaHK','filePath','\x20pushed,\x20','str','Local\x20directory\x20\x22','2107828CfMhcx','sqlRootDir','491543AibYiH','hash','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','entries','894719xeyzjW','catch','lastSync','3ZyUJme','sqlcode','sqlCode','exec'];a213_0x1fdb=function(){return _0x801744;};return a213_0x1fdb();}async function moveToTrash(_0x4323b0,_0x458e57,_0x445d5a){const _0x5ac8f9=a213_0x1718bb,_0x4cf50b=new Date()[_0x5ac8f9(0xda)]()[_0x5ac8f9(0xde)](/[:.]/g,'-'),_0x1f0cd1=relative(_0x4323b0,_0x445d5a),_0x5c75e7=join(_0x458e57,_0x4cf50b,_0x1f0cd1);return await mkdir(dirname(_0x5c75e7),{'recursive':!![]}),await rename(_0x445d5a,_0x5c75e7),_0x5c75e7;}async function cleanupEmptyDirectories(_0x3b3e46,_0x5957ee){const _0x293071=a213_0x1718bb;let _0x26bc3d=resolve(_0x3b3e46);const _0x3ead71=resolve(_0x5957ee);while(_0x26bc3d[_0x293071(0xea)](''+_0x3ead71+sep)||_0x26bc3d===_0x3ead71){if(_0x26bc3d===_0x3ead71)return;try{const _0x3edb77=await readdir(_0x26bc3d);if(_0x3edb77[_0x293071(0xbf)]>0x0)return;await rmdir(_0x26bc3d);}catch{return;}_0x26bc3d=dirname(_0x26bc3d);}}async function resolveTargetDbBinding(_0x28a99d,_0x53c9b2,_0x266adc){const _0x306c7a=a213_0x1718bb,_0x4d3e99=_0x53c9b2['dbDirectory'];if(!_0x4d3e99)return{'dbId':_0x266adc[_0x306c7a(0xbb)],'dbName':_0x266adc[_0x306c7a(0xe2)]};const _0x4de44c=buildDbDirectoryName(_0x266adc[_0x306c7a(0xe2)],_0x266adc[_0x306c7a(0xbb)]);if(_0x4d3e99===_0x4de44c)return{'dbId':_0x266adc[_0x306c7a(0xbb)],'dbName':_0x266adc[_0x306c7a(0xe2)]};const _0x2c4ee8=parseExplicitDbDirectory(_0x4d3e99);if(_0x2c4ee8!=null)return{'dbId':_0x2c4ee8,'dbName':await getDbName(_0x28a99d,_0x2c4ee8)[_0x306c7a(0xb3)](()=>undefined)};const _0x5a424e=await listDatabases(_0x28a99d),_0x5634b0=_0x5a424e[_0x306c7a(0xc4)](_0x54dea2=>buildDbDirectoryName(_0x54dea2[_0x306c7a(0xe2)],_0x54dea2[_0x306c7a(0xbb)])===_0x4d3e99);if(_0x5634b0[_0x306c7a(0xbf)]===0x1)return{'dbId':_0x5634b0[0x0][_0x306c7a(0xbb)],'dbName':_0x5634b0[0x0]['dbName']};if(_0x5634b0[_0x306c7a(0xbf)]===0x0)throw CliErrors[_0x306c7a(0xc0)](_0x306c7a(0xbc)+_0x4d3e99+_0x306c7a(0xc8)+_0x53c9b2[_0x306c7a(0xb7)]+'.');const _0x2ce4d1=_0x5634b0['map'](_0x3a4c21=>_0x3a4c21[_0x306c7a(0xe2)]+'\x20('+_0x3a4c21[_0x306c7a(0xbb)]+')')['join'](',\x20');throw CliErrors[_0x306c7a(0xc0)](_0x306c7a(0xab)+_0x4d3e99+_0x306c7a(0xb0)+_0x53c9b2[_0x306c7a(0xb7)]+':\x20'+_0x2ce4d1);}function parseExplicitDbDirectory(_0x382070){const _0x5eae42=a213_0x1718bb,_0x2ffe15=/^db-(\d+)$/[_0x5eae42(0xb8)](_0x382070);if(!_0x2ffe15)return null;const _0x20df91=Number(_0x2ffe15[0x1]);return Number[_0x5eae42(0xd0)](_0x20df91)&&_0x20df91>0x0?_0x20df91:null;}
@@ -1 +1 @@
1
- const a214_0x427823=a214_0xc4d8;function a214_0xc4d8(_0x596545,_0x4d80e9){_0x596545=_0x596545-0xe2;const _0x304573=a214_0x3045();let _0xc4d810=_0x304573[_0x596545];return _0xc4d810;}(function(_0x538547,_0x55fdcd){const _0x245a25=a214_0xc4d8,_0x3a99ee=_0x538547();while(!![]){try{const _0x250485=parseInt(_0x245a25(0xf7))/0x1+parseInt(_0x245a25(0xff))/0x2*(-parseInt(_0x245a25(0xf5))/0x3)+-parseInt(_0x245a25(0x100))/0x4+-parseInt(_0x245a25(0x10b))/0x5+parseInt(_0x245a25(0xe9))/0x6+-parseInt(_0x245a25(0xed))/0x7*(parseInt(_0x245a25(0xec))/0x8)+parseInt(_0x245a25(0x102))/0x9*(parseInt(_0x245a25(0xf1))/0xa);if(_0x250485===_0x55fdcd)break;else _0x3a99ee['push'](_0x3a99ee['shift']());}catch(_0x126dfc){_0x3a99ee['push'](_0x3a99ee['shift']());}}}(a214_0x3045,0xd91e5));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a214_0x427823(0x105);export function buildSqlLockEntry(_0x5f23ff,_0x441278,_0x45f21d,_0x1e1b91){const _0x478efc=a214_0x427823,_0x241655=detectSqlMode(_0x441278);return{'path':buildSqlRelativePath(_0x5f23ff[_0x478efc(0xe2)],_0x5f23ff[_0x478efc(0xf3)],_0x1e1b91?.[_0x478efc(0x10a)],_0x241655,_0x5f23ff[_0x478efc(0xee)]),'hash':_0x45f21d,'remoteId':_0x5f23ff['id'],'version':_0x5f23ff[_0x478efc(0xfb)],'dbId':Number(_0x5f23ff['dbId']),'dbName':_0x1e1b91?.['dbName'],'sqlName':_0x5f23ff[_0x478efc(0xf3)],'sqlConfig':_0x5f23ff[_0x478efc(0xf9)]??undefined,'mode':_0x241655};}export function cloneSqlLockData(_0x58ce26){const _0x3ab44e=a214_0x427823;return{'apps':Object[_0x3ab44e(0xfc)](Object['entries'](_0x58ce26['apps'])[_0x3ab44e(0xef)](([_0x275fee,_0x4dfcbf])=>[_0x275fee,{'sqlRoot':_0x4dfcbf['sqlRoot'],'lastSync':_0x4dfcbf[_0x3ab44e(0xe3)],'sqls':{..._0x4dfcbf['sqls']}}]))};}export function ensureRemoteSqlContent(_0x5ef79f){const _0xfde11a=a214_0x427823;return _0x5ef79f[_0xfde11a(0x101)]??'';}export function buildLocalSqlFileContent(_0x2c1cf7,_0x4acb36,_0xe2dff8){const _0xc53ed5=a214_0x427823,_0x325595=_0xe2dff8?.[_0xc53ed5(0xf4)]??detectSqlMode(_0x4acb36),_0x2bfee2=stripLocalSqlMetadata(_0x4acb36,_0x325595)[_0xc53ed5(0xf0)](),_0x358adc=[...buildMetadataHeaderLines({'sqlCode':_0x2c1cf7[_0xc53ed5(0xe2)],'sqlName':_0x2c1cf7[_0xc53ed5(0xf3)],'dbId':_0x2c1cf7['dbId'],'dbName':_0xe2dff8?.['dbName'],'mode':_0x325595,'syncedAt':_0xe2dff8?.[_0xc53ed5(0xe8)],'description':_0xe2dff8?.[_0xc53ed5(0x104)]},_0x325595),'',_0x2bfee2],_0xf364cd=_0x358adc['join']('\x0a');return _0xf364cd[_0xc53ed5(0x10c)]('\x0a')?_0xf364cd:_0xf364cd+'\x0a';}export function stripLocalSqlMetadata(_0x1f532e,_0x5e19c5){const _0x5b1a27=a214_0x427823,_0x378eed=_0x1f532e[_0x5b1a27(0xfd)](/\r\n/g,'\x0a')[_0x5b1a27(0x108)]('\x0a'),_0x302552=[];let _0x2f323c=0x0;if(_0x5e19c5===_0x5b1a27(0xeb))while(_0x2f323c<_0x378eed[_0x5b1a27(0xe5)]){const _0x5548c1=_0x378eed[_0x2f323c]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x5548c1)){_0x2f323c++;continue;}if(_0x5548c1['trim']()===''&&_0x2f323c>0x0){_0x2f323c++;continue;}break;}else while(_0x2f323c<_0x378eed[_0x5b1a27(0xe5)]){const _0x2195ba=_0x378eed[_0x2f323c]??'';if(/^\s*--\s*@lovrabet\./[_0x5b1a27(0x109)](_0x2195ba)){_0x2f323c++;continue;}if(_0x2195ba[_0x5b1a27(0xf0)]()===''&&_0x2f323c>0x0){_0x2f323c++;continue;}break;}for(;_0x2f323c<_0x378eed[_0x5b1a27(0xe5)];_0x2f323c++){_0x302552['push'](_0x378eed[_0x2f323c]);}return _0x302552[_0x5b1a27(0xf2)]('\x0a')[_0x5b1a27(0xf6)]();}export function resolveSqlMode(_0x178d0e,_0xd10bdb){const _0x6000df=a214_0x427823;if(_0xd10bdb?.[_0x6000df(0xf4)])return _0xd10bdb[_0x6000df(0xf4)];return detectSqlMode(_0x178d0e);}export function resolveSqlFileName(_0x2c4c63,_0x51ce83,_0x4bb2d0){const _0x5312d9=a214_0x427823;if(_0x4bb2d0?.['path'])return _0x4bb2d0[_0x5312d9(0x10d)];if(_0x4bb2d0?.[_0x5312d9(0xf3)]||_0x4bb2d0?.[_0x5312d9(0x10a)])return buildSqlRelativePath(_0x2c4c63,_0x4bb2d0?.[_0x5312d9(0xf3)],_0x4bb2d0?.[_0x5312d9(0x10a)],resolveSqlMode(_0x51ce83,_0x4bb2d0),_0x4bb2d0?.[_0x5312d9(0xee)]);return buildDefaultSqlFileName(_0x2c4c63,resolveSqlMode(_0x51ce83,_0x4bb2d0));}export function resolveSqlLocalDir(_0x2a6a59,_0x1125c9){return join(_0x2a6a59,SQL_LOCAL_REL_DIR,_0x1125c9);}export async function confirmForceOverwrite(_0x834f8a){const _0x27a6b1=a214_0x427823,_0x52048e=createInterface({'input':process[_0x27a6b1(0x103)],'output':process[_0x27a6b1(0xea)]}),_0x50e45e=await new Promise(_0x46e171=>{const _0x1aba4a=_0x27a6b1;_0x52048e[_0x1aba4a(0xe6)](_0x834f8a+_0x1aba4a(0xfe),_0x46e171);});return _0x52048e[_0x27a6b1(0x106)](),['y','yes'][_0x27a6b1(0x107)](_0x50e45e[_0x27a6b1(0xf0)]()[_0x27a6b1(0xe4)]());}export function findSqlLockScope(_0x340773,_0x2ef130){const _0x329c70=a214_0x427823;return _0x340773[_0x329c70(0xf8)][_0x2ef130];}function buildMetadataHeaderLines(_0x3a5f66,_0x1a2790){const _0x1f8bc1=a214_0x427823,_0x341823=[['sqlCode',_0x3a5f66[_0x1f8bc1(0xe2)]],['sqlName',_0x3a5f66[_0x1f8bc1(0xf3)]],[_0x1f8bc1(0xee),_0x3a5f66[_0x1f8bc1(0xee)]],[_0x1f8bc1(0x10a),_0x3a5f66[_0x1f8bc1(0x10a)]],[_0x1f8bc1(0xf4),_0x3a5f66[_0x1f8bc1(0xf4)]],[_0x1f8bc1(0xe8),_0x3a5f66[_0x1f8bc1(0xe8)]],['description',_0x3a5f66[_0x1f8bc1(0x104)]]];if(_0x1a2790===_0x1f8bc1(0xeb))return _0x341823[_0x1f8bc1(0xfa)](([,_0x3c0503])=>_0x3c0503!==undefined&&_0x3c0503!==null&&String(_0x3c0503)[_0x1f8bc1(0xf0)]()!=='')[_0x1f8bc1(0xef)](([_0x27820f,_0x4aa60])=>_0x1f8bc1(0xe7)+_0x27820f+':\x20'+String(_0x4aa60)+'\x20-->');return _0x341823[_0x1f8bc1(0xfa)](([,_0x31de72])=>_0x31de72!==undefined&&_0x31de72!==null&&String(_0x31de72)[_0x1f8bc1(0xf0)]()!=='')[_0x1f8bc1(0xef)](([_0x235cfd,_0x390852])=>'--\x20@lovrabet.'+_0x235cfd+':\x20'+String(_0x390852));}function a214_0x3045(){const _0x43a044=['mybatisXml','24QRgYgk','2850267yIRBXw','dbId','map','trim','1690yiePPU','join','sqlName','mode','3216495MvOYWg','trimStart','1583101iwNnXZ','apps','sqlConfig','filter','version','fromEntries','replace','\x20[y/N]\x20','2iCXxZJ','1126060mEiBFi','sqlContent','113193yeGauv','stdin','description','.rabetbase/sql','close','includes','split','test','dbName','7034140nXDNou','endsWith','path','sqlCode','lastSync','toLowerCase','length','question','<!--\x20@lovrabet.','syncedAt','6976524mPsrSo','stderr'];a214_0x3045=function(){return _0x43a044;};return a214_0x3045();}
1
+ const a214_0x34a22e=a214_0x28e4;(function(_0xd2dc53,_0x1af156){const _0x3f05bd=a214_0x28e4,_0xc5b278=_0xd2dc53();while(!![]){try{const _0x287e1e=parseInt(_0x3f05bd(0x8a))/0x1+parseInt(_0x3f05bd(0x80))/0x2*(parseInt(_0x3f05bd(0x8e))/0x3)+parseInt(_0x3f05bd(0x76))/0x4*(parseInt(_0x3f05bd(0x7e))/0x5)+parseInt(_0x3f05bd(0x73))/0x6*(parseInt(_0x3f05bd(0x77))/0x7)+parseInt(_0x3f05bd(0x96))/0x8+parseInt(_0x3f05bd(0x83))/0x9*(-parseInt(_0x3f05bd(0x90))/0xa)+-parseInt(_0x3f05bd(0x74))/0xb*(parseInt(_0x3f05bd(0x8b))/0xc);if(_0x287e1e===_0x1af156)break;else _0xc5b278['push'](_0xc5b278['shift']());}catch(_0x392816){_0xc5b278['push'](_0xc5b278['shift']());}}}(a214_0x3a9d,0x9dd26));function a214_0x3a9d(){const _0x418bd4=['join','description','question','dbName','version','450757mNazmW','192180qZHYZq','apps','dbId','282UMNHGW','trim','421340PWEgdN','length','path','filter','toLowerCase','sqlName','1439432XbcPXO','close','sqls','map','includes','split','sqlCode','2123412Aewtsd','979AgnUKb','replace','92pwFwHf','7zBfvSp','lastSync','mybatisXml','mode','endsWith','trimStart','test','188885zBbUYH','entries','18092AGVJDK','--\x20@lovrabet.','\x20[y/N]\x20','135ihbFOi','.rabetbase/sql'];a214_0x3a9d=function(){return _0x418bd4;};return a214_0x3a9d();}import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a214_0x34a22e(0x84);export function buildSqlLockEntry(_0x493de1,_0x46d849,_0x9f3db8,_0x3a2d35){const _0x1a8944=a214_0x34a22e,_0x16c8f8=detectSqlMode(_0x46d849);return{'path':buildSqlRelativePath(_0x493de1['sqlCode'],_0x493de1[_0x1a8944(0x95)],_0x3a2d35?.[_0x1a8944(0x88)],_0x16c8f8,_0x493de1['dbId']),'hash':_0x9f3db8,'remoteId':_0x493de1['id'],'version':_0x493de1[_0x1a8944(0x89)],'dbId':Number(_0x493de1[_0x1a8944(0x8d)]),'dbName':_0x3a2d35?.[_0x1a8944(0x88)],'sqlName':_0x493de1[_0x1a8944(0x95)],'sqlConfig':_0x493de1['sqlConfig']??undefined,'mode':_0x16c8f8};}export function cloneSqlLockData(_0x333fd9){const _0x1d9f79=a214_0x34a22e;return{'apps':Object['fromEntries'](Object[_0x1d9f79(0x7f)](_0x333fd9[_0x1d9f79(0x8c)])[_0x1d9f79(0x6f)](([_0x57ddf8,_0x139e5d])=>[_0x57ddf8,{'sqlRoot':_0x139e5d['sqlRoot'],'lastSync':_0x139e5d[_0x1d9f79(0x78)],'sqls':{..._0x139e5d[_0x1d9f79(0x6e)]}}]))};}export function ensureRemoteSqlContent(_0x3a7729){return _0x3a7729['sqlContent']??'';}export function buildLocalSqlFileContent(_0x23ae55,_0x1b8abd,_0x29d375){const _0x314422=a214_0x34a22e,_0x4f74ba=_0x29d375?.[_0x314422(0x7a)]??detectSqlMode(_0x1b8abd),_0xcf72a5=stripLocalSqlMetadata(_0x1b8abd,_0x4f74ba)[_0x314422(0x8f)](),_0x33af9f=[...buildMetadataHeaderLines({'sqlCode':_0x23ae55[_0x314422(0x72)],'sqlName':_0x23ae55[_0x314422(0x95)],'dbId':_0x23ae55['dbId'],'dbName':_0x29d375?.[_0x314422(0x88)],'mode':_0x4f74ba,'syncedAt':_0x29d375?.['syncedAt'],'description':_0x29d375?.[_0x314422(0x86)]},_0x4f74ba),'',_0xcf72a5],_0x39aa04=_0x33af9f['join']('\x0a');return _0x39aa04[_0x314422(0x7b)]('\x0a')?_0x39aa04:_0x39aa04+'\x0a';}function a214_0x28e4(_0x1045af,_0x175a22){_0x1045af=_0x1045af-0x6d;const _0x3a9d48=a214_0x3a9d();let _0x28e47c=_0x3a9d48[_0x1045af];return _0x28e47c;}export function stripLocalSqlMetadata(_0x4b7394,_0xca3218){const _0x1c36ef=a214_0x34a22e,_0xbb8fe6=_0x4b7394[_0x1c36ef(0x75)](/\r\n/g,'\x0a')[_0x1c36ef(0x71)]('\x0a'),_0x5521fa=[];let _0x262244=0x0;if(_0xca3218===_0x1c36ef(0x79))while(_0x262244<_0xbb8fe6[_0x1c36ef(0x91)]){const _0x42f32d=_0xbb8fe6[_0x262244]??'';if(/^\s*<!--\s*@lovrabet\./[_0x1c36ef(0x7d)](_0x42f32d)){_0x262244++;continue;}if(_0x42f32d['trim']()===''&&_0x262244>0x0){_0x262244++;continue;}break;}else while(_0x262244<_0xbb8fe6['length']){const _0x5aec64=_0xbb8fe6[_0x262244]??'';if(/^\s*--\s*@lovrabet\./[_0x1c36ef(0x7d)](_0x5aec64)){_0x262244++;continue;}if(_0x5aec64['trim']()===''&&_0x262244>0x0){_0x262244++;continue;}break;}for(;_0x262244<_0xbb8fe6[_0x1c36ef(0x91)];_0x262244++){_0x5521fa['push'](_0xbb8fe6[_0x262244]);}return _0x5521fa[_0x1c36ef(0x85)]('\x0a')[_0x1c36ef(0x7c)]();}export function resolveSqlMode(_0x1d5f93,_0x1ea8ae){const _0x29ab96=a214_0x34a22e;if(_0x1ea8ae?.[_0x29ab96(0x7a)])return _0x1ea8ae[_0x29ab96(0x7a)];return detectSqlMode(_0x1d5f93);}export function resolveSqlFileName(_0x2f557e,_0x5c5d6a,_0x7bc1db){const _0x2cd3dd=a214_0x34a22e;if(_0x7bc1db?.[_0x2cd3dd(0x92)])return _0x7bc1db[_0x2cd3dd(0x92)];if(_0x7bc1db?.['sqlName']||_0x7bc1db?.[_0x2cd3dd(0x88)])return buildSqlRelativePath(_0x2f557e,_0x7bc1db?.[_0x2cd3dd(0x95)],_0x7bc1db?.[_0x2cd3dd(0x88)],resolveSqlMode(_0x5c5d6a,_0x7bc1db),_0x7bc1db?.[_0x2cd3dd(0x8d)]);return buildDefaultSqlFileName(_0x2f557e,resolveSqlMode(_0x5c5d6a,_0x7bc1db));}export function resolveSqlLocalDir(_0x1b03d4,_0x10da76){return join(_0x1b03d4,SQL_LOCAL_REL_DIR,_0x10da76);}export async function confirmForceOverwrite(_0x13d00f){const _0x11e43e=a214_0x34a22e,_0x12cb7a=createInterface({'input':process['stdin'],'output':process['stderr']}),_0x18f3ad=await new Promise(_0xebdae2=>{const _0x2fa8ba=a214_0x28e4;_0x12cb7a[_0x2fa8ba(0x87)](_0x13d00f+_0x2fa8ba(0x82),_0xebdae2);});return _0x12cb7a[_0x11e43e(0x6d)](),['y','yes'][_0x11e43e(0x70)](_0x18f3ad[_0x11e43e(0x8f)]()[_0x11e43e(0x94)]());}export function findSqlLockScope(_0x1aa20e,_0x134467){const _0x47115b=a214_0x34a22e;return _0x1aa20e[_0x47115b(0x8c)][_0x134467];}function buildMetadataHeaderLines(_0x46fe52,_0x1b31c8){const _0x439d9c=a214_0x34a22e,_0x3d3ac4=[[_0x439d9c(0x72),_0x46fe52[_0x439d9c(0x72)]],['sqlName',_0x46fe52['sqlName']],[_0x439d9c(0x8d),_0x46fe52['dbId']],[_0x439d9c(0x88),_0x46fe52[_0x439d9c(0x88)]],[_0x439d9c(0x7a),_0x46fe52[_0x439d9c(0x7a)]],['syncedAt',_0x46fe52['syncedAt']],['description',_0x46fe52[_0x439d9c(0x86)]]];if(_0x1b31c8===_0x439d9c(0x79))return _0x3d3ac4[_0x439d9c(0x93)](([,_0x27885a])=>_0x27885a!==undefined&&_0x27885a!==null&&String(_0x27885a)['trim']()!=='')['map'](([_0x54f2a2,_0x1242bd])=>'<!--\x20@lovrabet.'+_0x54f2a2+':\x20'+String(_0x1242bd)+'\x20-->');return _0x3d3ac4['filter'](([,_0x185847])=>_0x185847!==undefined&&_0x185847!==null&&String(_0x185847)[_0x439d9c(0x8f)]()!=='')[_0x439d9c(0x6f)](([_0xf67b99,_0x1d0409])=>_0x439d9c(0x81)+_0xf67b99+':\x20'+String(_0x1d0409));}
@@ -1 +1 @@
1
- function a215_0x310c(){const _0x4fea9b=['7308530drbTLz','10GsfsFM','length','4629252mfntWu','1662yKDABC','243iOZwnk','sqlRoot','3976AjDfEo','map','\x20missing,\x20','keys','26VbnIms','\x20remote-only','appCode','56572rVZErB','lockFilePath','\x20modified,\x20','29718XYcEuc','sqlName','relativePath','paging','sqlCode','sql','324915NVBFBE','read','22UYggTm','hash','push','remote','has','24437OnMExz','lockKey','tableData','path','\x20added,\x20','\x20unchanged','filePath','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','7696795ikGaiw','sqls'];a215_0x310c=function(){return _0x4fea9b;};return a215_0x310c();}const a215_0x2dc53d=a215_0x100a;(function(_0x5b5c80,_0x529a62){const _0x3b37a4=a215_0x100a,_0x6380aa=_0x5b5c80();while(!![]){try{const _0x2a527e=parseInt(_0x3b37a4(0x145))/0x1*(parseInt(_0x3b37a4(0x12f))/0x2)+-parseInt(_0x3b37a4(0x133))/0x3*(-parseInt(_0x3b37a4(0x13c))/0x4)+-parseInt(_0x3b37a4(0x154))/0x5+parseInt(_0x3b37a4(0x132))/0x6*(-parseInt(_0x3b37a4(0x14c))/0x7)+-parseInt(_0x3b37a4(0x135))/0x8*(parseInt(_0x3b37a4(0x13f))/0x9)+parseInt(_0x3b37a4(0x12e))/0xa*(parseInt(_0x3b37a4(0x147))/0xb)+parseInt(_0x3b37a4(0x131))/0xc*(parseInt(_0x3b37a4(0x139))/0xd);if(_0x2a527e===_0x529a62)break;else _0x6380aa['push'](_0x6380aa['shift']());}catch(_0x578550){_0x6380aa['push'](_0x6380aa['shift']());}}}(a215_0x310c,0xd0f8a));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';function a215_0x100a(_0x508c38,_0x2c0164){_0x508c38=_0x508c38-0x12e;const _0x310c33=a215_0x310c();let _0x100af4=_0x310c33[_0x508c38];return _0x100af4;}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(_0x1ef49f){const _0x20cf07=a215_0x100a,_0x3d5ff4=[];let _0x9cb45=0x1;while(!![]){const _0x45338a=await listSqlQueries(_0x1ef49f,{'currentPage':_0x9cb45,'pageSize':PAGE_SIZE}),_0x2685bb=_0x45338a[_0x20cf07(0x14e)]??[];_0x3d5ff4['push'](..._0x2685bb['map'](_0x226738=>_0x226738[_0x20cf07(0x143)]));if(_0x2685bb[_0x20cf07(0x130)]===0x0)break;const _0x5deef5=_0x45338a[_0x20cf07(0x142)]?.['totalCount'];if(_0x5deef5!=null?_0x3d5ff4[_0x20cf07(0x130)]>=_0x5deef5:_0x2685bb[_0x20cf07(0x130)]<PAGE_SIZE)break;_0x9cb45++;}return _0x3d5ff4;}export const sqlStatus={'service':a215_0x2dc53d(0x144),'command':'status','description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a215_0x2dc53d(0x146),'flags':[{'name':a215_0x2dc53d(0x14a),'type':'boolean','description':a215_0x2dc53d(0x153)}],async 'execute'(_0x58b34b){const _0x4e16ff=a215_0x2dc53d,_0x36fbe6=loadSqlProjectConfig(_0x58b34b[_0x4e16ff(0x13b)]),_0x537d70=await readSqlLockFile(_0x36fbe6[_0x4e16ff(0x13d)]),{appLock:_0x7cdf83}=ensureSqlLockScope(_0x537d70??createEmptySqlLock(),_0x36fbe6[_0x4e16ff(0x13b)],_0x36fbe6[_0x4e16ff(0x134)],'status'),_0x435ebc=await scanLocalSqlQueries(_0x36fbe6),_0x865c9a=[],_0x16aebb=[],_0xd736c1=[],_0x287ea2=[],_0x45caea=new Set(_0x435ebc[_0x4e16ff(0x136)](_0x23a663=>_0x23a663[_0x4e16ff(0x14d)]));for(const _0x4034c6 of _0x435ebc){const _0xa96ef5=await computeSqlFileHash(_0x4034c6[_0x4e16ff(0x152)]),_0xc0177d=_0x7cdf83[_0x4e16ff(0x155)][_0x4034c6[_0x4e16ff(0x14d)]],_0x36a724=!!_0xc0177d&&_0xc0177d[_0x4e16ff(0x14f)]!==_0x4034c6[_0x4e16ff(0x141)],_0x5dd58f=!!_0xc0177d&&!!_0x4034c6[_0x4e16ff(0x140)]&&_0xc0177d[_0x4e16ff(0x140)]!==_0x4034c6[_0x4e16ff(0x140)];if(!_0xc0177d)_0x865c9a['push'](_0x4034c6[_0x4e16ff(0x14d)]);else _0xc0177d[_0x4e16ff(0x148)]!==_0xa96ef5||_0x36a724||_0x5dd58f?_0x16aebb[_0x4e16ff(0x149)](_0x4034c6[_0x4e16ff(0x14d)]):_0xd736c1[_0x4e16ff(0x149)](_0x4034c6['lockKey']);}for(const _0x5b2795 of Object[_0x4e16ff(0x138)](_0x7cdf83[_0x4e16ff(0x155)])){!_0x45caea[_0x4e16ff(0x14b)](_0x5b2795)&&_0x287ea2[_0x4e16ff(0x149)](_0x5b2795);}const _0x487467=[];if(_0x58b34b['bool'](_0x4e16ff(0x14a))){const _0x4afc4d=await fetchAllSqlCodes(_0x58b34b[_0x4e16ff(0x13b)]);for(const _0x4ddcf2 of _0x4afc4d){!_0x45caea[_0x4e16ff(0x14b)](_0x4ddcf2)&&!_0x7cdf83[_0x4e16ff(0x155)][_0x4ddcf2]&&_0x487467['push'](_0x4ddcf2);}}const _0x59be0a=_0x865c9a['length']===0x0&&_0x16aebb[_0x4e16ff(0x130)]===0x0&&_0x287ea2[_0x4e16ff(0x130)]===0x0&&_0x487467['length']===0x0;return{'ok':!![],'data':{'added':_0x865c9a,'modified':_0x16aebb,'missing':_0x287ea2,'unchanged':_0xd736c1,'remoteOnly':_0x487467},'message':_0x59be0a?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x865c9a[_0x4e16ff(0x130)]+_0x4e16ff(0x150)+_0x16aebb[_0x4e16ff(0x130)]+_0x4e16ff(0x13e)+_0x287ea2[_0x4e16ff(0x130)]+_0x4e16ff(0x137)+_0xd736c1[_0x4e16ff(0x130)]+_0x4e16ff(0x151)+(_0x487467[_0x4e16ff(0x130)]>0x0?',\x20'+_0x487467[_0x4e16ff(0x130)]+_0x4e16ff(0x13a):'')};}};
1
+ const a215_0x255533=a215_0x15a4;function a215_0x15a4(_0x5c3296,_0x4b733e){_0x5c3296=_0x5c3296-0x1d1;const _0x1b193f=a215_0x1b19();let _0x15a422=_0x1b193f[_0x5c3296];return _0x15a422;}(function(_0x53e824,_0x32109a){const _0x1dc62f=a215_0x15a4,_0x50fbd2=_0x53e824();while(!![]){try{const _0x3aa149=parseInt(_0x1dc62f(0x1e1))/0x1*(parseInt(_0x1dc62f(0x1e6))/0x2)+-parseInt(_0x1dc62f(0x1d4))/0x3+parseInt(_0x1dc62f(0x1ed))/0x4+-parseInt(_0x1dc62f(0x1d5))/0x5*(-parseInt(_0x1dc62f(0x1e8))/0x6)+parseInt(_0x1dc62f(0x1f4))/0x7+-parseInt(_0x1dc62f(0x1ec))/0x8+-parseInt(_0x1dc62f(0x1f1))/0x9*(parseInt(_0x1dc62f(0x1e4))/0xa);if(_0x3aa149===_0x32109a)break;else _0x50fbd2['push'](_0x50fbd2['shift']());}catch(_0x55909c){_0x50fbd2['push'](_0x50fbd2['shift']());}}}(a215_0x1b19,0x28cde));function a215_0x1b19(){const _0x572ea2=['boolean','33618jnHBAh','lockFilePath','has','push','2667240akmsVY','913792slTBqp','path','sqls','map','81vtIrfi','lockKey','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','1166872yCGsDL','All\x20SQL\x20queries\x20are\x20in\x20sync.','\x20added,\x20','keys','43443iTxTMb','165SbjPYz','hash','relativePath','remote','\x20unchanged','totalCount','sqlCode','filePath','sqlName','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','\x20remote-only','tableData','81974aWBvQb','length','appCode','163330tUMLUP','status','2JadHdE'];a215_0x1b19=function(){return _0x572ea2;};return a215_0x1b19();}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(_0x169468){const _0x574830=a215_0x15a4,_0xfbf881=[];let _0x256634=0x1;while(!![]){const _0x74a35b=await listSqlQueries(_0x169468,{'currentPage':_0x256634,'pageSize':PAGE_SIZE}),_0x4dc16d=_0x74a35b[_0x574830(0x1e0)]??[];_0xfbf881['push'](..._0x4dc16d[_0x574830(0x1f0)](_0x200fc6=>_0x200fc6[_0x574830(0x1db)]));if(_0x4dc16d[_0x574830(0x1e2)]===0x0)break;const _0x192dbc=_0x74a35b['paging']?.[_0x574830(0x1da)];if(_0x192dbc!=null?_0xfbf881[_0x574830(0x1e2)]>=_0x192dbc:_0x4dc16d[_0x574830(0x1e2)]<PAGE_SIZE)break;_0x256634++;}return _0xfbf881;}export const sqlStatus={'service':'sql','command':a215_0x255533(0x1e5),'description':a215_0x255533(0x1f3),'risk':'read','flags':[{'name':'remote','type':a215_0x255533(0x1e7),'description':a215_0x255533(0x1de)}],async 'execute'(_0x5b977){const _0x3919cb=a215_0x255533,_0x46d933=loadSqlProjectConfig(_0x5b977['appCode']),_0x3adb4f=await readSqlLockFile(_0x46d933[_0x3919cb(0x1e9)]),{appLock:_0x1cdfa8}=ensureSqlLockScope(_0x3adb4f??createEmptySqlLock(),_0x46d933['appCode'],_0x46d933['sqlRoot'],'status'),_0x4b7ca0=await scanLocalSqlQueries(_0x46d933),_0x253b9a=[],_0x20acfb=[],_0x261a8f=[],_0x4418e0=[],_0x11e8a2=new Set(_0x4b7ca0['map'](_0x182ed5=>_0x182ed5[_0x3919cb(0x1f2)]));for(const _0x3c38a3 of _0x4b7ca0){const _0x34bb0b=await computeSqlFileHash(_0x3c38a3[_0x3919cb(0x1dc)]),_0x22770e=_0x1cdfa8['sqls'][_0x3c38a3[_0x3919cb(0x1f2)]],_0x50dfa7=!!_0x22770e&&_0x22770e[_0x3919cb(0x1ee)]!==_0x3c38a3[_0x3919cb(0x1d7)],_0x235d95=!!_0x22770e&&!!_0x3c38a3[_0x3919cb(0x1dd)]&&_0x22770e['sqlName']!==_0x3c38a3[_0x3919cb(0x1dd)];if(!_0x22770e)_0x253b9a[_0x3919cb(0x1eb)](_0x3c38a3[_0x3919cb(0x1f2)]);else _0x22770e[_0x3919cb(0x1d6)]!==_0x34bb0b||_0x50dfa7||_0x235d95?_0x20acfb['push'](_0x3c38a3[_0x3919cb(0x1f2)]):_0x261a8f[_0x3919cb(0x1eb)](_0x3c38a3[_0x3919cb(0x1f2)]);}for(const _0x4cb7fa of Object[_0x3919cb(0x1d3)](_0x1cdfa8[_0x3919cb(0x1ef)])){!_0x11e8a2[_0x3919cb(0x1ea)](_0x4cb7fa)&&_0x4418e0['push'](_0x4cb7fa);}const _0x2fb03c=[];if(_0x5b977['bool'](_0x3919cb(0x1d8))){const _0x532267=await fetchAllSqlCodes(_0x5b977[_0x3919cb(0x1e3)]);for(const _0x555d71 of _0x532267){!_0x11e8a2[_0x3919cb(0x1ea)](_0x555d71)&&!_0x1cdfa8['sqls'][_0x555d71]&&_0x2fb03c['push'](_0x555d71);}}const _0x25c839=_0x253b9a[_0x3919cb(0x1e2)]===0x0&&_0x20acfb['length']===0x0&&_0x4418e0[_0x3919cb(0x1e2)]===0x0&&_0x2fb03c['length']===0x0;return{'ok':!![],'data':{'added':_0x253b9a,'modified':_0x20acfb,'missing':_0x4418e0,'unchanged':_0x261a8f,'remoteOnly':_0x2fb03c},'message':_0x25c839?_0x3919cb(0x1d1):_0x253b9a[_0x3919cb(0x1e2)]+_0x3919cb(0x1d2)+_0x20acfb[_0x3919cb(0x1e2)]+'\x20modified,\x20'+_0x4418e0[_0x3919cb(0x1e2)]+'\x20missing,\x20'+_0x261a8f[_0x3919cb(0x1e2)]+_0x3919cb(0x1d9)+(_0x2fb03c[_0x3919cb(0x1e2)]>0x0?',\x20'+_0x2fb03c[_0x3919cb(0x1e2)]+_0x3919cb(0x1df):'')};}};