@lovrabet/rabetbase-cli 2.5.4-beta.5 → 2.5.4

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 (358) 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/detail.js +1 -1
  77. package/lib/commands/dataset/extend-update.js +1 -1
  78. package/lib/commands/dataset/field-restore.js +1 -1
  79. package/lib/commands/dataset/field-update.js +1 -1
  80. package/lib/commands/dataset/generate.js +1 -1
  81. package/lib/commands/dataset/index.js +1 -1
  82. package/lib/commands/dataset/list.js +1 -1
  83. package/lib/commands/dataset/operations.js +1 -1
  84. package/lib/commands/dataset/relation-audit.js +1 -1
  85. package/lib/commands/dataset/relation-create.js +1 -1
  86. package/lib/commands/dataset/relation-delete.js +1 -1
  87. package/lib/commands/dataset/relation-shared.js +1 -1
  88. package/lib/commands/dataset/relation-update.js +1 -1
  89. package/lib/commands/dataset/relations.js +1 -1
  90. package/lib/commands/dataset/rename.js +1 -1
  91. package/lib/commands/dataset/restore.js +1 -1
  92. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  93. package/lib/commands/db/analysis-batching.js +1 -1
  94. package/lib/commands/db/analyze-batch-plan.js +1 -1
  95. package/lib/commands/db/analyze-cancel.js +1 -1
  96. package/lib/commands/db/analyze-start.js +1 -1
  97. package/lib/commands/db/analyze-status.js +1 -1
  98. package/lib/commands/db/create.js +1 -1
  99. package/lib/commands/db/delete.js +1 -1
  100. package/lib/commands/db/detail.js +1 -1
  101. package/lib/commands/db/diff-refresh-start.js +1 -1
  102. package/lib/commands/db/diff-refresh-status.js +1 -1
  103. package/lib/commands/db/diff.js +1 -1
  104. package/lib/commands/db/index.js +1 -1
  105. package/lib/commands/db/list.js +1 -1
  106. package/lib/commands/db/shared.js +1 -1
  107. package/lib/commands/db/table-diff-shared.js +1 -1
  108. package/lib/commands/db/tables.js +1 -1
  109. package/lib/commands/db/test.js +1 -1
  110. package/lib/commands/db/update.js +1 -1
  111. package/lib/commands/deployment/index.js +1 -1
  112. package/lib/commands/deployment/sync-all.js +1 -1
  113. package/lib/commands/deployment/sync-jobs.js +1 -1
  114. package/lib/commands/deployment/sync-status.js +1 -1
  115. package/lib/commands/doctor.js +1 -1
  116. package/lib/commands/file/index.js +1 -1
  117. package/lib/commands/flow/create.js +1 -1
  118. package/lib/commands/flow/detail.js +1 -1
  119. package/lib/commands/flow/index.js +1 -1
  120. package/lib/commands/flow/list.js +1 -1
  121. package/lib/commands/flow/publish.js +1 -1
  122. package/lib/commands/flow/runtime-resources-shared.js +1 -1
  123. package/lib/commands/flow/runtime-role-list.js +1 -1
  124. package/lib/commands/flow/runtime-role-user-list.js +1 -1
  125. package/lib/commands/flow/runtime-user-search.js +1 -1
  126. package/lib/commands/flow/shared.js +1 -1
  127. package/lib/commands/flow/update.js +1 -1
  128. package/lib/commands/flow/validate.js +1 -1
  129. package/lib/commands/instant-api-policy/current.js +1 -1
  130. package/lib/commands/instant-api-policy/index.js +1 -1
  131. package/lib/commands/instant-api-policy/init.js +1 -1
  132. package/lib/commands/instant-api-policy/publish.js +1 -1
  133. package/lib/commands/instant-api-policy/pull.js +1 -1
  134. package/lib/commands/instant-api-policy/revision.js +1 -1
  135. package/lib/commands/instant-api-policy/revisions.js +1 -1
  136. package/lib/commands/instant-api-policy/rollback.js +1 -1
  137. package/lib/commands/instant-api-policy/shared.js +1 -1
  138. package/lib/commands/instant-api-policy/validate.js +1 -1
  139. package/lib/commands/issue/index.js +1 -1
  140. package/lib/commands/issue/nudge.js +1 -1
  141. package/lib/commands/issue/report.js +1 -1
  142. package/lib/commands/issue/shared.js +1 -1
  143. package/lib/commands/kb/create.js +1 -1
  144. package/lib/commands/kb/delete.js +1 -1
  145. package/lib/commands/kb/detail.js +1 -1
  146. package/lib/commands/kb/index.js +1 -1
  147. package/lib/commands/kb/list.js +1 -1
  148. package/lib/commands/kb/search.js +1 -1
  149. package/lib/commands/kb/shared.js +1 -1
  150. package/lib/commands/kb/update.js +1 -1
  151. package/lib/commands/logs/index.js +1 -1
  152. package/lib/commands/menu/asset-update.js +1 -1
  153. package/lib/commands/menu/delete.js +1 -1
  154. package/lib/commands/menu/external-link-create.js +1 -1
  155. package/lib/commands/menu/external-link-update.js +1 -1
  156. package/lib/commands/menu/group-create.js +1 -1
  157. package/lib/commands/menu/group-update.js +1 -1
  158. package/lib/commands/menu/index.js +1 -1
  159. package/lib/commands/menu/list.js +1 -1
  160. package/lib/commands/menu/move.js +1 -1
  161. package/lib/commands/menu/regroup-start.js +1 -1
  162. package/lib/commands/menu/rename.js +1 -1
  163. package/lib/commands/menu/shared/compare-table.js +1 -1
  164. package/lib/commands/menu/shared/delete-plan.js +1 -1
  165. package/lib/commands/menu/shared/facts.js +1 -1
  166. package/lib/commands/menu/shared/index.js +1 -1
  167. package/lib/commands/menu/shared/inquirer.js +1 -1
  168. package/lib/commands/menu/shared/local-pages.js +1 -1
  169. package/lib/commands/menu/shared/logic.js +1 -1
  170. package/lib/commands/menu/shared/mutations.js +1 -1
  171. package/lib/commands/menu/shared/path.js +1 -1
  172. package/lib/commands/menu/shared/service.js +1 -1
  173. package/lib/commands/menu/shared/subapp-assets.js +1 -1
  174. package/lib/commands/menu/shared/sync-core.js +1 -1
  175. package/lib/commands/menu/shared/update-core.js +1 -1
  176. package/lib/commands/menu/shared/valid-url.js +1 -1
  177. package/lib/commands/menu/subapp-assets-status.js +1 -1
  178. package/lib/commands/menu/subapp-assets-update.js +1 -1
  179. package/lib/commands/menu/sync.js +1 -1
  180. package/lib/commands/menu/visibility-update.js +1 -1
  181. package/lib/commands/notification/config-create.js +1 -1
  182. package/lib/commands/notification/config-delete.js +1 -1
  183. package/lib/commands/notification/config-list.js +1 -1
  184. package/lib/commands/notification/config-update.js +1 -1
  185. package/lib/commands/notification/index.js +1 -1
  186. package/lib/commands/notification/shared.js +1 -1
  187. package/lib/commands/ocr/index.js +1 -1
  188. package/lib/commands/page/create.js +1 -1
  189. package/lib/commands/page/custom/detail.js +1 -1
  190. package/lib/commands/page/custom/list.js +1 -1
  191. package/lib/commands/page/custom/publish.js +1 -1
  192. package/lib/commands/page/custom/shared.js +1 -1
  193. package/lib/commands/page/custom/syntax.js +1 -1
  194. package/lib/commands/page/custom/update.js +1 -1
  195. package/lib/commands/page/data-list-status.js +1 -1
  196. package/lib/commands/page/generate-start.js +1 -1
  197. package/lib/commands/page/generate-status.js +1 -1
  198. package/lib/commands/page/index.js +1 -1
  199. package/lib/commands/page/pull.js +1 -1
  200. package/lib/commands/page/push.js +1 -1
  201. package/lib/commands/page/relation-audit.js +1 -1
  202. package/lib/commands/page/restore.js +1 -1
  203. package/lib/commands/page/shared.js +1 -1
  204. package/lib/commands/page/sync.js +1 -1
  205. package/lib/commands/project/api-architecture-upgrade.js +1 -1
  206. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  207. package/lib/commands/project/create/format-elapsed.js +1 -1
  208. package/lib/commands/project/create/main.js +1 -1
  209. package/lib/commands/project/create/materialize-project-template.js +1 -1
  210. package/lib/commands/project/create/project-name.js +1 -1
  211. package/lib/commands/project/create/project-template-archive.js +1 -1
  212. package/lib/commands/project/create/project-template-path.js +1 -1
  213. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  214. package/lib/commands/project/create/use-format-code.js +1 -1
  215. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  216. package/lib/commands/project/domain-routing-sync.js +1 -1
  217. package/lib/commands/project/index.js +1 -1
  218. package/lib/commands/project/upgrade.js +1 -1
  219. package/lib/commands/registry.js +1 -1
  220. package/lib/commands/role/delete.js +1 -1
  221. package/lib/commands/role/detail.js +1 -1
  222. package/lib/commands/role/index.js +1 -1
  223. package/lib/commands/role/list.js +1 -1
  224. package/lib/commands/role/shared.js +1 -1
  225. package/lib/commands/role/update.js +1 -1
  226. package/lib/commands/role/user-add.js +1 -1
  227. package/lib/commands/role/user-remove.js +1 -1
  228. package/lib/commands/role/user-resolve.js +1 -1
  229. package/lib/commands/rule/get.js +1 -1
  230. package/lib/commands/rule/index.js +1 -1
  231. package/lib/commands/rule/list.js +1 -1
  232. package/lib/commands/rule/set.js +1 -1
  233. package/lib/commands/rule/shared.js +1 -1
  234. package/lib/commands/run/index.js +1 -1
  235. package/lib/commands/schema.js +1 -1
  236. package/lib/commands/sql/create.js +1 -1
  237. package/lib/commands/sql/delete.js +1 -1
  238. package/lib/commands/sql/detail.js +1 -1
  239. package/lib/commands/sql/exec.js +1 -1
  240. package/lib/commands/sql/index.js +1 -1
  241. package/lib/commands/sql/list.js +1 -1
  242. package/lib/commands/sql/pull.js +1 -1
  243. package/lib/commands/sql/push.js +1 -1
  244. package/lib/commands/sql/shared.js +1 -1
  245. package/lib/commands/sql/status.js +1 -1
  246. package/lib/commands/sql/validate.js +1 -1
  247. package/lib/commands/task/index.js +1 -1
  248. package/lib/commands/task/status.js +1 -1
  249. package/lib/commands/tenant/index.js +1 -1
  250. package/lib/commands/tenant/members-list.js +1 -1
  251. package/lib/commands/tenant/shared.js +1 -1
  252. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  253. package/lib/commands/user-account/feishu-bind.js +1 -1
  254. package/lib/commands/user-account/index.js +1 -1
  255. package/lib/commands/workspace/add.js +1 -1
  256. package/lib/commands/workspace/index.js +1 -1
  257. package/lib/commands/workspace/remove.js +1 -1
  258. package/lib/config/domain-config.js +1 -1
  259. package/lib/config/project-domain-routing.js +1 -1
  260. package/lib/config/region-config.js +1 -1
  261. package/lib/config/schema.js +1 -1
  262. package/lib/constant/cdn.js +1 -1
  263. package/lib/constant/cli.js +1 -1
  264. package/lib/constant/defaults.js +1 -1
  265. package/lib/constant/domain.js +1 -1
  266. package/lib/constant/env.js +1 -1
  267. package/lib/constant/output.js +1 -1
  268. package/lib/constant/paths.js +1 -1
  269. package/lib/constant/region.js +1 -1
  270. package/lib/constant/risk.js +1 -1
  271. package/lib/constant/routing-profile.js +1 -1
  272. package/lib/context/app-resolver.js +1 -1
  273. package/lib/context/auth-resolver.js +1 -1
  274. package/lib/context/config-loader.js +1 -1
  275. package/lib/context.js +1 -1
  276. package/lib/core/alias-resolver.js +1 -1
  277. package/lib/core/api-client.js +1 -1
  278. package/lib/core/bff/config.js +1 -1
  279. package/lib/core/bff/file-system.js +1 -1
  280. package/lib/core/bff/hash.js +1 -1
  281. package/lib/core/bff/hook-directory.js +1 -1
  282. package/lib/core/bff/lock.js +1 -1
  283. package/lib/core/bff/utils.js +1 -1
  284. package/lib/core/cross-db-relation.js +1 -1
  285. package/lib/core/db-resolver.js +1 -1
  286. package/lib/core/flow-config.js +1 -1
  287. package/lib/core/instant-api-policy/config.js +1 -1
  288. package/lib/core/kb-search-client.js +1 -1
  289. package/lib/core/page/file-system.js +1 -1
  290. package/lib/core/page/hash.js +1 -1
  291. package/lib/core/page/lock.js +1 -1
  292. package/lib/core/page/lr-smart-jsx.js +1 -1
  293. package/lib/core/sql-index-auditor.js +1 -1
  294. package/lib/core/sql-sync/config.js +1 -1
  295. package/lib/core/sql-sync/file-system.js +1 -1
  296. package/lib/core/sql-sync/hash.js +1 -1
  297. package/lib/core/sql-sync/lock.js +1 -1
  298. package/lib/core/sql-sync/utils.js +1 -1
  299. package/lib/core/sql-validator.js +1 -1
  300. package/lib/errors.js +1 -1
  301. package/lib/framework/build-all-flags.js +1 -1
  302. package/lib/framework/error-output.js +1 -1
  303. package/lib/framework/explicit-yes.js +1 -1
  304. package/lib/framework/flags.js +1 -1
  305. package/lib/framework/help.js +1 -1
  306. package/lib/framework/index.js +1 -1
  307. package/lib/framework/output.js +1 -1
  308. package/lib/framework/response.js +1 -1
  309. package/lib/framework/runner-alias.js +1 -1
  310. package/lib/framework/runner.js +1 -1
  311. package/lib/framework/schema-export.js +1 -1
  312. package/lib/framework/supported-flags.js +1 -1
  313. package/lib/framework/types.js +1 -1
  314. package/lib/generated/build-info.d.ts +4 -4
  315. package/lib/generated/build-info.js +1 -1
  316. package/lib/generated/official-routing.js +1 -1
  317. package/lib/generated/routing-contract.js +1 -1
  318. package/lib/help.js +1 -1
  319. package/lib/postinstall.js +1 -1
  320. package/lib/runtime/confirmation.js +1 -1
  321. package/lib/runtime/event.js +1 -1
  322. package/lib/runtime/index.js +1 -1
  323. package/lib/runtime/queue.js +1 -1
  324. package/lib/runtime/resolve.js +1 -1
  325. package/lib/skills/builtin-skill.js +1 -1
  326. package/lib/skills/main.js +1 -1
  327. package/lib/skills/npx-skills-add.js +1 -1
  328. package/lib/skills/skill-presence.js +1 -1
  329. package/lib/telemetry/cli-command-trace.js +1 -1
  330. package/lib/telemetry/cli-help-trace.js +1 -1
  331. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  332. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  333. package/lib/telemetry/send-cli-trace-log.js +1 -1
  334. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  335. package/lib/utils/ai_config.js +1 -1
  336. package/lib/utils/apply-jq-filter.js +1 -1
  337. package/lib/utils/cdn-config.js +1 -1
  338. package/lib/utils/check-sdk-version.js +1 -1
  339. package/lib/utils/cli-version-check.js +1 -1
  340. package/lib/utils/cli-version-policy.js +1 -1
  341. package/lib/utils/config.js +1 -1
  342. package/lib/utils/entity-with-id.js +1 -1
  343. package/lib/utils/file-utils.js +1 -1
  344. package/lib/utils/guides-cdn.js +1 -1
  345. package/lib/utils/http-client.js +1 -1
  346. package/lib/utils/is-non-interactive.js +1 -1
  347. package/lib/utils/logger.js +1 -1
  348. package/lib/utils/params.js +1 -1
  349. package/lib/utils/platform.js +1 -1
  350. package/lib/utils/sleep.js +1 -1
  351. package/lib/utils/template-replacer.js +1 -1
  352. package/lib/utils/update-notice.js +1 -1
  353. package/lib/utils/version.js +1 -1
  354. package/lib/utils/with-active-cookie.js +1 -1
  355. package/lib/utils/write-cli-side-channel.js +1 -1
  356. package/package.json +1 -1
  357. package/skills/rabetbase/SKILL.md +1 -1
  358. package/skills/rabetbase.manifest.json +3 -3
