@lovrabet/rabetbase-cli 2.5.13-beta.1 → 2.5.13

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 (376) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/api-group.js +1 -1
  3. package/lib/api/fetch-model-list.js +1 -1
  4. package/lib/api/generate-api-file.js +1 -1
  5. package/lib/api/generate-sdk-config-file.js +1 -1
  6. package/lib/api/legacy-api-file.js +1 -1
  7. package/lib/api/model-registry-file.js +1 -1
  8. package/lib/api/model-registry-scaffold.js +1 -1
  9. package/lib/api/model-source.js +1 -1
  10. package/lib/auth/auth-server-ui.js +1 -1
  11. package/lib/auth/auth-server.js +1 -1
  12. package/lib/auth/constant.js +1 -1
  13. package/lib/auth/get-cookie.js +1 -1
  14. package/lib/auth/get-session-user.js +1 -1
  15. package/lib/auth/is-session-valid.js +1 -1
  16. package/lib/auth/login-success-html.js +1 -1
  17. package/lib/auth/logout.js +1 -1
  18. package/lib/cli-flags.js +1 -1
  19. package/lib/cli.js +1 -1
  20. package/lib/commands/api/generate.js +1 -1
  21. package/lib/commands/api/index.js +1 -1
  22. package/lib/commands/api/list.js +1 -1
  23. package/lib/commands/api/pull.js +1 -1
  24. package/lib/commands/api/shared.js +1 -1
  25. package/lib/commands/app/detail.js +1 -1
  26. package/lib/commands/app/index.js +1 -1
  27. package/lib/commands/app/list.js +1 -1
  28. package/lib/commands/app/members-list.js +1 -1
  29. package/lib/commands/app/remote-directory.js +1 -1
  30. package/lib/commands/app/shared.js +1 -1
  31. package/lib/commands/app-config/delete.js +1 -1
  32. package/lib/commands/app-config/get.js +1 -1
  33. package/lib/commands/app-config/index.js +1 -1
  34. package/lib/commands/app-config/list.js +1 -1
  35. package/lib/commands/app-config/set.js +1 -1
  36. package/lib/commands/app-config/shared.js +1 -1
  37. package/lib/commands/auth/index.js +1 -1
  38. package/lib/commands/bff/create.js +1 -1
  39. package/lib/commands/bff/delete.js +1 -1
  40. package/lib/commands/bff/detail.js +1 -1
  41. package/lib/commands/bff/index.js +1 -1
  42. package/lib/commands/bff/list.js +1 -1
  43. package/lib/commands/bff/logs.js +1 -1
  44. package/lib/commands/bff/pull.js +1 -1
  45. package/lib/commands/bff/push.js +1 -1
  46. package/lib/commands/bff/status.js +1 -1
  47. package/lib/commands/cli-skill/index.js +1 -1
  48. package/lib/commands/cli-update.js +1 -1
  49. package/lib/commands/codegen/index.js +1 -1
  50. package/lib/commands/codegen/sdk.js +1 -1
  51. package/lib/commands/codegen/sql.js +1 -1
  52. package/lib/commands/common/app-registry.js +1 -1
  53. package/lib/commands/common/app-selector.js +1 -1
  54. package/lib/commands/common/async-task.js +1 -1
  55. package/lib/commands/common/dry-run.js +1 -1
  56. package/lib/commands/common/flags.js +1 -1
  57. package/lib/commands/common/local-file.js +1 -1
  58. package/lib/commands/common/validate.js +1 -1
  59. package/lib/commands/config/delete.js +1 -1
  60. package/lib/commands/config/get.js +1 -1
  61. package/lib/commands/config/index.js +1 -1
  62. package/lib/commands/config/init.js +1 -1
  63. package/lib/commands/config/list.js +1 -1
  64. package/lib/commands/config/set.js +1 -1
  65. package/lib/commands/config/shared.js +1 -1
  66. package/lib/commands/dataset/batch-design.js +1 -1
  67. package/lib/commands/dataset/business-group-update.js +1 -1
  68. package/lib/commands/dataset/business-groups.js +1 -1
  69. package/lib/commands/dataset/capability.js +1 -1
  70. package/lib/commands/dataset/cross-relation-create.js +1 -1
  71. package/lib/commands/dataset/cross-relation-delete.js +1 -1
  72. package/lib/commands/dataset/cross-relation-list.js +1 -1
  73. package/lib/commands/dataset/cross-relation-shared.js +1 -1
  74. package/lib/commands/dataset/cross-relation-update.js +1 -1
  75. package/lib/commands/dataset/delete.js +1 -1
  76. package/lib/commands/dataset/design-context.js +1 -1
  77. package/lib/commands/dataset/design-start.js +1 -1
  78. package/lib/commands/dataset/design-status.js +1 -1
  79. package/lib/commands/dataset/design-sync-retry.js +1 -1
  80. package/lib/commands/dataset/design-sync-status.js +1 -1
  81. package/lib/commands/dataset/design-validate.js +1 -1
  82. package/lib/commands/dataset/detail.js +1 -1
  83. package/lib/commands/dataset/extend-update.js +1 -1
  84. package/lib/commands/dataset/field-restore.js +1 -1
  85. package/lib/commands/dataset/field-update.js +1 -1
  86. package/lib/commands/dataset/generate.js +1 -1
  87. package/lib/commands/dataset/index.js +1 -1
  88. package/lib/commands/dataset/list.js +1 -1
  89. package/lib/commands/dataset/operations.js +1 -1
  90. package/lib/commands/dataset/relation-audit.js +1 -1
  91. package/lib/commands/dataset/relation-create.js +1 -1
  92. package/lib/commands/dataset/relation-delete.js +1 -1
  93. package/lib/commands/dataset/relation-shared.js +1 -1
  94. package/lib/commands/dataset/relation-update.js +1 -1
  95. package/lib/commands/dataset/relations.js +1 -1
  96. package/lib/commands/dataset/rename.js +1 -1
  97. package/lib/commands/dataset/restore.js +1 -1
  98. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  99. package/lib/commands/db/analysis-batching.js +1 -1
  100. package/lib/commands/db/analyze-batch-plan.js +1 -1
  101. package/lib/commands/db/analyze-cancel.js +1 -1
  102. package/lib/commands/db/analyze-start.js +1 -1
  103. package/lib/commands/db/analyze-status.js +1 -1
  104. package/lib/commands/db/create.js +1 -1
  105. package/lib/commands/db/cross-db-analysis-shared.js +1 -1
  106. package/lib/commands/db/cross-db-analyze-latest.js +1 -1
  107. package/lib/commands/db/cross-db-analyze-start.js +1 -1
  108. package/lib/commands/db/cross-db-analyze-status.js +1 -1
  109. package/lib/commands/db/delete.js +1 -1
  110. package/lib/commands/db/detail.js +1 -1
  111. package/lib/commands/db/diff-refresh-start.js +1 -1
  112. package/lib/commands/db/diff-refresh-status.js +1 -1
  113. package/lib/commands/db/diff.js +1 -1
  114. package/lib/commands/db/index.js +1 -1
  115. package/lib/commands/db/list.js +1 -1
  116. package/lib/commands/db/shared.js +1 -1
  117. package/lib/commands/db/table-diff-shared.js +1 -1
  118. package/lib/commands/db/tables.js +1 -1
  119. package/lib/commands/db/test.js +1 -1
  120. package/lib/commands/db/update.js +1 -1
  121. package/lib/commands/deployment/index.js +1 -1
  122. package/lib/commands/deployment/sync-all.js +1 -1
  123. package/lib/commands/deployment/sync-jobs.js +1 -1
  124. package/lib/commands/deployment/sync-status.js +1 -1
  125. package/lib/commands/doctor.js +1 -1
  126. package/lib/commands/file/index.js +1 -1
  127. package/lib/commands/flow/create.js +1 -1
  128. package/lib/commands/flow/detail.js +1 -1
  129. package/lib/commands/flow/index.js +1 -1
  130. package/lib/commands/flow/list.js +1 -1
  131. package/lib/commands/flow/page-list.js +1 -1
  132. package/lib/commands/flow/publish.js +1 -1
  133. package/lib/commands/flow/runtime-resources-shared.js +1 -1
  134. package/lib/commands/flow/runtime-role-list.js +1 -1
  135. package/lib/commands/flow/runtime-role-user-list.js +1 -1
  136. package/lib/commands/flow/runtime-user-search.js +1 -1
  137. package/lib/commands/flow/shared.js +1 -1
  138. package/lib/commands/flow/update.js +1 -1
  139. package/lib/commands/flow/validate.js +1 -1
  140. package/lib/commands/instant-api-policy/current.js +1 -1
  141. package/lib/commands/instant-api-policy/index.js +1 -1
  142. package/lib/commands/instant-api-policy/init.js +1 -1
  143. package/lib/commands/instant-api-policy/publish.js +1 -1
  144. package/lib/commands/instant-api-policy/pull.js +1 -1
  145. package/lib/commands/instant-api-policy/revision.js +1 -1
  146. package/lib/commands/instant-api-policy/revisions.js +1 -1
  147. package/lib/commands/instant-api-policy/rollback.js +1 -1
  148. package/lib/commands/instant-api-policy/shared.js +1 -1
  149. package/lib/commands/instant-api-policy/validate.js +1 -1
  150. package/lib/commands/issue/context.js +1 -1
  151. package/lib/commands/issue/index.js +1 -1
  152. package/lib/commands/issue/nudge.js +1 -1
  153. package/lib/commands/issue/report.js +1 -1
  154. package/lib/commands/kb/create.js +1 -1
  155. package/lib/commands/kb/delete.js +1 -1
  156. package/lib/commands/kb/detail.js +1 -1
  157. package/lib/commands/kb/index.js +1 -1
  158. package/lib/commands/kb/list.js +1 -1
  159. package/lib/commands/kb/search.js +1 -1
  160. package/lib/commands/kb/shared.js +1 -1
  161. package/lib/commands/kb/update.js +1 -1
  162. package/lib/commands/logs/index.js +1 -1
  163. package/lib/commands/menu/asset-update.js +1 -1
  164. package/lib/commands/menu/delete.js +1 -1
  165. package/lib/commands/menu/external-link-create.js +1 -1
  166. package/lib/commands/menu/external-link-update.js +1 -1
  167. package/lib/commands/menu/group-create.js +1 -1
  168. package/lib/commands/menu/group-update.js +1 -1
  169. package/lib/commands/menu/index.js +1 -1
  170. package/lib/commands/menu/list.js +1 -1
  171. package/lib/commands/menu/move.js +1 -1
  172. package/lib/commands/menu/regroup-start.js +1 -1
  173. package/lib/commands/menu/rename.js +1 -1
  174. package/lib/commands/menu/shared/compare-table.js +1 -1
  175. package/lib/commands/menu/shared/delete-plan.js +1 -1
  176. package/lib/commands/menu/shared/facts.js +1 -1
  177. package/lib/commands/menu/shared/index.js +1 -1
  178. package/lib/commands/menu/shared/inquirer.js +1 -1
  179. package/lib/commands/menu/shared/local-pages.js +1 -1
  180. package/lib/commands/menu/shared/logic.js +1 -1
  181. package/lib/commands/menu/shared/mutations.js +1 -1
  182. package/lib/commands/menu/shared/path.js +1 -1
  183. package/lib/commands/menu/shared/service.js +1 -1
  184. package/lib/commands/menu/shared/subapp-assets.js +1 -1
  185. package/lib/commands/menu/shared/sync-core.js +1 -1
  186. package/lib/commands/menu/shared/update-core.js +1 -1
  187. package/lib/commands/menu/shared/valid-url.js +1 -1
  188. package/lib/commands/menu/subapp-assets-status.js +1 -1
  189. package/lib/commands/menu/subapp-assets-update.js +1 -1
  190. package/lib/commands/menu/sync.js +1 -1
  191. package/lib/commands/menu/visibility-update.js +1 -1
  192. package/lib/commands/notification/config-create.js +1 -1
  193. package/lib/commands/notification/config-delete.js +1 -1
  194. package/lib/commands/notification/config-list.js +1 -1
  195. package/lib/commands/notification/config-update.js +1 -1
  196. package/lib/commands/notification/index.js +1 -1
  197. package/lib/commands/notification/shared.js +1 -1
  198. package/lib/commands/ocr/index.js +1 -1
  199. package/lib/commands/page/create.js +1 -1
  200. package/lib/commands/page/custom/detail.js +1 -1
  201. package/lib/commands/page/custom/list.js +1 -1
  202. package/lib/commands/page/custom/publish.js +1 -1
  203. package/lib/commands/page/custom/shared.js +1 -1
  204. package/lib/commands/page/custom/syntax.js +1 -1
  205. package/lib/commands/page/custom/update.js +1 -1
  206. package/lib/commands/page/data-list-status.js +1 -1
  207. package/lib/commands/page/generate-start.js +1 -1
  208. package/lib/commands/page/generate-status.js +1 -1
  209. package/lib/commands/page/index.js +1 -1
  210. package/lib/commands/page/pull.js +1 -1
  211. package/lib/commands/page/push.js +1 -1
  212. package/lib/commands/page/relation-audit.js +1 -1
  213. package/lib/commands/page/restore.js +1 -1
  214. package/lib/commands/page/shared.js +1 -1
  215. package/lib/commands/page/sync.js +1 -1
  216. package/lib/commands/project/api-architecture-upgrade.js +1 -1
  217. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  218. package/lib/commands/project/create/format-elapsed.js +1 -1
  219. package/lib/commands/project/create/main.js +1 -1
  220. package/lib/commands/project/create/materialize-project-template.js +1 -1
  221. package/lib/commands/project/create/project-name.js +1 -1
  222. package/lib/commands/project/create/project-template-archive.js +1 -1
  223. package/lib/commands/project/create/project-template-path.js +1 -1
  224. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  225. package/lib/commands/project/create/use-format-code.js +1 -1
  226. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  227. package/lib/commands/project/domain-routing-sync.js +1 -1
  228. package/lib/commands/project/index.js +1 -1
  229. package/lib/commands/project/upgrade.js +1 -1
  230. package/lib/commands/registry.js +1 -1
  231. package/lib/commands/role/delete.js +1 -1
  232. package/lib/commands/role/detail.js +1 -1
  233. package/lib/commands/role/index.js +1 -1
  234. package/lib/commands/role/list.js +1 -1
  235. package/lib/commands/role/shared.js +1 -1
  236. package/lib/commands/role/update.js +1 -1
  237. package/lib/commands/role/user-add.js +1 -1
  238. package/lib/commands/role/user-remove.js +1 -1
  239. package/lib/commands/role/user-resolve.js +1 -1
  240. package/lib/commands/rule/get.js +1 -1
  241. package/lib/commands/rule/index.js +1 -1
  242. package/lib/commands/rule/list.js +1 -1
  243. package/lib/commands/rule/set.js +1 -1
  244. package/lib/commands/rule/shared.js +1 -1
  245. package/lib/commands/run/index.js +1 -1
  246. package/lib/commands/schema.js +1 -1
  247. package/lib/commands/sql/create.js +1 -1
  248. package/lib/commands/sql/delete.js +1 -1
  249. package/lib/commands/sql/detail.js +1 -1
  250. package/lib/commands/sql/exec.js +1 -1
  251. package/lib/commands/sql/index.js +1 -1
  252. package/lib/commands/sql/list.js +1 -1
  253. package/lib/commands/sql/pull.js +1 -1
  254. package/lib/commands/sql/push.js +1 -1
  255. package/lib/commands/sql/shared.js +1 -1
  256. package/lib/commands/sql/status.js +1 -1
  257. package/lib/commands/sql/validate.js +1 -1
  258. package/lib/commands/task/index.js +1 -1
  259. package/lib/commands/task/status.js +1 -1
  260. package/lib/commands/tenant/index.js +1 -1
  261. package/lib/commands/tenant/members-list.js +1 -1
  262. package/lib/commands/tenant/shared.js +1 -1
  263. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  264. package/lib/commands/user-account/feishu-bind.js +1 -1
  265. package/lib/commands/user-account/index.js +1 -1
  266. package/lib/commands/workspace/add.js +1 -1
  267. package/lib/commands/workspace/index.js +1 -1
  268. package/lib/commands/workspace/remove.js +1 -1
  269. package/lib/config/domain-config.js +1 -1
  270. package/lib/config/project-domain-routing.js +1 -1
  271. package/lib/config/region-config.js +1 -1
  272. package/lib/config/schema.js +1 -1
  273. package/lib/constant/cdn.js +1 -1
  274. package/lib/constant/cli.js +1 -1
  275. package/lib/constant/defaults.js +1 -1
  276. package/lib/constant/domain.js +1 -1
  277. package/lib/constant/env.js +1 -1
  278. package/lib/constant/output.js +1 -1
  279. package/lib/constant/paths.js +1 -1
  280. package/lib/constant/region.js +1 -1
  281. package/lib/constant/risk.js +1 -1
  282. package/lib/constant/routing-profile.js +1 -1
  283. package/lib/context/app-resolver.js +1 -1
  284. package/lib/context/auth-resolver.js +1 -1
  285. package/lib/context/config-loader.js +1 -1
  286. package/lib/context.js +1 -1
  287. package/lib/core/alias-resolver.js +1 -1
  288. package/lib/core/api-client.js +1 -1
  289. package/lib/core/bff/config.js +1 -1
  290. package/lib/core/bff/file-system.js +1 -1
  291. package/lib/core/bff/hash.js +1 -1
  292. package/lib/core/bff/hook-directory.js +1 -1
  293. package/lib/core/bff/lock.js +1 -1
  294. package/lib/core/bff/utils.js +1 -1
  295. package/lib/core/cross-db-analysis.js +1 -1
  296. package/lib/core/cross-db-relation.js +1 -1
  297. package/lib/core/db-resolver.js +1 -1
  298. package/lib/core/flow-config.js +1 -1
  299. package/lib/core/instant-api-policy/config.js +1 -1
  300. package/lib/core/instant-api-policy/endpoints.js +1 -1
  301. package/lib/core/kb-management-client.js +1 -1
  302. package/lib/core/kb-search-client.js +1 -1
  303. package/lib/core/page/file-system.js +1 -1
  304. package/lib/core/page/hash.js +1 -1
  305. package/lib/core/page/lock.js +1 -1
  306. package/lib/core/page/lr-smart-jsx.js +1 -1
  307. package/lib/core/sql-index-auditor.js +1 -1
  308. package/lib/core/sql-sync/config.js +1 -1
  309. package/lib/core/sql-sync/file-system.js +1 -1
  310. package/lib/core/sql-sync/hash.js +1 -1
  311. package/lib/core/sql-sync/lock.js +1 -1
  312. package/lib/core/sql-sync/utils.js +1 -1
  313. package/lib/core/sql-validator.js +1 -1
  314. package/lib/errors.js +1 -1
  315. package/lib/framework/build-all-flags.js +1 -1
  316. package/lib/framework/error-output.js +1 -1
  317. package/lib/framework/explicit-yes.js +1 -1
  318. package/lib/framework/flags.js +1 -1
  319. package/lib/framework/help.js +1 -1
  320. package/lib/framework/index.js +1 -1
  321. package/lib/framework/output.js +1 -1
  322. package/lib/framework/response.js +1 -1
  323. package/lib/framework/runner-alias.js +1 -1
  324. package/lib/framework/runner.js +1 -1
  325. package/lib/framework/schema-export.js +1 -1
  326. package/lib/framework/supported-flags.js +1 -1
  327. package/lib/framework/types.js +1 -1
  328. package/lib/generated/build-info.d.ts +4 -4
  329. package/lib/generated/build-info.js +1 -1
  330. package/lib/generated/official-routing.js +1 -1
  331. package/lib/generated/routing-contract.js +1 -1
  332. package/lib/help.js +1 -1
  333. package/lib/postinstall.js +1 -1
  334. package/lib/runtime/confirmation.js +1 -1
  335. package/lib/runtime/event.js +1 -1
  336. package/lib/runtime/index.js +1 -1
  337. package/lib/runtime/queue.js +1 -1
  338. package/lib/runtime/resolve.js +1 -1
  339. package/lib/services/dataset-design/checkpoint.js +1 -1
  340. package/lib/services/dataset-design/commands.js +1 -1
  341. package/lib/services/dataset-design/contract.js +1 -1
  342. package/lib/skills/builtin-skill.js +1 -1
  343. package/lib/skills/main.js +1 -1
  344. package/lib/skills/npx-skills-add.js +1 -1
  345. package/lib/skills/skill-presence.js +1 -1
  346. package/lib/telemetry/cli-command-trace.js +1 -1
  347. package/lib/telemetry/cli-help-trace.js +1 -1
  348. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  349. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  350. package/lib/telemetry/send-cli-trace-log.js +1 -1
  351. package/lib/utils/ai_config.js +1 -1
  352. package/lib/utils/apply-jq-filter.js +1 -1
  353. package/lib/utils/cdn-config.js +1 -1
  354. package/lib/utils/check-sdk-version.js +1 -1
  355. package/lib/utils/cli-version-check.js +1 -1
  356. package/lib/utils/cli-version-policy.js +1 -1
  357. package/lib/utils/config.js +1 -1
  358. package/lib/utils/entity-with-id.js +1 -1
  359. package/lib/utils/file-utils.js +1 -1
  360. package/lib/utils/guides-cdn.js +1 -1
  361. package/lib/utils/http-client.js +1 -1
  362. package/lib/utils/is-non-interactive.js +1 -1
  363. package/lib/utils/logger.js +1 -1
  364. package/lib/utils/params.js +1 -1
  365. package/lib/utils/platform.js +1 -1
  366. package/lib/utils/sleep.js +1 -1
  367. package/lib/utils/template-replacer.js +1 -1
  368. package/lib/utils/update-notice.js +1 -1
  369. package/lib/utils/version.js +1 -1
  370. package/lib/utils/with-active-cookie.js +1 -1
  371. package/lib/utils/write-cli-side-channel.js +1 -1
  372. package/package.json +1 -1
  373. package/skills/rabetbase/SKILL.md +1 -1
  374. package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
  375. package/skills/rabetbase-page-generation/SKILL.md +1 -1
  376. package/skills/rabetbase.manifest.json +3 -3
