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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/README.md +4 -3
  2. package/lib/api/api-doc.js +1 -1
  3. package/lib/api/api-group.js +1 -1
  4. package/lib/api/fetch-model-list.js +1 -1
  5. package/lib/api/generate-api-file.js +1 -1
  6. package/lib/api/generate-sdk-config-file.js +1 -1
  7. package/lib/api/legacy-api-file.js +1 -1
  8. package/lib/api/model-registry-file.js +1 -1
  9. package/lib/api/model-registry-scaffold.js +1 -1
  10. package/lib/api/model-source.js +1 -1
  11. package/lib/auth/auth-server-ui.js +1 -1
  12. package/lib/auth/auth-server.js +1 -1
  13. package/lib/auth/constant.js +1 -1
  14. package/lib/auth/get-cookie.js +1 -1
  15. package/lib/auth/get-session-user.js +1 -1
  16. package/lib/auth/is-session-valid.js +1 -1
  17. package/lib/auth/login-success-html.js +1 -1
  18. package/lib/auth/logout.js +1 -1
  19. package/lib/cli-flags.js +1 -1
  20. package/lib/cli.js +1 -1
  21. package/lib/commands/api/generate.js +1 -1
  22. package/lib/commands/api/index.js +1 -1
  23. package/lib/commands/api/list.js +1 -1
  24. package/lib/commands/api/pull.js +1 -1
  25. package/lib/commands/api/shared.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.d.ts +1 -1
  63. package/lib/commands/config/init.js +1 -1
  64. package/lib/commands/config/list.js +1 -1
  65. package/lib/commands/config/set.js +1 -1
  66. package/lib/commands/config/shared.js +1 -1
  67. package/lib/commands/dataset/batch-design.js +1 -1
  68. package/lib/commands/dataset/business-group-update.js +1 -1
  69. package/lib/commands/dataset/business-groups.js +1 -1
  70. package/lib/commands/dataset/capability.js +1 -1
  71. package/lib/commands/dataset/cross-relation-create.js +1 -1
  72. package/lib/commands/dataset/cross-relation-delete.js +1 -1
  73. package/lib/commands/dataset/cross-relation-list.js +1 -1
  74. package/lib/commands/dataset/cross-relation-shared.js +1 -1
  75. package/lib/commands/dataset/cross-relation-update.js +1 -1
  76. package/lib/commands/dataset/delete.js +1 -1
  77. package/lib/commands/dataset/detail.js +1 -1
  78. package/lib/commands/dataset/extend-update.js +1 -1
  79. package/lib/commands/dataset/field-restore.js +1 -1
  80. package/lib/commands/dataset/field-update.js +1 -1
  81. package/lib/commands/dataset/generate.js +1 -1
  82. package/lib/commands/dataset/index.js +1 -1
  83. package/lib/commands/dataset/list.js +1 -1
  84. package/lib/commands/dataset/operations.js +1 -1
  85. package/lib/commands/dataset/relation-audit.js +1 -1
  86. package/lib/commands/dataset/relation-create.js +1 -1
  87. package/lib/commands/dataset/relation-delete.js +1 -1
  88. package/lib/commands/dataset/relation-shared.js +1 -1
  89. package/lib/commands/dataset/relation-update.js +1 -1
  90. package/lib/commands/dataset/relations.js +1 -1
  91. package/lib/commands/dataset/rename.js +1 -1
  92. package/lib/commands/dataset/restore.js +1 -1
  93. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  94. package/lib/commands/db/analysis-batching.js +1 -1
  95. package/lib/commands/db/analyze-batch-plan.js +1 -1
  96. package/lib/commands/db/analyze-cancel.js +1 -1
  97. package/lib/commands/db/analyze-start.js +1 -1
  98. package/lib/commands/db/analyze-status.js +1 -1
  99. package/lib/commands/db/create.js +1 -1
  100. package/lib/commands/db/delete.js +1 -1
  101. package/lib/commands/db/detail.js +1 -1
  102. package/lib/commands/db/diff-refresh-start.js +1 -1
  103. package/lib/commands/db/diff-refresh-status.js +1 -1
  104. package/lib/commands/db/diff.js +1 -1
  105. package/lib/commands/db/index.js +1 -1
  106. package/lib/commands/db/list.js +1 -1
  107. package/lib/commands/db/shared.js +1 -1
  108. package/lib/commands/db/table-diff-shared.js +1 -1
  109. package/lib/commands/db/tables.js +1 -1
  110. package/lib/commands/db/test.js +1 -1
  111. package/lib/commands/db/update.js +1 -1
  112. package/lib/commands/deployment/index.js +1 -1
  113. package/lib/commands/deployment/sync-all.js +1 -1
  114. package/lib/commands/deployment/sync-jobs.js +1 -1
  115. package/lib/commands/deployment/sync-status.js +1 -1
  116. package/lib/commands/doctor.js +1 -1
  117. package/lib/commands/file/index.js +1 -1
  118. package/lib/commands/flow/create.js +1 -1
  119. package/lib/commands/flow/detail.js +1 -1
  120. package/lib/commands/flow/index.js +1 -1
  121. package/lib/commands/flow/list.js +1 -1
  122. package/lib/commands/flow/publish.js +1 -1
  123. package/lib/commands/flow/runtime-resources-shared.js +1 -1
  124. package/lib/commands/flow/runtime-role-list.js +1 -1
  125. package/lib/commands/flow/runtime-role-user-list.js +1 -1
  126. package/lib/commands/flow/runtime-user-search.js +1 -1
  127. package/lib/commands/flow/shared.js +1 -1
  128. package/lib/commands/flow/update.js +1 -1
  129. package/lib/commands/flow/validate.js +1 -1
  130. package/lib/commands/instant-api-policy/current.js +1 -1
  131. package/lib/commands/instant-api-policy/index.js +1 -1
  132. package/lib/commands/instant-api-policy/init.js +1 -1
  133. package/lib/commands/instant-api-policy/publish.js +1 -1
  134. package/lib/commands/instant-api-policy/pull.js +1 -1
  135. package/lib/commands/instant-api-policy/revision.js +1 -1
  136. package/lib/commands/instant-api-policy/revisions.js +1 -1
  137. package/lib/commands/instant-api-policy/rollback.js +1 -1
  138. package/lib/commands/instant-api-policy/shared.js +1 -1
  139. package/lib/commands/instant-api-policy/validate.js +1 -1
  140. package/lib/commands/issue/index.js +1 -1
  141. package/lib/commands/issue/nudge.js +1 -1
  142. package/lib/commands/issue/report.js +1 -1
  143. package/lib/commands/issue/shared.js +1 -1
  144. package/lib/commands/kb/create.js +1 -1
  145. package/lib/commands/kb/delete.js +1 -1
  146. package/lib/commands/kb/detail.js +1 -1
  147. package/lib/commands/kb/index.js +1 -1
  148. package/lib/commands/kb/list.js +1 -1
  149. package/lib/commands/kb/search.js +1 -1
  150. package/lib/commands/kb/shared.js +1 -1
  151. package/lib/commands/kb/update.js +1 -1
  152. package/lib/commands/logs/index.js +1 -1
  153. package/lib/commands/menu/asset-update.js +1 -1
  154. package/lib/commands/menu/delete.js +1 -1
  155. package/lib/commands/menu/external-link-create.js +1 -1
  156. package/lib/commands/menu/external-link-update.js +1 -1
  157. package/lib/commands/menu/group-create.js +1 -1
  158. package/lib/commands/menu/group-update.js +1 -1
  159. package/lib/commands/menu/index.js +1 -1
  160. package/lib/commands/menu/list.js +1 -1
  161. package/lib/commands/menu/move.js +1 -1
  162. package/lib/commands/menu/regroup-start.js +1 -1
  163. package/lib/commands/menu/rename.js +1 -1
  164. package/lib/commands/menu/shared/compare-table.js +1 -1
  165. package/lib/commands/menu/shared/delete-plan.js +1 -1
  166. package/lib/commands/menu/shared/facts.js +1 -1
  167. package/lib/commands/menu/shared/index.js +1 -1
  168. package/lib/commands/menu/shared/inquirer.js +1 -1
  169. package/lib/commands/menu/shared/local-pages.js +1 -1
  170. package/lib/commands/menu/shared/logic.js +1 -1
  171. package/lib/commands/menu/shared/mutations.js +1 -1
  172. package/lib/commands/menu/shared/service.js +1 -1
  173. package/lib/commands/menu/shared/sync-core.js +1 -1
  174. package/lib/commands/menu/shared/update-core.js +1 -1
  175. package/lib/commands/menu/shared/valid-url.js +1 -1
  176. package/lib/commands/menu/sync.js +1 -1
  177. package/lib/commands/menu/visibility-update.js +1 -1
  178. package/lib/commands/notification/config-create.js +1 -1
  179. package/lib/commands/notification/config-delete.js +1 -1
  180. package/lib/commands/notification/config-list.js +1 -1
  181. package/lib/commands/notification/config-update.js +1 -1
  182. package/lib/commands/notification/index.js +1 -1
  183. package/lib/commands/notification/shared.js +1 -1
  184. package/lib/commands/ocr/index.js +1 -1
  185. package/lib/commands/page/create.js +1 -1
  186. package/lib/commands/page/custom/detail.js +1 -1
  187. package/lib/commands/page/custom/list.js +1 -1
  188. package/lib/commands/page/custom/publish.js +1 -1
  189. package/lib/commands/page/custom/shared.js +1 -1
  190. package/lib/commands/page/custom/syntax.js +1 -1
  191. package/lib/commands/page/custom/update.js +1 -1
  192. package/lib/commands/page/data-list-status.js +1 -1
  193. package/lib/commands/page/generate-start.js +1 -1
  194. package/lib/commands/page/generate-status.js +1 -1
  195. package/lib/commands/page/index.js +1 -1
  196. package/lib/commands/page/pull.js +1 -1
  197. package/lib/commands/page/push.js +1 -1
  198. package/lib/commands/page/relation-audit.js +1 -1
  199. package/lib/commands/page/restore.js +1 -1
  200. package/lib/commands/page/shared.js +1 -1
  201. package/lib/commands/page/sync.js +1 -1
  202. package/lib/commands/project/api-architecture-upgrade.js +1 -1
  203. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  204. package/lib/commands/project/create/format-elapsed.js +1 -1
  205. package/lib/commands/project/create/main.js +1 -1
  206. package/lib/commands/project/create/materialize-project-template.js +1 -1
  207. package/lib/commands/project/create/project-name.js +1 -1
  208. package/lib/commands/project/create/project-template-archive.js +1 -1
  209. package/lib/commands/project/create/project-template-path.js +1 -1
  210. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  211. package/lib/commands/project/create/use-format-code.js +1 -1
  212. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  213. package/lib/commands/project/domain-routing-sync.js +1 -1
  214. package/lib/commands/project/index.js +1 -1
  215. package/lib/commands/project/upgrade.js +1 -1
  216. package/lib/commands/registry.js +1 -1
  217. package/lib/commands/role/delete.js +1 -1
  218. package/lib/commands/role/detail.js +1 -1
  219. package/lib/commands/role/index.js +1 -1
  220. package/lib/commands/role/list.js +1 -1
  221. package/lib/commands/role/shared.js +1 -1
  222. package/lib/commands/role/update.js +1 -1
  223. package/lib/commands/role/user-add.js +1 -1
  224. package/lib/commands/role/user-remove.js +1 -1
  225. package/lib/commands/role/user-resolve.js +1 -1
  226. package/lib/commands/rule/get.js +1 -1
  227. package/lib/commands/rule/index.js +1 -1
  228. package/lib/commands/rule/list.js +1 -1
  229. package/lib/commands/rule/set.js +1 -1
  230. package/lib/commands/rule/shared.js +1 -1
  231. package/lib/commands/run/index.js +1 -1
  232. package/lib/commands/schema.js +1 -1
  233. package/lib/commands/sql/create.js +1 -1
  234. package/lib/commands/sql/delete.js +1 -1
  235. package/lib/commands/sql/detail.js +1 -1
  236. package/lib/commands/sql/exec.js +1 -1
  237. package/lib/commands/sql/index.js +1 -1
  238. package/lib/commands/sql/list.js +1 -1
  239. package/lib/commands/sql/pull.js +1 -1
  240. package/lib/commands/sql/push.js +1 -1
  241. package/lib/commands/sql/shared.js +1 -1
  242. package/lib/commands/sql/status.js +1 -1
  243. package/lib/commands/sql/validate.js +1 -1
  244. package/lib/commands/task/index.js +1 -1
  245. package/lib/commands/task/status.js +1 -1
  246. package/lib/commands/tenant/index.js +1 -1
  247. package/lib/commands/tenant/members-list.js +1 -1
  248. package/lib/commands/tenant/shared.js +1 -1
  249. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  250. package/lib/commands/user-account/feishu-bind.d.ts +2 -0
  251. package/lib/commands/user-account/feishu-bind.js +1 -0
  252. package/lib/commands/user-account/index.js +1 -1
  253. package/lib/commands/workspace/add.js +1 -1
  254. package/lib/commands/workspace/index.js +1 -1
  255. package/lib/commands/workspace/remove.js +1 -1
  256. package/lib/config/domain-config.d.ts +1 -1
  257. package/lib/config/domain-config.js +1 -1
  258. package/lib/config/project-domain-routing.js +1 -1
  259. package/lib/config/region-config.js +1 -1
  260. package/lib/config/schema.d.ts +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.d.ts +4 -0
  266. package/lib/constant/domain.js +1 -1
  267. package/lib/constant/env.js +1 -1
  268. package/lib/constant/output.js +1 -1
  269. package/lib/constant/paths.js +1 -1
  270. package/lib/constant/region.d.ts +1 -1
  271. package/lib/constant/region.js +1 -1
  272. package/lib/constant/risk.js +1 -1
  273. package/lib/constant/routing-profile.d.ts +14 -1
  274. package/lib/constant/routing-profile.js +1 -1
  275. package/lib/context/app-resolver.d.ts +1 -0
  276. package/lib/context/app-resolver.js +1 -1
  277. package/lib/context/auth-resolver.js +1 -1
  278. package/lib/context/config-loader.js +1 -1
  279. package/lib/context.js +1 -1
  280. package/lib/core/alias-resolver.js +1 -1
  281. package/lib/core/api-client.d.ts +2 -0
  282. package/lib/core/api-client.js +1 -1
  283. package/lib/core/bff/config.js +1 -1
  284. package/lib/core/bff/file-system.js +1 -1
  285. package/lib/core/bff/hash.js +1 -1
  286. package/lib/core/bff/hook-directory.js +1 -1
  287. package/lib/core/bff/lock.js +1 -1
  288. package/lib/core/bff/utils.js +1 -1
  289. package/lib/core/cross-db-relation.js +1 -1
  290. package/lib/core/db-resolver.js +1 -1
  291. package/lib/core/flow-config.js +1 -1
  292. package/lib/core/instant-api-policy/config.js +1 -1
  293. package/lib/core/kb-search-client.js +1 -1
  294. package/lib/core/page/file-system.js +1 -1
  295. package/lib/core/page/hash.js +1 -1
  296. package/lib/core/page/lock.js +1 -1
  297. package/lib/core/page/lr-smart-jsx.js +1 -1
  298. package/lib/core/sql-index-auditor.js +1 -1
  299. package/lib/core/sql-sync/config.js +1 -1
  300. package/lib/core/sql-sync/file-system.js +1 -1
  301. package/lib/core/sql-sync/hash.js +1 -1
  302. package/lib/core/sql-sync/lock.js +1 -1
  303. package/lib/core/sql-sync/utils.js +1 -1
  304. package/lib/core/sql-validator.js +1 -1
  305. package/lib/errors.js +1 -1
  306. package/lib/framework/build-all-flags.js +1 -1
  307. package/lib/framework/error-output.js +1 -1
  308. package/lib/framework/explicit-yes.js +1 -1
  309. package/lib/framework/flags.js +1 -1
  310. package/lib/framework/help.js +1 -1
  311. package/lib/framework/index.js +1 -1
  312. package/lib/framework/output.js +1 -1
  313. package/lib/framework/response.js +1 -1
  314. package/lib/framework/runner-alias.js +1 -1
  315. package/lib/framework/runner.js +1 -1
  316. package/lib/framework/schema-export.js +1 -1
  317. package/lib/framework/supported-flags.js +1 -1
  318. package/lib/framework/types.js +1 -1
  319. package/lib/generated/build-info.d.ts +4 -4
  320. package/lib/generated/build-info.js +1 -1
  321. package/lib/generated/official-routing.d.ts +15 -3
  322. package/lib/generated/official-routing.js +1 -1
  323. package/lib/generated/routing-contract.d.ts +2 -2
  324. package/lib/generated/routing-contract.js +1 -1
  325. package/lib/help.js +1 -1
  326. package/lib/postinstall.js +1 -1
  327. package/lib/runtime/confirmation.js +1 -1
  328. package/lib/runtime/event.js +1 -1
  329. package/lib/runtime/index.js +1 -1
  330. package/lib/runtime/queue.js +1 -1
  331. package/lib/runtime/resolve.js +1 -1
  332. package/lib/skills/builtin-skill.js +1 -1
  333. package/lib/skills/main.js +1 -1
  334. package/lib/skills/npx-skills-add.d.ts +5 -0
  335. package/lib/skills/npx-skills-add.js +1 -1
  336. package/lib/skills/skill-presence.js +1 -1
  337. package/lib/telemetry/cli-command-trace.js +1 -1
  338. package/lib/telemetry/cli-help-trace.js +1 -1
  339. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  340. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  341. package/lib/telemetry/send-cli-trace-log.js +1 -1
  342. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  343. package/lib/utils/ai_config.js +1 -1
  344. package/lib/utils/apply-jq-filter.js +1 -1
  345. package/lib/utils/cdn-config.js +1 -1
  346. package/lib/utils/check-sdk-version.js +1 -1
  347. package/lib/utils/cli-version-check.js +1 -1
  348. package/lib/utils/cli-version-policy.js +1 -1
  349. package/lib/utils/config.js +1 -1
  350. package/lib/utils/entity-with-id.js +1 -1
  351. package/lib/utils/file-utils.js +1 -1
  352. package/lib/utils/guides-cdn.js +1 -1
  353. package/lib/utils/http-client.js +1 -1
  354. package/lib/utils/is-non-interactive.js +1 -1
  355. package/lib/utils/logger.js +1 -1
  356. package/lib/utils/params.js +1 -1
  357. package/lib/utils/platform.js +1 -1
  358. package/lib/utils/sleep.js +1 -1
  359. package/lib/utils/template-replacer.js +1 -1
  360. package/lib/utils/update-notice.js +1 -1
  361. package/lib/utils/version.js +1 -1
  362. package/lib/utils/with-active-cookie.js +1 -1
  363. package/lib/utils/write-cli-side-channel.js +1 -1
  364. package/package.json +1 -1
  365. package/skills/rabetbase/SKILL.md +4 -3
  366. package/skills/rabetbase/guides/sql-creation-workflow.md +1 -1
  367. package/skills/rabetbase/guides/sql-mybatis.md +12 -8
  368. package/skills/rabetbase/references/rabetbase-config.md +6 -4
  369. package/skills/rabetbase/references/rabetbase-init.md +7 -5
  370. package/skills/rabetbase/references/rabetbase-kb.md +8 -6
  371. package/skills/rabetbase/references/rabetbase-user-account.md +20 -2
  372. package/skills/rabetbase.manifest.json +3 -3