@@ -1 +1 @@
1
- function a231_0x3e0b(_0x4222e8,_0x13ac16){_0x4222e8=_0x4222e8-0x1c0;const _0x4e9601=a231_0x4e96();let _0x3e0b39=_0x4e9601[_0x4222e8];return _0x3e0b39;}const a231_0x4a0f7d=a231_0x3e0b;function a231_0x4e96(){const _0x1773a9=['5089536hQwtSt','3534984fgjciz','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','list','3519425rROVkK','43511430IPDFXl','all','8NZNJUp','103245LihtJc','3xnyyYo','9wSceVc','7121100wFxQkn','map','734834EgVAOg','read','length'];a231_0x4e96=function(){return _0x1773a9;};return a231_0x4e96();}(function(_0x2087a5,_0x459727){const _0x34d181=a231_0x3e0b,_0x583373=_0x2087a5();while(!![]){try{const _0x1638c8=parseInt(_0x34d181(0x1cf))/0x1*(-parseInt(_0x34d181(0x1c3))/0x2)+-parseInt(_0x34d181(0x1ce))/0x3*(parseInt(_0x34d181(0x1cd))/0x4)+-parseInt(_0x34d181(0x1c1))/0x5+-parseInt(_0x34d181(0x1c6))/0x6+-parseInt(_0x34d181(0x1ca))/0x7+parseInt(_0x34d181(0x1c7))/0x8+parseInt(_0x34d181(0x1c0))/0x9*(parseInt(_0x34d181(0x1cb))/0xa);if(_0x1638c8===_0x459727)break;else _0x583373['push'](_0x583373['shift']());}catch(_0x1e07d4){_0x583373['push'](_0x583373['shift']());}}}(a231_0x4e96,0xceb5c));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':'rule','command':a231_0x4a0f7d(0x1c9),'description':a231_0x4a0f7d(0x1c8),'risk':a231_0x4a0f7d(0x1c4),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x518e44){const _0x256435=a231_0x4a0f7d,_0x26e771=await Promise[_0x256435(0x1cc)](APP_RULE_TYPES['map'](_0x2b0c1c=>getAppRule(_0x518e44['cookie'],{'appCode':_0x518e44['appCode'],'type':_0x2b0c1c}))),_0x4b6fd9=APP_RULE_TYPES[_0x256435(0x1c2)]((_0x14f26f,_0x51b65f)=>projectAppRule(_0x14f26f,_0x26e771[_0x51b65f]??null));return{'ok':!![],'data':{'total':_0x4b6fd9[_0x256435(0x1c5)],'rules':_0x4b6fd9},'message':'Loaded\x20app\x20rule\x20configuration\x20for\x20'+_0x518e44['appCode']};}};
1
+ const a231_0x4f8345=a231_0x8b23;function a231_0x8b23(_0x3782e6,_0x37e2d4){_0x3782e6=_0x3782e6-0x72;const _0x5002ba=a231_0x5002();let _0x8b232b=_0x5002ba[_0x3782e6];return _0x8b232b;}(function(_0x5a564a,_0x2306d2){const _0x5d60ae=a231_0x8b23,_0x32d65c=_0x5a564a();while(!![]){try{const _0x2c2bdc=parseInt(_0x5d60ae(0x7b))/0x1+parseInt(_0x5d60ae(0x7a))/0x2*(-parseInt(_0x5d60ae(0x75))/0x3)+-parseInt(_0x5d60ae(0x80))/0x4*(parseInt(_0x5d60ae(0x74))/0x5)+parseInt(_0x5d60ae(0x7c))/0x6+parseInt(_0x5d60ae(0x7d))/0x7+-parseInt(_0x5d60ae(0x7f))/0x8*(parseInt(_0x5d60ae(0x79))/0x9)+parseInt(_0x5d60ae(0x7e))/0xa*(-parseInt(_0x5d60ae(0x84))/0xb);if(_0x2c2bdc===_0x2306d2)break;else _0x32d65c['push'](_0x32d65c['shift']());}catch(_0x29b680){_0x32d65c['push'](_0x32d65c['shift']());}}}(a231_0x5002,0x5062a));import{getAppRule}from'../../core/api-client.js';function a231_0x5002(){const _0x3ad577=['all','Loaded\x20app\x20rule\x20configuration\x20for\x20','4653nmXxZn','104086VzYiWK','576738PwKOCH','2528574CMyjLS','3721207FXxPZN','150BlpSnp','4768ElyHbF','1309908OkCDkX','appCode','rule','read','337931YlCncI','cookie','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','5ETVRFL','6FzYkxE','length'];a231_0x5002=function(){return _0x3ad577;};return a231_0x5002();}import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':a231_0x4f8345(0x82),'command':'list','description':a231_0x4f8345(0x73),'risk':a231_0x4f8345(0x83),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x31907e){const _0x3fd99e=a231_0x4f8345,_0x499eb6=await Promise[_0x3fd99e(0x77)](APP_RULE_TYPES['map'](_0x3859b8=>getAppRule(_0x31907e[_0x3fd99e(0x72)],{'appCode':_0x31907e[_0x3fd99e(0x81)],'type':_0x3859b8}))),_0x3e832c=APP_RULE_TYPES['map']((_0x1b15b6,_0x5c8a82)=>projectAppRule(_0x1b15b6,_0x499eb6[_0x5c8a82]??null));return{'ok':!![],'data':{'total':_0x3e832c[_0x3fd99e(0x76)],'rules':_0x3e832c},'message':_0x3fd99e(0x78)+_0x31907e[_0x3fd99e(0x81)]};}};
@@ -1 +1 @@
1
- const a232_0xabb6ce=a232_0x1577;(function(_0x444b9a,_0x5201b8){const _0x59d7c6=a232_0x1577,_0xccab0c=_0x444b9a();while(!![]){try{const _0x1167cc=parseInt(_0x59d7c6(0x149))/0x1+-parseInt(_0x59d7c6(0x139))/0x2+-parseInt(_0x59d7c6(0x144))/0x3+parseInt(_0x59d7c6(0x12e))/0x4*(-parseInt(_0x59d7c6(0x157))/0x5)+parseInt(_0x59d7c6(0x143))/0x6+-parseInt(_0x59d7c6(0x163))/0x7+parseInt(_0x59d7c6(0x162))/0x8;if(_0x1167cc===_0x5201b8)break;else _0xccab0c['push'](_0xccab0c['shift']());}catch(_0xba0b20){_0xccab0c['push'](_0xccab0c['shift']());}}}(a232_0x127f,0xb25b6));import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';function a232_0x127f(){const _0x370ad7=['rules','1171484euQskD','app_rule_verification_failed','number','planned','app_rule_set_outcome_unknown','cause','flag','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','Expected\x20','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','830054UcyduU','The\x20set\x20request\x20was\x20sent,\x20but\x20','byteSize','rule','\x20version\x20changed\x20before\x20write.','POST','expectedVersion','beforeRecord','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','type','6634230PdZQsp','2233719QBAvTq','file','string','str','trim','142235qGOScn','content','app_rule_verification_unavailable','--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','replacement','contentHash','defineProperty','app_rule_expected_version_invalid','Pass\x20a\x20UTF-8\x20Markdown\x20file.','app_rule_version_mismatch','input','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','cookie','5vTDwSs','unconfigured','rabetbase\x20rule\x20get\x20--type\x20','version','appCode','push','--file\x20is\x20required.','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.',';\x20current\x20version\x20is\x20','set','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','18207776kHzRJT','9386237vALBTj','expected-version','before','app_rule_file_required','\x20--format\x20compress'];a232_0x127f=function(){return _0x370ad7;};return a232_0x127f();}function a232_0x1577(_0x2366b0,_0x344692){_0x2366b0=_0x2366b0-0x12b;const _0x127f20=a232_0x127f();let _0x15774b=_0x127f20[_0x2366b0];return _0x15774b;}const SAVE_PATH='/smartapi/knowledge-base/save',NON_ATOMIC_WARNING=a232_0xabb6ce(0x14c);function readSetInput(_0x2c2921){const _0x20507a=a232_0xabb6ce,_0x4945fe=readAppRuleType(_0x2c2921),_0x3752ee=_0x2c2921[_0x20507a(0x147)](_0x20507a(0x145))[_0x20507a(0x148)]();if(!_0x3752ee)throw appRuleError(_0x20507a(0x12b),_0x20507a(0x15d),_0x20507a(0x152));const _0xbfa3d7=_0x2c2921[_0x20507a(0x134)](_0x20507a(0x164));let _0x598e38;if(_0xbfa3d7!==undefined){_0x598e38=Number(_0xbfa3d7);if(!Number['isSafeInteger'](_0x598e38)||_0x598e38<0x0)throw appRuleError(_0x20507a(0x151),_0x20507a(0x136));}return{'type':_0x4945fe,'file':_0x3752ee,'expectedVersion':_0x598e38};}async function prepareSet(_0x5d0be9){const _0x4db0ec=a232_0xabb6ce,_0x3c57af=readSetInput(_0x5d0be9),_0x5e2229=await readAppRuleFile(_0x3c57af['file']),_0x3e16bc=await getAppRule(_0x5d0be9[_0x4db0ec(0x156)],{'appCode':_0x5d0be9[_0x4db0ec(0x15b)],'type':_0x3c57af[_0x4db0ec(0x142)]});if(_0x3c57af[_0x4db0ec(0x13f)]!==undefined&&_0x3e16bc?.[_0x4db0ec(0x15a)]!==_0x3c57af[_0x4db0ec(0x13f)])throw appRuleError(_0x4db0ec(0x153),appRuleFileName(_0x3c57af[_0x4db0ec(0x142)])+_0x4db0ec(0x13d),_0x4db0ec(0x137)+_0x3c57af[_0x4db0ec(0x13f)]+_0x4db0ec(0x15f)+(_0x3e16bc?.[_0x4db0ec(0x15a)]??_0x4db0ec(0x158))+_0x4db0ec(0x135));return{'input':_0x3c57af,'replacement':_0x5e2229,'beforeRecord':_0x3e16bc,'before':projectAppRule(_0x3c57af[_0x4db0ec(0x142)],_0x3e16bc),'planned':{'type':_0x3c57af[_0x4db0ec(0x142)],'fileName':appRuleFileName(_0x3c57af[_0x4db0ec(0x142)]),'contextScope':appRuleContextScope(_0x3c57af['type']),'enabled':!![],'appCode':_0x5d0be9[_0x4db0ec(0x15b)],'scope':_0x4db0ec(0x12d),'contentByteSize':_0x5e2229[_0x4db0ec(0x13b)],'contentHash':_0x5e2229[_0x4db0ec(0x14f)]}};}function warningsFor(_0x2b00b0){return _0x2b00b0===undefined?[]:[NON_ATOMIC_WARNING];}export const ruleSet={'service':a232_0xabb6ce(0x13c),'command':a232_0xabb6ce(0x160),'description':a232_0xabb6ce(0x161),'risk':'write','requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a232_0xabb6ce(0x145),'type':a232_0xabb6ce(0x146),'required':!![],'description':'UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)'},{'name':'expected-version','type':a232_0xabb6ce(0x130),'required':![],'description':'Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version'}],async 'validate'(_0x2d1582){readSetInput(_0x2d1582);},async 'dryRun'(_0x16b753){const _0x286dd2=a232_0xabb6ce,_0x46ca0a=await prepareSet(_0x16b753);return asDryRunResult({'operation':'set','selector':{'appCode':_0x16b753[_0x286dd2(0x15b)],'scope':_0x286dd2(0x12d),'type':_0x46ca0a[_0x286dd2(0x154)][_0x286dd2(0x142)]},'before':_0x46ca0a[_0x286dd2(0x165)],'after':_0x46ca0a[_0x286dd2(0x131)],'dryRun':!![],'backend':{'method':_0x286dd2(0x13e),'path':SAVE_PATH},'warnings':warningsFor(_0x46ca0a[_0x286dd2(0x154)][_0x286dd2(0x13f)]),'verification':{'expectedVersion':_0x46ca0a[_0x286dd2(0x154)]['expectedVersion']??null,'atomicCompareAndSet':![],'lookupCommand':_0x286dd2(0x159)+_0x46ca0a[_0x286dd2(0x154)][_0x286dd2(0x142)]+'\x20--format\x20compress'}},{'method':'POST','url':SAVE_PATH});},async 'execute'(_0x2c016c){const _0x4dcb64=a232_0xabb6ce,_0x244f1a=await prepareSet(_0x2c016c);let _0x170348=![];try{await saveAppRule(_0x2c016c[_0x4dcb64(0x156)],{'appCode':_0x2c016c['appCode'],'type':_0x244f1a[_0x4dcb64(0x154)][_0x4dcb64(0x142)],'content':_0x244f1a[_0x4dcb64(0x14e)][_0x4dcb64(0x14a)]});}catch(_0x516896){if(!isPlatformTransportFailure(_0x516896))throw _0x516896;_0x170348=!![];}let _0x5b5a3d;try{_0x5b5a3d=await getAppRule(_0x2c016c[_0x4dcb64(0x156)],{'appCode':_0x2c016c[_0x4dcb64(0x15b)],'type':_0x244f1a[_0x4dcb64(0x154)][_0x4dcb64(0x142)]});}catch(_0xbb2807){const _0x18406a=appRuleError(_0x170348?_0x4dcb64(0x132):_0x4dcb64(0x14b),_0x4dcb64(0x13a)+appRuleFileName(_0x244f1a[_0x4dcb64(0x154)][_0x4dcb64(0x142)])+'\x20could\x20not\x20be\x20verified.',_0x4dcb64(0x155));Object[_0x4dcb64(0x150)](_0x18406a,_0x4dcb64(0x133),{'value':_0xbb2807,'enumerable':![]});throw _0x18406a;}const _0x56f00b=_0x5b5a3d&&inspectAppRuleContent(_0x5b5a3d[_0x4dcb64(0x14a)])[_0x4dcb64(0x14f)]===_0x244f1a[_0x4dcb64(0x14e)][_0x4dcb64(0x14f)],_0x4fb2d2=_0x5b5a3d&&(_0x244f1a[_0x4dcb64(0x140)]===null||_0x5b5a3d['version']>_0x244f1a[_0x4dcb64(0x140)][_0x4dcb64(0x15a)]);if(!_0x5b5a3d||!_0x56f00b||!_0x4fb2d2)throw appRuleError(_0x170348?_0x4dcb64(0x132):_0x4dcb64(0x12f),appRuleFileName(_0x244f1a['input'][_0x4dcb64(0x142)])+_0x4dcb64(0x14d),_0x4dcb64(0x141)+_0x244f1a['input'][_0x4dcb64(0x142)]+_0x4dcb64(0x15e));const _0x576850=warningsFor(_0x244f1a['input'][_0x4dcb64(0x13f)]);_0x170348&&_0x576850[_0x4dcb64(0x15c)](_0x4dcb64(0x138));const _0x5a0124=projectAppRule(_0x244f1a[_0x4dcb64(0x154)]['type'],_0x5b5a3d);return{'ok':!![],'data':{'operation':_0x4dcb64(0x160),'selector':{'appCode':_0x2c016c['appCode'],'scope':'rules','type':_0x244f1a['input'][_0x4dcb64(0x142)]},'before':_0x244f1a[_0x4dcb64(0x165)],'after':_0x5a0124,'dryRun':![],'backend':{'method':_0x4dcb64(0x13e),'path':SAVE_PATH},'warnings':_0x576850,'verification':{'status':'verified','recoveredAfterUnknownResponse':_0x170348,'expectedVersion':_0x244f1a['input'][_0x4dcb64(0x13f)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x4dcb64(0x159)+_0x244f1a[_0x4dcb64(0x154)][_0x4dcb64(0x142)]+_0x4dcb64(0x12c)}},'message':'Set\x20'+appRuleFileName(_0x244f1a[_0x4dcb64(0x154)][_0x4dcb64(0x142)])+'\x20for\x20'+_0x2c016c[_0x4dcb64(0x15b)]};}};
1
+ const a232_0x4bf09e=a232_0x2801;function a232_0x2801(_0x53fe50,_0x54e131){_0x53fe50=_0x53fe50-0xcd;const _0x4aa26c=a232_0x4aa2();let _0x2801af=_0x4aa26c[_0x53fe50];return _0x2801af;}(function(_0xada9e,_0x29add9){const _0x58357a=a232_0x2801,_0x4d7c6f=_0xada9e();while(!![]){try{const _0x4bd29e=-parseInt(_0x58357a(0xcd))/0x1+parseInt(_0x58357a(0xdc))/0x2*(parseInt(_0x58357a(0xd6))/0x3)+parseInt(_0x58357a(0x101))/0x4*(-parseInt(_0x58357a(0xf3))/0x5)+-parseInt(_0x58357a(0xe2))/0x6+parseInt(_0x58357a(0xfd))/0x7+parseInt(_0x58357a(0xce))/0x8+parseInt(_0x58357a(0x104))/0x9;if(_0x4bd29e===_0x29add9)break;else _0x4d7c6f['push'](_0x4d7c6f['shift']());}catch(_0x23475a){_0x4d7c6f['push'](_0x4d7c6f['shift']());}}}(a232_0x4aa2,0xb897c));import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';const SAVE_PATH=a232_0x4bf09e(0xd1),NON_ATOMIC_WARNING=a232_0x4bf09e(0xe7);function readSetInput(_0x5ee6a7){const _0x40e0e7=a232_0x4bf09e,_0x44782b=readAppRuleType(_0x5ee6a7),_0x4c1747=_0x5ee6a7[_0x40e0e7(0xf9)](_0x40e0e7(0xd2))[_0x40e0e7(0xe6)]();if(!_0x4c1747)throw appRuleError(_0x40e0e7(0x102),_0x40e0e7(0xf7),'Pass\x20a\x20UTF-8\x20Markdown\x20file.');const _0x363b0a=_0x5ee6a7[_0x40e0e7(0xfa)](_0x40e0e7(0xe4));let _0x116135;if(_0x363b0a!==undefined){_0x116135=Number(_0x363b0a);if(!Number['isSafeInteger'](_0x116135)||_0x116135<0x0)throw appRuleError(_0x40e0e7(0xe0),_0x40e0e7(0xf1));}return{'type':_0x44782b,'file':_0x4c1747,'expectedVersion':_0x116135};}function a232_0x4aa2(){const _0x3ca7a4=['trim','--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.','verified','replacement','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','app_rule_set_outcome_unknown','\x20version\x20changed\x20before\x20write.','Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version','version','UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)','rules','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','unconfigured','5wkdZyV','defineProperty','contentHash','POST','--file\x20is\x20required.','set','str','flag','type','rabetbase\x20rule\x20get\x20--type\x20','8841889eSFVuT','cause','number','push','3242584XBWfZa','app_rule_file_required','appCode','11940633yzhzgZ','planned','1045913ZWnTHD','6005968JeCVGq','\x20--format\x20compress','\x20for\x20','/smartapi/knowledge-base/save','file','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','cookie','app_rule_verification_failed','9777LdjYQx','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','expectedVersion','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','string','136qFHVjD','app_rule_version_mismatch',';\x20current\x20version\x20is\x20','before','app_rule_expected_version_invalid','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','5697426tnpWGD','input','expected-version','content'];a232_0x4aa2=function(){return _0x3ca7a4;};return a232_0x4aa2();}async function prepareSet(_0x4d76d8){const _0x53837d=a232_0x4bf09e,_0x40d70c=readSetInput(_0x4d76d8),_0x11c442=await readAppRuleFile(_0x40d70c[_0x53837d(0xd2)]),_0x5bd628=await getAppRule(_0x4d76d8[_0x53837d(0xd4)],{'appCode':_0x4d76d8[_0x53837d(0x103)],'type':_0x40d70c[_0x53837d(0xfb)]});if(_0x40d70c['expectedVersion']!==undefined&&_0x5bd628?.[_0x53837d(0xee)]!==_0x40d70c[_0x53837d(0xd9)])throw appRuleError(_0x53837d(0xdd),appRuleFileName(_0x40d70c[_0x53837d(0xfb)])+_0x53837d(0xec),'Expected\x20'+_0x40d70c[_0x53837d(0xd9)]+_0x53837d(0xde)+(_0x5bd628?.[_0x53837d(0xee)]??_0x53837d(0xf2))+'.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.');return{'input':_0x40d70c,'replacement':_0x11c442,'beforeRecord':_0x5bd628,'before':projectAppRule(_0x40d70c['type'],_0x5bd628),'planned':{'type':_0x40d70c[_0x53837d(0xfb)],'fileName':appRuleFileName(_0x40d70c[_0x53837d(0xfb)]),'contextScope':appRuleContextScope(_0x40d70c['type']),'enabled':!![],'appCode':_0x4d76d8['appCode'],'scope':'rules','contentByteSize':_0x11c442['byteSize'],'contentHash':_0x11c442[_0x53837d(0xf5)]}};}function warningsFor(_0x319a88){return _0x319a88===undefined?[]:[NON_ATOMIC_WARNING];}export const ruleSet={'service':'rule','command':'set','description':a232_0x4bf09e(0xd7),'risk':'write','requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a232_0x4bf09e(0xd2),'type':a232_0x4bf09e(0xdb),'required':!![],'description':a232_0x4bf09e(0xef)},{'name':'expected-version','type':a232_0x4bf09e(0xff),'required':![],'description':a232_0x4bf09e(0xed)}],async 'validate'(_0x15073f){readSetInput(_0x15073f);},async 'dryRun'(_0x1cda51){const _0x6da87a=a232_0x4bf09e,_0x500d7e=await prepareSet(_0x1cda51);return asDryRunResult({'operation':_0x6da87a(0xf8),'selector':{'appCode':_0x1cda51['appCode'],'scope':_0x6da87a(0xf0),'type':_0x500d7e['input'][_0x6da87a(0xfb)]},'before':_0x500d7e[_0x6da87a(0xdf)],'after':_0x500d7e[_0x6da87a(0x105)],'dryRun':!![],'backend':{'method':_0x6da87a(0xf6),'path':SAVE_PATH},'warnings':warningsFor(_0x500d7e[_0x6da87a(0xe3)]['expectedVersion']),'verification':{'expectedVersion':_0x500d7e[_0x6da87a(0xe3)][_0x6da87a(0xd9)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x6da87a(0xfc)+_0x500d7e[_0x6da87a(0xe3)]['type']+'\x20--format\x20compress'}},{'method':_0x6da87a(0xf6),'url':SAVE_PATH});},async 'execute'(_0x23d724){const _0x26fde7=a232_0x4bf09e,_0x720555=await prepareSet(_0x23d724);let _0xa65b12=![];try{await saveAppRule(_0x23d724[_0x26fde7(0xd4)],{'appCode':_0x23d724['appCode'],'type':_0x720555[_0x26fde7(0xe3)]['type'],'content':_0x720555['replacement'][_0x26fde7(0xe5)]});}catch(_0xe8de4c){if(!isPlatformTransportFailure(_0xe8de4c))throw _0xe8de4c;_0xa65b12=!![];}let _0x172699;try{_0x172699=await getAppRule(_0x23d724[_0x26fde7(0xd4)],{'appCode':_0x23d724[_0x26fde7(0x103)],'type':_0x720555['input']['type']});}catch(_0x5e8a36){const _0xf51787=appRuleError(_0xa65b12?_0x26fde7(0xeb):'app_rule_verification_unavailable','The\x20set\x20request\x20was\x20sent,\x20but\x20'+appRuleFileName(_0x720555[_0x26fde7(0xe3)][_0x26fde7(0xfb)])+'\x20could\x20not\x20be\x20verified.',_0x26fde7(0xd3));Object[_0x26fde7(0xf4)](_0xf51787,_0x26fde7(0xfe),{'value':_0x5e8a36,'enumerable':![]});throw _0xf51787;}const _0x4e47c8=_0x172699&&inspectAppRuleContent(_0x172699['content'])[_0x26fde7(0xf5)]===_0x720555[_0x26fde7(0xe9)]['contentHash'],_0x166185=_0x172699&&(_0x720555['beforeRecord']===null||_0x172699['version']>_0x720555['beforeRecord'][_0x26fde7(0xee)]);if(!_0x172699||!_0x4e47c8||!_0x166185)throw appRuleError(_0xa65b12?_0x26fde7(0xeb):_0x26fde7(0xd5),appRuleFileName(_0x720555[_0x26fde7(0xe3)][_0x26fde7(0xfb)])+_0x26fde7(0xd8),_0x26fde7(0xda)+_0x720555[_0x26fde7(0xe3)][_0x26fde7(0xfb)]+_0x26fde7(0xe1));const _0x440520=warningsFor(_0x720555['input'][_0x26fde7(0xd9)]);_0xa65b12&&_0x440520[_0x26fde7(0x100)](_0x26fde7(0xea));const _0x155f96=projectAppRule(_0x720555[_0x26fde7(0xe3)]['type'],_0x172699);return{'ok':!![],'data':{'operation':'set','selector':{'appCode':_0x23d724[_0x26fde7(0x103)],'scope':_0x26fde7(0xf0),'type':_0x720555[_0x26fde7(0xe3)]['type']},'before':_0x720555['before'],'after':_0x155f96,'dryRun':![],'backend':{'method':_0x26fde7(0xf6),'path':SAVE_PATH},'warnings':_0x440520,'verification':{'status':_0x26fde7(0xe8),'recoveredAfterUnknownResponse':_0xa65b12,'expectedVersion':_0x720555[_0x26fde7(0xe3)]['expectedVersion']??null,'atomicCompareAndSet':![],'lookupCommand':_0x26fde7(0xfc)+_0x720555[_0x26fde7(0xe3)][_0x26fde7(0xfb)]+_0x26fde7(0xcf)}},'message':'Set\x20'+appRuleFileName(_0x720555['input'][_0x26fde7(0xfb)])+_0x26fde7(0xd0)+_0x23d724[_0x26fde7(0x103)]};}};
@@ -1 +1 @@
1
- const a233_0x3ff7ab=a233_0x315b;(function(_0x58bb6b,_0x1d1e3f){const _0x5081ad=a233_0x315b,_0x30594e=_0x58bb6b();while(!![]){try{const _0x426222=parseInt(_0x5081ad(0x86))/0x1+-parseInt(_0x5081ad(0x8b))/0x2*(parseInt(_0x5081ad(0x76))/0x3)+-parseInt(_0x5081ad(0x94))/0x4+-parseInt(_0x5081ad(0x81))/0x5+-parseInt(_0x5081ad(0x98))/0x6*(-parseInt(_0x5081ad(0x7f))/0x7)+-parseInt(_0x5081ad(0x7e))/0x8+parseInt(_0x5081ad(0x72))/0x9;if(_0x426222===_0x1d1e3f)break;else _0x30594e['push'](_0x30594e['shift']());}catch(_0x2efd35){_0x30594e['push'](_0x30594e['shift']());}}}(a233_0x1410,0x4ee9a));import{createHash}from'node:crypto';function a233_0x1410(){const _0x395038=['scope','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','utf8','app_rule_content_invalid','hex','App\x20rule\x20file\x20is\x20blank:\x20','12287871iXfpHE','byteSize','isFile','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','24yOhAsw','updateTime','database','contentHash','Cannot\x20access\x20app\x20rule\x20file:\x20','type','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','utf-8','2054872uedXyr','1706117bzTQon','Cannot\x20read\x20app\x20rule\x20file:\x20','810795GWONPQ','app_rule_file_required','update','page-api-development','app_rule_type_invalid','231216QrYlCM','decode','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','sha256:','RULES.md','131578ecGsen','content','size','byteLength','database-analysis','string','message','app_rule_content_too_large','app_rule_file_unreadable','2286840wNAgUT','from','Pass\x20a\x20UTF-8\x20Markdown\x20file.','app_rule_file_invalid','6SkoenW','trim'];a233_0x1410=function(){return _0x395038;};return a233_0x1410();}import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';function a233_0x315b(_0x44decb,_0x3d6e19){_0x44decb=_0x44decb-0x6e;const _0x141003=a233_0x1410();let _0x315bca=_0x141003[_0x44decb];return _0x315bca;}export const APP_RULE_TYPES=['rules',a233_0x3ff7ab(0x78)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a233_0x3ff7ab(0x8a),'database':'DATABASE.md'},APP_RULE_CONTEXT_SCOPES={'rules':a233_0x3ff7ab(0x84),'database':a233_0x3ff7ab(0x8f)};export function appRuleError(_0x425fb0,_0x1f2c72,_0x200ab4){return new CliError(_0x425fb0,0x1,_0x1f2c72,_0x200ab4);}export function readAppRuleType(_0x4815b1){const _0x5cad44=a233_0x3ff7ab,_0x7483f0=_0x4815b1['str'](_0x5cad44(0x7b))[_0x5cad44(0x99)]()['toLowerCase']();if(_0x7483f0!=='rules'&&_0x7483f0!==_0x5cad44(0x78))throw appRuleError(_0x5cad44(0x85),_0x5cad44(0x88));return _0x7483f0;}export function appRuleFileName(_0x2039da){return APP_RULE_FILES[_0x2039da];}export function appRuleContextScope(_0x37dae9){return APP_RULE_CONTEXT_SCOPES[_0x37dae9];}export function inspectAppRuleContent(_0xa08c32){const _0x31635a=a233_0x3ff7ab,_0x5d3255=Buffer[_0x31635a(0x95)](_0xa08c32,_0x31635a(0x6e));return{'content':_0xa08c32,'byteSize':_0x5d3255[_0x31635a(0x8e)],'contentHash':_0x31635a(0x89)+createHash('sha256')[_0x31635a(0x83)](_0x5d3255)['digest'](_0x31635a(0x70))};}export async function readAppRuleFile(_0x3bcfe8){const _0x28567d=a233_0x3ff7ab,_0x4eae3e=_0x3bcfe8['trim']();if(!_0x4eae3e)throw appRuleError(_0x28567d(0x82),'--file\x20is\x20required.',_0x28567d(0x96));const _0x31e717=resolve(_0x4eae3e);let _0x351292;try{_0x351292=await stat(_0x31e717);}catch(_0x14927c){throw appRuleError(_0x28567d(0x93),_0x28567d(0x7a)+_0x4eae3e,_0x14927c instanceof Error?_0x14927c[_0x28567d(0x91)]:String(_0x14927c));}if(!_0x351292[_0x28567d(0x74)]())throw appRuleError(_0x28567d(0x97),'App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20'+_0x4eae3e);if(_0x351292[_0x28567d(0x8d)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x28567d(0x92),_0x28567d(0x7c));let _0x510549;try{_0x510549=await readFile(_0x31e717);}catch(_0x3bfb48){throw appRuleError(_0x28567d(0x93),_0x28567d(0x80)+_0x4eae3e,_0x3bfb48 instanceof Error?_0x3bfb48['message']:String(_0x3bfb48));}if(_0x510549[_0x28567d(0x8e)]>MAX_APP_RULE_BYTES)throw appRuleError('app_rule_content_too_large',_0x28567d(0x7c));let _0xd7dba4;try{_0xd7dba4=new TextDecoder(_0x28567d(0x7d),{'fatal':!![],'ignoreBOM':!![]})[_0x28567d(0x87)](_0x510549);}catch{throw appRuleError('app_rule_content_invalid',_0x28567d(0x75)+_0x4eae3e);}if(!_0xd7dba4[_0x28567d(0x99)]())throw appRuleError(_0x28567d(0x6f),_0x28567d(0x71)+_0x4eae3e);return inspectAppRuleContent(_0xd7dba4);}export function projectAppRule(_0x40331c,_0x25b08b){const _0x57f2f1=a233_0x3ff7ab;if(!_0x25b08b)return{'type':_0x40331c,'fileName':appRuleFileName(_0x40331c),'contextScope':appRuleContextScope(_0x40331c),'enabled':![]};const _0x30f7e8=inspectAppRuleContent(_0x25b08b[_0x57f2f1(0x8c)]);return{'type':_0x40331c,'fileName':appRuleFileName(_0x40331c),'contextScope':appRuleContextScope(_0x40331c),'enabled':!![],'id':_0x25b08b['id'],'scope':_0x25b08b[_0x57f2f1(0x9a)],'appCode':_0x25b08b['appCode'],'version':_0x25b08b['version'],'contentByteSize':_0x30f7e8[_0x57f2f1(0x73)],'contentHash':_0x30f7e8[_0x57f2f1(0x79)],..._0x25b08b['createTime']!==undefined&&_0x25b08b['createTime']!==null?{'createTime':_0x25b08b['createTime']}:{},..._0x25b08b[_0x57f2f1(0x77)]!==undefined&&_0x25b08b[_0x57f2f1(0x77)]!==null?{'updateTime':_0x25b08b[_0x57f2f1(0x77)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':'type','type':a233_0x3ff7ab(0x90),'required':!![],'description':a233_0x3ff7ab(0x9b),'enum':[...APP_RULE_TYPES]};
1
+ const a233_0x26382b=a233_0x5a8d;function a233_0x5a8d(_0x1a6351,_0x26b93d){_0x1a6351=_0x1a6351-0x79;const _0x5ea92f=a233_0x5ea9();let _0x5a8d4e=_0x5ea92f[_0x1a6351];return _0x5a8d4e;}(function(_0x5ae463,_0x5bf4d6){const _0x287f15=a233_0x5a8d,_0x5b12e9=_0x5ae463();while(!![]){try{const _0x2b0771=-parseInt(_0x287f15(0xa9))/0x1+parseInt(_0x287f15(0x9c))/0x2+-parseInt(_0x287f15(0x87))/0x3+parseInt(_0x287f15(0x7b))/0x4*(-parseInt(_0x287f15(0x88))/0x5)+parseInt(_0x287f15(0x98))/0x6*(-parseInt(_0x287f15(0x89))/0x7)+-parseInt(_0x287f15(0x93))/0x8+-parseInt(_0x287f15(0x80))/0x9*(-parseInt(_0x287f15(0xa5))/0xa);if(_0x2b0771===_0x5bf4d6)break;else _0x5b12e9['push'](_0x5b12e9['shift']());}catch(_0x10f07a){_0x5b12e9['push'](_0x5b12e9['shift']());}}}(a233_0x5ea9,0x29e5c));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a233_0x26382b(0x8d),'database'];function a233_0x5ea9(){const _0x1245fe=['content','App\x20rule\x20file\x20is\x20blank:\x20','7790910tWjGKi','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','scope','contentHash','116428jDgFtj','app_rule_type_invalid','update','createTime','version','530844ygMYrb','app_rule_file_required','Pass\x20a\x20UTF-8\x20Markdown\x20file.','size','sha256','9cEgBaS','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','toLowerCase','page-api-development','message','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','type','633621unkaUa','5tmTICn','900242Afelng','app_rule_file_invalid','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','app_rule_content_invalid','rules','RULES.md','utf8','app_rule_file_unreadable','byteLength','from','1366688IIWXBj','Cannot\x20access\x20app\x20rule\x20file:\x20','Cannot\x20read\x20app\x20rule\x20file:\x20','updateTime','decode','6lzwPiQ','str','database','byteSize','304618EkfwNz','sha256:','app_rule_content_too_large','trim','hex','appCode','database-analysis'];a233_0x5ea9=function(){return _0x1245fe;};return a233_0x5ea9();}export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a233_0x26382b(0x8e),'database':'DATABASE.md'},APP_RULE_CONTEXT_SCOPES={'rules':a233_0x26382b(0x83),'database':a233_0x26382b(0xa2)};export function appRuleError(_0x1a4a4d,_0x4fd732,_0x2d2f9b){return new CliError(_0x1a4a4d,0x1,_0x4fd732,_0x2d2f9b);}export function readAppRuleType(_0x18fd38){const _0x34541b=a233_0x26382b,_0xc5ec15=_0x18fd38[_0x34541b(0x99)](_0x34541b(0x86))['trim']()[_0x34541b(0x82)]();if(_0xc5ec15!==_0x34541b(0x8d)&&_0xc5ec15!==_0x34541b(0x9a))throw appRuleError(_0x34541b(0xaa),'--type\x20must\x20be\x20either\x20rules\x20or\x20database.');return _0xc5ec15;}export function appRuleFileName(_0x2e0487){return APP_RULE_FILES[_0x2e0487];}export function appRuleContextScope(_0x283f23){return APP_RULE_CONTEXT_SCOPES[_0x283f23];}export function inspectAppRuleContent(_0x4cbcdf){const _0x2dd3f6=a233_0x26382b,_0x117064=Buffer[_0x2dd3f6(0x92)](_0x4cbcdf,_0x2dd3f6(0x8f));return{'content':_0x4cbcdf,'byteSize':_0x117064[_0x2dd3f6(0x91)],'contentHash':_0x2dd3f6(0x9d)+createHash(_0x2dd3f6(0x7f))[_0x2dd3f6(0xab)](_0x117064)['digest'](_0x2dd3f6(0xa0))};}export async function readAppRuleFile(_0x47356e){const _0x2fd226=a233_0x26382b,_0x28c8c9=_0x47356e[_0x2fd226(0x9f)]();if(!_0x28c8c9)throw appRuleError(_0x2fd226(0x7c),'--file\x20is\x20required.',_0x2fd226(0x7d));const _0x2f035d=resolve(_0x28c8c9);let _0x4e503;try{_0x4e503=await stat(_0x2f035d);}catch(_0xea325d){throw appRuleError(_0x2fd226(0x90),_0x2fd226(0x94)+_0x28c8c9,_0xea325d instanceof Error?_0xea325d['message']:String(_0xea325d));}if(!_0x4e503['isFile']())throw appRuleError(_0x2fd226(0x8a),_0x2fd226(0x81)+_0x28c8c9);if(_0x4e503[_0x2fd226(0x7e)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x2fd226(0x9e),_0x2fd226(0x85));let _0x5ba523;try{_0x5ba523=await readFile(_0x2f035d);}catch(_0x1716d1){throw appRuleError(_0x2fd226(0x90),_0x2fd226(0x95)+_0x28c8c9,_0x1716d1 instanceof Error?_0x1716d1[_0x2fd226(0x84)]:String(_0x1716d1));}if(_0x5ba523['byteLength']>MAX_APP_RULE_BYTES)throw appRuleError(_0x2fd226(0x9e),_0x2fd226(0x85));let _0x2823d7;try{_0x2823d7=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})[_0x2fd226(0x97)](_0x5ba523);}catch{throw appRuleError(_0x2fd226(0x8c),_0x2fd226(0x8b)+_0x28c8c9);}if(!_0x2823d7[_0x2fd226(0x9f)]())throw appRuleError(_0x2fd226(0x8c),_0x2fd226(0xa4)+_0x28c8c9);return inspectAppRuleContent(_0x2823d7);}export function projectAppRule(_0x2e9234,_0x2f6981){const _0x843809=a233_0x26382b;if(!_0x2f6981)return{'type':_0x2e9234,'fileName':appRuleFileName(_0x2e9234),'contextScope':appRuleContextScope(_0x2e9234),'enabled':![]};const _0x1f0e43=inspectAppRuleContent(_0x2f6981[_0x843809(0xa3)]);return{'type':_0x2e9234,'fileName':appRuleFileName(_0x2e9234),'contextScope':appRuleContextScope(_0x2e9234),'enabled':!![],'id':_0x2f6981['id'],'scope':_0x2f6981[_0x843809(0xa7)],'appCode':_0x2f6981[_0x843809(0xa1)],'version':_0x2f6981[_0x843809(0x7a)],'contentByteSize':_0x1f0e43[_0x843809(0x9b)],'contentHash':_0x1f0e43[_0x843809(0xa8)],..._0x2f6981[_0x843809(0x79)]!==undefined&&_0x2f6981['createTime']!==null?{'createTime':_0x2f6981[_0x843809(0x79)]}:{},..._0x2f6981['updateTime']!==undefined&&_0x2f6981[_0x843809(0x96)]!==null?{'updateTime':_0x2f6981[_0x843809(0x96)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a233_0x26382b(0x86),'type':'string','required':!![],'description':a233_0x26382b(0xa6),'enum':[...APP_RULE_TYPES]};
@@ -1 +1 @@
1
- const a234_0x2cf3a9=a234_0x3fe9;(function(_0x4b03a4,_0x43a606){const _0x1d9f3e=a234_0x3fe9,_0x2e8553=_0x4b03a4();while(!![]){try{const _0x1e85ec=parseInt(_0x1d9f3e(0x15d))/0x1*(-parseInt(_0x1d9f3e(0x19f))/0x2)+-parseInt(_0x1d9f3e(0x167))/0x3*(parseInt(_0x1d9f3e(0x187))/0x4)+parseInt(_0x1d9f3e(0x173))/0x5*(parseInt(_0x1d9f3e(0x164))/0x6)+parseInt(_0x1d9f3e(0x199))/0x7*(-parseInt(_0x1d9f3e(0x15b))/0x8)+parseInt(_0x1d9f3e(0x18e))/0x9*(-parseInt(_0x1d9f3e(0x166))/0xa)+parseInt(_0x1d9f3e(0x19e))/0xb*(-parseInt(_0x1d9f3e(0x193))/0xc)+-parseInt(_0x1d9f3e(0x18d))/0xd*(-parseInt(_0x1d9f3e(0x17c))/0xe);if(_0x1e85ec===_0x43a606)break;else _0x2e8553['push'](_0x2e8553['shift']());}catch(_0x5ecb47){_0x2e8553['push'](_0x2e8553['shift']());}}}(a234_0x27eb,0x2b461));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set(['start',a234_0x2cf3a9(0x183)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a234_0x2cf3a9(0x195),a234_0x2cf3a9(0x183),'build',a234_0x2cf3a9(0x190)]);export function syncProjectDomainRoutingBeforeScript(_0x4d12ac,_0x1df649){const _0x5e3b01=a234_0x2cf3a9;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x5e3b01(0x160)](_0x1df649))return null;const _0x12481f=findProjectRootDirectory(_0x4d12ac);if(!resolveConfigPath(_0x12481f))return null;const _0x12ef7b=writeProjectDomainRoutingManifest(_0x12481f);return{'path':_0x12ef7b[_0x5e3b01(0x15e)],'changed':_0x12ef7b['changed']};}function readPackageScripts(_0x10b49e){const _0x3555d2=a234_0x2cf3a9,_0x1ce207=resolve(_0x10b49e,_0x3555d2(0x15c));if(!existsSync(_0x1ce207))return null;try{const _0x586cf0=JSON[_0x3555d2(0x163)](readFileSync(_0x1ce207,_0x3555d2(0x161)));return _0x586cf0[_0x3555d2(0x19c)]??{};}catch{return null;}}function a234_0x27eb(){const _0x529001=['cwd','Enable\x20watch\x20mode\x20for\x20preview','\x20run\x20','yarn.lock','length','yarn','script','Domain\x20routing\x20synchronized:\x20','228952VriHMi','package.json','3QSuYKy','path','\x20run\x20preview','has','utf-8','boolean','parse','54dauJBl','No\x20package.json\x20found\x20in\x20current\x20directory.','10gwZyIB','3KLPWtW','pnpm-lock.yaml','changed','log','vite\x20preview\x20exited\x20with\x20code\x20','bool','error','keys','Script\x20\x22','pnpm','validation','watch','152010YMLxZq','bun','\x0a\x20\x20Available\x20scripts:\x0a','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','\x20exited\x20with\x20code\x20','build','Run\x20a\x20package.json\x20script','close','push','1414bOGlLt','Available:\x20','join','\x20run\x20<script>\x0a','inherit','No\x20scripts\x20defined\x20in\x20package.json.','slice','dev','\x22\x20not\x20found\x20in\x20package.json.','node_modules','write','267528jghjKn','bun.lockb','\x20\x20\x20\x20','\x0a\x20\x20Usage:\x20','needsUpgrade','bun.lock','102401qtAXNW','241551krJkku','run','preview','Script\x20name\x20defined\x20in\x20package.json','\x20run\x20build','8220oUPxni','\x20run\x20preview\x20--watch','start','vite','--watch','.bin','35vMvjJq','npm','\x20run\x20start','scripts','args','5533WQUrsh','207050axGRqU'];a234_0x27eb=function(){return _0x529001;};return a234_0x27eb();}function a234_0x3fe9(_0x372f7e,_0x5debad){_0x372f7e=_0x372f7e-0x156;const _0x27ebb3=a234_0x27eb();let _0x3fe956=_0x27ebb3[_0x372f7e];return _0x3fe956;}function detectPackageManager(_0x23007a){const _0x17eee5=a234_0x2cf3a9;if(existsSync(resolve(_0x23007a,_0x17eee5(0x188)))||existsSync(resolve(_0x23007a,_0x17eee5(0x18c))))return _0x17eee5(0x174);if(existsSync(resolve(_0x23007a,_0x17eee5(0x168))))return _0x17eee5(0x170);if(existsSync(resolve(_0x23007a,_0x17eee5(0x156))))return _0x17eee5(0x158);return _0x17eee5(0x19a);}async function versionCheck(_0x43b585){const _0x2c0dc3=a234_0x2cf3a9,_0x361ab4=await checkCliVersion();(_0x361ab4[_0x2c0dc3(0x18b)]||_0x361ab4['belowMinimum'])&&(printCliUpgradeWarning(_0x361ab4),assertCliVersionSupported(_0x361ab4));const _0x49cf26=await checkSdkVersion(_0x43b585);if(_0x49cf26[_0x2c0dc3(0x18b)])printSdkUpgradeWarning(_0x49cf26);}function spawnScript(_0x54d90c,_0x432982,_0x3b8b26,_0x4a4e38){return new Promise((_0x168b12,_0x25a7d7)=>{const _0x5f2d3f=a234_0x3fe9,_0x5eaa34=[_0x5f2d3f(0x18f),_0x432982,..._0x3b8b26],_0x4be093=spawn(_0x54d90c,_0x5eaa34,{'cwd':_0x4a4e38,'stdio':_0x5f2d3f(0x180),'shell':!![],'env':{...process.env,'PATH':''+join(_0x4a4e38,_0x5f2d3f(0x185),_0x5f2d3f(0x198))+delimiter+process.env.PATH}});_0x4be093['on'](_0x5f2d3f(0x17a),_0x1ef416=>{const _0xac27e=_0x5f2d3f;if(_0x1ef416===0x0||_0x1ef416===null)_0x168b12();else _0x25a7d7(new Error(_0x54d90c+_0xac27e(0x1a2)+_0x432982+_0xac27e(0x177)+_0x1ef416));}),_0x4be093['on'](_0x5f2d3f(0x16d),_0x25a7d7);});}function spawnViteBuildWatch(_0x53db10){return new Promise((_0x11dabe,_0x3359dd)=>{const _0x110e02=a234_0x3fe9,_0x443688=spawn(_0x110e02(0x196),[_0x110e02(0x178),_0x110e02(0x197)],{'cwd':_0x53db10,'stdio':_0x110e02(0x180),'shell':!![],'env':{...process.env,'PATH':''+join(_0x53db10,_0x110e02(0x185),_0x110e02(0x198))+delimiter+process.env.PATH}});_0x443688['on']('close',_0x2b7639=>{const _0x4e19ba=_0x110e02;if(_0x2b7639===0x0||_0x2b7639===null)_0x11dabe();else _0x3359dd(new Error(_0x4e19ba(0x176)+_0x2b7639));}),_0x443688['on'](_0x110e02(0x16d),_0x3359dd);});}function spawnVitePreview(_0x2e1f6a){return new Promise((_0x3d4ccb,_0x254e6a)=>{const _0x1b9b06=a234_0x3fe9,_0x28c85e=spawn(_0x1b9b06(0x196),[_0x1b9b06(0x190)],{'cwd':_0x2e1f6a,'stdio':_0x1b9b06(0x180),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2e1f6a,'node_modules',_0x1b9b06(0x198))+delimiter+process.env.PATH}});_0x28c85e['on']('close',_0x2c1ab6=>{const _0x5abf1=_0x1b9b06;if(_0x2c1ab6===0x0||_0x2c1ab6===null)_0x3d4ccb();else _0x254e6a(new Error(_0x5abf1(0x16b)+_0x2c1ab6));}),_0x28c85e['on']('error',_0x254e6a);});}const runFlags=[{'name':a234_0x2cf3a9(0x172),'type':a234_0x2cf3a9(0x162),'description':a234_0x2cf3a9(0x1a1),'default':![]}];export const runDefinition={'service':a234_0x2cf3a9(0x18f),'command':'run','description':a234_0x2cf3a9(0x179),'risk':a234_0x2cf3a9(0x186),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a234_0x2cf3a9(0x159),'description':a234_0x2cf3a9(0x191),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0xecfaa2=a234_0x2cf3a9,_0x13a6f6=[];return _0x13a6f6[_0xecfaa2(0x17b)]('\x20\x20EXAMPLES'),_0x13a6f6[_0xecfaa2(0x17b)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0xecfaa2(0x19b)),_0x13a6f6[_0xecfaa2(0x17b)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0xecfaa2(0x192)),_0x13a6f6['push'](_0xecfaa2(0x189)+CLI_BIN_NAME+_0xecfaa2(0x15f)),_0x13a6f6['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0xecfaa2(0x194)),_0x13a6f6[_0xecfaa2(0x17e)]('\x0a');},async 'execute'(_0x43922a){const _0x25239e=a234_0x2cf3a9,_0x2ae530=process[_0x25239e(0x1a0)](),_0x696def=_0x43922a[_0x25239e(0x19d)][0x0],_0x450792=_0x43922a[_0x25239e(0x19d)][_0x25239e(0x182)](0x1),_0x62b9b4=readPackageScripts(_0x2ae530);if(!_0x62b9b4)throw CliErrors[_0x25239e(0x171)](_0x25239e(0x165));if(!_0x696def){const _0x401a99=Object[_0x25239e(0x16e)](_0x62b9b4);if(_0x401a99[_0x25239e(0x157)]===0x0)console[_0x25239e(0x16a)](_0x25239e(0x181));else{console[_0x25239e(0x16a)](_0x25239e(0x175));for(const _0x3b0b67 of _0x401a99){console[_0x25239e(0x16a)](_0x25239e(0x189)+_0x3b0b67);}console[_0x25239e(0x16a)](_0x25239e(0x18a)+CLI_BIN_NAME+_0x25239e(0x17f));}return{'ok':!![]};}if(!_0x62b9b4[_0x696def])throw CliErrors['validation'](_0x25239e(0x16f)+_0x696def+_0x25239e(0x184),_0x25239e(0x17d)+(Object[_0x25239e(0x16e)](_0x62b9b4)[_0x25239e(0x17e)](',\x20')||'(none)'));const _0x85c3df=detectPackageManager(_0x2ae530),_0x1b04bd=syncProjectDomainRoutingBeforeScript(_0x2ae530,_0x696def);_0x1b04bd?.[_0x25239e(0x169)]&&console['error'](_0x25239e(0x15a)+_0x1b04bd[_0x25239e(0x15e)]);VERSION_CHECK_SCRIPTS[_0x25239e(0x160)](_0x696def)&&await versionCheck(_0x2ae530);if(_0x696def===_0x25239e(0x190)&&_0x43922a[_0x25239e(0x16c)](_0x25239e(0x172)))return await Promise['all']([spawnViteBuildWatch(_0x2ae530),spawnVitePreview(_0x2ae530)]),{'ok':!![]};return await spawnScript(_0x85c3df,_0x696def,_0x450792,_0x2ae530),{'ok':!![]};}};
1
+ const a234_0x53374d=a234_0x6c1e;(function(_0xef83ba,_0x2d8978){const _0xf38b=a234_0x6c1e,_0x272098=_0xef83ba();while(!![]){try{const _0x3d1789=-parseInt(_0xf38b(0x133))/0x1*(-parseInt(_0xf38b(0x137))/0x2)+-parseInt(_0xf38b(0x124))/0x3*(-parseInt(_0xf38b(0x164))/0x4)+-parseInt(_0xf38b(0x15f))/0x5+parseInt(_0xf38b(0x12e))/0x6*(parseInt(_0xf38b(0x126))/0x7)+-parseInt(_0xf38b(0x147))/0x8*(-parseInt(_0xf38b(0x156))/0x9)+-parseInt(_0xf38b(0x15c))/0xa*(-parseInt(_0xf38b(0x140))/0xb)+parseInt(_0xf38b(0x154))/0xc*(-parseInt(_0xf38b(0x139))/0xd);if(_0x3d1789===_0x2d8978)break;else _0x272098['push'](_0x272098['shift']());}catch(_0x3a3ace){_0x272098['push'](_0x272098['shift']());}}}(a234_0x2d77,0x6ba71));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';function a234_0x2d77(){const _0x3be63e=['\x22\x20not\x20found\x20in\x20package.json.','scripts','write','433292VcyYjZ','bun','(none)','yarn','4IXwlxD','run','14524887xObedJ','inherit','\x0a\x20\x20Usage:\x20','yarn.lock','changed','\x20run\x20','has','11zpJIID','Enable\x20watch\x20mode\x20for\x20preview','vite','pnpm','.bin','\x20run\x20start','bun.lock','485592VCXdcE','log','\x0a\x20\x20Available\x20scripts:\x0a','args','path','error','bool','close','build','Available:\x20','\x20run\x20<script>\x0a','node_modules','--watch','12Pvlwge','script','27gFZoTB','\x20\x20EXAMPLES','start','push','\x20run\x20preview','Script\x20\x22','4788280fKXpsb','pnpm-lock.yaml','No\x20scripts\x20defined\x20in\x20package.json.','3963390JzQTlE','\x20run\x20preview\x20--watch','\x20\x20\x20\x20','dev','cwd','4QOYkGn','No\x20package.json\x20found\x20in\x20current\x20directory.','preview','utf-8','vite\x20preview\x20exited\x20with\x20code\x20','1147071xSAQiY','needsUpgrade','1078znrOVx','join','validation','keys','Run\x20a\x20package.json\x20script','Domain\x20routing\x20synchronized:\x20','\x20run\x20build','bun.lockb','17184vXwsTb','watch'];a234_0x2d77=function(){return _0x3be63e;};return a234_0x2d77();}const VERSION_CHECK_SCRIPTS=new Set([a234_0x53374d(0x158),a234_0x53374d(0x162)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a234_0x53374d(0x158),a234_0x53374d(0x162),a234_0x53374d(0x14f),a234_0x53374d(0x166)]);export function syncProjectDomainRoutingBeforeScript(_0x2f3918,_0x511bed){const _0x55b9ff=a234_0x53374d;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x55b9ff(0x13f)](_0x511bed))return null;const _0x1ccf6b=findProjectRootDirectory(_0x2f3918);if(!resolveConfigPath(_0x1ccf6b))return null;const _0x4b9b98=writeProjectDomainRoutingManifest(_0x1ccf6b);return{'path':_0x4b9b98['path'],'changed':_0x4b9b98[_0x55b9ff(0x13d)]};}function readPackageScripts(_0x357581){const _0x5da456=a234_0x53374d,_0x2fe336=resolve(_0x357581,'package.json');if(!existsSync(_0x2fe336))return null;try{const _0x22a1a8=JSON['parse'](readFileSync(_0x2fe336,_0x5da456(0x167)));return _0x22a1a8[_0x5da456(0x131)]??{};}catch{return null;}}function detectPackageManager(_0x1dc83c){const _0x4d5aba=a234_0x53374d;if(existsSync(resolve(_0x1dc83c,_0x4d5aba(0x12d)))||existsSync(resolve(_0x1dc83c,_0x4d5aba(0x146))))return _0x4d5aba(0x134);if(existsSync(resolve(_0x1dc83c,_0x4d5aba(0x15d))))return _0x4d5aba(0x143);if(existsSync(resolve(_0x1dc83c,_0x4d5aba(0x13c))))return _0x4d5aba(0x136);return'npm';}async function versionCheck(_0x5e5dda){const _0xffcf9c=a234_0x53374d,_0x29d8e7=await checkCliVersion();(_0x29d8e7['needsUpgrade']||_0x29d8e7['belowMinimum'])&&(printCliUpgradeWarning(_0x29d8e7),assertCliVersionSupported(_0x29d8e7));const _0x59bd54=await checkSdkVersion(_0x5e5dda);if(_0x59bd54[_0xffcf9c(0x125)])printSdkUpgradeWarning(_0x59bd54);}function a234_0x6c1e(_0x27bcb0,_0x4a6140){_0x27bcb0=_0x27bcb0-0x123;const _0x2d77ad=a234_0x2d77();let _0x6c1e0b=_0x2d77ad[_0x27bcb0];return _0x6c1e0b;}function spawnScript(_0x3fe2ea,_0xcbb93d,_0x1955c3,_0x2a141e){return new Promise((_0x745466,_0xaa9e52)=>{const _0x385579=a234_0x6c1e,_0x51a1ee=['run',_0xcbb93d,..._0x1955c3],_0x30b903=spawn(_0x3fe2ea,_0x51a1ee,{'cwd':_0x2a141e,'stdio':_0x385579(0x13a),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2a141e,_0x385579(0x152),_0x385579(0x144))+delimiter+process.env.PATH}});_0x30b903['on'](_0x385579(0x14e),_0x5017dd=>{const _0x4fba3e=_0x385579;if(_0x5017dd===0x0||_0x5017dd===null)_0x745466();else _0xaa9e52(new Error(_0x3fe2ea+_0x4fba3e(0x13e)+_0xcbb93d+'\x20exited\x20with\x20code\x20'+_0x5017dd));}),_0x30b903['on'](_0x385579(0x14c),_0xaa9e52);});}function spawnViteBuildWatch(_0xb705c3){return new Promise((_0x4e3f73,_0xeefba6)=>{const _0x385a61=a234_0x6c1e,_0x12622f=spawn(_0x385a61(0x142),[_0x385a61(0x14f),_0x385a61(0x153)],{'cwd':_0xb705c3,'stdio':_0x385a61(0x13a),'shell':!![],'env':{...process.env,'PATH':''+join(_0xb705c3,_0x385a61(0x152),_0x385a61(0x144))+delimiter+process.env.PATH}});_0x12622f['on']('close',_0x75b6a1=>{if(_0x75b6a1===0x0||_0x75b6a1===null)_0x4e3f73();else _0xeefba6(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x75b6a1));}),_0x12622f['on']('error',_0xeefba6);});}function spawnVitePreview(_0x3e3757){return new Promise((_0x322d2b,_0x269642)=>{const _0x18f8a5=a234_0x6c1e,_0x2ad049=spawn('vite',[_0x18f8a5(0x166)],{'cwd':_0x3e3757,'stdio':_0x18f8a5(0x13a),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3e3757,'node_modules',_0x18f8a5(0x144))+delimiter+process.env.PATH}});_0x2ad049['on'](_0x18f8a5(0x14e),_0xe92859=>{const _0x5b57ca=_0x18f8a5;if(_0xe92859===0x0||_0xe92859===null)_0x322d2b();else _0x269642(new Error(_0x5b57ca(0x123)+_0xe92859));}),_0x2ad049['on'](_0x18f8a5(0x14c),_0x269642);});}const runFlags=[{'name':a234_0x53374d(0x12f),'type':'boolean','description':a234_0x53374d(0x141),'default':![]}];export const runDefinition={'service':a234_0x53374d(0x138),'command':a234_0x53374d(0x138),'description':a234_0x53374d(0x12a),'risk':a234_0x53374d(0x132),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a234_0x53374d(0x155),'description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x22a42e=a234_0x53374d,_0x522bef=[];return _0x522bef[_0x22a42e(0x159)](_0x22a42e(0x157)),_0x522bef[_0x22a42e(0x159)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x22a42e(0x145)),_0x522bef[_0x22a42e(0x159)](_0x22a42e(0x161)+CLI_BIN_NAME+_0x22a42e(0x12c)),_0x522bef[_0x22a42e(0x159)](_0x22a42e(0x161)+CLI_BIN_NAME+_0x22a42e(0x15a)),_0x522bef[_0x22a42e(0x159)](_0x22a42e(0x161)+CLI_BIN_NAME+_0x22a42e(0x160)),_0x522bef['join']('\x0a');},async 'execute'(_0x439db1){const _0x12b62b=a234_0x53374d,_0x370692=process[_0x12b62b(0x163)](),_0x2eb927=_0x439db1[_0x12b62b(0x14a)][0x0],_0x4a23c2=_0x439db1[_0x12b62b(0x14a)]['slice'](0x1),_0x3a4ca7=readPackageScripts(_0x370692);if(!_0x3a4ca7)throw CliErrors[_0x12b62b(0x128)](_0x12b62b(0x165));if(!_0x2eb927){const _0x30f84b=Object[_0x12b62b(0x129)](_0x3a4ca7);if(_0x30f84b['length']===0x0)console['log'](_0x12b62b(0x15e));else{console['log'](_0x12b62b(0x149));for(const _0x4f8627 of _0x30f84b){console[_0x12b62b(0x148)](_0x12b62b(0x161)+_0x4f8627);}console[_0x12b62b(0x148)](_0x12b62b(0x13b)+CLI_BIN_NAME+_0x12b62b(0x151));}return{'ok':!![]};}if(!_0x3a4ca7[_0x2eb927])throw CliErrors['validation'](_0x12b62b(0x15b)+_0x2eb927+_0x12b62b(0x130),_0x12b62b(0x150)+(Object[_0x12b62b(0x129)](_0x3a4ca7)[_0x12b62b(0x127)](',\x20')||_0x12b62b(0x135)));const _0xe0042d=detectPackageManager(_0x370692),_0x1d61b8=syncProjectDomainRoutingBeforeScript(_0x370692,_0x2eb927);_0x1d61b8?.[_0x12b62b(0x13d)]&&console['error'](_0x12b62b(0x12b)+_0x1d61b8[_0x12b62b(0x14b)]);VERSION_CHECK_SCRIPTS[_0x12b62b(0x13f)](_0x2eb927)&&await versionCheck(_0x370692);if(_0x2eb927===_0x12b62b(0x166)&&_0x439db1[_0x12b62b(0x14d)](_0x12b62b(0x12f)))return await Promise['all']([spawnViteBuildWatch(_0x370692),spawnVitePreview(_0x370692)]),{'ok':!![]};return await spawnScript(_0xe0042d,_0x2eb927,_0x4a23c2,_0x370692),{'ok':!![]};}};
@@ -1 +1 @@
1
- const a235_0x1216c6=a235_0x5942;(function(_0x24b22e,_0x2e77ef){const _0x1661fc=a235_0x5942,_0x34a0c8=_0x24b22e();while(!![]){try{const _0x2f4ab2=parseInt(_0x1661fc(0x17a))/0x1*(parseInt(_0x1661fc(0x176))/0x2)+parseInt(_0x1661fc(0x17c))/0x3+parseInt(_0x1661fc(0x17d))/0x4+-parseInt(_0x1661fc(0x177))/0x5+-parseInt(_0x1661fc(0x173))/0x6+-parseInt(_0x1661fc(0x178))/0x7*(parseInt(_0x1661fc(0x17f))/0x8)+parseInt(_0x1661fc(0x17e))/0x9;if(_0x2f4ab2===_0x2e77ef)break;else _0x34a0c8['push'](_0x34a0c8['shift']());}catch(_0x263375){_0x34a0c8['push'](_0x34a0c8['shift']());}}}(a235_0x3a7e,0xa49f0));import{buildSchemaPayload}from'../framework/schema-export.js';function a235_0x5942(_0x25be8d,_0x2574c6){_0x25be8d=_0x25be8d-0x173;const _0x3a7e2e=a235_0x3a7e();let _0x594222=_0x3a7e2e[_0x25be8d];return _0x594222;}function a235_0x3a7e(){const _0x4de1da=['read','37NfCiGh','json','1406817hxNqka','601080eCuSsp','6491196zErIkS','8ClxMHS','export','1441932sqDCXV','Export\x20machine-readable\x20command\x20schema\x20(JSON)','schema','28586tYGgAx','744875erHPUX','5639963wJVFnE'];a235_0x3a7e=function(){return _0x4de1da;};return a235_0x3a7e();}async function execute(_0xc94089){const _0x12c0e2=await buildSchemaPayload();return{'ok':!![],'data':_0x12c0e2};}export const schemaDefinition={'service':a235_0x1216c6(0x175),'command':a235_0x1216c6(0x180),'description':a235_0x1216c6(0x174),'risk':a235_0x1216c6(0x179),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a235_0x1216c6(0x17b),'flags':[],'execute':execute};
1
+ const a235_0x4dcecc=a235_0x12c9;(function(_0x8cf7e4,_0x99822e){const _0x89c125=a235_0x12c9,_0x222da1=_0x8cf7e4();while(!![]){try{const _0x35e81e=parseInt(_0x89c125(0x138))/0x1*(parseInt(_0x89c125(0x134))/0x2)+parseInt(_0x89c125(0x139))/0x3+-parseInt(_0x89c125(0x12e))/0x4*(parseInt(_0x89c125(0x130))/0x5)+parseInt(_0x89c125(0x136))/0x6*(parseInt(_0x89c125(0x132))/0x7)+parseInt(_0x89c125(0x133))/0x8+-parseInt(_0x89c125(0x13a))/0x9+parseInt(_0x89c125(0x135))/0xa*(parseInt(_0x89c125(0x137))/0xb);if(_0x35e81e===_0x99822e)break;else _0x222da1['push'](_0x222da1['shift']());}catch(_0x3db4e3){_0x222da1['push'](_0x222da1['shift']());}}}(a235_0x141f,0xd716f));function a235_0x141f(){const _0xfaf159=['schema','5AAXezW','Export\x20machine-readable\x20command\x20schema\x20(JSON)','20020XoCHwP','7370240iNamzc','4OczjoA','44300shvVZe','1494GCaVmR','352XDLtrv','74552QcmzHb','986217UUBhPM','5867001uyBGMO','read','json','2880508ZtdPXu'];a235_0x141f=function(){return _0xfaf159;};return a235_0x141f();}import{buildSchemaPayload}from'../framework/schema-export.js';function a235_0x12c9(_0x5f03c9,_0x540bef){_0x5f03c9=_0x5f03c9-0x12c;const _0x141fbb=a235_0x141f();let _0x12c942=_0x141fbb[_0x5f03c9];return _0x12c942;}async function execute(_0x50743e){const _0x4ff271=await buildSchemaPayload();return{'ok':!![],'data':_0x4ff271};}export const schemaDefinition={'service':a235_0x4dcecc(0x12f),'command':'export','description':a235_0x4dcecc(0x131),'risk':a235_0x4dcecc(0x12c),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a235_0x4dcecc(0x12d),'flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a236_0xfd8194=a236_0x5d03;(function(_0x578ca2,_0x2d982c){const _0xfaa205=a236_0x5d03,_0xa0b259=_0x578ca2();while(!![]){try{const _0x55d601=-parseInt(_0xfaa205(0x1ce))/0x1*(-parseInt(_0xfaa205(0x1e1))/0x2)+-parseInt(_0xfaa205(0x1d8))/0x3*(-parseInt(_0xfaa205(0x1da))/0x4)+parseInt(_0xfaa205(0x1d5))/0x5+parseInt(_0xfaa205(0x1b5))/0x6*(-parseInt(_0xfaa205(0x1b9))/0x7)+parseInt(_0xfaa205(0x1dc))/0x8+parseInt(_0xfaa205(0x1c6))/0x9+parseInt(_0xfaa205(0x1ad))/0xa*(-parseInt(_0xfaa205(0x1d2))/0xb);if(_0x55d601===_0x2d982c)break;else _0xa0b259['push'](_0xa0b259['shift']());}catch(_0x5089eb){_0xa0b259['push'](_0xa0b259['shift']());}}}(a236_0x5638,0xa91c8));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';function a236_0x5d03(_0x37d929,_0x1ff9b0){_0x37d929=_0x37d929-0x1ab;const _0x5638db=a236_0x5638();let _0x5d0394=_0x5638db[_0x37d929];return _0x5d0394;}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(_0x1bd0e2){const _0x9c9441=a236_0x5d03;if(_0x1bd0e2===_0x9c9441(0x1dd))return[_0x9c9441(0x1d0),_0x9c9441(0x1bb),_0x9c9441(0x1d7),'']['join']('\x0a');return['SELECT\x201\x20AS\x20id;','']['join']('\x0a');}function a236_0x5638(){const _0x166b2d=['db-id','10037259lbNPmR','Select\x20the\x20local\x20SQL\x20mode:','number','/smartapi/custom/saveUserCustomSql','write','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','Target\x20database\x20ID','dbId\x20cannot\x20be\x20empty','7zkrJwR','description','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','isFinite','55aWpPXa','__manual__','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','635790hOSKWI','sqlRoot','</select>','154221sCdkYR','toISOString','52EcBQtS','dbId','10116936sHzHKk','mybatisXml','Invalid\x20database\x20selection\x20payload:\x20','string','POST','132122qtNnqq','validation','str','catch','new','sqls','isInteger','utf8','nonInteractive','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','flagMissing','lastSync','SQL\x20name\x20cannot\x20be\x20empty','sql','5700830ALePNz','File\x20already\x20exists:\x20','flag','parse','Select\x20the\x20target\x20database:','appCode','dbName','create','6KqBrST','sqlCode','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','lockFilePath','662543bNxKTi','sqlRootDir','\x20\x20SELECT\x201\x20AS\x20id','Plain\x20SQL\x20(sql)','name','<server-generated-sqlCode>','trim','MyBatis\x20XML\x20(mybatisXml)','Created\x20SQL\x20query\x20','mode','length','✎\x20Enter\x20dbId\x20manually'];a236_0x5638=function(){return _0x166b2d;};return a236_0x5638();}export const sqlCreate={'service':a236_0xfd8194(0x1ac),'command':a236_0xfd8194(0x1b4),'description':a236_0xfd8194(0x1b7),'risk':a236_0xfd8194(0x1ca),'flags':[{'name':'name','type':a236_0xfd8194(0x1df),'description':'SQL\x20query\x20display\x20name'},{'name':a236_0xfd8194(0x1c5),'type':a236_0xfd8194(0x1c8),'description':a236_0xfd8194(0x1cc)},{'name':a236_0xfd8194(0x1c2),'type':a236_0xfd8194(0x1df),'enum':[a236_0xfd8194(0x1ac),'mybatisXml'],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0xd41de0){const _0x11e47e=a236_0xfd8194;if(!_0xd41de0[_0x11e47e(0x1e9)])return;if(!_0xd41de0[_0x11e47e(0x1e3)](_0x11e47e(0x1bd))[_0x11e47e(0x1bf)]())throw CliErrors[_0x11e47e(0x1eb)](_0x11e47e(0x1bd),_0x11e47e(0x1ea));const _0x5da697=resolveProvidedDbId(_0xd41de0);if(typeof _0x5da697!==_0x11e47e(0x1c8)||!Number[_0x11e47e(0x1d1)](_0x5da697)||_0x5da697<=0x0)throw CliErrors[_0x11e47e(0x1eb)](_0x11e47e(0x1c5),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0xd41de0['str'](_0x11e47e(0x1c2))['trim']())throw CliErrors[_0x11e47e(0x1eb)](_0x11e47e(0x1c2),_0x11e47e(0x1cb));},async 'dryRun'(_0x31d84a){const _0x36db1a=a236_0xfd8194,_0x23ee92=loadSqlProjectConfig(_0x31d84a['appCode']),{sqlName:_0x2a4ade,dbId:_0x514cfe,dbName:_0x37914e,mode:_0x26b0df}=await resolveSqlNewInputs(_0x31d84a),_0xa7310f=buildSqlRelativePath(_0x36db1a(0x1be),_0x2a4ade,_0x37914e,_0x26b0df,_0x514cfe),_0x37dc89=_0x23ee92['sqlRootDir']+'/'+_0xa7310f;return{'method':_0x36db1a(0x1e0),'url':_0x36db1a(0x1c9),'body':{'appCode':_0x31d84a[_0x36db1a(0x1b2)],'sqlName':_0x2a4ade,'dbId':_0x514cfe,'mode':_0x26b0df,'localPath':_0x37dc89},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x23ee92[_0x36db1a(0x1ba)]};},async 'execute'(_0xcda7c0){const _0x3b60ec=a236_0xfd8194,_0x67826d=loadSqlProjectConfig(_0xcda7c0[_0x3b60ec(0x1b2)]),{sqlName:_0x38d585,dbId:_0x271200,dbName:_0x59032b,mode:_0x48fdcf}=await resolveSqlNewInputs(_0xcda7c0),_0x30dcf9=generateSqlTemplate(_0x48fdcf),_0x8ec13e=await createSqlQuery({'appCode':_0xcda7c0[_0x3b60ec(0x1b2)],'sqlName':_0x38d585,'dbId':_0x271200,'sqlContent':_0x30dcf9}),_0x21c273=ensureRemoteSqlContent(_0x8ec13e),_0x2b677e=_0x59032b||await getDbName(_0xcda7c0[_0x3b60ec(0x1b2)],_0x271200)[_0x3b60ec(0x1e4)](()=>undefined),_0x7c4705=buildSqlRelativePath(_0x8ec13e[_0x3b60ec(0x1b6)],_0x8ec13e['sqlName'],_0x2b677e,_0x48fdcf,_0x271200),_0x1e52f9=_0x67826d[_0x3b60ec(0x1ba)]+'/'+_0x7c4705,_0x1365dd=buildLocalSqlFileContent({'sqlCode':_0x8ec13e[_0x3b60ec(0x1b6)],'sqlName':_0x8ec13e['sqlName'],'dbId':_0x8ec13e[_0x3b60ec(0x1db)]},_0x21c273,{'dbName':_0x2b677e,'mode':_0x48fdcf,'syncedAt':new Date()['toISOString'](),'description':_0x8ec13e[_0x3b60ec(0x1cf)]});if(await fileExists(_0x1e52f9))throw CliErrors[_0x3b60ec(0x1e2)](_0x3b60ec(0x1ae)+_0x1e52f9);await ensureParentDirectory(_0x1e52f9),await writeFile(_0x1e52f9,_0x1365dd,_0x3b60ec(0x1e8));const _0x2ded69=await readSqlLockFile(_0x67826d[_0x3b60ec(0x1b8)]),{lockData:_0x2c94ac,appLock:_0xe3406}=ensureSqlLockScope(_0x2ded69??createEmptySqlLock(),_0x67826d['appCode'],_0x67826d[_0x3b60ec(0x1d6)],_0x3b60ec(0x1e5));return _0xe3406[_0x3b60ec(0x1e6)][_0x8ec13e[_0x3b60ec(0x1b6)]]={...buildSqlLockEntry(_0x8ec13e,_0x21c273,computeSqlContentHash(_0x1365dd),{'dbName':_0x2b677e}),'path':_0x7c4705,'mode':_0x48fdcf},_0xe3406[_0x3b60ec(0x1ec)]=new Date()[_0x3b60ec(0x1d9)](),await writeSqlLockFile(_0x67826d[_0x3b60ec(0x1b8)],_0x2c94ac),{'ok':!![],'data':{'id':_0x8ec13e['id'],'sqlCode':_0x8ec13e[_0x3b60ec(0x1b6)],'sqlName':_0x8ec13e['sqlName'],'dbId':_0x8ec13e[_0x3b60ec(0x1db)],'path':_0x1e52f9,'mode':_0x48fdcf},'message':_0x3b60ec(0x1c1)+_0x8ec13e[_0x3b60ec(0x1b6)]};}};async function resolveSqlNewInputs(_0x2eebe3){const _0xdbedc9=await resolveSqlNameInput(_0x2eebe3),{dbId:_0x44870b,dbName:_0x238eac}=await resolveDbSelection(_0x2eebe3),_0x5566a8=await resolveSqlModeInput(_0x2eebe3);return{'sqlName':_0xdbedc9,'dbId':_0x44870b,'dbName':_0x238eac,'mode':_0x5566a8};}async function resolveSqlNameInput(_0x456119){const _0x5800a0=a236_0xfd8194,_0x1c975a=_0x456119['str']('name')[_0x5800a0(0x1bf)]();if(_0x1c975a)return _0x1c975a;if(_0x456119['nonInteractive'])throw CliErrors[_0x5800a0(0x1eb)](_0x5800a0(0x1bd),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':'SQL\x20name:','validate':_0x4e972e=>_0x4e972e[_0x5800a0(0x1bf)]()?!![]:_0x5800a0(0x1ab)}))[_0x5800a0(0x1bf)]();}async function resolveDbSelection(_0x4ea2b9){const _0x533288=a236_0xfd8194,_0x494238=resolveProvidedDbId(_0x4ea2b9);if(typeof _0x494238==='number'&&Number['isFinite'](_0x494238)&&_0x494238>0x0)return{'dbId':_0x494238,'dbName':await getDbName(_0x4ea2b9['appCode'],_0x494238)[_0x533288(0x1e4)](()=>undefined)};if(_0x4ea2b9[_0x533288(0x1e9)])throw CliErrors[_0x533288(0x1eb)]('db-id','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x134d38=await listDatabases(_0x4ea2b9['appCode'])[_0x533288(0x1e4)](()=>[]);if(_0x134d38['length']===0x1)return{'dbId':_0x134d38[0x0]['dbId'],'dbName':_0x134d38[0x0][_0x533288(0x1b3)]};if(_0x134d38[_0x533288(0x1c3)]>0x1){const _0x5a92ea=await select({'message':_0x533288(0x1b1),'choices':[..._0x134d38['map'](_0x2f89d3=>({'name':_0x2f89d3[_0x533288(0x1b3)]+'\x20('+_0x2f89d3[_0x533288(0x1db)]+')','value':serializeDbSelection(_0x2f89d3)})),{'name':_0x533288(0x1c4),'value':_0x533288(0x1d3)}]});if(_0x5a92ea!=='__manual__')return deserializeDbSelection(_0x5a92ea);}const _0x2bfb25=await input({'message':'Target\x20database\x20dbId:','validate':_0xc8345c=>{const _0x283d45=_0x533288,_0x50c845=_0xc8345c[_0x283d45(0x1bf)]();if(!_0x50c845)return _0x283d45(0x1cd);const _0x23568b=Number(_0x50c845);if(!Number[_0x283d45(0x1e7)](_0x23568b)||_0x23568b<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x2bfb25['trim']())};}async function resolveSqlModeInput(_0x24bd6b){const _0x57ee22=a236_0xfd8194,_0x49885a=_0x24bd6b['str']('mode')[_0x57ee22(0x1bf)]();if(_0x49885a===_0x57ee22(0x1ac)||_0x49885a==='mybatisXml')return _0x49885a;if(_0x24bd6b['nonInteractive'])throw CliErrors[_0x57ee22(0x1eb)](_0x57ee22(0x1c2),_0x57ee22(0x1cb));return await select({'message':_0x57ee22(0x1c7),'choices':[{'name':_0x57ee22(0x1bc),'value':_0x57ee22(0x1ac),'description':_0x57ee22(0x1d4)},{'name':_0x57ee22(0x1c0),'value':_0x57ee22(0x1dd),'description':'For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags'}]});}function serializeDbSelection(_0x326b29){const _0x2b1370=a236_0xfd8194;return JSON['stringify']({'dbId':_0x326b29[_0x2b1370(0x1db)],'dbName':_0x326b29['dbName']});}function deserializeDbSelection(_0x4011af){const _0x312a7c=a236_0xfd8194;try{const _0x51bbf2=JSON[_0x312a7c(0x1b0)](_0x4011af);if(typeof _0x51bbf2[_0x312a7c(0x1db)]==='number'&&Number[_0x312a7c(0x1d1)](_0x51bbf2[_0x312a7c(0x1db)]))return{'dbId':_0x51bbf2[_0x312a7c(0x1db)],'dbName':_0x51bbf2[_0x312a7c(0x1b3)]};}catch{}throw CliErrors['validation'](_0x312a7c(0x1de)+_0x4011af);}function resolveProvidedDbId(_0x5f457f){const _0x9f9c0e=a236_0xfd8194,_0x49e346=_0x5f457f[_0x9f9c0e(0x1af)](_0x9f9c0e(0x1c5));if(typeof _0x49e346===_0x9f9c0e(0x1c8)&&Number[_0x9f9c0e(0x1d1)](_0x49e346))return _0x49e346;return undefined;}
1
+ const a236_0x56c34f=a236_0x4b53;(function(_0xf85d38,_0x523f7f){const _0x3a56b0=a236_0x4b53,_0x4a1d70=_0xf85d38();while(!![]){try{const _0xa91b85=-parseInt(_0x3a56b0(0x145))/0x1*(-parseInt(_0x3a56b0(0x16d))/0x2)+parseInt(_0x3a56b0(0x12d))/0x3*(-parseInt(_0x3a56b0(0x15b))/0x4)+-parseInt(_0x3a56b0(0x16e))/0x5*(-parseInt(_0x3a56b0(0x15c))/0x6)+parseInt(_0x3a56b0(0x157))/0x7+parseInt(_0x3a56b0(0x151))/0x8*(parseInt(_0x3a56b0(0x168))/0x9)+-parseInt(_0x3a56b0(0x130))/0xa*(parseInt(_0x3a56b0(0x15a))/0xb)+parseInt(_0x3a56b0(0x139))/0xc*(-parseInt(_0x3a56b0(0x138))/0xd);if(_0xa91b85===_0x523f7f)break;else _0x4a1d70['push'](_0x4a1d70['shift']());}catch(_0x14b55a){_0x4a1d70['push'](_0x4a1d70['shift']());}}}(a236_0x33ae,0x71127));import{writeFile}from'node:fs/promises';function a236_0x33ae(){const _0xf659e3=['dbId\x20must\x20be\x20a\x20positive\x20integer','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20name:','Invalid\x20database\x20selection\x20payload:\x20','flagMissing','description','Select\x20the\x20local\x20SQL\x20mode:','</select>','isFinite','2AJowOu','sqlCode','number','str','lockFilePath','SQL\x20name\x20cannot\x20be\x20empty','Target\x20database\x20dbId:','length','✎\x20Enter\x20dbId\x20manually','join','toISOString','mode','5961688xnUwKs','\x20\x20SELECT\x201\x20AS\x20id','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','sqlRootDir','mybatisXml','appCode','1652889NQqNnk','sqlName','dbId\x20cannot\x20be\x20empty','1639957VnJkdm','156KyESce','102eBriRr','dbName','utf8','isInteger','Target\x20database\x20ID','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','sqls','trim','dbId','validation','POST','File\x20already\x20exists:\x20','9WxHAkL','string','new','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','MyBatis\x20XML\x20(mybatisXml)','529798diTJcF','157615GIAzoR','db-id','name','catch','Select\x20the\x20target\x20database:','nonInteractive','46356LVYxSZ','<server-generated-sqlCode>','parse','60LSeTJI','Created\x20SQL\x20query\x20','Local\x20SQL\x20file\x20mode','lastSync','__manual__','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','sqlRoot','sql','1127542GIBArK','12rBWqTe','/smartapi/custom/saveUserCustomSql','create'];a236_0x33ae=function(){return _0xf659e3;};return a236_0x33ae();}import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x5386f9){const _0x22d0c6=a236_0x4b53;if(_0x5386f9===_0x22d0c6(0x155))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x22d0c6(0x152),_0x22d0c6(0x143),'']['join']('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x22d0c6(0x14e)]('\x0a');}export const sqlCreate={'service':'sql','command':a236_0x56c34f(0x13b),'description':a236_0x56c34f(0x135),'risk':'write','flags':[{'name':a236_0x56c34f(0x170),'type':'string','description':'SQL\x20query\x20display\x20name'},{'name':a236_0x56c34f(0x16f),'type':a236_0x56c34f(0x147),'description':a236_0x56c34f(0x160)},{'name':a236_0x56c34f(0x150),'type':a236_0x56c34f(0x169),'enum':[a236_0x56c34f(0x137),a236_0x56c34f(0x155)],'description':a236_0x56c34f(0x132)}],async 'validate'(_0x38e9de){const _0x2baa77=a236_0x56c34f;if(!_0x38e9de[_0x2baa77(0x12c)])return;if(!_0x38e9de[_0x2baa77(0x148)](_0x2baa77(0x170))[_0x2baa77(0x163)]())throw CliErrors['flagMissing'](_0x2baa77(0x170),_0x2baa77(0x161));const _0x1e18cf=resolveProvidedDbId(_0x38e9de);if(typeof _0x1e18cf!==_0x2baa77(0x147)||!Number['isFinite'](_0x1e18cf)||_0x1e18cf<=0x0)throw CliErrors['flagMissing'](_0x2baa77(0x16f),_0x2baa77(0x16b));if(!_0x38e9de[_0x2baa77(0x148)](_0x2baa77(0x150))[_0x2baa77(0x163)]())throw CliErrors[_0x2baa77(0x140)](_0x2baa77(0x150),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x517ee4){const _0x5ae061=a236_0x56c34f,_0x2af7da=loadSqlProjectConfig(_0x517ee4[_0x5ae061(0x156)]),{sqlName:_0xfe88e5,dbId:_0x40d473,dbName:_0x165cdd,mode:_0x14cb41}=await resolveSqlNewInputs(_0x517ee4),_0x455d0d=buildSqlRelativePath(_0x5ae061(0x12e),_0xfe88e5,_0x165cdd,_0x14cb41,_0x40d473),_0x2b7f40=_0x2af7da[_0x5ae061(0x154)]+'/'+_0x455d0d;return{'method':_0x5ae061(0x166),'url':_0x5ae061(0x13a),'body':{'appCode':_0x517ee4[_0x5ae061(0x156)],'sqlName':_0xfe88e5,'dbId':_0x40d473,'mode':_0x14cb41,'localPath':_0x2b7f40},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x2af7da[_0x5ae061(0x154)]};},async 'execute'(_0xd33b3b){const _0x235f5a=a236_0x56c34f,_0x5c7687=loadSqlProjectConfig(_0xd33b3b[_0x235f5a(0x156)]),{sqlName:_0x1deb48,dbId:_0x3f3e9e,dbName:_0x249b92,mode:_0x57269f}=await resolveSqlNewInputs(_0xd33b3b),_0xc9c76=generateSqlTemplate(_0x57269f),_0x1485ce=await createSqlQuery({'appCode':_0xd33b3b[_0x235f5a(0x156)],'sqlName':_0x1deb48,'dbId':_0x3f3e9e,'sqlContent':_0xc9c76}),_0x577225=ensureRemoteSqlContent(_0x1485ce),_0x2c14de=_0x249b92||await getDbName(_0xd33b3b['appCode'],_0x3f3e9e)[_0x235f5a(0x171)](()=>undefined),_0x15a23c=buildSqlRelativePath(_0x1485ce[_0x235f5a(0x146)],_0x1485ce[_0x235f5a(0x158)],_0x2c14de,_0x57269f,_0x3f3e9e),_0x4a03b7=_0x5c7687[_0x235f5a(0x154)]+'/'+_0x15a23c,_0x25df59=buildLocalSqlFileContent({'sqlCode':_0x1485ce['sqlCode'],'sqlName':_0x1485ce['sqlName'],'dbId':_0x1485ce['dbId']},_0x577225,{'dbName':_0x2c14de,'mode':_0x57269f,'syncedAt':new Date()[_0x235f5a(0x14f)](),'description':_0x1485ce[_0x235f5a(0x141)]});if(await fileExists(_0x4a03b7))throw CliErrors[_0x235f5a(0x165)](_0x235f5a(0x167)+_0x4a03b7);await ensureParentDirectory(_0x4a03b7),await writeFile(_0x4a03b7,_0x25df59,_0x235f5a(0x15e));const _0x14c0af=await readSqlLockFile(_0x5c7687[_0x235f5a(0x149)]),{lockData:_0x20b8d3,appLock:_0x42c8af}=ensureSqlLockScope(_0x14c0af??createEmptySqlLock(),_0x5c7687[_0x235f5a(0x156)],_0x5c7687[_0x235f5a(0x136)],_0x235f5a(0x16a));return _0x42c8af[_0x235f5a(0x162)][_0x1485ce[_0x235f5a(0x146)]]={...buildSqlLockEntry(_0x1485ce,_0x577225,computeSqlContentHash(_0x25df59),{'dbName':_0x2c14de}),'path':_0x15a23c,'mode':_0x57269f},_0x42c8af[_0x235f5a(0x133)]=new Date()[_0x235f5a(0x14f)](),await writeSqlLockFile(_0x5c7687[_0x235f5a(0x149)],_0x20b8d3),{'ok':!![],'data':{'id':_0x1485ce['id'],'sqlCode':_0x1485ce[_0x235f5a(0x146)],'sqlName':_0x1485ce[_0x235f5a(0x158)],'dbId':_0x1485ce[_0x235f5a(0x164)],'path':_0x4a03b7,'mode':_0x57269f},'message':_0x235f5a(0x131)+_0x1485ce[_0x235f5a(0x146)]};}};function a236_0x4b53(_0x28f032,_0x47125d){_0x28f032=_0x28f032-0x12c;const _0x33ae65=a236_0x33ae();let _0x4b5386=_0x33ae65[_0x28f032];return _0x4b5386;}async function resolveSqlNewInputs(_0x5324b4){const _0x227703=await resolveSqlNameInput(_0x5324b4),{dbId:_0x4f7e85,dbName:_0x576658}=await resolveDbSelection(_0x5324b4),_0xb2c645=await resolveSqlModeInput(_0x5324b4);return{'sqlName':_0x227703,'dbId':_0x4f7e85,'dbName':_0x576658,'mode':_0xb2c645};}async function resolveSqlNameInput(_0x350dc7){const _0x586407=a236_0x56c34f,_0x20f9f5=_0x350dc7[_0x586407(0x148)](_0x586407(0x170))[_0x586407(0x163)]();if(_0x20f9f5)return _0x20f9f5;if(_0x350dc7[_0x586407(0x12c)])throw CliErrors['flagMissing'](_0x586407(0x170),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x586407(0x13e),'validate':_0x1f20f9=>_0x1f20f9['trim']()?!![]:_0x586407(0x14a)}))[_0x586407(0x163)]();}async function resolveDbSelection(_0x1e5dd1){const _0x54191d=a236_0x56c34f,_0x3124f7=resolveProvidedDbId(_0x1e5dd1);if(typeof _0x3124f7===_0x54191d(0x147)&&Number[_0x54191d(0x144)](_0x3124f7)&&_0x3124f7>0x0)return{'dbId':_0x3124f7,'dbName':await getDbName(_0x1e5dd1['appCode'],_0x3124f7)[_0x54191d(0x171)](()=>undefined)};if(_0x1e5dd1[_0x54191d(0x12c)])throw CliErrors[_0x54191d(0x140)](_0x54191d(0x16f),_0x54191d(0x16b));const _0x186d01=await listDatabases(_0x1e5dd1[_0x54191d(0x156)])[_0x54191d(0x171)](()=>[]);if(_0x186d01[_0x54191d(0x14c)]===0x1)return{'dbId':_0x186d01[0x0]['dbId'],'dbName':_0x186d01[0x0][_0x54191d(0x15d)]};if(_0x186d01[_0x54191d(0x14c)]>0x1){const _0x4167d0=await select({'message':_0x54191d(0x172),'choices':[..._0x186d01['map'](_0x4dc9f1=>({'name':_0x4dc9f1[_0x54191d(0x15d)]+'\x20('+_0x4dc9f1['dbId']+')','value':serializeDbSelection(_0x4dc9f1)})),{'name':_0x54191d(0x14d),'value':_0x54191d(0x134)}]});if(_0x4167d0!==_0x54191d(0x134))return deserializeDbSelection(_0x4167d0);}const _0x3a3bc5=await input({'message':_0x54191d(0x14b),'validate':_0x46028c=>{const _0x671f5e=_0x54191d,_0x3cf2e2=_0x46028c[_0x671f5e(0x163)]();if(!_0x3cf2e2)return _0x671f5e(0x159);const _0x59bf67=Number(_0x3cf2e2);if(!Number[_0x671f5e(0x15f)](_0x59bf67)||_0x59bf67<=0x0)return _0x671f5e(0x13c);return!![];}});return{'dbId':Number(_0x3a3bc5['trim']())};}async function resolveSqlModeInput(_0xe9a7fd){const _0x223ea1=a236_0x56c34f,_0x7e14a5=_0xe9a7fd[_0x223ea1(0x148)](_0x223ea1(0x150))[_0x223ea1(0x163)]();if(_0x7e14a5==='sql'||_0x7e14a5===_0x223ea1(0x155))return _0x7e14a5;if(_0xe9a7fd['nonInteractive'])throw CliErrors['flagMissing'](_0x223ea1(0x150),_0x223ea1(0x13d));return await select({'message':_0x223ea1(0x142),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':'sql','description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x223ea1(0x16c),'value':_0x223ea1(0x155),'description':_0x223ea1(0x153)}]});}function serializeDbSelection(_0x195fd0){const _0x18d6c3=a236_0x56c34f;return JSON['stringify']({'dbId':_0x195fd0[_0x18d6c3(0x164)],'dbName':_0x195fd0[_0x18d6c3(0x15d)]});}function deserializeDbSelection(_0x29a9df){const _0x22f87b=a236_0x56c34f;try{const _0x3e4cc8=JSON[_0x22f87b(0x12f)](_0x29a9df);if(typeof _0x3e4cc8[_0x22f87b(0x164)]===_0x22f87b(0x147)&&Number['isFinite'](_0x3e4cc8['dbId']))return{'dbId':_0x3e4cc8[_0x22f87b(0x164)],'dbName':_0x3e4cc8[_0x22f87b(0x15d)]};}catch{}throw CliErrors[_0x22f87b(0x165)](_0x22f87b(0x13f)+_0x29a9df);}function resolveProvidedDbId(_0x4de77c){const _0x1b5308=a236_0x56c34f,_0x53439d=_0x4de77c['flag'](_0x1b5308(0x16f));if(typeof _0x53439d===_0x1b5308(0x147)&&Number[_0x1b5308(0x144)](_0x53439d))return _0x53439d;return undefined;}
@@ -1 +1 @@
1
- const a237_0x953149=a237_0x2333;(function(_0x150ee4,_0x5bdce8){const _0x44d3c5=a237_0x2333,_0x600ad9=_0x150ee4();while(!![]){try{const _0x590b94=parseInt(_0x44d3c5(0x127))/0x1+-parseInt(_0x44d3c5(0x12e))/0x2*(-parseInt(_0x44d3c5(0x129))/0x3)+parseInt(_0x44d3c5(0x142))/0x4*(parseInt(_0x44d3c5(0x131))/0x5)+parseInt(_0x44d3c5(0x128))/0x6+-parseInt(_0x44d3c5(0x148))/0x7*(parseInt(_0x44d3c5(0x141))/0x8)+parseInt(_0x44d3c5(0x12f))/0x9*(-parseInt(_0x44d3c5(0x13a))/0xa)+parseInt(_0x44d3c5(0x13f))/0xb*(-parseInt(_0x44d3c5(0x14b))/0xc);if(_0x590b94===_0x5bdce8)break;else _0x600ad9['push'](_0x600ad9['shift']());}catch(_0x3a4678){_0x600ad9['push'](_0x600ad9['shift']());}}}(a237_0x43bd,0x38614));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a237_0x43bd(){const _0x501b2b=['projectRoot','trashDir','20uYxDDW','fromEntries','appCode','length','startsWith','55YIyOcL','/smartapi/custom/deleteUserCustomSql','8ptzFfx','15804KfvaGB','delete','lastSync','str','remoteId','sqls','612647EqomCX','validation','POST','943524ghWFnc','Would\x20delete\x20SQL\x20','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','Deleted\x20','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','high-risk-write','135233HmYVsE','1638174kZBkcl','1129209unRcxT','sql','SQL\x20lock\x20file\x20not\x20found.','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','trashedTo','2xBLhok','808893znLRMn','sqlcode','135JUJrBB','filter','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','entries','sqlRoot','lockFilePath','toISOString'];a237_0x43bd=function(){return _0x501b2b;};return a237_0x43bd();}import{dirname,join,relative,resolve,sep}from'node:path';function a237_0x2333(_0x39bbae,_0xaabfa1){_0x39bbae=_0x39bbae-0x127;const _0x43bd22=a237_0x43bd();let _0x2333e2=_0x43bd22[_0x39bbae];return _0x2333e2;}import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a237_0x953149(0x12a),'command':a237_0x953149(0x143),'description':a237_0x953149(0x14d),'risk':a237_0x953149(0x150),'flags':[SQLCODE_FLAG],async 'validate'(_0x3453a7){const _0x2afca4=a237_0x953149,_0x49ee67=loadSqlProjectConfig(_0x3453a7[_0x2afca4(0x13c)]),_0x5672fd=await readSqlLockFile(_0x49ee67[_0x2afca4(0x136)]);if(!_0x5672fd)throw CliErrors[_0x2afca4(0x149)](_0x2afca4(0x133));},async 'dryRun'(_0x1b7c87){const _0x4d1272=a237_0x953149,_0x3ecbcd=loadSqlProjectConfig(_0x1b7c87['appCode']),_0x496037=await readSqlLockFile(_0x3ecbcd[_0x4d1272(0x136)]);if(!_0x496037)throw CliErrors['validation'](_0x4d1272(0x133));const {appLock:_0xff110d}=ensureSqlLockScope(_0x496037,_0x1b7c87[_0x4d1272(0x13c)],_0x3ecbcd['sqlRoot'],_0x4d1272(0x143)),_0x4e7485=_0x1b7c87['str'](_0x4d1272(0x130)),_0x45d742=_0xff110d[_0x4d1272(0x147)][_0x4e7485];if(!_0x45d742)throw CliErrors[_0x4d1272(0x149)](_0x4d1272(0x14f)+_0x4e7485+'\x22.');return{'method':_0x4d1272(0x14a),'url':_0x4d1272(0x140),'body':{'sqlCode':_0x4e7485,'id':_0x45d742[_0x4d1272(0x146)],'localPath':resolveLocalSqlFilePath(_0x3ecbcd,_0x4e7485,_0x45d742)},'description':_0x4d1272(0x14c)+_0x4e7485+_0x4d1272(0x12c)+_0x3ecbcd[_0x4d1272(0x139)]};},async 'execute'(_0x1db5f7){const _0x5065e3=a237_0x953149,_0x2029a9=loadSqlProjectConfig(_0x1db5f7[_0x5065e3(0x13c)]),_0x1d84c8=await readSqlLockFile(_0x2029a9[_0x5065e3(0x136)]);if(!_0x1d84c8)throw CliErrors[_0x5065e3(0x149)](_0x5065e3(0x12b));const {lockData:_0x3a9af4,appLock:_0x222d2a}=ensureSqlLockScope(_0x1d84c8,_0x1db5f7[_0x5065e3(0x13c)],_0x2029a9[_0x5065e3(0x135)],'delete'),_0x59ceaf=_0x1db5f7[_0x5065e3(0x145)](_0x5065e3(0x130)),_0x30aad1=_0x222d2a[_0x5065e3(0x147)][_0x59ceaf];if(!_0x30aad1)throw CliErrors['validation']('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x59ceaf+'\x22.');await deleteSqlQuery({'id':_0x30aad1[_0x5065e3(0x146)],'sqlCode':_0x59ceaf}),_0x222d2a[_0x5065e3(0x147)]=Object[_0x5065e3(0x13b)](Object[_0x5065e3(0x134)](_0x222d2a[_0x5065e3(0x147)])[_0x5065e3(0x132)](([_0x161446])=>_0x161446!==_0x59ceaf)),_0x222d2a[_0x5065e3(0x144)]=new Date()['toISOString'](),await writeSqlLockFile(_0x2029a9[_0x5065e3(0x136)],_0x3a9af4);const _0x28cadd=resolveLocalSqlFilePath(_0x2029a9,_0x59ceaf,_0x30aad1);let _0xe73812;await fileExists(_0x28cadd)&&(_0xe73812=await moveToTrash(_0x2029a9[_0x5065e3(0x138)],_0x2029a9[_0x5065e3(0x139)],_0x28cadd),await cleanupEmptyDirectories(dirname(_0x28cadd),_0x2029a9['sqlRootDir']));const _0xe3db97={'deleted':_0x59ceaf,'remoteId':_0x30aad1[_0x5065e3(0x146)]};if(_0xe73812)_0xe3db97[_0x5065e3(0x12d)]=_0xe73812;return{'ok':!![],'data':_0xe3db97,'message':_0x5065e3(0x14e)+_0x59ceaf+(_0xe73812?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x2dc897,_0x8f3197,_0x43b334){const _0x19679b=a237_0x953149,_0x2eef2e=new Date()[_0x19679b(0x137)]()['replace'](/[:.]/g,'-'),_0x3e31f0=relative(_0x2dc897,_0x43b334),_0x11a1fb=join(_0x8f3197,_0x2eef2e,_0x3e31f0);return await mkdir(dirname(_0x11a1fb),{'recursive':!![]}),await rename(_0x43b334,_0x11a1fb),_0x11a1fb;}async function cleanupEmptyDirectories(_0x7e96ed,_0x236c82){const _0x222d62=a237_0x953149;let _0x2c0bfc=resolve(_0x7e96ed);const _0x238535=resolve(_0x236c82);while(_0x2c0bfc[_0x222d62(0x13e)](''+_0x238535+sep)||_0x2c0bfc===_0x238535){if(_0x2c0bfc===_0x238535)return;try{const _0x1c9a75=await readdir(_0x2c0bfc);if(_0x1c9a75[_0x222d62(0x13d)]>0x0)return;await rmdir(_0x2c0bfc);}catch{return;}_0x2c0bfc=dirname(_0x2c0bfc);}}
1
+ function a237_0x26a8(){const _0x280d26=['lastSync','trashDir','projectRoot','length','validation','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','145355iWMJia','9148QLAGJs','466713ktlNwu','replace','remoteId','5019212YsLCtH','high-risk-write','toISOString','SQL\x20lock\x20file\x20not\x20found.','997780hbkVcD','2569084qCReUe','sqls','94LXppdu','appCode','sql','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','delete','lockFilePath','1210539HCHNsI','sqlRoot','102aGQKer','sqlRootDir','sqlcode','/smartapi/custom/deleteUserCustomSql','POST','40ockWbz','entries','trashedTo','Deleted\x20','fromEntries','110MmvtNb','\x20(local\x20file\x20moved\x20to\x20trash)','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'];a237_0x26a8=function(){return _0x280d26;};return a237_0x26a8();}const a237_0x53d290=a237_0x28a9;(function(_0x24de0e,_0x36da60){const _0x115cb0=a237_0x28a9,_0x5d68f8=_0x24de0e();while(!![]){try{const _0x1e4031=-parseInt(_0x115cb0(0x138))/0x1*(-parseInt(_0x115cb0(0x143))/0x2)+-parseInt(_0x115cb0(0x122))/0x3+-parseInt(_0x115cb0(0x141))/0x4+parseInt(_0x115cb0(0x137))/0x5*(parseInt(_0x115cb0(0x124))/0x6)+parseInt(_0x115cb0(0x140))/0x7*(parseInt(_0x115cb0(0x129))/0x8)+-parseInt(_0x115cb0(0x139))/0x9*(parseInt(_0x115cb0(0x12e))/0xa)+parseInt(_0x115cb0(0x13c))/0xb;if(_0x1e4031===_0x36da60)break;else _0x5d68f8['push'](_0x5d68f8['shift']());}catch(_0x40fe4d){_0x5d68f8['push'](_0x5d68f8['shift']());}}}(a237_0x26a8,0x74710));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a237_0x28a9(_0x40d4d3,_0x1ccb7a){_0x40d4d3=_0x40d4d3-0x122;const _0x26a87b=a237_0x26a8();let _0x28a932=_0x26a87b[_0x40d4d3];return _0x28a932;}import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a237_0x53d290(0x145),'command':a237_0x53d290(0x147),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a237_0x53d290(0x13d),'flags':[SQLCODE_FLAG],async 'validate'(_0x32009c){const _0xef56a2=a237_0x53d290,_0x56d529=loadSqlProjectConfig(_0x32009c[_0xef56a2(0x144)]),_0x2fb808=await readSqlLockFile(_0x56d529['lockFilePath']);if(!_0x2fb808)throw CliErrors[_0xef56a2(0x135)](_0xef56a2(0x146));},async 'dryRun'(_0x3c8069){const _0x101aa6=a237_0x53d290,_0x179203=loadSqlProjectConfig(_0x3c8069[_0x101aa6(0x144)]),_0x2a1395=await readSqlLockFile(_0x179203['lockFilePath']);if(!_0x2a1395)throw CliErrors['validation'](_0x101aa6(0x146));const {appLock:_0x4812e}=ensureSqlLockScope(_0x2a1395,_0x3c8069[_0x101aa6(0x144)],_0x179203[_0x101aa6(0x123)],_0x101aa6(0x147)),_0x4778e8=_0x3c8069['str'](_0x101aa6(0x126)),_0x57ef0f=_0x4812e[_0x101aa6(0x142)][_0x4778e8];if(!_0x57ef0f)throw CliErrors[_0x101aa6(0x135)](_0x101aa6(0x136)+_0x4778e8+'\x22.');return{'method':_0x101aa6(0x128),'url':_0x101aa6(0x127),'body':{'sqlCode':_0x4778e8,'id':_0x57ef0f['remoteId'],'localPath':resolveLocalSqlFilePath(_0x179203,_0x4778e8,_0x57ef0f)},'description':'Would\x20delete\x20SQL\x20'+_0x4778e8+_0x101aa6(0x130)+_0x179203[_0x101aa6(0x132)]};},async 'execute'(_0x3bbc48){const _0x3d83c5=a237_0x53d290,_0x5a516a=loadSqlProjectConfig(_0x3bbc48[_0x3d83c5(0x144)]),_0x4675a8=await readSqlLockFile(_0x5a516a['lockFilePath']);if(!_0x4675a8)throw CliErrors['validation'](_0x3d83c5(0x13f));const {lockData:_0x47e3ba,appLock:_0x2e3650}=ensureSqlLockScope(_0x4675a8,_0x3bbc48['appCode'],_0x5a516a[_0x3d83c5(0x123)],_0x3d83c5(0x147)),_0x35b23b=_0x3bbc48['str'](_0x3d83c5(0x126)),_0x27e31e=_0x2e3650[_0x3d83c5(0x142)][_0x35b23b];if(!_0x27e31e)throw CliErrors['validation']('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x35b23b+'\x22.');await deleteSqlQuery({'id':_0x27e31e[_0x3d83c5(0x13b)],'sqlCode':_0x35b23b}),_0x2e3650['sqls']=Object[_0x3d83c5(0x12d)](Object[_0x3d83c5(0x12a)](_0x2e3650['sqls'])['filter'](([_0xb0b447])=>_0xb0b447!==_0x35b23b)),_0x2e3650[_0x3d83c5(0x131)]=new Date()[_0x3d83c5(0x13e)](),await writeSqlLockFile(_0x5a516a[_0x3d83c5(0x148)],_0x47e3ba);const _0x3687af=resolveLocalSqlFilePath(_0x5a516a,_0x35b23b,_0x27e31e);let _0x5da5ae;await fileExists(_0x3687af)&&(_0x5da5ae=await moveToTrash(_0x5a516a[_0x3d83c5(0x133)],_0x5a516a[_0x3d83c5(0x132)],_0x3687af),await cleanupEmptyDirectories(dirname(_0x3687af),_0x5a516a[_0x3d83c5(0x125)]));const _0x371bbd={'deleted':_0x35b23b,'remoteId':_0x27e31e[_0x3d83c5(0x13b)]};if(_0x5da5ae)_0x371bbd[_0x3d83c5(0x12b)]=_0x5da5ae;return{'ok':!![],'data':_0x371bbd,'message':_0x3d83c5(0x12c)+_0x35b23b+(_0x5da5ae?_0x3d83c5(0x12f):'')};}};async function moveToTrash(_0x37ee74,_0x2d570a,_0x31a8a1){const _0x8e82af=a237_0x53d290,_0x329928=new Date()[_0x8e82af(0x13e)]()[_0x8e82af(0x13a)](/[:.]/g,'-'),_0x1acfe9=relative(_0x37ee74,_0x31a8a1),_0x304ab8=join(_0x2d570a,_0x329928,_0x1acfe9);return await mkdir(dirname(_0x304ab8),{'recursive':!![]}),await rename(_0x31a8a1,_0x304ab8),_0x304ab8;}async function cleanupEmptyDirectories(_0x3cd6c0,_0x2e2cdc){const _0x3e8065=a237_0x53d290;let _0x260e8b=resolve(_0x3cd6c0);const _0x2394e3=resolve(_0x2e2cdc);while(_0x260e8b['startsWith'](''+_0x2394e3+sep)||_0x260e8b===_0x2394e3){if(_0x260e8b===_0x2394e3)return;try{const _0xdb796c=await readdir(_0x260e8b);if(_0xdb796c[_0x3e8065(0x134)]>0x0)return;await rmdir(_0x260e8b);}catch{return;}_0x260e8b=dirname(_0x260e8b);}}
@@ -1 +1 @@
1
- const a238_0x132486=a238_0x9b1a;function a238_0x4929(){const _0x404c80=['16051200abmRnl','344202OwBmPq','sqlcode','3730RGhDci','9AHoyid','63DRXaFb','description','9229qGDukp','boolean','dbId','379664YdsQyD','verbose','detail','2UAtMjv','appCode','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','382904nOydEm','403315jgYKvV','Return\x20full\x20raw\x20SQL\x20query\x20object','1628991aHIjTN','sql','12JQRLDY','sqlContent'];a238_0x4929=function(){return _0x404c80;};return a238_0x4929();}(function(_0x3a696c,_0x21afd4){const _0x4b0ff2=a238_0x9b1a,_0x5d7595=_0x3a696c();while(!![]){try{const _0x34345d=-parseInt(_0x4b0ff2(0x93))/0x1*(parseInt(_0x4b0ff2(0x96))/0x2)+-parseInt(_0x4b0ff2(0x85))/0x3+parseInt(_0x4b0ff2(0x87))/0x4*(parseInt(_0x4b0ff2(0x83))/0x5)+parseInt(_0x4b0ff2(0x8a))/0x6*(parseInt(_0x4b0ff2(0x8e))/0x7)+-parseInt(_0x4b0ff2(0x82))/0x8*(-parseInt(_0x4b0ff2(0x8d))/0x9)+parseInt(_0x4b0ff2(0x8c))/0xa*(-parseInt(_0x4b0ff2(0x90))/0xb)+parseInt(_0x4b0ff2(0x89))/0xc;if(_0x34345d===_0x21afd4)break;else _0x5d7595['push'](_0x5d7595['shift']());}catch(_0x906002){_0x5d7595['push'](_0x5d7595['shift']());}}}(a238_0x4929,0xddb73));function a238_0x9b1a(_0x32f652,_0x3df726){_0x32f652=_0x32f652-0x82;const _0x492986=a238_0x4929();let _0x9b1ac0=_0x492986[_0x32f652];return _0x9b1ac0;}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a238_0x132486(0x86),'command':a238_0x132486(0x95),'description':a238_0x132486(0x98),'risk':'read','flags':[SQLCODE_FLAG,{'name':a238_0x132486(0x94),'type':a238_0x132486(0x91),'description':a238_0x132486(0x84)}],async 'execute'(_0x2a7f14){const _0x19fb17=a238_0x132486,_0x361ac6=await getSqlQueryInfo(_0x2a7f14[_0x19fb17(0x97)],_0x2a7f14['str'](_0x19fb17(0x8b))),_0x30573c=_0x2a7f14['bool'](_0x19fb17(0x94));if(_0x30573c)return{'ok':!![],'data':_0x361ac6};const _0x378072=_0x361ac6[_0x19fb17(0x92)]?await getDbName(_0x2a7f14['appCode'],_0x361ac6['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x361ac6['sqlCode'],'sqlName':_0x361ac6['sqlName'],'db':_0x378072?_0x378072+'\x20('+_0x361ac6[_0x19fb17(0x92)]+')':_0x361ac6['dbId']??'','description':_0x361ac6[_0x19fb17(0x8f)]??'','sqlContent':_0x361ac6[_0x19fb17(0x88)]??''}};}};
1
+ const a238_0x19d200=a238_0xd731;function a238_0x180e(){const _0x4ffec3=['57445056rwYXfX','36AmodZp','1590425MEftUk','detail','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','bool','175kZkGmS','appCode','sqlcode','description','9wDhgSx','365865FHLgfN','484341TKilEN','3HKQfrx','2696002zqLKsa','boolean','read','dbId','sqlContent','10912528fSxbPY','sqlCode','sqlName','verbose','180ndTaYs','266082GcRFgP'];a238_0x180e=function(){return _0x4ffec3;};return a238_0x180e();}(function(_0x3d2264,_0x41f56b){const _0x478c30=a238_0xd731,_0x407024=_0x3d2264();while(!![]){try{const _0x1aa7dc=-parseInt(_0x478c30(0x113))/0x1+parseInt(_0x478c30(0x106))/0x2*(-parseInt(_0x478c30(0x105))/0x3)+-parseInt(_0x478c30(0x112))/0x4*(-parseInt(_0x478c30(0x103))/0x5)+-parseInt(_0x478c30(0x110))/0x6*(parseInt(_0x478c30(0x117))/0x7)+parseInt(_0x478c30(0x10b))/0x8*(-parseInt(_0x478c30(0x11b))/0x9)+-parseInt(_0x478c30(0x10f))/0xa*(-parseInt(_0x478c30(0x104))/0xb)+parseInt(_0x478c30(0x111))/0xc;if(_0x1aa7dc===_0x41f56b)break;else _0x407024['push'](_0x407024['shift']());}catch(_0x83ff6){_0x407024['push'](_0x407024['shift']());}}}(a238_0x180e,0xc9e9c));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a238_0xd731(_0x31b2f4,_0x2c1a05){_0x31b2f4=_0x31b2f4-0x103;const _0x180ea3=a238_0x180e();let _0xd73188=_0x180ea3[_0x31b2f4];return _0xd73188;}export const sqlDetail={'service':'sql','command':a238_0x19d200(0x114),'description':a238_0x19d200(0x115),'risk':a238_0x19d200(0x108),'flags':[SQLCODE_FLAG,{'name':a238_0x19d200(0x10e),'type':a238_0x19d200(0x107),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x44b4fa){const _0x3ceb5a=a238_0x19d200,_0x35901b=await getSqlQueryInfo(_0x44b4fa['appCode'],_0x44b4fa['str'](_0x3ceb5a(0x119))),_0x15f5b9=_0x44b4fa[_0x3ceb5a(0x116)](_0x3ceb5a(0x10e));if(_0x15f5b9)return{'ok':!![],'data':_0x35901b};const _0x13cad5=_0x35901b[_0x3ceb5a(0x109)]?await getDbName(_0x44b4fa[_0x3ceb5a(0x118)],_0x35901b[_0x3ceb5a(0x109)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x35901b[_0x3ceb5a(0x10c)],'sqlName':_0x35901b[_0x3ceb5a(0x10d)],'db':_0x13cad5?_0x13cad5+'\x20('+_0x35901b[_0x3ceb5a(0x109)]+')':_0x35901b[_0x3ceb5a(0x109)]??'','description':_0x35901b[_0x3ceb5a(0x11a)]??'','sqlContent':_0x35901b[_0x3ceb5a(0x10a)]??''}};}};
@@ -1 +1 @@
1
- function a239_0x4a3e(_0x55b4b6,_0x7420b8){_0x55b4b6=_0x55b4b6-0xb2;const _0x24571e=a239_0x2457();let _0x4a3e6d=_0x24571e[_0x55b4b6];return _0x4a3e6d;}const a239_0x1be826=a239_0x4a3e;function a239_0x2457(){const _0x59d4f9=['length','248YLYidR','read','execError','272944WXQWZo','3027740XaYqbO','31988yBKizX','isArray','11195XkdmJf','execResult','9pVgANT','now','appCode','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','2dIlbhQ','1852jsWwuc','execSuccess','2993154QTRBeW','3122586oAEvka','sql','1061266VelUUn','8868cfXPve','SQL\x20execution\x20failed'];a239_0x2457=function(){return _0x59d4f9;};return a239_0x2457();}(function(_0x5a8df7,_0x514e75){const _0x48f5c2=a239_0x4a3e,_0x539445=_0x5a8df7();while(!![]){try{const _0x28a74c=-parseInt(_0x48f5c2(0xc6))/0x1*(parseInt(_0x48f5c2(0xb5))/0x2)+parseInt(_0x48f5c2(0xb3))/0x3+-parseInt(_0x48f5c2(0xc7))/0x4*(parseInt(_0x48f5c2(0xc0))/0x5)+parseInt(_0x48f5c2(0xb2))/0x6+parseInt(_0x48f5c2(0xbc))/0x7*(-parseInt(_0x48f5c2(0xb9))/0x8)+parseInt(_0x48f5c2(0xc2))/0x9*(parseInt(_0x48f5c2(0xbd))/0xa)+-parseInt(_0x48f5c2(0xbe))/0xb*(-parseInt(_0x48f5c2(0xb6))/0xc);if(_0x28a74c===_0x514e75)break;else _0x539445['push'](_0x539445['shift']());}catch(_0x44bda0){_0x539445['push'](_0x539445['shift']());}}}(a239_0x2457,0xa7320));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a239_0x1be826(0xb4),'command':'exec','description':a239_0x1be826(0xc5),'risk':a239_0x1be826(0xba),'flags':[SQLCODE_FLAG,{'name':'params','type':'string','description':'SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'}],async 'execute'(_0x17bd3c){const _0x5278b3=a239_0x1be826,_0x513e3d=parseJsonParams(_0x17bd3c['str']('params')),_0x293f94=Date[_0x5278b3(0xc3)](),_0x17a6e9=await executeSql(_0x17bd3c[_0x5278b3(0xc4)],_0x17bd3c['str']('sqlcode'),_0x513e3d),_0x467589=Date[_0x5278b3(0xc3)]()-_0x293f94,_0x56228c=_0x17a6e9?.[_0x5278b3(0xc1)]??_0x17a6e9,_0x12a1b1=_0x17a6e9?.[_0x5278b3(0xc8)]??!![];if(!_0x12a1b1)return{'ok':![],'data':{'error':_0x17a6e9?.[_0x5278b3(0xbb)]||_0x5278b3(0xb7),'elapsed':_0x467589},'message':'SQL\x20execution\x20failed'};const _0x2ce618=Array[_0x5278b3(0xbf)](_0x56228c)?_0x56228c:[];return{'ok':!![],'data':{'rows':_0x2ce618,'rowCount':_0x2ce618[_0x5278b3(0xb8)],'elapsed':_0x467589},'message':'Returned\x20'+_0x2ce618[_0x5278b3(0xb8)]+'\x20row(s)\x20in\x20'+_0x467589+'ms'};}};
1
+ function a239_0x2b61(){const _0x262e73=['942792GmDayT','5FUOcaQ','14tBueZw','1443693rKMxXv','SQL\x20execution\x20failed','sqlcode','str','length','20055882QTaZMu','798800eaYKJL','3062110YFdbCj','execError','\x20row(s)\x20in\x20','execResult','string','425713vnLZwc','appCode','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','execSuccess','18eClRQi','2177408MKSmXy','now','2wgPGaj','params','sql'];a239_0x2b61=function(){return _0x262e73;};return a239_0x2b61();}function a239_0x1874(_0xc736ff,_0x3110f4){_0xc736ff=_0xc736ff-0x14d;const _0x2b61ce=a239_0x2b61();let _0x18740c=_0x2b61ce[_0xc736ff];return _0x18740c;}const a239_0x534992=a239_0x1874;(function(_0x1c0a97,_0x4b0d8e){const _0x1c47ca=a239_0x1874,_0x2f755b=_0x1c0a97();while(!![]){try{const _0x5d9171=-parseInt(_0x1c47ca(0x150))/0x1+parseInt(_0x1c47ca(0x157))/0x2*(parseInt(_0x1c47ca(0x15d))/0x3)+-parseInt(_0x1c47ca(0x163))/0x4*(parseInt(_0x1c47ca(0x15b))/0x5)+-parseInt(_0x1c47ca(0x15a))/0x6+parseInt(_0x1c47ca(0x15c))/0x7*(-parseInt(_0x1c47ca(0x155))/0x8)+-parseInt(_0x1c47ca(0x154))/0x9*(parseInt(_0x1c47ca(0x164))/0xa)+parseInt(_0x1c47ca(0x162))/0xb;if(_0x5d9171===_0x4b0d8e)break;else _0x2f755b['push'](_0x2f755b['shift']());}catch(_0x5253ff){_0x2f755b['push'](_0x2f755b['shift']());}}}(a239_0x2b61,0x59276));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a239_0x534992(0x159),'command':'exec','description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':'read','flags':[SQLCODE_FLAG,{'name':'params','type':a239_0x534992(0x14f),'description':a239_0x534992(0x152)}],async 'execute'(_0x3ae108){const _0x48325a=a239_0x534992,_0x2eae1c=parseJsonParams(_0x3ae108['str'](_0x48325a(0x158))),_0xbd174c=Date[_0x48325a(0x156)](),_0x54a9cc=await executeSql(_0x3ae108[_0x48325a(0x151)],_0x3ae108[_0x48325a(0x160)](_0x48325a(0x15f)),_0x2eae1c),_0x547d95=Date['now']()-_0xbd174c,_0x1cce9a=_0x54a9cc?.[_0x48325a(0x14e)]??_0x54a9cc,_0x1c5034=_0x54a9cc?.[_0x48325a(0x153)]??!![];if(!_0x1c5034)return{'ok':![],'data':{'error':_0x54a9cc?.[_0x48325a(0x165)]||_0x48325a(0x15e),'elapsed':_0x547d95},'message':_0x48325a(0x15e)};const _0x6e2956=Array['isArray'](_0x1cce9a)?_0x1cce9a:[];return{'ok':!![],'data':{'rows':_0x6e2956,'rowCount':_0x6e2956[_0x48325a(0x161)],'elapsed':_0x547d95},'message':'Returned\x20'+_0x6e2956['length']+_0x48325a(0x14d)+_0x547d95+'ms'};}};
@@ -1 +1 @@
1
- function a240_0x54cc(){const _0x295daf=['176MQrIHj','39970HZwpTK','1300578lTdHgC','1832yPhiEW','456mTSQWD','364010PEcKtX','36KSdwjh','9bhaapU','1140607AkILJK','230rKoIGq','5250808aULEfV','21FoIFuy','721364XPwTcR'];a240_0x54cc=function(){return _0x295daf;};return a240_0x54cc();}(function(_0x11fd95,_0x4667b6){const _0x1e8e91=a240_0x2c05,_0x220495=_0x11fd95();while(!![]){try{const _0x455d93=-parseInt(_0x1e8e91(0xe5))/0x1+-parseInt(_0x1e8e91(0xe7))/0x2*(parseInt(_0x1e8e91(0xdf))/0x3)+parseInt(_0x1e8e91(0xdc))/0x4*(-parseInt(_0x1e8e91(0xe2))/0x5)+parseInt(_0x1e8e91(0xe8))/0x6*(-parseInt(_0x1e8e91(0xe4))/0x7)+-parseInt(_0x1e8e91(0xe3))/0x8*(parseInt(_0x1e8e91(0xe0))/0x9)+-parseInt(_0x1e8e91(0xde))/0xa*(parseInt(_0x1e8e91(0xe6))/0xb)+-parseInt(_0x1e8e91(0xdd))/0xc*(-parseInt(_0x1e8e91(0xe1))/0xd);if(_0x455d93===_0x4667b6)break;else _0x220495['push'](_0x220495['shift']());}catch(_0x5408a8){_0x220495['push'](_0x220495['shift']());}}}(a240_0x54cc,0x70fb6));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a240_0x2c05(_0x6e19d0,_0x39c682){_0x6e19d0=_0x6e19d0-0xdc;const _0x54cc5e=a240_0x54cc();let _0x2c0551=_0x54cc5e[_0x6e19d0];return _0x2c0551;}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x310bba,_0x4e42bd){const _0x37e755=a240_0xcb79,_0x388aa7=_0x310bba();while(!![]){try{const _0x2baecd=-parseInt(_0x37e755(0x89))/0x1*(parseInt(_0x37e755(0x91))/0x2)+parseInt(_0x37e755(0x8a))/0x3+-parseInt(_0x37e755(0x86))/0x4*(-parseInt(_0x37e755(0x8c))/0x5)+parseInt(_0x37e755(0x87))/0x6*(parseInt(_0x37e755(0x88))/0x7)+-parseInt(_0x37e755(0x8b))/0x8*(parseInt(_0x37e755(0x90))/0x9)+parseInt(_0x37e755(0x8e))/0xa+parseInt(_0x37e755(0x8f))/0xb*(parseInt(_0x37e755(0x8d))/0xc);if(_0x2baecd===_0x4e42bd)break;else _0x388aa7['push'](_0x388aa7['shift']());}catch(_0x419c9d){_0x388aa7['push'](_0x388aa7['shift']());}}}(a240_0x5104,0x773b0));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';function a240_0xcb79(_0x47d39b,_0x2fd2bf){_0x47d39b=_0x47d39b-0x86;const _0x5104f5=a240_0x5104();let _0xcb793=_0x5104f5[_0x47d39b];return _0xcb793;}import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';function a240_0x5104(){const _0x2cc6af=['2411547LgwgIP','8zRKKOS','815sAOeje','22620ovRuuH','22200uLrRln','1133rXUXiB','7588233InPqZN','23142mdidwo','15316KlxYcc','1228242JYBEEV','7SABDeL','43GUIrmn'];a240_0x5104=function(){return _0x2cc6af;};return a240_0x5104();}import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a241_0x28114=a241_0x3d18;function a241_0x3d18(_0x4f13c3,_0x378c7a){_0x4f13c3=_0x4f13c3-0xf6;const _0x8b9659=a241_0x8b96();let _0x3d185d=_0x8b9659[_0x4f13c3];return _0x3d185d;}(function(_0x125883,_0x15b361){const _0x1e31fb=a241_0x3d18,_0x3867cb=_0x125883();while(!![]){try{const _0x12b82a=parseInt(_0x1e31fb(0x101))/0x1+parseInt(_0x1e31fb(0xfb))/0x2*(-parseInt(_0x1e31fb(0x10d))/0x3)+parseInt(_0x1e31fb(0x10c))/0x4*(parseInt(_0x1e31fb(0x100))/0x5)+-parseInt(_0x1e31fb(0x113))/0x6+parseInt(_0x1e31fb(0x111))/0x7*(parseInt(_0x1e31fb(0xfa))/0x8)+parseInt(_0x1e31fb(0x118))/0x9*(-parseInt(_0x1e31fb(0x114))/0xa)+parseInt(_0x1e31fb(0x10f))/0xb;if(_0x12b82a===_0x15b361)break;else _0x3867cb['push'](_0x3867cb['shift']());}catch(_0x3b8fb6){_0x3867cb['push'](_0x3867cb['shift']());}}}(a241_0x8b96,0x4f63d));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a241_0x8b96(){const _0x226121=['page','description','sql','4vBdjNd','11622kVOfqL','sqlCode','4324672Iqszxt','read','11123IZIEAF','dbId','1090788MMUIqU','13800WBVkmt','List\x20custom\x20SQL\x20queries','string','Page\x20size','3501tJAUBf','paging','tableData','str','\x20SQL\x20queries\x20(total:\x20','appCode','pagesize','376kdtNVl','38SbTuVW','name','No\x20custom\x20SQL\x20queries\x20found.','totalCount','Found\x20','1605925IdTuth','328385sZkhpG','bool','boolean','verbose','map','Page\x20number','length','number'];a241_0x8b96=function(){return _0x226121;};return a241_0x8b96();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a241_0x28114(0x10b),'command':'list','description':a241_0x28114(0x115),'risk':a241_0x28114(0x110),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a241_0x28114(0x116),'description':'Filter\x20by\x20SQL\x20name'},{'name':a241_0x28114(0x109),'type':a241_0x28114(0x108),'description':a241_0x28114(0x106),'default':0x1},{'name':a241_0x28114(0xf9),'type':'number','description':a241_0x28114(0x117)},{'name':a241_0x28114(0x104),'type':a241_0x28114(0x103),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x1a7c64){const _0x5515a1=a241_0x28114,_0x55d618=await listSqlQueries(_0x1a7c64[_0x5515a1(0xf8)],{'sqlCode':_0x1a7c64[_0x5515a1(0xf6)]('sqlcode')||undefined,'sqlName':_0x1a7c64['str'](_0x5515a1(0xfc))||undefined,'currentPage':_0x1a7c64['num']('page'),'pageSize':_0x1a7c64['num'](_0x5515a1(0xf9),0x32)}),_0x53f782=_0x1a7c64[_0x5515a1(0x102)](_0x5515a1(0x104)),_0x351184=_0x55d618[_0x5515a1(0x11a)]??[],_0x1c9c1b=_0x55d618[_0x5515a1(0x119)]?.[_0x5515a1(0xfe)]??_0x351184[_0x5515a1(0x107)];let _0x287558;return _0x53f782?_0x287558=_0x351184:_0x287558=await Promise['all'](_0x351184[_0x5515a1(0x105)](async _0x373e76=>{const _0x5b527f=_0x5515a1;let _0x213529;try{_0x213529=_0x373e76[_0x5b527f(0x112)]?await getDbName(_0x1a7c64[_0x5b527f(0xf8)],_0x373e76['dbId']):undefined;}catch{}return{'sqlCode':_0x373e76[_0x5b527f(0x10e)],'sqlName':_0x373e76['sqlName'],'description':_0x373e76[_0x5b527f(0x10a)]??'','db':_0x213529?_0x213529+'\x20('+_0x373e76[_0x5b527f(0x112)]+')':_0x373e76[_0x5b527f(0x112)]??''};})),{'ok':!![],'data':_0x287558,'message':_0x351184['length']===0x0?_0x5515a1(0xfd):_0x5515a1(0xff)+_0x351184[_0x5515a1(0x107)]+_0x5515a1(0xf7)+_0x1c9c1b+').'};}};
1
+ function a241_0x5db3(_0x174d1a,_0x51d617){_0x174d1a=_0x174d1a-0x144;const _0x49bcd0=a241_0x49bc();let _0x5db303=_0x49bcd0[_0x174d1a];return _0x5db303;}const a241_0x38237a=a241_0x5db3;(function(_0x37f32e,_0xcdc89b){const _0x1c6d62=a241_0x5db3,_0x40a90b=_0x37f32e();while(!![]){try{const _0x161c52=-parseInt(_0x1c6d62(0x15a))/0x1+parseInt(_0x1c6d62(0x163))/0x2*(parseInt(_0x1c6d62(0x15b))/0x3)+-parseInt(_0x1c6d62(0x15f))/0x4*(-parseInt(_0x1c6d62(0x157))/0x5)+-parseInt(_0x1c6d62(0x15e))/0x6*(-parseInt(_0x1c6d62(0x169))/0x7)+-parseInt(_0x1c6d62(0x156))/0x8*(parseInt(_0x1c6d62(0x14d))/0x9)+parseInt(_0x1c6d62(0x155))/0xa*(-parseInt(_0x1c6d62(0x151))/0xb)+parseInt(_0x1c6d62(0x167))/0xc*(parseInt(_0x1c6d62(0x166))/0xd);if(_0x161c52===_0xcdc89b)break;else _0x40a90b['push'](_0x40a90b['shift']());}catch(_0x24dc7a){_0x40a90b['push'](_0x40a90b['shift']());}}}(a241_0x49bc,0xcd255));function a241_0x49bc(){const _0x5cbc80=['sql','145174BbImWs','length','Found\x20','943566iISNjF','420UexExb','Page\x20size','9086GzutGc','string','bool','all','number','verbose','dbId','num','List\x20custom\x20SQL\x20queries','paging','9kMeiLQ','page','sqlCode','str','22fHmbbU','description','Filter\x20by\x20SQL\x20name','read','3231850bwnWKU','10980248fAecIH','185XCXgmM','name','tableData','500391IpGVjf','15pyqjkC','appCode','map','1662pYCwVe','10456TOJMel','sqlcode','pagesize'];a241_0x49bc=function(){return _0x5cbc80;};return a241_0x49bc();}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a241_0x38237a(0x162),'command':'list','description':a241_0x38237a(0x14b),'risk':a241_0x38237a(0x154),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a241_0x38237a(0x158),'type':a241_0x38237a(0x144),'description':a241_0x38237a(0x153)},{'name':'page','type':a241_0x38237a(0x147),'description':'Page\x20number','default':0x1},{'name':a241_0x38237a(0x161),'type':a241_0x38237a(0x147),'description':a241_0x38237a(0x168)},{'name':a241_0x38237a(0x148),'type':'boolean','description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x34b474){const _0x40739f=a241_0x38237a,_0x294949=await listSqlQueries(_0x34b474[_0x40739f(0x15c)],{'sqlCode':_0x34b474['str'](_0x40739f(0x160))||undefined,'sqlName':_0x34b474[_0x40739f(0x150)](_0x40739f(0x158))||undefined,'currentPage':_0x34b474[_0x40739f(0x14a)](_0x40739f(0x14e)),'pageSize':_0x34b474[_0x40739f(0x14a)]('pagesize',0x32)}),_0x31297d=_0x34b474[_0x40739f(0x145)](_0x40739f(0x148)),_0x6d04c3=_0x294949[_0x40739f(0x159)]??[],_0x12107c=_0x294949[_0x40739f(0x14c)]?.['totalCount']??_0x6d04c3['length'];let _0x4c05ff;return _0x31297d?_0x4c05ff=_0x6d04c3:_0x4c05ff=await Promise[_0x40739f(0x146)](_0x6d04c3[_0x40739f(0x15d)](async _0xe3784e=>{const _0x3328e9=_0x40739f;let _0x5bac91;try{_0x5bac91=_0xe3784e[_0x3328e9(0x149)]?await getDbName(_0x34b474[_0x3328e9(0x15c)],_0xe3784e[_0x3328e9(0x149)]):undefined;}catch{}return{'sqlCode':_0xe3784e[_0x3328e9(0x14f)],'sqlName':_0xe3784e['sqlName'],'description':_0xe3784e[_0x3328e9(0x152)]??'','db':_0x5bac91?_0x5bac91+'\x20('+_0xe3784e[_0x3328e9(0x149)]+')':_0xe3784e[_0x3328e9(0x149)]??''};})),{'ok':!![],'data':_0x4c05ff,'message':_0x6d04c3[_0x40739f(0x164)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x40739f(0x165)+_0x6d04c3[_0x40739f(0x164)]+'\x20SQL\x20queries\x20(total:\x20'+_0x12107c+').'};}};
@@ -1 +1 @@
1
- const a242_0x78035e=a242_0x3989;(function(_0x1ce0bf,_0x1a54d9){const _0x2f1838=a242_0x3989,_0x5712cb=_0x1ce0bf();while(!![]){try{const _0x3f5dc5=-parseInt(_0x2f1838(0x106))/0x1+-parseInt(_0x2f1838(0x149))/0x2+-parseInt(_0x2f1838(0x117))/0x3*(parseInt(_0x2f1838(0x108))/0x4)+parseInt(_0x2f1838(0x104))/0x5+-parseInt(_0x2f1838(0x136))/0x6+parseInt(_0x2f1838(0x107))/0x7*(parseInt(_0x2f1838(0x122))/0x8)+parseInt(_0x2f1838(0x10f))/0x9;if(_0x3f5dc5===_0x1a54d9)break;else _0x5712cb['push'](_0x5712cb['shift']());}catch(_0x4b70d0){_0x5712cb['push'](_0x5712cb['shift']());}}}(a242_0x4808,0x69f68));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';function a242_0x3989(_0x6c24c,_0x111de7){_0x6c24c=_0x6c24c-0xfe;const _0x480865=a242_0x4808();let _0x3989ad=_0x480865[_0x6c24c];return _0x3989ad;}import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';function a242_0x4808(){const _0x3082a5=['sql','578930utAmMy','sqlcode','pull','description','join','force','\x20written,\x20','369635ghyoeb','all','468083flnsfw','1456623yoifej','52jwWfHT','catch','filePath','\x20SQL\x20file(s)\x20into\x20','local\x20differs\x20from\x20remote','path','lastSync','12621465wzVmOs','file','name','sqls','Force\x20pull\x20cancelled.','No\x20remote\x20SQL\x20queries\x20matched.','endsWith','\x20skipped,\x20','64041UhZfzL','test','unchanged','isCanonical','appCode','mode','sqlContent','boolean','push','find','toLowerCase','8gnlqVi','length','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','str','nonInteractive','sqlCode','split','sqlName','mybatisXml','some','cancelled','Would\x20pull\x20','string','replace','tableData','sqlRoot','lockFilePath','conflict','hash','dbId','1291908jqUdwc','toISOString','equivalent','.xml','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','skipped','Pull\x20complete:\x20','paging','message','map','Force\x20overwrite\x20local\x20unsynced\x20changes','apps','filter','bool','Filter\x20by\x20SQL\x20display\x20name','\x20failed','would_pull','sqlRootDir'];a242_0x4808=function(){return _0x3082a5;};return a242_0x4808();}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(_0x674418,_0x87be45){const _0x3889e9=a242_0x3989,_0x5a1c2f=[];let _0x5e240b=0x1;while(!![]){const _0x2c92bc=await listSqlQueries(_0x674418,{'currentPage':_0x5e240b,'pageSize':PAGE_SIZE,'sqlCode':_0x87be45[_0x3889e9(0x127)],'sqlName':_0x87be45['sqlName']}),_0x2f5295=_0x2c92bc[_0x3889e9(0x130)]??[];_0x5a1c2f[_0x3889e9(0x11f)](..._0x2f5295);if(_0x2f5295[_0x3889e9(0x123)]===0x0)break;const _0x3905cb=_0x2c92bc[_0x3889e9(0x13d)]?.['totalCount'];if(_0x3905cb!=null?_0x5a1c2f['length']>=_0x3905cb:_0x2f5295['length']<PAGE_SIZE)break;_0x5e240b++;}return _0x5a1c2f;}async function ensureSqlContent(_0x27bf62){const _0x3cab7e=a242_0x3989;if(_0x27bf62['sqlContent']!=null&&String(_0x27bf62[_0x3cab7e(0x11d)])['length']>0x0)return _0x27bf62;return getSqlQueryDetail(_0x27bf62['sqlCode']);}export const sqlPull={'service':a242_0x78035e(0x148),'command':a242_0x78035e(0xff),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a242_0x78035e(0x12e),'description':a242_0x78035e(0x144)},{'name':a242_0x78035e(0x102),'type':a242_0x78035e(0x11e),'description':a242_0x78035e(0x140)}],async 'dryRun'(_0x1bf746){const _0x39df32=a242_0x78035e,_0x2b05fd=loadSqlProjectConfig(_0x1bf746[_0x39df32(0x11b)]),_0x5e135b=await readSqlLockFile(_0x2b05fd[_0x39df32(0x132)]),{appLock:_0x2e0740}=ensureSqlLockScope(_0x5e135b??createEmptySqlLock(),_0x2b05fd[_0x39df32(0x11b)],_0x2b05fd[_0x39df32(0x131)],'pull'),_0x48df14=await fetchAllSqlQueries(_0x1bf746[_0x39df32(0x11b)],{'sqlCode':_0x1bf746['str'](_0x39df32(0xfe))||undefined,'sqlName':_0x1bf746[_0x39df32(0x125)](_0x39df32(0x111))||undefined}),_0x1e93a2=[];for(const _0x4012d3 of _0x48df14){const _0x161ea3=await ensureSqlContent(_0x4012d3),_0x12c60b=ensureRemoteSqlContent(_0x161ea3),_0x57553f=detectSqlMode(_0x12c60b),_0x250677=_0x161ea3[_0x39df32(0x135)]?await getDbName(_0x1bf746[_0x39df32(0x11b)],Number(_0x161ea3['dbId']))[_0x39df32(0x109)](()=>undefined):undefined,_0x376357=buildLocalSqlFileContent({'sqlCode':_0x161ea3[_0x39df32(0x127)],'sqlName':_0x161ea3[_0x39df32(0x129)],'dbId':_0x161ea3[_0x39df32(0x135)]},_0x12c60b,{'dbName':_0x250677,'mode':_0x57553f,'syncedAt':new Date()[_0x39df32(0x137)](),'description':_0x161ea3[_0x39df32(0x100)]}),_0x54108f=buildSqlLockEntry(_0x161ea3,_0x12c60b,'',{'dbName':_0x250677}),_0x31c02b=resolveLocalSqlFilePath(_0x2b05fd,_0x161ea3[_0x39df32(0x127)],_0x54108f);let _0x5ddbb5=_0x39df32(0x146),_0x33a803;const _0x3d462c=await findExistingSqlFiles(_0x2b05fd,_0x31c02b,_0x57553f,_0x2e0740[_0x39df32(0x112)][_0x161ea3[_0x39df32(0x127)]]);if(_0x3d462c[_0x39df32(0x123)]>0x0){const _0x1f1c09=await compareExistingSqlFiles(_0x3d462c,_0x376357,_0x57553f);if(_0x1f1c09['some'](({equivalent:_0x354b5d})=>!_0x354b5d))_0x5ddbb5=_0x39df32(0x133),_0x33a803='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)';else _0x1f1c09['length']===0x1&&_0x1f1c09[0x0]?.[_0x39df32(0x110)][_0x39df32(0x11a)]&&(_0x5ddbb5=_0x39df32(0x13b),_0x33a803=_0x39df32(0x119));}_0x1e93a2[_0x39df32(0x11f)]({'sqlCode':_0x161ea3['sqlCode'],'sqlName':_0x161ea3[_0x39df32(0x129)],'filePath':_0x31c02b,'status':_0x5ddbb5,'reason':_0x33a803});}return{'method':'POST','url':_0x39df32(0x124),'body':{'appCode':_0x1bf746[_0x39df32(0x11b)],'sqlCode':_0x1bf746[_0x39df32(0x125)](_0x39df32(0xfe))||null,'sqlName':_0x1bf746[_0x39df32(0x125)]('name')||null,'files':_0x1e93a2},'description':_0x39df32(0x12d)+_0x1e93a2[_0x39df32(0x123)]+_0x39df32(0x10b)+_0x2b05fd[_0x39df32(0x147)]};},async 'execute'(_0x57c76f){const _0xd49005=a242_0x78035e,_0xed97bb=loadSqlProjectConfig(_0x57c76f[_0xd49005(0x11b)]),_0x4e2523=await readSqlLockFile(_0xed97bb['lockFilePath']),{lockData:_0x5343a6,appLock:_0x49b4e8}=ensureSqlLockScope(_0x4e2523??createEmptySqlLock(),_0xed97bb['appCode'],_0xed97bb['sqlRoot'],'pull'),_0x446644=_0x57c76f[_0xd49005(0x143)](_0xd49005(0x102)),_0x313456=await fetchAllSqlQueries(_0x57c76f[_0xd49005(0x11b)],{'sqlCode':_0x57c76f[_0xd49005(0x125)]('sqlcode')||undefined,'sqlName':_0x57c76f[_0xd49005(0x125)](_0xd49005(0x111))||undefined});if(_0x313456[_0xd49005(0x123)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0xd49005(0x114)};const _0x59568b=[],_0x39bfe6=[];for(const _0x2b87af of _0x313456){try{_0x59568b[_0xd49005(0x11f)](await ensureSqlContent(_0x2b87af));}catch(_0x350edd){_0x39bfe6[_0xd49005(0x11f)]({'sqlCode':_0x2b87af['sqlCode'],'error':_0x350edd instanceof Error?_0x350edd[_0xd49005(0x13e)]:String(_0x350edd)});}}if(_0x446644&&!_0x57c76f[_0xd49005(0x126)]){let _0x4e019f=![];for(const _0x370be4 of _0x59568b){const _0x558a7f=detectSqlMode(ensureRemoteSqlContent(_0x370be4)),_0x544fa8=_0x370be4[_0xd49005(0x135)]?await getDbName(_0x57c76f[_0xd49005(0x11b)],Number(_0x370be4['dbId']))[_0xd49005(0x109)](()=>undefined):undefined,_0x4a5e62=buildLocalSqlFileContent({'sqlCode':_0x370be4[_0xd49005(0x127)],'sqlName':_0x370be4[_0xd49005(0x129)],'dbId':_0x370be4['dbId']},ensureRemoteSqlContent(_0x370be4),{'dbName':_0x544fa8,'mode':_0x558a7f,'syncedAt':new Date()[_0xd49005(0x137)](),'description':_0x370be4[_0xd49005(0x100)]}),_0x128782=resolveLocalSqlFilePath(_0xed97bb,_0x370be4[_0xd49005(0x127)],buildSqlLockEntry(_0x370be4,ensureRemoteSqlContent(_0x370be4),'',{'dbName':_0x544fa8})),_0x1348f4=await findExistingSqlFiles(_0xed97bb,_0x128782,_0x558a7f,_0x49b4e8[_0xd49005(0x112)][_0x370be4[_0xd49005(0x127)]]),_0x125683=await compareExistingSqlFiles(_0x1348f4,_0x4a5e62,_0x558a7f);if(_0x125683[_0xd49005(0x12b)](({equivalent:_0x3ab866})=>!_0x3ab866)){_0x4e019f=!![];break;}}if(_0x4e019f){const _0x54b712=await confirmForceOverwrite(_0xd49005(0x13a));if(!_0x54b712)throw CliErrors[_0xd49005(0x12c)](_0xd49005(0x113));}}const _0xdc1a0e=cloneSqlLockData(_0x5343a6),_0xa3dac8=_0xdc1a0e[_0xd49005(0x141)][_0xed97bb[_0xd49005(0x11b)]],_0x245756=[],_0x531bc6=[];for(const _0xa7b8e2 of _0x59568b){const _0x230cb1=_0xa3dac8[_0xd49005(0x112)][_0xa7b8e2['sqlCode']],_0x1d3b6c=ensureRemoteSqlContent(_0xa7b8e2),_0x37b9a5=detectSqlMode(_0x1d3b6c),_0x373cc9=_0xa7b8e2[_0xd49005(0x135)]?await getDbName(_0x57c76f[_0xd49005(0x11b)],Number(_0xa7b8e2['dbId']))[_0xd49005(0x109)](()=>undefined):undefined,_0x3f9e5c=buildLocalSqlFileContent({'sqlCode':_0xa7b8e2[_0xd49005(0x127)],'sqlName':_0xa7b8e2[_0xd49005(0x129)],'dbId':_0xa7b8e2[_0xd49005(0x135)]},_0x1d3b6c,{'dbName':_0x373cc9,'mode':_0x37b9a5,'syncedAt':new Date()[_0xd49005(0x137)](),'description':_0xa7b8e2[_0xd49005(0x100)]}),_0x5ba94f=buildSqlLockEntry(_0xa7b8e2,_0x1d3b6c,computeSqlContentHash(_0x3f9e5c),{'dbName':_0x373cc9}),_0x34bbc4=_0x5ba94f[_0xd49005(0x10d)],_0x4e8de2=join(_0xed97bb[_0xd49005(0x147)],_0x34bbc4);try{const _0x1fe373=await findExistingSqlFiles(_0xed97bb,_0x4e8de2,_0x37b9a5,_0x230cb1),_0x5f31d2=await compareExistingSqlFiles(_0x1fe373,_0x3f9e5c,_0x37b9a5);if(!_0x446644&&_0x5f31d2[_0xd49005(0x12b)](({equivalent:_0x35619c})=>!_0x35619c)){_0x531bc6[_0xd49005(0x11f)]({'sqlCode':_0xa7b8e2[_0xd49005(0x127)],'reason':_0xd49005(0x10c)});continue;}const _0x30df16=_0x5f31d2['find'](({file:_0x2e610a})=>_0x2e610a[_0xd49005(0x11a)]),_0x5605cd=_0x5f31d2[_0xd49005(0x120)](({file:_0xbe6ca0})=>!_0xbe6ca0[_0xd49005(0x11a)]);if(_0x30df16?.[_0xd49005(0x138)]&&!_0x5605cd){_0x531bc6[_0xd49005(0x11f)]({'sqlCode':_0xa7b8e2[_0xd49005(0x127)],'reason':_0xd49005(0x119)}),_0xa3dac8[_0xd49005(0x112)][_0xa7b8e2[_0xd49005(0x127)]]={..._0x5ba94f,'hash':computeSqlContentHash(_0x30df16['content']),'path':_0x34bbc4};continue;}!_0x30df16?.[_0xd49005(0x138)]&&(await ensureParentDirectory(_0x4e8de2),await writeFile(_0x4e8de2,_0x3f9e5c,'utf8')),_0x5605cd&&await rm(_0x5605cd[_0xd49005(0x110)][_0xd49005(0x10a)],{'force':!![]}),_0xa3dac8[_0xd49005(0x112)][_0xa7b8e2[_0xd49005(0x127)]]={..._0x5ba94f,'hash':_0x30df16?.[_0xd49005(0x138)]?computeSqlContentHash(_0x30df16['content']):_0x5ba94f[_0xd49005(0x134)],'path':_0x34bbc4},_0x245756[_0xd49005(0x11f)]({'sqlCode':_0xa7b8e2[_0xd49005(0x127)],'filePath':_0x4e8de2});}catch(_0x25a236){_0x39bfe6[_0xd49005(0x11f)]({'sqlCode':_0xa7b8e2[_0xd49005(0x127)],'error':_0x25a236 instanceof Error?_0x25a236['message']:String(_0x25a236)});}}return _0xa3dac8[_0xd49005(0x10e)]=new Date()[_0xd49005(0x137)](),await writeSqlLockFile(_0xed97bb[_0xd49005(0x132)],_0xdc1a0e),{'ok':_0x39bfe6[_0xd49005(0x123)]===0x0,'data':{'pulled':_0x245756,'skipped':_0x531bc6,'failed':_0x39bfe6},'message':_0xd49005(0x13c)+_0x245756['length']+_0xd49005(0x103)+_0x531bc6[_0xd49005(0x123)]+_0xd49005(0x116)+_0x39bfe6['length']+_0xd49005(0x145)};}};function isEquivalentPulledSqlFile(_0xda995c,_0xed7044,_0x2f4fe3,_0xe2314){if(_0x2f4fe3!==_0xe2314)return normalizePulledSqlBody(_0xda995c,_0x2f4fe3)===normalizePulledSqlBody(_0xed7044,_0xe2314);return normalizePullComparableContent(_0xda995c,_0x2f4fe3)===normalizePullComparableContent(_0xed7044,_0xe2314);}async function findExistingSqlFiles(_0x446c3e,_0x3557b7,_0x1e4afe,_0x3cb681){const _0x39dac6=a242_0x78035e,_0x3f917e=[];await fileExists(_0x3557b7)&&_0x3f917e[_0x39dac6(0x11f)]({'filePath':_0x3557b7,'mode':_0x1e4afe,'isCanonical':!![]});if(!_0x3cb681?.[_0x39dac6(0x10d)])return _0x3f917e;const _0x163e67=join(_0x446c3e[_0x39dac6(0x147)],_0x3cb681[_0x39dac6(0x10d)]);if(_0x163e67===_0x3557b7)return _0x3f917e;return await fileExists(_0x163e67)&&_0x3f917e[_0x39dac6(0x11f)]({'filePath':_0x163e67,'mode':_0x3cb681['mode']??modeFromFilePath(_0x163e67),'isCanonical':![]}),_0x3f917e;}async function compareExistingSqlFiles(_0x293b54,_0xe59c24,_0x5ec318){const _0x5bcf4d=a242_0x78035e;return Promise[_0x5bcf4d(0x105)](_0x293b54[_0x5bcf4d(0x13f)](async _0x23fe67=>{const _0x28883a=_0x5bcf4d,_0x31232b=await readFile(_0x23fe67[_0x28883a(0x10a)],'utf8');return{'file':_0x23fe67,'content':_0x31232b,'equivalent':isEquivalentPulledSqlFile(_0x31232b,_0xe59c24,_0x23fe67[_0x28883a(0x11c)],_0x5ec318)};}));}function modeFromFilePath(_0x40dec5){const _0xc17569=a242_0x78035e;return _0x40dec5[_0xc17569(0x121)]()[_0xc17569(0x115)](_0xc17569(0x139))?_0xc17569(0x12a):'sql';}function normalizePulledSqlBody(_0xf1638e,_0x14f782){return stripLocalSqlMetadata(_0xf1638e,_0x14f782)['replace'](/\r\n/g,'\x0a')['trim']();}function normalizePullComparableContent(_0x4d8372,_0x2c7f7e){const _0x3a9d60=a242_0x78035e,_0x3dec44=_0x4d8372[_0x3a9d60(0x12f)](/\r\n/g,'\x0a')[_0x3a9d60(0x128)]('\x0a'),_0x34fdea=_0x3dec44[_0x3a9d60(0x142)](_0x19ad94=>!isSyncedAtMetadataLine(_0x19ad94,_0x2c7f7e));return _0x34fdea[_0x3a9d60(0x101)]('\x0a');}function isSyncedAtMetadataLine(_0x26d12c,_0x139940){const _0x1feb58=a242_0x78035e;if(_0x139940===_0x1feb58(0x12a))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x1feb58(0x118)](_0x26d12c);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x1feb58(0x118)](_0x26d12c);}
1
+ const a242_0x58b04f=a242_0x4c29;(function(_0x3bac07,_0x2bf5f7){const _0x1ea084=a242_0x4c29,_0x4b2fcd=_0x3bac07();while(!![]){try{const _0x26613e=parseInt(_0x1ea084(0x187))/0x1+parseInt(_0x1ea084(0x165))/0x2+-parseInt(_0x1ea084(0x159))/0x3+parseInt(_0x1ea084(0x144))/0x4+-parseInt(_0x1ea084(0x186))/0x5+-parseInt(_0x1ea084(0x14b))/0x6+parseInt(_0x1ea084(0x158))/0x7;if(_0x26613e===_0x2bf5f7)break;else _0x4b2fcd['push'](_0x4b2fcd['shift']());}catch(_0x2531f9){_0x4b2fcd['push'](_0x4b2fcd['shift']());}}}(a242_0x4f2a,0x1a1ac));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(_0x1440ea,_0x95ade3){const _0x3953fa=a242_0x4c29,_0x356ff5=[];let _0x1a78df=0x1;while(!![]){const _0x61a438=await listSqlQueries(_0x1440ea,{'currentPage':_0x1a78df,'pageSize':PAGE_SIZE,'sqlCode':_0x95ade3['sqlCode'],'sqlName':_0x95ade3[_0x3953fa(0x171)]}),_0x5e7b6c=_0x61a438[_0x3953fa(0x145)]??[];_0x356ff5['push'](..._0x5e7b6c);if(_0x5e7b6c[_0x3953fa(0x16f)]===0x0)break;const _0x3d7325=_0x61a438['paging']?.[_0x3953fa(0x18c)];if(_0x3d7325!=null?_0x356ff5[_0x3953fa(0x16f)]>=_0x3d7325:_0x5e7b6c[_0x3953fa(0x16f)]<PAGE_SIZE)break;_0x1a78df++;}return _0x356ff5;}async function ensureSqlContent(_0x5be63f){const _0x25dfc1=a242_0x4c29;if(_0x5be63f[_0x25dfc1(0x167)]!=null&&String(_0x5be63f['sqlContent'])['length']>0x0)return _0x5be63f;return getSqlQueryDetail(_0x5be63f[_0x25dfc1(0x146)]);}export const sqlPull={'service':'sql','command':a242_0x58b04f(0x15a),'description':a242_0x58b04f(0x16a),'risk':a242_0x58b04f(0x14a),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a242_0x58b04f(0x182),'type':a242_0x58b04f(0x156),'description':a242_0x58b04f(0x17a)},{'name':'force','type':a242_0x58b04f(0x173),'description':a242_0x58b04f(0x14f)}],async 'dryRun'(_0x4af89f){const _0x3efa77=a242_0x58b04f,_0x1179a4=loadSqlProjectConfig(_0x4af89f[_0x3efa77(0x157)]),_0x5e63a3=await readSqlLockFile(_0x1179a4[_0x3efa77(0x14d)]),{appLock:_0x1cc665}=ensureSqlLockScope(_0x5e63a3??createEmptySqlLock(),_0x1179a4[_0x3efa77(0x157)],_0x1179a4[_0x3efa77(0x152)],_0x3efa77(0x15a)),_0xef9e1a=await fetchAllSqlQueries(_0x4af89f[_0x3efa77(0x157)],{'sqlCode':_0x4af89f[_0x3efa77(0x16d)](_0x3efa77(0x183))||undefined,'sqlName':_0x4af89f[_0x3efa77(0x16d)](_0x3efa77(0x182))||undefined}),_0x584e19=[];for(const _0x3ca31b of _0xef9e1a){const _0x59c9d8=await ensureSqlContent(_0x3ca31b),_0x4d2cbf=ensureRemoteSqlContent(_0x59c9d8),_0x244889=detectSqlMode(_0x4d2cbf),_0x113219=_0x59c9d8[_0x3efa77(0x177)]?await getDbName(_0x4af89f[_0x3efa77(0x157)],Number(_0x59c9d8[_0x3efa77(0x177)]))[_0x3efa77(0x178)](()=>undefined):undefined,_0x417783=buildLocalSqlFileContent({'sqlCode':_0x59c9d8[_0x3efa77(0x146)],'sqlName':_0x59c9d8[_0x3efa77(0x171)],'dbId':_0x59c9d8['dbId']},_0x4d2cbf,{'dbName':_0x113219,'mode':_0x244889,'syncedAt':new Date()['toISOString'](),'description':_0x59c9d8[_0x3efa77(0x161)]}),_0x3c69b0=buildSqlLockEntry(_0x59c9d8,_0x4d2cbf,'',{'dbName':_0x113219}),_0x11048f=resolveLocalSqlFilePath(_0x1179a4,_0x59c9d8[_0x3efa77(0x146)],_0x3c69b0);let _0x57bdd1=_0x3efa77(0x15d),_0x52a74b;const _0x375f0c=await findExistingSqlFiles(_0x1179a4,_0x11048f,_0x244889,_0x1cc665[_0x3efa77(0x155)][_0x59c9d8[_0x3efa77(0x146)]]);if(_0x375f0c[_0x3efa77(0x16f)]>0x0){const _0x2acf8c=await compareExistingSqlFiles(_0x375f0c,_0x417783,_0x244889);if(_0x2acf8c[_0x3efa77(0x169)](({equivalent:_0x3aa68a})=>!_0x3aa68a))_0x57bdd1=_0x3efa77(0x16b),_0x52a74b=_0x3efa77(0x17c);else _0x2acf8c[_0x3efa77(0x16f)]===0x1&&_0x2acf8c[0x0]?.['file'][_0x3efa77(0x166)]&&(_0x57bdd1=_0x3efa77(0x185),_0x52a74b=_0x3efa77(0x14e));}_0x584e19[_0x3efa77(0x153)]({'sqlCode':_0x59c9d8[_0x3efa77(0x146)],'sqlName':_0x59c9d8['sqlName'],'filePath':_0x11048f,'status':_0x57bdd1,'reason':_0x52a74b});}return{'method':_0x3efa77(0x180),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x4af89f[_0x3efa77(0x157)],'sqlCode':_0x4af89f[_0x3efa77(0x16d)](_0x3efa77(0x183))||null,'sqlName':_0x4af89f[_0x3efa77(0x16d)](_0x3efa77(0x182))||null,'files':_0x584e19},'description':_0x3efa77(0x15f)+_0x584e19[_0x3efa77(0x16f)]+_0x3efa77(0x163)+_0x1179a4['sqlRootDir']};},async 'execute'(_0x1c884b){const _0x211744=a242_0x58b04f,_0x37c4f8=loadSqlProjectConfig(_0x1c884b['appCode']),_0x8890cc=await readSqlLockFile(_0x37c4f8[_0x211744(0x14d)]),{lockData:_0x1dbd72,appLock:_0x32e1d6}=ensureSqlLockScope(_0x8890cc??createEmptySqlLock(),_0x37c4f8[_0x211744(0x157)],_0x37c4f8['sqlRoot'],'pull'),_0x1f209a=_0x1c884b[_0x211744(0x188)]('force'),_0x43f633=await fetchAllSqlQueries(_0x1c884b['appCode'],{'sqlCode':_0x1c884b[_0x211744(0x16d)](_0x211744(0x183))||undefined,'sqlName':_0x1c884b[_0x211744(0x16d)](_0x211744(0x182))||undefined});if(_0x43f633['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x211744(0x164)};const _0x5c95c2=[],_0x3fb976=[];for(const _0x15fb91 of _0x43f633){try{_0x5c95c2[_0x211744(0x153)](await ensureSqlContent(_0x15fb91));}catch(_0x45598e){_0x3fb976[_0x211744(0x153)]({'sqlCode':_0x15fb91[_0x211744(0x146)],'error':_0x45598e instanceof Error?_0x45598e[_0x211744(0x150)]:String(_0x45598e)});}}if(_0x1f209a&&!_0x1c884b[_0x211744(0x170)]){let _0x1dd815=![];for(const _0x3f4ad4 of _0x5c95c2){const _0x525ef4=detectSqlMode(ensureRemoteSqlContent(_0x3f4ad4)),_0x1df824=_0x3f4ad4[_0x211744(0x177)]?await getDbName(_0x1c884b[_0x211744(0x157)],Number(_0x3f4ad4['dbId']))[_0x211744(0x178)](()=>undefined):undefined,_0x3a0560=buildLocalSqlFileContent({'sqlCode':_0x3f4ad4[_0x211744(0x146)],'sqlName':_0x3f4ad4[_0x211744(0x171)],'dbId':_0x3f4ad4[_0x211744(0x177)]},ensureRemoteSqlContent(_0x3f4ad4),{'dbName':_0x1df824,'mode':_0x525ef4,'syncedAt':new Date()[_0x211744(0x176)](),'description':_0x3f4ad4['description']}),_0x577ce9=resolveLocalSqlFilePath(_0x37c4f8,_0x3f4ad4['sqlCode'],buildSqlLockEntry(_0x3f4ad4,ensureRemoteSqlContent(_0x3f4ad4),'',{'dbName':_0x1df824})),_0x1e7d3d=await findExistingSqlFiles(_0x37c4f8,_0x577ce9,_0x525ef4,_0x32e1d6[_0x211744(0x155)][_0x3f4ad4[_0x211744(0x146)]]),_0x5d0fb2=await compareExistingSqlFiles(_0x1e7d3d,_0x3a0560,_0x525ef4);if(_0x5d0fb2[_0x211744(0x169)](({equivalent:_0x4f1596})=>!_0x4f1596)){_0x1dd815=!![];break;}}if(_0x1dd815){const _0x1b6c6e=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x1b6c6e)throw CliErrors[_0x211744(0x162)](_0x211744(0x172));}}const _0x262c6c=cloneSqlLockData(_0x1dbd72),_0x558668=_0x262c6c[_0x211744(0x18a)][_0x37c4f8[_0x211744(0x157)]],_0x1c74d1=[],_0x4d73a1=[];for(const _0x1fba20 of _0x5c95c2){const _0x3d99ea=_0x558668[_0x211744(0x155)][_0x1fba20[_0x211744(0x146)]],_0x3c7501=ensureRemoteSqlContent(_0x1fba20),_0x32591c=detectSqlMode(_0x3c7501),_0x42db55=_0x1fba20[_0x211744(0x177)]?await getDbName(_0x1c884b[_0x211744(0x157)],Number(_0x1fba20[_0x211744(0x177)]))[_0x211744(0x178)](()=>undefined):undefined,_0x564fa0=buildLocalSqlFileContent({'sqlCode':_0x1fba20[_0x211744(0x146)],'sqlName':_0x1fba20['sqlName'],'dbId':_0x1fba20[_0x211744(0x177)]},_0x3c7501,{'dbName':_0x42db55,'mode':_0x32591c,'syncedAt':new Date()[_0x211744(0x176)](),'description':_0x1fba20['description']}),_0x23d907=buildSqlLockEntry(_0x1fba20,_0x3c7501,computeSqlContentHash(_0x564fa0),{'dbName':_0x42db55}),_0x5cad2b=_0x23d907[_0x211744(0x15b)],_0x23c82b=join(_0x37c4f8['sqlRootDir'],_0x5cad2b);try{const _0x23967a=await findExistingSqlFiles(_0x37c4f8,_0x23c82b,_0x32591c,_0x3d99ea),_0xe78eb3=await compareExistingSqlFiles(_0x23967a,_0x564fa0,_0x32591c);if(!_0x1f209a&&_0xe78eb3[_0x211744(0x169)](({equivalent:_0xdf8de9})=>!_0xdf8de9)){_0x4d73a1['push']({'sqlCode':_0x1fba20[_0x211744(0x146)],'reason':_0x211744(0x174)});continue;}const _0x3a687e=_0xe78eb3['find'](({file:_0x556279})=>_0x556279[_0x211744(0x166)]),_0x4d24df=_0xe78eb3[_0x211744(0x17e)](({file:_0x7bff8d})=>!_0x7bff8d['isCanonical']);if(_0x3a687e?.[_0x211744(0x149)]&&!_0x4d24df){_0x4d73a1['push']({'sqlCode':_0x1fba20[_0x211744(0x146)],'reason':_0x211744(0x14e)}),_0x558668[_0x211744(0x155)][_0x1fba20[_0x211744(0x146)]]={..._0x23d907,'hash':computeSqlContentHash(_0x3a687e[_0x211744(0x17f)]),'path':_0x5cad2b};continue;}!_0x3a687e?.[_0x211744(0x149)]&&(await ensureParentDirectory(_0x23c82b),await writeFile(_0x23c82b,_0x564fa0,_0x211744(0x179))),_0x4d24df&&await rm(_0x4d24df[_0x211744(0x14c)][_0x211744(0x15c)],{'force':!![]}),_0x558668['sqls'][_0x1fba20['sqlCode']]={..._0x23d907,'hash':_0x3a687e?.[_0x211744(0x149)]?computeSqlContentHash(_0x3a687e[_0x211744(0x17f)]):_0x23d907[_0x211744(0x181)],'path':_0x5cad2b},_0x1c74d1[_0x211744(0x153)]({'sqlCode':_0x1fba20[_0x211744(0x146)],'filePath':_0x23c82b});}catch(_0x5293a4){_0x3fb976[_0x211744(0x153)]({'sqlCode':_0x1fba20['sqlCode'],'error':_0x5293a4 instanceof Error?_0x5293a4['message']:String(_0x5293a4)});}}return _0x558668[_0x211744(0x168)]=new Date()[_0x211744(0x176)](),await writeSqlLockFile(_0x37c4f8['lockFilePath'],_0x262c6c),{'ok':_0x3fb976[_0x211744(0x16f)]===0x0,'data':{'pulled':_0x1c74d1,'skipped':_0x4d73a1,'failed':_0x3fb976},'message':_0x211744(0x15e)+_0x1c74d1[_0x211744(0x16f)]+_0x211744(0x16e)+_0x4d73a1[_0x211744(0x16f)]+'\x20skipped,\x20'+_0x3fb976[_0x211744(0x16f)]+_0x211744(0x16c)};}};function a242_0x4c29(_0x28cce2,_0x3175af){_0x28cce2=_0x28cce2-0x143;const _0x4f2a49=a242_0x4f2a();let _0x4c296d=_0x4f2a49[_0x28cce2];return _0x4c296d;}function isEquivalentPulledSqlFile(_0x78d928,_0x3234e9,_0x3a4d10,_0x868e08){if(_0x3a4d10!==_0x868e08)return normalizePulledSqlBody(_0x78d928,_0x3a4d10)===normalizePulledSqlBody(_0x3234e9,_0x868e08);return normalizePullComparableContent(_0x78d928,_0x3a4d10)===normalizePullComparableContent(_0x3234e9,_0x868e08);}function a242_0x4f2a(){const _0x3d481f=['lastSync','some','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','conflict','\x20failed','str','\x20written,\x20','length','nonInteractive','sqlName','Force\x20pull\x20cancelled.','boolean','local\x20differs\x20from\x20remote','sql','toISOString','dbId','catch','utf8','Filter\x20by\x20SQL\x20display\x20name','test','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','mybatisXml','find','content','POST','hash','name','sqlcode','trim','skipped','22855ZDJpAm','83971zzxAIj','bool','.xml','apps','replace','totalCount','join','265316GZvDYS','tableData','sqlCode','all','toLowerCase','equivalent','read','592788MdkPhe','file','lockFilePath','unchanged','Force\x20overwrite\x20local\x20unsynced\x20changes','message','sqlRootDir','sqlRoot','push','mode','sqls','string','appCode','738262xWJlli','308625FuaerO','pull','path','filePath','would_pull','Pull\x20complete:\x20','Would\x20pull\x20','map','description','cancelled','\x20SQL\x20file(s)\x20into\x20','No\x20remote\x20SQL\x20queries\x20matched.','114804GxteJB','isCanonical','sqlContent'];a242_0x4f2a=function(){return _0x3d481f;};return a242_0x4f2a();}async function findExistingSqlFiles(_0x346f0c,_0x554084,_0x1c9ded,_0x4289f0){const _0x4d904f=a242_0x58b04f,_0x1aa9c7=[];await fileExists(_0x554084)&&_0x1aa9c7[_0x4d904f(0x153)]({'filePath':_0x554084,'mode':_0x1c9ded,'isCanonical':!![]});if(!_0x4289f0?.[_0x4d904f(0x15b)])return _0x1aa9c7;const _0x365714=join(_0x346f0c[_0x4d904f(0x151)],_0x4289f0['path']);if(_0x365714===_0x554084)return _0x1aa9c7;return await fileExists(_0x365714)&&_0x1aa9c7[_0x4d904f(0x153)]({'filePath':_0x365714,'mode':_0x4289f0[_0x4d904f(0x154)]??modeFromFilePath(_0x365714),'isCanonical':![]}),_0x1aa9c7;}async function compareExistingSqlFiles(_0x313129,_0x2165ee,_0x517c27){const _0x475e94=a242_0x58b04f;return Promise[_0x475e94(0x147)](_0x313129[_0x475e94(0x160)](async _0x464bfa=>{const _0x2fe2dd=_0x475e94,_0x4a8677=await readFile(_0x464bfa['filePath'],'utf8');return{'file':_0x464bfa,'content':_0x4a8677,'equivalent':isEquivalentPulledSqlFile(_0x4a8677,_0x2165ee,_0x464bfa[_0x2fe2dd(0x154)],_0x517c27)};}));}function modeFromFilePath(_0x26252c){const _0x538c71=a242_0x58b04f;return _0x26252c[_0x538c71(0x148)]()['endsWith'](_0x538c71(0x189))?_0x538c71(0x17d):_0x538c71(0x175);}function normalizePulledSqlBody(_0x1f7d13,_0x4606e4){const _0x34faaf=a242_0x58b04f;return stripLocalSqlMetadata(_0x1f7d13,_0x4606e4)[_0x34faaf(0x18b)](/\r\n/g,'\x0a')[_0x34faaf(0x184)]();}function normalizePullComparableContent(_0x2841a0,_0x21ff3c){const _0x50d7a1=a242_0x58b04f,_0x4c4c72=_0x2841a0[_0x50d7a1(0x18b)](/\r\n/g,'\x0a')['split']('\x0a'),_0x5090e4=_0x4c4c72['filter'](_0xce7859=>!isSyncedAtMetadataLine(_0xce7859,_0x21ff3c));return _0x5090e4[_0x50d7a1(0x143)]('\x0a');}function isSyncedAtMetadataLine(_0x210b96,_0x4708c0){const _0x1e6680=a242_0x58b04f;if(_0x4708c0===_0x1e6680(0x17d))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x1e6680(0x17b)](_0x210b96);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x1e6680(0x17b)](_0x210b96);}
@@ -1 +1 @@
1
- const a243_0x53a130=a243_0x492e;(function(_0x101bd0,_0x17d71e){const _0x3239e2=a243_0x492e,_0x4c4a36=_0x101bd0();while(!![]){try{const _0x1c708d=-parseInt(_0x3239e2(0x1ff))/0x1*(-parseInt(_0x3239e2(0x1fa))/0x2)+parseInt(_0x3239e2(0x1f0))/0x3*(parseInt(_0x3239e2(0x1c1))/0x4)+-parseInt(_0x3239e2(0x1c5))/0x5*(parseInt(_0x3239e2(0x1eb))/0x6)+-parseInt(_0x3239e2(0x1c7))/0x7+-parseInt(_0x3239e2(0x1fe))/0x8+-parseInt(_0x3239e2(0x1c3))/0x9*(-parseInt(_0x3239e2(0x1e7))/0xa)+parseInt(_0x3239e2(0x1f9))/0xb*(parseInt(_0x3239e2(0x1f5))/0xc);if(_0x1c708d===_0x17d71e)break;else _0x4c4a36['push'](_0x4c4a36['shift']());}catch(_0x19fd90){_0x4c4a36['push'](_0x4c4a36['shift']());}}}(a243_0xf7de,0x32907));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a243_0x492e(_0x1b904b,_0xe74cc1){_0x1b904b=_0x1b904b-0x1be;const _0xf7dee=a243_0xf7de();let _0x492e49=_0xf7dee[_0x1b904b];return _0x492e49;}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(_0x454f87){const _0x2d4192=a243_0x492e,_0x353773=stripLocalSqlMetadata(await readFile(_0x454f87['filePath'],_0x2d4192(0x1e0)),_0x454f87['mode']);if(!_0x353773[_0x2d4192(0x202)]())throw CliErrors[_0x2d4192(0x201)](_0x454f87[_0x2d4192(0x1d8)]+':\x20SQL\x20content\x20is\x20empty.');return _0x353773;}async function getTargetSqlQueries(_0x327529,_0x12699,_0x3bbf79){const _0x2c91ab=a243_0x492e,_0x3508c9=await scanLocalSqlQueries(_0x327529),_0x1dcca1=new Map();for(const _0x317ded of _0x3508c9){if(_0x3bbf79&&_0x317ded[_0x2c91ab(0x1d8)]!==_0x3bbf79)continue;const _0x186eaf=_0x1dcca1[_0x2c91ab(0x1d5)](_0x317ded[_0x2c91ab(0x1d8)])??[];_0x186eaf['push'](_0x317ded),_0x1dcca1['set'](_0x317ded['sqlCode'],_0x186eaf);}if(_0x3bbf79&&!_0x1dcca1[_0x2c91ab(0x1d7)](_0x3bbf79))throw CliErrors[_0x2c91ab(0x201)](_0x2c91ab(0x1dc)+_0x3bbf79);const _0x4e605f=[];for(const [_0x3d79ce,_0x1afc76]of _0x1dcca1[_0x2c91ab(0x1e8)]()){if(_0x1afc76['length']===0x1){_0x4e605f[_0x2c91ab(0x1c8)](_0x1afc76[0x0]);continue;}const _0x53b426=_0x12699[_0x2c91ab(0x1ec)][_0x3d79ce],_0x1f01bd=_0x53b426?.[_0x2c91ab(0x1c2)],_0x532338=_0x1f01bd?_0x1afc76[_0x2c91ab(0x1ee)](_0x55a1b6=>_0x55a1b6[_0x2c91ab(0x1f4)]!==_0x1f01bd):_0x1afc76;if(_0x53b426&&_0x532338[_0x2c91ab(0x1d3)]===0x1){_0x4e605f[_0x2c91ab(0x1c8)](_0x532338[0x0]);continue;}throw CliErrors[_0x2c91ab(0x201)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x3d79ce+_0x2c91ab(0x1f2));}return _0x4e605f;}export const sqlPush={'service':a243_0x53a130(0x1fb),'command':a243_0x53a130(0x1c8),'description':a243_0x53a130(0x1f1),'risk':a243_0x53a130(0x203),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a243_0x53a130(0x1d2),'type':a243_0x53a130(0x1bf),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x317d1d){const _0x258696=a243_0x53a130,_0x39c748=loadSqlProjectConfig(_0x317d1d[_0x258696(0x1ea)]),_0x3ec1d0=await readSqlLockFile(_0x39c748['lockFilePath']),{appLock:_0x19e4b1}=ensureSqlLockScope(_0x3ec1d0??createEmptySqlLock(),_0x317d1d[_0x258696(0x1ea)],_0x39c748['sqlRoot'],'push'),_0x1be163=await getTargetSqlQueries(_0x39c748,_0x19e4b1,_0x317d1d['str']('sqlcode')||undefined),_0x1e9d5c=[];for(const _0x335d23 of _0x1be163){const _0x3af0be=await computeSqlFileHash(_0x335d23[_0x258696(0x1f3)]),_0x184263=_0x19e4b1[_0x258696(0x1ec)][_0x335d23[_0x258696(0x1d8)]],_0x8c11a3=!!_0x184263&&(_0x184263[_0x258696(0x1c2)]!==_0x335d23[_0x258696(0x1f4)]||!!_0x335d23['sqlName']&&_0x184263[_0x258696(0x1d9)]!==_0x335d23[_0x258696(0x1d9)]||_0x184263[_0x258696(0x1e1)]!==_0x335d23[_0x258696(0x1e1)]);if(!_0x317d1d[_0x258696(0x1cc)](_0x258696(0x1d2))&&_0x184263&&_0x184263[_0x258696(0x1df)]===_0x3af0be&&!_0x8c11a3)continue;if(!_0x184263)throw CliErrors[_0x258696(0x201)](_0x335d23[_0x258696(0x1d8)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0x184263[_0x258696(0x1c0)]==null)throw CliErrors[_0x258696(0x201)](_0x335d23[_0x258696(0x1d8)]+_0x258696(0x1de));await resolveTargetDbBinding(_0x317d1d[_0x258696(0x1ea)],_0x335d23,_0x184263),await readSqlUploadContent(_0x335d23),_0x1e9d5c['push'](_0x335d23['sqlCode']);}return{'method':'POST','url':_0x258696(0x1c4),'body':{'sqlCodes':_0x1e9d5c,'appCode':_0x317d1d[_0x258696(0x1ea)]},'description':'Would\x20push\x20'+_0x1e9d5c['length']+'\x20SQL\x20file(s)'};},async 'execute'(_0x4c3976){const _0x5d126a=a243_0x53a130,_0x352304=loadSqlProjectConfig(_0x4c3976['appCode']),_0x11deb9=await readSqlLockFile(_0x352304[_0x5d126a(0x1da)]),{lockData:_0x4beaed,appLock:_0x43d76f}=ensureSqlLockScope(_0x11deb9??createEmptySqlLock(),_0x4c3976[_0x5d126a(0x1ea)],_0x352304['sqlRoot'],_0x5d126a(0x1c8)),_0x279fbe=await getTargetSqlQueries(_0x352304,_0x43d76f,_0x4c3976[_0x5d126a(0x1f6)](_0x5d126a(0x1ef))||undefined);if(_0x279fbe[_0x5d126a(0x1d3)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x5d126a(0x1e4)};const _0x752736=[],_0x31678d=[],_0x1a1e91=[];let _0x4e4d71=![];for(const _0xbe8c10 of _0x279fbe){const _0x366a49=_0x43d76f[_0x5d126a(0x1ec)][_0xbe8c10[_0x5d126a(0x1d8)]];if(!_0x366a49){_0x1a1e91[_0x5d126a(0x1c8)]({'sqlCode':_0xbe8c10[_0x5d126a(0x1d8)],'error':_0x5d126a(0x1cd)});continue;}try{const _0x3fadaa=await computeSqlFileHash(_0xbe8c10['filePath']),_0x156418=_0x366a49[_0x5d126a(0x1c2)]!==_0xbe8c10[_0x5d126a(0x1f4)]||!!_0xbe8c10[_0x5d126a(0x1d9)]&&_0x366a49[_0x5d126a(0x1d9)]!==_0xbe8c10[_0x5d126a(0x1d9)]||_0x366a49[_0x5d126a(0x1e1)]!==_0xbe8c10[_0x5d126a(0x1e1)];if(!_0x4c3976[_0x5d126a(0x1cc)](_0x5d126a(0x1d2))&&_0x366a49['hash']===_0x3fadaa&&!_0x156418){_0x31678d['push']({'sqlCode':_0xbe8c10[_0x5d126a(0x1d8)],'reason':_0x5d126a(0x1c6)});continue;}if(_0x366a49[_0x5d126a(0x1c0)]==null){_0x1a1e91[_0x5d126a(0x1c8)]({'sqlCode':_0xbe8c10[_0x5d126a(0x1d8)],'error':_0x5d126a(0x1cf)});continue;}const _0xbd0eb7=_0xbe8c10[_0x5d126a(0x1d9)]||_0x366a49[_0x5d126a(0x1d9)],_0x148ba9=await resolveTargetDbBinding(_0x4c3976[_0x5d126a(0x1ea)],_0xbe8c10,_0x366a49),_0x5563ad=await readSqlUploadContent(_0xbe8c10),_0x37d89d=await updateSqlQuery({'id':_0x366a49[_0x5d126a(0x1fc)],'appCode':_0x4c3976[_0x5d126a(0x1ea)],'sqlCode':_0xbe8c10['sqlCode'],'sqlName':_0xbd0eb7,'dbId':_0x148ba9['dbId'],'version':_0x366a49[_0x5d126a(0x1c0)],'sqlContent':_0x5563ad,'sqlConfig':_0x366a49[_0x5d126a(0x1ca)]??undefined}),_0x5d6341=_0x37d89d['dbId']?await getDbName(_0x4c3976[_0x5d126a(0x1ea)],Number(_0x37d89d[_0x5d126a(0x1f7)]))[_0x5d126a(0x1ce)](()=>_0x148ba9[_0x5d126a(0x1e9)]):_0x148ba9['dbName'];_0x43d76f[_0x5d126a(0x1ec)][_0xbe8c10[_0x5d126a(0x1d8)]]={...buildSqlLockEntry(_0x37d89d,_0x5563ad,_0x3fadaa,{'dbName':_0x5d6341}),'path':_0xbe8c10[_0x5d126a(0x1f4)],'mode':_0xbe8c10['mode']},_0x4e4d71=!![],await archivePreviousSqlFileIfNeeded(_0x352304,_0x366a49['path'],_0xbe8c10[_0x5d126a(0x1f4)]),_0x752736[_0x5d126a(0x1c8)]({'sqlCode':_0xbe8c10[_0x5d126a(0x1d8)],'remoteId':_0x366a49[_0x5d126a(0x1fc)]});}catch(_0x46657b){_0x1a1e91['push']({'sqlCode':_0xbe8c10[_0x5d126a(0x1d8)],'error':_0x46657b instanceof Error?_0x46657b[_0x5d126a(0x1d1)]:String(_0x46657b)});}}(_0x4e4d71||_0x1a1e91[_0x5d126a(0x1d3)]===0x0)&&(_0x43d76f[_0x5d126a(0x1f8)]=new Date()[_0x5d126a(0x1e3)](),await writeSqlLockFile(_0x352304[_0x5d126a(0x1da)],_0x4beaed));const _0x11218c=_0x1a1e91['length']===0x0;return{'ok':_0x11218c,'data':{'pushed':_0x752736,'skipped':_0x31678d,'failed':_0x1a1e91},'message':_0x5d126a(0x200)+_0x752736[_0x5d126a(0x1d3)]+_0x5d126a(0x1fd)+_0x31678d[_0x5d126a(0x1d3)]+_0x5d126a(0x1be)+_0x1a1e91['length']+_0x5d126a(0x1e5)};}};async function archivePreviousSqlFileIfNeeded(_0x251065,_0x2e8dae,_0x3fad05){const _0x1e55d3=a243_0x53a130;if(!_0x2e8dae||_0x2e8dae===_0x3fad05)return;const _0x519464=join(_0x251065['sqlRootDir'],_0x2e8dae);if(!await fileExists(_0x519464))return;const _0x2dc602=await moveToTrash(_0x251065['projectRoot'],_0x251065[_0x1e55d3(0x1cb)],_0x519464);await cleanupEmptyDirectories(dirname(_0x519464),_0x251065[_0x1e55d3(0x1dd)]),void _0x2dc602;}async function moveToTrash(_0x3a89ed,_0x35560d,_0x14127f){const _0x4ef70e=new Date()['toISOString']()['replace'](/[:.]/g,'-'),_0x1117d2=relative(_0x3a89ed,_0x14127f),_0x13c055=join(_0x35560d,_0x4ef70e,_0x1117d2);return await mkdir(dirname(_0x13c055),{'recursive':!![]}),await rename(_0x14127f,_0x13c055),_0x13c055;}function a243_0xf7de(){const _0x5c0068=['dbId','lastSync','3311330RzduCO','47176QBrlyG','sql','remoteId','\x20pushed,\x20','674928rZniAs','8WiwHbn','Push\x20complete:\x20','validation','trim','write','\x20skipped,\x20','boolean','version','11296AQOKGI','path','2138706viTCLh','/smartapi/custom/updateUserCustomSql','109615zFtetk','unchanged','1164450gPRbNd','push','exec','sqlConfig','trashDir','bool','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','catch','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','startsWith','message','force','length','map','get','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','has','sqlCode','sqlName','lockFilePath','Local\x20directory\x20\x22','Local\x20SQL\x20not\x20found:\x20','sqlRootDir',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','hash','utf8','mode','No\x20database\x20matches\x20local\x20directory\x20\x22','toISOString','No\x20local\x20SQL\x20files\x20found.','\x20failed','\x22\x20for\x20sqlCode\x20','10bmQumO','entries','dbName','appCode','90aIroNJ','sqls','dbDirectory','filter','sqlcode','63bbgVAm','Push\x20local\x20SQL\x20files\x20to\x20remote','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','filePath','relativePath','12ubpOJM','str'];a243_0xf7de=function(){return _0x5c0068;};return a243_0xf7de();}async function cleanupEmptyDirectories(_0x2ce55c,_0x4e199a){const _0x482624=a243_0x53a130;let _0xe10757=resolve(_0x2ce55c);const _0x409b0d=resolve(_0x4e199a);while(_0xe10757[_0x482624(0x1d0)](''+_0x409b0d+sep)||_0xe10757===_0x409b0d){if(_0xe10757===_0x409b0d)return;try{const _0x1ab8b3=await readdir(_0xe10757);if(_0x1ab8b3[_0x482624(0x1d3)]>0x0)return;await rmdir(_0xe10757);}catch{return;}_0xe10757=dirname(_0xe10757);}}async function resolveTargetDbBinding(_0x58e5e1,_0x1cc9b8,_0x5b0ecf){const _0x54ac74=a243_0x53a130,_0x3862e5=_0x1cc9b8[_0x54ac74(0x1ed)];if(!_0x3862e5)return{'dbId':_0x5b0ecf[_0x54ac74(0x1f7)],'dbName':_0x5b0ecf[_0x54ac74(0x1e9)]};const _0x583058=buildDbDirectoryName(_0x5b0ecf[_0x54ac74(0x1e9)],_0x5b0ecf[_0x54ac74(0x1f7)]);if(_0x3862e5===_0x583058)return{'dbId':_0x5b0ecf['dbId'],'dbName':_0x5b0ecf['dbName']};const _0x196c2b=parseExplicitDbDirectory(_0x3862e5);if(_0x196c2b!=null)return{'dbId':_0x196c2b,'dbName':await getDbName(_0x58e5e1,_0x196c2b)[_0x54ac74(0x1ce)](()=>undefined)};const _0x19da71=await listDatabases(_0x58e5e1),_0x4b4235=_0x19da71[_0x54ac74(0x1ee)](_0x5e9076=>buildDbDirectoryName(_0x5e9076['dbName'],_0x5e9076[_0x54ac74(0x1f7)])===_0x3862e5);if(_0x4b4235[_0x54ac74(0x1d3)]===0x1)return{'dbId':_0x4b4235[0x0][_0x54ac74(0x1f7)],'dbName':_0x4b4235[0x0]['dbName']};if(_0x4b4235[_0x54ac74(0x1d3)]===0x0)throw CliErrors[_0x54ac74(0x201)](_0x54ac74(0x1e2)+_0x3862e5+_0x54ac74(0x1e6)+_0x1cc9b8[_0x54ac74(0x1d8)]+'.');const _0x1fffcf=_0x4b4235[_0x54ac74(0x1d4)](_0x2a4bd4=>_0x2a4bd4[_0x54ac74(0x1e9)]+'\x20('+_0x2a4bd4[_0x54ac74(0x1f7)]+')')['join'](',\x20');throw CliErrors['validation'](_0x54ac74(0x1db)+_0x3862e5+_0x54ac74(0x1d6)+_0x1cc9b8['sqlCode']+':\x20'+_0x1fffcf);}function parseExplicitDbDirectory(_0x1b4db3){const _0x237ec1=a243_0x53a130,_0x275075=/^db-(\d+)$/[_0x237ec1(0x1c9)](_0x1b4db3);if(!_0x275075)return null;const _0x5a769f=Number(_0x275075[0x1]);return Number['isFinite'](_0x5a769f)&&_0x5a769f>0x0?_0x5a769f:null;}
1
+ const a243_0x311b48=a243_0x2af1;(function(_0x23f559,_0x237461){const _0xd35534=a243_0x2af1,_0x2cc36a=_0x23f559();while(!![]){try{const _0x4b5c38=-parseInt(_0xd35534(0x114))/0x1*(parseInt(_0xd35534(0x13c))/0x2)+-parseInt(_0xd35534(0x10b))/0x3+-parseInt(_0xd35534(0x117))/0x4+parseInt(_0xd35534(0x112))/0x5+-parseInt(_0xd35534(0x12a))/0x6*(parseInt(_0xd35534(0x131))/0x7)+parseInt(_0xd35534(0x105))/0x8*(-parseInt(_0xd35534(0x115))/0x9)+parseInt(_0xd35534(0x11d))/0xa*(parseInt(_0xd35534(0x110))/0xb);if(_0x4b5c38===_0x237461)break;else _0x2cc36a['push'](_0x2cc36a['shift']());}catch(_0x1d3932){_0x2cc36a['push'](_0x2cc36a['shift']());}}}(a243_0x2a8d,0x37bf1));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';function a243_0x2af1(_0x2d565e,_0x3b9111){_0x2d565e=_0x2d565e-0xf7;const _0x2a8d94=a243_0x2a8d();let _0x2af1e7=_0x2a8d94[_0x2d565e];return _0x2af1e7;}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(_0x3c061e){const _0x24a8cf=a243_0x2af1,_0x239d3b=stripLocalSqlMetadata(await readFile(_0x3c061e[_0x24a8cf(0x120)],_0x24a8cf(0x136)),_0x3c061e[_0x24a8cf(0xf7)]);if(!_0x239d3b[_0x24a8cf(0xf8)]())throw CliErrors[_0x24a8cf(0x102)](_0x3c061e[_0x24a8cf(0x125)]+_0x24a8cf(0x124));return _0x239d3b;}async function getTargetSqlQueries(_0x436264,_0x48259c,_0x2e7b1d){const _0x7d43a6=a243_0x2af1,_0x2830b9=await scanLocalSqlQueries(_0x436264),_0x5a59f0=new Map();for(const _0x23fc3a of _0x2830b9){if(_0x2e7b1d&&_0x23fc3a['sqlCode']!==_0x2e7b1d)continue;const _0x4d8eca=_0x5a59f0[_0x7d43a6(0x11b)](_0x23fc3a[_0x7d43a6(0x125)])??[];_0x4d8eca[_0x7d43a6(0x135)](_0x23fc3a),_0x5a59f0['set'](_0x23fc3a[_0x7d43a6(0x125)],_0x4d8eca);}if(_0x2e7b1d&&!_0x5a59f0[_0x7d43a6(0x132)](_0x2e7b1d))throw CliErrors['validation']('Local\x20SQL\x20not\x20found:\x20'+_0x2e7b1d);const _0x267e86=[];for(const [_0x4bf649,_0x160763]of _0x5a59f0[_0x7d43a6(0x11a)]()){if(_0x160763['length']===0x1){_0x267e86['push'](_0x160763[0x0]);continue;}const _0xf4e21e=_0x48259c['sqls'][_0x4bf649],_0x3ea8e4=_0xf4e21e?.[_0x7d43a6(0x10e)],_0x4cc8d9=_0x3ea8e4?_0x160763[_0x7d43a6(0x130)](_0x87a822=>_0x87a822['relativePath']!==_0x3ea8e4):_0x160763;if(_0xf4e21e&&_0x4cc8d9[_0x7d43a6(0xff)]===0x1){_0x267e86[_0x7d43a6(0x135)](_0x4cc8d9[0x0]);continue;}throw CliErrors[_0x7d43a6(0x102)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x4bf649+_0x7d43a6(0x119));}return _0x267e86;}export const sqlPush={'service':a243_0x311b48(0x104),'command':a243_0x311b48(0x135),'description':a243_0x311b48(0x113),'risk':a243_0x311b48(0x116),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a243_0x311b48(0x10c),'type':'boolean','description':a243_0x311b48(0x128)}],async 'dryRun'(_0x1d0078){const _0x2eab96=a243_0x311b48,_0x40fa38=loadSqlProjectConfig(_0x1d0078[_0x2eab96(0x122)]),_0x45ea8e=await readSqlLockFile(_0x40fa38['lockFilePath']),{appLock:_0x4b56f0}=ensureSqlLockScope(_0x45ea8e??createEmptySqlLock(),_0x1d0078[_0x2eab96(0x122)],_0x40fa38[_0x2eab96(0x133)],_0x2eab96(0x135)),_0x13ed44=await getTargetSqlQueries(_0x40fa38,_0x4b56f0,_0x1d0078['str'](_0x2eab96(0x11c))||undefined),_0x9b77ef=[];for(const _0x280b10 of _0x13ed44){const _0x2d07e8=await computeSqlFileHash(_0x280b10[_0x2eab96(0x120)]),_0x153185=_0x4b56f0[_0x2eab96(0x108)][_0x280b10[_0x2eab96(0x125)]],_0x5963d3=!!_0x153185&&(_0x153185[_0x2eab96(0x10e)]!==_0x280b10['relativePath']||!!_0x280b10[_0x2eab96(0x13b)]&&_0x153185[_0x2eab96(0x13b)]!==_0x280b10[_0x2eab96(0x13b)]||_0x153185[_0x2eab96(0xf7)]!==_0x280b10[_0x2eab96(0xf7)]);if(!_0x1d0078[_0x2eab96(0x12d)](_0x2eab96(0x10c))&&_0x153185&&_0x153185['hash']===_0x2d07e8&&!_0x5963d3)continue;if(!_0x153185)throw CliErrors[_0x2eab96(0x102)](_0x280b10[_0x2eab96(0x125)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0x153185[_0x2eab96(0x138)]==null)throw CliErrors['validation'](_0x280b10[_0x2eab96(0x125)]+_0x2eab96(0xfa));await resolveTargetDbBinding(_0x1d0078[_0x2eab96(0x122)],_0x280b10,_0x153185),await readSqlUploadContent(_0x280b10),_0x9b77ef[_0x2eab96(0x135)](_0x280b10['sqlCode']);}return{'method':'POST','url':_0x2eab96(0xfe),'body':{'sqlCodes':_0x9b77ef,'appCode':_0x1d0078[_0x2eab96(0x122)]},'description':_0x2eab96(0x12e)+_0x9b77ef[_0x2eab96(0xff)]+_0x2eab96(0x121)};},async 'execute'(_0x4b13d5){const _0x1c4400=a243_0x311b48,_0x15962d=loadSqlProjectConfig(_0x4b13d5[_0x1c4400(0x122)]),_0x581656=await readSqlLockFile(_0x15962d['lockFilePath']),{lockData:_0x2f1bd5,appLock:_0x189e68}=ensureSqlLockScope(_0x581656??createEmptySqlLock(),_0x4b13d5[_0x1c4400(0x122)],_0x15962d[_0x1c4400(0x133)],_0x1c4400(0x135)),_0x331894=await getTargetSqlQueries(_0x15962d,_0x189e68,_0x4b13d5[_0x1c4400(0xf9)](_0x1c4400(0x11c))||undefined);if(_0x331894[_0x1c4400(0xff)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x1c4400(0x103)};const _0xb2b072=[],_0x3dc61f=[],_0x7eb91f=[];let _0x31cabc=![];for(const _0x3b42de of _0x331894){const _0x44c001=_0x189e68['sqls'][_0x3b42de[_0x1c4400(0x125)]];if(!_0x44c001){_0x7eb91f[_0x1c4400(0x135)]({'sqlCode':_0x3b42de[_0x1c4400(0x125)],'error':_0x1c4400(0x11f)});continue;}try{const _0x18ad29=await computeSqlFileHash(_0x3b42de[_0x1c4400(0x120)]),_0x2cb3a0=_0x44c001[_0x1c4400(0x10e)]!==_0x3b42de[_0x1c4400(0x10d)]||!!_0x3b42de[_0x1c4400(0x13b)]&&_0x44c001[_0x1c4400(0x13b)]!==_0x3b42de[_0x1c4400(0x13b)]||_0x44c001[_0x1c4400(0xf7)]!==_0x3b42de[_0x1c4400(0xf7)];if(!_0x4b13d5[_0x1c4400(0x12d)]('force')&&_0x44c001['hash']===_0x18ad29&&!_0x2cb3a0){_0x3dc61f['push']({'sqlCode':_0x3b42de[_0x1c4400(0x125)],'reason':'unchanged'});continue;}if(_0x44c001[_0x1c4400(0x138)]==null){_0x7eb91f[_0x1c4400(0x135)]({'sqlCode':_0x3b42de[_0x1c4400(0x125)],'error':_0x1c4400(0x12c)});continue;}const _0x3a6298=_0x3b42de[_0x1c4400(0x13b)]||_0x44c001[_0x1c4400(0x13b)],_0x243c5b=await resolveTargetDbBinding(_0x4b13d5[_0x1c4400(0x122)],_0x3b42de,_0x44c001),_0x5bc3c6=await readSqlUploadContent(_0x3b42de),_0x427acb=await updateSqlQuery({'id':_0x44c001['remoteId'],'appCode':_0x4b13d5[_0x1c4400(0x122)],'sqlCode':_0x3b42de[_0x1c4400(0x125)],'sqlName':_0x3a6298,'dbId':_0x243c5b[_0x1c4400(0x126)],'version':_0x44c001[_0x1c4400(0x138)],'sqlContent':_0x5bc3c6,'sqlConfig':_0x44c001[_0x1c4400(0x123)]??undefined}),_0x42835d=_0x427acb['dbId']?await getDbName(_0x4b13d5['appCode'],Number(_0x427acb[_0x1c4400(0x126)]))[_0x1c4400(0x137)](()=>_0x243c5b[_0x1c4400(0x134)]):_0x243c5b[_0x1c4400(0x134)];_0x189e68[_0x1c4400(0x108)][_0x3b42de['sqlCode']]={...buildSqlLockEntry(_0x427acb,_0x5bc3c6,_0x18ad29,{'dbName':_0x42835d}),'path':_0x3b42de[_0x1c4400(0x10d)],'mode':_0x3b42de['mode']},_0x31cabc=!![],await archivePreviousSqlFileIfNeeded(_0x15962d,_0x44c001[_0x1c4400(0x10e)],_0x3b42de['relativePath']),_0xb2b072[_0x1c4400(0x135)]({'sqlCode':_0x3b42de['sqlCode'],'remoteId':_0x44c001[_0x1c4400(0x139)]});}catch(_0x30e371){_0x7eb91f[_0x1c4400(0x135)]({'sqlCode':_0x3b42de[_0x1c4400(0x125)],'error':_0x30e371 instanceof Error?_0x30e371[_0x1c4400(0x109)]:String(_0x30e371)});}}(_0x31cabc||_0x7eb91f[_0x1c4400(0xff)]===0x0)&&(_0x189e68[_0x1c4400(0x12f)]=new Date()[_0x1c4400(0x101)](),await writeSqlLockFile(_0x15962d[_0x1c4400(0x107)],_0x2f1bd5));const _0x127d6c=_0x7eb91f[_0x1c4400(0xff)]===0x0;return{'ok':_0x127d6c,'data':{'pushed':_0xb2b072,'skipped':_0x3dc61f,'failed':_0x7eb91f},'message':_0x1c4400(0x100)+_0xb2b072['length']+'\x20pushed,\x20'+_0x3dc61f[_0x1c4400(0xff)]+_0x1c4400(0xfc)+_0x7eb91f[_0x1c4400(0xff)]+_0x1c4400(0x12b)};}};async function archivePreviousSqlFileIfNeeded(_0x19bba3,_0x5776ab,_0x1ed72b){const _0x3af9da=a243_0x311b48;if(!_0x5776ab||_0x5776ab===_0x1ed72b)return;const _0x8ed448=join(_0x19bba3[_0x3af9da(0x127)],_0x5776ab);if(!await fileExists(_0x8ed448))return;const _0x4a587d=await moveToTrash(_0x19bba3[_0x3af9da(0x106)],_0x19bba3[_0x3af9da(0x11e)],_0x8ed448);await cleanupEmptyDirectories(dirname(_0x8ed448),_0x19bba3[_0x3af9da(0x127)]),void _0x4a587d;}async function moveToTrash(_0x3f137a,_0x42a7a5,_0x225d59){const _0x32935e=a243_0x311b48,_0x5a0955=new Date()[_0x32935e(0x101)]()['replace'](/[:.]/g,'-'),_0x64d938=relative(_0x3f137a,_0x225d59),_0x58246f=join(_0x42a7a5,_0x5a0955,_0x64d938);return await mkdir(dirname(_0x58246f),{'recursive':!![]}),await rename(_0x225d59,_0x58246f),_0x58246f;}async function cleanupEmptyDirectories(_0x3ae52c,_0xc91d95){const _0x3d6eca=a243_0x311b48;let _0x332aed=resolve(_0x3ae52c);const _0x57025b=resolve(_0xc91d95);while(_0x332aed[_0x3d6eca(0x13a)](''+_0x57025b+sep)||_0x332aed===_0x57025b){if(_0x332aed===_0x57025b)return;try{const _0x2b3073=await readdir(_0x332aed);if(_0x2b3073[_0x3d6eca(0xff)]>0x0)return;await rmdir(_0x332aed);}catch{return;}_0x332aed=dirname(_0x332aed);}}function a243_0x2a8d(){const _0x8b6296=['\x22\x20for\x20sqlCode\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','entries','get','sqlcode','7430fbKayD','trashDir','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','filePath','\x20SQL\x20file(s)','appCode','sqlConfig',':\x20SQL\x20content\x20is\x20empty.','sqlCode','dbId','sqlRootDir','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','exec','2736WHSnFG','\x20failed','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','bool','Would\x20push\x20','lastSync','filter','6468fNSURG','has','sqlRoot','dbName','push','utf8','catch','version','remoteId','startsWith','sqlName','153346sGLLkC','mode','trim','str',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','No\x20database\x20matches\x20local\x20directory\x20\x22','\x20skipped,\x20','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','/smartapi/custom/updateUserCustomSql','length','Push\x20complete:\x20','toISOString','validation','No\x20local\x20SQL\x20files\x20found.','sql','1400gTlLZR','projectRoot','lockFilePath','sqls','message','join','1180935QrcmZW','force','relativePath','path','map','22803NXxrNN','dbDirectory','340470XzjESO','Push\x20local\x20SQL\x20files\x20to\x20remote','2xwtHlX','4302rFjSpO','write','1312044JAPmIl'];a243_0x2a8d=function(){return _0x8b6296;};return a243_0x2a8d();}async function resolveTargetDbBinding(_0x15d478,_0x563ad6,_0x3e4d6e){const _0x1d68d8=a243_0x311b48,_0x55b1b2=_0x563ad6[_0x1d68d8(0x111)];if(!_0x55b1b2)return{'dbId':_0x3e4d6e[_0x1d68d8(0x126)],'dbName':_0x3e4d6e[_0x1d68d8(0x134)]};const _0x45ba1b=buildDbDirectoryName(_0x3e4d6e[_0x1d68d8(0x134)],_0x3e4d6e[_0x1d68d8(0x126)]);if(_0x55b1b2===_0x45ba1b)return{'dbId':_0x3e4d6e['dbId'],'dbName':_0x3e4d6e[_0x1d68d8(0x134)]};const _0x203e83=parseExplicitDbDirectory(_0x55b1b2);if(_0x203e83!=null)return{'dbId':_0x203e83,'dbName':await getDbName(_0x15d478,_0x203e83)[_0x1d68d8(0x137)](()=>undefined)};const _0x44a1b0=await listDatabases(_0x15d478),_0xd093ed=_0x44a1b0['filter'](_0x2c3844=>buildDbDirectoryName(_0x2c3844[_0x1d68d8(0x134)],_0x2c3844[_0x1d68d8(0x126)])===_0x55b1b2);if(_0xd093ed[_0x1d68d8(0xff)]===0x1)return{'dbId':_0xd093ed[0x0][_0x1d68d8(0x126)],'dbName':_0xd093ed[0x0]['dbName']};if(_0xd093ed[_0x1d68d8(0xff)]===0x0)throw CliErrors[_0x1d68d8(0x102)](_0x1d68d8(0xfb)+_0x55b1b2+_0x1d68d8(0x118)+_0x563ad6[_0x1d68d8(0x125)]+'.');const _0x569d37=_0xd093ed[_0x1d68d8(0x10f)](_0x5afb39=>_0x5afb39[_0x1d68d8(0x134)]+'\x20('+_0x5afb39[_0x1d68d8(0x126)]+')')[_0x1d68d8(0x10a)](',\x20');throw CliErrors['validation']('Local\x20directory\x20\x22'+_0x55b1b2+_0x1d68d8(0xfd)+_0x563ad6[_0x1d68d8(0x125)]+':\x20'+_0x569d37);}function parseExplicitDbDirectory(_0x7fb409){const _0x51ce66=a243_0x311b48,_0x5e5470=/^db-(\d+)$/[_0x51ce66(0x129)](_0x7fb409);if(!_0x5e5470)return null;const _0x1f36f0=Number(_0x5e5470[0x1]);return Number['isFinite'](_0x1f36f0)&&_0x1f36f0>0x0?_0x1f36f0:null;}