@@ -1 +1 @@
1
- const a247_0xb35f96=a247_0x3e63;(function(_0x4a8105,_0x3c5d7c){const _0x2a1894=a247_0x3e63,_0x2b89ed=_0x4a8105();while(!![]){try{const _0x33c79b=parseInt(_0x2a1894(0x1a1))/0x1*(-parseInt(_0x2a1894(0x17a))/0x2)+parseInt(_0x2a1894(0x18d))/0x3*(-parseInt(_0x2a1894(0x1a5))/0x4)+-parseInt(_0x2a1894(0x180))/0x5*(parseInt(_0x2a1894(0x174))/0x6)+-parseInt(_0x2a1894(0x19e))/0x7+parseInt(_0x2a1894(0x190))/0x8*(-parseInt(_0x2a1894(0x192))/0x9)+parseInt(_0x2a1894(0x198))/0xa*(parseInt(_0x2a1894(0x177))/0xb)+parseInt(_0x2a1894(0x1a4))/0xc*(parseInt(_0x2a1894(0x1a0))/0xd);if(_0x33c79b===_0x3c5d7c)break;else _0x2b89ed['push'](_0x2b89ed['shift']());}catch(_0xa03df3){_0x2b89ed['push'](_0x2b89ed['shift']());}}}(a247_0x427d,0xb0453));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';function a247_0x3e63(_0x50839b,_0x5bb0ae){_0x50839b=_0x50839b-0x16d;const _0x427dbc=a247_0x427d();let _0x3e63f4=_0x427dbc[_0x50839b];return _0x3e63f4;}import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function a247_0x427d(){const _0x383374=['464470gGsNbh','SQL\x20query\x20display\x20name','dbName','lastSync','nonInteractive','Plain\x20SQL\x20(sql)','6637519JMduwM','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','408694gVLOcz','10174ptewCv','Created\x20SQL\x20query\x20','\x20\x20SELECT\x201\x20AS\x20id','1248lDveJB','60132CFIYrP','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','/smartapi/custom/saveUserCustomSql','write','join','isFinite','str','dbId\x20must\x20be\x20a\x20positive\x20integer','MyBatis\x20XML\x20(mybatisXml)','__manual__','sqlName','sqlRoot','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','create','name','POST','Select\x20the\x20target\x20database:','Invalid\x20database\x20selection\x20payload:\x20','validation','sqls','flagMissing','mode','stringify','string','426MHkhxO','lockFilePath','File\x20already\x20exists:\x20','319nqNFeb','catch','db-id','250FjNucJ','dbId\x20cannot\x20be\x20empty','SQL\x20name\x20cannot\x20be\x20empty','trim','isInteger','Target\x20database\x20dbId:','55190zHWSwU','mybatisXml','sqlRootDir','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','sql','appCode','number','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','parse','Select\x20the\x20local\x20SQL\x20mode:','dbId','utf8','length','159uyyVQZ','new','toISOString','8lBdVnt','</select>','846882VIvMMS','Local\x20SQL\x20file\x20mode','sqlCode','Target\x20database\x20ID','✎\x20Enter\x20dbId\x20manually','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'];a247_0x427d=function(){return _0x383374;};return a247_0x427d();}function generateSqlTemplate(_0x55ab9a){const _0x2dac4d=a247_0x3e63;if(_0x55ab9a===_0x2dac4d(0x181))return[_0x2dac4d(0x19f),_0x2dac4d(0x1a3),_0x2dac4d(0x191),''][_0x2dac4d(0x1a9)]('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x2dac4d(0x1a9)]('\x0a');}export const sqlCreate={'service':a247_0xb35f96(0x184),'command':a247_0xb35f96(0x1b2),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a247_0xb35f96(0x1a8),'flags':[{'name':'name','type':'string','description':a247_0xb35f96(0x199)},{'name':a247_0xb35f96(0x179),'type':a247_0xb35f96(0x186),'description':a247_0xb35f96(0x195)},{'name':a247_0xb35f96(0x171),'type':a247_0xb35f96(0x173),'enum':[a247_0xb35f96(0x184),a247_0xb35f96(0x181)],'description':a247_0xb35f96(0x193)}],async 'validate'(_0x442daf){const _0x57a571=a247_0xb35f96;if(!_0x442daf['nonInteractive'])return;if(!_0x442daf[_0x57a571(0x1ab)]('name')['trim']())throw CliErrors['flagMissing'](_0x57a571(0x1b3),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x5b4a30=resolveProvidedDbId(_0x442daf);if(typeof _0x5b4a30!==_0x57a571(0x186)||!Number[_0x57a571(0x1aa)](_0x5b4a30)||_0x5b4a30<=0x0)throw CliErrors[_0x57a571(0x170)]('db-id',_0x57a571(0x1a6));if(!_0x442daf['str']('mode')[_0x57a571(0x17d)]())throw CliErrors[_0x57a571(0x170)]('mode',_0x57a571(0x183));},async 'dryRun'(_0x18d6c7){const _0x440a1f=a247_0xb35f96,_0x394303=loadSqlProjectConfig(_0x18d6c7[_0x440a1f(0x185)]),{sqlName:_0x477ed1,dbId:_0x44114b,dbName:_0x5b255c,mode:_0x9412c1}=await resolveSqlNewInputs(_0x18d6c7),_0x1b1ec4=buildSqlRelativePath('<server-generated-sqlCode>',_0x477ed1,_0x5b255c,_0x9412c1,_0x44114b),_0x57fe6a=_0x394303[_0x440a1f(0x182)]+'/'+_0x1b1ec4;return{'method':_0x440a1f(0x1b4),'url':_0x440a1f(0x1a7),'body':{'appCode':_0x18d6c7[_0x440a1f(0x185)],'sqlName':_0x477ed1,'dbId':_0x44114b,'mode':_0x9412c1,'localPath':_0x57fe6a},'description':_0x440a1f(0x197)+_0x394303['sqlRootDir']};},async 'execute'(_0x6a54a0){const _0x443839=a247_0xb35f96,_0x31eabe=loadSqlProjectConfig(_0x6a54a0[_0x443839(0x185)]),{sqlName:_0x3e6649,dbId:_0x28effe,dbName:_0x2830f7,mode:_0x47b615}=await resolveSqlNewInputs(_0x6a54a0),_0x2c2885=generateSqlTemplate(_0x47b615),_0x2980a0=await createSqlQuery({'appCode':_0x6a54a0[_0x443839(0x185)],'sqlName':_0x3e6649,'dbId':_0x28effe,'sqlContent':_0x2c2885}),_0x2962aa=ensureRemoteSqlContent(_0x2980a0),_0x5c6ea8=_0x2830f7||await getDbName(_0x6a54a0[_0x443839(0x185)],_0x28effe)[_0x443839(0x178)](()=>undefined),_0x31a3cd=buildSqlRelativePath(_0x2980a0[_0x443839(0x194)],_0x2980a0['sqlName'],_0x5c6ea8,_0x47b615,_0x28effe),_0x4db938=_0x31eabe[_0x443839(0x182)]+'/'+_0x31a3cd,_0x922c35=buildLocalSqlFileContent({'sqlCode':_0x2980a0[_0x443839(0x194)],'sqlName':_0x2980a0[_0x443839(0x1af)],'dbId':_0x2980a0[_0x443839(0x18a)]},_0x2962aa,{'dbName':_0x5c6ea8,'mode':_0x47b615,'syncedAt':new Date()[_0x443839(0x18f)](),'description':_0x2980a0['description']});if(await fileExists(_0x4db938))throw CliErrors[_0x443839(0x16e)](_0x443839(0x176)+_0x4db938);await ensureParentDirectory(_0x4db938),await writeFile(_0x4db938,_0x922c35,_0x443839(0x18b));const _0x48746f=await readSqlLockFile(_0x31eabe[_0x443839(0x175)]),{lockData:_0x2280ae,appLock:_0x522675}=ensureSqlLockScope(_0x48746f??createEmptySqlLock(),_0x31eabe['appCode'],_0x31eabe[_0x443839(0x1b0)],_0x443839(0x18e));return _0x522675[_0x443839(0x16f)][_0x2980a0[_0x443839(0x194)]]={...buildSqlLockEntry(_0x2980a0,_0x2962aa,computeSqlContentHash(_0x922c35),{'dbName':_0x5c6ea8}),'path':_0x31a3cd,'mode':_0x47b615},_0x522675[_0x443839(0x19b)]=new Date()['toISOString'](),await writeSqlLockFile(_0x31eabe[_0x443839(0x175)],_0x2280ae),{'ok':!![],'data':{'id':_0x2980a0['id'],'sqlCode':_0x2980a0[_0x443839(0x194)],'sqlName':_0x2980a0['sqlName'],'dbId':_0x2980a0[_0x443839(0x18a)],'path':_0x4db938,'mode':_0x47b615},'message':_0x443839(0x1a2)+_0x2980a0[_0x443839(0x194)]};}};async function resolveSqlNewInputs(_0x3a0b93){const _0x347a7a=await resolveSqlNameInput(_0x3a0b93),{dbId:_0xd77f01,dbName:_0x33ce88}=await resolveDbSelection(_0x3a0b93),_0x58d773=await resolveSqlModeInput(_0x3a0b93);return{'sqlName':_0x347a7a,'dbId':_0xd77f01,'dbName':_0x33ce88,'mode':_0x58d773};}async function resolveSqlNameInput(_0x260632){const _0x165ef7=a247_0xb35f96,_0x3df988=_0x260632[_0x165ef7(0x1ab)](_0x165ef7(0x1b3))[_0x165ef7(0x17d)]();if(_0x3df988)return _0x3df988;if(_0x260632['nonInteractive'])throw CliErrors[_0x165ef7(0x170)]('name',_0x165ef7(0x1b1));return(await input({'message':'SQL\x20name:','validate':_0x5099e1=>_0x5099e1[_0x165ef7(0x17d)]()?!![]:_0x165ef7(0x17c)}))['trim']();}async function resolveDbSelection(_0x5a2391){const _0x4be2e9=a247_0xb35f96,_0x1eb985=resolveProvidedDbId(_0x5a2391);if(typeof _0x1eb985==='number'&&Number[_0x4be2e9(0x1aa)](_0x1eb985)&&_0x1eb985>0x0)return{'dbId':_0x1eb985,'dbName':await getDbName(_0x5a2391[_0x4be2e9(0x185)],_0x1eb985)['catch'](()=>undefined)};if(_0x5a2391[_0x4be2e9(0x19c)])throw CliErrors[_0x4be2e9(0x170)](_0x4be2e9(0x179),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x2894cb=await listDatabases(_0x5a2391[_0x4be2e9(0x185)])['catch'](()=>[]);if(_0x2894cb['length']===0x1)return{'dbId':_0x2894cb[0x0][_0x4be2e9(0x18a)],'dbName':_0x2894cb[0x0][_0x4be2e9(0x19a)]};if(_0x2894cb[_0x4be2e9(0x18c)]>0x1){const _0x522ee0=await select({'message':_0x4be2e9(0x1b5),'choices':[..._0x2894cb['map'](_0x29a04a=>({'name':_0x29a04a[_0x4be2e9(0x19a)]+'\x20('+_0x29a04a[_0x4be2e9(0x18a)]+')','value':serializeDbSelection(_0x29a04a)})),{'name':_0x4be2e9(0x196),'value':_0x4be2e9(0x1ae)}]});if(_0x522ee0!=='__manual__')return deserializeDbSelection(_0x522ee0);}const _0x261edc=await input({'message':_0x4be2e9(0x17f),'validate':_0x51c723=>{const _0xa6e06c=_0x4be2e9,_0x1becde=_0x51c723[_0xa6e06c(0x17d)]();if(!_0x1becde)return _0xa6e06c(0x17b);const _0x348561=Number(_0x1becde);if(!Number[_0xa6e06c(0x17e)](_0x348561)||_0x348561<=0x0)return _0xa6e06c(0x1ac);return!![];}});return{'dbId':Number(_0x261edc[_0x4be2e9(0x17d)]())};}async function resolveSqlModeInput(_0x35b1e4){const _0x649ce0=a247_0xb35f96,_0x542121=_0x35b1e4[_0x649ce0(0x1ab)]('mode')[_0x649ce0(0x17d)]();if(_0x542121==='sql'||_0x542121==='mybatisXml')return _0x542121;if(_0x35b1e4[_0x649ce0(0x19c)])throw CliErrors[_0x649ce0(0x170)](_0x649ce0(0x171),_0x649ce0(0x183));return await select({'message':_0x649ce0(0x189),'choices':[{'name':_0x649ce0(0x19d),'value':_0x649ce0(0x184),'description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x649ce0(0x1ad),'value':_0x649ce0(0x181),'description':_0x649ce0(0x187)}]});}function serializeDbSelection(_0x1b7128){const _0x4e02cb=a247_0xb35f96;return JSON[_0x4e02cb(0x172)]({'dbId':_0x1b7128[_0x4e02cb(0x18a)],'dbName':_0x1b7128[_0x4e02cb(0x19a)]});}function deserializeDbSelection(_0x226f61){const _0x2262eb=a247_0xb35f96;try{const _0x4dd48d=JSON[_0x2262eb(0x188)](_0x226f61);if(typeof _0x4dd48d[_0x2262eb(0x18a)]===_0x2262eb(0x186)&&Number['isFinite'](_0x4dd48d['dbId']))return{'dbId':_0x4dd48d[_0x2262eb(0x18a)],'dbName':_0x4dd48d['dbName']};}catch{}throw CliErrors[_0x2262eb(0x16e)](_0x2262eb(0x16d)+_0x226f61);}function resolveProvidedDbId(_0x4e61ec){const _0x332c64=a247_0xb35f96,_0x1b726c=_0x4e61ec['flag'](_0x332c64(0x179));if(typeof _0x1b726c===_0x332c64(0x186)&&Number[_0x332c64(0x1aa)](_0x1b726c))return _0x1b726c;return undefined;}
1
+ const a247_0x498c40=a247_0x5dac;(function(_0x430240,_0x33c08f){const _0x37ef96=a247_0x5dac,_0x439e8a=_0x430240();while(!![]){try{const _0x46f8aa=-parseInt(_0x37ef96(0x1ef))/0x1+-parseInt(_0x37ef96(0x1db))/0x2*(-parseInt(_0x37ef96(0x1be))/0x3)+parseInt(_0x37ef96(0x1eb))/0x4*(-parseInt(_0x37ef96(0x1cd))/0x5)+parseInt(_0x37ef96(0x1f1))/0x6*(-parseInt(_0x37ef96(0x1df))/0x7)+-parseInt(_0x37ef96(0x1e5))/0x8*(-parseInt(_0x37ef96(0x1d6))/0x9)+-parseInt(_0x37ef96(0x1cb))/0xa*(-parseInt(_0x37ef96(0x1e2))/0xb)+parseInt(_0x37ef96(0x1d9))/0xc;if(_0x46f8aa===_0x33c08f)break;else _0x439e8a['push'](_0x439e8a['shift']());}catch(_0x55b64c){_0x439e8a['push'](_0x439e8a['shift']());}}}(a247_0x72ba,0x46a35));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';function a247_0x72ba(){const _0x317fe0=['8FQQVsa','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','mode','str','Created\x20SQL\x20query\x20','length','8nfSDzl','isFinite','join','sql','516651JThaUQ','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','1818yrmFBw','nonInteractive','dbId\x20cannot\x20be\x20empty','Select\x20the\x20target\x20database:','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','lockFilePath','string','Plain\x20SQL\x20(sql)','appCode','trim','MyBatis\x20XML\x20(mybatisXml)','flag','__manual__','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','<server-generated-sqlCode>','1395DhKgsB','utf8','Target\x20database\x20dbId:','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','Select\x20the\x20local\x20SQL\x20mode:','name','isInteger','db-id','catch','lastSync','dbName','dbId','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','70ciVCsr','/smartapi/custom/saveUserCustomSql','1140065fQJIvU','SQL\x20query\x20display\x20name','validation','sqlCode','number','sqlName','mybatisXml','new','File\x20already\x20exists:\x20','1859157IWMtqZ','sqlRootDir','parse','10377792swjZnI','map','514NoIoTJ','stringify','sqlRoot','SELECT\x201\x20AS\x20id;','10843lLHacQ','Target\x20database\x20ID','flagMissing','849299KYTVPs','</select>','SQL\x20name:'];a247_0x72ba=function(){return _0x317fe0;};return a247_0x72ba();}import{getDbName,listDatabases}from'../../core/db-resolver.js';function a247_0x5dac(_0x3c8651,_0x3cfebf){_0x3c8651=_0x3c8651-0x1b2;const _0x72ba7a=a247_0x72ba();let _0x5dac1b=_0x72ba7a[_0x3c8651];return _0x5dac1b;}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x5a4958){const _0x4e8d46=a247_0x5dac;if(_0x5a4958===_0x4e8d46(0x1d3))return[_0x4e8d46(0x1b3),'\x20\x20SELECT\x201\x20AS\x20id',_0x4e8d46(0x1e3),''][_0x4e8d46(0x1ed)]('\x0a');return[_0x4e8d46(0x1de),''][_0x4e8d46(0x1ed)]('\x0a');}export const sqlCreate={'service':'sql','command':'create','description':a247_0x498c40(0x1bc),'risk':'write','flags':[{'name':a247_0x498c40(0x1c3),'type':a247_0x498c40(0x1b5),'description':a247_0x498c40(0x1ce)},{'name':a247_0x498c40(0x1c5),'type':'number','description':a247_0x498c40(0x1e0)},{'name':'mode','type':a247_0x498c40(0x1b5),'enum':[a247_0x498c40(0x1ee),a247_0x498c40(0x1d3)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x84f6ef){const _0x26591c=a247_0x498c40;if(!_0x84f6ef[_0x26591c(0x1f2)])return;if(!_0x84f6ef[_0x26591c(0x1e8)](_0x26591c(0x1c3))['trim']())throw CliErrors[_0x26591c(0x1e1)](_0x26591c(0x1c3),_0x26591c(0x1c1));const _0x1ee3ea=resolveProvidedDbId(_0x84f6ef);if(typeof _0x1ee3ea!=='number'||!Number[_0x26591c(0x1ec)](_0x1ee3ea)||_0x1ee3ea<=0x0)throw CliErrors['flagMissing'](_0x26591c(0x1c5),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x84f6ef[_0x26591c(0x1e8)]('mode')[_0x26591c(0x1b8)]())throw CliErrors['flagMissing'](_0x26591c(0x1e7),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x5f1963){const _0x3bc200=a247_0x498c40,_0x3e11b6=loadSqlProjectConfig(_0x5f1963[_0x3bc200(0x1b7)]),{sqlName:_0x4ad04a,dbId:_0x3b77f9,dbName:_0x179aa1,mode:_0x8734f}=await resolveSqlNewInputs(_0x5f1963),_0x56d375=buildSqlRelativePath(_0x3bc200(0x1bd),_0x4ad04a,_0x179aa1,_0x8734f,_0x3b77f9),_0x5757d8=_0x3e11b6['sqlRootDir']+'/'+_0x56d375;return{'method':'POST','url':_0x3bc200(0x1cc),'body':{'appCode':_0x5f1963['appCode'],'sqlName':_0x4ad04a,'dbId':_0x3b77f9,'mode':_0x8734f,'localPath':_0x5757d8},'description':_0x3bc200(0x1e6)+_0x3e11b6[_0x3bc200(0x1d7)]};},async 'execute'(_0x2c72cc){const _0xdac758=a247_0x498c40,_0x1f0cac=loadSqlProjectConfig(_0x2c72cc['appCode']),{sqlName:_0x10f951,dbId:_0x96bbb,dbName:_0x4eaa36,mode:_0x38f341}=await resolveSqlNewInputs(_0x2c72cc),_0x5421f8=generateSqlTemplate(_0x38f341),_0x4c839a=await createSqlQuery({'appCode':_0x2c72cc[_0xdac758(0x1b7)],'sqlName':_0x10f951,'dbId':_0x96bbb,'sqlContent':_0x5421f8}),_0x33b55e=ensureRemoteSqlContent(_0x4c839a),_0x8a112c=_0x4eaa36||await getDbName(_0x2c72cc[_0xdac758(0x1b7)],_0x96bbb)[_0xdac758(0x1c6)](()=>undefined),_0x575c80=buildSqlRelativePath(_0x4c839a[_0xdac758(0x1d0)],_0x4c839a[_0xdac758(0x1d2)],_0x8a112c,_0x38f341,_0x96bbb),_0x3e31c0=_0x1f0cac[_0xdac758(0x1d7)]+'/'+_0x575c80,_0x22c9aa=buildLocalSqlFileContent({'sqlCode':_0x4c839a[_0xdac758(0x1d0)],'sqlName':_0x4c839a[_0xdac758(0x1d2)],'dbId':_0x4c839a[_0xdac758(0x1c9)]},_0x33b55e,{'dbName':_0x8a112c,'mode':_0x38f341,'syncedAt':new Date()['toISOString'](),'description':_0x4c839a['description']});if(await fileExists(_0x3e31c0))throw CliErrors['validation'](_0xdac758(0x1d5)+_0x3e31c0);await ensureParentDirectory(_0x3e31c0),await writeFile(_0x3e31c0,_0x22c9aa,_0xdac758(0x1bf));const _0x3e1944=await readSqlLockFile(_0x1f0cac[_0xdac758(0x1b4)]),{lockData:_0xf6b17e,appLock:_0x190a7b}=ensureSqlLockScope(_0x3e1944??createEmptySqlLock(),_0x1f0cac[_0xdac758(0x1b7)],_0x1f0cac[_0xdac758(0x1dd)],_0xdac758(0x1d4));return _0x190a7b['sqls'][_0x4c839a[_0xdac758(0x1d0)]]={...buildSqlLockEntry(_0x4c839a,_0x33b55e,computeSqlContentHash(_0x22c9aa),{'dbName':_0x8a112c}),'path':_0x575c80,'mode':_0x38f341},_0x190a7b[_0xdac758(0x1c7)]=new Date()['toISOString'](),await writeSqlLockFile(_0x1f0cac[_0xdac758(0x1b4)],_0xf6b17e),{'ok':!![],'data':{'id':_0x4c839a['id'],'sqlCode':_0x4c839a[_0xdac758(0x1d0)],'sqlName':_0x4c839a[_0xdac758(0x1d2)],'dbId':_0x4c839a[_0xdac758(0x1c9)],'path':_0x3e31c0,'mode':_0x38f341},'message':_0xdac758(0x1e9)+_0x4c839a[_0xdac758(0x1d0)]};}};async function resolveSqlNewInputs(_0x4e0a1e){const _0x2dfad7=await resolveSqlNameInput(_0x4e0a1e),{dbId:_0x2ede41,dbName:_0x4f43a9}=await resolveDbSelection(_0x4e0a1e),_0x2127f9=await resolveSqlModeInput(_0x4e0a1e);return{'sqlName':_0x2dfad7,'dbId':_0x2ede41,'dbName':_0x4f43a9,'mode':_0x2127f9};}async function resolveSqlNameInput(_0x30ab45){const _0x29aafc=a247_0x498c40,_0x4c1732=_0x30ab45['str'](_0x29aafc(0x1c3))[_0x29aafc(0x1b8)]();if(_0x4c1732)return _0x4c1732;if(_0x30ab45[_0x29aafc(0x1f2)])throw CliErrors['flagMissing'](_0x29aafc(0x1c3),_0x29aafc(0x1c1));return(await input({'message':_0x29aafc(0x1e4),'validate':_0x260b2e=>_0x260b2e[_0x29aafc(0x1b8)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))['trim']();}async function resolveDbSelection(_0x5618ff){const _0x3e7747=a247_0x498c40,_0x5cdccc=resolveProvidedDbId(_0x5618ff);if(typeof _0x5cdccc===_0x3e7747(0x1d1)&&Number[_0x3e7747(0x1ec)](_0x5cdccc)&&_0x5cdccc>0x0)return{'dbId':_0x5cdccc,'dbName':await getDbName(_0x5618ff[_0x3e7747(0x1b7)],_0x5cdccc)['catch'](()=>undefined)};if(_0x5618ff['nonInteractive'])throw CliErrors[_0x3e7747(0x1e1)](_0x3e7747(0x1c5),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x33e315=await listDatabases(_0x5618ff[_0x3e7747(0x1b7)])['catch'](()=>[]);if(_0x33e315[_0x3e7747(0x1ea)]===0x1)return{'dbId':_0x33e315[0x0][_0x3e7747(0x1c9)],'dbName':_0x33e315[0x0]['dbName']};if(_0x33e315[_0x3e7747(0x1ea)]>0x1){const _0x8bc652=await select({'message':_0x3e7747(0x1b2),'choices':[..._0x33e315[_0x3e7747(0x1da)](_0x2559c2=>({'name':_0x2559c2[_0x3e7747(0x1c8)]+'\x20('+_0x2559c2['dbId']+')','value':serializeDbSelection(_0x2559c2)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':'__manual__'}]});if(_0x8bc652!==_0x3e7747(0x1bb))return deserializeDbSelection(_0x8bc652);}const _0x387732=await input({'message':_0x3e7747(0x1c0),'validate':_0x4764ba=>{const _0x2a9056=_0x3e7747,_0xf57a05=_0x4764ba['trim']();if(!_0xf57a05)return _0x2a9056(0x1f3);const _0x2bfc14=Number(_0xf57a05);if(!Number[_0x2a9056(0x1c4)](_0x2bfc14)||_0x2bfc14<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x387732[_0x3e7747(0x1b8)]())};}async function resolveSqlModeInput(_0x695f07){const _0x38421e=a247_0x498c40,_0x151737=_0x695f07['str'](_0x38421e(0x1e7))['trim']();if(_0x151737===_0x38421e(0x1ee)||_0x151737===_0x38421e(0x1d3))return _0x151737;if(_0x695f07[_0x38421e(0x1f2)])throw CliErrors['flagMissing']('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x38421e(0x1c2),'choices':[{'name':_0x38421e(0x1b6),'value':_0x38421e(0x1ee),'description':_0x38421e(0x1f0)},{'name':_0x38421e(0x1b9),'value':'mybatisXml','description':_0x38421e(0x1ca)}]});}function serializeDbSelection(_0x45166c){const _0x51c5ea=a247_0x498c40;return JSON[_0x51c5ea(0x1dc)]({'dbId':_0x45166c[_0x51c5ea(0x1c9)],'dbName':_0x45166c[_0x51c5ea(0x1c8)]});}function deserializeDbSelection(_0x3534bc){const _0x277ac0=a247_0x498c40;try{const _0x1dfe75=JSON[_0x277ac0(0x1d8)](_0x3534bc);if(typeof _0x1dfe75['dbId']===_0x277ac0(0x1d1)&&Number[_0x277ac0(0x1ec)](_0x1dfe75[_0x277ac0(0x1c9)]))return{'dbId':_0x1dfe75[_0x277ac0(0x1c9)],'dbName':_0x1dfe75[_0x277ac0(0x1c8)]};}catch{}throw CliErrors[_0x277ac0(0x1cf)]('Invalid\x20database\x20selection\x20payload:\x20'+_0x3534bc);}function resolveProvidedDbId(_0x5b4e9b){const _0x25ee00=a247_0x498c40,_0x20bee2=_0x5b4e9b[_0x25ee00(0x1ba)](_0x25ee00(0x1c5));if(typeof _0x20bee2===_0x25ee00(0x1d1)&&Number['isFinite'](_0x20bee2))return _0x20bee2;return undefined;}
@@ -1 +1 @@
1
- const a248_0xd763a1=a248_0x1f92;function a248_0x1f92(_0x5a6099,_0x3b30c3){_0x5a6099=_0x5a6099-0x197;const _0x4f2faf=a248_0x4f2f();let _0x1f928b=_0x4f2faf[_0x5a6099];return _0x1f928b;}(function(_0x3fa9b6,_0x283bef){const _0x5ed1e5=a248_0x1f92,_0x62f6c5=_0x3fa9b6();while(!![]){try{const _0x525132=parseInt(_0x5ed1e5(0x1b6))/0x1*(parseInt(_0x5ed1e5(0x1ad))/0x2)+-parseInt(_0x5ed1e5(0x19a))/0x3*(parseInt(_0x5ed1e5(0x1a9))/0x4)+parseInt(_0x5ed1e5(0x19c))/0x5*(parseInt(_0x5ed1e5(0x1a5))/0x6)+-parseInt(_0x5ed1e5(0x1a1))/0x7+-parseInt(_0x5ed1e5(0x1a2))/0x8+parseInt(_0x5ed1e5(0x1ab))/0x9*(-parseInt(_0x5ed1e5(0x197))/0xa)+parseInt(_0x5ed1e5(0x1b4))/0xb;if(_0x525132===_0x283bef)break;else _0x62f6c5['push'](_0x62f6c5['shift']());}catch(_0x4c3928){_0x62f6c5['push'](_0x62f6c5['shift']());}}}(a248_0x4f2f,0x2f6c5));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';function a248_0x4f2f(){const _0x1d27fd=['7966057gttntf','str','31DUUfiL','delete','Would\x20delete\x20SQL\x20','replace','1288370kPzjNA','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','213TKkzbx','startsWith','750XEgtfg','trashDir','filter','sql','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','2683975ReRNZe','2140720HsUgvz','remoteId','lockFilePath','10146llXQyC','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','appCode','sqlcode','21020Eqgnqm','SQL\x20lock\x20file\x20not\x20found.','9WHscxC','toISOString','23830tYBxEe','/smartapi/custom/deleteUserCustomSql','validation','sqlRoot','length','fromEntries','sqls'];a248_0x4f2f=function(){return _0x1d27fd;};return a248_0x4f2f();}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':a248_0xd763a1(0x19f),'command':a248_0xd763a1(0x1b7),'description':a248_0xd763a1(0x199),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x38a602){const _0x5b4c56=a248_0xd763a1,_0x2b041d=loadSqlProjectConfig(_0x38a602[_0x5b4c56(0x1a7)]),_0x27da2e=await readSqlLockFile(_0x2b041d[_0x5b4c56(0x1a4)]);if(!_0x27da2e)throw CliErrors[_0x5b4c56(0x1af)](_0x5b4c56(0x1a6));},async 'dryRun'(_0x516bd6){const _0x3151b3=a248_0xd763a1,_0x114958=loadSqlProjectConfig(_0x516bd6[_0x3151b3(0x1a7)]),_0x5b7323=await readSqlLockFile(_0x114958[_0x3151b3(0x1a4)]);if(!_0x5b7323)throw CliErrors[_0x3151b3(0x1af)](_0x3151b3(0x1a6));const {appLock:_0x94c208}=ensureSqlLockScope(_0x5b7323,_0x516bd6[_0x3151b3(0x1a7)],_0x114958[_0x3151b3(0x1b0)],_0x3151b3(0x1b7)),_0x1a30e8=_0x516bd6[_0x3151b3(0x1b5)](_0x3151b3(0x1a8)),_0x3783ac=_0x94c208[_0x3151b3(0x1b3)][_0x1a30e8];if(!_0x3783ac)throw CliErrors[_0x3151b3(0x1af)](_0x3151b3(0x198)+_0x1a30e8+'\x22.');return{'method':'POST','url':_0x3151b3(0x1ae),'body':{'sqlCode':_0x1a30e8,'id':_0x3783ac[_0x3151b3(0x1a3)],'localPath':resolveLocalSqlFilePath(_0x114958,_0x1a30e8,_0x3783ac)},'description':_0x3151b3(0x1b8)+_0x1a30e8+_0x3151b3(0x1a0)+_0x114958['trashDir']};},async 'execute'(_0x3463f9){const _0x4509c3=a248_0xd763a1,_0x51ac53=loadSqlProjectConfig(_0x3463f9['appCode']),_0x393ef2=await readSqlLockFile(_0x51ac53[_0x4509c3(0x1a4)]);if(!_0x393ef2)throw CliErrors['validation'](_0x4509c3(0x1aa));const {lockData:_0x38adf0,appLock:_0x4646e7}=ensureSqlLockScope(_0x393ef2,_0x3463f9['appCode'],_0x51ac53[_0x4509c3(0x1b0)],_0x4509c3(0x1b7)),_0x5d5d4d=_0x3463f9['str'](_0x4509c3(0x1a8)),_0x478263=_0x4646e7[_0x4509c3(0x1b3)][_0x5d5d4d];if(!_0x478263)throw CliErrors[_0x4509c3(0x1af)](_0x4509c3(0x198)+_0x5d5d4d+'\x22.');await deleteSqlQuery({'id':_0x478263[_0x4509c3(0x1a3)],'sqlCode':_0x5d5d4d}),_0x4646e7[_0x4509c3(0x1b3)]=Object[_0x4509c3(0x1b2)](Object['entries'](_0x4646e7[_0x4509c3(0x1b3)])[_0x4509c3(0x19e)](([_0x7d3f93])=>_0x7d3f93!==_0x5d5d4d)),_0x4646e7['lastSync']=new Date()[_0x4509c3(0x1ac)](),await writeSqlLockFile(_0x51ac53[_0x4509c3(0x1a4)],_0x38adf0);const _0x204b46=resolveLocalSqlFilePath(_0x51ac53,_0x5d5d4d,_0x478263);let _0x151801;await fileExists(_0x204b46)&&(_0x151801=await moveToTrash(_0x51ac53['projectRoot'],_0x51ac53[_0x4509c3(0x19d)],_0x204b46),await cleanupEmptyDirectories(dirname(_0x204b46),_0x51ac53['sqlRootDir']));const _0x57fb13={'deleted':_0x5d5d4d,'remoteId':_0x478263['remoteId']};if(_0x151801)_0x57fb13['trashedTo']=_0x151801;return{'ok':!![],'data':_0x57fb13,'message':'Deleted\x20'+_0x5d5d4d+(_0x151801?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x13ecef,_0x3380cb,_0x5df697){const _0x296968=a248_0xd763a1,_0xcd2599=new Date()['toISOString']()[_0x296968(0x1b9)](/[:.]/g,'-'),_0x3e514e=relative(_0x13ecef,_0x5df697),_0xf4822c=join(_0x3380cb,_0xcd2599,_0x3e514e);return await mkdir(dirname(_0xf4822c),{'recursive':!![]}),await rename(_0x5df697,_0xf4822c),_0xf4822c;}async function cleanupEmptyDirectories(_0x38bbf4,_0x2f600a){const _0x3a2e5a=a248_0xd763a1;let _0x49b10f=resolve(_0x38bbf4);const _0x59678a=resolve(_0x2f600a);while(_0x49b10f[_0x3a2e5a(0x19b)](''+_0x59678a+sep)||_0x49b10f===_0x59678a){if(_0x49b10f===_0x59678a)return;try{const _0x4f2c2d=await readdir(_0x49b10f);if(_0x4f2c2d[_0x3a2e5a(0x1b1)]>0x0)return;await rmdir(_0x49b10f);}catch{return;}_0x49b10f=dirname(_0x49b10f);}}
1
+ const a248_0x551ee5=a248_0x1a08;(function(_0x18e9b6,_0x30d6a1){const _0x463e98=a248_0x1a08,_0x1ef392=_0x18e9b6();while(!![]){try{const _0x4d4321=-parseInt(_0x463e98(0x177))/0x1+parseInt(_0x463e98(0x17b))/0x2+-parseInt(_0x463e98(0x186))/0x3*(parseInt(_0x463e98(0x179))/0x4)+-parseInt(_0x463e98(0x18a))/0x5+parseInt(_0x463e98(0x170))/0x6*(parseInt(_0x463e98(0x183))/0x7)+parseInt(_0x463e98(0x172))/0x8+parseInt(_0x463e98(0x16c))/0x9;if(_0x4d4321===_0x30d6a1)break;else _0x1ef392['push'](_0x1ef392['shift']());}catch(_0xa141d5){_0x1ef392['push'](_0x1ef392['shift']());}}}(a248_0x11a4,0x91d2f));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a248_0x11a4(){const _0xa3a681=['POST','validation','lastSync','\x20(local\x20file\x20moved\x20to\x20trash)','sqlRootDir','sqlRoot','appCode','133oyMdng','sql','remoteId','369nxBFPw','trashedTo','filter','fromEntries','694130EFlVUD','/smartapi/custom/deleteUserCustomSql','sqls','high-risk-write','Deleted\x20','11876202abLmcN','str','delete','lockFilePath','99780wgjWHz','SQL\x20lock\x20file\x20not\x20found.','6973656vtxvHZ','startsWith','Would\x20delete\x20SQL\x20','toISOString','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','968200DwuKjO','replace','30476Tilqjr','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','268406ZNjUSA'];a248_0x11a4=function(){return _0xa3a681;};return a248_0x11a4();}import{fileExists}from'../../core/bff/file-system.js';function a248_0x1a08(_0x23e804,_0x3ab45c){_0x23e804=_0x23e804-0x16a;const _0x11a411=a248_0x11a4();let _0x1a08b8=_0x11a411[_0x23e804];return _0x1a08b8;}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':a248_0x551ee5(0x184),'command':a248_0x551ee5(0x16e),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a248_0x551ee5(0x16a),'flags':[SQLCODE_FLAG],async 'validate'(_0x184339){const _0x5ba5a1=a248_0x551ee5,_0x575338=loadSqlProjectConfig(_0x184339[_0x5ba5a1(0x182)]),_0x4f5cd2=await readSqlLockFile(_0x575338['lockFilePath']);if(!_0x4f5cd2)throw CliErrors[_0x5ba5a1(0x17d)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x16b11c){const _0x453bb7=a248_0x551ee5,_0x5297c3=loadSqlProjectConfig(_0x16b11c[_0x453bb7(0x182)]),_0x24ff25=await readSqlLockFile(_0x5297c3[_0x453bb7(0x16f)]);if(!_0x24ff25)throw CliErrors[_0x453bb7(0x17d)](_0x453bb7(0x17a));const {appLock:_0x92a19e}=ensureSqlLockScope(_0x24ff25,_0x16b11c['appCode'],_0x5297c3[_0x453bb7(0x181)],_0x453bb7(0x16e)),_0x5ad32a=_0x16b11c[_0x453bb7(0x16d)]('sqlcode'),_0x58aac9=_0x92a19e[_0x453bb7(0x18c)][_0x5ad32a];if(!_0x58aac9)throw CliErrors[_0x453bb7(0x17d)](_0x453bb7(0x176)+_0x5ad32a+'\x22.');return{'method':_0x453bb7(0x17c),'url':_0x453bb7(0x18b),'body':{'sqlCode':_0x5ad32a,'id':_0x58aac9[_0x453bb7(0x185)],'localPath':resolveLocalSqlFilePath(_0x5297c3,_0x5ad32a,_0x58aac9)},'description':_0x453bb7(0x174)+_0x5ad32a+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x5297c3['trashDir']};},async 'execute'(_0x42da45){const _0x1fac0d=a248_0x551ee5,_0x14f9b7=loadSqlProjectConfig(_0x42da45[_0x1fac0d(0x182)]),_0x2722ed=await readSqlLockFile(_0x14f9b7[_0x1fac0d(0x16f)]);if(!_0x2722ed)throw CliErrors[_0x1fac0d(0x17d)](_0x1fac0d(0x171));const {lockData:_0x1533c3,appLock:_0x1979a4}=ensureSqlLockScope(_0x2722ed,_0x42da45[_0x1fac0d(0x182)],_0x14f9b7[_0x1fac0d(0x181)],_0x1fac0d(0x16e)),_0x56e721=_0x42da45[_0x1fac0d(0x16d)]('sqlcode'),_0x24d210=_0x1979a4[_0x1fac0d(0x18c)][_0x56e721];if(!_0x24d210)throw CliErrors[_0x1fac0d(0x17d)](_0x1fac0d(0x176)+_0x56e721+'\x22.');await deleteSqlQuery({'id':_0x24d210[_0x1fac0d(0x185)],'sqlCode':_0x56e721}),_0x1979a4[_0x1fac0d(0x18c)]=Object[_0x1fac0d(0x189)](Object['entries'](_0x1979a4['sqls'])[_0x1fac0d(0x188)](([_0x38c889])=>_0x38c889!==_0x56e721)),_0x1979a4[_0x1fac0d(0x17e)]=new Date()[_0x1fac0d(0x175)](),await writeSqlLockFile(_0x14f9b7[_0x1fac0d(0x16f)],_0x1533c3);const _0x47b710=resolveLocalSqlFilePath(_0x14f9b7,_0x56e721,_0x24d210);let _0x4f457a;await fileExists(_0x47b710)&&(_0x4f457a=await moveToTrash(_0x14f9b7['projectRoot'],_0x14f9b7['trashDir'],_0x47b710),await cleanupEmptyDirectories(dirname(_0x47b710),_0x14f9b7[_0x1fac0d(0x180)]));const _0x1cad83={'deleted':_0x56e721,'remoteId':_0x24d210[_0x1fac0d(0x185)]};if(_0x4f457a)_0x1cad83[_0x1fac0d(0x187)]=_0x4f457a;return{'ok':!![],'data':_0x1cad83,'message':_0x1fac0d(0x16b)+_0x56e721+(_0x4f457a?_0x1fac0d(0x17f):'')};}};async function moveToTrash(_0x582952,_0x2de0f2,_0x37e691){const _0x11c0e4=a248_0x551ee5,_0xbe038=new Date()['toISOString']()[_0x11c0e4(0x178)](/[:.]/g,'-'),_0x5c2cca=relative(_0x582952,_0x37e691),_0x2e928e=join(_0x2de0f2,_0xbe038,_0x5c2cca);return await mkdir(dirname(_0x2e928e),{'recursive':!![]}),await rename(_0x37e691,_0x2e928e),_0x2e928e;}async function cleanupEmptyDirectories(_0x2c22c9,_0x1f6ebb){const _0x526b0c=a248_0x551ee5;let _0x20d36c=resolve(_0x2c22c9);const _0x3a08ca=resolve(_0x1f6ebb);while(_0x20d36c[_0x526b0c(0x173)](''+_0x3a08ca+sep)||_0x20d36c===_0x3a08ca){if(_0x20d36c===_0x3a08ca)return;try{const _0x4a741d=await readdir(_0x20d36c);if(_0x4a741d['length']>0x0)return;await rmdir(_0x20d36c);}catch{return;}_0x20d36c=dirname(_0x20d36c);}}
@@ -1 +1 @@
1
- const a249_0x211e17=a249_0x4804;(function(_0x19f92a,_0x20627a){const _0x1762ea=a249_0x4804,_0x168247=_0x19f92a();while(!![]){try{const _0x475b8b=parseInt(_0x1762ea(0x1ef))/0x1+parseInt(_0x1762ea(0x1eb))/0x2*(parseInt(_0x1762ea(0x1e2))/0x3)+-parseInt(_0x1762ea(0x1f2))/0x4*(parseInt(_0x1762ea(0x1e1))/0x5)+-parseInt(_0x1762ea(0x1ed))/0x6+parseInt(_0x1762ea(0x1df))/0x7+parseInt(_0x1762ea(0x1e6))/0x8+parseInt(_0x1762ea(0x1e0))/0x9*(-parseInt(_0x1762ea(0x1e5))/0xa);if(_0x475b8b===_0x20627a)break;else _0x168247['push'](_0x168247['shift']());}catch(_0x4c982d){_0x168247['push'](_0x168247['shift']());}}}(a249_0x45ab,0x742e5));import{getSqlQueryInfo}from'../../core/api-client.js';function a249_0x4804(_0x5e6c57,_0x3fae50){_0x5e6c57=_0x5e6c57-0x1df;const _0x45ab84=a249_0x45ab();let _0x480474=_0x45ab84[_0x5e6c57];return _0x480474;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a249_0x45ab(){const _0x5d9cb2=['Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','3322123zLbpjG','1269TDjOdV','1074395MxkdYP','282OzaPbL','str','Return\x20full\x20raw\x20SQL\x20query\x20object','94510ImYqqe','5818400MotBUF','dbId','bool','sql','detail','16144SCTuZk','sqlContent','1728516nHTeTl','boolean','350776VVaIAe','read','verbose','4dUglKm'];a249_0x45ab=function(){return _0x5d9cb2;};return a249_0x45ab();}export const sqlDetail={'service':a249_0x211e17(0x1e9),'command':a249_0x211e17(0x1ea),'description':a249_0x211e17(0x1f3),'risk':a249_0x211e17(0x1f0),'flags':[SQLCODE_FLAG,{'name':a249_0x211e17(0x1f1),'type':a249_0x211e17(0x1ee),'description':a249_0x211e17(0x1e4)}],async 'execute'(_0x210e5b){const _0x196114=a249_0x211e17,_0x2148fa=await getSqlQueryInfo(_0x210e5b['appCode'],_0x210e5b[_0x196114(0x1e3)]('sqlcode')),_0x3aba36=_0x210e5b[_0x196114(0x1e8)]('verbose');if(_0x3aba36)return{'ok':!![],'data':_0x2148fa};const _0x7ce341=_0x2148fa[_0x196114(0x1e7)]?await getDbName(_0x210e5b['appCode'],_0x2148fa[_0x196114(0x1e7)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x2148fa['sqlCode'],'sqlName':_0x2148fa['sqlName'],'db':_0x7ce341?_0x7ce341+'\x20('+_0x2148fa[_0x196114(0x1e7)]+')':_0x2148fa['dbId']??'','description':_0x2148fa['description']??'','sqlContent':_0x2148fa[_0x196114(0x1ec)]??''}};}};
1
+ const a249_0x34eab3=a249_0x4781;(function(_0x3407cb,_0x5f5949){const _0x2136a6=a249_0x4781,_0x6c075=_0x3407cb();while(!![]){try{const _0x35ae63=parseInt(_0x2136a6(0x6d))/0x1*(-parseInt(_0x2136a6(0x7c))/0x2)+-parseInt(_0x2136a6(0x7b))/0x3+-parseInt(_0x2136a6(0x6f))/0x4*(-parseInt(_0x2136a6(0x6b))/0x5)+parseInt(_0x2136a6(0x7f))/0x6*(-parseInt(_0x2136a6(0x78))/0x7)+parseInt(_0x2136a6(0x69))/0x8+-parseInt(_0x2136a6(0x7e))/0x9+parseInt(_0x2136a6(0x7d))/0xa;if(_0x35ae63===_0x5f5949)break;else _0x6c075['push'](_0x6c075['shift']());}catch(_0x1c840f){_0x6c075['push'](_0x6c075['shift']());}}}(a249_0x47ea,0xb1edd));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a249_0x4781(_0x1dffa7,_0x21916c){_0x1dffa7=_0x1dffa7-0x69;const _0x47ea7a=a249_0x47ea();let _0x47818b=_0x47ea7a[_0x1dffa7];return _0x47818b;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a249_0x47ea(){const _0xc89773=['2827176pxCUEi','sqlCode','1670710EAHXWJ','sqlcode','24AbWOEG','sqlName','8RTFlyc','boolean','appCode','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','detail','read','dbId','sqlContent','description','35aDtVqs','Return\x20full\x20raw\x20SQL\x20query\x20object','bool','2575326UbJpsR','81710mZdDWr','34808170dQtnjR','9872766pyuFqO','1005318tFCEZP'];a249_0x47ea=function(){return _0xc89773;};return a249_0x47ea();}export const sqlDetail={'service':'sql','command':a249_0x34eab3(0x73),'description':a249_0x34eab3(0x72),'risk':a249_0x34eab3(0x74),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a249_0x34eab3(0x70),'description':a249_0x34eab3(0x79)}],async 'execute'(_0x2e8491){const _0x18003c=a249_0x34eab3,_0x36fb84=await getSqlQueryInfo(_0x2e8491[_0x18003c(0x71)],_0x2e8491['str'](_0x18003c(0x6c))),_0x13b55c=_0x2e8491[_0x18003c(0x7a)]('verbose');if(_0x13b55c)return{'ok':!![],'data':_0x36fb84};const _0x407f10=_0x36fb84[_0x18003c(0x75)]?await getDbName(_0x2e8491['appCode'],_0x36fb84[_0x18003c(0x75)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x36fb84[_0x18003c(0x6a)],'sqlName':_0x36fb84[_0x18003c(0x6e)],'db':_0x407f10?_0x407f10+'\x20('+_0x36fb84['dbId']+')':_0x36fb84['dbId']??'','description':_0x36fb84[_0x18003c(0x77)]??'','sqlContent':_0x36fb84[_0x18003c(0x76)]??''}};}};
@@ -1 +1 @@
1
- const a250_0x3cd56b=a250_0x3bd5;function a250_0xbd22(){const _0xdec634=['execError','str','sqlcode','exec','11705464UuEJdD','5672420Kwtsvx','sql','string','isArray','5261718OHgeDy','7LLScVB','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','params','1826hyGBYp','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','9FSmCpc','2628220dgWPTb','16LHgiem','now','SQL\x20execution\x20failed','length','181344azVaRn','68323lFKdSu','execResult','4SMLgkh','5126967hmJKQu','execSuccess','appCode','\x20row(s)\x20in\x20','read'];a250_0xbd22=function(){return _0xdec634;};return a250_0xbd22();}(function(_0x2f7f36,_0x273d3b){const _0x987a76=a250_0x3bd5,_0x351488=_0x2f7f36();while(!![]){try{const _0x3b026a=parseInt(_0x987a76(0x142))/0x1*(-parseInt(_0x987a76(0x13d))/0x2)+-parseInt(_0x987a76(0x145))/0x3+-parseInt(_0x987a76(0x144))/0x4*(parseInt(_0x987a76(0x13c))/0x5)+-parseInt(_0x987a76(0x135))/0x6*(parseInt(_0x987a76(0x136))/0x7)+parseInt(_0x987a76(0x130))/0x8*(parseInt(_0x987a76(0x13b))/0x9)+parseInt(_0x987a76(0x131))/0xa+parseInt(_0x987a76(0x139))/0xb*(parseInt(_0x987a76(0x141))/0xc);if(_0x3b026a===_0x273d3b)break;else _0x351488['push'](_0x351488['shift']());}catch(_0x24d5a1){_0x351488['push'](_0x351488['shift']());}}}(a250_0xbd22,0xd70cf));import{executeSql}from'../../core/api-client.js';function a250_0x3bd5(_0x5763a6,_0x2a9321){_0x5763a6=_0x5763a6-0x12c;const _0xbd2221=a250_0xbd22();let _0x3bd50f=_0xbd2221[_0x5763a6];return _0x3bd50f;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a250_0x3cd56b(0x132),'command':a250_0x3cd56b(0x12f),'description':a250_0x3cd56b(0x137),'risk':a250_0x3cd56b(0x149),'flags':[SQLCODE_FLAG,{'name':a250_0x3cd56b(0x138),'type':a250_0x3cd56b(0x133),'description':a250_0x3cd56b(0x13a)}],async 'execute'(_0x562415){const _0x1045de=a250_0x3cd56b,_0x401e36=parseJsonParams(_0x562415[_0x1045de(0x12d)](_0x1045de(0x138))),_0x3442c7=Date[_0x1045de(0x13e)](),_0x220065=await executeSql(_0x562415[_0x1045de(0x147)],_0x562415[_0x1045de(0x12d)](_0x1045de(0x12e)),_0x401e36),_0x55980c=Date[_0x1045de(0x13e)]()-_0x3442c7,_0x313721=_0x220065?.[_0x1045de(0x143)]??_0x220065,_0x2f326a=_0x220065?.[_0x1045de(0x146)]??!![];if(!_0x2f326a)return{'ok':![],'data':{'error':_0x220065?.[_0x1045de(0x12c)]||_0x1045de(0x13f),'elapsed':_0x55980c},'message':_0x1045de(0x13f)};const _0x49e805=Array[_0x1045de(0x134)](_0x313721)?_0x313721:[];return{'ok':!![],'data':{'rows':_0x49e805,'rowCount':_0x49e805[_0x1045de(0x140)],'elapsed':_0x55980c},'message':'Returned\x20'+_0x49e805['length']+_0x1045de(0x148)+_0x55980c+'ms'};}};
1
+ const a250_0x4cfbb1=a250_0x57a9;(function(_0x152d35,_0x455ebd){const _0x15619a=a250_0x57a9,_0x5aaafc=_0x152d35();while(!![]){try{const _0x530cf8=-parseInt(_0x15619a(0x124))/0x1+-parseInt(_0x15619a(0x118))/0x2+parseInt(_0x15619a(0x120))/0x3+-parseInt(_0x15619a(0x117))/0x4+-parseInt(_0x15619a(0x11d))/0x5*(parseInt(_0x15619a(0x121))/0x6)+-parseInt(_0x15619a(0x11c))/0x7*(-parseInt(_0x15619a(0x122))/0x8)+parseInt(_0x15619a(0x110))/0x9;if(_0x530cf8===_0x455ebd)break;else _0x5aaafc['push'](_0x5aaafc['shift']());}catch(_0x31a3db){_0x5aaafc['push'](_0x5aaafc['shift']());}}}(a250_0x5a87,0x6e62a));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a250_0x57a9(_0xbec578,_0x32140c){_0xbec578=_0xbec578-0x10c;const _0x5a8777=a250_0x5a87();let _0x57a9cd=_0x5a8777[_0xbec578];return _0x57a9cd;}function a250_0x5a87(){const _0xdf8f5b=['4688046HBoozS','params','appCode','\x20row(s)\x20in\x20','now','execError','read','1251340SvFufF','231352waqpuY','execResult','str','Returned\x20','394807dvqvDj','10485FhgpsR','SQL\x20execution\x20failed','length','908007FJQSaF','1158LsAAAs','112DybBAG','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','327807gQtdXC','execSuccess','exec','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','sqlcode','string','isArray'];a250_0x5a87=function(){return _0xdf8f5b;};return a250_0x5a87();}export const sqlExec={'service':'sql','command':a250_0x4cfbb1(0x126),'description':a250_0x4cfbb1(0x10c),'risk':a250_0x4cfbb1(0x116),'flags':[SQLCODE_FLAG,{'name':a250_0x4cfbb1(0x111),'type':a250_0x4cfbb1(0x10e),'description':a250_0x4cfbb1(0x123)}],async 'execute'(_0x1f224c){const _0x157a45=a250_0x4cfbb1,_0x16063f=parseJsonParams(_0x1f224c['str'](_0x157a45(0x111))),_0x2691e9=Date[_0x157a45(0x114)](),_0xf79d=await executeSql(_0x1f224c[_0x157a45(0x112)],_0x1f224c[_0x157a45(0x11a)](_0x157a45(0x10d)),_0x16063f),_0x32bd9e=Date[_0x157a45(0x114)]()-_0x2691e9,_0x305a60=_0xf79d?.[_0x157a45(0x119)]??_0xf79d,_0xf1d914=_0xf79d?.[_0x157a45(0x125)]??!![];if(!_0xf1d914)return{'ok':![],'data':{'error':_0xf79d?.[_0x157a45(0x115)]||_0x157a45(0x11e),'elapsed':_0x32bd9e},'message':_0x157a45(0x11e)};const _0x20d36f=Array[_0x157a45(0x10f)](_0x305a60)?_0x305a60:[];return{'ok':!![],'data':{'rows':_0x20d36f,'rowCount':_0x20d36f[_0x157a45(0x11f)],'elapsed':_0x32bd9e},'message':_0x157a45(0x11b)+_0x20d36f['length']+_0x157a45(0x113)+_0x32bd9e+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x30b4ca,_0x12e6d4){const _0x214147=a251_0x4fc4,_0x17045a=_0x30b4ca();while(!![]){try{const _0xf9cb60=-parseInt(_0x214147(0x1be))/0x1*(-parseInt(_0x214147(0x1bd))/0x2)+parseInt(_0x214147(0x1c5))/0x3+parseInt(_0x214147(0x1c1))/0x4*(-parseInt(_0x214147(0x1c7))/0x5)+-parseInt(_0x214147(0x1c2))/0x6+parseInt(_0x214147(0x1bf))/0x7*(-parseInt(_0x214147(0x1c3))/0x8)+-parseInt(_0x214147(0x1c6))/0x9+-parseInt(_0x214147(0x1c0))/0xa*(-parseInt(_0x214147(0x1c4))/0xb);if(_0xf9cb60===_0x12e6d4)break;else _0x17045a['push'](_0x17045a['shift']());}catch(_0x28ce1b){_0x17045a['push'](_0x17045a['shift']());}}}(a251_0x3442,0x3ae42));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';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';function a251_0x4fc4(_0x2b5a47,_0x2fcda9){_0x2b5a47=_0x2b5a47-0x1bd;const _0x344229=a251_0x3442();let _0x4fc492=_0x344229[_0x2b5a47];return _0x4fc492;}function a251_0x3442(){const _0x42ac31=['1052pwgKrQ','278892SAcbHv','16LnjtrF','77EvLmHQ','207135rwadxL','3925125rLUapG','5255wXOVzV','102048LmrWAr','2DiwvSS','1618659YJSrMX','1845170MiXRHy'];a251_0x3442=function(){return _0x42ac31;};return a251_0x3442();}export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x167845,_0xda54ba){const _0x4766a8=a251_0x3158,_0x1e4085=_0x167845();while(!![]){try{const _0x5cfbf9=parseInt(_0x4766a8(0x1bc))/0x1+parseInt(_0x4766a8(0x1be))/0x2*(parseInt(_0x4766a8(0x1c5))/0x3)+parseInt(_0x4766a8(0x1bd))/0x4*(-parseInt(_0x4766a8(0x1c1))/0x5)+parseInt(_0x4766a8(0x1c2))/0x6*(-parseInt(_0x4766a8(0x1c3))/0x7)+parseInt(_0x4766a8(0x1bb))/0x8*(-parseInt(_0x4766a8(0x1c0))/0x9)+parseInt(_0x4766a8(0x1c4))/0xa+parseInt(_0x4766a8(0x1bf))/0xb*(parseInt(_0x4766a8(0x1c6))/0xc);if(_0x5cfbf9===_0xda54ba)break;else _0x1e4085['push'](_0x1e4085['shift']());}catch(_0x1283ce){_0x1e4085['push'](_0x1e4085['shift']());}}}(a251_0x3e43,0x6b093));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';function a251_0x3158(_0x444270,_0x13cf0f){_0x444270=_0x444270-0x1bb;const _0x3e43f4=a251_0x3e43();let _0x31582b=_0x3e43f4[_0x444270];return _0x31582b;}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';function a251_0x3e43(){const _0x2653b5=['161484FgXfIJ','2PLqRPj','2484119Eiknqe','9FnleZu','70MFDdxf','518214atbfAH','21HqGNeK','4431850nmYqQY','202497bekhSf','24iopXVD','2058504RjWckg','557691WlqqKf'];a251_0x3e43=function(){return _0x2653b5;};return a251_0x3e43();}export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a252_0x51c1f3=a252_0xea94;(function(_0x20ad51,_0x37f806){const _0x1e312f=a252_0xea94,_0x59e87f=_0x20ad51();while(!![]){try{const _0x306b0c=parseInt(_0x1e312f(0x20b))/0x1*(parseInt(_0x1e312f(0x1f3))/0x2)+-parseInt(_0x1e312f(0x20e))/0x3+parseInt(_0x1e312f(0x1fb))/0x4*(-parseInt(_0x1e312f(0x1f1))/0x5)+parseInt(_0x1e312f(0x204))/0x6*(parseInt(_0x1e312f(0x1ef))/0x7)+-parseInt(_0x1e312f(0x206))/0x8*(-parseInt(_0x1e312f(0x1f2))/0x9)+-parseInt(_0x1e312f(0x1ed))/0xa*(parseInt(_0x1e312f(0x1f5))/0xb)+-parseInt(_0x1e312f(0x1eb))/0xc*(parseInt(_0x1e312f(0x1f7))/0xd);if(_0x306b0c===_0x37f806)break;else _0x59e87f['push'](_0x59e87f['shift']());}catch(_0x3658a8){_0x59e87f['push'](_0x59e87f['shift']());}}}(a252_0xd408,0x9da7b));function a252_0xea94(_0x9b5f6e,_0x1bc1c5){_0x9b5f6e=_0x9b5f6e-0x1e9;const _0xd408f4=a252_0xd408();let _0xea9433=_0xd408f4[_0x9b5f6e];return _0xea9433;}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a252_0xd408(){const _0x15fa74=['List\x20custom\x20SQL\x20queries','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','Filter\x20by\x20SQL\x20name','12jhIVtl','verbose','188530jpgkcw','page','13090rEGvAO','bool','15SwnxJr','313101lkLdih','2WHqQay','length','11mgrNzj','all','9720529SLEYFt','Page\x20size','str','dbId','469324FUJMSO','sql','name','num','Found\x20','list','No\x20custom\x20SQL\x20queries\x20found.','totalCount','paging','3180KitwxX','description','256EuXdmd','appCode','sqlCode','map','\x20SQL\x20queries\x20(total:\x20','539837rrcqbF','sqlName','pagesize','2639553lhkrFr','number'];a252_0xd408=function(){return _0x15fa74;};return a252_0xd408();}export const sqlList={'service':a252_0x51c1f3(0x1fc),'command':a252_0x51c1f3(0x200),'description':a252_0x51c1f3(0x210),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0x51c1f3(0x1fd),'type':'string','description':a252_0x51c1f3(0x1ea)},{'name':a252_0x51c1f3(0x1ee),'type':a252_0x51c1f3(0x20f),'description':'Page\x20number','default':0x1},{'name':a252_0x51c1f3(0x20d),'type':a252_0x51c1f3(0x20f),'description':a252_0x51c1f3(0x1f8)},{'name':'verbose','type':'boolean','description':a252_0x51c1f3(0x1e9)}],async 'execute'(_0x5b6eed){const _0x2268fe=a252_0x51c1f3,_0xf10183=await listSqlQueries(_0x5b6eed[_0x2268fe(0x207)],{'sqlCode':_0x5b6eed[_0x2268fe(0x1f9)]('sqlcode')||undefined,'sqlName':_0x5b6eed[_0x2268fe(0x1f9)]('name')||undefined,'currentPage':_0x5b6eed[_0x2268fe(0x1fe)](_0x2268fe(0x1ee)),'pageSize':_0x5b6eed['num'](_0x2268fe(0x20d),0x32)}),_0x21265d=_0x5b6eed[_0x2268fe(0x1f0)](_0x2268fe(0x1ec)),_0x1aea09=_0xf10183['tableData']??[],_0x120d43=_0xf10183[_0x2268fe(0x203)]?.[_0x2268fe(0x202)]??_0x1aea09[_0x2268fe(0x1f4)];let _0x4dfba4;return _0x21265d?_0x4dfba4=_0x1aea09:_0x4dfba4=await Promise[_0x2268fe(0x1f6)](_0x1aea09[_0x2268fe(0x209)](async _0x3b9f63=>{const _0x110cc1=_0x2268fe;let _0x110308;try{_0x110308=_0x3b9f63[_0x110cc1(0x1fa)]?await getDbName(_0x5b6eed[_0x110cc1(0x207)],_0x3b9f63[_0x110cc1(0x1fa)]):undefined;}catch{}return{'sqlCode':_0x3b9f63[_0x110cc1(0x208)],'sqlName':_0x3b9f63[_0x110cc1(0x20c)],'description':_0x3b9f63[_0x110cc1(0x205)]??'','db':_0x110308?_0x110308+'\x20('+_0x3b9f63[_0x110cc1(0x1fa)]+')':_0x3b9f63[_0x110cc1(0x1fa)]??''};})),{'ok':!![],'data':_0x4dfba4,'message':_0x1aea09[_0x2268fe(0x1f4)]===0x0?_0x2268fe(0x201):_0x2268fe(0x1ff)+_0x1aea09[_0x2268fe(0x1f4)]+_0x2268fe(0x20a)+_0x120d43+').'};}};
1
+ const a252_0xbc5cd3=a252_0x1c58;(function(_0x4fdabd,_0xd7fabf){const _0x5a026c=a252_0x1c58,_0x4b0ce0=_0x4fdabd();while(!![]){try{const _0x3e02d3=parseInt(_0x5a026c(0x198))/0x1*(-parseInt(_0x5a026c(0x17b))/0x2)+parseInt(_0x5a026c(0x190))/0x3*(parseInt(_0x5a026c(0x18e))/0x4)+parseInt(_0x5a026c(0x182))/0x5*(parseInt(_0x5a026c(0x17e))/0x6)+-parseInt(_0x5a026c(0x183))/0x7*(-parseInt(_0x5a026c(0x19c))/0x8)+parseInt(_0x5a026c(0x18a))/0x9+parseInt(_0x5a026c(0x181))/0xa*(-parseInt(_0x5a026c(0x189))/0xb)+-parseInt(_0x5a026c(0x17f))/0xc*(parseInt(_0x5a026c(0x195))/0xd);if(_0x3e02d3===_0xd7fabf)break;else _0x4b0ce0['push'](_0x4b0ce0['shift']());}catch(_0x51b985){_0x4b0ce0['push'](_0x4b0ce0['shift']());}}}(a252_0x596a,0x2510b));import{listSqlQueries}from'../../core/api-client.js';function a252_0x596a(){const _0x2d8620=['boolean','tableData','44uxoiKg','No\x20custom\x20SQL\x20queries\x20found.','verbose','3624rwDABw','7843296lAGurk','sqlName','1047930QIuIPk','2485wOeqmA','407743iJKRKU','sql','pagesize','\x20SQL\x20queries\x20(total:\x20','dbId','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','11prSemr','2486880jqwcAS','Page\x20size','all','list','275684pUYSiB','page','9toHQdL','bool','Found\x20','number','description','13gQIZxn','read','name','7468XZddWl','num','length','string','40lSlIFd','List\x20custom\x20SQL\x20queries','map','str','paging'];a252_0x596a=function(){return _0x2d8620;};return a252_0x596a();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a252_0x1c58(_0x116e6f,_0x4dec5c){_0x116e6f=_0x116e6f-0x178;const _0x596aff=a252_0x596a();let _0x1c582b=_0x596aff[_0x116e6f];return _0x1c582b;}export const sqlList={'service':a252_0xbc5cd3(0x184),'command':a252_0xbc5cd3(0x18d),'description':a252_0xbc5cd3(0x19d),'risk':a252_0xbc5cd3(0x196),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0xbc5cd3(0x197),'type':a252_0xbc5cd3(0x19b),'description':'Filter\x20by\x20SQL\x20name'},{'name':a252_0xbc5cd3(0x18f),'type':a252_0xbc5cd3(0x193),'description':'Page\x20number','default':0x1},{'name':a252_0xbc5cd3(0x185),'type':a252_0xbc5cd3(0x193),'description':a252_0xbc5cd3(0x18b)},{'name':a252_0xbc5cd3(0x17d),'type':a252_0xbc5cd3(0x179),'description':a252_0xbc5cd3(0x188)}],async 'execute'(_0x541a9f){const _0x2d40d2=a252_0xbc5cd3,_0x3f0154=await listSqlQueries(_0x541a9f['appCode'],{'sqlCode':_0x541a9f[_0x2d40d2(0x19f)]('sqlcode')||undefined,'sqlName':_0x541a9f['str'](_0x2d40d2(0x197))||undefined,'currentPage':_0x541a9f[_0x2d40d2(0x199)](_0x2d40d2(0x18f)),'pageSize':_0x541a9f[_0x2d40d2(0x199)](_0x2d40d2(0x185),0x32)}),_0x23d53b=_0x541a9f[_0x2d40d2(0x191)]('verbose'),_0x1e610b=_0x3f0154[_0x2d40d2(0x17a)]??[],_0x24611c=_0x3f0154[_0x2d40d2(0x178)]?.['totalCount']??_0x1e610b[_0x2d40d2(0x19a)];let _0x3e2021;return _0x23d53b?_0x3e2021=_0x1e610b:_0x3e2021=await Promise[_0x2d40d2(0x18c)](_0x1e610b[_0x2d40d2(0x19e)](async _0x4db8ca=>{const _0xc2eb88=_0x2d40d2;let _0x57d026;try{_0x57d026=_0x4db8ca[_0xc2eb88(0x187)]?await getDbName(_0x541a9f['appCode'],_0x4db8ca[_0xc2eb88(0x187)]):undefined;}catch{}return{'sqlCode':_0x4db8ca['sqlCode'],'sqlName':_0x4db8ca[_0xc2eb88(0x180)],'description':_0x4db8ca[_0xc2eb88(0x194)]??'','db':_0x57d026?_0x57d026+'\x20('+_0x4db8ca['dbId']+')':_0x4db8ca[_0xc2eb88(0x187)]??''};})),{'ok':!![],'data':_0x3e2021,'message':_0x1e610b[_0x2d40d2(0x19a)]===0x0?_0x2d40d2(0x17c):_0x2d40d2(0x192)+_0x1e610b[_0x2d40d2(0x19a)]+_0x2d40d2(0x186)+_0x24611c+').'};}};
@@ -1 +1 @@
1
- const a253_0x2d48fa=a253_0x5a8d;(function(_0x344d5a,_0x541348){const _0x293840=a253_0x5a8d,_0xf2f294=_0x344d5a();while(!![]){try{const _0x431bb7=parseInt(_0x293840(0xf0))/0x1*(parseInt(_0x293840(0x113))/0x2)+-parseInt(_0x293840(0x11c))/0x3+-parseInt(_0x293840(0x101))/0x4+parseInt(_0x293840(0x125))/0x5+parseInt(_0x293840(0x104))/0x6*(parseInt(_0x293840(0xf4))/0x7)+parseInt(_0x293840(0xd8))/0x8*(parseInt(_0x293840(0xd7))/0x9)+-parseInt(_0x293840(0x112))/0xa;if(_0x431bb7===_0x541348)break;else _0xf2f294['push'](_0xf2f294['shift']());}catch(_0x3d7024){_0xf2f294['push'](_0xf2f294['shift']());}}}(a253_0x4c77,0xc9231));function a253_0x4c77(){const _0x323e3b=['path','217sURoum','all','toISOString','pull','str','join','bool','force','skipped','sqlContent','Would\x20pull\x20','lockFilePath','would_pull','1227240MfHiWn','sqlCode','description','102942tqnVbC','\x20failed','boolean','Force\x20overwrite\x20local\x20unsynced\x20changes','POST','Pull\x20complete:\x20','\x20written,\x20','hash','conflict','unchanged','utf8','file','read','find','22714250MXvwgT','5578OQEAbL','name','No\x20remote\x20SQL\x20queries\x20matched.','\x20skipped,\x20','sql','toLowerCase','push','cancelled','sqlName','752265gplvid','sqlRootDir','test','filePath','sqls','endsWith','some','local\x20differs\x20from\x20remote','sqlRoot','4538865zHfcxY','5837202xoFshO','8obaNjS','trim','sqlcode','length','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','replace','string','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','split','equivalent','filter','catch','Force\x20pull\x20cancelled.','appCode','Filter\x20by\x20SQL\x20display\x20name','tableData','message','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','mybatisXml','isCanonical','map','dbId','totalCount','mode','561voOYVS','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','apps'];a253_0x4c77=function(){return _0x323e3b;};return a253_0x4c77();}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{detectSqlMode}from'../../core/sql-sync/utils.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(_0x8f025d,_0x27d162){const _0x3bc423=a253_0x5a8d,_0x413360=[];let _0x36c6f9=0x1;while(!![]){const _0x459c9b=await listSqlQueries(_0x8f025d,{'currentPage':_0x36c6f9,'pageSize':PAGE_SIZE,'sqlCode':_0x27d162[_0x3bc423(0x102)],'sqlName':_0x27d162[_0x3bc423(0x11b)]}),_0x2b71a0=_0x459c9b[_0x3bc423(0xe7)]??[];_0x413360[_0x3bc423(0x119)](..._0x2b71a0);if(_0x2b71a0[_0x3bc423(0xdb)]===0x0)break;const _0x4cc57f=_0x459c9b['paging']?.[_0x3bc423(0xee)];if(_0x4cc57f!=null?_0x413360['length']>=_0x4cc57f:_0x2b71a0['length']<PAGE_SIZE)break;_0x36c6f9++;}return _0x413360;}function a253_0x5a8d(_0x372605,_0x37f8ec){_0x372605=_0x372605-0xd7;const _0x4c77e2=a253_0x4c77();let _0x5a8d27=_0x4c77e2[_0x372605];return _0x5a8d27;}async function ensureSqlContent(_0x41ed39){const _0x494463=a253_0x5a8d;if(_0x41ed39[_0x494463(0xfd)]!=null&&String(_0x41ed39[_0x494463(0xfd)])[_0x494463(0xdb)]>0x0)return _0x41ed39;return getSqlQueryDetail(_0x41ed39[_0x494463(0x102)]);}export const sqlPull={'service':a253_0x2d48fa(0x117),'command':a253_0x2d48fa(0xf7),'description':a253_0x2d48fa(0xf1),'risk':a253_0x2d48fa(0x110),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x2d48fa(0x114),'type':a253_0x2d48fa(0xde),'description':a253_0x2d48fa(0xe6)},{'name':a253_0x2d48fa(0xfb),'type':a253_0x2d48fa(0x106),'description':a253_0x2d48fa(0x107)}],async 'dryRun'(_0x25adb1){const _0x4d9cde=a253_0x2d48fa,_0x2fbbe4=loadSqlProjectConfig(_0x25adb1['appCode']),_0x4196ea=await readSqlLockFile(_0x2fbbe4[_0x4d9cde(0xff)]),{appLock:_0x2b46ce}=ensureSqlLockScope(_0x4196ea??createEmptySqlLock(),_0x2fbbe4[_0x4d9cde(0xe5)],_0x2fbbe4[_0x4d9cde(0x124)],'pull'),_0x4e7cfd=await fetchAllSqlQueries(_0x25adb1[_0x4d9cde(0xe5)],{'sqlCode':_0x25adb1[_0x4d9cde(0xf8)](_0x4d9cde(0xda))||undefined,'sqlName':_0x25adb1[_0x4d9cde(0xf8)](_0x4d9cde(0x114))||undefined}),_0x47ece7=[];for(const _0x2e6308 of _0x4e7cfd){const _0x59e4bd=await ensureSqlContent(_0x2e6308),_0x598486=ensureRemoteSqlContent(_0x59e4bd),_0x2eefd5=detectSqlMode(_0x598486),_0x155452=_0x59e4bd[_0x4d9cde(0xed)]?await getDbName(_0x25adb1[_0x4d9cde(0xe5)],Number(_0x59e4bd[_0x4d9cde(0xed)]))[_0x4d9cde(0xe3)](()=>undefined):undefined,_0x45a5e1=buildLocalSqlFileContent({'sqlCode':_0x59e4bd[_0x4d9cde(0x102)],'sqlName':_0x59e4bd[_0x4d9cde(0x11b)],'dbId':_0x59e4bd[_0x4d9cde(0xed)]},_0x598486,{'dbName':_0x155452,'mode':_0x2eefd5,'syncedAt':new Date()[_0x4d9cde(0xf6)](),'description':_0x59e4bd[_0x4d9cde(0x103)]}),_0x166875=buildSqlLockEntry(_0x59e4bd,_0x598486,'',{'dbName':_0x155452}),_0x38e8cd=resolveLocalSqlFilePath(_0x2fbbe4,_0x59e4bd['sqlCode'],_0x166875);let _0x2eb752=_0x4d9cde(0x100),_0x1864af;const _0x1d6f27=await findExistingSqlFiles(_0x2fbbe4,_0x38e8cd,_0x2eefd5,_0x2b46ce[_0x4d9cde(0x120)][_0x59e4bd[_0x4d9cde(0x102)]]);if(_0x1d6f27[_0x4d9cde(0xdb)]>0x0){const _0x598ece=await compareExistingSqlFiles(_0x1d6f27,_0x45a5e1,_0x2eefd5);if(_0x598ece[_0x4d9cde(0x122)](({equivalent:_0x31390d})=>!_0x31390d))_0x2eb752=_0x4d9cde(0x10c),_0x1864af=_0x4d9cde(0xdf);else _0x598ece[_0x4d9cde(0xdb)]===0x1&&_0x598ece[0x0]?.[_0x4d9cde(0x10f)][_0x4d9cde(0xeb)]&&(_0x2eb752=_0x4d9cde(0xfc),_0x1864af='unchanged');}_0x47ece7[_0x4d9cde(0x119)]({'sqlCode':_0x59e4bd['sqlCode'],'sqlName':_0x59e4bd['sqlName'],'filePath':_0x38e8cd,'status':_0x2eb752,'reason':_0x1864af});}return{'method':_0x4d9cde(0x108),'url':_0x4d9cde(0xe9),'body':{'appCode':_0x25adb1[_0x4d9cde(0xe5)],'sqlCode':_0x25adb1[_0x4d9cde(0xf8)](_0x4d9cde(0xda))||null,'sqlName':_0x25adb1[_0x4d9cde(0xf8)](_0x4d9cde(0x114))||null,'files':_0x47ece7},'description':_0x4d9cde(0xfe)+_0x47ece7[_0x4d9cde(0xdb)]+'\x20SQL\x20file(s)\x20into\x20'+_0x2fbbe4[_0x4d9cde(0x11d)]};},async 'execute'(_0x21c30f){const _0x5c3c94=a253_0x2d48fa,_0xf1a3f9=loadSqlProjectConfig(_0x21c30f[_0x5c3c94(0xe5)]),_0x4be849=await readSqlLockFile(_0xf1a3f9[_0x5c3c94(0xff)]),{lockData:_0x33483c,appLock:_0x2d21a3}=ensureSqlLockScope(_0x4be849??createEmptySqlLock(),_0xf1a3f9[_0x5c3c94(0xe5)],_0xf1a3f9[_0x5c3c94(0x124)],_0x5c3c94(0xf7)),_0x263262=_0x21c30f[_0x5c3c94(0xfa)](_0x5c3c94(0xfb)),_0x3fb579=await fetchAllSqlQueries(_0x21c30f[_0x5c3c94(0xe5)],{'sqlCode':_0x21c30f[_0x5c3c94(0xf8)](_0x5c3c94(0xda))||undefined,'sqlName':_0x21c30f[_0x5c3c94(0xf8)](_0x5c3c94(0x114))||undefined});if(_0x3fb579['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x5c3c94(0x115)};const _0x391c87=[],_0x4d4ed3=[];for(const _0x42c2c9 of _0x3fb579){try{_0x391c87['push'](await ensureSqlContent(_0x42c2c9));}catch(_0x5546f6){_0x4d4ed3[_0x5c3c94(0x119)]({'sqlCode':_0x42c2c9[_0x5c3c94(0x102)],'error':_0x5546f6 instanceof Error?_0x5546f6[_0x5c3c94(0xe8)]:String(_0x5546f6)});}}if(_0x263262&&!_0x21c30f['nonInteractive']){let _0x37818d=![];for(const _0x10e8ac of _0x391c87){const _0x403c42=detectSqlMode(ensureRemoteSqlContent(_0x10e8ac)),_0x129df7=_0x10e8ac[_0x5c3c94(0xed)]?await getDbName(_0x21c30f[_0x5c3c94(0xe5)],Number(_0x10e8ac['dbId']))[_0x5c3c94(0xe3)](()=>undefined):undefined,_0x2912f2=buildLocalSqlFileContent({'sqlCode':_0x10e8ac[_0x5c3c94(0x102)],'sqlName':_0x10e8ac[_0x5c3c94(0x11b)],'dbId':_0x10e8ac['dbId']},ensureRemoteSqlContent(_0x10e8ac),{'dbName':_0x129df7,'mode':_0x403c42,'syncedAt':new Date()['toISOString'](),'description':_0x10e8ac[_0x5c3c94(0x103)]}),_0x1cccca=resolveLocalSqlFilePath(_0xf1a3f9,_0x10e8ac['sqlCode'],buildSqlLockEntry(_0x10e8ac,ensureRemoteSqlContent(_0x10e8ac),'',{'dbName':_0x129df7})),_0x54e678=await findExistingSqlFiles(_0xf1a3f9,_0x1cccca,_0x403c42,_0x2d21a3[_0x5c3c94(0x120)][_0x10e8ac[_0x5c3c94(0x102)]]),_0xd05d9c=await compareExistingSqlFiles(_0x54e678,_0x2912f2,_0x403c42);if(_0xd05d9c[_0x5c3c94(0x122)](({equivalent:_0x4f14f3})=>!_0x4f14f3)){_0x37818d=!![];break;}}if(_0x37818d){const _0x147fa9=await confirmForceOverwrite(_0x5c3c94(0xdc));if(!_0x147fa9)throw CliErrors[_0x5c3c94(0x11a)](_0x5c3c94(0xe4));}}const _0x4cb0bf=cloneSqlLockData(_0x33483c),_0x88ef93=_0x4cb0bf[_0x5c3c94(0xf2)][_0xf1a3f9['appCode']],_0x2bcd40=[],_0x91d8a8=[];for(const _0x503c02 of _0x391c87){const _0x3de8d1=_0x88ef93[_0x5c3c94(0x120)][_0x503c02['sqlCode']],_0x22ad53=ensureRemoteSqlContent(_0x503c02),_0x5746fd=detectSqlMode(_0x22ad53),_0x332784=_0x503c02[_0x5c3c94(0xed)]?await getDbName(_0x21c30f[_0x5c3c94(0xe5)],Number(_0x503c02['dbId']))[_0x5c3c94(0xe3)](()=>undefined):undefined,_0x3ea262=buildLocalSqlFileContent({'sqlCode':_0x503c02['sqlCode'],'sqlName':_0x503c02[_0x5c3c94(0x11b)],'dbId':_0x503c02[_0x5c3c94(0xed)]},_0x22ad53,{'dbName':_0x332784,'mode':_0x5746fd,'syncedAt':new Date()[_0x5c3c94(0xf6)](),'description':_0x503c02['description']}),_0x5bd619=buildSqlLockEntry(_0x503c02,_0x22ad53,computeSqlContentHash(_0x3ea262),{'dbName':_0x332784}),_0x37bd4b=_0x5bd619[_0x5c3c94(0xf3)],_0x16818e=join(_0xf1a3f9['sqlRootDir'],_0x37bd4b);try{const _0x51d801=await findExistingSqlFiles(_0xf1a3f9,_0x16818e,_0x5746fd,_0x3de8d1),_0x11ceef=await compareExistingSqlFiles(_0x51d801,_0x3ea262,_0x5746fd);if(!_0x263262&&_0x11ceef[_0x5c3c94(0x122)](({equivalent:_0x307299})=>!_0x307299)){_0x91d8a8[_0x5c3c94(0x119)]({'sqlCode':_0x503c02[_0x5c3c94(0x102)],'reason':_0x5c3c94(0x123)});continue;}const _0x22c122=_0x11ceef[_0x5c3c94(0x111)](({file:_0x311fae})=>_0x311fae[_0x5c3c94(0xeb)]),_0xe3dd04=_0x11ceef[_0x5c3c94(0x111)](({file:_0x47b952})=>!_0x47b952[_0x5c3c94(0xeb)]);if(_0x22c122?.[_0x5c3c94(0xe1)]&&!_0xe3dd04){_0x91d8a8[_0x5c3c94(0x119)]({'sqlCode':_0x503c02[_0x5c3c94(0x102)],'reason':_0x5c3c94(0x10d)}),_0x88ef93[_0x5c3c94(0x120)][_0x503c02['sqlCode']]={..._0x5bd619,'hash':computeSqlContentHash(_0x22c122['content']),'path':_0x37bd4b};continue;}!_0x22c122?.['equivalent']&&(await ensureParentDirectory(_0x16818e),await writeFile(_0x16818e,_0x3ea262,'utf8')),_0xe3dd04&&await rm(_0xe3dd04[_0x5c3c94(0x10f)][_0x5c3c94(0x11f)],{'force':!![]}),_0x88ef93['sqls'][_0x503c02[_0x5c3c94(0x102)]]={..._0x5bd619,'hash':_0x22c122?.[_0x5c3c94(0xe1)]?computeSqlContentHash(_0x22c122['content']):_0x5bd619[_0x5c3c94(0x10b)],'path':_0x37bd4b},_0x2bcd40[_0x5c3c94(0x119)]({'sqlCode':_0x503c02[_0x5c3c94(0x102)],'filePath':_0x16818e});}catch(_0x18fd7a){_0x4d4ed3[_0x5c3c94(0x119)]({'sqlCode':_0x503c02[_0x5c3c94(0x102)],'error':_0x18fd7a instanceof Error?_0x18fd7a[_0x5c3c94(0xe8)]:String(_0x18fd7a)});}}return _0x88ef93['lastSync']=new Date()[_0x5c3c94(0xf6)](),await writeSqlLockFile(_0xf1a3f9[_0x5c3c94(0xff)],_0x4cb0bf),{'ok':_0x4d4ed3['length']===0x0,'data':{'pulled':_0x2bcd40,'skipped':_0x91d8a8,'failed':_0x4d4ed3},'message':_0x5c3c94(0x109)+_0x2bcd40['length']+_0x5c3c94(0x10a)+_0x91d8a8[_0x5c3c94(0xdb)]+_0x5c3c94(0x116)+_0x4d4ed3[_0x5c3c94(0xdb)]+_0x5c3c94(0x105)};}};function isEquivalentPulledSqlFile(_0x5cf53a,_0x517541,_0x2d4620,_0x395474){if(_0x2d4620!==_0x395474)return normalizePulledSqlBody(_0x5cf53a,_0x2d4620)===normalizePulledSqlBody(_0x517541,_0x395474);return normalizePullComparableContent(_0x5cf53a,_0x2d4620)===normalizePullComparableContent(_0x517541,_0x395474);}async function findExistingSqlFiles(_0x4b546f,_0x3bb64b,_0xf6aa29,_0xc4e467){const _0x5ddd01=a253_0x2d48fa,_0x2d821d=[];await fileExists(_0x3bb64b)&&_0x2d821d[_0x5ddd01(0x119)]({'filePath':_0x3bb64b,'mode':_0xf6aa29,'isCanonical':!![]});if(!_0xc4e467?.[_0x5ddd01(0xf3)])return _0x2d821d;const _0x22e20d=join(_0x4b546f[_0x5ddd01(0x11d)],_0xc4e467[_0x5ddd01(0xf3)]);if(_0x22e20d===_0x3bb64b)return _0x2d821d;return await fileExists(_0x22e20d)&&_0x2d821d['push']({'filePath':_0x22e20d,'mode':_0xc4e467[_0x5ddd01(0xef)]??modeFromFilePath(_0x22e20d),'isCanonical':![]}),_0x2d821d;}async function compareExistingSqlFiles(_0x23ce1d,_0x1f83f4,_0x27fa07){const _0x32560d=a253_0x2d48fa;return Promise[_0x32560d(0xf5)](_0x23ce1d[_0x32560d(0xec)](async _0x2736b6=>{const _0x5eeb51=_0x32560d,_0x1f8f55=await readFile(_0x2736b6['filePath'],_0x5eeb51(0x10e));return{'file':_0x2736b6,'content':_0x1f8f55,'equivalent':isEquivalentPulledSqlFile(_0x1f8f55,_0x1f83f4,_0x2736b6[_0x5eeb51(0xef)],_0x27fa07)};}));}function modeFromFilePath(_0x50565b){const _0x281439=a253_0x2d48fa;return _0x50565b[_0x281439(0x118)]()[_0x281439(0x121)]('.xml')?_0x281439(0xea):_0x281439(0x117);}function normalizePulledSqlBody(_0x5108ee,_0x7d628d){const _0x2f7db1=a253_0x2d48fa;return stripLocalSqlMetadata(_0x5108ee,_0x7d628d)[_0x2f7db1(0xdd)](/\r\n/g,'\x0a')[_0x2f7db1(0xd9)]();}function normalizePullComparableContent(_0x2ba3a1,_0x36ce3d){const _0x202c40=a253_0x2d48fa,_0x52df18=_0x2ba3a1['replace'](/\r\n/g,'\x0a')[_0x202c40(0xe0)]('\x0a'),_0x1eccfe=_0x52df18[_0x202c40(0xe2)](_0xe44f06=>!isSyncedAtMetadataLine(_0xe44f06,_0x36ce3d));return _0x1eccfe[_0x202c40(0xf9)]('\x0a');}function isSyncedAtMetadataLine(_0x251aed,_0x3c4243){const _0xb37b96=a253_0x2d48fa;if(_0x3c4243===_0xb37b96(0xea))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0xb37b96(0x11e)](_0x251aed);return/^\s*--\s*@lovrabet\.syncedAt:/[_0xb37b96(0x11e)](_0x251aed);}
1
+ const a253_0x4dea89=a253_0x1789;(function(_0x1d5a27,_0x4900f0){const _0xf9fa73=a253_0x1789,_0x469dbb=_0x1d5a27();while(!![]){try{const _0x458011=parseInt(_0xf9fa73(0x1ae))/0x1*(parseInt(_0xf9fa73(0x1b7))/0x2)+parseInt(_0xf9fa73(0x1a8))/0x3*(parseInt(_0xf9fa73(0x192))/0x4)+-parseInt(_0xf9fa73(0x1a2))/0x5+parseInt(_0xf9fa73(0x187))/0x6+parseInt(_0xf9fa73(0x1bd))/0x7+parseInt(_0xf9fa73(0x1b9))/0x8+parseInt(_0xf9fa73(0x18e))/0x9*(-parseInt(_0xf9fa73(0x1cb))/0xa);if(_0x458011===_0x4900f0)break;else _0x469dbb['push'](_0x469dbb['shift']());}catch(_0x504042){_0x469dbb['push'](_0x469dbb['shift']());}}}(a253_0x281e,0x3d861));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{detectSqlMode}from'../../core/sql-sync/utils.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;function a253_0x281e(){const _0x2a3f6a=['some','boolean','string','filter','message','pull','str','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','114RdlvBh','sqlRoot','803000SUFNKa','Force\x20overwrite\x20local\x20unsynced\x20changes','sql','totalCount','1475971oKfHfD','force','read','sqlContent','dbId','hash','appCode','skipped','join','utf8','replace','find','\x20skipped,\x20','apps','30DLmugF','sqls','local\x20differs\x20from\x20remote','isCanonical','.xml','nonInteractive','equivalent','toISOString','paging','sqlRootDir','filePath','344022kGFKZD','description','unchanged','would_pull','Would\x20pull\x20','bool','split','922203KouCIO','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','map','all','8tguqtB','conflict','tableData','lastSync','name','POST','file','sqlCode','catch','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','toLowerCase','test','Pull\x20complete:\x20','endsWith','mybatisXml','mode','1019310LnIBjA','trim','sqlcode','sqlName','push','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','276468mfVWOg','\x20written,\x20','path','Force\x20pull\x20cancelled.','lockFilePath','length','3691YqBgmh'];a253_0x281e=function(){return _0x2a3f6a;};return a253_0x281e();}async function fetchAllSqlQueries(_0x24884d,_0x395e1d){const _0x5026bb=a253_0x1789,_0x41bc7f=[];let _0x6ca3b=0x1;while(!![]){const _0xa78ac9=await listSqlQueries(_0x24884d,{'currentPage':_0x6ca3b,'pageSize':PAGE_SIZE,'sqlCode':_0x395e1d[_0x5026bb(0x199)],'sqlName':_0x395e1d[_0x5026bb(0x1a5)]}),_0x4d525c=_0xa78ac9[_0x5026bb(0x194)]??[];_0x41bc7f['push'](..._0x4d525c);if(_0x4d525c[_0x5026bb(0x1ad)]===0x0)break;const _0x2802bc=_0xa78ac9[_0x5026bb(0x184)]?.[_0x5026bb(0x1bc)];if(_0x2802bc!=null?_0x41bc7f[_0x5026bb(0x1ad)]>=_0x2802bc:_0x4d525c[_0x5026bb(0x1ad)]<PAGE_SIZE)break;_0x6ca3b++;}return _0x41bc7f;}async function ensureSqlContent(_0x493784){const _0xc38abd=a253_0x1789;if(_0x493784['sqlContent']!=null&&String(_0x493784[_0xc38abd(0x1c0)])[_0xc38abd(0x1ad)]>0x0)return _0x493784;return getSqlQueryDetail(_0x493784[_0xc38abd(0x199)]);}export const sqlPull={'service':'sql','command':a253_0x4dea89(0x1b4),'description':a253_0x4dea89(0x19b),'risk':a253_0x4dea89(0x1bf),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x4dea89(0x196),'type':a253_0x4dea89(0x1b1),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a253_0x4dea89(0x1be),'type':a253_0x4dea89(0x1b0),'description':a253_0x4dea89(0x1ba)}],async 'dryRun'(_0x18348a){const _0x562036=a253_0x4dea89,_0x8e4a3d=loadSqlProjectConfig(_0x18348a[_0x562036(0x1c3)]),_0xe73c13=await readSqlLockFile(_0x8e4a3d[_0x562036(0x1ac)]),{appLock:_0x5cec64}=ensureSqlLockScope(_0xe73c13??createEmptySqlLock(),_0x8e4a3d[_0x562036(0x1c3)],_0x8e4a3d['sqlRoot'],_0x562036(0x1b4)),_0x3e37bc=await fetchAllSqlQueries(_0x18348a[_0x562036(0x1c3)],{'sqlCode':_0x18348a[_0x562036(0x1b5)](_0x562036(0x1a4))||undefined,'sqlName':_0x18348a[_0x562036(0x1b5)](_0x562036(0x196))||undefined}),_0x1ec708=[];for(const _0x40c3a2 of _0x3e37bc){const _0x54f4a7=await ensureSqlContent(_0x40c3a2),_0x4a9810=ensureRemoteSqlContent(_0x54f4a7),_0x3b59a1=detectSqlMode(_0x4a9810),_0x2d7b57=_0x54f4a7[_0x562036(0x1c1)]?await getDbName(_0x18348a[_0x562036(0x1c3)],Number(_0x54f4a7[_0x562036(0x1c1)]))[_0x562036(0x19a)](()=>undefined):undefined,_0x55f1d4=buildLocalSqlFileContent({'sqlCode':_0x54f4a7[_0x562036(0x199)],'sqlName':_0x54f4a7[_0x562036(0x1a5)],'dbId':_0x54f4a7[_0x562036(0x1c1)]},_0x4a9810,{'dbName':_0x2d7b57,'mode':_0x3b59a1,'syncedAt':new Date()['toISOString'](),'description':_0x54f4a7[_0x562036(0x188)]}),_0x1e1e45=buildSqlLockEntry(_0x54f4a7,_0x4a9810,'',{'dbName':_0x2d7b57}),_0x31fbd9=resolveLocalSqlFilePath(_0x8e4a3d,_0x54f4a7[_0x562036(0x199)],_0x1e1e45);let _0xf78700=_0x562036(0x18a),_0x4df20d;const _0x23ee5c=await findExistingSqlFiles(_0x8e4a3d,_0x31fbd9,_0x3b59a1,_0x5cec64[_0x562036(0x1cc)][_0x54f4a7[_0x562036(0x199)]]);if(_0x23ee5c[_0x562036(0x1ad)]>0x0){const _0x385cc0=await compareExistingSqlFiles(_0x23ee5c,_0x55f1d4,_0x3b59a1);if(_0x385cc0[_0x562036(0x1af)](({equivalent:_0x5f20d8})=>!_0x5f20d8))_0xf78700=_0x562036(0x193),_0x4df20d=_0x562036(0x1b6);else _0x385cc0[_0x562036(0x1ad)]===0x1&&_0x385cc0[0x0]?.[_0x562036(0x198)][_0x562036(0x1ce)]&&(_0xf78700=_0x562036(0x1c4),_0x4df20d=_0x562036(0x189));}_0x1ec708[_0x562036(0x1a6)]({'sqlCode':_0x54f4a7['sqlCode'],'sqlName':_0x54f4a7['sqlName'],'filePath':_0x31fbd9,'status':_0xf78700,'reason':_0x4df20d});}return{'method':_0x562036(0x197),'url':_0x562036(0x1a7),'body':{'appCode':_0x18348a[_0x562036(0x1c3)],'sqlCode':_0x18348a[_0x562036(0x1b5)](_0x562036(0x1a4))||null,'sqlName':_0x18348a[_0x562036(0x1b5)]('name')||null,'files':_0x1ec708},'description':_0x562036(0x18b)+_0x1ec708[_0x562036(0x1ad)]+'\x20SQL\x20file(s)\x20into\x20'+_0x8e4a3d[_0x562036(0x185)]};},async 'execute'(_0x2e3108){const _0x3b282b=a253_0x4dea89,_0x3f9118=loadSqlProjectConfig(_0x2e3108[_0x3b282b(0x1c3)]),_0x55a043=await readSqlLockFile(_0x3f9118[_0x3b282b(0x1ac)]),{lockData:_0x5b87a7,appLock:_0xf9403d}=ensureSqlLockScope(_0x55a043??createEmptySqlLock(),_0x3f9118[_0x3b282b(0x1c3)],_0x3f9118[_0x3b282b(0x1b8)],'pull'),_0x52f50b=_0x2e3108[_0x3b282b(0x18c)](_0x3b282b(0x1be)),_0x4f336e=await fetchAllSqlQueries(_0x2e3108[_0x3b282b(0x1c3)],{'sqlCode':_0x2e3108[_0x3b282b(0x1b5)]('sqlcode')||undefined,'sqlName':_0x2e3108[_0x3b282b(0x1b5)](_0x3b282b(0x196))||undefined});if(_0x4f336e['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x5dbbda=[],_0x40c637=[];for(const _0x391768 of _0x4f336e){try{_0x5dbbda[_0x3b282b(0x1a6)](await ensureSqlContent(_0x391768));}catch(_0x1da90a){_0x40c637[_0x3b282b(0x1a6)]({'sqlCode':_0x391768[_0x3b282b(0x199)],'error':_0x1da90a instanceof Error?_0x1da90a[_0x3b282b(0x1b3)]:String(_0x1da90a)});}}if(_0x52f50b&&!_0x2e3108[_0x3b282b(0x181)]){let _0x2de042=![];for(const _0x39af53 of _0x5dbbda){const _0x32ee50=detectSqlMode(ensureRemoteSqlContent(_0x39af53)),_0x2808f8=_0x39af53[_0x3b282b(0x1c1)]?await getDbName(_0x2e3108[_0x3b282b(0x1c3)],Number(_0x39af53['dbId']))['catch'](()=>undefined):undefined,_0x402641=buildLocalSqlFileContent({'sqlCode':_0x39af53[_0x3b282b(0x199)],'sqlName':_0x39af53[_0x3b282b(0x1a5)],'dbId':_0x39af53[_0x3b282b(0x1c1)]},ensureRemoteSqlContent(_0x39af53),{'dbName':_0x2808f8,'mode':_0x32ee50,'syncedAt':new Date()[_0x3b282b(0x183)](),'description':_0x39af53[_0x3b282b(0x188)]}),_0x590b26=resolveLocalSqlFilePath(_0x3f9118,_0x39af53[_0x3b282b(0x199)],buildSqlLockEntry(_0x39af53,ensureRemoteSqlContent(_0x39af53),'',{'dbName':_0x2808f8})),_0x1231d1=await findExistingSqlFiles(_0x3f9118,_0x590b26,_0x32ee50,_0xf9403d[_0x3b282b(0x1cc)][_0x39af53[_0x3b282b(0x199)]]),_0x553430=await compareExistingSqlFiles(_0x1231d1,_0x402641,_0x32ee50);if(_0x553430[_0x3b282b(0x1af)](({equivalent:_0xd5ea58})=>!_0xd5ea58)){_0x2de042=!![];break;}}if(_0x2de042){const _0x52d534=await confirmForceOverwrite(_0x3b282b(0x18f));if(!_0x52d534)throw CliErrors['cancelled'](_0x3b282b(0x1ab));}}const _0x6f202f=cloneSqlLockData(_0x5b87a7),_0x2f0ab8=_0x6f202f[_0x3b282b(0x1ca)][_0x3f9118['appCode']],_0xbc2e07=[],_0x19f4e4=[];for(const _0x448b4b of _0x5dbbda){const _0x5837fe=_0x2f0ab8[_0x3b282b(0x1cc)][_0x448b4b['sqlCode']],_0x4877e9=ensureRemoteSqlContent(_0x448b4b),_0x46bfcf=detectSqlMode(_0x4877e9),_0x4439ba=_0x448b4b[_0x3b282b(0x1c1)]?await getDbName(_0x2e3108[_0x3b282b(0x1c3)],Number(_0x448b4b[_0x3b282b(0x1c1)]))['catch'](()=>undefined):undefined,_0x4ace3c=buildLocalSqlFileContent({'sqlCode':_0x448b4b['sqlCode'],'sqlName':_0x448b4b['sqlName'],'dbId':_0x448b4b[_0x3b282b(0x1c1)]},_0x4877e9,{'dbName':_0x4439ba,'mode':_0x46bfcf,'syncedAt':new Date()['toISOString'](),'description':_0x448b4b[_0x3b282b(0x188)]}),_0x209f5a=buildSqlLockEntry(_0x448b4b,_0x4877e9,computeSqlContentHash(_0x4ace3c),{'dbName':_0x4439ba}),_0x1d8f20=_0x209f5a[_0x3b282b(0x1aa)],_0x2d82e9=join(_0x3f9118[_0x3b282b(0x185)],_0x1d8f20);try{const _0xf88e93=await findExistingSqlFiles(_0x3f9118,_0x2d82e9,_0x46bfcf,_0x5837fe),_0x38a956=await compareExistingSqlFiles(_0xf88e93,_0x4ace3c,_0x46bfcf);if(!_0x52f50b&&_0x38a956[_0x3b282b(0x1af)](({equivalent:_0x1838dc})=>!_0x1838dc)){_0x19f4e4[_0x3b282b(0x1a6)]({'sqlCode':_0x448b4b['sqlCode'],'reason':_0x3b282b(0x1cd)});continue;}const _0x113df3=_0x38a956[_0x3b282b(0x1c8)](({file:_0x321e91})=>_0x321e91['isCanonical']),_0x3612f0=_0x38a956[_0x3b282b(0x1c8)](({file:_0x3e25f6})=>!_0x3e25f6[_0x3b282b(0x1ce)]);if(_0x113df3?.[_0x3b282b(0x182)]&&!_0x3612f0){_0x19f4e4['push']({'sqlCode':_0x448b4b[_0x3b282b(0x199)],'reason':_0x3b282b(0x189)}),_0x2f0ab8[_0x3b282b(0x1cc)][_0x448b4b[_0x3b282b(0x199)]]={..._0x209f5a,'hash':computeSqlContentHash(_0x113df3['content']),'path':_0x1d8f20};continue;}!_0x113df3?.['equivalent']&&(await ensureParentDirectory(_0x2d82e9),await writeFile(_0x2d82e9,_0x4ace3c,_0x3b282b(0x1c6))),_0x3612f0&&await rm(_0x3612f0['file'][_0x3b282b(0x186)],{'force':!![]}),_0x2f0ab8[_0x3b282b(0x1cc)][_0x448b4b[_0x3b282b(0x199)]]={..._0x209f5a,'hash':_0x113df3?.[_0x3b282b(0x182)]?computeSqlContentHash(_0x113df3['content']):_0x209f5a[_0x3b282b(0x1c2)],'path':_0x1d8f20},_0xbc2e07[_0x3b282b(0x1a6)]({'sqlCode':_0x448b4b[_0x3b282b(0x199)],'filePath':_0x2d82e9});}catch(_0x739f17){_0x40c637[_0x3b282b(0x1a6)]({'sqlCode':_0x448b4b[_0x3b282b(0x199)],'error':_0x739f17 instanceof Error?_0x739f17[_0x3b282b(0x1b3)]:String(_0x739f17)});}}return _0x2f0ab8[_0x3b282b(0x195)]=new Date()[_0x3b282b(0x183)](),await writeSqlLockFile(_0x3f9118['lockFilePath'],_0x6f202f),{'ok':_0x40c637[_0x3b282b(0x1ad)]===0x0,'data':{'pulled':_0xbc2e07,'skipped':_0x19f4e4,'failed':_0x40c637},'message':_0x3b282b(0x19e)+_0xbc2e07['length']+_0x3b282b(0x1a9)+_0x19f4e4['length']+_0x3b282b(0x1c9)+_0x40c637['length']+'\x20failed'};}};function a253_0x1789(_0x5934b1,_0x1ab0ac){_0x5934b1=_0x5934b1-0x181;const _0x281ebc=a253_0x281e();let _0x17896b=_0x281ebc[_0x5934b1];return _0x17896b;}function isEquivalentPulledSqlFile(_0x3d75a5,_0x3e356e,_0x4e1dbf,_0x2c11bc){if(_0x4e1dbf!==_0x2c11bc)return normalizePulledSqlBody(_0x3d75a5,_0x4e1dbf)===normalizePulledSqlBody(_0x3e356e,_0x2c11bc);return normalizePullComparableContent(_0x3d75a5,_0x4e1dbf)===normalizePullComparableContent(_0x3e356e,_0x2c11bc);}async function findExistingSqlFiles(_0x594699,_0x1efa70,_0x1e0f4d,_0x31432d){const _0x33d807=a253_0x4dea89,_0x45acd9=[];await fileExists(_0x1efa70)&&_0x45acd9[_0x33d807(0x1a6)]({'filePath':_0x1efa70,'mode':_0x1e0f4d,'isCanonical':!![]});if(!_0x31432d?.[_0x33d807(0x1aa)])return _0x45acd9;const _0x13070a=join(_0x594699[_0x33d807(0x185)],_0x31432d[_0x33d807(0x1aa)]);if(_0x13070a===_0x1efa70)return _0x45acd9;return await fileExists(_0x13070a)&&_0x45acd9['push']({'filePath':_0x13070a,'mode':_0x31432d[_0x33d807(0x1a1)]??modeFromFilePath(_0x13070a),'isCanonical':![]}),_0x45acd9;}async function compareExistingSqlFiles(_0x4e9522,_0x276e6e,_0x4dd06f){const _0x3b5a85=a253_0x4dea89;return Promise[_0x3b5a85(0x191)](_0x4e9522[_0x3b5a85(0x190)](async _0x12c88c=>{const _0xe84ad8=_0x3b5a85,_0x4320bb=await readFile(_0x12c88c['filePath'],_0xe84ad8(0x1c6));return{'file':_0x12c88c,'content':_0x4320bb,'equivalent':isEquivalentPulledSqlFile(_0x4320bb,_0x276e6e,_0x12c88c[_0xe84ad8(0x1a1)],_0x4dd06f)};}));}function modeFromFilePath(_0x852495){const _0x265cad=a253_0x4dea89;return _0x852495[_0x265cad(0x19c)]()[_0x265cad(0x19f)](_0x265cad(0x1cf))?_0x265cad(0x1a0):_0x265cad(0x1bb);}function normalizePulledSqlBody(_0x14f7b2,_0x5921d9){const _0x1ab6ef=a253_0x4dea89;return stripLocalSqlMetadata(_0x14f7b2,_0x5921d9)[_0x1ab6ef(0x1c7)](/\r\n/g,'\x0a')[_0x1ab6ef(0x1a3)]();}function normalizePullComparableContent(_0x30739a,_0x4918ab){const _0x3eac18=a253_0x4dea89,_0x22a08f=_0x30739a[_0x3eac18(0x1c7)](/\r\n/g,'\x0a')[_0x3eac18(0x18d)]('\x0a'),_0x5bf637=_0x22a08f[_0x3eac18(0x1b2)](_0x47d11e=>!isSyncedAtMetadataLine(_0x47d11e,_0x4918ab));return _0x5bf637[_0x3eac18(0x1c5)]('\x0a');}function isSyncedAtMetadataLine(_0x5aa04c,_0x1043b1){const _0x64aaa7=a253_0x4dea89;if(_0x1043b1==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x64aaa7(0x19d)](_0x5aa04c);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x5aa04c);}
@@ -1 +1 @@
1
- const a254_0x11d5d5=a254_0x2cd4;(function(_0x218ebf,_0x341f9f){const _0x3b61ca=a254_0x2cd4,_0x77cd07=_0x218ebf();while(!![]){try{const _0x3c1dec=-parseInt(_0x3b61ca(0x192))/0x1*(-parseInt(_0x3b61ca(0x178))/0x2)+-parseInt(_0x3b61ca(0x1a0))/0x3*(-parseInt(_0x3b61ca(0x160))/0x4)+parseInt(_0x3b61ca(0x189))/0x5+parseInt(_0x3b61ca(0x19f))/0x6*(-parseInt(_0x3b61ca(0x188))/0x7)+parseInt(_0x3b61ca(0x16c))/0x8*(parseInt(_0x3b61ca(0x1aa))/0x9)+parseInt(_0x3b61ca(0x186))/0xa+-parseInt(_0x3b61ca(0x163))/0xb*(parseInt(_0x3b61ca(0x199))/0xc);if(_0x3c1dec===_0x341f9f)break;else _0x77cd07['push'](_0x77cd07['shift']());}catch(_0x5a0711){_0x77cd07['push'](_0x77cd07['shift']());}}}(a254_0x3f1e,0x7de0c));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';function a254_0x3f1e(){const _0x421c26=['No\x20database\x20matches\x20local\x20directory\x20\x22','appCode','path','hash','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','3778644OpiqdS','Would\x20push\x20','toISOString','version','dbName','filePath','2676846sUkWpm','18npccdU',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','sqlcode','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','remoteId','replace','Local\x20directory\x20\x22','POST','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','dbId','72rWnyDM','startsWith','115516VCfluR','sqls','\x20SQL\x20file(s)','44xZyAtd','bool','unchanged','join','projectRoot','length','dbDirectory','exec','lockFilePath','1013768GGtyRD','/smartapi/custom/updateUserCustomSql','sql',':\x20SQL\x20content\x20is\x20empty.','\x20pushed,\x20','utf8','\x20failed','filter','set','catch','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','\x20skipped,\x20','2KVlYBP','Local\x20SQL\x20not\x20found:\x20','sqlConfig','force','Push\x20local\x20SQL\x20files\x20to\x20remote','map',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','write','relativePath','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','isFinite','push','validation','sqlName','1581670WspzhV','str','7krZnUJ','1079795nAHAef','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqlCode','boolean','sqlRoot','Push\x20complete:\x20','has','mode','trashDir','660117CzhkXk','sqlRootDir'];a254_0x3f1e=function(){return _0x421c26;};return a254_0x3f1e();}import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function readSqlUploadContent(_0xc92804){const _0x3ae132=a254_0x2cd4,_0x2578f8=stripLocalSqlMetadata(await readFile(_0xc92804[_0x3ae132(0x19e)],_0x3ae132(0x171)),_0xc92804['mode']);if(!_0x2578f8['trim']())throw CliErrors[_0x3ae132(0x184)](_0xc92804[_0x3ae132(0x18b)]+_0x3ae132(0x16f));return _0x2578f8;}async function getTargetSqlQueries(_0x57fd09,_0x88aa74,_0x194f93){const _0x4a5659=a254_0x2cd4,_0x2a1835=await scanLocalSqlQueries(_0x57fd09),_0xe9f35e=new Map();for(const _0x46c963 of _0x2a1835){if(_0x194f93&&_0x46c963[_0x4a5659(0x18b)]!==_0x194f93)continue;const _0x3ce757=_0xe9f35e['get'](_0x46c963[_0x4a5659(0x18b)])??[];_0x3ce757[_0x4a5659(0x183)](_0x46c963),_0xe9f35e[_0x4a5659(0x174)](_0x46c963['sqlCode'],_0x3ce757);}if(_0x194f93&&!_0xe9f35e[_0x4a5659(0x18f)](_0x194f93))throw CliErrors[_0x4a5659(0x184)](_0x4a5659(0x179)+_0x194f93);const _0x3f8ac1=[];for(const [_0x14f865,_0x257ffc]of _0xe9f35e['entries']()){if(_0x257ffc[_0x4a5659(0x168)]===0x1){_0x3f8ac1[_0x4a5659(0x183)](_0x257ffc[0x0]);continue;}const _0x25b5b8=_0x88aa74[_0x4a5659(0x161)][_0x14f865],_0x43e003=_0x25b5b8?.[_0x4a5659(0x196)],_0x26198b=_0x43e003?_0x257ffc[_0x4a5659(0x173)](_0x106220=>_0x106220[_0x4a5659(0x180)]!==_0x43e003):_0x257ffc;if(_0x25b5b8&&_0x26198b[_0x4a5659(0x168)]===0x1){_0x3f8ac1[_0x4a5659(0x183)](_0x26198b[0x0]);continue;}throw CliErrors[_0x4a5659(0x184)](_0x4a5659(0x1a3)+_0x14f865+_0x4a5659(0x176));}return _0x3f8ac1;}function a254_0x2cd4(_0x3d092c,_0x3fef53){_0x3d092c=_0x3d092c-0x160;const _0x3f1e41=a254_0x3f1e();let _0x2cd402=_0x3f1e41[_0x3d092c];return _0x2cd402;}export const sqlPush={'service':a254_0x11d5d5(0x16e),'command':a254_0x11d5d5(0x183),'description':a254_0x11d5d5(0x17c),'risk':a254_0x11d5d5(0x17f),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a254_0x11d5d5(0x17b),'type':a254_0x11d5d5(0x18c),'description':a254_0x11d5d5(0x18a)}],async 'dryRun'(_0x4d1180){const _0xa12430=a254_0x11d5d5,_0x45e692=loadSqlProjectConfig(_0x4d1180[_0xa12430(0x195)]),_0x29802c=await readSqlLockFile(_0x45e692[_0xa12430(0x16b)]),{appLock:_0x2aa239}=ensureSqlLockScope(_0x29802c??createEmptySqlLock(),_0x4d1180['appCode'],_0x45e692['sqlRoot'],_0xa12430(0x183)),_0x5154f8=await getTargetSqlQueries(_0x45e692,_0x2aa239,_0x4d1180[_0xa12430(0x187)](_0xa12430(0x1a2))||undefined),_0xc48430=[];for(const _0x3f17ad of _0x5154f8){const _0x175e0c=await computeSqlFileHash(_0x3f17ad['filePath']),_0x15becd=_0x2aa239[_0xa12430(0x161)][_0x3f17ad[_0xa12430(0x18b)]],_0x25e031=!!_0x15becd&&(_0x15becd[_0xa12430(0x196)]!==_0x3f17ad[_0xa12430(0x180)]||!!_0x3f17ad['sqlName']&&_0x15becd['sqlName']!==_0x3f17ad[_0xa12430(0x185)]||_0x15becd[_0xa12430(0x190)]!==_0x3f17ad[_0xa12430(0x190)]);if(!_0x4d1180[_0xa12430(0x164)](_0xa12430(0x17b))&&_0x15becd&&_0x15becd['hash']===_0x175e0c&&!_0x25e031)continue;if(!_0x15becd)throw CliErrors[_0xa12430(0x184)](_0x3f17ad[_0xa12430(0x18b)]+_0xa12430(0x1a1));if(_0x15becd[_0xa12430(0x19c)]==null)throw CliErrors[_0xa12430(0x184)](_0x3f17ad[_0xa12430(0x18b)]+_0xa12430(0x17e));await resolveTargetDbBinding(_0x4d1180[_0xa12430(0x195)],_0x3f17ad,_0x15becd),await readSqlUploadContent(_0x3f17ad),_0xc48430[_0xa12430(0x183)](_0x3f17ad[_0xa12430(0x18b)]);}return{'method':_0xa12430(0x1a7),'url':_0xa12430(0x16d),'body':{'sqlCodes':_0xc48430,'appCode':_0x4d1180[_0xa12430(0x195)]},'description':_0xa12430(0x19a)+_0xc48430[_0xa12430(0x168)]+_0xa12430(0x162)};},async 'execute'(_0x18c61e){const _0x276003=a254_0x11d5d5,_0x369c46=loadSqlProjectConfig(_0x18c61e['appCode']),_0x5bdcb7=await readSqlLockFile(_0x369c46['lockFilePath']),{lockData:_0x2be724,appLock:_0x50075d}=ensureSqlLockScope(_0x5bdcb7??createEmptySqlLock(),_0x18c61e['appCode'],_0x369c46[_0x276003(0x18d)],_0x276003(0x183)),_0xaf62fc=await getTargetSqlQueries(_0x369c46,_0x50075d,_0x18c61e[_0x276003(0x187)](_0x276003(0x1a2))||undefined);if(_0xaf62fc['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x1e8c1c=[],_0x4eee12=[],_0x583f0d=[];let _0x247c7f=![];for(const _0x10da79 of _0xaf62fc){const _0xa95907=_0x50075d[_0x276003(0x161)][_0x10da79[_0x276003(0x18b)]];if(!_0xa95907){_0x583f0d['push']({'sqlCode':_0x10da79['sqlCode'],'error':_0x276003(0x1a8)});continue;}try{const _0x3b9cbe=await computeSqlFileHash(_0x10da79[_0x276003(0x19e)]),_0x992681=_0xa95907['path']!==_0x10da79[_0x276003(0x180)]||!!_0x10da79['sqlName']&&_0xa95907[_0x276003(0x185)]!==_0x10da79[_0x276003(0x185)]||_0xa95907[_0x276003(0x190)]!==_0x10da79[_0x276003(0x190)];if(!_0x18c61e[_0x276003(0x164)]('force')&&_0xa95907[_0x276003(0x197)]===_0x3b9cbe&&!_0x992681){_0x4eee12[_0x276003(0x183)]({'sqlCode':_0x10da79[_0x276003(0x18b)],'reason':_0x276003(0x165)});continue;}if(_0xa95907['version']==null){_0x583f0d[_0x276003(0x183)]({'sqlCode':_0x10da79[_0x276003(0x18b)],'error':_0x276003(0x181)});continue;}const _0x2f338b=_0x10da79[_0x276003(0x185)]||_0xa95907[_0x276003(0x185)],_0x3ab178=await resolveTargetDbBinding(_0x18c61e[_0x276003(0x195)],_0x10da79,_0xa95907),_0x45d995=await readSqlUploadContent(_0x10da79),_0x35557f=await updateSqlQuery({'id':_0xa95907['remoteId'],'appCode':_0x18c61e[_0x276003(0x195)],'sqlCode':_0x10da79[_0x276003(0x18b)],'sqlName':_0x2f338b,'dbId':_0x3ab178[_0x276003(0x1a9)],'version':_0xa95907[_0x276003(0x19c)],'sqlContent':_0x45d995,'sqlConfig':_0xa95907[_0x276003(0x17a)]??undefined}),_0x13c10f=_0x35557f['dbId']?await getDbName(_0x18c61e[_0x276003(0x195)],Number(_0x35557f[_0x276003(0x1a9)]))['catch'](()=>_0x3ab178[_0x276003(0x19d)]):_0x3ab178[_0x276003(0x19d)];_0x50075d[_0x276003(0x161)][_0x10da79[_0x276003(0x18b)]]={...buildSqlLockEntry(_0x35557f,_0x45d995,_0x3b9cbe,{'dbName':_0x13c10f}),'path':_0x10da79['relativePath'],'mode':_0x10da79['mode']},_0x247c7f=!![],await archivePreviousSqlFileIfNeeded(_0x369c46,_0xa95907['path'],_0x10da79[_0x276003(0x180)]),_0x1e8c1c['push']({'sqlCode':_0x10da79[_0x276003(0x18b)],'remoteId':_0xa95907[_0x276003(0x1a4)]});}catch(_0x4b4948){_0x583f0d[_0x276003(0x183)]({'sqlCode':_0x10da79[_0x276003(0x18b)],'error':_0x4b4948 instanceof Error?_0x4b4948['message']:String(_0x4b4948)});}}(_0x247c7f||_0x583f0d[_0x276003(0x168)]===0x0)&&(_0x50075d['lastSync']=new Date()[_0x276003(0x19b)](),await writeSqlLockFile(_0x369c46[_0x276003(0x16b)],_0x2be724));const _0x268548=_0x583f0d[_0x276003(0x168)]===0x0;return{'ok':_0x268548,'data':{'pushed':_0x1e8c1c,'skipped':_0x4eee12,'failed':_0x583f0d},'message':_0x276003(0x18e)+_0x1e8c1c['length']+_0x276003(0x170)+_0x4eee12[_0x276003(0x168)]+_0x276003(0x177)+_0x583f0d[_0x276003(0x168)]+_0x276003(0x172)};}};async function archivePreviousSqlFileIfNeeded(_0x4d9279,_0x5d7a3f,_0x1d2601){const _0x32b108=a254_0x11d5d5;if(!_0x5d7a3f||_0x5d7a3f===_0x1d2601)return;const _0xfef873=join(_0x4d9279[_0x32b108(0x193)],_0x5d7a3f);if(!await fileExists(_0xfef873))return;const _0x188281=await moveToTrash(_0x4d9279[_0x32b108(0x167)],_0x4d9279[_0x32b108(0x191)],_0xfef873);await cleanupEmptyDirectories(dirname(_0xfef873),_0x4d9279['sqlRootDir']),void _0x188281;}async function moveToTrash(_0x1ec3bc,_0xe1557d,_0x225ad8){const _0x51532d=a254_0x11d5d5,_0x21bd28=new Date()['toISOString']()[_0x51532d(0x1a5)](/[:.]/g,'-'),_0x4861dc=relative(_0x1ec3bc,_0x225ad8),_0x297fb8=join(_0xe1557d,_0x21bd28,_0x4861dc);return await mkdir(dirname(_0x297fb8),{'recursive':!![]}),await rename(_0x225ad8,_0x297fb8),_0x297fb8;}async function cleanupEmptyDirectories(_0x1689cb,_0x2f5270){const _0x34d2d9=a254_0x11d5d5;let _0x42d6d2=resolve(_0x1689cb);const _0x5e2b45=resolve(_0x2f5270);while(_0x42d6d2[_0x34d2d9(0x1ab)](''+_0x5e2b45+sep)||_0x42d6d2===_0x5e2b45){if(_0x42d6d2===_0x5e2b45)return;try{const _0x970d0b=await readdir(_0x42d6d2);if(_0x970d0b[_0x34d2d9(0x168)]>0x0)return;await rmdir(_0x42d6d2);}catch{return;}_0x42d6d2=dirname(_0x42d6d2);}}async function resolveTargetDbBinding(_0x3cd2b3,_0x33ca71,_0x5c01f5){const _0x3afb2f=a254_0x11d5d5,_0x2e6eb6=_0x33ca71[_0x3afb2f(0x169)];if(!_0x2e6eb6)return{'dbId':_0x5c01f5[_0x3afb2f(0x1a9)],'dbName':_0x5c01f5[_0x3afb2f(0x19d)]};const _0x2458ec=buildDbDirectoryName(_0x5c01f5['dbName'],_0x5c01f5['dbId']);if(_0x2e6eb6===_0x2458ec)return{'dbId':_0x5c01f5[_0x3afb2f(0x1a9)],'dbName':_0x5c01f5[_0x3afb2f(0x19d)]};const _0x554b76=parseExplicitDbDirectory(_0x2e6eb6);if(_0x554b76!=null)return{'dbId':_0x554b76,'dbName':await getDbName(_0x3cd2b3,_0x554b76)[_0x3afb2f(0x175)](()=>undefined)};const _0x3fe788=await listDatabases(_0x3cd2b3),_0x24a6d0=_0x3fe788[_0x3afb2f(0x173)](_0x5227a9=>buildDbDirectoryName(_0x5227a9['dbName'],_0x5227a9[_0x3afb2f(0x1a9)])===_0x2e6eb6);if(_0x24a6d0['length']===0x1)return{'dbId':_0x24a6d0[0x0][_0x3afb2f(0x1a9)],'dbName':_0x24a6d0[0x0]['dbName']};if(_0x24a6d0['length']===0x0)throw CliErrors[_0x3afb2f(0x184)](_0x3afb2f(0x194)+_0x2e6eb6+'\x22\x20for\x20sqlCode\x20'+_0x33ca71['sqlCode']+'.');const _0x5e433d=_0x24a6d0[_0x3afb2f(0x17d)](_0x13be37=>_0x13be37[_0x3afb2f(0x19d)]+'\x20('+_0x13be37['dbId']+')')[_0x3afb2f(0x166)](',\x20');throw CliErrors['validation'](_0x3afb2f(0x1a6)+_0x2e6eb6+_0x3afb2f(0x198)+_0x33ca71[_0x3afb2f(0x18b)]+':\x20'+_0x5e433d);}function parseExplicitDbDirectory(_0x2bed38){const _0x5db10c=a254_0x11d5d5,_0x41b482=/^db-(\d+)$/[_0x5db10c(0x16a)](_0x2bed38);if(!_0x41b482)return null;const _0x13c4ac=Number(_0x41b482[0x1]);return Number[_0x5db10c(0x182)](_0x13c4ac)&&_0x13c4ac>0x0?_0x13c4ac:null;}
1
+ const a254_0x14e39b=a254_0x249c;(function(_0xae2333,_0x3cd2e3){const _0x34970d=a254_0x249c,_0x6fa34b=_0xae2333();while(!![]){try{const _0x7e6028=-parseInt(_0x34970d(0x149))/0x1+parseInt(_0x34970d(0x17c))/0x2*(parseInt(_0x34970d(0x154))/0x3)+parseInt(_0x34970d(0x15d))/0x4+parseInt(_0x34970d(0x145))/0x5+-parseInt(_0x34970d(0x17a))/0x6+parseInt(_0x34970d(0x172))/0x7+parseInt(_0x34970d(0x148))/0x8;if(_0x7e6028===_0x3cd2e3)break;else _0x6fa34b['push'](_0x6fa34b['shift']());}catch(_0x2b2846){_0x6fa34b['push'](_0x6fa34b['shift']());}}}(a254_0x3340,0x26210));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';function a254_0x249c(_0x5ad75e,_0x247f77){_0x5ad75e=_0x5ad75e-0x145;const _0x3340ab=a254_0x3340();let _0x249ccb=_0x3340ab[_0x5ad75e];return _0x249ccb;}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function readSqlUploadContent(_0x3638c2){const _0x4eb9e4=a254_0x249c,_0x5c03bc=stripLocalSqlMetadata(await readFile(_0x3638c2[_0x4eb9e4(0x16f)],'utf8'),_0x3638c2['mode']);if(!_0x5c03bc[_0x4eb9e4(0x14e)]())throw CliErrors['validation'](_0x3638c2[_0x4eb9e4(0x17b)]+':\x20SQL\x20content\x20is\x20empty.');return _0x5c03bc;}function a254_0x3340(){const _0x5c8c20=['toISOString','1384885HwfqWU','lockFilePath','sqls','431512TdzrgM','179354nhnnTa','bool','replace','/smartapi/custom/updateUserCustomSql','Local\x20directory\x20\x22','trim',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','force','dbName','message','Local\x20SQL\x20not\x20found:\x20','12FLIdya','sqlConfig',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','Would\x20push\x20','push','write','mode','str','remoteId','440552YnDveO','path','No\x20local\x20SQL\x20files\x20found.','version','boolean','sql','Push\x20complete:\x20','validation','entries','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','exec','length','has','sqlRootDir','Push\x20local\x20SQL\x20files\x20to\x20remote','\x20SQL\x20file(s)','POST','appCode','filePath','hash','sqlName','221298xlzxbL','\x20pushed,\x20','join','sqlcode','filter','startsWith','relativePath','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','1241532uXYiTK','sqlCode','34892vhfUQy','lastSync','isFinite','catch','No\x20database\x20matches\x20local\x20directory\x20\x22','dbDirectory','\x20failed','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','\x20skipped,\x20','sqlRoot','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','dbId'];a254_0x3340=function(){return _0x5c8c20;};return a254_0x3340();}async function getTargetSqlQueries(_0x1b61c0,_0x3f1df0,_0x22e0ff){const _0x635b2c=a254_0x249c,_0x6b5dfa=await scanLocalSqlQueries(_0x1b61c0),_0x5e8409=new Map();for(const _0x261d1f of _0x6b5dfa){if(_0x22e0ff&&_0x261d1f[_0x635b2c(0x17b)]!==_0x22e0ff)continue;const _0xe628a1=_0x5e8409['get'](_0x261d1f[_0x635b2c(0x17b)])??[];_0xe628a1[_0x635b2c(0x158)](_0x261d1f),_0x5e8409['set'](_0x261d1f[_0x635b2c(0x17b)],_0xe628a1);}if(_0x22e0ff&&!_0x5e8409[_0x635b2c(0x169)](_0x22e0ff))throw CliErrors['validation'](_0x635b2c(0x153)+_0x22e0ff);const _0x455ec4=[];for(const [_0x85d91b,_0x5b78e7]of _0x5e8409[_0x635b2c(0x165)]()){if(_0x5b78e7[_0x635b2c(0x168)]===0x1){_0x455ec4[_0x635b2c(0x158)](_0x5b78e7[0x0]);continue;}const _0x48282b=_0x3f1df0[_0x635b2c(0x147)][_0x85d91b],_0x12303c=_0x48282b?.[_0x635b2c(0x15e)],_0x3421f5=_0x12303c?_0x5b78e7['filter'](_0x4a2535=>_0x4a2535[_0x635b2c(0x178)]!==_0x12303c):_0x5b78e7;if(_0x48282b&&_0x3421f5[_0x635b2c(0x168)]===0x1){_0x455ec4[_0x635b2c(0x158)](_0x3421f5[0x0]);continue;}throw CliErrors['validation']('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x85d91b+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x455ec4;}export const sqlPush={'service':a254_0x14e39b(0x162),'command':a254_0x14e39b(0x158),'description':a254_0x14e39b(0x16b),'risk':a254_0x14e39b(0x159),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a254_0x14e39b(0x161),'description':a254_0x14e39b(0x186)}],async 'dryRun'(_0x1bde62){const _0x40416d=a254_0x14e39b,_0x2e8693=loadSqlProjectConfig(_0x1bde62[_0x40416d(0x16e)]),_0x590a89=await readSqlLockFile(_0x2e8693['lockFilePath']),{appLock:_0x42faf0}=ensureSqlLockScope(_0x590a89??createEmptySqlLock(),_0x1bde62[_0x40416d(0x16e)],_0x2e8693[_0x40416d(0x185)],_0x40416d(0x158)),_0x41d794=await getTargetSqlQueries(_0x2e8693,_0x42faf0,_0x1bde62[_0x40416d(0x15b)](_0x40416d(0x175))||undefined),_0x58926d=[];for(const _0x27b998 of _0x41d794){const _0x4954df=await computeSqlFileHash(_0x27b998[_0x40416d(0x16f)]),_0x1cbeac=_0x42faf0[_0x40416d(0x147)][_0x27b998[_0x40416d(0x17b)]],_0x186b5c=!!_0x1cbeac&&(_0x1cbeac['path']!==_0x27b998[_0x40416d(0x178)]||!!_0x27b998[_0x40416d(0x171)]&&_0x1cbeac[_0x40416d(0x171)]!==_0x27b998[_0x40416d(0x171)]||_0x1cbeac[_0x40416d(0x15a)]!==_0x27b998['mode']);if(!_0x1bde62[_0x40416d(0x14a)]('force')&&_0x1cbeac&&_0x1cbeac[_0x40416d(0x170)]===_0x4954df&&!_0x186b5c)continue;if(!_0x1cbeac)throw CliErrors['validation'](_0x27b998[_0x40416d(0x17b)]+_0x40416d(0x14f));if(_0x1cbeac[_0x40416d(0x160)]==null)throw CliErrors[_0x40416d(0x164)](_0x27b998[_0x40416d(0x17b)]+_0x40416d(0x156));await resolveTargetDbBinding(_0x1bde62[_0x40416d(0x16e)],_0x27b998,_0x1cbeac),await readSqlUploadContent(_0x27b998),_0x58926d[_0x40416d(0x158)](_0x27b998['sqlCode']);}return{'method':_0x40416d(0x16d),'url':_0x40416d(0x14c),'body':{'sqlCodes':_0x58926d,'appCode':_0x1bde62[_0x40416d(0x16e)]},'description':_0x40416d(0x157)+_0x58926d[_0x40416d(0x168)]+_0x40416d(0x16c)};},async 'execute'(_0x561f0c){const _0x5af172=a254_0x14e39b,_0x3cafed=loadSqlProjectConfig(_0x561f0c[_0x5af172(0x16e)]),_0x45b7b9=await readSqlLockFile(_0x3cafed[_0x5af172(0x146)]),{lockData:_0x8adeff,appLock:_0x3e88ee}=ensureSqlLockScope(_0x45b7b9??createEmptySqlLock(),_0x561f0c[_0x5af172(0x16e)],_0x3cafed[_0x5af172(0x185)],_0x5af172(0x158)),_0x146a08=await getTargetSqlQueries(_0x3cafed,_0x3e88ee,_0x561f0c[_0x5af172(0x15b)](_0x5af172(0x175))||undefined);if(_0x146a08[_0x5af172(0x168)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x5af172(0x15f)};const _0x186ebc=[],_0x12e87d=[],_0x94aa0f=[];let _0x302bbe=![];for(const _0x436c13 of _0x146a08){const _0x5db529=_0x3e88ee[_0x5af172(0x147)][_0x436c13[_0x5af172(0x17b)]];if(!_0x5db529){_0x94aa0f[_0x5af172(0x158)]({'sqlCode':_0x436c13[_0x5af172(0x17b)],'error':_0x5af172(0x183)});continue;}try{const _0x56a99b=await computeSqlFileHash(_0x436c13[_0x5af172(0x16f)]),_0x1ae60a=_0x5db529[_0x5af172(0x15e)]!==_0x436c13[_0x5af172(0x178)]||!!_0x436c13['sqlName']&&_0x5db529[_0x5af172(0x171)]!==_0x436c13[_0x5af172(0x171)]||_0x5db529[_0x5af172(0x15a)]!==_0x436c13[_0x5af172(0x15a)];if(!_0x561f0c[_0x5af172(0x14a)](_0x5af172(0x150))&&_0x5db529['hash']===_0x56a99b&&!_0x1ae60a){_0x12e87d['push']({'sqlCode':_0x436c13[_0x5af172(0x17b)],'reason':'unchanged'});continue;}if(_0x5db529[_0x5af172(0x160)]==null){_0x94aa0f[_0x5af172(0x158)]({'sqlCode':_0x436c13['sqlCode'],'error':_0x5af172(0x166)});continue;}const _0x12c4f7=_0x436c13['sqlName']||_0x5db529[_0x5af172(0x171)],_0x147067=await resolveTargetDbBinding(_0x561f0c[_0x5af172(0x16e)],_0x436c13,_0x5db529),_0x49e4b8=await readSqlUploadContent(_0x436c13),_0x581ffc=await updateSqlQuery({'id':_0x5db529[_0x5af172(0x15c)],'appCode':_0x561f0c[_0x5af172(0x16e)],'sqlCode':_0x436c13[_0x5af172(0x17b)],'sqlName':_0x12c4f7,'dbId':_0x147067['dbId'],'version':_0x5db529[_0x5af172(0x160)],'sqlContent':_0x49e4b8,'sqlConfig':_0x5db529[_0x5af172(0x155)]??undefined}),_0x40ffaf=_0x581ffc[_0x5af172(0x187)]?await getDbName(_0x561f0c['appCode'],Number(_0x581ffc[_0x5af172(0x187)]))[_0x5af172(0x17f)](()=>_0x147067[_0x5af172(0x151)]):_0x147067[_0x5af172(0x151)];_0x3e88ee[_0x5af172(0x147)][_0x436c13[_0x5af172(0x17b)]]={...buildSqlLockEntry(_0x581ffc,_0x49e4b8,_0x56a99b,{'dbName':_0x40ffaf}),'path':_0x436c13[_0x5af172(0x178)],'mode':_0x436c13[_0x5af172(0x15a)]},_0x302bbe=!![],await archivePreviousSqlFileIfNeeded(_0x3cafed,_0x5db529[_0x5af172(0x15e)],_0x436c13[_0x5af172(0x178)]),_0x186ebc['push']({'sqlCode':_0x436c13[_0x5af172(0x17b)],'remoteId':_0x5db529[_0x5af172(0x15c)]});}catch(_0x57caf9){_0x94aa0f[_0x5af172(0x158)]({'sqlCode':_0x436c13[_0x5af172(0x17b)],'error':_0x57caf9 instanceof Error?_0x57caf9[_0x5af172(0x152)]:String(_0x57caf9)});}}(_0x302bbe||_0x94aa0f['length']===0x0)&&(_0x3e88ee[_0x5af172(0x17d)]=new Date()[_0x5af172(0x188)](),await writeSqlLockFile(_0x3cafed['lockFilePath'],_0x8adeff));const _0x30aaf2=_0x94aa0f['length']===0x0;return{'ok':_0x30aaf2,'data':{'pushed':_0x186ebc,'skipped':_0x12e87d,'failed':_0x94aa0f},'message':_0x5af172(0x163)+_0x186ebc[_0x5af172(0x168)]+_0x5af172(0x173)+_0x12e87d[_0x5af172(0x168)]+_0x5af172(0x184)+_0x94aa0f[_0x5af172(0x168)]+_0x5af172(0x182)};}};async function archivePreviousSqlFileIfNeeded(_0xb93eb6,_0x708de8,_0x29c13a){const _0x35b90b=a254_0x14e39b;if(!_0x708de8||_0x708de8===_0x29c13a)return;const _0x1e1fb6=join(_0xb93eb6[_0x35b90b(0x16a)],_0x708de8);if(!await fileExists(_0x1e1fb6))return;const _0x3d2184=await moveToTrash(_0xb93eb6['projectRoot'],_0xb93eb6['trashDir'],_0x1e1fb6);await cleanupEmptyDirectories(dirname(_0x1e1fb6),_0xb93eb6[_0x35b90b(0x16a)]),void _0x3d2184;}async function moveToTrash(_0xdc87a6,_0x531214,_0x271d1e){const _0x2efe6d=a254_0x14e39b,_0x492450=new Date()['toISOString']()[_0x2efe6d(0x14b)](/[:.]/g,'-'),_0x2e3269=relative(_0xdc87a6,_0x271d1e),_0x81d8f9=join(_0x531214,_0x492450,_0x2e3269);return await mkdir(dirname(_0x81d8f9),{'recursive':!![]}),await rename(_0x271d1e,_0x81d8f9),_0x81d8f9;}async function cleanupEmptyDirectories(_0x97369b,_0x45addc){const _0x3033e7=a254_0x14e39b;let _0x40281d=resolve(_0x97369b);const _0x56af14=resolve(_0x45addc);while(_0x40281d[_0x3033e7(0x177)](''+_0x56af14+sep)||_0x40281d===_0x56af14){if(_0x40281d===_0x56af14)return;try{const _0x5dc1a7=await readdir(_0x40281d);if(_0x5dc1a7[_0x3033e7(0x168)]>0x0)return;await rmdir(_0x40281d);}catch{return;}_0x40281d=dirname(_0x40281d);}}async function resolveTargetDbBinding(_0x1bc678,_0x437395,_0x23da0b){const _0xc826a0=a254_0x14e39b,_0x23797f=_0x437395[_0xc826a0(0x181)];if(!_0x23797f)return{'dbId':_0x23da0b['dbId'],'dbName':_0x23da0b[_0xc826a0(0x151)]};const _0x17a075=buildDbDirectoryName(_0x23da0b[_0xc826a0(0x151)],_0x23da0b['dbId']);if(_0x23797f===_0x17a075)return{'dbId':_0x23da0b[_0xc826a0(0x187)],'dbName':_0x23da0b[_0xc826a0(0x151)]};const _0x421ba8=parseExplicitDbDirectory(_0x23797f);if(_0x421ba8!=null)return{'dbId':_0x421ba8,'dbName':await getDbName(_0x1bc678,_0x421ba8)[_0xc826a0(0x17f)](()=>undefined)};const _0x2d70f6=await listDatabases(_0x1bc678),_0x20d2b5=_0x2d70f6[_0xc826a0(0x176)](_0x1af4f9=>buildDbDirectoryName(_0x1af4f9[_0xc826a0(0x151)],_0x1af4f9[_0xc826a0(0x187)])===_0x23797f);if(_0x20d2b5[_0xc826a0(0x168)]===0x1)return{'dbId':_0x20d2b5[0x0][_0xc826a0(0x187)],'dbName':_0x20d2b5[0x0][_0xc826a0(0x151)]};if(_0x20d2b5[_0xc826a0(0x168)]===0x0)throw CliErrors[_0xc826a0(0x164)](_0xc826a0(0x180)+_0x23797f+'\x22\x20for\x20sqlCode\x20'+_0x437395['sqlCode']+'.');const _0x1a15a5=_0x20d2b5['map'](_0x4d0474=>_0x4d0474[_0xc826a0(0x151)]+'\x20('+_0x4d0474['dbId']+')')[_0xc826a0(0x174)](',\x20');throw CliErrors[_0xc826a0(0x164)](_0xc826a0(0x14d)+_0x23797f+_0xc826a0(0x179)+_0x437395[_0xc826a0(0x17b)]+':\x20'+_0x1a15a5);}function parseExplicitDbDirectory(_0x30d0b9){const _0x3fa99c=a254_0x14e39b,_0x37db0c=/^db-(\d+)$/[_0x3fa99c(0x167)](_0x30d0b9);if(!_0x37db0c)return null;const _0x3162a6=Number(_0x37db0c[0x1]);return Number[_0x3fa99c(0x17e)](_0x3162a6)&&_0x3162a6>0x0?_0x3162a6:null;}
@@ -1 +1 @@
1
- const a255_0x561149=a255_0xe5fe;(function(_0x43df1a,_0x4c8113){const _0x67bc80=a255_0xe5fe,_0x32c4f4=_0x43df1a();while(!![]){try{const _0x2c31b1=-parseInt(_0x67bc80(0x1e2))/0x1*(parseInt(_0x67bc80(0x1e7))/0x2)+-parseInt(_0x67bc80(0x1bf))/0x3*(-parseInt(_0x67bc80(0x1c2))/0x4)+parseInt(_0x67bc80(0x1df))/0x5*(parseInt(_0x67bc80(0x1c4))/0x6)+parseInt(_0x67bc80(0x1f0))/0x7*(parseInt(_0x67bc80(0x1d9))/0x8)+-parseInt(_0x67bc80(0x1d6))/0x9*(parseInt(_0x67bc80(0x1d5))/0xa)+parseInt(_0x67bc80(0x1d4))/0xb+-parseInt(_0x67bc80(0x1be))/0xc*(parseInt(_0x67bc80(0x1c9))/0xd);if(_0x2c31b1===_0x4c8113)break;else _0x32c4f4['push'](_0x32c4f4['shift']());}catch(_0x471f28){_0x32c4f4['push'](_0x32c4f4['shift']());}}}(a255_0x394a,0x5daf8));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=a255_0x561149(0x1ed);export function buildSqlLockEntry(_0x293d18,_0x5f2952,_0x14941d,_0x216513){const _0x3c4832=a255_0x561149,_0x1f0389=detectSqlMode(_0x5f2952);return{'path':buildSqlRelativePath(_0x293d18[_0x3c4832(0x1c5)],_0x293d18[_0x3c4832(0x1db)],_0x216513?.['dbName'],_0x1f0389,_0x293d18[_0x3c4832(0x1dc)]),'hash':_0x14941d,'remoteId':_0x293d18['id'],'version':_0x293d18[_0x3c4832(0x1ee)],'dbId':Number(_0x293d18[_0x3c4832(0x1dc)]),'dbName':_0x216513?.['dbName'],'sqlName':_0x293d18[_0x3c4832(0x1db)],'sqlConfig':_0x293d18[_0x3c4832(0x1cf)]??undefined,'mode':_0x1f0389};}export function cloneSqlLockData(_0x152c93){const _0x1c50f8=a255_0x561149;return{'apps':Object[_0x1c50f8(0x1cb)](Object[_0x1c50f8(0x1de)](_0x152c93[_0x1c50f8(0x1ec)])[_0x1c50f8(0x1d8)](([_0x2a73b9,_0x10a918])=>[_0x2a73b9,{'sqlRoot':_0x10a918[_0x1c50f8(0x1ce)],'lastSync':_0x10a918[_0x1c50f8(0x1eb)],'sqls':{..._0x10a918['sqls']}}]))};}export function ensureRemoteSqlContent(_0x5098da){const _0x7a912d=a255_0x561149;return _0x5098da[_0x7a912d(0x1e1)]??'';}export function buildLocalSqlFileContent(_0x3c1eea,_0xf28bf4,_0x5ef96d){const _0x4601c4=a255_0x561149,_0x8bf698=_0x5ef96d?.[_0x4601c4(0x1e6)]??detectSqlMode(_0xf28bf4),_0x5119d6=stripLocalSqlMetadata(_0xf28bf4,_0x8bf698)[_0x4601c4(0x1d1)](),_0x5aa54e=buildMetadataHeaderLines({'sqlCode':_0x3c1eea[_0x4601c4(0x1c5)],'sqlName':_0x3c1eea[_0x4601c4(0x1db)],'dbId':_0x3c1eea['dbId'],'dbName':_0x5ef96d?.[_0x4601c4(0x1c0)],'mode':_0x8bf698,'syncedAt':_0x5ef96d?.['syncedAt'],'description':_0x5ef96d?.[_0x4601c4(0x1c8)]},_0x8bf698),_0xe452d7=_0x8bf698===_0x4601c4(0x1d0)?splitXmlDeclaration(_0x5119d6):{'body':_0x5119d6},_0x58107d=[..._0xe452d7[_0x4601c4(0x1c6)]?[_0xe452d7['declaration']]:[],..._0x5aa54e,'',_0xe452d7['body'][_0x4601c4(0x1e0)]()],_0x91d0bc=_0x58107d['join']('\x0a');return _0x91d0bc['endsWith']('\x0a')?_0x91d0bc:_0x91d0bc+'\x0a';}export function stripLocalSqlMetadata(_0x121559,_0x275244){const _0x53b06e=a255_0x561149;if(_0x275244===_0x53b06e(0x1d0)){const {declaration:_0x2e4c8c,body:_0x23cdd0}=splitXmlDeclaration(_0x121559[_0x53b06e(0x1ca)](/\r\n/g,'\x0a')),_0x2d41ca=stripLeadingMetadataLines(_0x23cdd0,/^\s*<!--\s*@lovrabet\./);return _0x2e4c8c?''+_0x2e4c8c+(_0x2d41ca?'\x0a'+_0x2d41ca:''):_0x2d41ca;}return stripLeadingMetadataLines(_0x121559[_0x53b06e(0x1ca)](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}function a255_0x394a(){const _0x3db9c8=['apps','.rabetbase/sql','version','stdin','21wbbePU','includes','12IXQYgz','6wFZQgR','dbName','syncedAt','1491520aAprPM','close','1997328KiOJmR','sqlCode','declaration','toLowerCase','description','6491719JLDXYr','replace','fromEntries','test','length','sqlRoot','sqlConfig','mybatisXml','trim','--\x20@lovrabet.','yes','1610675LyKURm','10GJcqmz','3702438PRCTvL','join','map','1307752bgxHdd','\x20[y/N]\x20','sqlName','dbId','<!--\x20@lovrabet.','entries','5ulrkUC','trimStart','sqlContent','3vKYDiV','filter','split','\x20-->','mode','280666sIeGpl','stderr','exec','path','lastSync'];a255_0x394a=function(){return _0x3db9c8;};return a255_0x394a();}export function resolveSqlMode(_0x3d7842,_0x48588c){const _0x1ab573=a255_0x561149;if(_0x48588c?.[_0x1ab573(0x1e6)])return _0x48588c[_0x1ab573(0x1e6)];return detectSqlMode(_0x3d7842);}function a255_0xe5fe(_0x531c83,_0x5415d1){_0x531c83=_0x531c83-0x1bd;const _0x394aa1=a255_0x394a();let _0xe5feb4=_0x394aa1[_0x531c83];return _0xe5feb4;}export function resolveSqlFileName(_0x20572c,_0x4962f2,_0x1cb8ea){const _0x1a31ff=a255_0x561149;if(_0x1cb8ea?.['path'])return _0x1cb8ea[_0x1a31ff(0x1ea)];if(_0x1cb8ea?.[_0x1a31ff(0x1db)]||_0x1cb8ea?.[_0x1a31ff(0x1c0)])return buildSqlRelativePath(_0x20572c,_0x1cb8ea?.[_0x1a31ff(0x1db)],_0x1cb8ea?.[_0x1a31ff(0x1c0)],resolveSqlMode(_0x4962f2,_0x1cb8ea),_0x1cb8ea?.[_0x1a31ff(0x1dc)]);return buildDefaultSqlFileName(_0x20572c,resolveSqlMode(_0x4962f2,_0x1cb8ea));}export function resolveSqlLocalDir(_0xfd651a,_0x828f0e){return join(_0xfd651a,SQL_LOCAL_REL_DIR,_0x828f0e);}export async function confirmForceOverwrite(_0x346929){const _0x3e006e=a255_0x561149,_0xb3803c=createInterface({'input':process[_0x3e006e(0x1ef)],'output':process[_0x3e006e(0x1e8)]}),_0x30210a=await new Promise(_0x1f51d4=>{const _0x2996c9=_0x3e006e;_0xb3803c['question'](_0x346929+_0x2996c9(0x1da),_0x1f51d4);});return _0xb3803c[_0x3e006e(0x1c3)](),['y',_0x3e006e(0x1d3)][_0x3e006e(0x1bd)](_0x30210a[_0x3e006e(0x1d1)]()[_0x3e006e(0x1c7)]());}export function findSqlLockScope(_0x119763,_0x4a5f40){const _0x1d796e=a255_0x561149;return _0x119763[_0x1d796e(0x1ec)][_0x4a5f40];}function buildMetadataHeaderLines(_0x4bb3c7,_0x1a8e97){const _0x59033e=a255_0x561149,_0x5a954b=[[_0x59033e(0x1c5),_0x4bb3c7['sqlCode']],[_0x59033e(0x1db),_0x4bb3c7[_0x59033e(0x1db)]],['dbId',_0x4bb3c7[_0x59033e(0x1dc)]],[_0x59033e(0x1c0),_0x4bb3c7['dbName']],[_0x59033e(0x1e6),_0x4bb3c7['mode']],[_0x59033e(0x1c1),_0x4bb3c7[_0x59033e(0x1c1)]],[_0x59033e(0x1c8),_0x4bb3c7[_0x59033e(0x1c8)]]];if(_0x1a8e97===_0x59033e(0x1d0))return _0x5a954b[_0x59033e(0x1e3)](([,_0x43db89])=>_0x43db89!==undefined&&_0x43db89!==null&&String(_0x43db89)[_0x59033e(0x1d1)]()!=='')[_0x59033e(0x1d8)](([_0xe63ebc,_0x2c8be7])=>_0x59033e(0x1dd)+_0xe63ebc+':\x20'+String(_0x2c8be7)+_0x59033e(0x1e5));return _0x5a954b[_0x59033e(0x1e3)](([,_0x584593])=>_0x584593!==undefined&&_0x584593!==null&&String(_0x584593)[_0x59033e(0x1d1)]()!=='')['map'](([_0x3e9098,_0x36dc58])=>_0x59033e(0x1d2)+_0x3e9098+':\x20'+String(_0x36dc58));}function splitXmlDeclaration(_0x5a6969){const _0x4efc96=a255_0x561149,_0x33dbf7=_0x5a6969['trimStart'](),_0x38641b=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i[_0x4efc96(0x1e9)](_0x33dbf7);if(!_0x38641b)return{'body':_0x5a6969};return{'declaration':_0x38641b[0x0],'body':_0x33dbf7['slice'](_0x38641b[0x0][_0x4efc96(0x1cd)])};}function stripLeadingMetadataLines(_0x48925b,_0x37c163){const _0x2cd5bf=a255_0x561149,_0x1d2985=_0x48925b[_0x2cd5bf(0x1e4)]('\x0a');let _0x1619f5=0x0;while(_0x1619f5<_0x1d2985['length']){const _0xddf6d7=_0x1d2985[_0x1619f5]??'';if(_0x37c163[_0x2cd5bf(0x1cc)](_0xddf6d7)||_0xddf6d7[_0x2cd5bf(0x1d1)]()===''){_0x1619f5++;continue;}break;}return _0x1d2985['slice'](_0x1619f5)[_0x2cd5bf(0x1d7)]('\x0a')[_0x2cd5bf(0x1e0)]();}
1
+ const a255_0x5d9677=a255_0x208f;(function(_0x24729a,_0x4a773c){const _0x9f7bfd=a255_0x208f,_0x47efb8=_0x24729a();while(!![]){try{const _0x4334a5=parseInt(_0x9f7bfd(0xb9))/0x1+parseInt(_0x9f7bfd(0xbf))/0x2*(-parseInt(_0x9f7bfd(0xaa))/0x3)+parseInt(_0x9f7bfd(0xc0))/0x4*(-parseInt(_0x9f7bfd(0xa7))/0x5)+-parseInt(_0x9f7bfd(0x9c))/0x6*(-parseInt(_0x9f7bfd(0xb0))/0x7)+-parseInt(_0x9f7bfd(0x98))/0x8*(parseInt(_0x9f7bfd(0xa9))/0x9)+parseInt(_0x9f7bfd(0xa4))/0xa+-parseInt(_0x9f7bfd(0xc6))/0xb*(-parseInt(_0x9f7bfd(0xae))/0xc);if(_0x4334a5===_0x4a773c)break;else _0x47efb8['push'](_0x47efb8['shift']());}catch(_0xaeb3b9){_0x47efb8['push'](_0x47efb8['shift']());}}}(a255_0x1e45,0x5a1dd));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=a255_0x5d9677(0xb2);export function buildSqlLockEntry(_0x35b6d7,_0x20b397,_0x5048b5,_0xeea1c0){const _0x567ec3=a255_0x5d9677,_0x2302f7=detectSqlMode(_0x20b397);return{'path':buildSqlRelativePath(_0x35b6d7['sqlCode'],_0x35b6d7[_0x567ec3(0xbc)],_0xeea1c0?.[_0x567ec3(0xaf)],_0x2302f7,_0x35b6d7['dbId']),'hash':_0x5048b5,'remoteId':_0x35b6d7['id'],'version':_0x35b6d7[_0x567ec3(0xbb)],'dbId':Number(_0x35b6d7[_0x567ec3(0x9b)]),'dbName':_0xeea1c0?.['dbName'],'sqlName':_0x35b6d7[_0x567ec3(0xbc)],'sqlConfig':_0x35b6d7['sqlConfig']??undefined,'mode':_0x2302f7};}export function cloneSqlLockData(_0x3d0591){const _0xa33fed=a255_0x5d9677;return{'apps':Object['fromEntries'](Object[_0xa33fed(0xb1)](_0x3d0591[_0xa33fed(0xc2)])[_0xa33fed(0xc3)](([_0x427d8f,_0x37d561])=>[_0x427d8f,{'sqlRoot':_0x37d561[_0xa33fed(0xc5)],'lastSync':_0x37d561[_0xa33fed(0xac)],'sqls':{..._0x37d561['sqls']}}]))};}export function ensureRemoteSqlContent(_0x2d4e49){const _0x5e167c=a255_0x5d9677;return _0x2d4e49[_0x5e167c(0x9a)]??'';}export function buildLocalSqlFileContent(_0x516f33,_0x4c0ec7,_0x1d3389){const _0x7de567=a255_0x5d9677,_0x2d97f3=_0x1d3389?.[_0x7de567(0x9f)]??detectSqlMode(_0x4c0ec7),_0x3aa4c1=stripLocalSqlMetadata(_0x4c0ec7,_0x2d97f3)['trim'](),_0x13c447=buildMetadataHeaderLines({'sqlCode':_0x516f33[_0x7de567(0x99)],'sqlName':_0x516f33['sqlName'],'dbId':_0x516f33[_0x7de567(0x9b)],'dbName':_0x1d3389?.[_0x7de567(0xaf)],'mode':_0x2d97f3,'syncedAt':_0x1d3389?.[_0x7de567(0xba)],'description':_0x1d3389?.[_0x7de567(0xbe)]},_0x2d97f3),_0x56647d=_0x2d97f3===_0x7de567(0x9d)?splitXmlDeclaration(_0x3aa4c1):{'body':_0x3aa4c1},_0x1d6c9d=[..._0x56647d['declaration']?[_0x56647d['declaration']]:[],..._0x13c447,'',_0x56647d[_0x7de567(0xa1)][_0x7de567(0xb8)]()],_0x2969b0=_0x1d6c9d[_0x7de567(0xa8)]('\x0a');return _0x2969b0[_0x7de567(0xa3)]('\x0a')?_0x2969b0:_0x2969b0+'\x0a';}export function stripLocalSqlMetadata(_0x1cb01e,_0x21391f){const _0x51d227=a255_0x5d9677;if(_0x21391f===_0x51d227(0x9d)){const {declaration:_0x876ce9,body:_0x316d3a}=splitXmlDeclaration(_0x1cb01e[_0x51d227(0xa2)](/\r\n/g,'\x0a')),_0x50b0df=stripLeadingMetadataLines(_0x316d3a,/^\s*<!--\s*@lovrabet\./);return _0x876ce9?''+_0x876ce9+(_0x50b0df?'\x0a'+_0x50b0df:''):_0x50b0df;}return stripLeadingMetadataLines(_0x1cb01e[_0x51d227(0xa2)](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0xd1b125,_0x2c3983){const _0x51188e=a255_0x5d9677;if(_0x2c3983?.[_0x51188e(0x9f)])return _0x2c3983[_0x51188e(0x9f)];return detectSqlMode(_0xd1b125);}function a255_0x208f(_0x320b94,_0x501872){_0x320b94=_0x320b94-0x98;const _0x1e4531=a255_0x1e45();let _0x208f7b=_0x1e4531[_0x320b94];return _0x208f7b;}function a255_0x1e45(){const _0x3b1b26=['filter','sqlRoot','5093imVEMF','608BGBXyI','sqlCode','sqlContent','dbId','6SLAKpI','mybatisXml','yes','mode','toLowerCase','body','replace','endsWith','6799810pZyVJx','--\x20@lovrabet.','slice','2499845wpXOtn','join','83484ZiItBP','537AZOyrY','close','lastSync','test','24060nOCsyM','dbName','1930124zScDmx','entries','.rabetbase/sql','length','trim','question','path','\x20[y/N]\x20','trimStart','199468twDcwc','syncedAt','version','sqlName','\x20-->','description','5692BlWEhI','4HdikZG','stderr','apps','map'];a255_0x1e45=function(){return _0x3b1b26;};return a255_0x1e45();}export function resolveSqlFileName(_0x130595,_0x26571f,_0x5e8a2f){const _0x4039ac=a255_0x5d9677;if(_0x5e8a2f?.[_0x4039ac(0xb6)])return _0x5e8a2f[_0x4039ac(0xb6)];if(_0x5e8a2f?.['sqlName']||_0x5e8a2f?.[_0x4039ac(0xaf)])return buildSqlRelativePath(_0x130595,_0x5e8a2f?.[_0x4039ac(0xbc)],_0x5e8a2f?.[_0x4039ac(0xaf)],resolveSqlMode(_0x26571f,_0x5e8a2f),_0x5e8a2f?.[_0x4039ac(0x9b)]);return buildDefaultSqlFileName(_0x130595,resolveSqlMode(_0x26571f,_0x5e8a2f));}export function resolveSqlLocalDir(_0x27f5af,_0x259f8c){return join(_0x27f5af,SQL_LOCAL_REL_DIR,_0x259f8c);}export async function confirmForceOverwrite(_0x5dc969){const _0x155b4=a255_0x5d9677,_0x2dfd35=createInterface({'input':process['stdin'],'output':process[_0x155b4(0xc1)]}),_0x51bcd2=await new Promise(_0xe2cceb=>{const _0x190c7a=_0x155b4;_0x2dfd35[_0x190c7a(0xb5)](_0x5dc969+_0x190c7a(0xb7),_0xe2cceb);});return _0x2dfd35[_0x155b4(0xab)](),['y',_0x155b4(0x9e)]['includes'](_0x51bcd2[_0x155b4(0xb4)]()[_0x155b4(0xa0)]());}export function findSqlLockScope(_0x56f621,_0x4382f9){const _0x2f179c=a255_0x5d9677;return _0x56f621[_0x2f179c(0xc2)][_0x4382f9];}function buildMetadataHeaderLines(_0x19c234,_0x1862bf){const _0x4f0a1b=a255_0x5d9677,_0xe63a02=[['sqlCode',_0x19c234[_0x4f0a1b(0x99)]],['sqlName',_0x19c234['sqlName']],[_0x4f0a1b(0x9b),_0x19c234[_0x4f0a1b(0x9b)]],['dbName',_0x19c234[_0x4f0a1b(0xaf)]],[_0x4f0a1b(0x9f),_0x19c234[_0x4f0a1b(0x9f)]],[_0x4f0a1b(0xba),_0x19c234['syncedAt']],['description',_0x19c234['description']]];if(_0x1862bf===_0x4f0a1b(0x9d))return _0xe63a02[_0x4f0a1b(0xc4)](([,_0x4c1c62])=>_0x4c1c62!==undefined&&_0x4c1c62!==null&&String(_0x4c1c62)['trim']()!=='')[_0x4f0a1b(0xc3)](([_0x1c539c,_0x5548bf])=>'<!--\x20@lovrabet.'+_0x1c539c+':\x20'+String(_0x5548bf)+_0x4f0a1b(0xbd));return _0xe63a02[_0x4f0a1b(0xc4)](([,_0x4e698d])=>_0x4e698d!==undefined&&_0x4e698d!==null&&String(_0x4e698d)[_0x4f0a1b(0xb4)]()!=='')[_0x4f0a1b(0xc3)](([_0x4e7679,_0x7a2870])=>_0x4f0a1b(0xa5)+_0x4e7679+':\x20'+String(_0x7a2870));}function splitXmlDeclaration(_0x392306){const _0x295169=a255_0x5d9677,_0x25cef3=_0x392306[_0x295169(0xb8)](),_0x5b4a95=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i['exec'](_0x25cef3);if(!_0x5b4a95)return{'body':_0x392306};return{'declaration':_0x5b4a95[0x0],'body':_0x25cef3[_0x295169(0xa6)](_0x5b4a95[0x0][_0x295169(0xb3)])};}function stripLeadingMetadataLines(_0x3e47c8,_0x280d8f){const _0x2ef212=a255_0x5d9677,_0x471ef5=_0x3e47c8['split']('\x0a');let _0x200ed1=0x0;while(_0x200ed1<_0x471ef5[_0x2ef212(0xb3)]){const _0x2f18f2=_0x471ef5[_0x200ed1]??'';if(_0x280d8f[_0x2ef212(0xad)](_0x2f18f2)||_0x2f18f2[_0x2ef212(0xb4)]()===''){_0x200ed1++;continue;}break;}return _0x471ef5[_0x2ef212(0xa6)](_0x200ed1)['join']('\x0a')['trimStart']();}
@@ -1 +1 @@
1
- const a256_0x2a434c=a256_0x5632;(function(_0x294d4b,_0x3df098){const _0x2b02bd=a256_0x5632,_0x45618c=_0x294d4b();while(!![]){try{const _0x5e7387=-parseInt(_0x2b02bd(0x1a3))/0x1*(parseInt(_0x2b02bd(0x1a7))/0x2)+-parseInt(_0x2b02bd(0x19e))/0x3+parseInt(_0x2b02bd(0x192))/0x4+-parseInt(_0x2b02bd(0x1b4))/0x5+parseInt(_0x2b02bd(0x19f))/0x6*(parseInt(_0x2b02bd(0x1a0))/0x7)+parseInt(_0x2b02bd(0x196))/0x8+parseInt(_0x2b02bd(0x1aa))/0x9;if(_0x5e7387===_0x3df098)break;else _0x45618c['push'](_0x45618c['shift']());}catch(_0x9fbaa4){_0x45618c['push'](_0x45618c['shift']());}}}(a256_0x13f0,0x79703));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(_0x5390d2){const _0x426a23=a256_0x5632,_0xd7bae0=[];let _0x549926=0x1;while(!![]){const _0x34f9a7=await listSqlQueries(_0x5390d2,{'currentPage':_0x549926,'pageSize':PAGE_SIZE}),_0x272f7a=_0x34f9a7[_0x426a23(0x19d)]??[];_0xd7bae0['push'](..._0x272f7a[_0x426a23(0x1a1)](_0x45b8d8=>_0x45b8d8['sqlCode']));if(_0x272f7a[_0x426a23(0x1a2)]===0x0)break;const _0x2458b3=_0x34f9a7[_0x426a23(0x1b1)]?.[_0x426a23(0x193)];if(_0x2458b3!=null?_0xd7bae0[_0x426a23(0x1a2)]>=_0x2458b3:_0x272f7a[_0x426a23(0x1a2)]<PAGE_SIZE)break;_0x549926++;}return _0xd7bae0;}export const sqlStatus={'service':'sql','command':a256_0x2a434c(0x1ad),'description':a256_0x2a434c(0x19b),'risk':'read','flags':[{'name':a256_0x2a434c(0x1a8),'type':a256_0x2a434c(0x1b2),'description':a256_0x2a434c(0x198)}],async 'execute'(_0x3c67f8){const _0x4589e1=a256_0x2a434c,_0x4a8327=loadSqlProjectConfig(_0x3c67f8[_0x4589e1(0x1ac)]),_0x5d1ee5=await readSqlLockFile(_0x4a8327['lockFilePath']),{appLock:_0x55a07a}=ensureSqlLockScope(_0x5d1ee5??createEmptySqlLock(),_0x4a8327[_0x4589e1(0x1ac)],_0x4a8327[_0x4589e1(0x1a6)],_0x4589e1(0x1ad)),_0x3d70c3=await scanLocalSqlQueries(_0x4a8327),_0x4b91d9=[],_0x38ee42=[],_0x512d11=[],_0x24b9e2=[],_0x17d15f=new Set(_0x3d70c3['map'](_0x336fb8=>_0x336fb8[_0x4589e1(0x197)]));for(const _0x45c673 of _0x3d70c3){const _0xf21706=await computeSqlFileHash(_0x45c673[_0x4589e1(0x19a)]),_0x5c5548=_0x55a07a[_0x4589e1(0x195)][_0x45c673[_0x4589e1(0x197)]],_0x4b4280=!!_0x5c5548&&_0x5c5548[_0x4589e1(0x19c)]!==_0x45c673[_0x4589e1(0x199)],_0x50cc3b=!!_0x5c5548&&!!_0x45c673[_0x4589e1(0x1ae)]&&_0x5c5548['sqlName']!==_0x45c673['sqlName'];if(!_0x5c5548)_0x4b91d9['push'](_0x45c673[_0x4589e1(0x197)]);else _0x5c5548[_0x4589e1(0x1b3)]!==_0xf21706||_0x4b4280||_0x50cc3b?_0x38ee42[_0x4589e1(0x1ab)](_0x45c673[_0x4589e1(0x197)]):_0x512d11[_0x4589e1(0x1ab)](_0x45c673[_0x4589e1(0x197)]);}for(const _0x1192f7 of Object[_0x4589e1(0x1a4)](_0x55a07a['sqls'])){!_0x17d15f[_0x4589e1(0x1af)](_0x1192f7)&&_0x24b9e2[_0x4589e1(0x1ab)](_0x1192f7);}const _0x7287b8=[];if(_0x3c67f8[_0x4589e1(0x1b0)]('remote')){const _0x378792=await fetchAllSqlCodes(_0x3c67f8[_0x4589e1(0x1ac)]);for(const _0x137d1b of _0x378792){!_0x17d15f[_0x4589e1(0x1af)](_0x137d1b)&&!_0x55a07a[_0x4589e1(0x195)][_0x137d1b]&&_0x7287b8[_0x4589e1(0x1ab)](_0x137d1b);}}const _0x46ec75=_0x4b91d9[_0x4589e1(0x1a2)]===0x0&&_0x38ee42['length']===0x0&&_0x24b9e2[_0x4589e1(0x1a2)]===0x0&&_0x7287b8[_0x4589e1(0x1a2)]===0x0;return{'ok':!![],'data':{'added':_0x4b91d9,'modified':_0x38ee42,'missing':_0x24b9e2,'unchanged':_0x512d11,'remoteOnly':_0x7287b8},'message':_0x46ec75?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x4b91d9[_0x4589e1(0x1a2)]+_0x4589e1(0x1a9)+_0x38ee42[_0x4589e1(0x1a2)]+'\x20modified,\x20'+_0x24b9e2[_0x4589e1(0x1a2)]+_0x4589e1(0x194)+_0x512d11[_0x4589e1(0x1a2)]+'\x20unchanged'+(_0x7287b8[_0x4589e1(0x1a2)]>0x0?',\x20'+_0x7287b8[_0x4589e1(0x1a2)]+_0x4589e1(0x1a5):'')};}};function a256_0x5632(_0x515163,_0x280074){_0x515163=_0x515163-0x192;const _0x13f0a0=a256_0x13f0();let _0x563263=_0x13f0a0[_0x515163];return _0x563263;}function a256_0x13f0(){const _0x308c10=['1670940ouGFld','push','appCode','status','sqlName','has','bool','paging','boolean','hash','4474255NWBURV','3659828HdIdjK','totalCount','\x20missing,\x20','sqls','6277536drgbyZ','lockKey','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','relativePath','filePath','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','path','tableData','1320651FtlLEL','429888dXjVsp','70qucHyy','map','length','4049SDOCSV','keys','\x20remote-only','sqlRoot','380JEUaVh','remote','\x20added,\x20'];a256_0x13f0=function(){return _0x308c10;};return a256_0x13f0();}
1
+ const a256_0x4aee54=a256_0x56f6;(function(_0x32aac1,_0xb3a3b7){const _0x4af9b2=a256_0x56f6,_0x282437=_0x32aac1();while(!![]){try{const _0x20e33c=parseInt(_0x4af9b2(0x1b8))/0x1*(parseInt(_0x4af9b2(0x1be))/0x2)+parseInt(_0x4af9b2(0x1c4))/0x3*(-parseInt(_0x4af9b2(0x1bd))/0x4)+parseInt(_0x4af9b2(0x1c2))/0x5+parseInt(_0x4af9b2(0x1ca))/0x6+parseInt(_0x4af9b2(0x1dc))/0x7*(-parseInt(_0x4af9b2(0x1c9))/0x8)+parseInt(_0x4af9b2(0x1dd))/0x9+-parseInt(_0x4af9b2(0x1b9))/0xa*(parseInt(_0x4af9b2(0x1cc))/0xb);if(_0x20e33c===_0xb3a3b7)break;else _0x282437['push'](_0x282437['shift']());}catch(_0x30a258){_0x282437['push'](_0x282437['shift']());}}}(a256_0x2699,0x4c36d));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a256_0x2699(){const _0x6b6cd6=['50GNiEtH','tableData','bool','relativePath','32zrAgMa','28OkvReM','\x20unchanged','status','paging','849425WGopDy','totalCount','14187gMoyHC','lockKey','read','\x20missing,\x20','push','5912fVTpLO','767106xrBbYB','\x20added,\x20','1535039zmyyka','filePath','sqlRoot','sqlName','appCode','length','remote','sqls','path','sql','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','lockFilePath','map','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','\x20remote-only','has','1162WyGjKw','4526280baFDJX','26412nzSnXM'];a256_0x2699=function(){return _0x6b6cd6;};return a256_0x2699();}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a256_0x56f6(_0x5cf8e7,_0x39ebb9){_0x5cf8e7=_0x5cf8e7-0x1b8;const _0x269949=a256_0x2699();let _0x56f696=_0x269949[_0x5cf8e7];return _0x56f696;}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x54bfdb){const _0x266e2b=a256_0x56f6,_0x4e50a2=[];let _0x431667=0x1;while(!![]){const _0x1059f5=await listSqlQueries(_0x54bfdb,{'currentPage':_0x431667,'pageSize':PAGE_SIZE}),_0x143c78=_0x1059f5[_0x266e2b(0x1ba)]??[];_0x4e50a2[_0x266e2b(0x1c8)](..._0x143c78[_0x266e2b(0x1d8)](_0x3fce10=>_0x3fce10['sqlCode']));if(_0x143c78[_0x266e2b(0x1d1)]===0x0)break;const _0x39fac=_0x1059f5[_0x266e2b(0x1c1)]?.[_0x266e2b(0x1c3)];if(_0x39fac!=null?_0x4e50a2['length']>=_0x39fac:_0x143c78['length']<PAGE_SIZE)break;_0x431667++;}return _0x4e50a2;}export const sqlStatus={'service':a256_0x4aee54(0x1d5),'command':a256_0x4aee54(0x1c0),'description':a256_0x4aee54(0x1d6),'risk':a256_0x4aee54(0x1c6),'flags':[{'name':a256_0x4aee54(0x1d2),'type':'boolean','description':a256_0x4aee54(0x1d9)}],async 'execute'(_0x54215f){const _0x3b080f=a256_0x4aee54,_0x5f0952=loadSqlProjectConfig(_0x54215f[_0x3b080f(0x1d0)]),_0x2e0639=await readSqlLockFile(_0x5f0952[_0x3b080f(0x1d7)]),{appLock:_0x5de9ab}=ensureSqlLockScope(_0x2e0639??createEmptySqlLock(),_0x5f0952['appCode'],_0x5f0952[_0x3b080f(0x1ce)],_0x3b080f(0x1c0)),_0x1527ae=await scanLocalSqlQueries(_0x5f0952),_0x3248db=[],_0x41fae1=[],_0x4d7acd=[],_0x409936=[],_0x2d27e9=new Set(_0x1527ae['map'](_0x2ac13c=>_0x2ac13c[_0x3b080f(0x1c5)]));for(const _0x33cafe of _0x1527ae){const _0x36e38d=await computeSqlFileHash(_0x33cafe[_0x3b080f(0x1cd)]),_0x4aec96=_0x5de9ab[_0x3b080f(0x1d3)][_0x33cafe[_0x3b080f(0x1c5)]],_0x3f2eb3=!!_0x4aec96&&_0x4aec96[_0x3b080f(0x1d4)]!==_0x33cafe[_0x3b080f(0x1bc)],_0x413ce4=!!_0x4aec96&&!!_0x33cafe['sqlName']&&_0x4aec96[_0x3b080f(0x1cf)]!==_0x33cafe[_0x3b080f(0x1cf)];if(!_0x4aec96)_0x3248db[_0x3b080f(0x1c8)](_0x33cafe[_0x3b080f(0x1c5)]);else _0x4aec96['hash']!==_0x36e38d||_0x3f2eb3||_0x413ce4?_0x41fae1[_0x3b080f(0x1c8)](_0x33cafe[_0x3b080f(0x1c5)]):_0x4d7acd[_0x3b080f(0x1c8)](_0x33cafe['lockKey']);}for(const _0x17a964 of Object['keys'](_0x5de9ab[_0x3b080f(0x1d3)])){!_0x2d27e9[_0x3b080f(0x1db)](_0x17a964)&&_0x409936[_0x3b080f(0x1c8)](_0x17a964);}const _0x3ff592=[];if(_0x54215f[_0x3b080f(0x1bb)](_0x3b080f(0x1d2))){const _0x321e46=await fetchAllSqlCodes(_0x54215f[_0x3b080f(0x1d0)]);for(const _0x189bb5 of _0x321e46){!_0x2d27e9['has'](_0x189bb5)&&!_0x5de9ab[_0x3b080f(0x1d3)][_0x189bb5]&&_0x3ff592[_0x3b080f(0x1c8)](_0x189bb5);}}const _0x29a4ae=_0x3248db[_0x3b080f(0x1d1)]===0x0&&_0x41fae1[_0x3b080f(0x1d1)]===0x0&&_0x409936[_0x3b080f(0x1d1)]===0x0&&_0x3ff592[_0x3b080f(0x1d1)]===0x0;return{'ok':!![],'data':{'added':_0x3248db,'modified':_0x41fae1,'missing':_0x409936,'unchanged':_0x4d7acd,'remoteOnly':_0x3ff592},'message':_0x29a4ae?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x3248db[_0x3b080f(0x1d1)]+_0x3b080f(0x1cb)+_0x41fae1['length']+'\x20modified,\x20'+_0x409936['length']+_0x3b080f(0x1c7)+_0x4d7acd[_0x3b080f(0x1d1)]+_0x3b080f(0x1bf)+(_0x3ff592[_0x3b080f(0x1d1)]>0x0?',\x20'+_0x3ff592[_0x3b080f(0x1d1)]+_0x3b080f(0x1da):'')};}};
@@ -1 +1 @@
1
- const a257_0x44ef7c=a257_0x18ba;(function(_0x12888a,_0x2ebae3){const _0x5e5476=a257_0x18ba,_0x3b8fbb=_0x12888a();while(!![]){try{const _0x3f83b9=-parseInt(_0x5e5476(0xfb))/0x1*(parseInt(_0x5e5476(0xef))/0x2)+-parseInt(_0x5e5476(0xf8))/0x3*(parseInt(_0x5e5476(0x10f))/0x4)+parseInt(_0x5e5476(0xec))/0x5+parseInt(_0x5e5476(0xe5))/0x6*(-parseInt(_0x5e5476(0x110))/0x7)+-parseInt(_0x5e5476(0x108))/0x8+-parseInt(_0x5e5476(0xeb))/0x9+parseInt(_0x5e5476(0xfa))/0xa;if(_0x3f83b9===_0x2ebae3)break;else _0x3b8fbb['push'](_0x3b8fbb['shift']());}catch(_0x17c8f7){_0x3b8fbb['push'](_0x3b8fbb['shift']());}}}(a257_0x45d5,0x42b45));function a257_0x18ba(_0x50896b,_0x1d51cc){_0x50896b=_0x50896b-0xd8;const _0x45d5c4=a257_0x45d5();let _0x18ba78=_0x45d5c4[_0x50896b];return _0x18ba78;}import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a257_0x44ef7c(0xff),'command':a257_0x44ef7c(0xfe),'description':a257_0x44ef7c(0x111),'risk':a257_0x44ef7c(0xe4),'flags':[{'name':a257_0x44ef7c(0xf2),'type':a257_0x44ef7c(0xdf),'description':a257_0x44ef7c(0xf6)},{'name':a257_0x44ef7c(0xff),'type':a257_0x44ef7c(0xdf),'description':a257_0x44ef7c(0x11d)},{'name':a257_0x44ef7c(0x109),'type':'string','description':a257_0x44ef7c(0xe6)},{'name':a257_0x44ef7c(0xf3),'type':'boolean','description':a257_0x44ef7c(0xfd)}],async 'execute'(_0x47681f){const _0x12879f=a257_0x44ef7c,_0x40f132=_0x47681f['str'](_0x12879f(0xf2)),_0x42be35=_0x47681f[_0x12879f(0x116)](_0x12879f(0xff)),_0x28b93e=_0x47681f[_0x12879f(0x116)](_0x12879f(0x109)),_0x57afc8=_0x47681f[_0x12879f(0xe1)]('check-indexes');if(!_0x40f132&&!_0x42be35)throw CliErrors['flagMissing'](_0x12879f(0xf2),'Provide\x20--file\x20or\x20--sql');if(_0x57afc8&&!_0x28b93e)throw CliErrors[_0x12879f(0x10a)](_0x12879f(0x102));let _0x2b9f7a;if(_0x40f132){const _0x372e3d=resolve(process['cwd'](),_0x40f132);if(!existsSync(_0x372e3d))throw CliErrors[_0x12879f(0x10a)](_0x12879f(0x113)+_0x372e3d);_0x2b9f7a=readFileSync(_0x372e3d,_0x12879f(0xe3));}else _0x2b9f7a=_0x42be35;const _0x5091f3=validateSql(_0x2b9f7a),_0x45c0de={'valid':_0x5091f3['valid'],'sqlType':_0x5091f3[_0x12879f(0x104)][_0x12879f(0xea)],'isSelectOnly':_0x5091f3['sqlType']['isSelectOnly'],'isLockingRead':_0x5091f3[_0x12879f(0x104)][_0x12879f(0x119)]??![],'isDangerous':_0x5091f3[_0x12879f(0x104)][_0x12879f(0xda)],'tables':_0x5091f3[_0x12879f(0xe8)],'parameters':_0x5091f3[_0x12879f(0xed)],'message':_0x5091f3[_0x12879f(0xf4)]};_0x5091f3[_0x12879f(0x104)][_0x12879f(0xde)]&&(_0x45c0de[_0x12879f(0xde)]=_0x5091f3[_0x12879f(0x104)][_0x12879f(0xde)]);if(_0x28b93e&&_0x5091f3['valid']){const _0x301e62=_0x28b93e[_0x12879f(0xe9)](',')[_0x12879f(0xe2)](_0xfa0b82=>_0xfa0b82[_0x12879f(0x10c)]())[_0x12879f(0xf0)](Boolean),_0x58f8b0=[],_0x2818d2=[],_0x5e3dbc=filterDbTableBackedDatasets(await listDatasets(_0x47681f['appCode'])),_0x2713ce=new Map(_0x5e3dbc[_0x12879f(0xe2)](_0x4fec05=>[_0x4fec05['dbtableConfig']?.[_0x12879f(0x10d)]?.[_0x12879f(0x112)](),_0x4fec05]));for(const _0x4f056d of _0x5091f3[_0x12879f(0xe8)]){const _0x23e5e0=_0x2713ce[_0x12879f(0x118)](_0x4f056d['toLowerCase']());!_0x23e5e0&&_0x58f8b0[_0x12879f(0x114)](_0x12879f(0xf5)+_0x4f056d+_0x12879f(0x103));}for(const _0x288a3c of _0x301e62){let _0x1e54a2;try{_0x1e54a2=await getDatasetDetail(_0x288a3c);}catch{_0x58f8b0['push'](_0x12879f(0xf1)+_0x288a3c+_0x12879f(0xe7));continue;}assertDatasetIsDbTableBacked(_0x1e54a2,_0x12879f(0x106));const _0x183f58=Array[_0x12879f(0x117)](_0x1e54a2[_0x12879f(0x10b)])?_0x1e54a2[_0x12879f(0x10b)]:[],_0x372cf6=new Set(_0x183f58[_0x12879f(0xe2)](_0x5201e8=>_0x5201e8[_0x12879f(0xdc)]?.[_0x12879f(0x112)]())),_0xddbfd5=_0x1e54a2[_0x12879f(0x100)]?.[_0x12879f(0x10d)]||_0x1e54a2[_0x12879f(0x10d)]||_0x288a3c;_0x45c0de[_0x12879f(0x105)+_0xddbfd5]={'code':_0x288a3c,'tableName':_0xddbfd5,'fieldCount':_0x372cf6['size'],'fields':Array['from'](_0x372cf6)};if(_0x57afc8){const _0x1a7dcc=normalizeDatasetIndexes(_0x1e54a2);_0x2818d2[_0x12879f(0x114)]({'tableName':_0xddbfd5,..._0x1a7dcc});}}_0x58f8b0[_0x12879f(0x10e)]>0x0&&(_0x45c0de['schemaWarnings']=_0x58f8b0),_0x57afc8&&(_0x45c0de[_0x12879f(0xdd)]=auditSqlJoinIndexes(_0x2b9f7a,_0x2818d2));}return{'ok':_0x5091f3[_0x12879f(0xe0)],'data':_0x45c0de,'message':_0x5091f3[_0x12879f(0xf4)]};}};function normalizeDatasetIndexes(_0x2e9dc6){const _0x9bd43a=a257_0x44ef7c,_0x1a441a=Array['isArray'](_0x2e9dc6?.[_0x9bd43a(0x101)]?.[_0x9bd43a(0xf9)])?_0x2e9dc6[_0x9bd43a(0x101)][_0x9bd43a(0xf9)]:Array['isArray'](_0x2e9dc6?.[_0x9bd43a(0xf9)])?_0x2e9dc6[_0x9bd43a(0xf9)]:[],_0x4c0cf8=_0x1a441a[_0x9bd43a(0xf7)](_0x469300=>{const _0x9223b=_0x9bd43a,_0x53808f=Array[_0x9223b(0x117)](_0x469300?.[_0x9223b(0xd9)])?_0x469300['index_columns']:Array[_0x9223b(0x117)](_0x469300?.[_0x9223b(0xee)])?_0x469300[_0x9223b(0xee)]:Array[_0x9223b(0x117)](_0x469300?.[_0x9223b(0x115)])?_0x469300['columns']:[],_0x59525c=_0x53808f[_0x9223b(0xf0)](_0x1a348f=>typeof _0x1a348f===_0x9223b(0xdf))[_0x9223b(0xe2)](_0x1f6884=>_0x1f6884[_0x9223b(0x10c)]())[_0x9223b(0xf0)](Boolean);if(_0x59525c[_0x9223b(0x10e)]===0x0)return[];const _0x3d2d75=[_0x469300?.[_0x9223b(0xfc)],_0x469300?.[_0x9223b(0x11a)],_0x469300?.[_0x9223b(0xdc)]][_0x9223b(0x107)](_0x52c7b8=>typeof _0x52c7b8==='string'&&_0x52c7b8[_0x9223b(0x10c)]()),_0x5778ca=[_0x469300?.[_0x9223b(0x11c)],_0x469300?.[_0x9223b(0xea)]][_0x9223b(0x107)](_0x1fc95f=>typeof _0x1fc95f===_0x9223b(0xdf)&&_0x1fc95f[_0x9223b(0x10c)]());return[{..._0x3d2d75?{'name':_0x3d2d75['trim']()}:{},..._0x5778ca?{'type':_0x5778ca[_0x9223b(0x10c)]()}:{},'columns':_0x59525c}];}),_0x238113=[..._0x4c0cf8],_0x161a20=typeof _0x2e9dc6?.[_0x9bd43a(0x100)]?.[_0x9bd43a(0x11b)]===_0x9bd43a(0xdf)?_0x2e9dc6[_0x9bd43a(0x100)][_0x9bd43a(0x11b)][_0x9bd43a(0xe9)](',')[_0x9bd43a(0xe2)](_0x3bf53c=>_0x3bf53c['trim']())['filter'](Boolean):[];return _0x161a20[_0x9bd43a(0x10e)]>0x0&&_0x238113[_0x9bd43a(0xd8)]({'type':_0x9bd43a(0xdb),'columns':_0x161a20}),{'indexes':_0x238113,'metadataAvailable':_0x4c0cf8['length']>0x0};}function a257_0x45d5(){const _0x1b3e01=['map','utf-8','read','1728XstWpD','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','\x22\x20not\x20found\x20or\x20not\x20accessible','tables','split','type','2259945jPcdzY','560wLFqwa','parameters','columnNames','16Reimkc','filter','Dataset\x20\x22','file','check-indexes','message','Table\x20\x22','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','flatMap','140091lSxbLp','indexes','22541990evLbyU','63854SEvZNb','indexName','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','validate','sql','dbtableConfig','dataset','--check-indexes\x20requires\x20--schemas.','\x22\x20not\x20found\x20in\x20any\x20dataset','sqlType','schema:','SQL\x20schema\x20validation','find','1489776mVdbfw','schemas','validation','fields','trim','tableName','length','44FugPwQ','12621hXHRLX','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','toLowerCase','File\x20not\x20found:\x20','push','columns','str','isArray','get','isLockingRead','index_name','pkField','index_type','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','unshift','index_columns','isDangerous','primary','name','joinAudit','reason','string','valid','bool'];a257_0x45d5=function(){return _0x1b3e01;};return a257_0x45d5();}
1
+ const a257_0x3f8810=a257_0x15b6;(function(_0x1bcfdf,_0x583dc5){const _0x132e2f=a257_0x15b6,_0x2bee9b=_0x1bcfdf();while(!![]){try{const _0x22b909=-parseInt(_0x132e2f(0x91))/0x1+parseInt(_0x132e2f(0x88))/0x2*(-parseInt(_0x132e2f(0x7c))/0x3)+parseInt(_0x132e2f(0x9b))/0x4+parseInt(_0x132e2f(0x8e))/0x5+parseInt(_0x132e2f(0x92))/0x6*(-parseInt(_0x132e2f(0x8a))/0x7)+parseInt(_0x132e2f(0x90))/0x8*(-parseInt(_0x132e2f(0xb2))/0x9)+parseInt(_0x132e2f(0x95))/0xa;if(_0x22b909===_0x583dc5)break;else _0x2bee9b['push'](_0x2bee9b['shift']());}catch(_0x1c5cae){_0x2bee9b['push'](_0x2bee9b['shift']());}}}(a257_0x4327,0x78397));import{readFileSync,existsSync}from'node:fs';function a257_0x4327(){const _0x111688=['filter','utf-8','20814270CIHjGR','index_name','--check-indexes\x20requires\x20--schemas.','schema:','trim','columns','1380844cCsBaR','isLockingRead','str','fields','bool','file','Table\x20\x22','dataset','indexName','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','columnNames','sqlType','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','Provide\x20--file\x20or\x20--sql','push','SQL\x20schema\x20validation','Dataset\x20\x22','isArray','isDangerous','schemas','string','\x22\x20not\x20found\x20in\x20any\x20dataset','File\x20not\x20found:\x20','9UsHSNT','toLowerCase','tableName','pkField','name','index_type','split','type','validation','3pbtdFE','boolean','sql','map','parameters','length','indexes','unshift','get','check-indexes','index_columns','valid','1788842tVZHaf','schemaWarnings','217BAwnZI','cwd','from','dbtableConfig','3143810WyZEhx','message','5175472wqDmQB','719573iXYGSf','58458gMTYfK'];a257_0x4327=function(){return _0x111688;};return a257_0x4327();}import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a257_0x15b6(_0x2f3798,_0x547e56){_0x2f3798=_0x2f3798-0x75;const _0x43279d=a257_0x4327();let _0x15b6b0=_0x43279d[_0x2f3798];return _0x15b6b0;}import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a257_0x3f8810(0x7e),'command':'validate','description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':'read','flags':[{'name':'file','type':a257_0x3f8810(0xaf),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a257_0x3f8810(0x7e),'type':'string','description':a257_0x3f8810(0xa7)},{'name':a257_0x3f8810(0xae),'type':a257_0x3f8810(0xaf),'description':a257_0x3f8810(0xa4)},{'name':a257_0x3f8810(0x85),'type':a257_0x3f8810(0x7d),'description':'Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'}],async 'execute'(_0x5d8ac1){const _0x544029=a257_0x3f8810,_0x48d5e4=_0x5d8ac1[_0x544029(0x9d)](_0x544029(0xa0)),_0x26d17a=_0x5d8ac1[_0x544029(0x9d)](_0x544029(0x7e)),_0x4b261a=_0x5d8ac1[_0x544029(0x9d)](_0x544029(0xae)),_0x15293e=_0x5d8ac1[_0x544029(0x9f)](_0x544029(0x85));if(!_0x48d5e4&&!_0x26d17a)throw CliErrors['flagMissing'](_0x544029(0xa0),_0x544029(0xa8));if(_0x15293e&&!_0x4b261a)throw CliErrors[_0x544029(0x7b)](_0x544029(0x97));let _0x5eb1a8;if(_0x48d5e4){const _0x2b08d5=resolve(process[_0x544029(0x8b)](),_0x48d5e4);if(!existsSync(_0x2b08d5))throw CliErrors['validation'](_0x544029(0xb1)+_0x2b08d5);_0x5eb1a8=readFileSync(_0x2b08d5,_0x544029(0x94));}else _0x5eb1a8=_0x26d17a;const _0x25d8c2=validateSql(_0x5eb1a8),_0x5d0846={'valid':_0x25d8c2['valid'],'sqlType':_0x25d8c2['sqlType'][_0x544029(0x7a)],'isSelectOnly':_0x25d8c2[_0x544029(0xa6)]['isSelectOnly'],'isLockingRead':_0x25d8c2['sqlType'][_0x544029(0x9c)]??![],'isDangerous':_0x25d8c2[_0x544029(0xa6)][_0x544029(0xad)],'tables':_0x25d8c2['tables'],'parameters':_0x25d8c2[_0x544029(0x80)],'message':_0x25d8c2[_0x544029(0x8f)]};_0x25d8c2['sqlType']['reason']&&(_0x5d0846['reason']=_0x25d8c2[_0x544029(0xa6)]['reason']);if(_0x4b261a&&_0x25d8c2[_0x544029(0x87)]){const _0x225b68=_0x4b261a[_0x544029(0x79)](',')['map'](_0x14b064=>_0x14b064[_0x544029(0x99)]())[_0x544029(0x93)](Boolean),_0x341e9c=[],_0x55422a=[],_0x40beb8=filterDbTableBackedDatasets(await listDatasets(_0x5d8ac1['appCode'])),_0x1d85ba=new Map(_0x40beb8['map'](_0x4d6c8b=>[_0x4d6c8b[_0x544029(0x8d)]?.['tableName']?.[_0x544029(0xb3)](),_0x4d6c8b]));for(const _0x53e4b5 of _0x25d8c2['tables']){const _0x3ec713=_0x1d85ba[_0x544029(0x84)](_0x53e4b5[_0x544029(0xb3)]());!_0x3ec713&&_0x341e9c[_0x544029(0xa9)](_0x544029(0xa1)+_0x53e4b5+_0x544029(0xb0));}for(const _0x49e327 of _0x225b68){let _0x2398a7;try{_0x2398a7=await getDatasetDetail(_0x49e327);}catch{_0x341e9c[_0x544029(0xa9)](_0x544029(0xab)+_0x49e327+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x2398a7,_0x544029(0xaa));const _0x2e3310=Array[_0x544029(0xac)](_0x2398a7[_0x544029(0x9e)])?_0x2398a7[_0x544029(0x9e)]:[],_0x1f5ab7=new Set(_0x2e3310[_0x544029(0x7f)](_0x420f34=>_0x420f34[_0x544029(0x77)]?.[_0x544029(0xb3)]())),_0x1cdaea=_0x2398a7[_0x544029(0x8d)]?.[_0x544029(0x75)]||_0x2398a7[_0x544029(0x75)]||_0x49e327;_0x5d0846[_0x544029(0x98)+_0x1cdaea]={'code':_0x49e327,'tableName':_0x1cdaea,'fieldCount':_0x1f5ab7['size'],'fields':Array[_0x544029(0x8c)](_0x1f5ab7)};if(_0x15293e){const _0x18a3db=normalizeDatasetIndexes(_0x2398a7);_0x55422a[_0x544029(0xa9)]({'tableName':_0x1cdaea,..._0x18a3db});}}_0x341e9c[_0x544029(0x81)]>0x0&&(_0x5d0846[_0x544029(0x89)]=_0x341e9c),_0x15293e&&(_0x5d0846['joinAudit']=auditSqlJoinIndexes(_0x5eb1a8,_0x55422a));}return{'ok':_0x25d8c2[_0x544029(0x87)],'data':_0x5d0846,'message':_0x25d8c2[_0x544029(0x8f)]};}};function normalizeDatasetIndexes(_0x356dc9){const _0x402a7f=a257_0x3f8810,_0x81e96c=Array[_0x402a7f(0xac)](_0x356dc9?.[_0x402a7f(0xa2)]?.[_0x402a7f(0x82)])?_0x356dc9[_0x402a7f(0xa2)][_0x402a7f(0x82)]:Array[_0x402a7f(0xac)](_0x356dc9?.[_0x402a7f(0x82)])?_0x356dc9[_0x402a7f(0x82)]:[],_0x2abf09=_0x81e96c['flatMap'](_0x5ac596=>{const _0x5d1400=_0x402a7f,_0x2c6a88=Array[_0x5d1400(0xac)](_0x5ac596?.[_0x5d1400(0x86)])?_0x5ac596[_0x5d1400(0x86)]:Array[_0x5d1400(0xac)](_0x5ac596?.['columnNames'])?_0x5ac596[_0x5d1400(0xa5)]:Array[_0x5d1400(0xac)](_0x5ac596?.[_0x5d1400(0x9a)])?_0x5ac596[_0x5d1400(0x9a)]:[],_0x3de440=_0x2c6a88[_0x5d1400(0x93)](_0x176347=>typeof _0x176347==='string')[_0x5d1400(0x7f)](_0x3ff760=>_0x3ff760[_0x5d1400(0x99)]())[_0x5d1400(0x93)](Boolean);if(_0x3de440[_0x5d1400(0x81)]===0x0)return[];const _0x5dba45=[_0x5ac596?.[_0x5d1400(0xa3)],_0x5ac596?.[_0x5d1400(0x96)],_0x5ac596?.['name']]['find'](_0x558c3b=>typeof _0x558c3b===_0x5d1400(0xaf)&&_0x558c3b['trim']()),_0x4730f3=[_0x5ac596?.[_0x5d1400(0x78)],_0x5ac596?.[_0x5d1400(0x7a)]]['find'](_0x48f427=>typeof _0x48f427===_0x5d1400(0xaf)&&_0x48f427[_0x5d1400(0x99)]());return[{..._0x5dba45?{'name':_0x5dba45[_0x5d1400(0x99)]()}:{},..._0x4730f3?{'type':_0x4730f3[_0x5d1400(0x99)]()}:{},'columns':_0x3de440}];}),_0xf5b4=[..._0x2abf09],_0x132466=typeof _0x356dc9?.[_0x402a7f(0x8d)]?.[_0x402a7f(0x76)]==='string'?_0x356dc9[_0x402a7f(0x8d)][_0x402a7f(0x76)][_0x402a7f(0x79)](',')[_0x402a7f(0x7f)](_0x55f0aa=>_0x55f0aa['trim']())[_0x402a7f(0x93)](Boolean):[];return _0x132466[_0x402a7f(0x81)]>0x0&&_0xf5b4[_0x402a7f(0x83)]({'type':'primary','columns':_0x132466}),{'indexes':_0xf5b4,'metadataAvailable':_0x2abf09[_0x402a7f(0x81)]>0x0};}
@@ -1 +1 @@
1
- function a258_0x51bb(_0x324050,_0x9b1597){_0x324050=_0x324050-0x1a3;const _0x9266b1=a258_0x9266();let _0x51bb3c=_0x9266b1[_0x324050];return _0x51bb3c;}function a258_0x9266(){const _0x11c038=['3PbdaNP','7584576CROzKc','45yjosKz','127210KFshpr','12wfoCYZ','84396DPmIkD','89078KrtCgw','13364490sKyyAL','8693937XfCYnU','2029503bmERAJ'];a258_0x9266=function(){return _0x11c038;};return a258_0x9266();}(function(_0x5dd9be,_0x5c5c13){const _0x43dce0=a258_0x51bb,_0x13a612=_0x5dd9be();while(!![]){try{const _0x36a520=parseInt(_0x43dce0(0x1a9))/0x1*(-parseInt(_0x43dce0(0x1a5))/0x2)+-parseInt(_0x43dce0(0x1ab))/0x3*(parseInt(_0x43dce0(0x1a4))/0x4)+parseInt(_0x43dce0(0x1ac))/0x5*(parseInt(_0x43dce0(0x1a3))/0x6)+-parseInt(_0x43dce0(0x1a8))/0x7+-parseInt(_0x43dce0(0x1aa))/0x8+parseInt(_0x43dce0(0x1a7))/0x9+parseInt(_0x43dce0(0x1a6))/0xa;if(_0x36a520===_0x5c5c13)break;else _0x13a612['push'](_0x13a612['shift']());}catch(_0x1b7ac4){_0x13a612['push'](_0x13a612['shift']());}}}(a258_0x9266,0xa2687));import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];
1
+ (function(_0x38c4de,_0x2494e0){const _0x1e423d=a258_0x60aa,_0x38ae64=_0x38c4de();while(!![]){try{const _0x29a473=parseInt(_0x1e423d(0x121))/0x1+parseInt(_0x1e423d(0x120))/0x2*(parseInt(_0x1e423d(0x124))/0x3)+parseInt(_0x1e423d(0x125))/0x4*(parseInt(_0x1e423d(0x127))/0x5)+parseInt(_0x1e423d(0x11f))/0x6+parseInt(_0x1e423d(0x122))/0x7+parseInt(_0x1e423d(0x11e))/0x8+-parseInt(_0x1e423d(0x123))/0x9*(parseInt(_0x1e423d(0x126))/0xa);if(_0x29a473===_0x2494e0)break;else _0x38ae64['push'](_0x38ae64['shift']());}catch(_0x54aa5f){_0x38ae64['push'](_0x38ae64['shift']());}}}(a258_0x23a9,0x5bd58));import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];function a258_0x60aa(_0x227801,_0x42e894){_0x227801=_0x227801-0x11e;const _0x23a988=a258_0x23a9();let _0x60aa2e=_0x23a988[_0x227801];return _0x60aa2e;}function a258_0x23a9(){const _0x34c102=['1539537bHVYAz','76892dyxDLq','4814380nrxtyU','10ZXnTVB','199144rKnMdP','3138138ozdSln','2uEPUXP','310157LkJoCD','2875376WwCACY','27ZPSSCM'];a258_0x23a9=function(){return _0x34c102;};return a258_0x23a9();}
@@ -1 +1 @@
1
- const a259_0x4e49eb=a259_0x547a;(function(_0x353602,_0x538b77){const _0x7579e4=a259_0x547a,_0xfe7241=_0x353602();while(!![]){try{const _0x487eff=-parseInt(_0x7579e4(0x17c))/0x1*(parseInt(_0x7579e4(0x184))/0x2)+parseInt(_0x7579e4(0x18c))/0x3*(-parseInt(_0x7579e4(0x182))/0x4)+-parseInt(_0x7579e4(0x194))/0x5+parseInt(_0x7579e4(0x18f))/0x6*(-parseInt(_0x7579e4(0x186))/0x7)+parseInt(_0x7579e4(0x18e))/0x8+parseInt(_0x7579e4(0x191))/0x9+parseInt(_0x7579e4(0x17a))/0xa;if(_0x487eff===_0x538b77)break;else _0xfe7241['push'](_0xfe7241['shift']());}catch(_0x5265e5){_0xfe7241['push'](_0xfe7241['shift']());}}}(a259_0x36cb,0x486d7));function a259_0x547a(_0x254eb9,_0x517302){_0x254eb9=_0x254eb9-0x17a;const _0x36cbf6=a259_0x36cb();let _0x547a31=_0x36cbf6[_0x254eb9];return _0x547a31;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';function a259_0x36cb(){const _0xa7d0a9=['flagMissing','127464CqZvfV','read','82MgiSOB','task-id','6559uydxiN',',\x20received\x20','compress','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','string','appCode','30MEeYpv','trim','3102632oTrKRX','3768tplcAG','cookie','2463363PJmDcv','apiError','isTerminal','122160PwOVqk','6570190YhinVD','taskId','2204dBOAKg','status','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','task','str'];a259_0x36cb=function(){return _0xa7d0a9;};return a259_0x36cb();}import{CliErrors}from'../../errors.js';export const taskStatus={'service':a259_0x4e49eb(0x17f),'command':a259_0x4e49eb(0x17d),'description':a259_0x4e49eb(0x17e),'risk':a259_0x4e49eb(0x183),'defaultOutputFormat':a259_0x4e49eb(0x188),'structuredErrors':!![],'flags':[{'name':'task-id','type':a259_0x4e49eb(0x18a),'required':!![],'description':a259_0x4e49eb(0x189)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x18a4d8){const _0x531088=a259_0x4e49eb;if(!_0x18a4d8[_0x531088(0x180)](_0x531088(0x185))[_0x531088(0x18d)]())throw CliErrors[_0x531088(0x181)](_0x531088(0x185));},async 'execute'(_0x15f144){const _0x43165a=a259_0x4e49eb,_0x5ed695=_0x15f144[_0x43165a(0x180)](_0x43165a(0x185))[_0x43165a(0x18d)](),_0x587ca6=normalizeAsyncTask(await getAsyncTaskStatus(_0x5ed695,_0x15f144['appCode'],_0x15f144[_0x43165a(0x190)]));if(_0x587ca6['taskId']!==_0x5ed695)throw CliErrors[_0x43165a(0x192)]('Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20'+_0x5ed695+_0x43165a(0x187)+_0x587ca6[_0x43165a(0x17b)]+'.');const _0x2ef527=buildAsyncTaskStatusCommand(_0x587ca6[_0x43165a(0x17b)],_0x15f144[_0x43165a(0x18b)]);return{'ok':!![],'message':asyncTaskMessage(_0x587ca6),'data':{'appCode':_0x15f144[_0x43165a(0x18b)],..._0x587ca6,'query':_0x587ca6[_0x43165a(0x193)]?null:{'command':_0x2ef527}}};}};
1
+ const a259_0x27dcff=a259_0x882b;(function(_0x2e89a7,_0x55e77c){const _0x256439=a259_0x882b,_0x1e5b32=_0x2e89a7();while(!![]){try{const _0x2fdfc7=-parseInt(_0x256439(0x1d4))/0x1*(parseInt(_0x256439(0x1d3))/0x2)+-parseInt(_0x256439(0x1db))/0x3+-parseInt(_0x256439(0x1cf))/0x4*(-parseInt(_0x256439(0x1e7))/0x5)+-parseInt(_0x256439(0x1d5))/0x6+-parseInt(_0x256439(0x1df))/0x7*(parseInt(_0x256439(0x1d7))/0x8)+-parseInt(_0x256439(0x1e6))/0x9+-parseInt(_0x256439(0x1e3))/0xa*(-parseInt(_0x256439(0x1d6))/0xb);if(_0x2fdfc7===_0x55e77c)break;else _0x1e5b32['push'](_0x1e5b32['shift']());}catch(_0xe56910){_0x1e5b32['push'](_0x1e5b32['shift']());}}}(a259_0x13ed,0x2084c));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';function a259_0x13ed(){const _0x4d828d=['49JmOswR','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','appCode','trim','10fgEMiD','isTerminal','task','772029PRrZYN','105QTUFvX','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','31932xIPzGt','apiError','cookie','taskId','16858PynYGK','31sOMRsL','781110CDCYqu','9982291zxmZzw','266032rIOnfW','string','flagMissing','task-id','695655Xeyozm','compress','status','read'];a259_0x13ed=function(){return _0x4d828d;};return a259_0x13ed();}function a259_0x882b(_0x35c2ff,_0xcfbf9c){_0x35c2ff=_0x35c2ff-0x1cf;const _0x13ed71=a259_0x13ed();let _0x882b9f=_0x13ed71[_0x35c2ff];return _0x882b9f;}import{CliErrors}from'../../errors.js';export const taskStatus={'service':a259_0x27dcff(0x1e5),'command':a259_0x27dcff(0x1dd),'description':'Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','risk':a259_0x27dcff(0x1de),'defaultOutputFormat':a259_0x27dcff(0x1dc),'structuredErrors':!![],'flags':[{'name':a259_0x27dcff(0x1da),'type':a259_0x27dcff(0x1d8),'required':!![],'description':a259_0x27dcff(0x1e0)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2807e6){const _0x404ff4=a259_0x27dcff;if(!_0x2807e6['str'](_0x404ff4(0x1da))[_0x404ff4(0x1e2)]())throw CliErrors[_0x404ff4(0x1d9)](_0x404ff4(0x1da));},async 'execute'(_0x2a46f8){const _0x3cc95b=a259_0x27dcff,_0x5c25b6=_0x2a46f8['str']('task-id')[_0x3cc95b(0x1e2)](),_0x5739b7=normalizeAsyncTask(await getAsyncTaskStatus(_0x5c25b6,_0x2a46f8[_0x3cc95b(0x1e1)],_0x2a46f8[_0x3cc95b(0x1d1)]));if(_0x5739b7[_0x3cc95b(0x1d2)]!==_0x5c25b6)throw CliErrors[_0x3cc95b(0x1d0)](_0x3cc95b(0x1e8)+_0x5c25b6+',\x20received\x20'+_0x5739b7[_0x3cc95b(0x1d2)]+'.');const _0x3430aa=buildAsyncTaskStatusCommand(_0x5739b7[_0x3cc95b(0x1d2)],_0x2a46f8[_0x3cc95b(0x1e1)]);return{'ok':!![],'message':asyncTaskMessage(_0x5739b7),'data':{'appCode':_0x2a46f8[_0x3cc95b(0x1e1)],..._0x5739b7,'query':_0x5739b7[_0x3cc95b(0x1e4)]?null:{'command':_0x3430aa}}};}};