@@ -1 +1 @@
1
- const a228_0x4306f3=a228_0x15d9;(function(_0x37beb6,_0x5b55fd){const _0x4b833a=a228_0x15d9,_0x437911=_0x37beb6();while(!![]){try{const _0x4a5a3a=-parseInt(_0x4b833a(0x8c))/0x1*(-parseInt(_0x4b833a(0x94))/0x2)+parseInt(_0x4b833a(0x7c))/0x3*(parseInt(_0x4b833a(0x87))/0x4)+-parseInt(_0x4b833a(0xa3))/0x5*(parseInt(_0x4b833a(0x86))/0x6)+parseInt(_0x4b833a(0xa7))/0x7+-parseInt(_0x4b833a(0x7e))/0x8*(-parseInt(_0x4b833a(0x97))/0x9)+-parseInt(_0x4b833a(0x8d))/0xa+-parseInt(_0x4b833a(0x84))/0xb*(parseInt(_0x4b833a(0xa2))/0xc);if(_0x4a5a3a===_0x5b55fd)break;else _0x437911['push'](_0x437911['shift']());}catch(_0x3d72ba){_0x437911['push'](_0x437911['shift']());}}}(a228_0x4dd3,0x4a294));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';function a228_0x15d9(_0x7deafc,_0x362a60){_0x7deafc=_0x7deafc-0x78;const _0x4dd3c6=a228_0x4dd3();let _0x15d9a9=_0x4dd3c6[_0x7deafc];return _0x15d9a9;}import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a228_0x4306f3(0x79),a228_0x4306f3(0x8a)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a228_0x4306f3(0x7a),'database':a228_0x4306f3(0x7f)},APP_RULE_CONTEXT_SCOPES={'rules':a228_0x4306f3(0x81),'database':a228_0x4306f3(0x7d)};export function appRuleError(_0x7b9e04,_0x1de7db,_0x535214){return new CliError(_0x7b9e04,0x1,_0x1de7db,_0x535214);}export function readAppRuleType(_0xbf7704){const _0x3fc4b5=a228_0x4306f3,_0x584819=_0xbf7704[_0x3fc4b5(0x9c)](_0x3fc4b5(0x88))[_0x3fc4b5(0x85)]()[_0x3fc4b5(0xa4)]();if(_0x584819!==_0x3fc4b5(0x79)&&_0x584819!=='database')throw appRuleError('app_rule_type_invalid',_0x3fc4b5(0x89));return _0x584819;}export function appRuleFileName(_0x568ca9){return APP_RULE_FILES[_0x568ca9];}export function appRuleContextScope(_0x1eae9e){return APP_RULE_CONTEXT_SCOPES[_0x1eae9e];}function a228_0x4dd3(){const _0x35d320=['376Xixaiw','DATABASE.md','scope','page-api-development','byteSize','isFile','11eUWtVi','trim','1398132IFWgkG','192144gLOIny','type','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','database','updateTime','1TjbHkm','993480oTIDtb','app_rule_file_invalid','sha256:','Pass\x20a\x20UTF-8\x20Markdown\x20file.','utf8','appCode','createTime','307570YsOHrG','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','app_rule_content_invalid','66672JOCcSx','Cannot\x20read\x20app\x20rule\x20file:\x20','content','message','hex','str','app_rule_file_required','app_rule_content_too_large','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','Cannot\x20access\x20app\x20rule\x20file:\x20','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','7434984tyGLLK','10OHkhDO','toLowerCase','byteLength','from','3881171rFwsNC','version','string','update','rules','RULES.md','App\x20rule\x20file\x20is\x20blank:\x20','27jYXyNc','database-analysis'];a228_0x4dd3=function(){return _0x35d320;};return a228_0x4dd3();}export function inspectAppRuleContent(_0xcdaa18){const _0x1ca595=a228_0x4306f3,_0x242b46=Buffer[_0x1ca595(0xa6)](_0xcdaa18,_0x1ca595(0x91));return{'content':_0xcdaa18,'byteSize':_0x242b46[_0x1ca595(0xa5)],'contentHash':_0x1ca595(0x8f)+createHash('sha256')[_0x1ca595(0x78)](_0x242b46)['digest'](_0x1ca595(0x9b))};}export async function readAppRuleFile(_0x19eb74){const _0x4c68b2=a228_0x4306f3,_0x5414c5=_0x19eb74[_0x4c68b2(0x85)]();if(!_0x5414c5)throw appRuleError(_0x4c68b2(0x9d),'--file\x20is\x20required.',_0x4c68b2(0x90));const _0x522848=resolve(_0x5414c5);let _0x1653fe;try{_0x1653fe=await stat(_0x522848);}catch(_0x11dfcd){throw appRuleError('app_rule_file_unreadable',_0x4c68b2(0xa0)+_0x5414c5,_0x11dfcd instanceof Error?_0x11dfcd[_0x4c68b2(0x9a)]:String(_0x11dfcd));}if(!_0x1653fe[_0x4c68b2(0x83)]())throw appRuleError(_0x4c68b2(0x8e),_0x4c68b2(0xa1)+_0x5414c5);if(_0x1653fe['size']>MAX_APP_RULE_BYTES)throw appRuleError(_0x4c68b2(0x9e),_0x4c68b2(0x95));let _0x3c7118;try{_0x3c7118=await readFile(_0x522848);}catch(_0x6f974f){throw appRuleError('app_rule_file_unreadable',_0x4c68b2(0x98)+_0x5414c5,_0x6f974f instanceof Error?_0x6f974f[_0x4c68b2(0x9a)]:String(_0x6f974f));}if(_0x3c7118['byteLength']>MAX_APP_RULE_BYTES)throw appRuleError(_0x4c68b2(0x9e),'App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.');let _0xc3f960;try{_0xc3f960=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})['decode'](_0x3c7118);}catch{throw appRuleError(_0x4c68b2(0x96),'App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20'+_0x5414c5);}if(!_0xc3f960[_0x4c68b2(0x85)]())throw appRuleError(_0x4c68b2(0x96),_0x4c68b2(0x7b)+_0x5414c5);return inspectAppRuleContent(_0xc3f960);}export function projectAppRule(_0x1511e4,_0x12170a){const _0x122a53=a228_0x4306f3;if(!_0x12170a)return{'type':_0x1511e4,'fileName':appRuleFileName(_0x1511e4),'contextScope':appRuleContextScope(_0x1511e4),'enabled':![]};const _0x273767=inspectAppRuleContent(_0x12170a[_0x122a53(0x99)]);return{'type':_0x1511e4,'fileName':appRuleFileName(_0x1511e4),'contextScope':appRuleContextScope(_0x1511e4),'enabled':!![],'id':_0x12170a['id'],'scope':_0x12170a[_0x122a53(0x80)],'appCode':_0x12170a[_0x122a53(0x92)],'version':_0x12170a[_0x122a53(0xa8)],'contentByteSize':_0x273767[_0x122a53(0x82)],'contentHash':_0x273767['contentHash'],..._0x12170a['createTime']!==undefined&&_0x12170a[_0x122a53(0x93)]!==null?{'createTime':_0x12170a[_0x122a53(0x93)]}:{},..._0x12170a[_0x122a53(0x8b)]!==undefined&&_0x12170a[_0x122a53(0x8b)]!==null?{'updateTime':_0x12170a[_0x122a53(0x8b)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a228_0x4306f3(0x88),'type':a228_0x4306f3(0xa9),'required':!![],'description':a228_0x4306f3(0x9f),'enum':[...APP_RULE_TYPES]};
1
+ const a228_0x2b0de3=a228_0x4edc;(function(_0x4a3e7e,_0x3e8514){const _0x18a6c9=a228_0x4edc,_0x1f9c09=_0x4a3e7e();while(!![]){try{const _0x4eb298=parseInt(_0x18a6c9(0x1d9))/0x1+-parseInt(_0x18a6c9(0x1de))/0x2*(parseInt(_0x18a6c9(0x1e2))/0x3)+parseInt(_0x18a6c9(0x1d5))/0x4*(parseInt(_0x18a6c9(0x1bc))/0x5)+-parseInt(_0x18a6c9(0x1e0))/0x6*(parseInt(_0x18a6c9(0x1b7))/0x7)+-parseInt(_0x18a6c9(0x1b5))/0x8*(parseInt(_0x18a6c9(0x1d1))/0x9)+-parseInt(_0x18a6c9(0x1cf))/0xa+parseInt(_0x18a6c9(0x1dc))/0xb*(parseInt(_0x18a6c9(0x1b6))/0xc);if(_0x4eb298===_0x3e8514)break;else _0x1f9c09['push'](_0x1f9c09['shift']());}catch(_0x41185b){_0x1f9c09['push'](_0x1f9c09['shift']());}}}(a228_0x4ea5,0xdca0e));function a228_0x4ea5(){const _0x3f12fc=['type','content','app_rule_type_invalid','trim','sha256','8187510KxLKjB','Pass\x20a\x20UTF-8\x20Markdown\x20file.','302283eKaPVA','page-api-development','byteLength','app_rule_file_required','20cPGlzM','database-analysis','size','byteSize','134577WtNTNR','scope','updateTime','72787tMedJe','DATABASE.md','2Vyyzjv','decode','6OFWBMm','Cannot\x20read\x20app\x20rule\x20file:\x20','3847062BWdmCY','--file\x20is\x20required.','contentHash','isFile','168aEYaWH','7812ySCVOO','11350731UDdNGj','database','createTime','str','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','889415WUBKFW','app_rule_content_invalid','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','RULES.md','hex','message','digest','Cannot\x20access\x20app\x20rule\x20file:\x20','rules','App\x20rule\x20file\x20is\x20blank:\x20','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','app_rule_file_unreadable','app_rule_content_too_large','app_rule_file_invalid'];a228_0x4ea5=function(){return _0x3f12fc;};return a228_0x4ea5();}import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';function a228_0x4edc(_0x124647,_0x29a0ee){_0x124647=_0x124647-0x1b5;const _0x4ea55d=a228_0x4ea5();let _0x4edc98=_0x4ea55d[_0x124647];return _0x4edc98;}import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a228_0x2b0de3(0x1c4),a228_0x2b0de3(0x1b8)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a228_0x2b0de3(0x1bf),'database':a228_0x2b0de3(0x1dd)},APP_RULE_CONTEXT_SCOPES={'rules':a228_0x2b0de3(0x1d2),'database':a228_0x2b0de3(0x1d6)};export function appRuleError(_0x16c32b,_0x175b9b,_0x279aa1){return new CliError(_0x16c32b,0x1,_0x175b9b,_0x279aa1);}export function readAppRuleType(_0x558543){const _0x1f0e28=a228_0x2b0de3,_0x445d40=_0x558543[_0x1f0e28(0x1ba)](_0x1f0e28(0x1ca))[_0x1f0e28(0x1cd)]()['toLowerCase']();if(_0x445d40!==_0x1f0e28(0x1c4)&&_0x445d40!=='database')throw appRuleError(_0x1f0e28(0x1cc),_0x1f0e28(0x1be));return _0x445d40;}export function appRuleFileName(_0x4079fa){return APP_RULE_FILES[_0x4079fa];}export function appRuleContextScope(_0x413e47){return APP_RULE_CONTEXT_SCOPES[_0x413e47];}export function inspectAppRuleContent(_0x5f002b){const _0x4d524d=a228_0x2b0de3,_0xb05865=Buffer['from'](_0x5f002b,'utf8');return{'content':_0x5f002b,'byteSize':_0xb05865[_0x4d524d(0x1d3)],'contentHash':'sha256:'+createHash(_0x4d524d(0x1ce))['update'](_0xb05865)[_0x4d524d(0x1c2)](_0x4d524d(0x1c0))};}export async function readAppRuleFile(_0x4afcf3){const _0x21d0b3=a228_0x2b0de3,_0x3cde58=_0x4afcf3['trim']();if(!_0x3cde58)throw appRuleError(_0x21d0b3(0x1d4),_0x21d0b3(0x1e3),_0x21d0b3(0x1d0));const _0x309b0b=resolve(_0x3cde58);let _0x150e21;try{_0x150e21=await stat(_0x309b0b);}catch(_0x1ee50e){throw appRuleError(_0x21d0b3(0x1c7),_0x21d0b3(0x1c3)+_0x3cde58,_0x1ee50e instanceof Error?_0x1ee50e[_0x21d0b3(0x1c1)]:String(_0x1ee50e));}if(!_0x150e21[_0x21d0b3(0x1e5)]())throw appRuleError(_0x21d0b3(0x1c9),'App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20'+_0x3cde58);if(_0x150e21[_0x21d0b3(0x1d7)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x21d0b3(0x1c8),_0x21d0b3(0x1bb));let _0x130194;try{_0x130194=await readFile(_0x309b0b);}catch(_0x2d41be){throw appRuleError(_0x21d0b3(0x1c7),_0x21d0b3(0x1e1)+_0x3cde58,_0x2d41be instanceof Error?_0x2d41be[_0x21d0b3(0x1c1)]:String(_0x2d41be));}if(_0x130194[_0x21d0b3(0x1d3)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x21d0b3(0x1c8),_0x21d0b3(0x1bb));let _0x4a5fe2;try{_0x4a5fe2=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})[_0x21d0b3(0x1df)](_0x130194);}catch{throw appRuleError(_0x21d0b3(0x1bd),'App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20'+_0x3cde58);}if(!_0x4a5fe2[_0x21d0b3(0x1cd)]())throw appRuleError(_0x21d0b3(0x1bd),_0x21d0b3(0x1c5)+_0x3cde58);return inspectAppRuleContent(_0x4a5fe2);}export function projectAppRule(_0x204532,_0x187eeb){const _0x311eb0=a228_0x2b0de3;if(!_0x187eeb)return{'type':_0x204532,'fileName':appRuleFileName(_0x204532),'contextScope':appRuleContextScope(_0x204532),'enabled':![]};const _0x2d5296=inspectAppRuleContent(_0x187eeb[_0x311eb0(0x1cb)]);return{'type':_0x204532,'fileName':appRuleFileName(_0x204532),'contextScope':appRuleContextScope(_0x204532),'enabled':!![],'id':_0x187eeb['id'],'scope':_0x187eeb[_0x311eb0(0x1da)],'appCode':_0x187eeb['appCode'],'version':_0x187eeb['version'],'contentByteSize':_0x2d5296[_0x311eb0(0x1d8)],'contentHash':_0x2d5296[_0x311eb0(0x1e4)],..._0x187eeb[_0x311eb0(0x1b9)]!==undefined&&_0x187eeb[_0x311eb0(0x1b9)]!==null?{'createTime':_0x187eeb['createTime']}:{},..._0x187eeb['updateTime']!==undefined&&_0x187eeb[_0x311eb0(0x1db)]!==null?{'updateTime':_0x187eeb[_0x311eb0(0x1db)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a228_0x2b0de3(0x1ca),'type':'string','required':!![],'description':a228_0x2b0de3(0x1c6),'enum':[...APP_RULE_TYPES]};
@@ -1 +1 @@
1
- const a229_0x4e0efd=a229_0x4858;(function(_0x447c4c,_0x46dc1e){const _0x1ec319=a229_0x4858,_0x1fd4aa=_0x447c4c();while(!![]){try{const _0x3ed4c1=parseInt(_0x1ec319(0x9a))/0x1*(-parseInt(_0x1ec319(0xad))/0x2)+-parseInt(_0x1ec319(0xb1))/0x3*(-parseInt(_0x1ec319(0x9f))/0x4)+-parseInt(_0x1ec319(0x75))/0x5+parseInt(_0x1ec319(0x8c))/0x6+-parseInt(_0x1ec319(0xa3))/0x7+-parseInt(_0x1ec319(0x93))/0x8*(parseInt(_0x1ec319(0x87))/0x9)+parseInt(_0x1ec319(0xaf))/0xa;if(_0x3ed4c1===_0x46dc1e)break;else _0x1fd4aa['push'](_0x1fd4aa['shift']());}catch(_0x5bc3e9){_0x1fd4aa['push'](_0x1fd4aa['shift']());}}}(a229_0x2080,0x7f565));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';function a229_0x2080(){const _0x1c2f36=['1868346SeyBLO','path','\x20run\x20preview','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','Domain\x20routing\x20synchronized:\x20','vite','inherit','328840CEFzmg','(none)','Enable\x20watch\x20mode\x20for\x20preview','\x20run\x20','\x20run\x20preview\x20--watch','all','.bin','1znXESF','build','error','write','changed','544772EnkItY','keys','\x20\x20EXAMPLES','close','3307304ryLFCA','\x0a\x20\x20Usage:\x20','Script\x20name\x20defined\x20in\x20package.json','args','--watch','push','needsUpgrade','slice','pnpm-lock.yaml','preview','647812cnLGCA','scripts','7274120Nnyhpg','vite\x20preview\x20exited\x20with\x20code\x20','21QaPmnh','script','No\x20scripts\x20defined\x20in\x20package.json.','\x20run\x20start','2343390vOMMQg','validation','boolean','Script\x20\x22','node_modules','utf-8','watch','dev','run','start','join','yarn.lock','Available:\x20','\x20\x20\x20\x20','log','belowMinimum','bun','\x20run\x20build','45IoXnFO','bun.lockb','npm','length','has'];a229_0x2080=function(){return _0x1c2f36;};return a229_0x2080();}import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';function a229_0x4858(_0x6dcc40,_0x1481ae){_0x6dcc40=_0x6dcc40-0x73;const _0x208006=a229_0x2080();let _0x485891=_0x208006[_0x6dcc40];return _0x485891;}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([a229_0x4e0efd(0x7e),a229_0x4e0efd(0x7c)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a229_0x4e0efd(0x7e),'dev',a229_0x4e0efd(0x9b),a229_0x4e0efd(0xac)]);export function syncProjectDomainRoutingBeforeScript(_0x51cb7b,_0x2ff3f5){const _0x369be7=a229_0x4e0efd;if(!DOMAIN_ROUTING_SYNC_SCRIPTS['has'](_0x2ff3f5))return null;const _0x253607=findProjectRootDirectory(_0x51cb7b);if(!resolveConfigPath(_0x253607))return null;const _0x11027a=writeProjectDomainRoutingManifest(_0x253607);return{'path':_0x11027a[_0x369be7(0x8d)],'changed':_0x11027a[_0x369be7(0x9e)]};}function readPackageScripts(_0x2bc9b6){const _0x3941d9=a229_0x4e0efd,_0x1709e8=resolve(_0x2bc9b6,'package.json');if(!existsSync(_0x1709e8))return null;try{const _0x577552=JSON['parse'](readFileSync(_0x1709e8,_0x3941d9(0x7a)));return _0x577552[_0x3941d9(0xae)]??{};}catch{return null;}}function detectPackageManager(_0x1179b7){const _0x403fd6=a229_0x4e0efd;if(existsSync(resolve(_0x1179b7,_0x403fd6(0x88)))||existsSync(resolve(_0x1179b7,'bun.lock')))return _0x403fd6(0x85);if(existsSync(resolve(_0x1179b7,_0x403fd6(0xab))))return'pnpm';if(existsSync(resolve(_0x1179b7,_0x403fd6(0x80))))return'yarn';return _0x403fd6(0x89);}async function versionCheck(_0xddf23c){const _0x5106ca=a229_0x4e0efd,_0x2fdf0f=await checkCliVersion();(_0x2fdf0f[_0x5106ca(0xa9)]||_0x2fdf0f[_0x5106ca(0x84)])&&(printCliUpgradeWarning(_0x2fdf0f),assertCliVersionSupported(_0x2fdf0f));const _0x181e19=await checkSdkVersion(_0xddf23c);if(_0x181e19[_0x5106ca(0xa9)])printSdkUpgradeWarning(_0x181e19);}function spawnScript(_0x239551,_0x2c08cc,_0x16fb25,_0x352c64){return new Promise((_0xcb1884,_0x39b447)=>{const _0x5afedc=a229_0x4858,_0x4a040c=[_0x5afedc(0x7d),_0x2c08cc,..._0x16fb25],_0x49a60f=spawn(_0x239551,_0x4a040c,{'cwd':_0x352c64,'stdio':_0x5afedc(0x92),'shell':!![],'env':{...process.env,'PATH':''+join(_0x352c64,_0x5afedc(0x79),'.bin')+delimiter+process.env.PATH}});_0x49a60f['on'](_0x5afedc(0xa2),_0x40e882=>{const _0x4aea2f=_0x5afedc;if(_0x40e882===0x0||_0x40e882===null)_0xcb1884();else _0x39b447(new Error(_0x239551+_0x4aea2f(0x96)+_0x2c08cc+'\x20exited\x20with\x20code\x20'+_0x40e882));}),_0x49a60f['on'](_0x5afedc(0x9c),_0x39b447);});}function spawnViteBuildWatch(_0x4bc71d){return new Promise((_0xcc8799,_0x14250d)=>{const _0x5aa18d=a229_0x4858,_0x4d1886=spawn(_0x5aa18d(0x91),[_0x5aa18d(0x9b),_0x5aa18d(0xa7)],{'cwd':_0x4bc71d,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x4bc71d,'node_modules',_0x5aa18d(0x99))+delimiter+process.env.PATH}});_0x4d1886['on'](_0x5aa18d(0xa2),_0x194c3c=>{const _0x2f062e=_0x5aa18d;if(_0x194c3c===0x0||_0x194c3c===null)_0xcc8799();else _0x14250d(new Error(_0x2f062e(0x8f)+_0x194c3c));}),_0x4d1886['on'](_0x5aa18d(0x9c),_0x14250d);});}function spawnVitePreview(_0x5c1ce6){return new Promise((_0x38cae1,_0x322785)=>{const _0x1fcdbe=a229_0x4858,_0x4389c0=spawn('vite',['preview'],{'cwd':_0x5c1ce6,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x5c1ce6,_0x1fcdbe(0x79),_0x1fcdbe(0x99))+delimiter+process.env.PATH}});_0x4389c0['on'](_0x1fcdbe(0xa2),_0x537e62=>{const _0x58e009=_0x1fcdbe;if(_0x537e62===0x0||_0x537e62===null)_0x38cae1();else _0x322785(new Error(_0x58e009(0xb0)+_0x537e62));}),_0x4389c0['on']('error',_0x322785);});}const runFlags=[{'name':a229_0x4e0efd(0x7b),'type':a229_0x4e0efd(0x77),'description':a229_0x4e0efd(0x95),'default':![]}];export const runDefinition={'service':a229_0x4e0efd(0x7d),'command':a229_0x4e0efd(0x7d),'description':'Run\x20a\x20package.json\x20script','risk':a229_0x4e0efd(0x9d),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a229_0x4e0efd(0xb2),'description':a229_0x4e0efd(0xa5),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x36659f=a229_0x4e0efd,_0x5a3a78=[];return _0x5a3a78[_0x36659f(0xa8)](_0x36659f(0xa1)),_0x5a3a78['push'](_0x36659f(0x82)+CLI_BIN_NAME+_0x36659f(0x74)),_0x5a3a78[_0x36659f(0xa8)](_0x36659f(0x82)+CLI_BIN_NAME+_0x36659f(0x86)),_0x5a3a78['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x36659f(0x8e)),_0x5a3a78['push'](_0x36659f(0x82)+CLI_BIN_NAME+_0x36659f(0x97)),_0x5a3a78[_0x36659f(0x7f)]('\x0a');},async 'execute'(_0x1129e0){const _0x52f3f7=a229_0x4e0efd,_0x505393=process['cwd'](),_0x1179e7=_0x1129e0[_0x52f3f7(0xa6)][0x0],_0x2472b9=_0x1129e0[_0x52f3f7(0xa6)][_0x52f3f7(0xaa)](0x1),_0x17ba39=readPackageScripts(_0x505393);if(!_0x17ba39)throw CliErrors[_0x52f3f7(0x76)]('No\x20package.json\x20found\x20in\x20current\x20directory.');if(!_0x1179e7){const _0x2a21ed=Object[_0x52f3f7(0xa0)](_0x17ba39);if(_0x2a21ed[_0x52f3f7(0x8a)]===0x0)console[_0x52f3f7(0x83)](_0x52f3f7(0x73));else{console[_0x52f3f7(0x83)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x599b13 of _0x2a21ed){console[_0x52f3f7(0x83)](_0x52f3f7(0x82)+_0x599b13);}console['log'](_0x52f3f7(0xa4)+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x17ba39[_0x1179e7])throw CliErrors[_0x52f3f7(0x76)](_0x52f3f7(0x78)+_0x1179e7+'\x22\x20not\x20found\x20in\x20package.json.',_0x52f3f7(0x81)+(Object[_0x52f3f7(0xa0)](_0x17ba39)[_0x52f3f7(0x7f)](',\x20')||_0x52f3f7(0x94)));const _0x70932f=detectPackageManager(_0x505393),_0x422d17=syncProjectDomainRoutingBeforeScript(_0x505393,_0x1179e7);_0x422d17?.[_0x52f3f7(0x9e)]&&console[_0x52f3f7(0x9c)](_0x52f3f7(0x90)+_0x422d17[_0x52f3f7(0x8d)]);VERSION_CHECK_SCRIPTS[_0x52f3f7(0x8b)](_0x1179e7)&&await versionCheck(_0x505393);if(_0x1179e7===_0x52f3f7(0xac)&&_0x1129e0['bool']('watch'))return await Promise[_0x52f3f7(0x98)]([spawnViteBuildWatch(_0x505393),spawnVitePreview(_0x505393)]),{'ok':!![]};return await spawnScript(_0x70932f,_0x1179e7,_0x2472b9,_0x505393),{'ok':!![]};}};
1
+ const a229_0x2befb2=a229_0x1fee;(function(_0x248191,_0x2ca75a){const _0x44aa82=a229_0x1fee,_0xa9e215=_0x248191();while(!![]){try{const _0x28a257=-parseInt(_0x44aa82(0x10f))/0x1*(parseInt(_0x44aa82(0x109))/0x2)+parseInt(_0x44aa82(0x128))/0x3+parseInt(_0x44aa82(0xf8))/0x4*(parseInt(_0x44aa82(0x118))/0x5)+-parseInt(_0x44aa82(0xfb))/0x6*(-parseInt(_0x44aa82(0x10c))/0x7)+-parseInt(_0x44aa82(0x127))/0x8+-parseInt(_0x44aa82(0x116))/0x9*(parseInt(_0x44aa82(0x103))/0xa)+parseInt(_0x44aa82(0x122))/0xb*(parseInt(_0x44aa82(0x12d))/0xc);if(_0x28a257===_0x2ca75a)break;else _0xa9e215['push'](_0xa9e215['shift']());}catch(_0x10990d){_0xa9e215['push'](_0xa9e215['shift']());}}}(a229_0x3290,0x3e254));import{readFileSync,existsSync}from'node:fs';function a229_0x3290(){const _0xaba5f1=['start','\x20run\x20preview','\x20\x20\x20\x20','\x0a\x20\x20Usage:\x20','No\x20package.json\x20found\x20in\x20current\x20directory.','76ikXwHx','keys','join','1145543ldTZOn','.bin','pnpm','3401WzHiXx','push','Enable\x20watch\x20mode\x20for\x20preview','\x22\x20not\x20found\x20in\x20package.json.','\x20run\x20build','(none)','\x20run\x20start','4198239DslbUM','write','451135CNsvaA','args','yarn','vite','changed','close','inherit','bun.lock','script','bool','7799rYIyVM','yarn.lock','watch','\x20\x20EXAMPLES','needsUpgrade','2947080nHZLDa','1518600sbdakE','slice','vite\x20preview\x20exited\x20with\x20code\x20','preview','\x20run\x20<script>\x0a','3180yRIxfO','Script\x20name\x20defined\x20in\x20package.json','dev','package.json','Domain\x20routing\x20synchronized:\x20','all','has','build','path','node_modules','error','16hTGOZk','Script\x20\x22','--watch','6mwmdfK','validation','length','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','No\x20scripts\x20defined\x20in\x20package.json.','bun.lockb','log','cwd','10mMvpxl'];a229_0x3290=function(){return _0xaba5f1;};return a229_0x3290();}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',a229_0x2befb2(0x12f)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a229_0x2befb2(0x104),'dev',a229_0x2befb2(0xf4),a229_0x2befb2(0x12b)]);export function syncProjectDomainRoutingBeforeScript(_0x105591,_0xd70509){const _0x57f348=a229_0x2befb2;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x57f348(0xf3)](_0xd70509))return null;const _0x554a89=findProjectRootDirectory(_0x105591);if(!resolveConfigPath(_0x554a89))return null;const _0x40f0f8=writeProjectDomainRoutingManifest(_0x554a89);return{'path':_0x40f0f8[_0x57f348(0xf5)],'changed':_0x40f0f8[_0x57f348(0x11c)]};}function readPackageScripts(_0x1f5d2a){const _0x387d5e=a229_0x2befb2,_0x28274b=resolve(_0x1f5d2a,_0x387d5e(0x130));if(!existsSync(_0x28274b))return null;try{const _0x34167e=JSON['parse'](readFileSync(_0x28274b,'utf-8'));return _0x34167e['scripts']??{};}catch{return null;}}function detectPackageManager(_0x5b71f4){const _0x52f465=a229_0x2befb2;if(existsSync(resolve(_0x5b71f4,_0x52f465(0x100)))||existsSync(resolve(_0x5b71f4,_0x52f465(0x11f))))return'bun';if(existsSync(resolve(_0x5b71f4,'pnpm-lock.yaml')))return _0x52f465(0x10e);if(existsSync(resolve(_0x5b71f4,_0x52f465(0x123))))return _0x52f465(0x11a);return'npm';}async function versionCheck(_0x9cbe18){const _0x4ab04c=a229_0x2befb2,_0x23a4f1=await checkCliVersion();(_0x23a4f1[_0x4ab04c(0x126)]||_0x23a4f1['belowMinimum'])&&(printCliUpgradeWarning(_0x23a4f1),assertCliVersionSupported(_0x23a4f1));const _0x2b35a4=await checkSdkVersion(_0x9cbe18);if(_0x2b35a4[_0x4ab04c(0x126)])printSdkUpgradeWarning(_0x2b35a4);}function spawnScript(_0x3bf5e5,_0x27191f,_0x1f0156,_0x2bdacd){return new Promise((_0x13b7a9,_0x2988ea)=>{const _0xf8015e=a229_0x1fee,_0x250612=['run',_0x27191f,..._0x1f0156],_0x5a9400=spawn(_0x3bf5e5,_0x250612,{'cwd':_0x2bdacd,'stdio':_0xf8015e(0x11e),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2bdacd,_0xf8015e(0xf6),_0xf8015e(0x10d))+delimiter+process.env.PATH}});_0x5a9400['on'](_0xf8015e(0x11d),_0x20f652=>{if(_0x20f652===0x0||_0x20f652===null)_0x13b7a9();else _0x2988ea(new Error(_0x3bf5e5+'\x20run\x20'+_0x27191f+'\x20exited\x20with\x20code\x20'+_0x20f652));}),_0x5a9400['on']('error',_0x2988ea);});}function a229_0x1fee(_0x32441b,_0x1e3c20){_0x32441b=_0x32441b-0xf1;const _0x3290e5=a229_0x3290();let _0x1feedb=_0x3290e5[_0x32441b];return _0x1feedb;}function spawnViteBuildWatch(_0x247181){return new Promise((_0x1098ca,_0x5344c3)=>{const _0x85cdd8=a229_0x1fee,_0x26eb6c=spawn(_0x85cdd8(0x11b),[_0x85cdd8(0xf4),_0x85cdd8(0xfa)],{'cwd':_0x247181,'stdio':_0x85cdd8(0x11e),'shell':!![],'env':{...process.env,'PATH':''+join(_0x247181,_0x85cdd8(0xf6),_0x85cdd8(0x10d))+delimiter+process.env.PATH}});_0x26eb6c['on']('close',_0x21df38=>{const _0x9e1c8f=_0x85cdd8;if(_0x21df38===0x0||_0x21df38===null)_0x1098ca();else _0x5344c3(new Error(_0x9e1c8f(0xfe)+_0x21df38));}),_0x26eb6c['on'](_0x85cdd8(0xf7),_0x5344c3);});}function spawnVitePreview(_0x864129){return new Promise((_0x5a482f,_0x4a738c)=>{const _0x36f104=a229_0x1fee,_0x5a2d1c=spawn(_0x36f104(0x11b),['preview'],{'cwd':_0x864129,'stdio':_0x36f104(0x11e),'shell':!![],'env':{...process.env,'PATH':''+join(_0x864129,_0x36f104(0xf6),'.bin')+delimiter+process.env.PATH}});_0x5a2d1c['on'](_0x36f104(0x11d),_0x515606=>{const _0x563eeb=_0x36f104;if(_0x515606===0x0||_0x515606===null)_0x5a482f();else _0x4a738c(new Error(_0x563eeb(0x12a)+_0x515606));}),_0x5a2d1c['on']('error',_0x4a738c);});}const runFlags=[{'name':'watch','type':'boolean','description':a229_0x2befb2(0x111),'default':![]}];export const runDefinition={'service':'run','command':'run','description':'Run\x20a\x20package.json\x20script','risk':a229_0x2befb2(0x117),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a229_0x2befb2(0x120),'description':a229_0x2befb2(0x12e),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x1936f8=a229_0x2befb2,_0x367bb1=[];return _0x367bb1['push'](_0x1936f8(0x125)),_0x367bb1['push'](_0x1936f8(0x106)+CLI_BIN_NAME+_0x1936f8(0x115)),_0x367bb1['push'](_0x1936f8(0x106)+CLI_BIN_NAME+_0x1936f8(0x113)),_0x367bb1[_0x1936f8(0x110)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x1936f8(0x105)),_0x367bb1[_0x1936f8(0x110)](_0x1936f8(0x106)+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x367bb1[_0x1936f8(0x10b)]('\x0a');},async 'execute'(_0x230290){const _0x4d3f20=a229_0x2befb2,_0x1f0e36=process[_0x4d3f20(0x102)](),_0x3366d3=_0x230290[_0x4d3f20(0x119)][0x0],_0x14c23b=_0x230290[_0x4d3f20(0x119)][_0x4d3f20(0x129)](0x1),_0x20cba5=readPackageScripts(_0x1f0e36);if(!_0x20cba5)throw CliErrors[_0x4d3f20(0xfc)](_0x4d3f20(0x108));if(!_0x3366d3){const _0x48ec85=Object[_0x4d3f20(0x10a)](_0x20cba5);if(_0x48ec85[_0x4d3f20(0xfd)]===0x0)console[_0x4d3f20(0x101)](_0x4d3f20(0xff));else{console['log']('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x33d507 of _0x48ec85){console['log'](_0x4d3f20(0x106)+_0x33d507);}console[_0x4d3f20(0x101)](_0x4d3f20(0x107)+CLI_BIN_NAME+_0x4d3f20(0x12c));}return{'ok':!![]};}if(!_0x20cba5[_0x3366d3])throw CliErrors['validation'](_0x4d3f20(0xf9)+_0x3366d3+_0x4d3f20(0x112),'Available:\x20'+(Object[_0x4d3f20(0x10a)](_0x20cba5)[_0x4d3f20(0x10b)](',\x20')||_0x4d3f20(0x114)));const _0x12d331=detectPackageManager(_0x1f0e36),_0x425011=syncProjectDomainRoutingBeforeScript(_0x1f0e36,_0x3366d3);_0x425011?.[_0x4d3f20(0x11c)]&&console['error'](_0x4d3f20(0xf1)+_0x425011[_0x4d3f20(0xf5)]);VERSION_CHECK_SCRIPTS[_0x4d3f20(0xf3)](_0x3366d3)&&await versionCheck(_0x1f0e36);if(_0x3366d3===_0x4d3f20(0x12b)&&_0x230290[_0x4d3f20(0x121)](_0x4d3f20(0x124)))return await Promise[_0x4d3f20(0xf2)]([spawnViteBuildWatch(_0x1f0e36),spawnVitePreview(_0x1f0e36)]),{'ok':!![]};return await spawnScript(_0x12d331,_0x3366d3,_0x14c23b,_0x1f0e36),{'ok':!![]};}};
@@ -1 +1 @@
1
- const a230_0x212bbb=a230_0x1e7c;(function(_0x2939e0,_0x320d32){const _0x189594=a230_0x1e7c,_0x460b11=_0x2939e0();while(!![]){try{const _0x6fe25e=parseInt(_0x189594(0x1fe))/0x1+parseInt(_0x189594(0x1f7))/0x2+parseInt(_0x189594(0x1f4))/0x3*(-parseInt(_0x189594(0x1fa))/0x4)+parseInt(_0x189594(0x1fb))/0x5+parseInt(_0x189594(0x1f5))/0x6+-parseInt(_0x189594(0x1fd))/0x7*(-parseInt(_0x189594(0x1f8))/0x8)+-parseInt(_0x189594(0x1fc))/0x9;if(_0x6fe25e===_0x320d32)break;else _0x460b11['push'](_0x460b11['shift']());}catch(_0x3d309f){_0x460b11['push'](_0x460b11['shift']());}}}(a230_0xc5ac,0x891da));function a230_0xc5ac(){const _0x530dc8=['export','read','253686dcCtVo','1443798TMkhyg','schema','1118608hilXFz','536enQRgJ','Export\x20machine-readable\x20command\x20schema\x20(JSON)','24Ledvdi','5267590qzuJKa','18566838ugjzcE','55972zpKfgU','742793blFfhO'];a230_0xc5ac=function(){return _0x530dc8;};return a230_0xc5ac();}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x3473a5){const _0x7273a5=await buildSchemaPayload();return{'ok':!![],'data':_0x7273a5};}function a230_0x1e7c(_0x3eb800,_0x3e2b16){_0x3eb800=_0x3eb800-0x1f2;const _0xc5acf5=a230_0xc5ac();let _0x1e7ca4=_0xc5acf5[_0x3eb800];return _0x1e7ca4;}export const schemaDefinition={'service':a230_0x212bbb(0x1f6),'command':a230_0x212bbb(0x1f2),'description':a230_0x212bbb(0x1f9),'risk':a230_0x212bbb(0x1f3),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
1
+ function a230_0x15b2(){const _0x4813c1=['246iOiTOp','schema','read','1017696xuxtYr','Export\x20machine-readable\x20command\x20schema\x20(JSON)','18jutunQ','39837YdZXBk','83312jWVuLX','416666qdOouP','10026540gtBqfn','export','4176mwODDL','json','402395dIHbIz'];a230_0x15b2=function(){return _0x4813c1;};return a230_0x15b2();}const a230_0x4c86da=a230_0x24ae;function a230_0x24ae(_0x4d28ee,_0x1bc4d4){_0x4d28ee=_0x4d28ee-0xa5;const _0x15b2be=a230_0x15b2();let _0x24ae6c=_0x15b2be[_0x4d28ee];return _0x24ae6c;}(function(_0x25deec,_0x268cd0){const _0x2fedc3=a230_0x24ae,_0x426c52=_0x25deec();while(!![]){try{const _0x185f69=-parseInt(_0x2fedc3(0xa6))/0x1+-parseInt(_0x2fedc3(0xa9))/0x2*(parseInt(_0x2fedc3(0xb1))/0x3)+-parseInt(_0x2fedc3(0xa5))/0x4+-parseInt(_0x2fedc3(0xab))/0x5+-parseInt(_0x2fedc3(0xac))/0x6*(parseInt(_0x2fedc3(0xb2))/0x7)+-parseInt(_0x2fedc3(0xaf))/0x8+parseInt(_0x2fedc3(0xa7))/0x9;if(_0x185f69===_0x268cd0)break;else _0x426c52['push'](_0x426c52['shift']());}catch(_0x471946){_0x426c52['push'](_0x426c52['shift']());}}}(a230_0x15b2,0x36728));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x5daec2){const _0x514f8c=await buildSchemaPayload();return{'ok':!![],'data':_0x514f8c};}export const schemaDefinition={'service':a230_0x4c86da(0xad),'command':a230_0x4c86da(0xa8),'description':a230_0x4c86da(0xb0),'risk':a230_0x4c86da(0xae),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a230_0x4c86da(0xaa),'flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a231_0x19d3f4=a231_0x4930;(function(_0x27f3c2,_0x1c4d8c){const _0x6496c0=a231_0x4930,_0x2dbc36=_0x27f3c2();while(!![]){try{const _0x2996b6=-parseInt(_0x6496c0(0x146))/0x1*(parseInt(_0x6496c0(0x13b))/0x2)+-parseInt(_0x6496c0(0x16f))/0x3*(-parseInt(_0x6496c0(0x16c))/0x4)+parseInt(_0x6496c0(0x168))/0x5+-parseInt(_0x6496c0(0x16b))/0x6+-parseInt(_0x6496c0(0x152))/0x7+parseInt(_0x6496c0(0x14c))/0x8*(parseInt(_0x6496c0(0x12a))/0x9)+-parseInt(_0x6496c0(0x131))/0xa;if(_0x2996b6===_0x1c4d8c)break;else _0x2dbc36['push'](_0x2dbc36['shift']());}catch(_0xce87da){_0x2dbc36['push'](_0x2dbc36['shift']());}}}(a231_0x3a3c,0x62fab));function a231_0x4930(_0x3c9b80,_0x3d62c6){_0x3c9b80=_0x3c9b80-0x12a;const _0x3a3cdc=a231_0x3a3c();let _0x4930ad=_0x3a3cdc[_0x3c9b80];return _0x4930ad;}import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';function a231_0x3a3c(){const _0x32c4eb=['sqlRoot','3HJPbhJ','279HeXPxo','sqls','flag','trim','__manual__','dbId\x20must\x20be\x20a\x20positive\x20integer','map','4014680okNpdi','dbId','POST','length','stringify','sqlName','db-id','lastSync','dbName','sql','255698trtAhx','flagMissing','create','nonInteractive','Select\x20the\x20local\x20SQL\x20mode:','lockFilePath','new','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','description','SQL\x20query\x20display\x20name','validation','1mAxeux','✎\x20Enter\x20dbId\x20manually','isFinite','sqlRootDir','Plain\x20SQL\x20(sql)','SQL\x20name:','185096IuZAXb','Invalid\x20database\x20selection\x20payload:\x20','parse','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','catch','utf8','4009166ngTMfr','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','str','write','mode','Select\x20the\x20target\x20database:','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','toISOString','<server-generated-sqlCode>','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','number','sqlCode','string','name','Target\x20database\x20dbId:','mybatisXml','/smartapi/custom/saveUserCustomSql','\x20\x20SELECT\x201\x20AS\x20id','SQL\x20name\x20cannot\x20be\x20empty','appCode','Created\x20SQL\x20query\x20','join','3575250ObRrvM','Local\x20SQL\x20file\x20mode','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','3515976xWGkoJ','2644692mFaohc','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'];a231_0x3a3c=function(){return _0x32c4eb;};return a231_0x3a3c();}import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x78702b){const _0x1566e9=a231_0x4930;if(_0x78702b===_0x1566e9(0x161))return[_0x1566e9(0x142),_0x1566e9(0x163),'</select>',''][_0x1566e9(0x167)]('\x0a');return['SELECT\x201\x20AS\x20id;','']['join']('\x0a');}export const sqlCreate={'service':'sql','command':a231_0x19d3f4(0x13d),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a231_0x19d3f4(0x155),'flags':[{'name':a231_0x19d3f4(0x15f),'type':a231_0x19d3f4(0x15e),'description':a231_0x19d3f4(0x144)},{'name':a231_0x19d3f4(0x137),'type':a231_0x19d3f4(0x15c),'description':'Target\x20database\x20ID'},{'name':a231_0x19d3f4(0x156),'type':a231_0x19d3f4(0x15e),'enum':[a231_0x19d3f4(0x13a),a231_0x19d3f4(0x161)],'description':a231_0x19d3f4(0x169)}],async 'validate'(_0x801334){const _0x293e8f=a231_0x19d3f4;if(!_0x801334[_0x293e8f(0x13e)])return;if(!_0x801334['str']('name')[_0x293e8f(0x12d)]())throw CliErrors[_0x293e8f(0x13c)](_0x293e8f(0x15f),_0x293e8f(0x158));const _0x2ec3e0=resolveProvidedDbId(_0x801334);if(typeof _0x2ec3e0!==_0x293e8f(0x15c)||!Number[_0x293e8f(0x148)](_0x2ec3e0)||_0x2ec3e0<=0x0)throw CliErrors[_0x293e8f(0x13c)]('db-id',_0x293e8f(0x14f));if(!_0x801334['str'](_0x293e8f(0x156))['trim']())throw CliErrors[_0x293e8f(0x13c)](_0x293e8f(0x156),_0x293e8f(0x153));},async 'dryRun'(_0x1f819a){const _0x5c2867=a231_0x19d3f4,_0x34d3a3=loadSqlProjectConfig(_0x1f819a[_0x5c2867(0x165)]),{sqlName:_0x3dc8b5,dbId:_0x185cce,dbName:_0x2bca30,mode:_0x299e6c}=await resolveSqlNewInputs(_0x1f819a),_0x5ac327=buildSqlRelativePath(_0x5c2867(0x15a),_0x3dc8b5,_0x2bca30,_0x299e6c,_0x185cce),_0x4d2ef3=_0x34d3a3[_0x5c2867(0x149)]+'/'+_0x5ac327;return{'method':_0x5c2867(0x133),'url':_0x5c2867(0x162),'body':{'appCode':_0x1f819a[_0x5c2867(0x165)],'sqlName':_0x3dc8b5,'dbId':_0x185cce,'mode':_0x299e6c,'localPath':_0x4d2ef3},'description':_0x5c2867(0x16d)+_0x34d3a3[_0x5c2867(0x149)]};},async 'execute'(_0x2e7b92){const _0x5645a8=a231_0x19d3f4,_0xb43a4b=loadSqlProjectConfig(_0x2e7b92[_0x5645a8(0x165)]),{sqlName:_0x33e2b3,dbId:_0x1ae2e5,dbName:_0x316ea8,mode:_0x55c84e}=await resolveSqlNewInputs(_0x2e7b92),_0xfeacbd=generateSqlTemplate(_0x55c84e),_0x5e87f6=await createSqlQuery({'appCode':_0x2e7b92['appCode'],'sqlName':_0x33e2b3,'dbId':_0x1ae2e5,'sqlContent':_0xfeacbd}),_0x4e5033=ensureRemoteSqlContent(_0x5e87f6),_0x267156=_0x316ea8||await getDbName(_0x2e7b92[_0x5645a8(0x165)],_0x1ae2e5)['catch'](()=>undefined),_0x4813f0=buildSqlRelativePath(_0x5e87f6['sqlCode'],_0x5e87f6[_0x5645a8(0x136)],_0x267156,_0x55c84e,_0x1ae2e5),_0x31b1d4=_0xb43a4b[_0x5645a8(0x149)]+'/'+_0x4813f0,_0x414fc=buildLocalSqlFileContent({'sqlCode':_0x5e87f6[_0x5645a8(0x15d)],'sqlName':_0x5e87f6[_0x5645a8(0x136)],'dbId':_0x5e87f6[_0x5645a8(0x132)]},_0x4e5033,{'dbName':_0x267156,'mode':_0x55c84e,'syncedAt':new Date()[_0x5645a8(0x159)](),'description':_0x5e87f6[_0x5645a8(0x143)]});if(await fileExists(_0x31b1d4))throw CliErrors[_0x5645a8(0x145)]('File\x20already\x20exists:\x20'+_0x31b1d4);await ensureParentDirectory(_0x31b1d4),await writeFile(_0x31b1d4,_0x414fc,_0x5645a8(0x151));const _0x478b84=await readSqlLockFile(_0xb43a4b[_0x5645a8(0x140)]),{lockData:_0x19ec7f,appLock:_0x4f8917}=ensureSqlLockScope(_0x478b84??createEmptySqlLock(),_0xb43a4b['appCode'],_0xb43a4b[_0x5645a8(0x16e)],_0x5645a8(0x141));return _0x4f8917[_0x5645a8(0x12b)][_0x5e87f6[_0x5645a8(0x15d)]]={...buildSqlLockEntry(_0x5e87f6,_0x4e5033,computeSqlContentHash(_0x414fc),{'dbName':_0x267156}),'path':_0x4813f0,'mode':_0x55c84e},_0x4f8917[_0x5645a8(0x138)]=new Date()[_0x5645a8(0x159)](),await writeSqlLockFile(_0xb43a4b[_0x5645a8(0x140)],_0x19ec7f),{'ok':!![],'data':{'id':_0x5e87f6['id'],'sqlCode':_0x5e87f6[_0x5645a8(0x15d)],'sqlName':_0x5e87f6[_0x5645a8(0x136)],'dbId':_0x5e87f6[_0x5645a8(0x132)],'path':_0x31b1d4,'mode':_0x55c84e},'message':_0x5645a8(0x166)+_0x5e87f6[_0x5645a8(0x15d)]};}};async function resolveSqlNewInputs(_0x49f14e){const _0x429e80=await resolveSqlNameInput(_0x49f14e),{dbId:_0x3f6e93,dbName:_0x258502}=await resolveDbSelection(_0x49f14e),_0x20801a=await resolveSqlModeInput(_0x49f14e);return{'sqlName':_0x429e80,'dbId':_0x3f6e93,'dbName':_0x258502,'mode':_0x20801a};}async function resolveSqlNameInput(_0x53eaf7){const _0x282bb1=a231_0x19d3f4,_0x293075=_0x53eaf7[_0x282bb1(0x154)](_0x282bb1(0x15f))[_0x282bb1(0x12d)]();if(_0x293075)return _0x293075;if(_0x53eaf7['nonInteractive'])throw CliErrors[_0x282bb1(0x13c)](_0x282bb1(0x15f),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x282bb1(0x14b),'validate':_0x2ea4ae=>_0x2ea4ae[_0x282bb1(0x12d)]()?!![]:_0x282bb1(0x164)}))['trim']();}async function resolveDbSelection(_0x3b9c5f){const _0x3adf8c=a231_0x19d3f4,_0x3b1d22=resolveProvidedDbId(_0x3b9c5f);if(typeof _0x3b1d22===_0x3adf8c(0x15c)&&Number[_0x3adf8c(0x148)](_0x3b1d22)&&_0x3b1d22>0x0)return{'dbId':_0x3b1d22,'dbName':await getDbName(_0x3b9c5f[_0x3adf8c(0x165)],_0x3b1d22)[_0x3adf8c(0x150)](()=>undefined)};if(_0x3b9c5f[_0x3adf8c(0x13e)])throw CliErrors['flagMissing'](_0x3adf8c(0x137),_0x3adf8c(0x14f));const _0x57f5f4=await listDatabases(_0x3b9c5f[_0x3adf8c(0x165)])[_0x3adf8c(0x150)](()=>[]);if(_0x57f5f4[_0x3adf8c(0x134)]===0x1)return{'dbId':_0x57f5f4[0x0][_0x3adf8c(0x132)],'dbName':_0x57f5f4[0x0][_0x3adf8c(0x139)]};if(_0x57f5f4['length']>0x1){const _0x2cd340=await select({'message':_0x3adf8c(0x157),'choices':[..._0x57f5f4[_0x3adf8c(0x130)](_0x319a99=>({'name':_0x319a99['dbName']+'\x20('+_0x319a99[_0x3adf8c(0x132)]+')','value':serializeDbSelection(_0x319a99)})),{'name':_0x3adf8c(0x147),'value':_0x3adf8c(0x12e)}]});if(_0x2cd340!==_0x3adf8c(0x12e))return deserializeDbSelection(_0x2cd340);}const _0x154f81=await input({'message':_0x3adf8c(0x160),'validate':_0x27b8c9=>{const _0x1877a9=_0x3adf8c,_0x4be659=_0x27b8c9['trim']();if(!_0x4be659)return'dbId\x20cannot\x20be\x20empty';const _0x14d6e8=Number(_0x4be659);if(!Number['isInteger'](_0x14d6e8)||_0x14d6e8<=0x0)return _0x1877a9(0x12f);return!![];}});return{'dbId':Number(_0x154f81[_0x3adf8c(0x12d)]())};}async function resolveSqlModeInput(_0x83f374){const _0x2c8cb4=a231_0x19d3f4,_0x3022cb=_0x83f374[_0x2c8cb4(0x154)](_0x2c8cb4(0x156))[_0x2c8cb4(0x12d)]();if(_0x3022cb===_0x2c8cb4(0x13a)||_0x3022cb===_0x2c8cb4(0x161))return _0x3022cb;if(_0x83f374['nonInteractive'])throw CliErrors[_0x2c8cb4(0x13c)](_0x2c8cb4(0x156),_0x2c8cb4(0x153));return await select({'message':_0x2c8cb4(0x13f),'choices':[{'name':_0x2c8cb4(0x14a),'value':_0x2c8cb4(0x13a),'description':_0x2c8cb4(0x16a)},{'name':'MyBatis\x20XML\x20(mybatisXml)','value':_0x2c8cb4(0x161),'description':_0x2c8cb4(0x15b)}]});}function serializeDbSelection(_0x2424f4){const _0x4bd516=a231_0x19d3f4;return JSON[_0x4bd516(0x135)]({'dbId':_0x2424f4['dbId'],'dbName':_0x2424f4[_0x4bd516(0x139)]});}function deserializeDbSelection(_0x2dba8e){const _0x40eee9=a231_0x19d3f4;try{const _0x1e068a=JSON[_0x40eee9(0x14e)](_0x2dba8e);if(typeof _0x1e068a[_0x40eee9(0x132)]===_0x40eee9(0x15c)&&Number['isFinite'](_0x1e068a[_0x40eee9(0x132)]))return{'dbId':_0x1e068a[_0x40eee9(0x132)],'dbName':_0x1e068a[_0x40eee9(0x139)]};}catch{}throw CliErrors[_0x40eee9(0x145)](_0x40eee9(0x14d)+_0x2dba8e);}function resolveProvidedDbId(_0x2f3556){const _0x44eb97=a231_0x19d3f4,_0x3b3882=_0x2f3556[_0x44eb97(0x12c)]('db-id');if(typeof _0x3b3882==='number'&&Number['isFinite'](_0x3b3882))return _0x3b3882;return undefined;}
1
+ const a231_0x4f1731=a231_0x5c3d;(function(_0x57e357,_0x598747){const _0x4f3cf8=a231_0x5c3d,_0xf0e670=_0x57e357();while(!![]){try{const _0x4312d0=-parseInt(_0x4f3cf8(0x1b5))/0x1+parseInt(_0x4f3cf8(0x1c3))/0x2*(-parseInt(_0x4f3cf8(0x1d4))/0x3)+-parseInt(_0x4f3cf8(0x1b8))/0x4+-parseInt(_0x4f3cf8(0x1cb))/0x5*(-parseInt(_0x4f3cf8(0x1e3))/0x6)+parseInt(_0x4f3cf8(0x1d7))/0x7+-parseInt(_0x4f3cf8(0x1c1))/0x8+-parseInt(_0x4f3cf8(0x1bf))/0x9*(-parseInt(_0x4f3cf8(0x1b4))/0xa);if(_0x4312d0===_0x598747)break;else _0xf0e670['push'](_0xf0e670['shift']());}catch(_0x505885){_0xf0e670['push'](_0xf0e670['shift']());}}}(a231_0xe1fa,0xae1e2));function a231_0x5c3d(_0x5e7c3a,_0x29c773){_0x5e7c3a=_0x5e7c3a-0x1b4;const _0xe1fa47=a231_0xe1fa();let _0x5c3db4=_0xe1fa47[_0x5e7c3a];return _0x5c3db4;}import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';function a231_0xe1fa(){const _0x40fd6d=['Target\x20database\x20dbId:','10tTkuKX','132349GKHkFe','description','utf8','3939068xtGPkm','join','number','lockFilePath','MyBatis\x20XML\x20(mybatisXml)','sqlCode','</select>','21321684azQKUv','mybatisXml','9569064qJffxU','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','2682aVtufQ','str','mode','Select\x20the\x20target\x20database:','flag','appCode','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','167630LDfeaq','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','catch','dbId\x20cannot\x20be\x20empty','sql','__manual__','Invalid\x20database\x20selection\x20payload:\x20','lastSync','✎\x20Enter\x20dbId\x20manually','597TzQQfX','sqlRootDir','flagMissing','4122706XsjrLb','nonInteractive','SELECT\x201\x20AS\x20id;','Created\x20SQL\x20query\x20','Select\x20the\x20local\x20SQL\x20mode:','dbId','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','dbName','isFinite','name','parse','dbId\x20must\x20be\x20a\x20positive\x20integer','60GIqNkw','db-id','toISOString','SQL\x20query\x20display\x20name','sqls','SQL\x20name\x20cannot\x20be\x20empty','trim','validation','length','sqlName','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20name:','stringify','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','/smartapi/custom/saveUserCustomSql','create','map','File\x20already\x20exists:\x20','\x20\x20SELECT\x201\x20AS\x20id','string','Local\x20SQL\x20file\x20mode','<server-generated-sqlCode>','new'];a231_0xe1fa=function(){return _0x40fd6d;};return a231_0xe1fa();}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(_0x4b15d4){const _0x3ba3c4=a231_0x5c3d;if(_0x4b15d4==='mybatisXml')return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x3ba3c4(0x1f5),_0x3ba3c4(0x1be),''][_0x3ba3c4(0x1b9)]('\x0a');return[_0x3ba3c4(0x1d9),'']['join']('\x0a');}export const sqlCreate={'service':a231_0x4f1731(0x1cf),'command':a231_0x4f1731(0x1f2),'description':a231_0x4f1731(0x1f0),'risk':'write','flags':[{'name':a231_0x4f1731(0x1e0),'type':a231_0x4f1731(0x1f6),'description':a231_0x4f1731(0x1e6)},{'name':a231_0x4f1731(0x1e4),'type':a231_0x4f1731(0x1ba),'description':'Target\x20database\x20ID'},{'name':a231_0x4f1731(0x1c5),'type':a231_0x4f1731(0x1f6),'enum':[a231_0x4f1731(0x1cf),a231_0x4f1731(0x1c0)],'description':a231_0x4f1731(0x1f7)}],async 'validate'(_0x179548){const _0x4b6298=a231_0x4f1731;if(!_0x179548[_0x4b6298(0x1d8)])return;if(!_0x179548[_0x4b6298(0x1c4)](_0x4b6298(0x1e0))['trim']())throw CliErrors[_0x4b6298(0x1d6)]('name',_0x4b6298(0x1c2));const _0x56cd43=resolveProvidedDbId(_0x179548);if(typeof _0x56cd43!=='number'||!Number[_0x4b6298(0x1df)](_0x56cd43)||_0x56cd43<=0x0)throw CliErrors['flagMissing'](_0x4b6298(0x1e4),_0x4b6298(0x1ed));if(!_0x179548[_0x4b6298(0x1c4)](_0x4b6298(0x1c5))[_0x4b6298(0x1e9)]())throw CliErrors['flagMissing'](_0x4b6298(0x1c5),_0x4b6298(0x1dd));},async 'dryRun'(_0x1ee81a){const _0x4a8044=a231_0x4f1731,_0x19a986=loadSqlProjectConfig(_0x1ee81a['appCode']),{sqlName:_0x5ef700,dbId:_0x7be79c,dbName:_0x34e574,mode:_0x42530c}=await resolveSqlNewInputs(_0x1ee81a),_0x2405c1=buildSqlRelativePath(_0x4a8044(0x1f8),_0x5ef700,_0x34e574,_0x42530c,_0x7be79c),_0x2c54ab=_0x19a986[_0x4a8044(0x1d5)]+'/'+_0x2405c1;return{'method':'POST','url':_0x4a8044(0x1f1),'body':{'appCode':_0x1ee81a['appCode'],'sqlName':_0x5ef700,'dbId':_0x7be79c,'mode':_0x42530c,'localPath':_0x2c54ab},'description':_0x4a8044(0x1cc)+_0x19a986[_0x4a8044(0x1d5)]};},async 'execute'(_0x408855){const _0x561af0=a231_0x4f1731,_0x80309d=loadSqlProjectConfig(_0x408855[_0x561af0(0x1c8)]),{sqlName:_0x12cc50,dbId:_0x48ba3c,dbName:_0x436bb5,mode:_0x3e1943}=await resolveSqlNewInputs(_0x408855),_0x12bb60=generateSqlTemplate(_0x3e1943),_0x458d39=await createSqlQuery({'appCode':_0x408855[_0x561af0(0x1c8)],'sqlName':_0x12cc50,'dbId':_0x48ba3c,'sqlContent':_0x12bb60}),_0x3ec416=ensureRemoteSqlContent(_0x458d39),_0x324de7=_0x436bb5||await getDbName(_0x408855['appCode'],_0x48ba3c)['catch'](()=>undefined),_0x369f45=buildSqlRelativePath(_0x458d39[_0x561af0(0x1bd)],_0x458d39['sqlName'],_0x324de7,_0x3e1943,_0x48ba3c),_0x37d93f=_0x80309d[_0x561af0(0x1d5)]+'/'+_0x369f45,_0x1f07a8=buildLocalSqlFileContent({'sqlCode':_0x458d39['sqlCode'],'sqlName':_0x458d39[_0x561af0(0x1ec)],'dbId':_0x458d39[_0x561af0(0x1dc)]},_0x3ec416,{'dbName':_0x324de7,'mode':_0x3e1943,'syncedAt':new Date()[_0x561af0(0x1e5)](),'description':_0x458d39[_0x561af0(0x1b6)]});if(await fileExists(_0x37d93f))throw CliErrors['validation'](_0x561af0(0x1f4)+_0x37d93f);await ensureParentDirectory(_0x37d93f),await writeFile(_0x37d93f,_0x1f07a8,_0x561af0(0x1b7));const _0x385133=await readSqlLockFile(_0x80309d[_0x561af0(0x1bb)]),{lockData:_0x20bd97,appLock:_0x2531ab}=ensureSqlLockScope(_0x385133??createEmptySqlLock(),_0x80309d[_0x561af0(0x1c8)],_0x80309d['sqlRoot'],_0x561af0(0x1f9));return _0x2531ab[_0x561af0(0x1e7)][_0x458d39[_0x561af0(0x1bd)]]={...buildSqlLockEntry(_0x458d39,_0x3ec416,computeSqlContentHash(_0x1f07a8),{'dbName':_0x324de7}),'path':_0x369f45,'mode':_0x3e1943},_0x2531ab[_0x561af0(0x1d2)]=new Date()[_0x561af0(0x1e5)](),await writeSqlLockFile(_0x80309d['lockFilePath'],_0x20bd97),{'ok':!![],'data':{'id':_0x458d39['id'],'sqlCode':_0x458d39['sqlCode'],'sqlName':_0x458d39[_0x561af0(0x1ec)],'dbId':_0x458d39[_0x561af0(0x1dc)],'path':_0x37d93f,'mode':_0x3e1943},'message':_0x561af0(0x1da)+_0x458d39[_0x561af0(0x1bd)]};}};async function resolveSqlNewInputs(_0x4d5336){const _0x28d674=await resolveSqlNameInput(_0x4d5336),{dbId:_0x3c1513,dbName:_0x40c7d0}=await resolveDbSelection(_0x4d5336),_0x1bc22=await resolveSqlModeInput(_0x4d5336);return{'sqlName':_0x28d674,'dbId':_0x3c1513,'dbName':_0x40c7d0,'mode':_0x1bc22};}async function resolveSqlNameInput(_0x587955){const _0x3d711a=a231_0x4f1731,_0x2fe75c=_0x587955[_0x3d711a(0x1c4)]('name')[_0x3d711a(0x1e9)]();if(_0x2fe75c)return _0x2fe75c;if(_0x587955[_0x3d711a(0x1d8)])throw CliErrors[_0x3d711a(0x1d6)](_0x3d711a(0x1e0),_0x3d711a(0x1c2));return(await input({'message':_0x3d711a(0x1ee),'validate':_0x1d5d7d=>_0x1d5d7d['trim']()?!![]:_0x3d711a(0x1e8)}))['trim']();}async function resolveDbSelection(_0x4b125d){const _0x3511bc=a231_0x4f1731,_0x756e4d=resolveProvidedDbId(_0x4b125d);if(typeof _0x756e4d===_0x3511bc(0x1ba)&&Number['isFinite'](_0x756e4d)&&_0x756e4d>0x0)return{'dbId':_0x756e4d,'dbName':await getDbName(_0x4b125d[_0x3511bc(0x1c8)],_0x756e4d)['catch'](()=>undefined)};if(_0x4b125d['nonInteractive'])throw CliErrors[_0x3511bc(0x1d6)](_0x3511bc(0x1e4),_0x3511bc(0x1ed));const _0x46b294=await listDatabases(_0x4b125d[_0x3511bc(0x1c8)])[_0x3511bc(0x1cd)](()=>[]);if(_0x46b294[_0x3511bc(0x1eb)]===0x1)return{'dbId':_0x46b294[0x0][_0x3511bc(0x1dc)],'dbName':_0x46b294[0x0][_0x3511bc(0x1de)]};if(_0x46b294['length']>0x1){const _0x449e8e=await select({'message':_0x3511bc(0x1c6),'choices':[..._0x46b294[_0x3511bc(0x1f3)](_0x1715a1=>({'name':_0x1715a1['dbName']+'\x20('+_0x1715a1['dbId']+')','value':serializeDbSelection(_0x1715a1)})),{'name':_0x3511bc(0x1d3),'value':_0x3511bc(0x1d0)}]});if(_0x449e8e!==_0x3511bc(0x1d0))return deserializeDbSelection(_0x449e8e);}const _0x2fad14=await input({'message':_0x3511bc(0x1fa),'validate':_0x14c468=>{const _0x19290f=_0x3511bc,_0x32ab35=_0x14c468[_0x19290f(0x1e9)]();if(!_0x32ab35)return _0x19290f(0x1ce);const _0x119ae1=Number(_0x32ab35);if(!Number['isInteger'](_0x119ae1)||_0x119ae1<=0x0)return _0x19290f(0x1e2);return!![];}});return{'dbId':Number(_0x2fad14['trim']())};}async function resolveSqlModeInput(_0x5b53e3){const _0x23e019=a231_0x4f1731,_0x482139=_0x5b53e3[_0x23e019(0x1c4)](_0x23e019(0x1c5))['trim']();if(_0x482139==='sql'||_0x482139===_0x23e019(0x1c0))return _0x482139;if(_0x5b53e3[_0x23e019(0x1d8)])throw CliErrors[_0x23e019(0x1d6)](_0x23e019(0x1c5),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x23e019(0x1db),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':_0x23e019(0x1cf),'description':_0x23e019(0x1c9)},{'name':_0x23e019(0x1bc),'value':_0x23e019(0x1c0),'description':_0x23e019(0x1ca)}]});}function serializeDbSelection(_0x4478b2){const _0x20abb6=a231_0x4f1731;return JSON[_0x20abb6(0x1ef)]({'dbId':_0x4478b2[_0x20abb6(0x1dc)],'dbName':_0x4478b2[_0x20abb6(0x1de)]});}function deserializeDbSelection(_0x574217){const _0x4e0be4=a231_0x4f1731;try{const _0x4f9887=JSON[_0x4e0be4(0x1e1)](_0x574217);if(typeof _0x4f9887[_0x4e0be4(0x1dc)]==='number'&&Number[_0x4e0be4(0x1df)](_0x4f9887[_0x4e0be4(0x1dc)]))return{'dbId':_0x4f9887['dbId'],'dbName':_0x4f9887[_0x4e0be4(0x1de)]};}catch{}throw CliErrors[_0x4e0be4(0x1ea)](_0x4e0be4(0x1d1)+_0x574217);}function resolveProvidedDbId(_0xb727ed){const _0x3ea794=a231_0x4f1731,_0x5a7251=_0xb727ed[_0x3ea794(0x1c7)](_0x3ea794(0x1e4));if(typeof _0x5a7251==='number'&&Number[_0x3ea794(0x1df)](_0x5a7251))return _0x5a7251;return undefined;}
@@ -1 +1 @@
1
- const a232_0x56d3a2=a232_0x3925;(function(_0x8b415e,_0x1857ae){const _0x46cc59=a232_0x3925,_0x364c62=_0x8b415e();while(!![]){try{const _0x243c9a=parseInt(_0x46cc59(0x192))/0x1*(-parseInt(_0x46cc59(0x1af))/0x2)+-parseInt(_0x46cc59(0x1a0))/0x3+-parseInt(_0x46cc59(0x1b2))/0x4+parseInt(_0x46cc59(0x198))/0x5*(parseInt(_0x46cc59(0x1a1))/0x6)+parseInt(_0x46cc59(0x19c))/0x7*(-parseInt(_0x46cc59(0x1ad))/0x8)+parseInt(_0x46cc59(0x1a6))/0x9+parseInt(_0x46cc59(0x1b0))/0xa;if(_0x243c9a===_0x1857ae)break;else _0x364c62['push'](_0x364c62['shift']());}catch(_0x447a23){_0x364c62['push'](_0x364c62['shift']());}}}(a232_0xda26,0x5c7d5));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';function a232_0xda26(){const _0x1cc54b=['155160AXoZGC','remoteId','delete','replace','appCode','filter','sqlRootDir','177832vFbEak','validation','sql','SQL\x20lock\x20file\x20not\x20found.','trashDir','\x20(local\x20file\x20moved\x20to\x20trash)','5bhsAZL','lastSync','trashedTo','length','462SbnXuK','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','POST','startsWith','1154016kczfXG','4124976xUpqhe','Deleted\x20','projectRoot','sqlRoot','high-risk-write','3964374CkGDvR','lockFilePath','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','fromEntries','entries','str','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','69496xqefHx','sqls','8LgElBg','9589870GfcvpJ','Would\x20delete\x20SQL\x20'];a232_0xda26=function(){return _0x1cc54b;};return a232_0xda26();}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':a232_0x56d3a2(0x194),'command':'delete','description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a232_0x56d3a2(0x1a5),'flags':[SQLCODE_FLAG],async 'validate'(_0x2b1a78){const _0x29176f=a232_0x56d3a2,_0x253899=loadSqlProjectConfig(_0x2b1a78[_0x29176f(0x18f)]),_0x308d33=await readSqlLockFile(_0x253899[_0x29176f(0x1a7)]);if(!_0x308d33)throw CliErrors[_0x29176f(0x193)](_0x29176f(0x1ac));},async 'dryRun'(_0x49d79e){const _0x329df4=a232_0x56d3a2,_0x14962f=loadSqlProjectConfig(_0x49d79e[_0x329df4(0x18f)]),_0x294aff=await readSqlLockFile(_0x14962f[_0x329df4(0x1a7)]);if(!_0x294aff)throw CliErrors[_0x329df4(0x193)](_0x329df4(0x1ac));const {appLock:_0x2b9182}=ensureSqlLockScope(_0x294aff,_0x49d79e[_0x329df4(0x18f)],_0x14962f[_0x329df4(0x1a4)],_0x329df4(0x1b4)),_0x176ecc=_0x49d79e[_0x329df4(0x1ab)]('sqlcode'),_0x3aed2b=_0x2b9182[_0x329df4(0x1ae)][_0x176ecc];if(!_0x3aed2b)throw CliErrors[_0x329df4(0x193)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x176ecc+'\x22.');return{'method':_0x329df4(0x19e),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x176ecc,'id':_0x3aed2b[_0x329df4(0x1b3)],'localPath':resolveLocalSqlFilePath(_0x14962f,_0x176ecc,_0x3aed2b)},'description':_0x329df4(0x1b1)+_0x176ecc+_0x329df4(0x1a8)+_0x14962f[_0x329df4(0x196)]};},async 'execute'(_0x2306f1){const _0x958a54=a232_0x56d3a2,_0xe7d98=loadSqlProjectConfig(_0x2306f1[_0x958a54(0x18f)]),_0x6ce0b3=await readSqlLockFile(_0xe7d98['lockFilePath']);if(!_0x6ce0b3)throw CliErrors[_0x958a54(0x193)](_0x958a54(0x195));const {lockData:_0x2a800e,appLock:_0x3f1a3b}=ensureSqlLockScope(_0x6ce0b3,_0x2306f1[_0x958a54(0x18f)],_0xe7d98[_0x958a54(0x1a4)],_0x958a54(0x1b4)),_0x1e551e=_0x2306f1[_0x958a54(0x1ab)]('sqlcode'),_0x830134=_0x3f1a3b['sqls'][_0x1e551e];if(!_0x830134)throw CliErrors[_0x958a54(0x193)](_0x958a54(0x19d)+_0x1e551e+'\x22.');await deleteSqlQuery({'id':_0x830134['remoteId'],'sqlCode':_0x1e551e}),_0x3f1a3b[_0x958a54(0x1ae)]=Object[_0x958a54(0x1a9)](Object[_0x958a54(0x1aa)](_0x3f1a3b[_0x958a54(0x1ae)])[_0x958a54(0x190)](([_0x3d089d])=>_0x3d089d!==_0x1e551e)),_0x3f1a3b[_0x958a54(0x199)]=new Date()['toISOString'](),await writeSqlLockFile(_0xe7d98[_0x958a54(0x1a7)],_0x2a800e);const _0x41ee01=resolveLocalSqlFilePath(_0xe7d98,_0x1e551e,_0x830134);let _0x2be20a;await fileExists(_0x41ee01)&&(_0x2be20a=await moveToTrash(_0xe7d98[_0x958a54(0x1a3)],_0xe7d98[_0x958a54(0x196)],_0x41ee01),await cleanupEmptyDirectories(dirname(_0x41ee01),_0xe7d98[_0x958a54(0x191)]));const _0x217b7f={'deleted':_0x1e551e,'remoteId':_0x830134[_0x958a54(0x1b3)]};if(_0x2be20a)_0x217b7f[_0x958a54(0x19a)]=_0x2be20a;return{'ok':!![],'data':_0x217b7f,'message':_0x958a54(0x1a2)+_0x1e551e+(_0x2be20a?_0x958a54(0x197):'')};}};async function moveToTrash(_0x57a048,_0x16ee07,_0x790905){const _0x38948a=a232_0x56d3a2,_0x4b44f8=new Date()['toISOString']()[_0x38948a(0x1b5)](/[:.]/g,'-'),_0x17a2ed=relative(_0x57a048,_0x790905),_0x5c619f=join(_0x16ee07,_0x4b44f8,_0x17a2ed);return await mkdir(dirname(_0x5c619f),{'recursive':!![]}),await rename(_0x790905,_0x5c619f),_0x5c619f;}function a232_0x3925(_0x7e145e,_0x210969){_0x7e145e=_0x7e145e-0x18f;const _0xda2693=a232_0xda26();let _0x3925d1=_0xda2693[_0x7e145e];return _0x3925d1;}async function cleanupEmptyDirectories(_0x37a937,_0x432ef0){const _0x33ffe0=a232_0x56d3a2;let _0x5890d3=resolve(_0x37a937);const _0x550aeb=resolve(_0x432ef0);while(_0x5890d3[_0x33ffe0(0x19f)](''+_0x550aeb+sep)||_0x5890d3===_0x550aeb){if(_0x5890d3===_0x550aeb)return;try{const _0x1ab1c9=await readdir(_0x5890d3);if(_0x1ab1c9[_0x33ffe0(0x19b)]>0x0)return;await rmdir(_0x5890d3);}catch{return;}_0x5890d3=dirname(_0x5890d3);}}
1
+ const a232_0x4882fe=a232_0x4ea8;(function(_0x5da039,_0x515f2f){const _0x42ed18=a232_0x4ea8,_0x3ef2ae=_0x5da039();while(!![]){try{const _0x4612e7=parseInt(_0x42ed18(0xf3))/0x1*(parseInt(_0x42ed18(0xdf))/0x2)+-parseInt(_0x42ed18(0xd9))/0x3*(parseInt(_0x42ed18(0xe1))/0x4)+parseInt(_0x42ed18(0xdd))/0x5+parseInt(_0x42ed18(0xe8))/0x6*(-parseInt(_0x42ed18(0xd2))/0x7)+parseInt(_0x42ed18(0xf0))/0x8+-parseInt(_0x42ed18(0xd4))/0x9*(-parseInt(_0x42ed18(0xed))/0xa)+parseInt(_0x42ed18(0xf2))/0xb*(parseInt(_0x42ed18(0xf6))/0xc);if(_0x4612e7===_0x515f2f)break;else _0x3ef2ae['push'](_0x3ef2ae['shift']());}catch(_0x4a4621){_0x3ef2ae['push'](_0x3ef2ae['shift']());}}}(a232_0x1b70,0x4c8e7));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a232_0x4ea8(_0x241683,_0x20d6ec){_0x241683=_0x241683-0xcf;const _0x1b708a=a232_0x1b70();let _0x4ea812=_0x1b708a[_0x241683];return _0x4ea812;}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a232_0x4882fe(0xd6),'command':a232_0x4882fe(0xd0),'description':a232_0x4882fe(0xec),'risk':a232_0x4882fe(0xda),'flags':[SQLCODE_FLAG],async 'validate'(_0x58b2c4){const _0x7ddc75=a232_0x4882fe,_0xe1bd37=loadSqlProjectConfig(_0x58b2c4[_0x7ddc75(0xe3)]),_0x3bc88d=await readSqlLockFile(_0xe1bd37[_0x7ddc75(0xf4)]);if(!_0x3bc88d)throw CliErrors[_0x7ddc75(0xde)](_0x7ddc75(0xdb));},async 'dryRun'(_0x2e65cc){const _0x4e7da8=a232_0x4882fe,_0x400c5f=loadSqlProjectConfig(_0x2e65cc[_0x4e7da8(0xe3)]),_0x1117d6=await readSqlLockFile(_0x400c5f[_0x4e7da8(0xf4)]);if(!_0x1117d6)throw CliErrors[_0x4e7da8(0xde)](_0x4e7da8(0xdb));const {appLock:_0x193b5a}=ensureSqlLockScope(_0x1117d6,_0x2e65cc['appCode'],_0x400c5f[_0x4e7da8(0xef)],_0x4e7da8(0xd0)),_0x359b89=_0x2e65cc[_0x4e7da8(0xe5)]('sqlcode'),_0x8611ae=_0x193b5a['sqls'][_0x359b89];if(!_0x8611ae)throw CliErrors[_0x4e7da8(0xde)](_0x4e7da8(0xd1)+_0x359b89+'\x22.');return{'method':_0x4e7da8(0xf7),'url':_0x4e7da8(0xee),'body':{'sqlCode':_0x359b89,'id':_0x8611ae[_0x4e7da8(0xe2)],'localPath':resolveLocalSqlFilePath(_0x400c5f,_0x359b89,_0x8611ae)},'description':_0x4e7da8(0xf1)+_0x359b89+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x400c5f[_0x4e7da8(0xe6)]};},async 'execute'(_0x2ec173){const _0x22be63=a232_0x4882fe,_0x581649=loadSqlProjectConfig(_0x2ec173['appCode']),_0x5a4d21=await readSqlLockFile(_0x581649[_0x22be63(0xf4)]);if(!_0x5a4d21)throw CliErrors[_0x22be63(0xde)](_0x22be63(0xe0));const {lockData:_0x122cf2,appLock:_0x1117c5}=ensureSqlLockScope(_0x5a4d21,_0x2ec173[_0x22be63(0xe3)],_0x581649['sqlRoot'],_0x22be63(0xd0)),_0x2aecc8=_0x2ec173[_0x22be63(0xe5)](_0x22be63(0xe4)),_0x54bfde=_0x1117c5[_0x22be63(0xeb)][_0x2aecc8];if(!_0x54bfde)throw CliErrors[_0x22be63(0xde)](_0x22be63(0xd1)+_0x2aecc8+'\x22.');await deleteSqlQuery({'id':_0x54bfde[_0x22be63(0xe2)],'sqlCode':_0x2aecc8}),_0x1117c5[_0x22be63(0xeb)]=Object[_0x22be63(0xe9)](Object[_0x22be63(0xea)](_0x1117c5[_0x22be63(0xeb)])['filter'](([_0x107575])=>_0x107575!==_0x2aecc8)),_0x1117c5['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x581649[_0x22be63(0xf4)],_0x122cf2);const _0x422692=resolveLocalSqlFilePath(_0x581649,_0x2aecc8,_0x54bfde);let _0x2b75e2;await fileExists(_0x422692)&&(_0x2b75e2=await moveToTrash(_0x581649[_0x22be63(0xd5)],_0x581649[_0x22be63(0xe6)],_0x422692),await cleanupEmptyDirectories(dirname(_0x422692),_0x581649['sqlRootDir']));const _0x1fac9f={'deleted':_0x2aecc8,'remoteId':_0x54bfde['remoteId']};if(_0x2b75e2)_0x1fac9f[_0x22be63(0xd8)]=_0x2b75e2;return{'ok':!![],'data':_0x1fac9f,'message':_0x22be63(0xcf)+_0x2aecc8+(_0x2b75e2?_0x22be63(0xdc):'')};}};async function moveToTrash(_0x51b5d0,_0x14fed3,_0x52559f){const _0xd6620b=a232_0x4882fe,_0x14828a=new Date()[_0xd6620b(0xd3)]()[_0xd6620b(0xd7)](/[:.]/g,'-'),_0x829144=relative(_0x51b5d0,_0x52559f),_0x38e172=join(_0x14fed3,_0x14828a,_0x829144);return await mkdir(dirname(_0x38e172),{'recursive':!![]}),await rename(_0x52559f,_0x38e172),_0x38e172;}function a232_0x1b70(){const _0x3e64f5=['sqlRoot','2426176JUkxUZ','Would\x20delete\x20SQL\x20','2492171AjujRA','902xECcHV','lockFilePath','length','12BktQzy','POST','Deleted\x20','delete','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','415394rBOSkg','toISOString','972UNaVFJ','projectRoot','sql','replace','trashedTo','5259BvupZk','high-risk-write','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','\x20(local\x20file\x20moved\x20to\x20trash)','1117445fWkIYK','validation','458MjajNL','SQL\x20lock\x20file\x20not\x20found.','812hxeGov','remoteId','appCode','sqlcode','str','trashDir','startsWith','30GYnTpx','fromEntries','entries','sqls','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','580plyCBd','/smartapi/custom/deleteUserCustomSql'];a232_0x1b70=function(){return _0x3e64f5;};return a232_0x1b70();}async function cleanupEmptyDirectories(_0xafc397,_0x6614cf){const _0x83e9a7=a232_0x4882fe;let _0x128087=resolve(_0xafc397);const _0x116ba3=resolve(_0x6614cf);while(_0x128087[_0x83e9a7(0xe7)](''+_0x116ba3+sep)||_0x128087===_0x116ba3){if(_0x128087===_0x116ba3)return;try{const _0x3a67dc=await readdir(_0x128087);if(_0x3a67dc[_0x83e9a7(0xf5)]>0x0)return;await rmdir(_0x128087);}catch{return;}_0x128087=dirname(_0x128087);}}
@@ -1 +1 @@
1
- const a233_0x162931=a233_0x2b1e;function a233_0x2b1e(_0x132534,_0xbf677d){_0x132534=_0x132534-0x78;const _0x296b44=a233_0x296b();let _0x2b1e6b=_0x296b44[_0x132534];return _0x2b1e6b;}(function(_0x3b6130,_0x2a4d93){const _0x3e8459=a233_0x2b1e,_0x88fdfd=_0x3b6130();while(!![]){try{const _0x4ecd57=-parseInt(_0x3e8459(0x7a))/0x1+parseInt(_0x3e8459(0x87))/0x2*(parseInt(_0x3e8459(0x7f))/0x3)+parseInt(_0x3e8459(0x8b))/0x4+-parseInt(_0x3e8459(0x79))/0x5+parseInt(_0x3e8459(0x8d))/0x6*(-parseInt(_0x3e8459(0x86))/0x7)+parseInt(_0x3e8459(0x85))/0x8+parseInt(_0x3e8459(0x7b))/0x9;if(_0x4ecd57===_0x2a4d93)break;else _0x88fdfd['push'](_0x88fdfd['shift']());}catch(_0x41bf93){_0x88fdfd['push'](_0x88fdfd['shift']());}}}(a233_0x296b,0x76a6c));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a233_0x296b(){const _0xc48103=['4250735emsNcW','343464SUHnWN','13807053qbBHvd','sqlContent','detail','str','99yiAVVK','description','bool','appCode','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','sqlCode','1336200TVKowl','119FdgUqe','48706mNtSnS','sql','sqlName','sqlcode','431920tiqXdI','boolean','329352nzCAQv','dbId','verbose'];a233_0x296b=function(){return _0xc48103;};return a233_0x296b();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a233_0x162931(0x88),'command':a233_0x162931(0x7d),'description':a233_0x162931(0x83),'risk':'read','flags':[SQLCODE_FLAG,{'name':a233_0x162931(0x78),'type':a233_0x162931(0x8c),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x518e36){const _0x1914c0=a233_0x162931,_0x3ab550=await getSqlQueryInfo(_0x518e36[_0x1914c0(0x82)],_0x518e36[_0x1914c0(0x7e)](_0x1914c0(0x8a))),_0x3df5c1=_0x518e36[_0x1914c0(0x81)](_0x1914c0(0x78));if(_0x3df5c1)return{'ok':!![],'data':_0x3ab550};const _0x6309c9=_0x3ab550[_0x1914c0(0x8e)]?await getDbName(_0x518e36[_0x1914c0(0x82)],_0x3ab550[_0x1914c0(0x8e)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x3ab550[_0x1914c0(0x84)],'sqlName':_0x3ab550[_0x1914c0(0x89)],'db':_0x6309c9?_0x6309c9+'\x20('+_0x3ab550[_0x1914c0(0x8e)]+')':_0x3ab550[_0x1914c0(0x8e)]??'','description':_0x3ab550[_0x1914c0(0x80)]??'','sqlContent':_0x3ab550[_0x1914c0(0x7c)]??''}};}};
1
+ const a233_0x2736c9=a233_0x5ff8;(function(_0x3ee1cc,_0x1c0061){const _0x20d650=a233_0x5ff8,_0x1cb8b2=_0x3ee1cc();while(!![]){try{const _0x2be6bb=-parseInt(_0x20d650(0xc3))/0x1*(parseInt(_0x20d650(0xcf))/0x2)+-parseInt(_0x20d650(0xd4))/0x3+-parseInt(_0x20d650(0xc5))/0x4*(-parseInt(_0x20d650(0xc6))/0x5)+-parseInt(_0x20d650(0xca))/0x6+parseInt(_0x20d650(0xc9))/0x7*(parseInt(_0x20d650(0xcd))/0x8)+parseInt(_0x20d650(0xc2))/0x9+parseInt(_0x20d650(0xcc))/0xa*(parseInt(_0x20d650(0xd2))/0xb);if(_0x2be6bb===_0x1c0061)break;else _0x1cb8b2['push'](_0x1cb8b2['shift']());}catch(_0x2cba9a){_0x1cb8b2['push'](_0x1cb8b2['shift']());}}}(a233_0x254c,0x193bf));import{getSqlQueryInfo}from'../../core/api-client.js';function a233_0x254c(){const _0x176bd5=['sqlName','sqlCode','appCode','1769157hoErnV','83MdwIHX','sql','284neBPju','11145GeKVPL','Return\x20full\x20raw\x20SQL\x20query\x20object','read','182378JyRURT','879138EcvNTJ','bool','510miARDt','8SSwHZC','description','3544TMKHmQ','sqlContent','dbId','9757lltgUj','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','87495gahiud','verbose'];a233_0x254c=function(){return _0x176bd5;};return a233_0x254c();}import{getDbName}from'../../core/db-resolver.js';function a233_0x5ff8(_0x196df1,_0x1a5bbc){_0x196df1=_0x196df1-0xc0;const _0x254cf2=a233_0x254c();let _0x5ff85e=_0x254cf2[_0x196df1];return _0x5ff85e;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a233_0x2736c9(0xc4),'command':'detail','description':a233_0x2736c9(0xd3),'risk':a233_0x2736c9(0xc8),'flags':[SQLCODE_FLAG,{'name':a233_0x2736c9(0xd5),'type':'boolean','description':a233_0x2736c9(0xc7)}],async 'execute'(_0x283968){const _0xee90d0=a233_0x2736c9,_0xe5bd5a=await getSqlQueryInfo(_0x283968[_0xee90d0(0xc1)],_0x283968['str']('sqlcode')),_0x350676=_0x283968[_0xee90d0(0xcb)](_0xee90d0(0xd5));if(_0x350676)return{'ok':!![],'data':_0xe5bd5a};const _0x1c14e3=_0xe5bd5a[_0xee90d0(0xd1)]?await getDbName(_0x283968[_0xee90d0(0xc1)],_0xe5bd5a[_0xee90d0(0xd1)]):undefined;return{'ok':!![],'data':{'sqlCode':_0xe5bd5a[_0xee90d0(0xc0)],'sqlName':_0xe5bd5a[_0xee90d0(0xd6)],'db':_0x1c14e3?_0x1c14e3+'\x20('+_0xe5bd5a['dbId']+')':_0xe5bd5a[_0xee90d0(0xd1)]??'','description':_0xe5bd5a[_0xee90d0(0xce)]??'','sqlContent':_0xe5bd5a[_0xee90d0(0xd0)]??''}};}};
@@ -1 +1 @@
1
- const a234_0x291ae1=a234_0x36ac;(function(_0x2a4a93,_0x1952f0){const _0x2c206c=a234_0x36ac,_0x11f91d=_0x2a4a93();while(!![]){try{const _0x1d6cb1=parseInt(_0x2c206c(0x93))/0x1*(-parseInt(_0x2c206c(0x9e))/0x2)+parseInt(_0x2c206c(0x9d))/0x3+-parseInt(_0x2c206c(0xa0))/0x4+parseInt(_0x2c206c(0x99))/0x5*(-parseInt(_0x2c206c(0x95))/0x6)+-parseInt(_0x2c206c(0xa4))/0x7*(-parseInt(_0x2c206c(0x9f))/0x8)+-parseInt(_0x2c206c(0x9b))/0x9*(parseInt(_0x2c206c(0xa2))/0xa)+parseInt(_0x2c206c(0x8f))/0xb*(parseInt(_0x2c206c(0x91))/0xc);if(_0x1d6cb1===_0x1952f0)break;else _0x11f91d['push'](_0x11f91d['shift']());}catch(_0x1e0687){_0x11f91d['push'](_0x11f91d['shift']());}}}(a234_0x20c4,0x58702));function a234_0x36ac(_0x149c86,_0x5934b7){_0x149c86=_0x149c86-0x8f;const _0x20c44f=a234_0x20c4();let _0x36ac9=_0x20c44f[_0x149c86];return _0x36ac9;}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a234_0x20c4(){const _0x42e17e=['now','str','11rmobPq','execSuccess','4602732jhdfdI','string','214PsvGPa','sqlcode','24hAIpJy','exec','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','sql','721235UhxDZA','execError','36BLkWlp','params','691164Wlhxgd','2084hTuReg','8fAyWHb','23340DSAxcS','isArray','268250BEpTjH','SQL\x20execution\x20failed','4629828ZKlgmK'];a234_0x20c4=function(){return _0x42e17e;};return a234_0x20c4();}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a234_0x291ae1(0x98),'command':a234_0x291ae1(0x96),'description':a234_0x291ae1(0x97),'risk':'read','flags':[SQLCODE_FLAG,{'name':'params','type':a234_0x291ae1(0x92),'description':'SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'}],async 'execute'(_0x217ff7){const _0x22c91a=a234_0x291ae1,_0x5eb46c=parseJsonParams(_0x217ff7[_0x22c91a(0xa6)](_0x22c91a(0x9c))),_0x696f7d=Date[_0x22c91a(0xa5)](),_0x62d917=await executeSql(_0x217ff7['appCode'],_0x217ff7[_0x22c91a(0xa6)](_0x22c91a(0x94)),_0x5eb46c),_0x11989a=Date['now']()-_0x696f7d,_0xed9242=_0x62d917?.['execResult']??_0x62d917,_0x56b7f0=_0x62d917?.[_0x22c91a(0x90)]??!![];if(!_0x56b7f0)return{'ok':![],'data':{'error':_0x62d917?.[_0x22c91a(0x9a)]||_0x22c91a(0xa3),'elapsed':_0x11989a},'message':_0x22c91a(0xa3)};const _0x424eae=Array[_0x22c91a(0xa1)](_0xed9242)?_0xed9242:[];return{'ok':!![],'data':{'rows':_0x424eae,'rowCount':_0x424eae['length'],'elapsed':_0x11989a},'message':'Returned\x20'+_0x424eae['length']+'\x20row(s)\x20in\x20'+_0x11989a+'ms'};}};
1
+ const a234_0x2c1102=a234_0x379c;(function(_0x481135,_0x1a6128){const _0x354a43=a234_0x379c,_0x139d0b=_0x481135();while(!![]){try{const _0x4eac84=-parseInt(_0x354a43(0x19d))/0x1+parseInt(_0x354a43(0x1a8))/0x2+-parseInt(_0x354a43(0x1ab))/0x3*(parseInt(_0x354a43(0x1b0))/0x4)+-parseInt(_0x354a43(0x1b1))/0x5+parseInt(_0x354a43(0x1b2))/0x6+-parseInt(_0x354a43(0x19f))/0x7*(-parseInt(_0x354a43(0x1a5))/0x8)+parseInt(_0x354a43(0x1af))/0x9*(parseInt(_0x354a43(0x19e))/0xa);if(_0x4eac84===_0x1a6128)break;else _0x139d0b['push'](_0x139d0b['shift']());}catch(_0x5b6511){_0x139d0b['push'](_0x139d0b['shift']());}}}(a234_0x5573,0xba5a2));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':a234_0x2c1102(0x19c),'command':a234_0x2c1102(0x1aa),'description':a234_0x2c1102(0x1ad),'risk':a234_0x2c1102(0x1a4),'flags':[SQLCODE_FLAG,{'name':a234_0x2c1102(0x1a2),'type':'string','description':'SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'}],async 'execute'(_0x2b1f76){const _0x45add0=a234_0x2c1102,_0x46e949=parseJsonParams(_0x2b1f76[_0x45add0(0x1ae)]('params')),_0x59780a=Date[_0x45add0(0x1a7)](),_0x1edfac=await executeSql(_0x2b1f76['appCode'],_0x2b1f76['str'](_0x45add0(0x1a3)),_0x46e949),_0x1ea3c9=Date[_0x45add0(0x1a7)]()-_0x59780a,_0x32faea=_0x1edfac?.[_0x45add0(0x1b3)]??_0x1edfac,_0x10ae02=_0x1edfac?.[_0x45add0(0x1a0)]??!![];if(!_0x10ae02)return{'ok':![],'data':{'error':_0x1edfac?.['execError']||_0x45add0(0x1ac),'elapsed':_0x1ea3c9},'message':_0x45add0(0x1ac)};const _0x39a9b8=Array[_0x45add0(0x1a9)](_0x32faea)?_0x32faea:[];return{'ok':!![],'data':{'rows':_0x39a9b8,'rowCount':_0x39a9b8['length'],'elapsed':_0x1ea3c9},'message':_0x45add0(0x1a1)+_0x39a9b8[_0x45add0(0x1a6)]+'\x20row(s)\x20in\x20'+_0x1ea3c9+'ms'};}};function a234_0x379c(_0x1d54d9,_0x233c7f){_0x1d54d9=_0x1d54d9-0x19c;const _0x557369=a234_0x5573();let _0x379c30=_0x557369[_0x1d54d9];return _0x379c30;}function a234_0x5573(){const _0x342616=['isArray','exec','3fiaJJk','SQL\x20execution\x20failed','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','str','9srUGoR','1835276kFfbZV','34910ABFTsq','3087270terxdW','execResult','sql','675534ukyFpw','194780HhRWve','21CzPoyh','execSuccess','Returned\x20','params','sqlcode','read','521368pSmzJI','length','now','2350194eFggCP'];a234_0x5573=function(){return _0x342616;};return a234_0x5573();}
@@ -1 +1 @@
1
- (function(_0x126c60,_0x1845ef){const _0x1d93bf=a235_0xf277,_0x33e60f=_0x126c60();while(!![]){try{const _0x3ea731=-parseInt(_0x1d93bf(0x9b))/0x1*(parseInt(_0x1d93bf(0x9e))/0x2)+parseInt(_0x1d93bf(0x9f))/0x3+parseInt(_0x1d93bf(0x9d))/0x4*(-parseInt(_0x1d93bf(0x99))/0x5)+-parseInt(_0x1d93bf(0x9a))/0x6+parseInt(_0x1d93bf(0x9c))/0x7*(parseInt(_0x1d93bf(0x97))/0x8)+parseInt(_0x1d93bf(0x96))/0x9*(parseInt(_0x1d93bf(0xa0))/0xa)+parseInt(_0x1d93bf(0x98))/0xb;if(_0x3ea731===_0x1845ef)break;else _0x33e60f['push'](_0x33e60f['shift']());}catch(_0x54c29f){_0x33e60f['push'](_0x33e60f['shift']());}}}(a235_0x1e12,0xf2c3a));function a235_0xf277(_0x54571a,_0x43c2b2){_0x54571a=_0x54571a-0x96;const _0x1e12ad=a235_0x1e12();let _0xf277=_0x1e12ad[_0x54571a];return _0xf277;}import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a235_0x1e12(){const _0x54538d=['3188JOzvkS','14GTpDqt','2257359SJcVEc','616790UdEceM','135lhekiU','560NKEyXp','18330114tRVevL','11315tuJtIW','8487300RnxNdh','16787oGfUdT','98602omsRUf'];a235_0x1e12=function(){return _0x54538d;};return a235_0x1e12();}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(_0x103d21,_0xac955e){const _0x1f2acb=a235_0x7627,_0xd54056=_0x103d21();while(!![]){try{const _0x41aa14=-parseInt(_0x1f2acb(0xc3))/0x1*(parseInt(_0x1f2acb(0xbd))/0x2)+parseInt(_0x1f2acb(0xc0))/0x3*(-parseInt(_0x1f2acb(0xc2))/0x4)+-parseInt(_0x1f2acb(0xbc))/0x5*(parseInt(_0x1f2acb(0xc1))/0x6)+-parseInt(_0x1f2acb(0xc6))/0x7+-parseInt(_0x1f2acb(0xc4))/0x8*(-parseInt(_0x1f2acb(0xc5))/0x9)+-parseInt(_0x1f2acb(0xbe))/0xa*(parseInt(_0x1f2acb(0xbf))/0xb)+parseInt(_0x1f2acb(0xc8))/0xc*(parseInt(_0x1f2acb(0xc7))/0xd);if(_0x41aa14===_0xac955e)break;else _0xd54056['push'](_0xd54056['shift']());}catch(_0x4bd986){_0xd54056['push'](_0xd54056['shift']());}}}(a235_0x1c2c,0x1d0b2));function a235_0x1c2c(){const _0x573e93=['2630DrDfFL','8547bljmLa','3AcUawc','1174980WlFboH','820804rLxuzI','4nOEERn','108152gppzxB','144iwHggX','669837ZMGAAP','9654151pFSlzz','12lSkRSU','5SQDtga','69448RKbnIL'];a235_0x1c2c=function(){return _0x573e93;};return a235_0x1c2c();}import{sqlList}from'../../commands/sql/list.js';function a235_0x7627(_0x34396a,_0x2fc481){_0x34396a=_0x34396a-0xbc;const _0x1c2cfc=a235_0x1c2c();let _0x762714=_0x1c2cfc[_0x34396a];return _0x762714;}import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a236_0x1c96e8=a236_0x5a4f;(function(_0x37d1ec,_0x19ccf5){const _0x40af23=a236_0x5a4f,_0x4c1093=_0x37d1ec();while(!![]){try{const _0x3b68fd=-parseInt(_0x40af23(0xdc))/0x1*(-parseInt(_0x40af23(0xda))/0x2)+-parseInt(_0x40af23(0xf0))/0x3*(parseInt(_0x40af23(0xf6))/0x4)+parseInt(_0x40af23(0xe3))/0x5+-parseInt(_0x40af23(0xe0))/0x6*(parseInt(_0x40af23(0xe1))/0x7)+-parseInt(_0x40af23(0xfb))/0x8*(-parseInt(_0x40af23(0xfa))/0x9)+parseInt(_0x40af23(0xdd))/0xa*(parseInt(_0x40af23(0xe6))/0xb)+-parseInt(_0x40af23(0xd7))/0xc;if(_0x3b68fd===_0x19ccf5)break;else _0x4c1093['push'](_0x4c1093['shift']());}catch(_0x3b8584){_0x4c1093['push'](_0x4c1093['shift']());}}}(a236_0x32a0,0xaf415));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a236_0x5a4f(_0x17873b,_0x158402){_0x17873b=_0x17873b-0xd7;const _0x32a030=a236_0x32a0();let _0x5a4f1d=_0x32a030[_0x17873b];return _0x5a4f1d;}function a236_0x32a0(){const _0xc2f272=['\x20SQL\x20queries\x20(total:\x20','3322YuJGmK','number','853hciAYm','10dBHQGb','sqlcode','read','25098EBwzdg','1561SuwXfK','name','6571700nhFWOG','tableData','list','4727591KThbsf','No\x20custom\x20SQL\x20queries\x20found.','length','dbId','pagesize','Page\x20number','sqlCode','verbose','sqlName','page','4241631aRPzcZ','str','string','map','all','num','4JpqmfI','Found\x20','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','boolean','27yOXKId','3811784MFyDic','appCode','18310104JcukiU','totalCount'];a236_0x32a0=function(){return _0xc2f272;};return a236_0x32a0();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a236_0x1c96e8(0xe5),'description':'List\x20custom\x20SQL\x20queries','risk':a236_0x1c96e8(0xdf),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a236_0x1c96e8(0xf2),'description':'Filter\x20by\x20SQL\x20name'},{'name':a236_0x1c96e8(0xef),'type':'number','description':a236_0x1c96e8(0xeb),'default':0x1},{'name':a236_0x1c96e8(0xea),'type':a236_0x1c96e8(0xdb),'description':'Page\x20size'},{'name':'verbose','type':a236_0x1c96e8(0xf9),'description':a236_0x1c96e8(0xf8)}],async 'execute'(_0xbe4a0){const _0x5ccef9=a236_0x1c96e8,_0x74984a=await listSqlQueries(_0xbe4a0[_0x5ccef9(0xfc)],{'sqlCode':_0xbe4a0['str'](_0x5ccef9(0xde))||undefined,'sqlName':_0xbe4a0[_0x5ccef9(0xf1)](_0x5ccef9(0xe2))||undefined,'currentPage':_0xbe4a0['num']('page'),'pageSize':_0xbe4a0[_0x5ccef9(0xf5)](_0x5ccef9(0xea),0x32)}),_0x3500d8=_0xbe4a0['bool'](_0x5ccef9(0xed)),_0x110d8d=_0x74984a[_0x5ccef9(0xe4)]??[],_0x16c602=_0x74984a['paging']?.[_0x5ccef9(0xd8)]??_0x110d8d['length'];let _0xec3fc3;return _0x3500d8?_0xec3fc3=_0x110d8d:_0xec3fc3=await Promise[_0x5ccef9(0xf4)](_0x110d8d[_0x5ccef9(0xf3)](async _0x79beeb=>{const _0x4b4ba6=_0x5ccef9;let _0x5e1e8c;try{_0x5e1e8c=_0x79beeb[_0x4b4ba6(0xe9)]?await getDbName(_0xbe4a0[_0x4b4ba6(0xfc)],_0x79beeb[_0x4b4ba6(0xe9)]):undefined;}catch{}return{'sqlCode':_0x79beeb[_0x4b4ba6(0xec)],'sqlName':_0x79beeb[_0x4b4ba6(0xee)],'description':_0x79beeb['description']??'','db':_0x5e1e8c?_0x5e1e8c+'\x20('+_0x79beeb[_0x4b4ba6(0xe9)]+')':_0x79beeb[_0x4b4ba6(0xe9)]??''};})),{'ok':!![],'data':_0xec3fc3,'message':_0x110d8d[_0x5ccef9(0xe8)]===0x0?_0x5ccef9(0xe7):_0x5ccef9(0xf7)+_0x110d8d[_0x5ccef9(0xe8)]+_0x5ccef9(0xd9)+_0x16c602+').'};}};
1
+ const a236_0x1a16a5=a236_0x390e;(function(_0x2486f0,_0x1476a7){const _0x33ea29=a236_0x390e,_0x294a84=_0x2486f0();while(!![]){try{const _0x1d931f=-parseInt(_0x33ea29(0x131))/0x1*(-parseInt(_0x33ea29(0x11e))/0x2)+parseInt(_0x33ea29(0x10f))/0x3+parseInt(_0x33ea29(0x110))/0x4*(-parseInt(_0x33ea29(0x128))/0x5)+-parseInt(_0x33ea29(0x112))/0x6*(-parseInt(_0x33ea29(0x134))/0x7)+parseInt(_0x33ea29(0x11f))/0x8*(parseInt(_0x33ea29(0x120))/0x9)+parseInt(_0x33ea29(0x11b))/0xa*(-parseInt(_0x33ea29(0x132))/0xb)+-parseInt(_0x33ea29(0x124))/0xc*(-parseInt(_0x33ea29(0x12d))/0xd);if(_0x1d931f===_0x1476a7)break;else _0x294a84['push'](_0x294a84['shift']());}catch(_0x5dbe07){_0x294a84['push'](_0x294a84['shift']());}}}(a236_0x5c6b,0xc89f6));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a236_0x390e(_0x367c70,_0x4b3914){_0x367c70=_0x367c70-0x10e;const _0x5c6b3f=a236_0x5c6b();let _0x390e5a=_0x5c6b3f[_0x367c70];return _0x390e5a;}function a236_0x5c6b(){const _0x3912c5=['string','read','13FepJIX','sql','Page\x20size','No\x20custom\x20SQL\x20queries\x20found.','5bwuOkX','43219lCXGQK','str','1631wPKcEx','all','List\x20custom\x20SQL\x20queries','553851kHjgrt','4kprmyq','length','19524KMemrq','list','sqlcode','totalCount','number','name','page','Filter\x20by\x20SQL\x20name','pagesize','1840eEXqsv','\x20SQL\x20queries\x20(total:\x20','Found\x20','22478FjdAoZ','1572952wNJKsQ','27YhitbP','boolean','sqlName','dbId','4075356FbNwnU','bool','num','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','1918890TZWOay','appCode','paging'];a236_0x5c6b=function(){return _0x3912c5;};return a236_0x5c6b();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a236_0x1a16a5(0x12e),'command':a236_0x1a16a5(0x113),'description':a236_0x1a16a5(0x10e),'risk':a236_0x1a16a5(0x12c),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a236_0x1a16a5(0x117),'type':a236_0x1a16a5(0x12b),'description':a236_0x1a16a5(0x119)},{'name':'page','type':a236_0x1a16a5(0x116),'description':'Page\x20number','default':0x1},{'name':a236_0x1a16a5(0x11a),'type':a236_0x1a16a5(0x116),'description':a236_0x1a16a5(0x12f)},{'name':'verbose','type':a236_0x1a16a5(0x121),'description':a236_0x1a16a5(0x127)}],async 'execute'(_0x1fd1d7){const _0x7f585e=a236_0x1a16a5,_0x4e15c4=await listSqlQueries(_0x1fd1d7[_0x7f585e(0x129)],{'sqlCode':_0x1fd1d7[_0x7f585e(0x133)](_0x7f585e(0x114))||undefined,'sqlName':_0x1fd1d7[_0x7f585e(0x133)](_0x7f585e(0x117))||undefined,'currentPage':_0x1fd1d7[_0x7f585e(0x126)](_0x7f585e(0x118)),'pageSize':_0x1fd1d7[_0x7f585e(0x126)](_0x7f585e(0x11a),0x32)}),_0x4fdc73=_0x1fd1d7[_0x7f585e(0x125)]('verbose'),_0x4eef60=_0x4e15c4['tableData']??[],_0x2272fb=_0x4e15c4[_0x7f585e(0x12a)]?.[_0x7f585e(0x115)]??_0x4eef60['length'];let _0x33346b;return _0x4fdc73?_0x33346b=_0x4eef60:_0x33346b=await Promise[_0x7f585e(0x135)](_0x4eef60['map'](async _0x66dcfa=>{const _0x85cd27=_0x7f585e;let _0x2df6a8;try{_0x2df6a8=_0x66dcfa['dbId']?await getDbName(_0x1fd1d7[_0x85cd27(0x129)],_0x66dcfa[_0x85cd27(0x123)]):undefined;}catch{}return{'sqlCode':_0x66dcfa['sqlCode'],'sqlName':_0x66dcfa[_0x85cd27(0x122)],'description':_0x66dcfa['description']??'','db':_0x2df6a8?_0x2df6a8+'\x20('+_0x66dcfa['dbId']+')':_0x66dcfa[_0x85cd27(0x123)]??''};})),{'ok':!![],'data':_0x33346b,'message':_0x4eef60[_0x7f585e(0x111)]===0x0?_0x7f585e(0x130):_0x7f585e(0x11d)+_0x4eef60[_0x7f585e(0x111)]+_0x7f585e(0x11c)+_0x2272fb+').'};}};
@@ -1 +1 @@
1
- const a237_0x3ebf86=a237_0x7d6c;(function(_0x397fab,_0x24cfe2){const _0x5011bd=a237_0x7d6c,_0x5a9d97=_0x397fab();while(!![]){try{const _0x2021a3=parseInt(_0x5011bd(0x9c))/0x1+-parseInt(_0x5011bd(0xb4))/0x2+parseInt(_0x5011bd(0x95))/0x3*(parseInt(_0x5011bd(0x9e))/0x4)+parseInt(_0x5011bd(0x87))/0x5*(parseInt(_0x5011bd(0x83))/0x6)+-parseInt(_0x5011bd(0x99))/0x7*(-parseInt(_0x5011bd(0x6d))/0x8)+-parseInt(_0x5011bd(0x6f))/0x9+parseInt(_0x5011bd(0x9a))/0xa*(-parseInt(_0x5011bd(0xa3))/0xb);if(_0x2021a3===_0x24cfe2)break;else _0x5a9d97['push'](_0x5a9d97['shift']());}catch(_0x24364d){_0x5a9d97['push'](_0x5a9d97['shift']());}}}(a237_0x3ad0,0x613e3));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';function a237_0x7d6c(_0x456a31,_0x3977c2){_0x456a31=_0x456a31-0x6b;const _0x3ad0d3=a237_0x3ad0();let _0x7d6c4=_0x3ad0d3[_0x456a31];return _0x7d6c4;}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(_0x32ca2f,_0x247554){const _0x1c5bb3=a237_0x7d6c,_0x518dd7=[];let _0x1981ac=0x1;while(!![]){const _0x127523=await listSqlQueries(_0x32ca2f,{'currentPage':_0x1981ac,'pageSize':PAGE_SIZE,'sqlCode':_0x247554[_0x1c5bb3(0xb2)],'sqlName':_0x247554[_0x1c5bb3(0x8f)]}),_0x287dd4=_0x127523[_0x1c5bb3(0xb3)]??[];_0x518dd7[_0x1c5bb3(0xb0)](..._0x287dd4);if(_0x287dd4[_0x1c5bb3(0x8a)]===0x0)break;const _0x63d42=_0x127523[_0x1c5bb3(0x98)]?.[_0x1c5bb3(0x7d)];if(_0x63d42!=null?_0x518dd7[_0x1c5bb3(0x8a)]>=_0x63d42:_0x287dd4[_0x1c5bb3(0x8a)]<PAGE_SIZE)break;_0x1981ac++;}return _0x518dd7;}async function ensureSqlContent(_0x369ee5){const _0x4d30bc=a237_0x7d6c;if(_0x369ee5['sqlContent']!=null&&String(_0x369ee5[_0x4d30bc(0x92)])['length']>0x0)return _0x369ee5;return getSqlQueryDetail(_0x369ee5[_0x4d30bc(0xb2)]);}export const sqlPull={'service':a237_0x3ebf86(0x6c),'command':a237_0x3ebf86(0x79),'description':a237_0x3ebf86(0x77),'risk':a237_0x3ebf86(0x8d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a237_0x3ebf86(0x71),'type':a237_0x3ebf86(0x9f),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a237_0x3ebf86(0x9b),'type':'boolean','description':a237_0x3ebf86(0x73)}],async 'dryRun'(_0x1ea4b5){const _0x5a6ec9=a237_0x3ebf86,_0x3c6a24=loadSqlProjectConfig(_0x1ea4b5[_0x5a6ec9(0x89)]),_0x4da28d=await readSqlLockFile(_0x3c6a24[_0x5a6ec9(0xaf)]),{appLock:_0x32592f}=ensureSqlLockScope(_0x4da28d??createEmptySqlLock(),_0x3c6a24[_0x5a6ec9(0x89)],_0x3c6a24[_0x5a6ec9(0xac)],_0x5a6ec9(0x79)),_0x4196e5=await fetchAllSqlQueries(_0x1ea4b5['appCode'],{'sqlCode':_0x1ea4b5[_0x5a6ec9(0xa7)](_0x5a6ec9(0x8b))||undefined,'sqlName':_0x1ea4b5[_0x5a6ec9(0xa7)](_0x5a6ec9(0x71))||undefined}),_0xeb763c=[];for(const _0x4f1e7c of _0x4196e5){const _0x441d2d=await ensureSqlContent(_0x4f1e7c),_0x924766=ensureRemoteSqlContent(_0x441d2d),_0xdebf6e=detectSqlMode(_0x924766),_0xfdcece=_0x441d2d['dbId']?await getDbName(_0x1ea4b5[_0x5a6ec9(0x89)],Number(_0x441d2d['dbId']))[_0x5a6ec9(0xa6)](()=>undefined):undefined,_0x3e407f=buildLocalSqlFileContent({'sqlCode':_0x441d2d[_0x5a6ec9(0xb2)],'sqlName':_0x441d2d['sqlName'],'dbId':_0x441d2d['dbId']},_0x924766,{'dbName':_0xfdcece,'mode':_0xdebf6e,'syncedAt':new Date()[_0x5a6ec9(0xa9)](),'description':_0x441d2d['description']}),_0xeabd5d=buildSqlLockEntry(_0x441d2d,_0x924766,'',{'dbName':_0xfdcece}),_0x2de75e=resolveLocalSqlFilePath(_0x3c6a24,_0x441d2d['sqlCode'],_0xeabd5d);let _0x2700ff='would_pull',_0x3c7d7b;const _0x2acd2d=await findExistingSqlFiles(_0x3c6a24,_0x2de75e,_0xdebf6e,_0x32592f[_0x5a6ec9(0x9d)][_0x441d2d[_0x5a6ec9(0xb2)]]);if(_0x2acd2d[_0x5a6ec9(0x8a)]>0x0){const _0x4a6f15=await compareExistingSqlFiles(_0x2acd2d,_0x3e407f,_0xdebf6e);if(_0x4a6f15[_0x5a6ec9(0xb1)](({equivalent:_0xed62b4})=>!_0xed62b4))_0x2700ff='conflict',_0x3c7d7b=_0x5a6ec9(0x74);else _0x4a6f15['length']===0x1&&_0x4a6f15[0x0]?.[_0x5a6ec9(0x97)]['isCanonical']&&(_0x2700ff=_0x5a6ec9(0x81),_0x3c7d7b=_0x5a6ec9(0xad));}_0xeb763c[_0x5a6ec9(0xb0)]({'sqlCode':_0x441d2d['sqlCode'],'sqlName':_0x441d2d[_0x5a6ec9(0x8f)],'filePath':_0x2de75e,'status':_0x2700ff,'reason':_0x3c7d7b});}return{'method':_0x5a6ec9(0x6e),'url':_0x5a6ec9(0x96),'body':{'appCode':_0x1ea4b5[_0x5a6ec9(0x89)],'sqlCode':_0x1ea4b5[_0x5a6ec9(0xa7)]('sqlcode')||null,'sqlName':_0x1ea4b5[_0x5a6ec9(0xa7)](_0x5a6ec9(0x71))||null,'files':_0xeb763c},'description':_0x5a6ec9(0xae)+_0xeb763c[_0x5a6ec9(0x8a)]+_0x5a6ec9(0xa4)+_0x3c6a24[_0x5a6ec9(0x82)]};},async 'execute'(_0x1e4ddf){const _0x243800=a237_0x3ebf86,_0x549c13=loadSqlProjectConfig(_0x1e4ddf[_0x243800(0x89)]),_0x1c8ee7=await readSqlLockFile(_0x549c13[_0x243800(0xaf)]),{lockData:_0x572d40,appLock:_0xbc28c9}=ensureSqlLockScope(_0x1c8ee7??createEmptySqlLock(),_0x549c13[_0x243800(0x89)],_0x549c13['sqlRoot'],'pull'),_0x300e67=_0x1e4ddf[_0x243800(0x91)](_0x243800(0x9b)),_0x2ba2d2=await fetchAllSqlQueries(_0x1e4ddf[_0x243800(0x89)],{'sqlCode':_0x1e4ddf[_0x243800(0xa7)](_0x243800(0x8b))||undefined,'sqlName':_0x1e4ddf[_0x243800(0xa7)](_0x243800(0x71))||undefined});if(_0x2ba2d2['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x243800(0x7f)};const _0x3d3099=[],_0x3e0935=[];for(const _0x54225b of _0x2ba2d2){try{_0x3d3099['push'](await ensureSqlContent(_0x54225b));}catch(_0x50bc57){_0x3e0935['push']({'sqlCode':_0x54225b[_0x243800(0xb2)],'error':_0x50bc57 instanceof Error?_0x50bc57[_0x243800(0xa5)]:String(_0x50bc57)});}}if(_0x300e67&&!_0x1e4ddf['nonInteractive']){let _0x37c08f=![];for(const _0x310e60 of _0x3d3099){const _0x2a01cf=detectSqlMode(ensureRemoteSqlContent(_0x310e60)),_0x31ccb3=_0x310e60['dbId']?await getDbName(_0x1e4ddf[_0x243800(0x89)],Number(_0x310e60[_0x243800(0x93)]))[_0x243800(0xa6)](()=>undefined):undefined,_0x51a79a=buildLocalSqlFileContent({'sqlCode':_0x310e60[_0x243800(0xb2)],'sqlName':_0x310e60[_0x243800(0x8f)],'dbId':_0x310e60[_0x243800(0x93)]},ensureRemoteSqlContent(_0x310e60),{'dbName':_0x31ccb3,'mode':_0x2a01cf,'syncedAt':new Date()[_0x243800(0xa9)](),'description':_0x310e60['description']}),_0x1735a9=resolveLocalSqlFilePath(_0x549c13,_0x310e60[_0x243800(0xb2)],buildSqlLockEntry(_0x310e60,ensureRemoteSqlContent(_0x310e60),'',{'dbName':_0x31ccb3})),_0x1eb26c=await findExistingSqlFiles(_0x549c13,_0x1735a9,_0x2a01cf,_0xbc28c9['sqls'][_0x310e60[_0x243800(0xb2)]]),_0x720361=await compareExistingSqlFiles(_0x1eb26c,_0x51a79a,_0x2a01cf);if(_0x720361[_0x243800(0xb1)](({equivalent:_0xa4a907})=>!_0xa4a907)){_0x37c08f=!![];break;}}if(_0x37c08f){const _0x10fb31=await confirmForceOverwrite(_0x243800(0xab));if(!_0x10fb31)throw CliErrors['cancelled']('Force\x20pull\x20cancelled.');}}const _0x5065a1=cloneSqlLockData(_0x572d40),_0x145e35=_0x5065a1[_0x243800(0x72)][_0x549c13[_0x243800(0x89)]],_0x424693=[],_0x2c27a1=[];for(const _0x2a5368 of _0x3d3099){const _0x5cb547=_0x145e35['sqls'][_0x2a5368[_0x243800(0xb2)]],_0x40ef4d=ensureRemoteSqlContent(_0x2a5368),_0x63c21c=detectSqlMode(_0x40ef4d),_0x457a38=_0x2a5368[_0x243800(0x93)]?await getDbName(_0x1e4ddf[_0x243800(0x89)],Number(_0x2a5368[_0x243800(0x93)]))[_0x243800(0xa6)](()=>undefined):undefined,_0x4f7436=buildLocalSqlFileContent({'sqlCode':_0x2a5368[_0x243800(0xb2)],'sqlName':_0x2a5368[_0x243800(0x8f)],'dbId':_0x2a5368[_0x243800(0x93)]},_0x40ef4d,{'dbName':_0x457a38,'mode':_0x63c21c,'syncedAt':new Date()[_0x243800(0xa9)](),'description':_0x2a5368[_0x243800(0x76)]}),_0xec97d8=buildSqlLockEntry(_0x2a5368,_0x40ef4d,computeSqlContentHash(_0x4f7436),{'dbName':_0x457a38}),_0x5230ee=_0xec97d8['path'],_0x97c4e0=join(_0x549c13[_0x243800(0x82)],_0x5230ee);try{const _0x49fb96=await findExistingSqlFiles(_0x549c13,_0x97c4e0,_0x63c21c,_0x5cb547),_0x3dd345=await compareExistingSqlFiles(_0x49fb96,_0x4f7436,_0x63c21c);if(!_0x300e67&&_0x3dd345['some'](({equivalent:_0x233177})=>!_0x233177)){_0x2c27a1['push']({'sqlCode':_0x2a5368[_0x243800(0xb2)],'reason':'local\x20differs\x20from\x20remote'});continue;}const _0x49dde4=_0x3dd345['find'](({file:_0x364985})=>_0x364985[_0x243800(0x7c)]),_0x111bd8=_0x3dd345[_0x243800(0x86)](({file:_0x29bfb1})=>!_0x29bfb1['isCanonical']);if(_0x49dde4?.[_0x243800(0xa0)]&&!_0x111bd8){_0x2c27a1['push']({'sqlCode':_0x2a5368[_0x243800(0xb2)],'reason':_0x243800(0xad)}),_0x145e35[_0x243800(0x9d)][_0x2a5368[_0x243800(0xb2)]]={..._0xec97d8,'hash':computeSqlContentHash(_0x49dde4[_0x243800(0xa8)]),'path':_0x5230ee};continue;}!_0x49dde4?.['equivalent']&&(await ensureParentDirectory(_0x97c4e0),await writeFile(_0x97c4e0,_0x4f7436,_0x243800(0xa1))),_0x111bd8&&await rm(_0x111bd8[_0x243800(0x97)][_0x243800(0x78)],{'force':!![]}),_0x145e35[_0x243800(0x9d)][_0x2a5368[_0x243800(0xb2)]]={..._0xec97d8,'hash':_0x49dde4?.[_0x243800(0xa0)]?computeSqlContentHash(_0x49dde4[_0x243800(0xa8)]):_0xec97d8[_0x243800(0x8c)],'path':_0x5230ee},_0x424693[_0x243800(0xb0)]({'sqlCode':_0x2a5368[_0x243800(0xb2)],'filePath':_0x97c4e0});}catch(_0x36228d){_0x3e0935[_0x243800(0xb0)]({'sqlCode':_0x2a5368[_0x243800(0xb2)],'error':_0x36228d instanceof Error?_0x36228d[_0x243800(0xa5)]:String(_0x36228d)});}}return _0x145e35[_0x243800(0x75)]=new Date()[_0x243800(0xa9)](),await writeSqlLockFile(_0x549c13['lockFilePath'],_0x5065a1),{'ok':_0x3e0935[_0x243800(0x8a)]===0x0,'data':{'pulled':_0x424693,'skipped':_0x2c27a1,'failed':_0x3e0935},'message':_0x243800(0x70)+_0x424693[_0x243800(0x8a)]+_0x243800(0xa2)+_0x2c27a1['length']+'\x20skipped,\x20'+_0x3e0935['length']+_0x243800(0x7e)};}};function a237_0x3ad0(){const _0x53a3f7=['mybatisXml','sql','208ZUMyui','POST','4104108QOZNjo','Pull\x20complete:\x20','name','apps','Force\x20overwrite\x20local\x20unsynced\x20changes','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','lastSync','description','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','filePath','pull','mode','split','isCanonical','totalCount','\x20failed','No\x20remote\x20SQL\x20queries\x20matched.','test','skipped','sqlRootDir','6krNSiv','.xml','path','find','159905kbapIE','endsWith','appCode','length','sqlcode','hash','read','replace','sqlName','map','bool','sqlContent','dbId','all','1742394WnlAoS','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','file','paging','205625pQEeNF','10rapDep','force','663466ZyMGMT','sqls','4PTtcMN','string','equivalent','utf8','\x20written,\x20','11340197IyVtuc','\x20SQL\x20file(s)\x20into\x20','message','catch','str','content','toISOString','trim','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','sqlRoot','unchanged','Would\x20pull\x20','lockFilePath','push','some','sqlCode','tableData','309498WmBQKN'];a237_0x3ad0=function(){return _0x53a3f7;};return a237_0x3ad0();}function isEquivalentPulledSqlFile(_0x4e5448,_0x39200c,_0x93c14f,_0xb57f60){if(_0x93c14f!==_0xb57f60)return normalizePulledSqlBody(_0x4e5448,_0x93c14f)===normalizePulledSqlBody(_0x39200c,_0xb57f60);return normalizePullComparableContent(_0x4e5448,_0x93c14f)===normalizePullComparableContent(_0x39200c,_0xb57f60);}async function findExistingSqlFiles(_0x25c452,_0x135669,_0x172548,_0x16d3a4){const _0x55acb6=a237_0x3ebf86,_0x56fc32=[];await fileExists(_0x135669)&&_0x56fc32[_0x55acb6(0xb0)]({'filePath':_0x135669,'mode':_0x172548,'isCanonical':!![]});if(!_0x16d3a4?.['path'])return _0x56fc32;const _0x50402d=join(_0x25c452[_0x55acb6(0x82)],_0x16d3a4[_0x55acb6(0x85)]);if(_0x50402d===_0x135669)return _0x56fc32;return await fileExists(_0x50402d)&&_0x56fc32[_0x55acb6(0xb0)]({'filePath':_0x50402d,'mode':_0x16d3a4[_0x55acb6(0x7a)]??modeFromFilePath(_0x50402d),'isCanonical':![]}),_0x56fc32;}async function compareExistingSqlFiles(_0x4b6774,_0x22f5bd,_0x254acd){const _0x1820a4=a237_0x3ebf86;return Promise[_0x1820a4(0x94)](_0x4b6774[_0x1820a4(0x90)](async _0x14efe0=>{const _0x461e42=_0x1820a4,_0x2996bf=await readFile(_0x14efe0[_0x461e42(0x78)],'utf8');return{'file':_0x14efe0,'content':_0x2996bf,'equivalent':isEquivalentPulledSqlFile(_0x2996bf,_0x22f5bd,_0x14efe0[_0x461e42(0x7a)],_0x254acd)};}));}function modeFromFilePath(_0x497448){const _0x196f46=a237_0x3ebf86;return _0x497448['toLowerCase']()[_0x196f46(0x88)](_0x196f46(0x84))?_0x196f46(0x6b):_0x196f46(0x6c);}function normalizePulledSqlBody(_0x4d42cb,_0x49eb91){const _0x333198=a237_0x3ebf86;return stripLocalSqlMetadata(_0x4d42cb,_0x49eb91)[_0x333198(0x8e)](/\r\n/g,'\x0a')[_0x333198(0xaa)]();}function normalizePullComparableContent(_0x3897bd,_0x3e1b0a){const _0x48b9c3=a237_0x3ebf86,_0x570a2c=_0x3897bd[_0x48b9c3(0x8e)](/\r\n/g,'\x0a')[_0x48b9c3(0x7b)]('\x0a'),_0x2e303c=_0x570a2c['filter'](_0x159414=>!isSyncedAtMetadataLine(_0x159414,_0x3e1b0a));return _0x2e303c['join']('\x0a');}function isSyncedAtMetadataLine(_0x58110f,_0x3e7fdb){const _0x5aaeb0=a237_0x3ebf86;if(_0x3e7fdb===_0x5aaeb0(0x6b))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x5aaeb0(0x80)](_0x58110f);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x58110f);}
1
+ const a237_0x429b38=a237_0x34f7;(function(_0xf4aa8e,_0x4cc0bb){const _0x530587=a237_0x34f7,_0x37a71f=_0xf4aa8e();while(!![]){try{const _0x1e68ed=-parseInt(_0x530587(0xbf))/0x1*(-parseInt(_0x530587(0xb7))/0x2)+-parseInt(_0x530587(0xa6))/0x3*(-parseInt(_0x530587(0xad))/0x4)+parseInt(_0x530587(0xcc))/0x5+parseInt(_0x530587(0x9b))/0x6+parseInt(_0x530587(0xc2))/0x7+parseInt(_0x530587(0xb4))/0x8+-parseInt(_0x530587(0xd0))/0x9;if(_0x1e68ed===_0x4cc0bb)break;else _0x37a71f['push'](_0x37a71f['shift']());}catch(_0x3eddc2){_0x37a71f['push'](_0x37a71f['shift']());}}}(a237_0x35ee,0x6c96e));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a237_0x35ee(){const _0x337baa=['content','2zGMGCG','split','sqlRootDir','filePath','equivalent','Would\x20pull\x20','apps','find','309691ortJAj','paging','description','4122188shWXMX','totalCount','sqlContent','dbId','appCode','Pull\x20complete:\x20','join','some','sqlName','tableData','472040GrcChf','local\x20differs\x20from\x20remote','sqls','boolean','17926407VydEqy','toLowerCase','all','trim','endsWith','hash','POST','sqlcode','unchanged','str','\x20failed','sqlCode','mybatisXml','sql','filter','lockFilePath','length','mode','would_pull','3729750mRBLdv','\x20skipped,\x20','pull','No\x20remote\x20SQL\x20queries\x20matched.','sqlRoot','Force\x20pull\x20cancelled.','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','path','catch','test','message','365727UMaCtK','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','map','read','isCanonical','.xml','force','4gAcjkQ','lastSync','Filter\x20by\x20SQL\x20display\x20name','replace','name','file','push','5600704IuHuxy','toISOString'];a237_0x35ee=function(){return _0x337baa;};return a237_0x35ee();}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(_0x2ad18d,_0x14e340){const _0x492b4f=a237_0x34f7,_0x18107d=[];let _0x427225=0x1;while(!![]){const _0x574916=await listSqlQueries(_0x2ad18d,{'currentPage':_0x427225,'pageSize':PAGE_SIZE,'sqlCode':_0x14e340['sqlCode'],'sqlName':_0x14e340['sqlName']}),_0x1815bf=_0x574916[_0x492b4f(0xcb)]??[];_0x18107d[_0x492b4f(0xb3)](..._0x1815bf);if(_0x1815bf[_0x492b4f(0x98)]===0x0)break;const _0x5672ca=_0x574916[_0x492b4f(0xc0)]?.[_0x492b4f(0xc3)];if(_0x5672ca!=null?_0x18107d[_0x492b4f(0x98)]>=_0x5672ca:_0x1815bf['length']<PAGE_SIZE)break;_0x427225++;}return _0x18107d;}async function ensureSqlContent(_0x320f68){const _0x13eadd=a237_0x34f7;if(_0x320f68[_0x13eadd(0xc4)]!=null&&String(_0x320f68['sqlContent'])['length']>0x0)return _0x320f68;return getSqlQueryDetail(_0x320f68[_0x13eadd(0xdb)]);}export const sqlPull={'service':a237_0x429b38(0xdd),'command':a237_0x429b38(0x9d),'description':a237_0x429b38(0xa1),'risk':a237_0x429b38(0xa9),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a237_0x429b38(0xb1),'type':'string','description':a237_0x429b38(0xaf)},{'name':a237_0x429b38(0xac),'type':a237_0x429b38(0xcf),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x32c226){const _0x3bc3c3=a237_0x429b38,_0x434731=loadSqlProjectConfig(_0x32c226[_0x3bc3c3(0xc6)]),_0x2582a2=await readSqlLockFile(_0x434731[_0x3bc3c3(0xdf)]),{appLock:_0xae6f2}=ensureSqlLockScope(_0x2582a2??createEmptySqlLock(),_0x434731[_0x3bc3c3(0xc6)],_0x434731[_0x3bc3c3(0x9f)],_0x3bc3c3(0x9d)),_0x14e3d0=await fetchAllSqlQueries(_0x32c226['appCode'],{'sqlCode':_0x32c226[_0x3bc3c3(0xd9)](_0x3bc3c3(0xd7))||undefined,'sqlName':_0x32c226[_0x3bc3c3(0xd9)](_0x3bc3c3(0xb1))||undefined}),_0x425602=[];for(const _0xbf25a8 of _0x14e3d0){const _0x3adc98=await ensureSqlContent(_0xbf25a8),_0x3655d9=ensureRemoteSqlContent(_0x3adc98),_0x301561=detectSqlMode(_0x3655d9),_0xa543c4=_0x3adc98[_0x3bc3c3(0xc5)]?await getDbName(_0x32c226[_0x3bc3c3(0xc6)],Number(_0x3adc98[_0x3bc3c3(0xc5)]))[_0x3bc3c3(0xa3)](()=>undefined):undefined,_0x41a27a=buildLocalSqlFileContent({'sqlCode':_0x3adc98[_0x3bc3c3(0xdb)],'sqlName':_0x3adc98[_0x3bc3c3(0xca)],'dbId':_0x3adc98['dbId']},_0x3655d9,{'dbName':_0xa543c4,'mode':_0x301561,'syncedAt':new Date()[_0x3bc3c3(0xb5)](),'description':_0x3adc98[_0x3bc3c3(0xc1)]}),_0x512fdc=buildSqlLockEntry(_0x3adc98,_0x3655d9,'',{'dbName':_0xa543c4}),_0x307748=resolveLocalSqlFilePath(_0x434731,_0x3adc98[_0x3bc3c3(0xdb)],_0x512fdc);let _0x27f83a=_0x3bc3c3(0x9a),_0x3162d9;const _0x40d0ae=await findExistingSqlFiles(_0x434731,_0x307748,_0x301561,_0xae6f2[_0x3bc3c3(0xce)][_0x3adc98[_0x3bc3c3(0xdb)]]);if(_0x40d0ae['length']>0x0){const _0x3befb3=await compareExistingSqlFiles(_0x40d0ae,_0x41a27a,_0x301561);if(_0x3befb3[_0x3bc3c3(0xc9)](({equivalent:_0x4aa762})=>!_0x4aa762))_0x27f83a='conflict',_0x3162d9='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)';else _0x3befb3[_0x3bc3c3(0x98)]===0x1&&_0x3befb3[0x0]?.[_0x3bc3c3(0xb2)]['isCanonical']&&(_0x27f83a='skipped',_0x3162d9='unchanged');}_0x425602[_0x3bc3c3(0xb3)]({'sqlCode':_0x3adc98[_0x3bc3c3(0xdb)],'sqlName':_0x3adc98['sqlName'],'filePath':_0x307748,'status':_0x27f83a,'reason':_0x3162d9});}return{'method':_0x3bc3c3(0xd6),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x32c226[_0x3bc3c3(0xc6)],'sqlCode':_0x32c226[_0x3bc3c3(0xd9)](_0x3bc3c3(0xd7))||null,'sqlName':_0x32c226[_0x3bc3c3(0xd9)]('name')||null,'files':_0x425602},'description':_0x3bc3c3(0xbc)+_0x425602[_0x3bc3c3(0x98)]+'\x20SQL\x20file(s)\x20into\x20'+_0x434731[_0x3bc3c3(0xb9)]};},async 'execute'(_0x153401){const _0x107105=a237_0x429b38,_0x33477b=loadSqlProjectConfig(_0x153401[_0x107105(0xc6)]),_0x181e1b=await readSqlLockFile(_0x33477b[_0x107105(0xdf)]),{lockData:_0x52af26,appLock:_0x217c91}=ensureSqlLockScope(_0x181e1b??createEmptySqlLock(),_0x33477b[_0x107105(0xc6)],_0x33477b[_0x107105(0x9f)],_0x107105(0x9d)),_0x2b4d77=_0x153401['bool'](_0x107105(0xac)),_0x21f315=await fetchAllSqlQueries(_0x153401[_0x107105(0xc6)],{'sqlCode':_0x153401['str']('sqlcode')||undefined,'sqlName':_0x153401['str'](_0x107105(0xb1))||undefined});if(_0x21f315[_0x107105(0x98)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x107105(0x9e)};const _0x16000c=[],_0x53bcd3=[];for(const _0x29bf1c of _0x21f315){try{_0x16000c['push'](await ensureSqlContent(_0x29bf1c));}catch(_0x29ff90){_0x53bcd3['push']({'sqlCode':_0x29bf1c[_0x107105(0xdb)],'error':_0x29ff90 instanceof Error?_0x29ff90['message']:String(_0x29ff90)});}}if(_0x2b4d77&&!_0x153401['nonInteractive']){let _0x40a1ed=![];for(const _0x4778e4 of _0x16000c){const _0x43dd19=detectSqlMode(ensureRemoteSqlContent(_0x4778e4)),_0x591482=_0x4778e4[_0x107105(0xc5)]?await getDbName(_0x153401[_0x107105(0xc6)],Number(_0x4778e4[_0x107105(0xc5)]))[_0x107105(0xa3)](()=>undefined):undefined,_0xe45f63=buildLocalSqlFileContent({'sqlCode':_0x4778e4['sqlCode'],'sqlName':_0x4778e4['sqlName'],'dbId':_0x4778e4[_0x107105(0xc5)]},ensureRemoteSqlContent(_0x4778e4),{'dbName':_0x591482,'mode':_0x43dd19,'syncedAt':new Date()['toISOString'](),'description':_0x4778e4['description']}),_0x5683de=resolveLocalSqlFilePath(_0x33477b,_0x4778e4[_0x107105(0xdb)],buildSqlLockEntry(_0x4778e4,ensureRemoteSqlContent(_0x4778e4),'',{'dbName':_0x591482})),_0x59e446=await findExistingSqlFiles(_0x33477b,_0x5683de,_0x43dd19,_0x217c91[_0x107105(0xce)][_0x4778e4[_0x107105(0xdb)]]),_0x40b2cf=await compareExistingSqlFiles(_0x59e446,_0xe45f63,_0x43dd19);if(_0x40b2cf[_0x107105(0xc9)](({equivalent:_0x2a0df2})=>!_0x2a0df2)){_0x40a1ed=!![];break;}}if(_0x40a1ed){const _0xcf2bf6=await confirmForceOverwrite(_0x107105(0xa7));if(!_0xcf2bf6)throw CliErrors['cancelled'](_0x107105(0xa0));}}const _0x179e6d=cloneSqlLockData(_0x52af26),_0x458b38=_0x179e6d[_0x107105(0xbd)][_0x33477b[_0x107105(0xc6)]],_0x1eb064=[],_0x2d0b91=[];for(const _0x259d26 of _0x16000c){const _0x599f92=_0x458b38[_0x107105(0xce)][_0x259d26[_0x107105(0xdb)]],_0x401865=ensureRemoteSqlContent(_0x259d26),_0x504178=detectSqlMode(_0x401865),_0x2233b7=_0x259d26[_0x107105(0xc5)]?await getDbName(_0x153401[_0x107105(0xc6)],Number(_0x259d26[_0x107105(0xc5)]))[_0x107105(0xa3)](()=>undefined):undefined,_0x572727=buildLocalSqlFileContent({'sqlCode':_0x259d26[_0x107105(0xdb)],'sqlName':_0x259d26['sqlName'],'dbId':_0x259d26[_0x107105(0xc5)]},_0x401865,{'dbName':_0x2233b7,'mode':_0x504178,'syncedAt':new Date()[_0x107105(0xb5)](),'description':_0x259d26['description']}),_0x5607c4=buildSqlLockEntry(_0x259d26,_0x401865,computeSqlContentHash(_0x572727),{'dbName':_0x2233b7}),_0x34707e=_0x5607c4['path'],_0x29353f=join(_0x33477b['sqlRootDir'],_0x34707e);try{const _0x34ad27=await findExistingSqlFiles(_0x33477b,_0x29353f,_0x504178,_0x599f92),_0x19964e=await compareExistingSqlFiles(_0x34ad27,_0x572727,_0x504178);if(!_0x2b4d77&&_0x19964e[_0x107105(0xc9)](({equivalent:_0xfa4ca7})=>!_0xfa4ca7)){_0x2d0b91[_0x107105(0xb3)]({'sqlCode':_0x259d26[_0x107105(0xdb)],'reason':_0x107105(0xcd)});continue;}const _0x21e622=_0x19964e['find'](({file:_0x44863e})=>_0x44863e[_0x107105(0xaa)]),_0x33d5b5=_0x19964e[_0x107105(0xbe)](({file:_0x3d2a63})=>!_0x3d2a63[_0x107105(0xaa)]);if(_0x21e622?.[_0x107105(0xbb)]&&!_0x33d5b5){_0x2d0b91[_0x107105(0xb3)]({'sqlCode':_0x259d26['sqlCode'],'reason':_0x107105(0xd8)}),_0x458b38[_0x107105(0xce)][_0x259d26['sqlCode']]={..._0x5607c4,'hash':computeSqlContentHash(_0x21e622['content']),'path':_0x34707e};continue;}!_0x21e622?.['equivalent']&&(await ensureParentDirectory(_0x29353f),await writeFile(_0x29353f,_0x572727,'utf8')),_0x33d5b5&&await rm(_0x33d5b5[_0x107105(0xb2)]['filePath'],{'force':!![]}),_0x458b38[_0x107105(0xce)][_0x259d26[_0x107105(0xdb)]]={..._0x5607c4,'hash':_0x21e622?.[_0x107105(0xbb)]?computeSqlContentHash(_0x21e622[_0x107105(0xb6)]):_0x5607c4[_0x107105(0xd5)],'path':_0x34707e},_0x1eb064['push']({'sqlCode':_0x259d26[_0x107105(0xdb)],'filePath':_0x29353f});}catch(_0x257d4f){_0x53bcd3[_0x107105(0xb3)]({'sqlCode':_0x259d26[_0x107105(0xdb)],'error':_0x257d4f instanceof Error?_0x257d4f[_0x107105(0xa5)]:String(_0x257d4f)});}}return _0x458b38[_0x107105(0xae)]=new Date()['toISOString'](),await writeSqlLockFile(_0x33477b[_0x107105(0xdf)],_0x179e6d),{'ok':_0x53bcd3[_0x107105(0x98)]===0x0,'data':{'pulled':_0x1eb064,'skipped':_0x2d0b91,'failed':_0x53bcd3},'message':_0x107105(0xc7)+_0x1eb064[_0x107105(0x98)]+'\x20written,\x20'+_0x2d0b91['length']+_0x107105(0x9c)+_0x53bcd3[_0x107105(0x98)]+_0x107105(0xda)};}};function isEquivalentPulledSqlFile(_0x2d0af6,_0x2adfae,_0x4dc973,_0x4f490a){if(_0x4dc973!==_0x4f490a)return normalizePulledSqlBody(_0x2d0af6,_0x4dc973)===normalizePulledSqlBody(_0x2adfae,_0x4f490a);return normalizePullComparableContent(_0x2d0af6,_0x4dc973)===normalizePullComparableContent(_0x2adfae,_0x4f490a);}async function findExistingSqlFiles(_0x99a44b,_0x1822dd,_0x3650e9,_0x136a31){const _0x18f73d=a237_0x429b38,_0x2ae888=[];await fileExists(_0x1822dd)&&_0x2ae888[_0x18f73d(0xb3)]({'filePath':_0x1822dd,'mode':_0x3650e9,'isCanonical':!![]});if(!_0x136a31?.[_0x18f73d(0xa2)])return _0x2ae888;const _0x155858=join(_0x99a44b[_0x18f73d(0xb9)],_0x136a31['path']);if(_0x155858===_0x1822dd)return _0x2ae888;return await fileExists(_0x155858)&&_0x2ae888['push']({'filePath':_0x155858,'mode':_0x136a31[_0x18f73d(0x99)]??modeFromFilePath(_0x155858),'isCanonical':![]}),_0x2ae888;}function a237_0x34f7(_0x4efc13,_0x1e1f24){_0x4efc13=_0x4efc13-0x98;const _0x35eea4=a237_0x35ee();let _0x34f7b0=_0x35eea4[_0x4efc13];return _0x34f7b0;}async function compareExistingSqlFiles(_0x261a6c,_0x56ae38,_0x527d24){const _0x555bfb=a237_0x429b38;return Promise[_0x555bfb(0xd2)](_0x261a6c[_0x555bfb(0xa8)](async _0x2ac230=>{const _0x28e136=_0x555bfb,_0x16eb89=await readFile(_0x2ac230[_0x28e136(0xba)],'utf8');return{'file':_0x2ac230,'content':_0x16eb89,'equivalent':isEquivalentPulledSqlFile(_0x16eb89,_0x56ae38,_0x2ac230[_0x28e136(0x99)],_0x527d24)};}));}function modeFromFilePath(_0x106b16){const _0x12b1de=a237_0x429b38;return _0x106b16[_0x12b1de(0xd1)]()[_0x12b1de(0xd4)](_0x12b1de(0xab))?_0x12b1de(0xdc):_0x12b1de(0xdd);}function normalizePulledSqlBody(_0x5895aa,_0x54e837){const _0x55d4ee=a237_0x429b38;return stripLocalSqlMetadata(_0x5895aa,_0x54e837)[_0x55d4ee(0xb0)](/\r\n/g,'\x0a')[_0x55d4ee(0xd3)]();}function normalizePullComparableContent(_0x46fec8,_0x12bc12){const _0x2e1b17=a237_0x429b38,_0x4ae787=_0x46fec8['replace'](/\r\n/g,'\x0a')[_0x2e1b17(0xb8)]('\x0a'),_0x4a6b9f=_0x4ae787[_0x2e1b17(0xde)](_0x311dc2=>!isSyncedAtMetadataLine(_0x311dc2,_0x12bc12));return _0x4a6b9f[_0x2e1b17(0xc8)]('\x0a');}function isSyncedAtMetadataLine(_0x3b5d5b,_0x4218d2){const _0x568597=a237_0x429b38;if(_0x4218d2===_0x568597(0xdc))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x568597(0xa4)](_0x3b5d5b);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x568597(0xa4)](_0x3b5d5b);}
@@ -1 +1 @@
1
- const a238_0x1607b9=a238_0x1f9c;(function(_0x3619ec,_0x53d8a8){const _0x2497ef=a238_0x1f9c,_0x59d81a=_0x3619ec();while(!![]){try{const _0x237a22=parseInt(_0x2497ef(0x1ed))/0x1*(-parseInt(_0x2497ef(0x1bb))/0x2)+-parseInt(_0x2497ef(0x1c4))/0x3*(-parseInt(_0x2497ef(0x1e9))/0x4)+parseInt(_0x2497ef(0x1c1))/0x5*(parseInt(_0x2497ef(0x1db))/0x6)+parseInt(_0x2497ef(0x1ac))/0x7+-parseInt(_0x2497ef(0x1da))/0x8+-parseInt(_0x2497ef(0x1d2))/0x9*(-parseInt(_0x2497ef(0x1d9))/0xa)+-parseInt(_0x2497ef(0x1e6))/0xb*(parseInt(_0x2497ef(0x1be))/0xc);if(_0x237a22===_0x53d8a8)break;else _0x59d81a['push'](_0x59d81a['shift']());}catch(_0x50581d){_0x59d81a['push'](_0x59d81a['shift']());}}}(a238_0x90a0,0x2e1b7));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function readSqlUploadContent(_0x24b336){const _0x1a0bf6=a238_0x1f9c,_0x380293=stripLocalSqlMetadata(await readFile(_0x24b336[_0x1a0bf6(0x1b6)],_0x1a0bf6(0x1c7)),_0x24b336[_0x1a0bf6(0x1d7)]);if(!_0x380293[_0x1a0bf6(0x1c8)]())throw CliErrors[_0x1a0bf6(0x1f1)](_0x24b336[_0x1a0bf6(0x1e4)]+_0x1a0bf6(0x1cf));return _0x380293;}async function getTargetSqlQueries(_0x5baa77,_0x5bfa68,_0x5aa520){const _0x551688=a238_0x1f9c,_0xb8e95c=await scanLocalSqlQueries(_0x5baa77),_0x34123b=new Map();for(const _0x1b5b1e of _0xb8e95c){if(_0x5aa520&&_0x1b5b1e['sqlCode']!==_0x5aa520)continue;const _0x55994c=_0x34123b[_0x551688(0x1eb)](_0x1b5b1e[_0x551688(0x1e4)])??[];_0x55994c[_0x551688(0x1d5)](_0x1b5b1e),_0x34123b[_0x551688(0x1f5)](_0x1b5b1e[_0x551688(0x1e4)],_0x55994c);}if(_0x5aa520&&!_0x34123b['has'](_0x5aa520))throw CliErrors[_0x551688(0x1f1)](_0x551688(0x1ef)+_0x5aa520);const _0x47f1cd=[];for(const [_0x40829f,_0x154fb1]of _0x34123b[_0x551688(0x1d0)]()){if(_0x154fb1[_0x551688(0x1b5)]===0x1){_0x47f1cd[_0x551688(0x1d5)](_0x154fb1[0x0]);continue;}const _0x5e1129=_0x5bfa68[_0x551688(0x1f2)][_0x40829f],_0x17e3ff=_0x5e1129?.[_0x551688(0x1ce)],_0x2197bb=_0x17e3ff?_0x154fb1[_0x551688(0x1b9)](_0x3805a1=>_0x3805a1[_0x551688(0x1c0)]!==_0x17e3ff):_0x154fb1;if(_0x5e1129&&_0x2197bb['length']===0x1){_0x47f1cd[_0x551688(0x1d5)](_0x2197bb[0x0]);continue;}throw CliErrors['validation']('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x40829f+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x47f1cd;}export const sqlPush={'service':a238_0x1607b9(0x1ca),'command':a238_0x1607b9(0x1d5),'description':a238_0x1607b9(0x1cb),'risk':a238_0x1607b9(0x1b3),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a238_0x1607b9(0x1d8),'description':a238_0x1607b9(0x1df)}],async 'dryRun'(_0xd857d5){const _0x21b0ed=a238_0x1607b9,_0x3d679d=loadSqlProjectConfig(_0xd857d5[_0x21b0ed(0x1cd)]),_0x13fb9a=await readSqlLockFile(_0x3d679d['lockFilePath']),{appLock:_0x3dee07}=ensureSqlLockScope(_0x13fb9a??createEmptySqlLock(),_0xd857d5[_0x21b0ed(0x1cd)],_0x3d679d[_0x21b0ed(0x1bf)],_0x21b0ed(0x1d5)),_0x519c7a=await getTargetSqlQueries(_0x3d679d,_0x3dee07,_0xd857d5['str']('sqlcode')||undefined),_0x16a951=[];for(const _0x3bed05 of _0x519c7a){const _0x1bf3df=await computeSqlFileHash(_0x3bed05[_0x21b0ed(0x1b6)]),_0x366ffb=_0x3dee07[_0x21b0ed(0x1f2)][_0x3bed05[_0x21b0ed(0x1e4)]],_0x51143e=!!_0x366ffb&&(_0x366ffb[_0x21b0ed(0x1ce)]!==_0x3bed05[_0x21b0ed(0x1c0)]||!!_0x3bed05[_0x21b0ed(0x1e5)]&&_0x366ffb[_0x21b0ed(0x1e5)]!==_0x3bed05[_0x21b0ed(0x1e5)]||_0x366ffb[_0x21b0ed(0x1d7)]!==_0x3bed05[_0x21b0ed(0x1d7)]);if(!_0xd857d5[_0x21b0ed(0x1d4)]('force')&&_0x366ffb&&_0x366ffb[_0x21b0ed(0x1b7)]===_0x1bf3df&&!_0x51143e)continue;if(!_0x366ffb)throw CliErrors['validation'](_0x3bed05['sqlCode']+_0x21b0ed(0x1e1));if(_0x366ffb['version']==null)throw CliErrors['validation'](_0x3bed05[_0x21b0ed(0x1e4)]+_0x21b0ed(0x1ee));await resolveTargetDbBinding(_0xd857d5[_0x21b0ed(0x1cd)],_0x3bed05,_0x366ffb),await readSqlUploadContent(_0x3bed05),_0x16a951[_0x21b0ed(0x1d5)](_0x3bed05[_0x21b0ed(0x1e4)]);}return{'method':_0x21b0ed(0x1af),'url':_0x21b0ed(0x1bc),'body':{'sqlCodes':_0x16a951,'appCode':_0xd857d5[_0x21b0ed(0x1cd)]},'description':_0x21b0ed(0x1d3)+_0x16a951['length']+_0x21b0ed(0x1ec)};},async 'execute'(_0x21c25d){const _0x2a6ebd=a238_0x1607b9,_0x4a3784=loadSqlProjectConfig(_0x21c25d[_0x2a6ebd(0x1cd)]),_0x515fb5=await readSqlLockFile(_0x4a3784['lockFilePath']),{lockData:_0x59798e,appLock:_0x3fcf3c}=ensureSqlLockScope(_0x515fb5??createEmptySqlLock(),_0x21c25d[_0x2a6ebd(0x1cd)],_0x4a3784[_0x2a6ebd(0x1bf)],_0x2a6ebd(0x1d5)),_0x9bac2b=await getTargetSqlQueries(_0x4a3784,_0x3fcf3c,_0x21c25d[_0x2a6ebd(0x1cc)](_0x2a6ebd(0x1c5))||undefined);if(_0x9bac2b['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x2a6ebd(0x1ea)};const _0x4691ea=[],_0x226999=[],_0x17a21d=[];let _0x4b365e=![];for(const _0x1f56d8 of _0x9bac2b){const _0x2abc93=_0x3fcf3c[_0x2a6ebd(0x1f2)][_0x1f56d8['sqlCode']];if(!_0x2abc93){_0x17a21d['push']({'sqlCode':_0x1f56d8[_0x2a6ebd(0x1e4)],'error':_0x2a6ebd(0x1b1)});continue;}try{const _0x31a892=await computeSqlFileHash(_0x1f56d8['filePath']),_0x3b6d4d=_0x2abc93[_0x2a6ebd(0x1ce)]!==_0x1f56d8[_0x2a6ebd(0x1c0)]||!!_0x1f56d8[_0x2a6ebd(0x1e5)]&&_0x2abc93['sqlName']!==_0x1f56d8[_0x2a6ebd(0x1e5)]||_0x2abc93['mode']!==_0x1f56d8[_0x2a6ebd(0x1d7)];if(!_0x21c25d['bool'](_0x2a6ebd(0x1e3))&&_0x2abc93['hash']===_0x31a892&&!_0x3b6d4d){_0x226999[_0x2a6ebd(0x1d5)]({'sqlCode':_0x1f56d8['sqlCode'],'reason':_0x2a6ebd(0x1de)});continue;}if(_0x2abc93['version']==null){_0x17a21d[_0x2a6ebd(0x1d5)]({'sqlCode':_0x1f56d8[_0x2a6ebd(0x1e4)],'error':_0x2a6ebd(0x1e7)});continue;}const _0x26b8bd=_0x1f56d8[_0x2a6ebd(0x1e5)]||_0x2abc93['sqlName'],_0x2f3755=await resolveTargetDbBinding(_0x21c25d[_0x2a6ebd(0x1cd)],_0x1f56d8,_0x2abc93),_0x287380=await readSqlUploadContent(_0x1f56d8),_0x2c382c=await updateSqlQuery({'id':_0x2abc93[_0x2a6ebd(0x1f0)],'appCode':_0x21c25d[_0x2a6ebd(0x1cd)],'sqlCode':_0x1f56d8[_0x2a6ebd(0x1e4)],'sqlName':_0x26b8bd,'dbId':_0x2f3755[_0x2a6ebd(0x1e8)],'version':_0x2abc93[_0x2a6ebd(0x1ad)],'sqlContent':_0x287380,'sqlConfig':_0x2abc93[_0x2a6ebd(0x1f4)]??undefined}),_0x29143a=_0x2c382c['dbId']?await getDbName(_0x21c25d['appCode'],Number(_0x2c382c[_0x2a6ebd(0x1e8)]))['catch'](()=>_0x2f3755[_0x2a6ebd(0x1c3)]):_0x2f3755['dbName'];_0x3fcf3c[_0x2a6ebd(0x1f2)][_0x1f56d8[_0x2a6ebd(0x1e4)]]={...buildSqlLockEntry(_0x2c382c,_0x287380,_0x31a892,{'dbName':_0x29143a}),'path':_0x1f56d8['relativePath'],'mode':_0x1f56d8[_0x2a6ebd(0x1d7)]},_0x4b365e=!![],await archivePreviousSqlFileIfNeeded(_0x4a3784,_0x2abc93[_0x2a6ebd(0x1ce)],_0x1f56d8[_0x2a6ebd(0x1c0)]),_0x4691ea[_0x2a6ebd(0x1d5)]({'sqlCode':_0x1f56d8[_0x2a6ebd(0x1e4)],'remoteId':_0x2abc93[_0x2a6ebd(0x1f0)]});}catch(_0xc3caf7){_0x17a21d[_0x2a6ebd(0x1d5)]({'sqlCode':_0x1f56d8[_0x2a6ebd(0x1e4)],'error':_0xc3caf7 instanceof Error?_0xc3caf7[_0x2a6ebd(0x1ba)]:String(_0xc3caf7)});}}(_0x4b365e||_0x17a21d['length']===0x0)&&(_0x3fcf3c[_0x2a6ebd(0x1f3)]=new Date()['toISOString'](),await writeSqlLockFile(_0x4a3784[_0x2a6ebd(0x1dc)],_0x59798e));const _0x1eb05b=_0x17a21d['length']===0x0;return{'ok':_0x1eb05b,'data':{'pushed':_0x4691ea,'skipped':_0x226999,'failed':_0x17a21d},'message':'Push\x20complete:\x20'+_0x4691ea[_0x2a6ebd(0x1b5)]+_0x2a6ebd(0x1b0)+_0x226999['length']+_0x2a6ebd(0x1c2)+_0x17a21d[_0x2a6ebd(0x1b5)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0xd0f876,_0x146284,_0x451eb3){const _0x211f93=a238_0x1607b9;if(!_0x146284||_0x146284===_0x451eb3)return;const _0x41a6f9=join(_0xd0f876[_0x211f93(0x1c9)],_0x146284);if(!await fileExists(_0x41a6f9))return;const _0x5ed962=await moveToTrash(_0xd0f876['projectRoot'],_0xd0f876['trashDir'],_0x41a6f9);await cleanupEmptyDirectories(dirname(_0x41a6f9),_0xd0f876[_0x211f93(0x1c9)]),void _0x5ed962;}async function moveToTrash(_0x445730,_0x316ce8,_0x22aa3b){const _0x2456b8=a238_0x1607b9,_0x48d668=new Date()[_0x2456b8(0x1ae)]()[_0x2456b8(0x1b8)](/[:.]/g,'-'),_0x1d7e88=relative(_0x445730,_0x22aa3b),_0x3a5a28=join(_0x316ce8,_0x48d668,_0x1d7e88);return await mkdir(dirname(_0x3a5a28),{'recursive':!![]}),await rename(_0x22aa3b,_0x3a5a28),_0x3a5a28;}async function cleanupEmptyDirectories(_0x320c6f,_0x387cc6){let _0x1b8ad3=resolve(_0x320c6f);const _0x6ea9e3=resolve(_0x387cc6);while(_0x1b8ad3['startsWith'](''+_0x6ea9e3+sep)||_0x1b8ad3===_0x6ea9e3){if(_0x1b8ad3===_0x6ea9e3)return;try{const _0x6f532b=await readdir(_0x1b8ad3);if(_0x6f532b['length']>0x0)return;await rmdir(_0x1b8ad3);}catch{return;}_0x1b8ad3=dirname(_0x1b8ad3);}}function a238_0x1f9c(_0x4b5c07,_0x4262f1){_0x4b5c07=_0x4b5c07-0x1ac;const _0x90a0e0=a238_0x90a0();let _0x1f9cb8=_0x90a0e0[_0x4b5c07];return _0x1f9cb8;}async function resolveTargetDbBinding(_0xaff0be,_0x5461c8,_0x3ca11b){const _0x28d7d5=a238_0x1607b9,_0x2e31f1=_0x5461c8[_0x28d7d5(0x1e2)];if(!_0x2e31f1)return{'dbId':_0x3ca11b[_0x28d7d5(0x1e8)],'dbName':_0x3ca11b[_0x28d7d5(0x1c3)]};const _0x5ec824=buildDbDirectoryName(_0x3ca11b['dbName'],_0x3ca11b[_0x28d7d5(0x1e8)]);if(_0x2e31f1===_0x5ec824)return{'dbId':_0x3ca11b[_0x28d7d5(0x1e8)],'dbName':_0x3ca11b[_0x28d7d5(0x1c3)]};const _0x6964cc=parseExplicitDbDirectory(_0x2e31f1);if(_0x6964cc!=null)return{'dbId':_0x6964cc,'dbName':await getDbName(_0xaff0be,_0x6964cc)['catch'](()=>undefined)};const _0xdec6aa=await listDatabases(_0xaff0be),_0x3b0d28=_0xdec6aa['filter'](_0x43ae5a=>buildDbDirectoryName(_0x43ae5a[_0x28d7d5(0x1c3)],_0x43ae5a[_0x28d7d5(0x1e8)])===_0x2e31f1);if(_0x3b0d28[_0x28d7d5(0x1b5)]===0x1)return{'dbId':_0x3b0d28[0x0][_0x28d7d5(0x1e8)],'dbName':_0x3b0d28[0x0][_0x28d7d5(0x1c3)]};if(_0x3b0d28[_0x28d7d5(0x1b5)]===0x0)throw CliErrors[_0x28d7d5(0x1f1)](_0x28d7d5(0x1d6)+_0x2e31f1+_0x28d7d5(0x1bd)+_0x5461c8[_0x28d7d5(0x1e4)]+'.');const _0x11e864=_0x3b0d28[_0x28d7d5(0x1c6)](_0x2152de=>_0x2152de[_0x28d7d5(0x1c3)]+'\x20('+_0x2152de['dbId']+')')[_0x28d7d5(0x1e0)](',\x20');throw CliErrors[_0x28d7d5(0x1f1)](_0x28d7d5(0x1dd)+_0x2e31f1+_0x28d7d5(0x1d1)+_0x5461c8[_0x28d7d5(0x1e4)]+':\x20'+_0x11e864);}function parseExplicitDbDirectory(_0x494091){const _0x411ee9=a238_0x1607b9,_0x299b38=/^db-(\d+)$/[_0x411ee9(0x1b4)](_0x494091);if(!_0x299b38)return null;const _0x90a0bb=Number(_0x299b38[0x1]);return Number[_0x411ee9(0x1b2)](_0x90a0bb)&&_0x90a0bb>0x0?_0x90a0bb:null;}function a238_0x90a0(){const _0x1e8fdf=['hash','replace','filter','message','2gmNwoh','/smartapi/custom/updateUserCustomSql','\x22\x20for\x20sqlCode\x20','60936KWpYWc','sqlRoot','relativePath','82610kLgsta','\x20skipped,\x20','dbName','3xXbpRq','sqlcode','map','utf8','trim','sqlRootDir','sql','Push\x20local\x20SQL\x20files\x20to\x20remote','str','appCode','path',':\x20SQL\x20content\x20is\x20empty.','entries','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','92223WkMEKh','Would\x20push\x20','bool','push','No\x20database\x20matches\x20local\x20directory\x20\x22','mode','boolean','200XyhAOp','331768SuOvZD','18zrgtrn','lockFilePath','Local\x20directory\x20\x22','unchanged','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','join',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','dbDirectory','force','sqlCode','sqlName','77RuXaIo','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','dbId','1034428xjPmti','No\x20local\x20SQL\x20files\x20found.','get','\x20SQL\x20file(s)','317459RrxgHO',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','Local\x20SQL\x20not\x20found:\x20','remoteId','validation','sqls','lastSync','sqlConfig','set','491526Udujaq','version','toISOString','POST','\x20pushed,\x20','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','isFinite','write','exec','length','filePath'];a238_0x90a0=function(){return _0x1e8fdf;};return a238_0x90a0();}
1
+ const a238_0x463884=a238_0x4b6a;function a238_0x3d63(){const _0x3ccf0e=[':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','Push\x20local\x20SQL\x20files\x20to\x20remote','trashDir','catch','sql','\x22\x20for\x20sqlCode\x20','boolean','remoteId','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','utf8','entries','get','dbName','force','sqlcode','validation','replace','set','89954XrXgOg','write','exec','2hRkzGi','path','No\x20database\x20matches\x20local\x20directory\x20\x22','760170wrVZne','isFinite','toISOString','659185aMCZbB','version','No\x20local\x20SQL\x20files\x20found.','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','filePath','8572725tpqeUL','filter','sqls','join','Push\x20complete:\x20','1466955mHlnYY','\x20skipped,\x20','Would\x20push\x20',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','sqlRootDir','map','452784gqZqCk',':\x20SQL\x20content\x20is\x20empty.','Local\x20SQL\x20not\x20found:\x20','dbId','28qpxNjP','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','push','sqlRoot','sqlName','3094056YRmjgo','sqlCode','\x20pushed,\x20','has','POST','length','projectRoot','\x20SQL\x20file(s)','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','relativePath','mode','lockFilePath','appCode','startsWith','hash'];a238_0x3d63=function(){return _0x3ccf0e;};return a238_0x3d63();}(function(_0x2879cf,_0x4693ad){const _0x29ac4d=a238_0x4b6a,_0x5c780a=_0x2879cf();while(!![]){try{const _0x24ba7c=-parseInt(_0x29ac4d(0xf4))/0x1*(-parseInt(_0x29ac4d(0xf7))/0x2)+parseInt(_0x29ac4d(0x107))/0x3+-parseInt(_0x29ac4d(0x10d))/0x4+-parseInt(_0x29ac4d(0xfd))/0x5+-parseInt(_0x29ac4d(0xfa))/0x6*(-parseInt(_0x29ac4d(0x111))/0x7)+parseInt(_0x29ac4d(0x117))/0x8+-parseInt(_0x29ac4d(0x102))/0x9;if(_0x24ba7c===_0x4693ad)break;else _0x5c780a['push'](_0x5c780a['shift']());}catch(_0x112c0d){_0x5c780a['push'](_0x5c780a['shift']());}}}(a238_0x3d63,0x431e6));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a238_0x4b6a(_0x4c58f1,_0x3a8629){_0x4c58f1=_0x4c58f1-0xea;const _0x3d633a=a238_0x3d63();let _0x4b6a68=_0x3d633a[_0x4c58f1];return _0x4b6a68;}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(_0x38cebd){const _0x4a324e=a238_0x4b6a,_0x21f809=stripLocalSqlMetadata(await readFile(_0x38cebd['filePath'],_0x4a324e(0xeb)),_0x38cebd[_0x4a324e(0x121)]);if(!_0x21f809['trim']())throw CliErrors[_0x4a324e(0xf1)](_0x38cebd[_0x4a324e(0x118)]+_0x4a324e(0x10e));return _0x21f809;}async function getTargetSqlQueries(_0x42c5eb,_0x5b0ef8,_0x26bef5){const _0x28b994=a238_0x4b6a,_0x4722fb=await scanLocalSqlQueries(_0x42c5eb),_0x4db0d3=new Map();for(const _0x191585 of _0x4722fb){if(_0x26bef5&&_0x191585[_0x28b994(0x118)]!==_0x26bef5)continue;const _0xa07dd8=_0x4db0d3[_0x28b994(0xed)](_0x191585['sqlCode'])??[];_0xa07dd8[_0x28b994(0x114)](_0x191585),_0x4db0d3[_0x28b994(0xf3)](_0x191585[_0x28b994(0x118)],_0xa07dd8);}if(_0x26bef5&&!_0x4db0d3[_0x28b994(0x11a)](_0x26bef5))throw CliErrors[_0x28b994(0xf1)](_0x28b994(0x10f)+_0x26bef5);const _0x3c4121=[];for(const [_0xc70b33,_0x3d0c47]of _0x4db0d3[_0x28b994(0xec)]()){if(_0x3d0c47[_0x28b994(0x11c)]===0x1){_0x3c4121[_0x28b994(0x114)](_0x3d0c47[0x0]);continue;}const _0x24eae3=_0x5b0ef8['sqls'][_0xc70b33],_0x572fab=_0x24eae3?.['path'],_0x202b60=_0x572fab?_0x3d0c47['filter'](_0x5773d4=>_0x5773d4['relativePath']!==_0x572fab):_0x3d0c47;if(_0x24eae3&&_0x202b60[_0x28b994(0x11c)]===0x1){_0x3c4121[_0x28b994(0x114)](_0x202b60[0x0]);continue;}throw CliErrors[_0x28b994(0xf1)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0xc70b33+_0x28b994(0x112));}return _0x3c4121;}export const sqlPush={'service':a238_0x463884(0x12a),'command':'push','description':a238_0x463884(0x127),'risk':a238_0x463884(0xf5),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a238_0x463884(0xef),'type':a238_0x463884(0x12c),'description':a238_0x463884(0x113)}],async 'dryRun'(_0x5821a4){const _0x5ed8de=a238_0x463884,_0x1f9ded=loadSqlProjectConfig(_0x5821a4[_0x5ed8de(0x123)]),_0x299c68=await readSqlLockFile(_0x1f9ded['lockFilePath']),{appLock:_0x57669d}=ensureSqlLockScope(_0x299c68??createEmptySqlLock(),_0x5821a4['appCode'],_0x1f9ded[_0x5ed8de(0x115)],_0x5ed8de(0x114)),_0x171c95=await getTargetSqlQueries(_0x1f9ded,_0x57669d,_0x5821a4['str'](_0x5ed8de(0xf0))||undefined),_0x5e0f2d=[];for(const _0x1c1fbd of _0x171c95){const _0x20d5e3=await computeSqlFileHash(_0x1c1fbd['filePath']),_0x105990=_0x57669d[_0x5ed8de(0x104)][_0x1c1fbd['sqlCode']],_0x1774a2=!!_0x105990&&(_0x105990[_0x5ed8de(0xf8)]!==_0x1c1fbd['relativePath']||!!_0x1c1fbd[_0x5ed8de(0x116)]&&_0x105990['sqlName']!==_0x1c1fbd[_0x5ed8de(0x116)]||_0x105990['mode']!==_0x1c1fbd[_0x5ed8de(0x121)]);if(!_0x5821a4['bool'](_0x5ed8de(0xef))&&_0x105990&&_0x105990['hash']===_0x20d5e3&&!_0x1774a2)continue;if(!_0x105990)throw CliErrors['validation'](_0x1c1fbd[_0x5ed8de(0x118)]+_0x5ed8de(0x126));if(_0x105990[_0x5ed8de(0xfe)]==null)throw CliErrors[_0x5ed8de(0xf1)](_0x1c1fbd[_0x5ed8de(0x118)]+_0x5ed8de(0x10a));await resolveTargetDbBinding(_0x5821a4[_0x5ed8de(0x123)],_0x1c1fbd,_0x105990),await readSqlUploadContent(_0x1c1fbd),_0x5e0f2d[_0x5ed8de(0x114)](_0x1c1fbd[_0x5ed8de(0x118)]);}return{'method':_0x5ed8de(0x11b),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x5e0f2d,'appCode':_0x5821a4[_0x5ed8de(0x123)]},'description':_0x5ed8de(0x109)+_0x5e0f2d[_0x5ed8de(0x11c)]+_0x5ed8de(0x11e)};},async 'execute'(_0x2eee7e){const _0x527c47=a238_0x463884,_0x3151c9=loadSqlProjectConfig(_0x2eee7e[_0x527c47(0x123)]),_0x399319=await readSqlLockFile(_0x3151c9[_0x527c47(0x122)]),{lockData:_0x15c1f8,appLock:_0x3ccee8}=ensureSqlLockScope(_0x399319??createEmptySqlLock(),_0x2eee7e[_0x527c47(0x123)],_0x3151c9['sqlRoot'],_0x527c47(0x114)),_0x1a9f6c=await getTargetSqlQueries(_0x3151c9,_0x3ccee8,_0x2eee7e['str'](_0x527c47(0xf0))||undefined);if(_0x1a9f6c[_0x527c47(0x11c)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x527c47(0xff)};const _0x384a1b=[],_0x639edb=[],_0x5bce87=[];let _0x337cd1=![];for(const _0x3fd6c5 of _0x1a9f6c){const _0x28f843=_0x3ccee8['sqls'][_0x3fd6c5[_0x527c47(0x118)]];if(!_0x28f843){_0x5bce87[_0x527c47(0x114)]({'sqlCode':_0x3fd6c5[_0x527c47(0x118)],'error':_0x527c47(0xea)});continue;}try{const _0x384c78=await computeSqlFileHash(_0x3fd6c5[_0x527c47(0x101)]),_0x2e7747=_0x28f843[_0x527c47(0xf8)]!==_0x3fd6c5[_0x527c47(0x120)]||!!_0x3fd6c5[_0x527c47(0x116)]&&_0x28f843['sqlName']!==_0x3fd6c5[_0x527c47(0x116)]||_0x28f843[_0x527c47(0x121)]!==_0x3fd6c5['mode'];if(!_0x2eee7e['bool'](_0x527c47(0xef))&&_0x28f843[_0x527c47(0x125)]===_0x384c78&&!_0x2e7747){_0x639edb[_0x527c47(0x114)]({'sqlCode':_0x3fd6c5[_0x527c47(0x118)],'reason':'unchanged'});continue;}if(_0x28f843[_0x527c47(0xfe)]==null){_0x5bce87[_0x527c47(0x114)]({'sqlCode':_0x3fd6c5[_0x527c47(0x118)],'error':_0x527c47(0x100)});continue;}const _0xc0b66d=_0x3fd6c5['sqlName']||_0x28f843[_0x527c47(0x116)],_0x48ebd9=await resolveTargetDbBinding(_0x2eee7e['appCode'],_0x3fd6c5,_0x28f843),_0x1a0295=await readSqlUploadContent(_0x3fd6c5),_0x785a61=await updateSqlQuery({'id':_0x28f843[_0x527c47(0x12d)],'appCode':_0x2eee7e[_0x527c47(0x123)],'sqlCode':_0x3fd6c5[_0x527c47(0x118)],'sqlName':_0xc0b66d,'dbId':_0x48ebd9[_0x527c47(0x110)],'version':_0x28f843[_0x527c47(0xfe)],'sqlContent':_0x1a0295,'sqlConfig':_0x28f843['sqlConfig']??undefined}),_0x5d6ea3=_0x785a61['dbId']?await getDbName(_0x2eee7e[_0x527c47(0x123)],Number(_0x785a61[_0x527c47(0x110)]))[_0x527c47(0x129)](()=>_0x48ebd9[_0x527c47(0xee)]):_0x48ebd9[_0x527c47(0xee)];_0x3ccee8[_0x527c47(0x104)][_0x3fd6c5['sqlCode']]={...buildSqlLockEntry(_0x785a61,_0x1a0295,_0x384c78,{'dbName':_0x5d6ea3}),'path':_0x3fd6c5[_0x527c47(0x120)],'mode':_0x3fd6c5[_0x527c47(0x121)]},_0x337cd1=!![],await archivePreviousSqlFileIfNeeded(_0x3151c9,_0x28f843[_0x527c47(0xf8)],_0x3fd6c5[_0x527c47(0x120)]),_0x384a1b['push']({'sqlCode':_0x3fd6c5[_0x527c47(0x118)],'remoteId':_0x28f843[_0x527c47(0x12d)]});}catch(_0x52be34){_0x5bce87[_0x527c47(0x114)]({'sqlCode':_0x3fd6c5[_0x527c47(0x118)],'error':_0x52be34 instanceof Error?_0x52be34['message']:String(_0x52be34)});}}(_0x337cd1||_0x5bce87[_0x527c47(0x11c)]===0x0)&&(_0x3ccee8['lastSync']=new Date()[_0x527c47(0xfc)](),await writeSqlLockFile(_0x3151c9[_0x527c47(0x122)],_0x15c1f8));const _0x45d68a=_0x5bce87[_0x527c47(0x11c)]===0x0;return{'ok':_0x45d68a,'data':{'pushed':_0x384a1b,'skipped':_0x639edb,'failed':_0x5bce87},'message':_0x527c47(0x106)+_0x384a1b[_0x527c47(0x11c)]+_0x527c47(0x119)+_0x639edb['length']+_0x527c47(0x108)+_0x5bce87['length']+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0xce9e59,_0x2ef548,_0x14e8b8){const _0x58b441=a238_0x463884;if(!_0x2ef548||_0x2ef548===_0x14e8b8)return;const _0x25df9c=join(_0xce9e59[_0x58b441(0x10b)],_0x2ef548);if(!await fileExists(_0x25df9c))return;const _0x52837d=await moveToTrash(_0xce9e59[_0x58b441(0x11d)],_0xce9e59[_0x58b441(0x128)],_0x25df9c);await cleanupEmptyDirectories(dirname(_0x25df9c),_0xce9e59[_0x58b441(0x10b)]),void _0x52837d;}async function moveToTrash(_0x1d2eeb,_0x1a6ba3,_0x150a87){const _0x2e412e=a238_0x463884,_0x485f8d=new Date()[_0x2e412e(0xfc)]()[_0x2e412e(0xf2)](/[:.]/g,'-'),_0x493128=relative(_0x1d2eeb,_0x150a87),_0x3eb19e=join(_0x1a6ba3,_0x485f8d,_0x493128);return await mkdir(dirname(_0x3eb19e),{'recursive':!![]}),await rename(_0x150a87,_0x3eb19e),_0x3eb19e;}async function cleanupEmptyDirectories(_0x20fe7d,_0x448e25){const _0x33b5f9=a238_0x463884;let _0x3c1105=resolve(_0x20fe7d);const _0x49d774=resolve(_0x448e25);while(_0x3c1105[_0x33b5f9(0x124)](''+_0x49d774+sep)||_0x3c1105===_0x49d774){if(_0x3c1105===_0x49d774)return;try{const _0x5d20e6=await readdir(_0x3c1105);if(_0x5d20e6[_0x33b5f9(0x11c)]>0x0)return;await rmdir(_0x3c1105);}catch{return;}_0x3c1105=dirname(_0x3c1105);}}async function resolveTargetDbBinding(_0xea0f6e,_0x50a77d,_0x30c24f){const _0x45559e=a238_0x463884,_0x43bc8c=_0x50a77d['dbDirectory'];if(!_0x43bc8c)return{'dbId':_0x30c24f[_0x45559e(0x110)],'dbName':_0x30c24f[_0x45559e(0xee)]};const _0x22eb91=buildDbDirectoryName(_0x30c24f[_0x45559e(0xee)],_0x30c24f[_0x45559e(0x110)]);if(_0x43bc8c===_0x22eb91)return{'dbId':_0x30c24f[_0x45559e(0x110)],'dbName':_0x30c24f[_0x45559e(0xee)]};const _0x19c5fe=parseExplicitDbDirectory(_0x43bc8c);if(_0x19c5fe!=null)return{'dbId':_0x19c5fe,'dbName':await getDbName(_0xea0f6e,_0x19c5fe)[_0x45559e(0x129)](()=>undefined)};const _0x262b9f=await listDatabases(_0xea0f6e),_0x5c1715=_0x262b9f[_0x45559e(0x103)](_0x343946=>buildDbDirectoryName(_0x343946['dbName'],_0x343946[_0x45559e(0x110)])===_0x43bc8c);if(_0x5c1715[_0x45559e(0x11c)]===0x1)return{'dbId':_0x5c1715[0x0][_0x45559e(0x110)],'dbName':_0x5c1715[0x0]['dbName']};if(_0x5c1715[_0x45559e(0x11c)]===0x0)throw CliErrors[_0x45559e(0xf1)](_0x45559e(0xf9)+_0x43bc8c+_0x45559e(0x12b)+_0x50a77d[_0x45559e(0x118)]+'.');const _0x274e47=_0x5c1715[_0x45559e(0x10c)](_0x1ff25a=>_0x1ff25a[_0x45559e(0xee)]+'\x20('+_0x1ff25a['dbId']+')')[_0x45559e(0x105)](',\x20');throw CliErrors[_0x45559e(0xf1)]('Local\x20directory\x20\x22'+_0x43bc8c+_0x45559e(0x11f)+_0x50a77d[_0x45559e(0x118)]+':\x20'+_0x274e47);}function parseExplicitDbDirectory(_0x30bccc){const _0x2a7c4f=a238_0x463884,_0x46651e=/^db-(\d+)$/[_0x2a7c4f(0xf6)](_0x30bccc);if(!_0x46651e)return null;const _0x5e4280=Number(_0x46651e[0x1]);return Number[_0x2a7c4f(0xfb)](_0x5e4280)&&_0x5e4280>0x0?_0x5e4280:null;}
@@ -1 +1 @@
1
- function a239_0x262f(){const _0x58bdc0=['910550VXLMTv','2ZTNopZ','801GOyNhe','replace','trimStart','stdin','lastSync','path','body','mode','endsWith','filter','close','test','declaration','5Ybuuee','join','6992802Xujgdy','length','sqlCode','3199sAXkVR','sqlRoot','syncedAt','sqlName','question','--\x20@lovrabet.','\x20[y/N]\x20','18488TbnxLc','88wlPAzA','apps','mybatisXml','dbName','description','dbId','split','\x20-->','5462238GBmcZW','version','11944UCXZMM','29913zEuKXr','includes','map','entries','slice','sqlContent','trim','6684ySpyiS','160818dMjSXn'];a239_0x262f=function(){return _0x58bdc0;};return a239_0x262f();}(function(_0x563382,_0x4c6acd){const _0x371a03=a239_0x3129,_0x193cce=_0x563382();while(!![]){try{const _0x25a19e=-parseInt(_0x371a03(0x12c))/0x1*(-parseInt(_0x371a03(0x12e))/0x2)+-parseInt(_0x371a03(0x12f))/0x3*(parseInt(_0x371a03(0x153))/0x4)+parseInt(_0x371a03(0x13c))/0x5*(parseInt(_0x371a03(0x151))/0x6)+-parseInt(_0x371a03(0x141))/0x7*(parseInt(_0x371a03(0x148))/0x8)+parseInt(_0x371a03(0x13e))/0x9+-parseInt(_0x371a03(0x12d))/0xa*(parseInt(_0x371a03(0x149))/0xb)+-parseInt(_0x371a03(0x12b))/0xc*(-parseInt(_0x371a03(0x154))/0xd);if(_0x25a19e===_0x4c6acd)break;else _0x193cce['push'](_0x193cce['shift']());}catch(_0x127a3b){_0x193cce['push'](_0x193cce['shift']());}}}(a239_0x262f,0x85c9d));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x26d2fb,_0x128ec7,_0x146b55,_0x5bcd46){const _0x46750a=a239_0x3129,_0x5ee42a=detectSqlMode(_0x128ec7);return{'path':buildSqlRelativePath(_0x26d2fb[_0x46750a(0x140)],_0x26d2fb['sqlName'],_0x5bcd46?.[_0x46750a(0x14c)],_0x5ee42a,_0x26d2fb['dbId']),'hash':_0x146b55,'remoteId':_0x26d2fb['id'],'version':_0x26d2fb[_0x46750a(0x152)],'dbId':Number(_0x26d2fb[_0x46750a(0x14e)]),'dbName':_0x5bcd46?.['dbName'],'sqlName':_0x26d2fb[_0x46750a(0x144)],'sqlConfig':_0x26d2fb['sqlConfig']??undefined,'mode':_0x5ee42a};}export function cloneSqlLockData(_0x342669){const _0x6cd212=a239_0x3129;return{'apps':Object['fromEntries'](Object[_0x6cd212(0x127)](_0x342669[_0x6cd212(0x14a)])[_0x6cd212(0x126)](([_0x7b667f,_0x1174f])=>[_0x7b667f,{'sqlRoot':_0x1174f[_0x6cd212(0x142)],'lastSync':_0x1174f[_0x6cd212(0x133)],'sqls':{..._0x1174f['sqls']}}]))};}export function ensureRemoteSqlContent(_0x2230dd){const _0x2c65d7=a239_0x3129;return _0x2230dd[_0x2c65d7(0x129)]??'';}export function buildLocalSqlFileContent(_0x5a1a64,_0x5e66a3,_0x492e79){const _0x23938b=a239_0x3129,_0x2fa7e7=_0x492e79?.[_0x23938b(0x136)]??detectSqlMode(_0x5e66a3),_0x5dcb2e=stripLocalSqlMetadata(_0x5e66a3,_0x2fa7e7)[_0x23938b(0x12a)](),_0x4b6923=buildMetadataHeaderLines({'sqlCode':_0x5a1a64[_0x23938b(0x140)],'sqlName':_0x5a1a64[_0x23938b(0x144)],'dbId':_0x5a1a64['dbId'],'dbName':_0x492e79?.[_0x23938b(0x14c)],'mode':_0x2fa7e7,'syncedAt':_0x492e79?.[_0x23938b(0x143)],'description':_0x492e79?.[_0x23938b(0x14d)]},_0x2fa7e7),_0x2f8eff=_0x2fa7e7===_0x23938b(0x14b)?splitXmlDeclaration(_0x5dcb2e):{'body':_0x5dcb2e},_0x5ddbdc=[..._0x2f8eff[_0x23938b(0x13b)]?[_0x2f8eff[_0x23938b(0x13b)]]:[],..._0x4b6923,'',_0x2f8eff[_0x23938b(0x135)][_0x23938b(0x131)]()],_0x5d078e=_0x5ddbdc['join']('\x0a');return _0x5d078e[_0x23938b(0x137)]('\x0a')?_0x5d078e:_0x5d078e+'\x0a';}export function stripLocalSqlMetadata(_0xa15ef1,_0x656766){const _0xbf4848=a239_0x3129;if(_0x656766==='mybatisXml'){const {declaration:_0x529af8,body:_0x533389}=splitXmlDeclaration(_0xa15ef1['replace'](/\r\n/g,'\x0a')),_0x3b4118=stripLeadingMetadataLines(_0x533389,/^\s*<!--\s*@lovrabet\./);return _0x529af8?''+_0x529af8+(_0x3b4118?'\x0a'+_0x3b4118:''):_0x3b4118;}return stripLeadingMetadataLines(_0xa15ef1[_0xbf4848(0x130)](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0x2e9aaa,_0x49be6b){if(_0x49be6b?.['mode'])return _0x49be6b['mode'];return detectSqlMode(_0x2e9aaa);}export function resolveSqlFileName(_0x281940,_0x57aa9f,_0x501a99){const _0x43e531=a239_0x3129;if(_0x501a99?.[_0x43e531(0x134)])return _0x501a99[_0x43e531(0x134)];if(_0x501a99?.['sqlName']||_0x501a99?.[_0x43e531(0x14c)])return buildSqlRelativePath(_0x281940,_0x501a99?.['sqlName'],_0x501a99?.[_0x43e531(0x14c)],resolveSqlMode(_0x57aa9f,_0x501a99),_0x501a99?.[_0x43e531(0x14e)]);return buildDefaultSqlFileName(_0x281940,resolveSqlMode(_0x57aa9f,_0x501a99));}export function resolveSqlLocalDir(_0x176ded,_0xc54442){return join(_0x176ded,SQL_LOCAL_REL_DIR,_0xc54442);}export async function confirmForceOverwrite(_0x428636){const _0x4ea43d=a239_0x3129,_0x2d63a3=createInterface({'input':process[_0x4ea43d(0x132)],'output':process['stderr']}),_0x36eec1=await new Promise(_0x17c5f2=>{const _0x4585cd=_0x4ea43d;_0x2d63a3[_0x4585cd(0x145)](_0x428636+_0x4585cd(0x147),_0x17c5f2);});return _0x2d63a3[_0x4ea43d(0x139)](),['y','yes'][_0x4ea43d(0x155)](_0x36eec1[_0x4ea43d(0x12a)]()['toLowerCase']());}function a239_0x3129(_0x4de3d0,_0x76a196){_0x4de3d0=_0x4de3d0-0x126;const _0x262fc9=a239_0x262f();let _0x31298e=_0x262fc9[_0x4de3d0];return _0x31298e;}export function findSqlLockScope(_0x4651b9,_0x4d5912){const _0x47e54=a239_0x3129;return _0x4651b9[_0x47e54(0x14a)][_0x4d5912];}function buildMetadataHeaderLines(_0x25c2b2,_0x2cd9dc){const _0x2f8a84=a239_0x3129,_0x2a9ff3=[[_0x2f8a84(0x140),_0x25c2b2[_0x2f8a84(0x140)]],[_0x2f8a84(0x144),_0x25c2b2[_0x2f8a84(0x144)]],['dbId',_0x25c2b2[_0x2f8a84(0x14e)]],[_0x2f8a84(0x14c),_0x25c2b2[_0x2f8a84(0x14c)]],[_0x2f8a84(0x136),_0x25c2b2[_0x2f8a84(0x136)]],['syncedAt',_0x25c2b2['syncedAt']],['description',_0x25c2b2['description']]];if(_0x2cd9dc==='mybatisXml')return _0x2a9ff3[_0x2f8a84(0x138)](([,_0x57dcf8])=>_0x57dcf8!==undefined&&_0x57dcf8!==null&&String(_0x57dcf8)[_0x2f8a84(0x12a)]()!=='')[_0x2f8a84(0x126)](([_0x20b138,_0x44fc77])=>'<!--\x20@lovrabet.'+_0x20b138+':\x20'+String(_0x44fc77)+_0x2f8a84(0x150));return _0x2a9ff3[_0x2f8a84(0x138)](([,_0x28ce4d])=>_0x28ce4d!==undefined&&_0x28ce4d!==null&&String(_0x28ce4d)[_0x2f8a84(0x12a)]()!=='')[_0x2f8a84(0x126)](([_0x84c0a,_0x5c2181])=>_0x2f8a84(0x146)+_0x84c0a+':\x20'+String(_0x5c2181));}function splitXmlDeclaration(_0x5cebd9){const _0x34054b=a239_0x3129,_0x56e7f7=_0x5cebd9[_0x34054b(0x131)](),_0x33e7c3=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i['exec'](_0x56e7f7);if(!_0x33e7c3)return{'body':_0x5cebd9};return{'declaration':_0x33e7c3[0x0],'body':_0x56e7f7[_0x34054b(0x128)](_0x33e7c3[0x0][_0x34054b(0x13f)])};}function stripLeadingMetadataLines(_0x1888a3,_0x1e8edf){const _0x38355f=a239_0x3129,_0xd182d1=_0x1888a3[_0x38355f(0x14f)]('\x0a');let _0x1c8925=0x0;while(_0x1c8925<_0xd182d1[_0x38355f(0x13f)]){const _0x4b3e90=_0xd182d1[_0x1c8925]??'';if(_0x1e8edf[_0x38355f(0x13a)](_0x4b3e90)||_0x4b3e90[_0x38355f(0x12a)]()===''){_0x1c8925++;continue;}break;}return _0xd182d1[_0x38355f(0x128)](_0x1c8925)[_0x38355f(0x13d)]('\x0a')['trimStart']();}
1
+ const a239_0x57c26d=a239_0x4c88;function a239_0x4c88(_0x474670,_0x475718){_0x474670=_0x474670-0xbd;const _0x415a98=a239_0x415a();let _0x4c884a=_0x415a98[_0x474670];return _0x4c884a;}(function(_0x3fa940,_0x2efe4b){const _0x39b797=a239_0x4c88,_0x26d4e0=_0x3fa940();while(!![]){try{const _0x3c8b67=parseInt(_0x39b797(0xc4))/0x1+-parseInt(_0x39b797(0xcb))/0x2*(-parseInt(_0x39b797(0xcd))/0x3)+-parseInt(_0x39b797(0xd3))/0x4+-parseInt(_0x39b797(0xda))/0x5+parseInt(_0x39b797(0xe8))/0x6+-parseInt(_0x39b797(0xcc))/0x7*(-parseInt(_0x39b797(0xd6))/0x8)+parseInt(_0x39b797(0xdf))/0x9*(-parseInt(_0x39b797(0xd9))/0xa);if(_0x3c8b67===_0x2efe4b)break;else _0x26d4e0['push'](_0x26d4e0['shift']());}catch(_0x435e8b){_0x26d4e0['push'](_0x26d4e0['shift']());}}}(a239_0x415a,0xcd17b));import{createInterface}from'node:readline';import{join}from'node:path';function a239_0x415a(){const _0x58aaff=['mode','dbName','7778128DAzdHg','mybatisXml','apps','2782980GxSJIu','658350sUtzxl','body','map','--\x20@lovrabet.','filter','90LIbQCv','sqls','\x20[y/N]\x20','dbId','replace','sqlContent','sqlName','declaration','length','8485830MZUfgY','.rabetbase/sql','trim','\x20-->','close','lastSync','yes','description','syncedAt','path','1049710maJavR','join','trimStart','version','sqlConfig','fromEntries','stdin','79488EDDGUX','7gNurHw','30XLqNaN','sqlCode','split','test','entries','exec','316048kCfwpZ'];a239_0x415a=function(){return _0x58aaff;};return a239_0x415a();}import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a239_0x57c26d(0xe9);export function buildSqlLockEntry(_0x984f3d,_0x3c5abf,_0x447780,_0x5c666d){const _0x532d4c=a239_0x57c26d,_0x438aeb=detectSqlMode(_0x3c5abf);return{'path':buildSqlRelativePath(_0x984f3d['sqlCode'],_0x984f3d['sqlName'],_0x5c666d?.['dbName'],_0x438aeb,_0x984f3d[_0x532d4c(0xe2)]),'hash':_0x447780,'remoteId':_0x984f3d['id'],'version':_0x984f3d[_0x532d4c(0xc7)],'dbId':Number(_0x984f3d['dbId']),'dbName':_0x5c666d?.['dbName'],'sqlName':_0x984f3d[_0x532d4c(0xe5)],'sqlConfig':_0x984f3d[_0x532d4c(0xc8)]??undefined,'mode':_0x438aeb};}export function cloneSqlLockData(_0x3f8708){const _0x1c087b=a239_0x57c26d;return{'apps':Object[_0x1c087b(0xc9)](Object[_0x1c087b(0xd1)](_0x3f8708[_0x1c087b(0xd8)])[_0x1c087b(0xdc)](([_0x5e993d,_0x2a0356])=>[_0x5e993d,{'sqlRoot':_0x2a0356['sqlRoot'],'lastSync':_0x2a0356[_0x1c087b(0xbf)],'sqls':{..._0x2a0356[_0x1c087b(0xe0)]}}]))};}export function ensureRemoteSqlContent(_0x565a8f){const _0x7cec16=a239_0x57c26d;return _0x565a8f[_0x7cec16(0xe4)]??'';}export function buildLocalSqlFileContent(_0x11dd29,_0x3d38c6,_0x593e29){const _0x365b0d=a239_0x57c26d,_0x4b758b=_0x593e29?.[_0x365b0d(0xd4)]??detectSqlMode(_0x3d38c6),_0x1be625=stripLocalSqlMetadata(_0x3d38c6,_0x4b758b)[_0x365b0d(0xea)](),_0x561b65=buildMetadataHeaderLines({'sqlCode':_0x11dd29[_0x365b0d(0xce)],'sqlName':_0x11dd29['sqlName'],'dbId':_0x11dd29['dbId'],'dbName':_0x593e29?.[_0x365b0d(0xd5)],'mode':_0x4b758b,'syncedAt':_0x593e29?.['syncedAt'],'description':_0x593e29?.[_0x365b0d(0xc1)]},_0x4b758b),_0x1f16a9=_0x4b758b===_0x365b0d(0xd7)?splitXmlDeclaration(_0x1be625):{'body':_0x1be625},_0x4f3993=[..._0x1f16a9[_0x365b0d(0xe6)]?[_0x1f16a9[_0x365b0d(0xe6)]]:[],..._0x561b65,'',_0x1f16a9[_0x365b0d(0xdb)][_0x365b0d(0xc6)]()],_0x4211f4=_0x4f3993['join']('\x0a');return _0x4211f4['endsWith']('\x0a')?_0x4211f4:_0x4211f4+'\x0a';}export function stripLocalSqlMetadata(_0x2c8451,_0x48d9ee){const _0xbb27bc=a239_0x57c26d;if(_0x48d9ee===_0xbb27bc(0xd7)){const {declaration:_0x2d92b3,body:_0x27d935}=splitXmlDeclaration(_0x2c8451[_0xbb27bc(0xe3)](/\r\n/g,'\x0a')),_0xb3c70c=stripLeadingMetadataLines(_0x27d935,/^\s*<!--\s*@lovrabet\./);return _0x2d92b3?''+_0x2d92b3+(_0xb3c70c?'\x0a'+_0xb3c70c:''):_0xb3c70c;}return stripLeadingMetadataLines(_0x2c8451[_0xbb27bc(0xe3)](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0xf13b69,_0x23518f){const _0x25da67=a239_0x57c26d;if(_0x23518f?.[_0x25da67(0xd4)])return _0x23518f[_0x25da67(0xd4)];return detectSqlMode(_0xf13b69);}export function resolveSqlFileName(_0x147f3e,_0x18f5ed,_0x5b5b4e){const _0x13e12b=a239_0x57c26d;if(_0x5b5b4e?.[_0x13e12b(0xc3)])return _0x5b5b4e[_0x13e12b(0xc3)];if(_0x5b5b4e?.['sqlName']||_0x5b5b4e?.[_0x13e12b(0xd5)])return buildSqlRelativePath(_0x147f3e,_0x5b5b4e?.['sqlName'],_0x5b5b4e?.[_0x13e12b(0xd5)],resolveSqlMode(_0x18f5ed,_0x5b5b4e),_0x5b5b4e?.[_0x13e12b(0xe2)]);return buildDefaultSqlFileName(_0x147f3e,resolveSqlMode(_0x18f5ed,_0x5b5b4e));}export function resolveSqlLocalDir(_0x3a6aef,_0x283696){return join(_0x3a6aef,SQL_LOCAL_REL_DIR,_0x283696);}export async function confirmForceOverwrite(_0x59133b){const _0x21bdf5=a239_0x57c26d,_0x5ed9c4=createInterface({'input':process[_0x21bdf5(0xca)],'output':process['stderr']}),_0x6a918a=await new Promise(_0x529e3c=>{const _0x23d313=_0x21bdf5;_0x5ed9c4['question'](_0x59133b+_0x23d313(0xe1),_0x529e3c);});return _0x5ed9c4[_0x21bdf5(0xbe)](),['y',_0x21bdf5(0xc0)]['includes'](_0x6a918a['trim']()['toLowerCase']());}export function findSqlLockScope(_0x14531d,_0x239c58){const _0x1d976d=a239_0x57c26d;return _0x14531d[_0x1d976d(0xd8)][_0x239c58];}function buildMetadataHeaderLines(_0x298171,_0xc49081){const _0x38ebbf=a239_0x57c26d,_0x48a5aa=[[_0x38ebbf(0xce),_0x298171[_0x38ebbf(0xce)]],[_0x38ebbf(0xe5),_0x298171[_0x38ebbf(0xe5)]],[_0x38ebbf(0xe2),_0x298171[_0x38ebbf(0xe2)]],[_0x38ebbf(0xd5),_0x298171[_0x38ebbf(0xd5)]],[_0x38ebbf(0xd4),_0x298171[_0x38ebbf(0xd4)]],[_0x38ebbf(0xc2),_0x298171[_0x38ebbf(0xc2)]],[_0x38ebbf(0xc1),_0x298171[_0x38ebbf(0xc1)]]];if(_0xc49081===_0x38ebbf(0xd7))return _0x48a5aa[_0x38ebbf(0xde)](([,_0x5b1964])=>_0x5b1964!==undefined&&_0x5b1964!==null&&String(_0x5b1964)[_0x38ebbf(0xea)]()!=='')[_0x38ebbf(0xdc)](([_0x1524eb,_0x523da4])=>'<!--\x20@lovrabet.'+_0x1524eb+':\x20'+String(_0x523da4)+_0x38ebbf(0xbd));return _0x48a5aa[_0x38ebbf(0xde)](([,_0x414c41])=>_0x414c41!==undefined&&_0x414c41!==null&&String(_0x414c41)[_0x38ebbf(0xea)]()!=='')[_0x38ebbf(0xdc)](([_0x174dfa,_0x58f4d9])=>_0x38ebbf(0xdd)+_0x174dfa+':\x20'+String(_0x58f4d9));}function splitXmlDeclaration(_0x5f0cef){const _0x30170d=a239_0x57c26d,_0x1bb911=_0x5f0cef[_0x30170d(0xc6)](),_0x4f8fdc=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i[_0x30170d(0xd2)](_0x1bb911);if(!_0x4f8fdc)return{'body':_0x5f0cef};return{'declaration':_0x4f8fdc[0x0],'body':_0x1bb911['slice'](_0x4f8fdc[0x0][_0x30170d(0xe7)])};}function stripLeadingMetadataLines(_0x20c414,_0x5849ec){const _0x5cc855=a239_0x57c26d,_0x2dabe9=_0x20c414[_0x5cc855(0xcf)]('\x0a');let _0x3f3d83=0x0;while(_0x3f3d83<_0x2dabe9[_0x5cc855(0xe7)]){const _0x199bff=_0x2dabe9[_0x3f3d83]??'';if(_0x5849ec[_0x5cc855(0xd0)](_0x199bff)||_0x199bff[_0x5cc855(0xea)]()===''){_0x3f3d83++;continue;}break;}return _0x2dabe9['slice'](_0x3f3d83)[_0x5cc855(0xc5)]('\x0a')[_0x5cc855(0xc6)]();}