@lovrabet/rabetbase-cli 2.5.8-beta.2 → 2.5.9-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. package/README.md +6 -6
  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/detail.js +1 -1
  27. package/lib/commands/app/index.js +1 -1
  28. package/lib/commands/app/list.js +1 -1
  29. package/lib/commands/app/members-list.js +1 -1
  30. package/lib/commands/app/remote-directory.js +1 -1
  31. package/lib/commands/app/shared.js +1 -1
  32. package/lib/commands/app-config/delete.js +1 -1
  33. package/lib/commands/app-config/get.js +1 -1
  34. package/lib/commands/app-config/index.js +1 -1
  35. package/lib/commands/app-config/list.js +1 -1
  36. package/lib/commands/app-config/set.js +1 -1
  37. package/lib/commands/app-config/shared.js +1 -1
  38. package/lib/commands/auth/index.js +1 -1
  39. package/lib/commands/bff/create.js +1 -1
  40. package/lib/commands/bff/delete.js +1 -1
  41. package/lib/commands/bff/detail.js +1 -1
  42. package/lib/commands/bff/index.js +1 -1
  43. package/lib/commands/bff/list.js +1 -1
  44. package/lib/commands/bff/logs.js +1 -1
  45. package/lib/commands/bff/pull.js +1 -1
  46. package/lib/commands/bff/push.js +1 -1
  47. package/lib/commands/bff/status.js +1 -1
  48. package/lib/commands/cli-skill/index.js +1 -1
  49. package/lib/commands/cli-update.js +1 -1
  50. package/lib/commands/codegen/index.js +1 -1
  51. package/lib/commands/codegen/sdk.js +1 -1
  52. package/lib/commands/codegen/sql.js +1 -1
  53. package/lib/commands/common/app-registry.js +1 -1
  54. package/lib/commands/common/app-selector.js +1 -1
  55. package/lib/commands/common/async-task.js +1 -1
  56. package/lib/commands/common/dry-run.js +1 -1
  57. package/lib/commands/common/flags.js +1 -1
  58. package/lib/commands/common/local-file.js +1 -1
  59. package/lib/commands/common/validate.js +1 -1
  60. package/lib/commands/config/delete.js +1 -1
  61. package/lib/commands/config/get.js +1 -1
  62. package/lib/commands/config/index.js +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/design-context.js +1 -1
  78. package/lib/commands/dataset/design-start.js +1 -1
  79. package/lib/commands/dataset/design-status.js +1 -1
  80. package/lib/commands/dataset/design-sync-retry.js +1 -1
  81. package/lib/commands/dataset/design-sync-status.js +1 -1
  82. package/lib/commands/dataset/design-validate.js +1 -1
  83. package/lib/commands/dataset/detail.js +1 -1
  84. package/lib/commands/dataset/extend-update.js +1 -1
  85. package/lib/commands/dataset/field-restore.js +1 -1
  86. package/lib/commands/dataset/field-update.js +1 -1
  87. package/lib/commands/dataset/generate.js +1 -1
  88. package/lib/commands/dataset/index.js +1 -1
  89. package/lib/commands/dataset/list.js +1 -1
  90. package/lib/commands/dataset/operations.js +1 -1
  91. package/lib/commands/dataset/relation-audit.js +1 -1
  92. package/lib/commands/dataset/relation-create.js +1 -1
  93. package/lib/commands/dataset/relation-delete.js +1 -1
  94. package/lib/commands/dataset/relation-shared.js +1 -1
  95. package/lib/commands/dataset/relation-update.js +1 -1
  96. package/lib/commands/dataset/relations.js +1 -1
  97. package/lib/commands/dataset/rename.js +1 -1
  98. package/lib/commands/dataset/restore.js +1 -1
  99. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  100. package/lib/commands/db/analysis-batching.js +1 -1
  101. package/lib/commands/db/analyze-batch-plan.js +1 -1
  102. package/lib/commands/db/analyze-cancel.js +1 -1
  103. package/lib/commands/db/analyze-start.js +1 -1
  104. package/lib/commands/db/analyze-status.js +1 -1
  105. package/lib/commands/db/create.js +1 -1
  106. package/lib/commands/db/cross-db-analysis-shared.js +1 -1
  107. package/lib/commands/db/cross-db-analyze-latest.js +1 -1
  108. package/lib/commands/db/cross-db-analyze-start.js +1 -1
  109. package/lib/commands/db/cross-db-analyze-status.js +1 -1
  110. package/lib/commands/db/delete.js +1 -1
  111. package/lib/commands/db/detail.js +1 -1
  112. package/lib/commands/db/diff-refresh-start.js +1 -1
  113. package/lib/commands/db/diff-refresh-status.js +1 -1
  114. package/lib/commands/db/diff.js +1 -1
  115. package/lib/commands/db/index.js +1 -1
  116. package/lib/commands/db/list.js +1 -1
  117. package/lib/commands/db/shared.js +1 -1
  118. package/lib/commands/db/table-diff-shared.js +1 -1
  119. package/lib/commands/db/tables.js +1 -1
  120. package/lib/commands/db/test.js +1 -1
  121. package/lib/commands/db/update.js +1 -1
  122. package/lib/commands/deployment/index.js +1 -1
  123. package/lib/commands/deployment/sync-all.js +1 -1
  124. package/lib/commands/deployment/sync-jobs.js +1 -1
  125. package/lib/commands/deployment/sync-status.js +1 -1
  126. package/lib/commands/doctor.js +1 -1
  127. package/lib/commands/file/index.js +1 -1
  128. package/lib/commands/flow/create.js +1 -1
  129. package/lib/commands/flow/detail.js +1 -1
  130. package/lib/commands/flow/index.js +1 -1
  131. package/lib/commands/flow/list.js +1 -1
  132. package/lib/commands/flow/page-list.js +1 -1
  133. package/lib/commands/flow/publish.js +1 -1
  134. package/lib/commands/flow/runtime-resources-shared.js +1 -1
  135. package/lib/commands/flow/runtime-role-list.js +1 -1
  136. package/lib/commands/flow/runtime-role-user-list.js +1 -1
  137. package/lib/commands/flow/runtime-user-search.js +1 -1
  138. package/lib/commands/flow/shared.js +1 -1
  139. package/lib/commands/flow/update.js +1 -1
  140. package/lib/commands/flow/validate.js +1 -1
  141. package/lib/commands/instant-api-policy/current.js +1 -1
  142. package/lib/commands/instant-api-policy/index.js +1 -1
  143. package/lib/commands/instant-api-policy/init.js +1 -1
  144. package/lib/commands/instant-api-policy/publish.js +1 -1
  145. package/lib/commands/instant-api-policy/pull.js +1 -1
  146. package/lib/commands/instant-api-policy/revision.js +1 -1
  147. package/lib/commands/instant-api-policy/revisions.js +1 -1
  148. package/lib/commands/instant-api-policy/rollback.js +1 -1
  149. package/lib/commands/instant-api-policy/shared.js +1 -1
  150. package/lib/commands/instant-api-policy/validate.js +1 -1
  151. package/lib/commands/issue/index.js +1 -1
  152. package/lib/commands/issue/nudge.js +1 -1
  153. package/lib/commands/issue/report.js +1 -1
  154. package/lib/commands/issue/shared.js +1 -1
  155. package/lib/commands/kb/create.js +1 -1
  156. package/lib/commands/kb/delete.js +1 -1
  157. package/lib/commands/kb/detail.js +1 -1
  158. package/lib/commands/kb/index.js +1 -1
  159. package/lib/commands/kb/list.js +1 -1
  160. package/lib/commands/kb/search.js +1 -1
  161. package/lib/commands/kb/shared.d.ts +8 -5
  162. package/lib/commands/kb/shared.js +1 -1
  163. package/lib/commands/kb/update.js +1 -1
  164. package/lib/commands/logs/index.js +1 -1
  165. package/lib/commands/menu/asset-update.js +1 -1
  166. package/lib/commands/menu/delete.js +1 -1
  167. package/lib/commands/menu/external-link-create.js +1 -1
  168. package/lib/commands/menu/external-link-update.js +1 -1
  169. package/lib/commands/menu/group-create.js +1 -1
  170. package/lib/commands/menu/group-update.js +1 -1
  171. package/lib/commands/menu/index.js +1 -1
  172. package/lib/commands/menu/list.js +1 -1
  173. package/lib/commands/menu/move.js +1 -1
  174. package/lib/commands/menu/regroup-start.js +1 -1
  175. package/lib/commands/menu/rename.js +1 -1
  176. package/lib/commands/menu/shared/compare-table.js +1 -1
  177. package/lib/commands/menu/shared/delete-plan.js +1 -1
  178. package/lib/commands/menu/shared/facts.js +1 -1
  179. package/lib/commands/menu/shared/index.js +1 -1
  180. package/lib/commands/menu/shared/inquirer.js +1 -1
  181. package/lib/commands/menu/shared/local-pages.js +1 -1
  182. package/lib/commands/menu/shared/logic.js +1 -1
  183. package/lib/commands/menu/shared/mutations.js +1 -1
  184. package/lib/commands/menu/shared/path.js +1 -1
  185. package/lib/commands/menu/shared/service.js +1 -1
  186. package/lib/commands/menu/shared/subapp-assets.js +1 -1
  187. package/lib/commands/menu/shared/sync-core.js +1 -1
  188. package/lib/commands/menu/shared/update-core.js +1 -1
  189. package/lib/commands/menu/shared/valid-url.js +1 -1
  190. package/lib/commands/menu/subapp-assets-status.js +1 -1
  191. package/lib/commands/menu/subapp-assets-update.js +1 -1
  192. package/lib/commands/menu/sync.js +1 -1
  193. package/lib/commands/menu/visibility-update.js +1 -1
  194. package/lib/commands/notification/config-create.js +1 -1
  195. package/lib/commands/notification/config-delete.js +1 -1
  196. package/lib/commands/notification/config-list.js +1 -1
  197. package/lib/commands/notification/config-update.js +1 -1
  198. package/lib/commands/notification/index.js +1 -1
  199. package/lib/commands/notification/shared.js +1 -1
  200. package/lib/commands/ocr/index.js +1 -1
  201. package/lib/commands/page/create.js +1 -1
  202. package/lib/commands/page/custom/detail.js +1 -1
  203. package/lib/commands/page/custom/list.js +1 -1
  204. package/lib/commands/page/custom/publish.js +1 -1
  205. package/lib/commands/page/custom/shared.js +1 -1
  206. package/lib/commands/page/custom/syntax.js +1 -1
  207. package/lib/commands/page/custom/update.js +1 -1
  208. package/lib/commands/page/data-list-status.js +1 -1
  209. package/lib/commands/page/generate-start.js +1 -1
  210. package/lib/commands/page/generate-status.js +1 -1
  211. package/lib/commands/page/index.js +1 -1
  212. package/lib/commands/page/pull.js +1 -1
  213. package/lib/commands/page/push.js +1 -1
  214. package/lib/commands/page/relation-audit.js +1 -1
  215. package/lib/commands/page/restore.js +1 -1
  216. package/lib/commands/page/shared.js +1 -1
  217. package/lib/commands/page/sync.js +1 -1
  218. package/lib/commands/project/api-architecture-upgrade.js +1 -1
  219. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  220. package/lib/commands/project/create/format-elapsed.js +1 -1
  221. package/lib/commands/project/create/main.js +1 -1
  222. package/lib/commands/project/create/materialize-project-template.js +1 -1
  223. package/lib/commands/project/create/project-name.js +1 -1
  224. package/lib/commands/project/create/project-template-archive.js +1 -1
  225. package/lib/commands/project/create/project-template-path.js +1 -1
  226. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  227. package/lib/commands/project/create/use-format-code.js +1 -1
  228. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  229. package/lib/commands/project/domain-routing-sync.js +1 -1
  230. package/lib/commands/project/index.js +1 -1
  231. package/lib/commands/project/upgrade.js +1 -1
  232. package/lib/commands/registry.js +1 -1
  233. package/lib/commands/role/delete.js +1 -1
  234. package/lib/commands/role/detail.js +1 -1
  235. package/lib/commands/role/index.js +1 -1
  236. package/lib/commands/role/list.js +1 -1
  237. package/lib/commands/role/shared.js +1 -1
  238. package/lib/commands/role/update.js +1 -1
  239. package/lib/commands/role/user-add.js +1 -1
  240. package/lib/commands/role/user-remove.js +1 -1
  241. package/lib/commands/role/user-resolve.js +1 -1
  242. package/lib/commands/rule/get.js +1 -1
  243. package/lib/commands/rule/index.js +1 -1
  244. package/lib/commands/rule/list.js +1 -1
  245. package/lib/commands/rule/set.js +1 -1
  246. package/lib/commands/rule/shared.d.ts +5 -3
  247. package/lib/commands/rule/shared.js +1 -1
  248. package/lib/commands/run/index.js +1 -1
  249. package/lib/commands/schema.js +1 -1
  250. package/lib/commands/sql/create.js +1 -1
  251. package/lib/commands/sql/delete.js +1 -1
  252. package/lib/commands/sql/detail.js +1 -1
  253. package/lib/commands/sql/exec.js +1 -1
  254. package/lib/commands/sql/index.js +1 -1
  255. package/lib/commands/sql/list.js +1 -1
  256. package/lib/commands/sql/pull.js +1 -1
  257. package/lib/commands/sql/push.js +1 -1
  258. package/lib/commands/sql/shared.js +1 -1
  259. package/lib/commands/sql/status.js +1 -1
  260. package/lib/commands/sql/validate.js +1 -1
  261. package/lib/commands/task/index.js +1 -1
  262. package/lib/commands/task/status.js +1 -1
  263. package/lib/commands/tenant/index.js +1 -1
  264. package/lib/commands/tenant/members-list.js +1 -1
  265. package/lib/commands/tenant/shared.js +1 -1
  266. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  267. package/lib/commands/user-account/feishu-bind.js +1 -1
  268. package/lib/commands/user-account/index.js +1 -1
  269. package/lib/commands/workspace/add.js +1 -1
  270. package/lib/commands/workspace/index.js +1 -1
  271. package/lib/commands/workspace/remove.js +1 -1
  272. package/lib/config/domain-config.js +1 -1
  273. package/lib/config/project-domain-routing.js +1 -1
  274. package/lib/config/region-config.js +1 -1
  275. package/lib/config/schema.js +1 -1
  276. package/lib/constant/cdn.js +1 -1
  277. package/lib/constant/cli.js +1 -1
  278. package/lib/constant/defaults.js +1 -1
  279. package/lib/constant/domain.js +1 -1
  280. package/lib/constant/env.js +1 -1
  281. package/lib/constant/output.js +1 -1
  282. package/lib/constant/paths.js +1 -1
  283. package/lib/constant/region.js +1 -1
  284. package/lib/constant/risk.js +1 -1
  285. package/lib/constant/routing-profile.js +1 -1
  286. package/lib/context/app-resolver.js +1 -1
  287. package/lib/context/auth-resolver.js +1 -1
  288. package/lib/context/config-loader.js +1 -1
  289. package/lib/context.js +1 -1
  290. package/lib/core/alias-resolver.js +1 -1
  291. package/lib/core/api-client.d.ts +14 -11
  292. package/lib/core/api-client.js +1 -1
  293. package/lib/core/bff/config.js +1 -1
  294. package/lib/core/bff/file-system.js +1 -1
  295. package/lib/core/bff/hash.js +1 -1
  296. package/lib/core/bff/hook-directory.js +1 -1
  297. package/lib/core/bff/lock.js +1 -1
  298. package/lib/core/bff/utils.js +1 -1
  299. package/lib/core/cross-db-analysis.js +1 -1
  300. package/lib/core/cross-db-relation.js +1 -1
  301. package/lib/core/db-resolver.js +1 -1
  302. package/lib/core/flow-config.js +1 -1
  303. package/lib/core/instant-api-policy/config.js +1 -1
  304. package/lib/core/kb-management-client.d.ts +2 -2
  305. package/lib/core/kb-management-client.js +1 -1
  306. package/lib/core/kb-search-client.d.ts +3 -1
  307. package/lib/core/kb-search-client.js +1 -1
  308. package/lib/core/page/file-system.js +1 -1
  309. package/lib/core/page/hash.js +1 -1
  310. package/lib/core/page/lock.js +1 -1
  311. package/lib/core/page/lr-smart-jsx.js +1 -1
  312. package/lib/core/sql-index-auditor.js +1 -1
  313. package/lib/core/sql-sync/config.js +1 -1
  314. package/lib/core/sql-sync/file-system.js +1 -1
  315. package/lib/core/sql-sync/hash.js +1 -1
  316. package/lib/core/sql-sync/lock.js +1 -1
  317. package/lib/core/sql-sync/utils.js +1 -1
  318. package/lib/core/sql-validator.js +1 -1
  319. package/lib/errors.js +1 -1
  320. package/lib/framework/build-all-flags.js +1 -1
  321. package/lib/framework/error-output.js +1 -1
  322. package/lib/framework/explicit-yes.js +1 -1
  323. package/lib/framework/flags.js +1 -1
  324. package/lib/framework/help.js +1 -1
  325. package/lib/framework/index.js +1 -1
  326. package/lib/framework/output.js +1 -1
  327. package/lib/framework/response.js +1 -1
  328. package/lib/framework/runner-alias.js +1 -1
  329. package/lib/framework/runner.js +1 -1
  330. package/lib/framework/schema-export.js +1 -1
  331. package/lib/framework/supported-flags.js +1 -1
  332. package/lib/framework/types.js +1 -1
  333. package/lib/generated/build-info.d.ts +4 -4
  334. package/lib/generated/build-info.js +1 -1
  335. package/lib/generated/official-routing.js +1 -1
  336. package/lib/generated/routing-contract.js +1 -1
  337. package/lib/help.js +1 -1
  338. package/lib/postinstall.js +1 -1
  339. package/lib/runtime/confirmation.js +1 -1
  340. package/lib/runtime/event.js +1 -1
  341. package/lib/runtime/index.js +1 -1
  342. package/lib/runtime/queue.js +1 -1
  343. package/lib/runtime/resolve.js +1 -1
  344. package/lib/services/dataset-design/checkpoint.js +1 -1
  345. package/lib/services/dataset-design/commands.js +1 -1
  346. package/lib/services/dataset-design/contract.js +1 -1
  347. package/lib/skills/builtin-skill.js +1 -1
  348. package/lib/skills/main.js +1 -1
  349. package/lib/skills/npx-skills-add.js +1 -1
  350. package/lib/skills/skill-presence.js +1 -1
  351. package/lib/telemetry/cli-command-trace.js +1 -1
  352. package/lib/telemetry/cli-help-trace.js +1 -1
  353. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  354. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  355. package/lib/telemetry/send-cli-trace-log.js +1 -1
  356. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  357. package/lib/utils/ai_config.js +1 -1
  358. package/lib/utils/apply-jq-filter.js +1 -1
  359. package/lib/utils/cdn-config.js +1 -1
  360. package/lib/utils/check-sdk-version.js +1 -1
  361. package/lib/utils/cli-version-check.js +1 -1
  362. package/lib/utils/cli-version-policy.js +1 -1
  363. package/lib/utils/config.js +1 -1
  364. package/lib/utils/entity-with-id.js +1 -1
  365. package/lib/utils/file-utils.js +1 -1
  366. package/lib/utils/guides-cdn.js +1 -1
  367. package/lib/utils/http-client.js +1 -1
  368. package/lib/utils/is-non-interactive.js +1 -1
  369. package/lib/utils/logger.js +1 -1
  370. package/lib/utils/params.js +1 -1
  371. package/lib/utils/platform.js +1 -1
  372. package/lib/utils/sleep.js +1 -1
  373. package/lib/utils/template-replacer.js +1 -1
  374. package/lib/utils/update-notice.js +1 -1
  375. package/lib/utils/version.js +1 -1
  376. package/lib/utils/with-active-cookie.js +1 -1
  377. package/lib/utils/write-cli-side-channel.js +1 -1
  378. package/package.json +1 -1
  379. package/skills/rabetbase/SKILL.md +1 -1
  380. package/skills/rabetbase/references/rabetbase-kb.md +17 -15
  381. package/skills/rabetbase/references/rabetbase-rule.md +8 -6
  382. package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
  383. package/skills/rabetbase-page-generation/SKILL.md +1 -1
  384. package/skills/rabetbase.manifest.json +3 -3
@@ -2,6 +2,7 @@ import type { AppRuleRecord, AppRuleType } from "../../core/api-client.js";
2
2
  import { CliError } from "../../errors.js";
3
3
  import type { RuntimeContext } from "../../framework/types.js";
4
4
  export declare const APP_RULE_TYPES: readonly AppRuleType[];
5
+ export declare const MAX_APP_RULE_UNITS: number;
5
6
  export declare const MAX_APP_RULE_BYTES: number;
6
7
  export type AppRuleContextScope = "page-api-development" | "database-analysis";
7
8
  export declare function appRuleError(code: string, message: string, hint?: string): CliError;
@@ -23,16 +24,17 @@ export declare function projectAppRule(type: AppRuleType, record: AppRuleRecord
23
24
  } | {
24
25
  updateTime?: string | number | undefined;
25
26
  createTime?: string | number | undefined;
27
+ contentByteSize: number;
28
+ contentHash: string;
29
+ indexStatus?: import("../../core/api-client.js").KnowledgeIndexStatus | undefined;
26
30
  type: AppRuleType;
27
31
  fileName: "RULES.md" | "DATABASE.md";
28
32
  contextScope: AppRuleContextScope;
29
33
  enabled: boolean;
30
- id: number;
34
+ id: string;
31
35
  scope: "rules";
32
36
  appCode: string;
33
37
  version: number;
34
- contentByteSize: number;
35
- contentHash: string;
36
38
  };
37
39
  export declare const APP_RULE_TYPE_FLAG: {
38
40
  name: string;
@@ -1 +1 @@
1
- const a244_0x3976a0=a244_0x16aa;(function(_0x165748,_0x48cee2){const _0x4d313c=a244_0x16aa,_0x38f24a=_0x165748();while(!![]){try{const _0x58656d=-parseInt(_0x4d313c(0x19f))/0x1+-parseInt(_0x4d313c(0x1a1))/0x2+parseInt(_0x4d313c(0x180))/0x3*(-parseInt(_0x4d313c(0x189))/0x4)+-parseInt(_0x4d313c(0x19e))/0x5+parseInt(_0x4d313c(0x192))/0x6+-parseInt(_0x4d313c(0x1a5))/0x7*(parseInt(_0x4d313c(0x187))/0x8)+parseInt(_0x4d313c(0x194))/0x9*(parseInt(_0x4d313c(0x18c))/0xa);if(_0x58656d===_0x48cee2)break;else _0x38f24a['push'](_0x38f24a['shift']());}catch(_0x1dfed8){_0x38f24a['push'](_0x38f24a['shift']());}}}(a244_0x17a9,0x572ea));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a244_0x3976a0(0x18b),a244_0x3976a0(0x1a0)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a244_0x3976a0(0x19a),'database':a244_0x3976a0(0x17b)},APP_RULE_CONTEXT_SCOPES={'rules':a244_0x3976a0(0x1a3),'database':'database-analysis'};export function appRuleError(_0x97b225,_0x372755,_0x1f3018){return new CliError(_0x97b225,0x1,_0x372755,_0x1f3018);}export function readAppRuleType(_0x2d8942){const _0x670c97=a244_0x3976a0,_0x473190=_0x2d8942[_0x670c97(0x1a2)]('type')[_0x670c97(0x19c)]()['toLowerCase']();if(_0x473190!==_0x670c97(0x18b)&&_0x473190!==_0x670c97(0x1a0))throw appRuleError(_0x670c97(0x186),_0x670c97(0x19b));return _0x473190;}export function appRuleFileName(_0x3a9138){return APP_RULE_FILES[_0x3a9138];}export function appRuleContextScope(_0x726db9){return APP_RULE_CONTEXT_SCOPES[_0x726db9];}export function inspectAppRuleContent(_0x484b04){const _0x3def4c=a244_0x3976a0,_0x4364ba=Buffer[_0x3def4c(0x18e)](_0x484b04,_0x3def4c(0x18f));return{'content':_0x484b04,'byteSize':_0x4364ba[_0x3def4c(0x193)],'contentHash':_0x3def4c(0x177)+createHash(_0x3def4c(0x195))['update'](_0x4364ba)[_0x3def4c(0x199)](_0x3def4c(0x174))};}function a244_0x16aa(_0x4c94c4,_0x1c9c32){_0x4c94c4=_0x4c94c4-0x174;const _0x17a9f7=a244_0x17a9();let _0x16aa78=_0x17a9f7[_0x4c94c4];return _0x16aa78;}export async function readAppRuleFile(_0x2dbc8c){const _0x58995d=a244_0x3976a0,_0x4af864=_0x2dbc8c[_0x58995d(0x19c)]();if(!_0x4af864)throw appRuleError(_0x58995d(0x1a4),_0x58995d(0x17c),'Pass\x20a\x20UTF-8\x20Markdown\x20file.');const _0x44f753=resolve(_0x4af864);let _0x2e8456;try{_0x2e8456=await stat(_0x44f753);}catch(_0x270a05){throw appRuleError(_0x58995d(0x178),_0x58995d(0x18d)+_0x4af864,_0x270a05 instanceof Error?_0x270a05[_0x58995d(0x17f)]:String(_0x270a05));}if(!_0x2e8456[_0x58995d(0x188)]())throw appRuleError('app_rule_file_invalid',_0x58995d(0x176)+_0x4af864);if(_0x2e8456[_0x58995d(0x196)]>MAX_APP_RULE_BYTES)throw appRuleError('app_rule_content_too_large','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.');let _0x139d9d;try{_0x139d9d=await readFile(_0x44f753);}catch(_0x230ab7){throw appRuleError(_0x58995d(0x178),_0x58995d(0x179)+_0x4af864,_0x230ab7 instanceof Error?_0x230ab7[_0x58995d(0x17f)]:String(_0x230ab7));}if(_0x139d9d[_0x58995d(0x193)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x58995d(0x181),_0x58995d(0x17a));let _0x38cd9b;try{_0x38cd9b=new TextDecoder(_0x58995d(0x198),{'fatal':!![],'ignoreBOM':!![]})[_0x58995d(0x184)](_0x139d9d);}catch{throw appRuleError(_0x58995d(0x197),'App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20'+_0x4af864);}if(!_0x38cd9b['trim']())throw appRuleError(_0x58995d(0x197),_0x58995d(0x182)+_0x4af864);return inspectAppRuleContent(_0x38cd9b);}function a244_0x17a9(){const _0x3e902e=['createTime','message','48579EmoUxM','app_rule_content_too_large','App\x20rule\x20file\x20is\x20blank:\x20','string','decode','content','app_rule_type_invalid','24WLPnli','isFile','76IZFcGZ','type','rules','210340aMcYPL','Cannot\x20access\x20app\x20rule\x20file:\x20','from','utf8','byteSize','appCode','3700590ICpBwg','byteLength','495IEkAzt','sha256','size','app_rule_content_invalid','utf-8','digest','RULES.md','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','trim','updateTime','1177540SgTcTM','39790ZLpqIN','database','928586BOMSqY','str','page-api-development','app_rule_file_required','861651PDVjVw','hex','scope','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','sha256:','app_rule_file_unreadable','Cannot\x20read\x20app\x20rule\x20file:\x20','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','DATABASE.md','--file\x20is\x20required.','contentHash'];a244_0x17a9=function(){return _0x3e902e;};return a244_0x17a9();}export function projectAppRule(_0x2c0b1e,_0x22adbb){const _0x2ce7e5=a244_0x3976a0;if(!_0x22adbb)return{'type':_0x2c0b1e,'fileName':appRuleFileName(_0x2c0b1e),'contextScope':appRuleContextScope(_0x2c0b1e),'enabled':![]};const _0x1a1242=inspectAppRuleContent(_0x22adbb[_0x2ce7e5(0x185)]);return{'type':_0x2c0b1e,'fileName':appRuleFileName(_0x2c0b1e),'contextScope':appRuleContextScope(_0x2c0b1e),'enabled':!![],'id':_0x22adbb['id'],'scope':_0x22adbb[_0x2ce7e5(0x175)],'appCode':_0x22adbb[_0x2ce7e5(0x191)],'version':_0x22adbb['version'],'contentByteSize':_0x1a1242[_0x2ce7e5(0x190)],'contentHash':_0x1a1242[_0x2ce7e5(0x17d)],..._0x22adbb['createTime']!==undefined&&_0x22adbb[_0x2ce7e5(0x17e)]!==null?{'createTime':_0x22adbb[_0x2ce7e5(0x17e)]}:{},..._0x22adbb['updateTime']!==undefined&&_0x22adbb['updateTime']!==null?{'updateTime':_0x22adbb[_0x2ce7e5(0x19d)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x3976a0(0x18a),'type':a244_0x3976a0(0x183),'required':!![],'description':'Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','enum':[...APP_RULE_TYPES]};
1
+ const a244_0x458a9c=a244_0x3260;(function(_0x56379f,_0x5cbaf8){const _0xeb3561=a244_0x3260,_0x4b9b8a=_0x56379f();while(!![]){try{const _0x263dae=-parseInt(_0xeb3561(0x167))/0x1+-parseInt(_0xeb3561(0x189))/0x2+parseInt(_0xeb3561(0x172))/0x3*(parseInt(_0xeb3561(0x16b))/0x4)+parseInt(_0xeb3561(0x170))/0x5+-parseInt(_0xeb3561(0x171))/0x6+parseInt(_0xeb3561(0x17f))/0x7*(-parseInt(_0xeb3561(0x187))/0x8)+-parseInt(_0xeb3561(0x176))/0x9*(-parseInt(_0xeb3561(0x191))/0xa);if(_0x263dae===_0x5cbaf8)break;else _0x4b9b8a['push'](_0x4b9b8a['shift']());}catch(_0x2a503b){_0x4b9b8a['push'](_0x4b9b8a['shift']());}}}(a244_0x26ab,0x8ab64));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';function a244_0x3260(_0x1f3db7,_0x49c50d){_0x1f3db7=_0x1f3db7-0x163;const _0x26abc3=a244_0x26ab();let _0x32601f=_0x26abc3[_0x1f3db7];return _0x32601f;}import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a244_0x458a9c(0x168),'database'];export const MAX_APP_RULE_UNITS=0x5*0x400*0x400;function a244_0x26ab(){const _0x742901=['from','RULES.md','size','19620963upNlKD','updateTime','createTime','app_rule_file_invalid','hex','isFile','utf8','DATABASE.md','database-analysis','7rGkFnc','toLowerCase','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','sha256','app_rule_content_invalid','byteSize','message','appCode','2066992tcWdaf','app_rule_type_invalid','1249580EOzYaR','digest','version','trim','app_rule_content_too_large','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','scope','--file\x20is\x20required.','10xkwyxp','string','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','app_rule_file_required','App\x20rule\x20content\x20exceeds\x20the\x20bounded\x20UTF-8\x20file\x20limit.','content','str','contentHash','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','length','indexStatus','App\x20rule\x20content\x20exceeds\x205242880\x20UTF-16\x20units.','418498PAjAWc','rules','app_rule_file_unreadable','update','1060ocBTXw','Pass\x20a\x20UTF-8\x20Markdown\x20file.','Cannot\x20access\x20app\x20rule\x20file:\x20','App\x20rule\x20file\x20is\x20blank:\x20','type','3429050EDzDMa','5978136OwEjgt','3rLQmyH'];a244_0x26ab=function(){return _0x742901;};return a244_0x26ab();}export const MAX_APP_RULE_BYTES=MAX_APP_RULE_UNITS*0x4;const APP_RULE_FILES={'rules':a244_0x458a9c(0x174),'database':a244_0x458a9c(0x17d)},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':a244_0x458a9c(0x17e)};export function appRuleError(_0x15aa79,_0x2eb96c,_0x43d578){return new CliError(_0x15aa79,0x1,_0x2eb96c,_0x43d578);}export function readAppRuleType(_0x19edd3){const _0x46d605=a244_0x458a9c,_0x425973=_0x19edd3[_0x46d605(0x197)](_0x46d605(0x16f))[_0x46d605(0x18c)]()[_0x46d605(0x180)]();if(_0x425973!==_0x46d605(0x168)&&_0x425973!=='database')throw appRuleError(_0x46d605(0x188),_0x46d605(0x18e));return _0x425973;}export function appRuleFileName(_0x1f4a1b){return APP_RULE_FILES[_0x1f4a1b];}export function appRuleContextScope(_0x85b3c){return APP_RULE_CONTEXT_SCOPES[_0x85b3c];}export function inspectAppRuleContent(_0x507bcc){const _0x49b6e3=a244_0x458a9c,_0x23e2c4=Buffer[_0x49b6e3(0x173)](_0x507bcc,_0x49b6e3(0x17c));return{'content':_0x507bcc,'byteSize':_0x23e2c4['byteLength'],'contentHash':'sha256:'+createHash(_0x49b6e3(0x182))[_0x49b6e3(0x16a)](_0x23e2c4)[_0x49b6e3(0x18a)](_0x49b6e3(0x17a))};}export async function readAppRuleFile(_0x9c83b7){const _0x49b93f=a244_0x458a9c,_0x109b45=_0x9c83b7[_0x49b93f(0x18c)]();if(!_0x109b45)throw appRuleError(_0x49b93f(0x194),_0x49b93f(0x190),_0x49b93f(0x16c));const _0x4a6196=resolve(_0x109b45);let _0x81486d;try{_0x81486d=await stat(_0x4a6196);}catch(_0xe0950f){throw appRuleError(_0x49b93f(0x169),_0x49b93f(0x16d)+_0x109b45,_0xe0950f instanceof Error?_0xe0950f[_0x49b93f(0x185)]:String(_0xe0950f));}if(!_0x81486d[_0x49b93f(0x17b)]())throw appRuleError(_0x49b93f(0x179),_0x49b93f(0x163)+_0x109b45);if(_0x81486d[_0x49b93f(0x175)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x49b93f(0x18d),_0x49b93f(0x195));let _0x24fcdb;try{_0x24fcdb=await readFile(_0x4a6196);}catch(_0x418af6){throw appRuleError(_0x49b93f(0x169),'Cannot\x20read\x20app\x20rule\x20file:\x20'+_0x109b45,_0x418af6 instanceof Error?_0x418af6[_0x49b93f(0x185)]:String(_0x418af6));}if(_0x24fcdb['byteLength']>MAX_APP_RULE_BYTES)throw appRuleError('app_rule_content_too_large',_0x49b93f(0x195));let _0x4a42cd;try{_0x4a42cd=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})['decode'](_0x24fcdb);}catch{throw appRuleError(_0x49b93f(0x183),_0x49b93f(0x193)+_0x109b45);}if(_0x4a42cd[_0x49b93f(0x164)]>MAX_APP_RULE_UNITS)throw appRuleError('app_rule_content_too_large',_0x49b93f(0x166));if(!_0x4a42cd[_0x49b93f(0x18c)]())throw appRuleError(_0x49b93f(0x183),_0x49b93f(0x16e)+_0x109b45);return inspectAppRuleContent(_0x4a42cd);}export function projectAppRule(_0x16b42b,_0x54e61d){const _0x5b3ed3=a244_0x458a9c;if(!_0x54e61d)return{'type':_0x16b42b,'fileName':appRuleFileName(_0x16b42b),'contextScope':appRuleContextScope(_0x16b42b),'enabled':![]};const _0x38b456=inspectAppRuleContent(_0x54e61d[_0x5b3ed3(0x196)]);return{'type':_0x16b42b,'fileName':appRuleFileName(_0x16b42b),'contextScope':appRuleContextScope(_0x16b42b),'enabled':!![],'id':_0x54e61d['id'],'scope':_0x54e61d[_0x5b3ed3(0x18f)],'appCode':_0x54e61d[_0x5b3ed3(0x186)],'version':_0x54e61d[_0x5b3ed3(0x18b)],..._0x54e61d[_0x5b3ed3(0x165)]!==undefined?{'indexStatus':_0x54e61d[_0x5b3ed3(0x165)]}:{},'contentByteSize':_0x38b456[_0x5b3ed3(0x184)],'contentHash':_0x38b456[_0x5b3ed3(0x198)],..._0x54e61d[_0x5b3ed3(0x178)]!==undefined&&_0x54e61d[_0x5b3ed3(0x178)]!==null?{'createTime':_0x54e61d[_0x5b3ed3(0x178)]}:{},..._0x54e61d[_0x5b3ed3(0x177)]!==undefined&&_0x54e61d[_0x5b3ed3(0x177)]!==null?{'updateTime':_0x54e61d[_0x5b3ed3(0x177)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x458a9c(0x16f),'type':a244_0x458a9c(0x192),'required':!![],'description':a244_0x458a9c(0x181),'enum':[...APP_RULE_TYPES]};
@@ -1 +1 @@
1
- const a245_0x48e6f4=a245_0x4ec7;(function(_0x325760,_0x3cbf16){const _0x532192=a245_0x4ec7,_0x192433=_0x325760();while(!![]){try{const _0x2c7a0f=-parseInt(_0x532192(0x188))/0x1*(-parseInt(_0x532192(0x1aa))/0x2)+parseInt(_0x532192(0x179))/0x3*(-parseInt(_0x532192(0x1b0))/0x4)+-parseInt(_0x532192(0x1b1))/0x5*(parseInt(_0x532192(0x1a7))/0x6)+-parseInt(_0x532192(0x1b4))/0x7*(parseInt(_0x532192(0x18a))/0x8)+-parseInt(_0x532192(0x184))/0x9+parseInt(_0x532192(0x195))/0xa+parseInt(_0x532192(0x1ac))/0xb;if(_0x2c7a0f===_0x3cbf16)break;else _0x192433['push'](_0x192433['shift']());}catch(_0x4fa7c7){_0x192433['push'](_0x192433['shift']());}}}(a245_0x3d91,0xb6b95));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 a245_0x4ec7(_0x3d5ba3,_0x1b1fdd){_0x3d5ba3=_0x3d5ba3-0x179;const _0x3d9150=a245_0x3d91();let _0x4ec7b2=_0x3d9150[_0x3d5ba3];return _0x4ec7b2;}import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';function a245_0x3d91(){const _0x150e41=['inherit','changed','close','No\x20package.json\x20found\x20in\x20current\x20directory.','node_modules','write','vite\x20preview\x20exited\x20with\x20code\x20','log','18hGJTuS','Available:\x20','join','462562TQRoqj','watch','26029707OYKLdF','args','utf-8','keys','177144ufMgEJ','1456505xgwYZb','bun.lockb','scripts','7eLXCYr','start','48tVdXes','Script\x20name\x20defined\x20in\x20package.json','\x20run\x20start','npm','\x20run\x20<script>\x0a','pnpm-lock.yaml','parse','--watch','bun.lock','\x20\x20EXAMPLES','has','8576415dKCMTY','\x20run\x20','cwd','boolean','1FFRVSP','package.json','4649096euYwgv','error','length','\x20run\x20preview','yarn','Domain\x20routing\x20synchronized:\x20','path','validation','push','belowMinimum','\x22\x20not\x20found\x20in\x20package.json.','12673700vSpjzM','Run\x20a\x20package.json\x20script','\x20\x20\x20\x20','needsUpgrade','No\x20scripts\x20defined\x20in\x20package.json.','run','pnpm','.bin','preview','build'];a245_0x3d91=function(){return _0x150e41;};return a245_0x3d91();}const VERSION_CHECK_SCRIPTS=new Set(['start','dev']),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a245_0x48e6f4(0x1b5),'dev',a245_0x48e6f4(0x19e),'preview']);export function syncProjectDomainRoutingBeforeScript(_0x2a8b01,_0x3b332a){const _0x2bc111=a245_0x48e6f4;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x2bc111(0x183)](_0x3b332a))return null;const _0x4e9525=findProjectRootDirectory(_0x2a8b01);if(!resolveConfigPath(_0x4e9525))return null;const _0x55b1e2=writeProjectDomainRoutingManifest(_0x4e9525);return{'path':_0x55b1e2[_0x2bc111(0x190)],'changed':_0x55b1e2[_0x2bc111(0x1a0)]};}function readPackageScripts(_0x54f66e){const _0x4d9abd=a245_0x48e6f4,_0x1e8b4a=resolve(_0x54f66e,_0x4d9abd(0x189));if(!existsSync(_0x1e8b4a))return null;try{const _0x5ad23c=JSON[_0x4d9abd(0x17f)](readFileSync(_0x1e8b4a,_0x4d9abd(0x1ae)));return _0x5ad23c[_0x4d9abd(0x1b3)]??{};}catch{return null;}}function detectPackageManager(_0x38c037){const _0x14d50b=a245_0x48e6f4;if(existsSync(resolve(_0x38c037,_0x14d50b(0x1b2)))||existsSync(resolve(_0x38c037,_0x14d50b(0x181))))return'bun';if(existsSync(resolve(_0x38c037,_0x14d50b(0x17e))))return _0x14d50b(0x19b);if(existsSync(resolve(_0x38c037,'yarn.lock')))return _0x14d50b(0x18e);return _0x14d50b(0x17c);}async function versionCheck(_0x216d42){const _0x318f8b=a245_0x48e6f4,_0x257edb=await checkCliVersion();(_0x257edb[_0x318f8b(0x198)]||_0x257edb[_0x318f8b(0x193)])&&(printCliUpgradeWarning(_0x257edb),assertCliVersionSupported(_0x257edb));const _0x2e5a53=await checkSdkVersion(_0x216d42);if(_0x2e5a53[_0x318f8b(0x198)])printSdkUpgradeWarning(_0x2e5a53);}function spawnScript(_0xad561,_0x2742ce,_0xc367ac,_0x549f77){return new Promise((_0x12a5fb,_0x2a633e)=>{const _0x38508c=a245_0x4ec7,_0x30b24f=[_0x38508c(0x19a),_0x2742ce,..._0xc367ac],_0x807309=spawn(_0xad561,_0x30b24f,{'cwd':_0x549f77,'stdio':_0x38508c(0x19f),'shell':!![],'env':{...process.env,'PATH':''+join(_0x549f77,_0x38508c(0x1a3),'.bin')+delimiter+process.env.PATH}});_0x807309['on'](_0x38508c(0x1a1),_0x1eba31=>{const _0x1e88bd=_0x38508c;if(_0x1eba31===0x0||_0x1eba31===null)_0x12a5fb();else _0x2a633e(new Error(_0xad561+_0x1e88bd(0x185)+_0x2742ce+'\x20exited\x20with\x20code\x20'+_0x1eba31));}),_0x807309['on'](_0x38508c(0x18b),_0x2a633e);});}function spawnViteBuildWatch(_0x444610){return new Promise((_0x536ef7,_0x55c60b)=>{const _0x57640c=a245_0x4ec7,_0x43885e=spawn('vite',[_0x57640c(0x19e),_0x57640c(0x180)],{'cwd':_0x444610,'stdio':_0x57640c(0x19f),'shell':!![],'env':{...process.env,'PATH':''+join(_0x444610,_0x57640c(0x1a3),_0x57640c(0x19c))+delimiter+process.env.PATH}});_0x43885e['on'](_0x57640c(0x1a1),_0x4c8999=>{if(_0x4c8999===0x0||_0x4c8999===null)_0x536ef7();else _0x55c60b(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x4c8999));}),_0x43885e['on'](_0x57640c(0x18b),_0x55c60b);});}function spawnVitePreview(_0x330626){return new Promise((_0x566f90,_0x2e437f)=>{const _0x10ccd3=a245_0x4ec7,_0x35a10d=spawn('vite',[_0x10ccd3(0x19d)],{'cwd':_0x330626,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x330626,_0x10ccd3(0x1a3),'.bin')+delimiter+process.env.PATH}});_0x35a10d['on'](_0x10ccd3(0x1a1),_0x5e0408=>{const _0xa9ca40=_0x10ccd3;if(_0x5e0408===0x0||_0x5e0408===null)_0x566f90();else _0x2e437f(new Error(_0xa9ca40(0x1a5)+_0x5e0408));}),_0x35a10d['on'](_0x10ccd3(0x18b),_0x2e437f);});}const runFlags=[{'name':a245_0x48e6f4(0x1ab),'type':a245_0x48e6f4(0x187),'description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a245_0x48e6f4(0x19a),'command':a245_0x48e6f4(0x19a),'description':a245_0x48e6f4(0x196),'risk':a245_0x48e6f4(0x1a4),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':a245_0x48e6f4(0x17a),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x2b4921=a245_0x48e6f4,_0x1d411b=[];return _0x1d411b[_0x2b4921(0x192)](_0x2b4921(0x182)),_0x1d411b[_0x2b4921(0x192)](_0x2b4921(0x197)+CLI_BIN_NAME+_0x2b4921(0x17b)),_0x1d411b['push'](_0x2b4921(0x197)+CLI_BIN_NAME+'\x20run\x20build'),_0x1d411b['push'](_0x2b4921(0x197)+CLI_BIN_NAME+_0x2b4921(0x18d)),_0x1d411b[_0x2b4921(0x192)](_0x2b4921(0x197)+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x1d411b[_0x2b4921(0x1a9)]('\x0a');},async 'execute'(_0x5ef28e){const _0x2129ac=a245_0x48e6f4,_0x48e1c6=process[_0x2129ac(0x186)](),_0x1adef4=_0x5ef28e[_0x2129ac(0x1ad)][0x0],_0x2cc090=_0x5ef28e[_0x2129ac(0x1ad)]['slice'](0x1),_0x3831ae=readPackageScripts(_0x48e1c6);if(!_0x3831ae)throw CliErrors[_0x2129ac(0x191)](_0x2129ac(0x1a2));if(!_0x1adef4){const _0x4cb55f=Object[_0x2129ac(0x1af)](_0x3831ae);if(_0x4cb55f[_0x2129ac(0x18c)]===0x0)console['log'](_0x2129ac(0x199));else{console['log']('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x508a66 of _0x4cb55f){console[_0x2129ac(0x1a6)](_0x2129ac(0x197)+_0x508a66);}console[_0x2129ac(0x1a6)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+_0x2129ac(0x17d));}return{'ok':!![]};}if(!_0x3831ae[_0x1adef4])throw CliErrors[_0x2129ac(0x191)]('Script\x20\x22'+_0x1adef4+_0x2129ac(0x194),_0x2129ac(0x1a8)+(Object['keys'](_0x3831ae)[_0x2129ac(0x1a9)](',\x20')||'(none)'));const _0x1201b4=detectPackageManager(_0x48e1c6),_0x17d6fc=syncProjectDomainRoutingBeforeScript(_0x48e1c6,_0x1adef4);_0x17d6fc?.[_0x2129ac(0x1a0)]&&console[_0x2129ac(0x18b)](_0x2129ac(0x18f)+_0x17d6fc['path']);VERSION_CHECK_SCRIPTS[_0x2129ac(0x183)](_0x1adef4)&&await versionCheck(_0x48e1c6);if(_0x1adef4===_0x2129ac(0x19d)&&_0x5ef28e['bool'](_0x2129ac(0x1ab)))return await Promise['all']([spawnViteBuildWatch(_0x48e1c6),spawnVitePreview(_0x48e1c6)]),{'ok':!![]};return await spawnScript(_0x1201b4,_0x1adef4,_0x2cc090,_0x48e1c6),{'ok':!![]};}};
1
+ const a245_0x4ad350=a245_0x35cd;(function(_0x6de55e,_0x5946c4){const _0x3570e7=a245_0x35cd,_0x9b99bd=_0x6de55e();while(!![]){try{const _0x42c160=parseInt(_0x3570e7(0x1c8))/0x1+-parseInt(_0x3570e7(0x19e))/0x2*(-parseInt(_0x3570e7(0x1ac))/0x3)+parseInt(_0x3570e7(0x1c7))/0x4+-parseInt(_0x3570e7(0x19d))/0x5*(-parseInt(_0x3570e7(0x195))/0x6)+parseInt(_0x3570e7(0x1c1))/0x7+-parseInt(_0x3570e7(0x1a1))/0x8+-parseInt(_0x3570e7(0x197))/0x9;if(_0x42c160===_0x5946c4)break;else _0x9b99bd['push'](_0x9b99bd['shift']());}catch(_0x520a6b){_0x9b99bd['push'](_0x9b99bd['shift']());}}}(a245_0x4c07,0x2df46));import{readFileSync,existsSync}from'node:fs';function a245_0x4c07(){const _0x1f625d=['4841550YGHLGx','\x20run\x20start','yarn','parse','No\x20package.json\x20found\x20in\x20current\x20directory.','\x20run\x20','35LIoVWv','2168WLYYtk','length','yarn.lock','2142240hXjiZl','inherit','node_modules','cwd','package.json','\x20run\x20<script>\x0a','Available:\x20','vite\x20preview\x20exited\x20with\x20code\x20','Enable\x20watch\x20mode\x20for\x20preview','\x20\x20\x20\x20','args','546XnAkbj','log','pnpm','write','build','Domain\x20routing\x20synchronized:\x20','keys','\x20\x20EXAMPLES','Script\x20\x22','changed','(none)','has','\x20run\x20preview\x20--watch','vite','\x20run\x20build','\x22\x20not\x20found\x20in\x20package.json.','--watch','dev','utf-8','path','bun.lock','1038695eBwXxh','start','push','bun.lockb','\x20exited\x20with\x20code\x20','close','667328zfTVYd','184032zWxVck','No\x20scripts\x20defined\x20in\x20package.json.','slice','validation','watch','\x20run\x20preview','npm','pnpm-lock.yaml','all','error','preview','254934MSgIbK','belowMinimum'];a245_0x4c07=function(){return _0x1f625d;};return a245_0x4c07();}function a245_0x35cd(_0x42b3c3,_0x31be2d){_0x42b3c3=_0x42b3c3-0x18f;const _0x4c070d=a245_0x4c07();let _0x35cd8d=_0x4c070d[_0x42b3c3];return _0x35cd8d;}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([a245_0x4ad350(0x1c2),a245_0x4ad350(0x1bd)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a245_0x4ad350(0x1c2),a245_0x4ad350(0x1bd),a245_0x4ad350(0x1b0),a245_0x4ad350(0x194)]);export function syncProjectDomainRoutingBeforeScript(_0x3ca7b4,_0x38b31c){const _0x5d6f73=a245_0x4ad350;if(!DOMAIN_ROUTING_SYNC_SCRIPTS['has'](_0x38b31c))return null;const _0x1129c7=findProjectRootDirectory(_0x3ca7b4);if(!resolveConfigPath(_0x1129c7))return null;const _0x1f0447=writeProjectDomainRoutingManifest(_0x1129c7);return{'path':_0x1f0447[_0x5d6f73(0x1bf)],'changed':_0x1f0447[_0x5d6f73(0x1b5)]};}function readPackageScripts(_0x2b2aea){const _0x5ae94e=a245_0x4ad350,_0x4bef58=resolve(_0x2b2aea,_0x5ae94e(0x1a5));if(!existsSync(_0x4bef58))return null;try{const _0x31a17a=JSON[_0x5ae94e(0x19a)](readFileSync(_0x4bef58,_0x5ae94e(0x1be)));return _0x31a17a['scripts']??{};}catch{return null;}}function detectPackageManager(_0x3dae7f){const _0x58d05e=a245_0x4ad350;if(existsSync(resolve(_0x3dae7f,_0x58d05e(0x1c4)))||existsSync(resolve(_0x3dae7f,_0x58d05e(0x1c0))))return'bun';if(existsSync(resolve(_0x3dae7f,_0x58d05e(0x191))))return _0x58d05e(0x1ae);if(existsSync(resolve(_0x3dae7f,_0x58d05e(0x1a0))))return _0x58d05e(0x199);return _0x58d05e(0x190);}async function versionCheck(_0x5daf1a){const _0x3bd1ed=a245_0x4ad350,_0x181836=await checkCliVersion();(_0x181836['needsUpgrade']||_0x181836[_0x3bd1ed(0x196)])&&(printCliUpgradeWarning(_0x181836),assertCliVersionSupported(_0x181836));const _0x49f767=await checkSdkVersion(_0x5daf1a);if(_0x49f767['needsUpgrade'])printSdkUpgradeWarning(_0x49f767);}function spawnScript(_0x4e6b56,_0x4f754a,_0x52a325,_0x429e24){return new Promise((_0x146cf0,_0x5365de)=>{const _0x3dd6c7=a245_0x35cd,_0x276b56=['run',_0x4f754a,..._0x52a325],_0x503bb8=spawn(_0x4e6b56,_0x276b56,{'cwd':_0x429e24,'stdio':_0x3dd6c7(0x1a2),'shell':!![],'env':{...process.env,'PATH':''+join(_0x429e24,'node_modules','.bin')+delimiter+process.env.PATH}});_0x503bb8['on'](_0x3dd6c7(0x1c6),_0x1bee0a=>{const _0x270fd7=_0x3dd6c7;if(_0x1bee0a===0x0||_0x1bee0a===null)_0x146cf0();else _0x5365de(new Error(_0x4e6b56+_0x270fd7(0x19c)+_0x4f754a+_0x270fd7(0x1c5)+_0x1bee0a));}),_0x503bb8['on']('error',_0x5365de);});}function spawnViteBuildWatch(_0x14f772){return new Promise((_0x3334ba,_0x42ebd0)=>{const _0x1b7ccd=a245_0x35cd,_0x364d7a=spawn(_0x1b7ccd(0x1b9),['build',_0x1b7ccd(0x1bc)],{'cwd':_0x14f772,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x14f772,_0x1b7ccd(0x1a3),'.bin')+delimiter+process.env.PATH}});_0x364d7a['on'](_0x1b7ccd(0x1c6),_0x19402a=>{if(_0x19402a===0x0||_0x19402a===null)_0x3334ba();else _0x42ebd0(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x19402a));}),_0x364d7a['on'](_0x1b7ccd(0x193),_0x42ebd0);});}function spawnVitePreview(_0x36112d){return new Promise((_0x13976c,_0x2027b8)=>{const _0x56d851=a245_0x35cd,_0x2a767f=spawn(_0x56d851(0x1b9),['preview'],{'cwd':_0x36112d,'stdio':_0x56d851(0x1a2),'shell':!![],'env':{...process.env,'PATH':''+join(_0x36112d,_0x56d851(0x1a3),'.bin')+delimiter+process.env.PATH}});_0x2a767f['on'](_0x56d851(0x1c6),_0x5d776e=>{const _0xd61b13=_0x56d851;if(_0x5d776e===0x0||_0x5d776e===null)_0x13976c();else _0x2027b8(new Error(_0xd61b13(0x1a8)+_0x5d776e));}),_0x2a767f['on'](_0x56d851(0x193),_0x2027b8);});}const runFlags=[{'name':a245_0x4ad350(0x1cc),'type':'boolean','description':a245_0x4ad350(0x1a9),'default':![]}];export const runDefinition={'service':'run','command':'run','description':'Run\x20a\x20package.json\x20script','risk':a245_0x4ad350(0x1af),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x10ca07=a245_0x4ad350,_0x373e48=[];return _0x373e48[_0x10ca07(0x1c3)](_0x10ca07(0x1b3)),_0x373e48[_0x10ca07(0x1c3)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x10ca07(0x198)),_0x373e48[_0x10ca07(0x1c3)](_0x10ca07(0x1aa)+CLI_BIN_NAME+_0x10ca07(0x1ba)),_0x373e48[_0x10ca07(0x1c3)](_0x10ca07(0x1aa)+CLI_BIN_NAME+_0x10ca07(0x18f)),_0x373e48[_0x10ca07(0x1c3)](_0x10ca07(0x1aa)+CLI_BIN_NAME+_0x10ca07(0x1b8)),_0x373e48['join']('\x0a');},async 'execute'(_0x1ba251){const _0xcb4c91=a245_0x4ad350,_0x1ef3aa=process[_0xcb4c91(0x1a4)](),_0x15ded7=_0x1ba251[_0xcb4c91(0x1ab)][0x0],_0x1d9f75=_0x1ba251[_0xcb4c91(0x1ab)][_0xcb4c91(0x1ca)](0x1),_0x79a633=readPackageScripts(_0x1ef3aa);if(!_0x79a633)throw CliErrors[_0xcb4c91(0x1cb)](_0xcb4c91(0x19b));if(!_0x15ded7){const _0x3d16fa=Object[_0xcb4c91(0x1b2)](_0x79a633);if(_0x3d16fa[_0xcb4c91(0x19f)]===0x0)console['log'](_0xcb4c91(0x1c9));else{console['log']('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x45c1fe of _0x3d16fa){console['log']('\x20\x20\x20\x20'+_0x45c1fe);}console[_0xcb4c91(0x1ad)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+_0xcb4c91(0x1a6));}return{'ok':!![]};}if(!_0x79a633[_0x15ded7])throw CliErrors[_0xcb4c91(0x1cb)](_0xcb4c91(0x1b4)+_0x15ded7+_0xcb4c91(0x1bb),_0xcb4c91(0x1a7)+(Object[_0xcb4c91(0x1b2)](_0x79a633)['join'](',\x20')||_0xcb4c91(0x1b6)));const _0x100c0a=detectPackageManager(_0x1ef3aa),_0x5cb8b5=syncProjectDomainRoutingBeforeScript(_0x1ef3aa,_0x15ded7);_0x5cb8b5?.[_0xcb4c91(0x1b5)]&&console[_0xcb4c91(0x193)](_0xcb4c91(0x1b1)+_0x5cb8b5[_0xcb4c91(0x1bf)]);VERSION_CHECK_SCRIPTS[_0xcb4c91(0x1b7)](_0x15ded7)&&await versionCheck(_0x1ef3aa);if(_0x15ded7===_0xcb4c91(0x194)&&_0x1ba251['bool']('watch'))return await Promise[_0xcb4c91(0x192)]([spawnViteBuildWatch(_0x1ef3aa),spawnVitePreview(_0x1ef3aa)]),{'ok':!![]};return await spawnScript(_0x100c0a,_0x15ded7,_0x1d9f75,_0x1ef3aa),{'ok':!![]};}};
@@ -1 +1 @@
1
- function a246_0x2b9d(_0x339c90,_0x42fa2c){_0x339c90=_0x339c90-0xc9;const _0x5a8c55=a246_0x5a8c();let _0x2b9d6b=_0x5a8c55[_0x339c90];return _0x2b9d6b;}const a246_0x2fc097=a246_0x2b9d;(function(_0xc3cbc7,_0x14bfa2){const _0x535c8b=a246_0x2b9d,_0x23b9f2=_0xc3cbc7();while(!![]){try{const _0x3e7007=-parseInt(_0x535c8b(0xcf))/0x1+-parseInt(_0x535c8b(0xd5))/0x2*(-parseInt(_0x535c8b(0xd8))/0x3)+-parseInt(_0x535c8b(0xd1))/0x4+-parseInt(_0x535c8b(0xd7))/0x5*(parseInt(_0x535c8b(0xd0))/0x6)+parseInt(_0x535c8b(0xcc))/0x7*(parseInt(_0x535c8b(0xd6))/0x8)+-parseInt(_0x535c8b(0xd3))/0x9*(parseInt(_0x535c8b(0xc9))/0xa)+-parseInt(_0x535c8b(0xd4))/0xb*(-parseInt(_0x535c8b(0xce))/0xc);if(_0x3e7007===_0x14bfa2)break;else _0x23b9f2['push'](_0x23b9f2['shift']());}catch(_0x165073){_0x23b9f2['push'](_0x23b9f2['shift']());}}}(a246_0x5a8c,0xb4b1c));function a246_0x5a8c(){const _0x425669=['149584VZwdWM','210995aczRst','97095eTImgk','642080ZzRGun','export','read','553QHMgFP','Export\x20machine-readable\x20command\x20schema\x20(JSON)','9144usMkQc','24581pEYuVo','204rtDehA','4470496cHGSka','schema','63LeJcJN','32582wNgmzJ','2QEvcBg'];a246_0x5a8c=function(){return _0x425669;};return a246_0x5a8c();}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x1b424d){const _0x7d77bb=await buildSchemaPayload();return{'ok':!![],'data':_0x7d77bb};}export const schemaDefinition={'service':a246_0x2fc097(0xd2),'command':a246_0x2fc097(0xca),'description':a246_0x2fc097(0xcd),'risk':a246_0x2fc097(0xcb),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
1
+ const a246_0x3ca1a7=a246_0x3c55;function a246_0x3c55(_0x52b519,_0x528333){_0x52b519=_0x52b519-0xf9;const _0x6da6d1=a246_0x6da6();let _0x3c553a=_0x6da6d1[_0x52b519];return _0x3c553a;}(function(_0x5466be,_0x1ed5e3){const _0x541f49=a246_0x3c55,_0x1bcf7c=_0x5466be();while(!![]){try{const _0x4402a6=parseInt(_0x541f49(0xff))/0x1+parseInt(_0x541f49(0xfa))/0x2*(-parseInt(_0x541f49(0x104))/0x3)+-parseInt(_0x541f49(0x103))/0x4+parseInt(_0x541f49(0x102))/0x5*(parseInt(_0x541f49(0x101))/0x6)+-parseInt(_0x541f49(0xf9))/0x7+parseInt(_0x541f49(0xfc))/0x8*(-parseInt(_0x541f49(0xfb))/0x9)+parseInt(_0x541f49(0xfe))/0xa;if(_0x4402a6===_0x1ed5e3)break;else _0x1bcf7c['push'](_0x1bcf7c['shift']());}catch(_0xeb215){_0x1bcf7c['push'](_0x1bcf7c['shift']());}}}(a246_0x6da6,0x90092));import{buildSchemaPayload}from'../framework/schema-export.js';function a246_0x6da6(){const _0xb570f9=['176115aFNZeN','108899RcFKMH','40fTpuRV','237555DfcxAc','48Tyiwso','Export\x20machine-readable\x20command\x20schema\x20(JSON)','11881040IXhswG','996076csqiWY','json','33210lhhFvw','665mJPUHS','3929352FmYPjR'];a246_0x6da6=function(){return _0xb570f9;};return a246_0x6da6();}async function execute(_0x670fd2){const _0x29ed12=await buildSchemaPayload();return{'ok':!![],'data':_0x29ed12};}export const schemaDefinition={'service':'schema','command':'export','description':a246_0x3ca1a7(0xfd),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a246_0x3ca1a7(0x100),'flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a247_0x51145f=a247_0x360c;(function(_0x397597,_0x8da302){const _0x464ae9=a247_0x360c,_0x2e2098=_0x397597();while(!![]){try{const _0x1d6bab=-parseInt(_0x464ae9(0x1bd))/0x1+parseInt(_0x464ae9(0x188))/0x2*(parseInt(_0x464ae9(0x1a5))/0x3)+-parseInt(_0x464ae9(0x190))/0x4+parseInt(_0x464ae9(0x1bb))/0x5+-parseInt(_0x464ae9(0x19d))/0x6+-parseInt(_0x464ae9(0x185))/0x7+-parseInt(_0x464ae9(0x18c))/0x8*(-parseInt(_0x464ae9(0x1ab))/0x9);if(_0x1d6bab===_0x8da302)break;else _0x2e2098['push'](_0x2e2098['shift']());}catch(_0x3f704a){_0x2e2098['push'](_0x2e2098['shift']());}}}(a247_0x20e1,0x2f7f3));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a247_0x20e1(){const _0x1b9a43=['new','sql','dbId\x20cannot\x20be\x20empty','nonInteractive','str','sqlRoot','join','write','isFinite','validation','dbName','__manual__','SQL\x20name\x20cannot\x20be\x20empty','1105630YnXvrU','Select\x20the\x20target\x20database:','69013emRsdK','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Plain\x20SQL\x20(sql)','Target\x20database\x20ID','flagMissing','mode','sqlName','1745884jcBunu','map','appCode','2494ePWUlV','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','lastSync','SELECT\x201\x20AS\x20id;','8888MqkeTP','Local\x20SQL\x20file\x20mode','SQL\x20query\x20display\x20name','MyBatis\x20XML\x20(mybatisXml)','58048uSoxcs','/smartapi/custom/saveUserCustomSql','mybatisXml','toISOString','sqls','db-id','dbId','</select>','dbId\x20must\x20be\x20a\x20positive\x20integer','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','Select\x20the\x20local\x20SQL\x20mode:','Target\x20database\x20dbId:','number','889602JCCHkf','description','name','length','catch','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','Invalid\x20database\x20selection\x20payload:\x20','\x20\x20SELECT\x201\x20AS\x20id','54QzZrfB','SQL\x20name:','trim','POST','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlRootDir','3501BbyLZU','flag','sqlCode'];a247_0x20e1=function(){return _0x1b9a43;};return a247_0x20e1();}import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0xf7e05){const _0x4412c8=a247_0x360c;if(_0xf7e05===_0x4412c8(0x192))return[_0x4412c8(0x199),_0x4412c8(0x1a4),_0x4412c8(0x197),''][_0x4412c8(0x1b4)]('\x0a');return[_0x4412c8(0x18b),'']['join']('\x0a');}export const sqlCreate={'service':a247_0x51145f(0x1af),'command':'create','description':a247_0x51145f(0x1bf),'risk':a247_0x51145f(0x1b5),'flags':[{'name':'name','type':'string','description':a247_0x51145f(0x18e)},{'name':a247_0x51145f(0x195),'type':'number','description':a247_0x51145f(0x181)},{'name':a247_0x51145f(0x183),'type':'string','enum':[a247_0x51145f(0x1af),'mybatisXml'],'description':a247_0x51145f(0x18d)}],async 'validate'(_0x4e5f20){const _0x530552=a247_0x51145f;if(!_0x4e5f20[_0x530552(0x1b1)])return;if(!_0x4e5f20[_0x530552(0x1b2)](_0x530552(0x19f))[_0x530552(0x1a7)]())throw CliErrors['flagMissing'](_0x530552(0x19f),_0x530552(0x1a9));const _0x595ef3=resolveProvidedDbId(_0x4e5f20);if(typeof _0x595ef3!==_0x530552(0x19c)||!Number['isFinite'](_0x595ef3)||_0x595ef3<=0x0)throw CliErrors[_0x530552(0x182)](_0x530552(0x195),_0x530552(0x189));if(!_0x4e5f20['str'](_0x530552(0x183))[_0x530552(0x1a7)]())throw CliErrors[_0x530552(0x182)]('mode',_0x530552(0x1be));},async 'dryRun'(_0x2f0639){const _0xf421cb=a247_0x51145f,_0x1fefc0=loadSqlProjectConfig(_0x2f0639[_0xf421cb(0x187)]),{sqlName:_0x1027d5,dbId:_0x157cba,dbName:_0x167957,mode:_0x1f472c}=await resolveSqlNewInputs(_0x2f0639),_0x403981=buildSqlRelativePath('<server-generated-sqlCode>',_0x1027d5,_0x167957,_0x1f472c,_0x157cba),_0x2806d5=_0x1fefc0[_0xf421cb(0x1aa)]+'/'+_0x403981;return{'method':_0xf421cb(0x1a8),'url':_0xf421cb(0x191),'body':{'appCode':_0x2f0639[_0xf421cb(0x187)],'sqlName':_0x1027d5,'dbId':_0x157cba,'mode':_0x1f472c,'localPath':_0x2806d5},'description':_0xf421cb(0x1a2)+_0x1fefc0['sqlRootDir']};},async 'execute'(_0x2b57e2){const _0x1655bc=a247_0x51145f,_0x159523=loadSqlProjectConfig(_0x2b57e2[_0x1655bc(0x187)]),{sqlName:_0x5d31ad,dbId:_0x5024a5,dbName:_0x5718a5,mode:_0x3f8340}=await resolveSqlNewInputs(_0x2b57e2),_0x1e192f=generateSqlTemplate(_0x3f8340),_0x58aaa8=await createSqlQuery({'appCode':_0x2b57e2[_0x1655bc(0x187)],'sqlName':_0x5d31ad,'dbId':_0x5024a5,'sqlContent':_0x1e192f}),_0x4e5ad4=ensureRemoteSqlContent(_0x58aaa8),_0x40fc54=_0x5718a5||await getDbName(_0x2b57e2[_0x1655bc(0x187)],_0x5024a5)[_0x1655bc(0x1a1)](()=>undefined),_0x1f714b=buildSqlRelativePath(_0x58aaa8[_0x1655bc(0x1ad)],_0x58aaa8[_0x1655bc(0x184)],_0x40fc54,_0x3f8340,_0x5024a5),_0x40fe56=_0x159523[_0x1655bc(0x1aa)]+'/'+_0x1f714b,_0x49a195=buildLocalSqlFileContent({'sqlCode':_0x58aaa8['sqlCode'],'sqlName':_0x58aaa8[_0x1655bc(0x184)],'dbId':_0x58aaa8[_0x1655bc(0x196)]},_0x4e5ad4,{'dbName':_0x40fc54,'mode':_0x3f8340,'syncedAt':new Date()[_0x1655bc(0x193)](),'description':_0x58aaa8[_0x1655bc(0x19e)]});if(await fileExists(_0x40fe56))throw CliErrors[_0x1655bc(0x1b7)]('File\x20already\x20exists:\x20'+_0x40fe56);await ensureParentDirectory(_0x40fe56),await writeFile(_0x40fe56,_0x49a195,'utf8');const _0x4135d2=await readSqlLockFile(_0x159523['lockFilePath']),{lockData:_0xd1d196,appLock:_0x10769b}=ensureSqlLockScope(_0x4135d2??createEmptySqlLock(),_0x159523['appCode'],_0x159523[_0x1655bc(0x1b3)],_0x1655bc(0x1ae));return _0x10769b[_0x1655bc(0x194)][_0x58aaa8['sqlCode']]={...buildSqlLockEntry(_0x58aaa8,_0x4e5ad4,computeSqlContentHash(_0x49a195),{'dbName':_0x40fc54}),'path':_0x1f714b,'mode':_0x3f8340},_0x10769b[_0x1655bc(0x18a)]=new Date()['toISOString'](),await writeSqlLockFile(_0x159523['lockFilePath'],_0xd1d196),{'ok':!![],'data':{'id':_0x58aaa8['id'],'sqlCode':_0x58aaa8[_0x1655bc(0x1ad)],'sqlName':_0x58aaa8[_0x1655bc(0x184)],'dbId':_0x58aaa8['dbId'],'path':_0x40fe56,'mode':_0x3f8340},'message':'Created\x20SQL\x20query\x20'+_0x58aaa8['sqlCode']};}};async function resolveSqlNewInputs(_0x591e5b){const _0x243313=await resolveSqlNameInput(_0x591e5b),{dbId:_0x13d602,dbName:_0x2fdcdc}=await resolveDbSelection(_0x591e5b),_0x86d1c5=await resolveSqlModeInput(_0x591e5b);return{'sqlName':_0x243313,'dbId':_0x13d602,'dbName':_0x2fdcdc,'mode':_0x86d1c5};}function a247_0x360c(_0x2be258,_0x543017){_0x2be258=_0x2be258-0x181;const _0x20e1b7=a247_0x20e1();let _0x360c83=_0x20e1b7[_0x2be258];return _0x360c83;}async function resolveSqlNameInput(_0x4f006f){const _0x317a93=a247_0x51145f,_0x3a69f6=_0x4f006f[_0x317a93(0x1b2)](_0x317a93(0x19f))[_0x317a93(0x1a7)]();if(_0x3a69f6)return _0x3a69f6;if(_0x4f006f[_0x317a93(0x1b1)])throw CliErrors[_0x317a93(0x182)](_0x317a93(0x19f),_0x317a93(0x1a9));return(await input({'message':_0x317a93(0x1a6),'validate':_0x14a97e=>_0x14a97e[_0x317a93(0x1a7)]()?!![]:_0x317a93(0x1ba)}))['trim']();}async function resolveDbSelection(_0x5cd4fa){const _0x14210a=a247_0x51145f,_0x3d70e=resolveProvidedDbId(_0x5cd4fa);if(typeof _0x3d70e==='number'&&Number[_0x14210a(0x1b6)](_0x3d70e)&&_0x3d70e>0x0)return{'dbId':_0x3d70e,'dbName':await getDbName(_0x5cd4fa[_0x14210a(0x187)],_0x3d70e)['catch'](()=>undefined)};if(_0x5cd4fa[_0x14210a(0x1b1)])throw CliErrors[_0x14210a(0x182)]('db-id',_0x14210a(0x189));const _0x498a4c=await listDatabases(_0x5cd4fa[_0x14210a(0x187)])[_0x14210a(0x1a1)](()=>[]);if(_0x498a4c[_0x14210a(0x1a0)]===0x1)return{'dbId':_0x498a4c[0x0][_0x14210a(0x196)],'dbName':_0x498a4c[0x0][_0x14210a(0x1b8)]};if(_0x498a4c[_0x14210a(0x1a0)]>0x1){const _0x11871b=await select({'message':_0x14210a(0x1bc),'choices':[..._0x498a4c[_0x14210a(0x186)](_0x2ab6a9=>({'name':_0x2ab6a9['dbName']+'\x20('+_0x2ab6a9[_0x14210a(0x196)]+')','value':serializeDbSelection(_0x2ab6a9)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':'__manual__'}]});if(_0x11871b!==_0x14210a(0x1b9))return deserializeDbSelection(_0x11871b);}const _0x3ab22d=await input({'message':_0x14210a(0x19b),'validate':_0x570c57=>{const _0x27cbac=_0x14210a,_0x5c63d7=_0x570c57[_0x27cbac(0x1a7)]();if(!_0x5c63d7)return _0x27cbac(0x1b0);const _0x401103=Number(_0x5c63d7);if(!Number['isInteger'](_0x401103)||_0x401103<=0x0)return _0x27cbac(0x198);return!![];}});return{'dbId':Number(_0x3ab22d[_0x14210a(0x1a7)]())};}async function resolveSqlModeInput(_0x328be9){const _0x9f9f01=a247_0x51145f,_0x5a13fa=_0x328be9[_0x9f9f01(0x1b2)](_0x9f9f01(0x183))[_0x9f9f01(0x1a7)]();if(_0x5a13fa==='sql'||_0x5a13fa==='mybatisXml')return _0x5a13fa;if(_0x328be9[_0x9f9f01(0x1b1)])throw CliErrors[_0x9f9f01(0x182)]('mode',_0x9f9f01(0x1be));return await select({'message':_0x9f9f01(0x19a),'choices':[{'name':_0x9f9f01(0x1c0),'value':_0x9f9f01(0x1af),'description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x9f9f01(0x18f),'value':'mybatisXml','description':'For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags'}]});}function serializeDbSelection(_0x38a4d7){const _0x191b87=a247_0x51145f;return JSON['stringify']({'dbId':_0x38a4d7[_0x191b87(0x196)],'dbName':_0x38a4d7[_0x191b87(0x1b8)]});}function deserializeDbSelection(_0x4b7ae7){const _0x390eb2=a247_0x51145f;try{const _0x2e4d26=JSON['parse'](_0x4b7ae7);if(typeof _0x2e4d26['dbId']===_0x390eb2(0x19c)&&Number[_0x390eb2(0x1b6)](_0x2e4d26['dbId']))return{'dbId':_0x2e4d26['dbId'],'dbName':_0x2e4d26[_0x390eb2(0x1b8)]};}catch{}throw CliErrors[_0x390eb2(0x1b7)](_0x390eb2(0x1a3)+_0x4b7ae7);}function resolveProvidedDbId(_0x528223){const _0xf0ad0f=a247_0x51145f,_0x548ac9=_0x528223[_0xf0ad0f(0x1ac)](_0xf0ad0f(0x195));if(typeof _0x548ac9===_0xf0ad0f(0x19c)&&Number[_0xf0ad0f(0x1b6)](_0x548ac9))return _0x548ac9;return undefined;}
1
+ function a247_0xde10(_0x9e92b,_0x11661b){_0x9e92b=_0x9e92b-0xc4;const _0x4c90ac=a247_0x4c90();let _0xde1075=_0x4c90ac[_0x9e92b];return _0xde1075;}const a247_0x4a1ffd=a247_0xde10;(function(_0x5841a2,_0x253863){const _0x5ab969=a247_0xde10,_0x350ab3=_0x5841a2();while(!![]){try{const _0x4dc473=-parseInt(_0x5ab969(0xce))/0x1+-parseInt(_0x5ab969(0xf5))/0x2*(parseInt(_0x5ab969(0xdd))/0x3)+-parseInt(_0x5ab969(0x100))/0x4*(parseInt(_0x5ab969(0xf2))/0x5)+parseInt(_0x5ab969(0xd8))/0x6+parseInt(_0x5ab969(0xc7))/0x7+parseInt(_0x5ab969(0xc4))/0x8*(parseInt(_0x5ab969(0x108))/0x9)+-parseInt(_0x5ab969(0xe9))/0xa*(-parseInt(_0x5ab969(0xf8))/0xb);if(_0x4dc473===_0x253863)break;else _0x350ab3['push'](_0x350ab3['shift']());}catch(_0x47467d){_0x350ab3['push'](_0x350ab3['shift']());}}}(a247_0x4c90,0xa140e));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';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function a247_0x4c90(){const _0x571edd=['File\x20already\x20exists:\x20','SELECT\x201\x20AS\x20id;','mybatisXml','sqlRootDir','1256771kRGJfD','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','/smartapi/custom/saveUserCustomSql','catch','sqls','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','SQL\x20name\x20cannot\x20be\x20empty','isInteger','<server-generated-sqlCode>','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','1839528bHtzaY','write','parse','dbId','sql','3nBUozx','trim','map','POST','dbId\x20cannot\x20be\x20empty','dbName','✎\x20Enter\x20dbId\x20manually','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','toISOString','Created\x20SQL\x20query\x20','sqlRoot','flagMissing','170rCikRL','SQL\x20query\x20display\x20name','sqlName','db-id','nonInteractive','number','Local\x20SQL\x20file\x20mode','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','appCode','5JZofmT','Select\x20the\x20target\x20database:','validation','1677918dWudWB','Plain\x20SQL\x20(sql)','length','855426QNnOzU','__manual__','\x20\x20SELECT\x201\x20AS\x20id','str','isFinite','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','string','join','334556YyAAIK','sqlCode','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','create','name','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','Invalid\x20database\x20selection\x20payload:\x20','lastSync','9BnQiDO','7768640Stjgjj','MyBatis\x20XML\x20(mybatisXml)','utf8','1681211wIQGqZ','</select>','mode'];a247_0x4c90=function(){return _0x571edd;};return a247_0x4c90();}function generateSqlTemplate(_0x363849){const _0x2094ac=a247_0xde10;if(_0x363849==='mybatisXml')return[_0x2094ac(0xfd),_0x2094ac(0xfa),_0x2094ac(0xc8),''][_0x2094ac(0xff)]('\x0a');return[_0x2094ac(0xcb),''][_0x2094ac(0xff)]('\x0a');}export const sqlCreate={'service':a247_0x4a1ffd(0xdc),'command':a247_0x4a1ffd(0x103),'description':a247_0x4a1ffd(0xd3),'risk':a247_0x4a1ffd(0xd9),'flags':[{'name':'name','type':a247_0x4a1ffd(0xfe),'description':a247_0x4a1ffd(0xea)},{'name':'db-id','type':a247_0x4a1ffd(0xee),'description':'Target\x20database\x20ID'},{'name':a247_0x4a1ffd(0xc9),'type':a247_0x4a1ffd(0xfe),'enum':[a247_0x4a1ffd(0xdc),a247_0x4a1ffd(0xcc)],'description':a247_0x4a1ffd(0xef)}],async 'validate'(_0x58d6fa){const _0x586e2=a247_0x4a1ffd;if(!_0x58d6fa[_0x586e2(0xed)])return;if(!_0x58d6fa[_0x586e2(0xfb)](_0x586e2(0x104))[_0x586e2(0xde)]())throw CliErrors[_0x586e2(0xe8)](_0x586e2(0x104),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x3785e1=resolveProvidedDbId(_0x58d6fa);if(typeof _0x3785e1!==_0x586e2(0xee)||!Number[_0x586e2(0xfc)](_0x3785e1)||_0x3785e1<=0x0)throw CliErrors[_0x586e2(0xe8)](_0x586e2(0xec),_0x586e2(0xf0));if(!_0x58d6fa[_0x586e2(0xfb)](_0x586e2(0xc9))['trim']())throw CliErrors[_0x586e2(0xe8)](_0x586e2(0xc9),_0x586e2(0xcf));},async 'dryRun'(_0x323f01){const _0x144419=a247_0x4a1ffd,_0x4f2913=loadSqlProjectConfig(_0x323f01['appCode']),{sqlName:_0x438ea0,dbId:_0xd7dc6b,dbName:_0x194dd9,mode:_0x16bc0d}=await resolveSqlNewInputs(_0x323f01),_0x4357ff=buildSqlRelativePath(_0x144419(0xd6),_0x438ea0,_0x194dd9,_0x16bc0d,_0xd7dc6b),_0x2ae7e8=_0x4f2913[_0x144419(0xcd)]+'/'+_0x4357ff;return{'method':_0x144419(0xe0),'url':_0x144419(0xd0),'body':{'appCode':_0x323f01[_0x144419(0xf1)],'sqlName':_0x438ea0,'dbId':_0xd7dc6b,'mode':_0x16bc0d,'localPath':_0x2ae7e8},'description':_0x144419(0xd7)+_0x4f2913['sqlRootDir']};},async 'execute'(_0x56100a){const _0x56cc27=a247_0x4a1ffd,_0x339a40=loadSqlProjectConfig(_0x56100a[_0x56cc27(0xf1)]),{sqlName:_0x3bd289,dbId:_0x39aa8b,dbName:_0x1db422,mode:_0x242f71}=await resolveSqlNewInputs(_0x56100a),_0x1420a5=generateSqlTemplate(_0x242f71),_0x34d832=await createSqlQuery({'appCode':_0x56100a[_0x56cc27(0xf1)],'sqlName':_0x3bd289,'dbId':_0x39aa8b,'sqlContent':_0x1420a5}),_0xd5f594=ensureRemoteSqlContent(_0x34d832),_0x2d824c=_0x1db422||await getDbName(_0x56100a['appCode'],_0x39aa8b)[_0x56cc27(0xd1)](()=>undefined),_0x3ad83a=buildSqlRelativePath(_0x34d832[_0x56cc27(0x101)],_0x34d832[_0x56cc27(0xeb)],_0x2d824c,_0x242f71,_0x39aa8b),_0x537dc3=_0x339a40['sqlRootDir']+'/'+_0x3ad83a,_0x10bb40=buildLocalSqlFileContent({'sqlCode':_0x34d832['sqlCode'],'sqlName':_0x34d832[_0x56cc27(0xeb)],'dbId':_0x34d832['dbId']},_0xd5f594,{'dbName':_0x2d824c,'mode':_0x242f71,'syncedAt':new Date()[_0x56cc27(0xe5)](),'description':_0x34d832['description']});if(await fileExists(_0x537dc3))throw CliErrors[_0x56cc27(0xf4)](_0x56cc27(0xca)+_0x537dc3);await ensureParentDirectory(_0x537dc3),await writeFile(_0x537dc3,_0x10bb40,_0x56cc27(0xc6));const _0x5d240e=await readSqlLockFile(_0x339a40['lockFilePath']),{lockData:_0x4fe5f0,appLock:_0x94f6f3}=ensureSqlLockScope(_0x5d240e??createEmptySqlLock(),_0x339a40[_0x56cc27(0xf1)],_0x339a40[_0x56cc27(0xe7)],'new');return _0x94f6f3[_0x56cc27(0xd2)][_0x34d832[_0x56cc27(0x101)]]={...buildSqlLockEntry(_0x34d832,_0xd5f594,computeSqlContentHash(_0x10bb40),{'dbName':_0x2d824c}),'path':_0x3ad83a,'mode':_0x242f71},_0x94f6f3[_0x56cc27(0x107)]=new Date()[_0x56cc27(0xe5)](),await writeSqlLockFile(_0x339a40['lockFilePath'],_0x4fe5f0),{'ok':!![],'data':{'id':_0x34d832['id'],'sqlCode':_0x34d832[_0x56cc27(0x101)],'sqlName':_0x34d832[_0x56cc27(0xeb)],'dbId':_0x34d832['dbId'],'path':_0x537dc3,'mode':_0x242f71},'message':_0x56cc27(0xe6)+_0x34d832[_0x56cc27(0x101)]};}};async function resolveSqlNewInputs(_0x42fcd6){const _0x278688=await resolveSqlNameInput(_0x42fcd6),{dbId:_0x385c3a,dbName:_0xe4dd64}=await resolveDbSelection(_0x42fcd6),_0x3d42c8=await resolveSqlModeInput(_0x42fcd6);return{'sqlName':_0x278688,'dbId':_0x385c3a,'dbName':_0xe4dd64,'mode':_0x3d42c8};}async function resolveSqlNameInput(_0x1271a0){const _0x3238e1=a247_0x4a1ffd,_0x2710cb=_0x1271a0[_0x3238e1(0xfb)](_0x3238e1(0x104))[_0x3238e1(0xde)]();if(_0x2710cb)return _0x2710cb;if(_0x1271a0[_0x3238e1(0xed)])throw CliErrors[_0x3238e1(0xe8)](_0x3238e1(0x104),_0x3238e1(0x102));return(await input({'message':'SQL\x20name:','validate':_0x3ea0fc=>_0x3ea0fc[_0x3238e1(0xde)]()?!![]:_0x3238e1(0xd4)}))['trim']();}async function resolveDbSelection(_0x542f25){const _0x2825f9=a247_0x4a1ffd,_0x47174f=resolveProvidedDbId(_0x542f25);if(typeof _0x47174f===_0x2825f9(0xee)&&Number[_0x2825f9(0xfc)](_0x47174f)&&_0x47174f>0x0)return{'dbId':_0x47174f,'dbName':await getDbName(_0x542f25[_0x2825f9(0xf1)],_0x47174f)[_0x2825f9(0xd1)](()=>undefined)};if(_0x542f25[_0x2825f9(0xed)])throw CliErrors['flagMissing'](_0x2825f9(0xec),_0x2825f9(0xf0));const _0x2a0b97=await listDatabases(_0x542f25[_0x2825f9(0xf1)])[_0x2825f9(0xd1)](()=>[]);if(_0x2a0b97[_0x2825f9(0xf7)]===0x1)return{'dbId':_0x2a0b97[0x0][_0x2825f9(0xdb)],'dbName':_0x2a0b97[0x0][_0x2825f9(0xe2)]};if(_0x2a0b97['length']>0x1){const _0x3c4826=await select({'message':_0x2825f9(0xf3),'choices':[..._0x2a0b97[_0x2825f9(0xdf)](_0x92d471=>({'name':_0x92d471[_0x2825f9(0xe2)]+'\x20('+_0x92d471[_0x2825f9(0xdb)]+')','value':serializeDbSelection(_0x92d471)})),{'name':_0x2825f9(0xe3),'value':_0x2825f9(0xf9)}]});if(_0x3c4826!==_0x2825f9(0xf9))return deserializeDbSelection(_0x3c4826);}const _0x3b2d61=await input({'message':'Target\x20database\x20dbId:','validate':_0x1ac9c2=>{const _0x2cc44a=_0x2825f9,_0x432a3f=_0x1ac9c2['trim']();if(!_0x432a3f)return _0x2cc44a(0xe1);const _0x649740=Number(_0x432a3f);if(!Number[_0x2cc44a(0xd5)](_0x649740)||_0x649740<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x3b2d61[_0x2825f9(0xde)]())};}async function resolveSqlModeInput(_0x344876){const _0x44d1b9=a247_0x4a1ffd,_0x52ed33=_0x344876[_0x44d1b9(0xfb)](_0x44d1b9(0xc9))['trim']();if(_0x52ed33===_0x44d1b9(0xdc)||_0x52ed33===_0x44d1b9(0xcc))return _0x52ed33;if(_0x344876[_0x44d1b9(0xed)])throw CliErrors[_0x44d1b9(0xe8)](_0x44d1b9(0xc9),_0x44d1b9(0xcf));return await select({'message':'Select\x20the\x20local\x20SQL\x20mode:','choices':[{'name':_0x44d1b9(0xf6),'value':_0x44d1b9(0xdc),'description':_0x44d1b9(0xe4)},{'name':_0x44d1b9(0xc5),'value':'mybatisXml','description':_0x44d1b9(0x105)}]});}function serializeDbSelection(_0x46bac9){const _0x359c46=a247_0x4a1ffd;return JSON['stringify']({'dbId':_0x46bac9[_0x359c46(0xdb)],'dbName':_0x46bac9[_0x359c46(0xe2)]});}function deserializeDbSelection(_0x2d9443){const _0x5bdcf6=a247_0x4a1ffd;try{const _0x341f6a=JSON[_0x5bdcf6(0xda)](_0x2d9443);if(typeof _0x341f6a[_0x5bdcf6(0xdb)]===_0x5bdcf6(0xee)&&Number['isFinite'](_0x341f6a[_0x5bdcf6(0xdb)]))return{'dbId':_0x341f6a['dbId'],'dbName':_0x341f6a[_0x5bdcf6(0xe2)]};}catch{}throw CliErrors[_0x5bdcf6(0xf4)](_0x5bdcf6(0x106)+_0x2d9443);}function resolveProvidedDbId(_0x2e540c){const _0x348d4b=a247_0x4a1ffd,_0x974a23=_0x2e540c['flag']('db-id');if(typeof _0x974a23==='number'&&Number[_0x348d4b(0xfc)](_0x974a23))return _0x974a23;return undefined;}
@@ -1 +1 @@
1
- const a248_0x322230=a248_0x267f;(function(_0x3ab31a,_0x38ce09){const _0x4ed891=a248_0x267f,_0x34c7dc=_0x3ab31a();while(!![]){try{const _0x5ebff9=-parseInt(_0x4ed891(0x132))/0x1+parseInt(_0x4ed891(0x12b))/0x2+-parseInt(_0x4ed891(0x11b))/0x3+parseInt(_0x4ed891(0x11e))/0x4*(parseInt(_0x4ed891(0x137))/0x5)+-parseInt(_0x4ed891(0x119))/0x6+parseInt(_0x4ed891(0x11c))/0x7+parseInt(_0x4ed891(0x136))/0x8;if(_0x5ebff9===_0x38ce09)break;else _0x34c7dc['push'](_0x34c7dc['shift']());}catch(_0x103001){_0x34c7dc['push'](_0x34c7dc['shift']());}}}(a248_0x2627,0xe3361));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a248_0x2627(){const _0x2c6d74=['20162824DlXotH','2373020axqmEI','filter','354462jzKkBi','sqls','5439750UvkCyt','232099rrRoYX','lockFilePath','4xNoxXh','\x20(local\x20file\x20moved\x20to\x20trash)','toISOString','sql','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','str','SQL\x20lock\x20file\x20not\x20found.','delete','Deleted\x20','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','validation','length','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','644568fMUqTg','sqlRoot','appCode','trashDir','remoteId','sqlcode','replace','547414ZhQNPY','POST','high-risk-write','/smartapi/custom/deleteUserCustomSql'];a248_0x2627=function(){return _0x2c6d74;};return a248_0x2627();}import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';function a248_0x267f(_0x1c7079,_0x4d2e0f){_0x1c7079=_0x1c7079-0x119;const _0x2627d5=a248_0x2627();let _0x267fec=_0x2627d5[_0x1c7079];return _0x267fec;}import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a248_0x322230(0x121),'command':a248_0x322230(0x125),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a248_0x322230(0x134),'flags':[SQLCODE_FLAG],async 'validate'(_0x5c2c21){const _0x4ad7dc=a248_0x322230,_0x24f102=loadSqlProjectConfig(_0x5c2c21['appCode']),_0x22de86=await readSqlLockFile(_0x24f102[_0x4ad7dc(0x11d)]);if(!_0x22de86)throw CliErrors[_0x4ad7dc(0x128)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x275f4c){const _0x5b70ec=a248_0x322230,_0x1f2d76=loadSqlProjectConfig(_0x275f4c[_0x5b70ec(0x12d)]),_0x57a987=await readSqlLockFile(_0x1f2d76[_0x5b70ec(0x11d)]);if(!_0x57a987)throw CliErrors[_0x5b70ec(0x128)](_0x5b70ec(0x127));const {appLock:_0x2e33fb}=ensureSqlLockScope(_0x57a987,_0x275f4c[_0x5b70ec(0x12d)],_0x1f2d76[_0x5b70ec(0x12c)],_0x5b70ec(0x125)),_0x1b2fa5=_0x275f4c[_0x5b70ec(0x123)](_0x5b70ec(0x130)),_0x1fec3a=_0x2e33fb['sqls'][_0x1b2fa5];if(!_0x1fec3a)throw CliErrors[_0x5b70ec(0x128)](_0x5b70ec(0x12a)+_0x1b2fa5+'\x22.');return{'method':_0x5b70ec(0x133),'url':_0x5b70ec(0x135),'body':{'sqlCode':_0x1b2fa5,'id':_0x1fec3a[_0x5b70ec(0x12f)],'localPath':resolveLocalSqlFilePath(_0x1f2d76,_0x1b2fa5,_0x1fec3a)},'description':'Would\x20delete\x20SQL\x20'+_0x1b2fa5+_0x5b70ec(0x122)+_0x1f2d76[_0x5b70ec(0x12e)]};},async 'execute'(_0x4f690c){const _0xbbb5c1=a248_0x322230,_0x3a1edd=loadSqlProjectConfig(_0x4f690c['appCode']),_0x4c4c69=await readSqlLockFile(_0x3a1edd[_0xbbb5c1(0x11d)]);if(!_0x4c4c69)throw CliErrors[_0xbbb5c1(0x128)](_0xbbb5c1(0x124));const {lockData:_0x19c24f,appLock:_0x30bf99}=ensureSqlLockScope(_0x4c4c69,_0x4f690c[_0xbbb5c1(0x12d)],_0x3a1edd[_0xbbb5c1(0x12c)],_0xbbb5c1(0x125)),_0x3b05e4=_0x4f690c[_0xbbb5c1(0x123)](_0xbbb5c1(0x130)),_0x521760=_0x30bf99[_0xbbb5c1(0x11a)][_0x3b05e4];if(!_0x521760)throw CliErrors[_0xbbb5c1(0x128)](_0xbbb5c1(0x12a)+_0x3b05e4+'\x22.');await deleteSqlQuery({'id':_0x521760[_0xbbb5c1(0x12f)],'sqlCode':_0x3b05e4}),_0x30bf99['sqls']=Object['fromEntries'](Object['entries'](_0x30bf99[_0xbbb5c1(0x11a)])[_0xbbb5c1(0x138)](([_0x2fd488])=>_0x2fd488!==_0x3b05e4)),_0x30bf99['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x3a1edd['lockFilePath'],_0x19c24f);const _0x4467f3=resolveLocalSqlFilePath(_0x3a1edd,_0x3b05e4,_0x521760);let _0xb3eb39;await fileExists(_0x4467f3)&&(_0xb3eb39=await moveToTrash(_0x3a1edd['projectRoot'],_0x3a1edd[_0xbbb5c1(0x12e)],_0x4467f3),await cleanupEmptyDirectories(dirname(_0x4467f3),_0x3a1edd['sqlRootDir']));const _0x24f39a={'deleted':_0x3b05e4,'remoteId':_0x521760[_0xbbb5c1(0x12f)]};if(_0xb3eb39)_0x24f39a['trashedTo']=_0xb3eb39;return{'ok':!![],'data':_0x24f39a,'message':_0xbbb5c1(0x126)+_0x3b05e4+(_0xb3eb39?_0xbbb5c1(0x11f):'')};}};async function moveToTrash(_0x3f00af,_0x265850,_0x1ea996){const _0x4cbac7=a248_0x322230,_0x152044=new Date()[_0x4cbac7(0x120)]()[_0x4cbac7(0x131)](/[:.]/g,'-'),_0x3067a0=relative(_0x3f00af,_0x1ea996),_0x45f828=join(_0x265850,_0x152044,_0x3067a0);return await mkdir(dirname(_0x45f828),{'recursive':!![]}),await rename(_0x1ea996,_0x45f828),_0x45f828;}async function cleanupEmptyDirectories(_0x39d375,_0x2bfd77){const _0x427764=a248_0x322230;let _0x245757=resolve(_0x39d375);const _0x319dce=resolve(_0x2bfd77);while(_0x245757['startsWith'](''+_0x319dce+sep)||_0x245757===_0x319dce){if(_0x245757===_0x319dce)return;try{const _0x385c80=await readdir(_0x245757);if(_0x385c80[_0x427764(0x129)]>0x0)return;await rmdir(_0x245757);}catch{return;}_0x245757=dirname(_0x245757);}}
1
+ const a248_0x38edc3=a248_0x332c;(function(_0x566d3a,_0x4dfc6a){const _0x3b2cae=a248_0x332c,_0x4fe06b=_0x566d3a();while(!![]){try{const _0xa60adb=parseInt(_0x3b2cae(0x172))/0x1+-parseInt(_0x3b2cae(0x187))/0x2+-parseInt(_0x3b2cae(0x183))/0x3+parseInt(_0x3b2cae(0x184))/0x4+-parseInt(_0x3b2cae(0x179))/0x5*(-parseInt(_0x3b2cae(0x169))/0x6)+parseInt(_0x3b2cae(0x168))/0x7*(parseInt(_0x3b2cae(0x17a))/0x8)+-parseInt(_0x3b2cae(0x16e))/0x9;if(_0xa60adb===_0x4dfc6a)break;else _0x4fe06b['push'](_0x4fe06b['shift']());}catch(_0x4852c9){_0x4fe06b['push'](_0x4fe06b['shift']());}}}(a248_0x51b4,0x43e72));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 a248_0x332c(_0x138763,_0x245819){_0x138763=_0x138763-0x168;const _0x51b4f5=a248_0x51b4();let _0x332c22=_0x51b4f5[_0x138763];return _0x332c22;}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a248_0x51b4(){const _0x2c84fe=['sqlRoot','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','str','toISOString','projectRoot','\x20(local\x20file\x20moved\x20to\x20trash)','869270ZnDBAU','4456dlVYVz','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','delete','validation','trashDir','high-risk-write','POST','sqlRootDir','Would\x20delete\x20SQL\x20','163257rZBrkU','2087284yuuWrt','replace','/smartapi/custom/deleteUserCustomSql','343742MyoDWX','appCode','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','filter','6538CqnJwU','12QjLEbs','entries','sqlcode','lockFilePath','sqls','11025540HUYHTv','trashedTo','startsWith','length','339713jMAyLb'];a248_0x51b4=function(){return _0x2c84fe;};return a248_0x51b4();}import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':'sql','command':'delete','description':a248_0x38edc3(0x17b),'risk':a248_0x38edc3(0x17f),'flags':[SQLCODE_FLAG],async 'validate'(_0x394fb6){const _0x170f69=a248_0x38edc3,_0x2cce1f=loadSqlProjectConfig(_0x394fb6['appCode']),_0x48961b=await readSqlLockFile(_0x2cce1f[_0x170f69(0x16c)]);if(!_0x48961b)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x529ebd){const _0x122889=a248_0x38edc3,_0x4ac8d2=loadSqlProjectConfig(_0x529ebd['appCode']),_0x182aee=await readSqlLockFile(_0x4ac8d2[_0x122889(0x16c)]);if(!_0x182aee)throw CliErrors[_0x122889(0x17d)](_0x122889(0x174));const {appLock:_0x3c24e6}=ensureSqlLockScope(_0x182aee,_0x529ebd[_0x122889(0x188)],_0x4ac8d2[_0x122889(0x173)],_0x122889(0x17c)),_0x3f324d=_0x529ebd['str']('sqlcode'),_0x576e49=_0x3c24e6['sqls'][_0x3f324d];if(!_0x576e49)throw CliErrors[_0x122889(0x17d)](_0x122889(0x189)+_0x3f324d+'\x22.');return{'method':_0x122889(0x180),'url':_0x122889(0x186),'body':{'sqlCode':_0x3f324d,'id':_0x576e49['remoteId'],'localPath':resolveLocalSqlFilePath(_0x4ac8d2,_0x3f324d,_0x576e49)},'description':_0x122889(0x182)+_0x3f324d+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x4ac8d2[_0x122889(0x17e)]};},async 'execute'(_0x1b2de0){const _0x37b007=a248_0x38edc3,_0x53e004=loadSqlProjectConfig(_0x1b2de0['appCode']),_0x26a2d2=await readSqlLockFile(_0x53e004[_0x37b007(0x16c)]);if(!_0x26a2d2)throw CliErrors[_0x37b007(0x17d)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x436759,appLock:_0x2fe35d}=ensureSqlLockScope(_0x26a2d2,_0x1b2de0[_0x37b007(0x188)],_0x53e004[_0x37b007(0x173)],_0x37b007(0x17c)),_0x20106a=_0x1b2de0[_0x37b007(0x175)](_0x37b007(0x16b)),_0x2737ad=_0x2fe35d[_0x37b007(0x16d)][_0x20106a];if(!_0x2737ad)throw CliErrors[_0x37b007(0x17d)](_0x37b007(0x189)+_0x20106a+'\x22.');await deleteSqlQuery({'id':_0x2737ad['remoteId'],'sqlCode':_0x20106a}),_0x2fe35d[_0x37b007(0x16d)]=Object['fromEntries'](Object[_0x37b007(0x16a)](_0x2fe35d['sqls'])[_0x37b007(0x18a)](([_0x4083e7])=>_0x4083e7!==_0x20106a)),_0x2fe35d['lastSync']=new Date()[_0x37b007(0x176)](),await writeSqlLockFile(_0x53e004[_0x37b007(0x16c)],_0x436759);const _0x1eab00=resolveLocalSqlFilePath(_0x53e004,_0x20106a,_0x2737ad);let _0x3a9504;await fileExists(_0x1eab00)&&(_0x3a9504=await moveToTrash(_0x53e004[_0x37b007(0x177)],_0x53e004[_0x37b007(0x17e)],_0x1eab00),await cleanupEmptyDirectories(dirname(_0x1eab00),_0x53e004[_0x37b007(0x181)]));const _0x24a32e={'deleted':_0x20106a,'remoteId':_0x2737ad['remoteId']};if(_0x3a9504)_0x24a32e[_0x37b007(0x16f)]=_0x3a9504;return{'ok':!![],'data':_0x24a32e,'message':'Deleted\x20'+_0x20106a+(_0x3a9504?_0x37b007(0x178):'')};}};async function moveToTrash(_0xf6341,_0x3f0c0f,_0x28bf59){const _0x227618=a248_0x38edc3,_0x4d2f95=new Date()[_0x227618(0x176)]()[_0x227618(0x185)](/[:.]/g,'-'),_0x2cd2d8=relative(_0xf6341,_0x28bf59),_0x57dd24=join(_0x3f0c0f,_0x4d2f95,_0x2cd2d8);return await mkdir(dirname(_0x57dd24),{'recursive':!![]}),await rename(_0x28bf59,_0x57dd24),_0x57dd24;}async function cleanupEmptyDirectories(_0x4ac953,_0x579df0){const _0x2b6be9=a248_0x38edc3;let _0xcd42=resolve(_0x4ac953);const _0x28fc4e=resolve(_0x579df0);while(_0xcd42[_0x2b6be9(0x170)](''+_0x28fc4e+sep)||_0xcd42===_0x28fc4e){if(_0xcd42===_0x28fc4e)return;try{const _0x370318=await readdir(_0xcd42);if(_0x370318[_0x2b6be9(0x171)]>0x0)return;await rmdir(_0xcd42);}catch{return;}_0xcd42=dirname(_0xcd42);}}
@@ -1 +1 @@
1
- function a249_0x3ed2(_0x28c2bc,_0x2cc699){_0x28c2bc=_0x28c2bc-0x189;const _0x2f5d89=a249_0x2f5d();let _0x3ed2a6=_0x2f5d89[_0x28c2bc];return _0x3ed2a6;}const a249_0x550782=a249_0x3ed2;function a249_0x2f5d(){const _0x4b95f1=['appCode','sqlContent','50982890dwZMUp','1198957UNJtBq','404410IOOiJp','read','1682884BFHNCs','264SBfpJh','description','sql','96cAMLaF','str','63sGSbHI','51304QzQSqq','detail','42300dfjkpd','Return\x20full\x20raw\x20SQL\x20query\x20object','1760301RXMgCq','verbose','dbId','boolean'];a249_0x2f5d=function(){return _0x4b95f1;};return a249_0x2f5d();}(function(_0x77c9f8,_0x5a0698){const _0x97af1e=a249_0x3ed2,_0x238592=_0x77c9f8();while(!![]){try{const _0x317d29=-parseInt(_0x97af1e(0x18b))/0x1+-parseInt(_0x97af1e(0x18e))/0x2+parseInt(_0x97af1e(0x18f))/0x3*(-parseInt(_0x97af1e(0x197))/0x4)+parseInt(_0x97af1e(0x18c))/0x5*(-parseInt(_0x97af1e(0x192))/0x6)+parseInt(_0x97af1e(0x194))/0x7*(parseInt(_0x97af1e(0x195))/0x8)+-parseInt(_0x97af1e(0x199))/0x9+parseInt(_0x97af1e(0x18a))/0xa;if(_0x317d29===_0x5a0698)break;else _0x238592['push'](_0x238592['shift']());}catch(_0x393519){_0x238592['push'](_0x238592['shift']());}}}(a249_0x2f5d,0xa9c0a));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a249_0x550782(0x191),'command':a249_0x550782(0x196),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a249_0x550782(0x18d),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a249_0x550782(0x19c),'description':a249_0x550782(0x198)}],async 'execute'(_0x5c6a6e){const _0x56dfab=a249_0x550782,_0x3cfbb8=await getSqlQueryInfo(_0x5c6a6e[_0x56dfab(0x19d)],_0x5c6a6e[_0x56dfab(0x193)]('sqlcode')),_0x57fe0e=_0x5c6a6e['bool'](_0x56dfab(0x19a));if(_0x57fe0e)return{'ok':!![],'data':_0x3cfbb8};const _0x32d383=_0x3cfbb8[_0x56dfab(0x19b)]?await getDbName(_0x5c6a6e[_0x56dfab(0x19d)],_0x3cfbb8['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x3cfbb8['sqlCode'],'sqlName':_0x3cfbb8['sqlName'],'db':_0x32d383?_0x32d383+'\x20('+_0x3cfbb8[_0x56dfab(0x19b)]+')':_0x3cfbb8[_0x56dfab(0x19b)]??'','description':_0x3cfbb8[_0x56dfab(0x190)]??'','sqlContent':_0x3cfbb8[_0x56dfab(0x189)]??''}};}};
1
+ const a249_0x2038f1=a249_0x4abe;(function(_0x1450d2,_0x35c20a){const _0x47a9ff=a249_0x4abe,_0x476c3d=_0x1450d2();while(!![]){try{const _0x44dd3a=-parseInt(_0x47a9ff(0xd4))/0x1*(-parseInt(_0x47a9ff(0xc9))/0x2)+-parseInt(_0x47a9ff(0xdd))/0x3+-parseInt(_0x47a9ff(0xca))/0x4*(-parseInt(_0x47a9ff(0xcc))/0x5)+-parseInt(_0x47a9ff(0xcd))/0x6+parseInt(_0x47a9ff(0xd7))/0x7*(parseInt(_0x47a9ff(0xce))/0x8)+parseInt(_0x47a9ff(0xd6))/0x9*(parseInt(_0x47a9ff(0xdb))/0xa)+-parseInt(_0x47a9ff(0xcf))/0xb;if(_0x44dd3a===_0x35c20a)break;else _0x476c3d['push'](_0x476c3d['shift']());}catch(_0x39cc09){_0x476c3d['push'](_0x476c3d['shift']());}}}(a249_0x4dc8,0x71adb));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a249_0x4abe(_0x53fecf,_0x3cc8c5){_0x53fecf=_0x53fecf-0xc9;const _0x4dc881=a249_0x4dc8();let _0x4abeb1=_0x4dc881[_0x53fecf];return _0x4abeb1;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a249_0x2038f1(0xdc),'command':a249_0x2038f1(0xd8),'description':a249_0x2038f1(0xcb),'risk':a249_0x2038f1(0xdf),'flags':[SQLCODE_FLAG,{'name':a249_0x2038f1(0xde),'type':a249_0x2038f1(0xd1),'description':a249_0x2038f1(0xd0)}],async 'execute'(_0xbd28ab){const _0x21bf6d=a249_0x2038f1,_0x205618=await getSqlQueryInfo(_0xbd28ab['appCode'],_0xbd28ab['str']('sqlcode')),_0x3b2488=_0xbd28ab[_0x21bf6d(0xd3)](_0x21bf6d(0xde));if(_0x3b2488)return{'ok':!![],'data':_0x205618};const _0x462f47=_0x205618[_0x21bf6d(0xd9)]?await getDbName(_0xbd28ab[_0x21bf6d(0xda)],_0x205618['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x205618['sqlCode'],'sqlName':_0x205618[_0x21bf6d(0xd2)],'db':_0x462f47?_0x462f47+'\x20('+_0x205618[_0x21bf6d(0xd9)]+')':_0x205618[_0x21bf6d(0xd9)]??'','description':_0x205618[_0x21bf6d(0xd5)]??'','sqlContent':_0x205618['sqlContent']??''}};}};function a249_0x4dc8(){const _0x2398f9=['23626uvBtMN','124YaaSqp','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','106395TtKAny','3104838oeyNpO','190752HTqrbi','19980939RMzpnH','Return\x20full\x20raw\x20SQL\x20query\x20object','boolean','sqlName','bool','57tYEIUO','description','5517fZTcAE','217FDStGB','detail','dbId','appCode','13620puhyuJ','sql','322533vGzzIq','verbose','read'];a249_0x4dc8=function(){return _0x2398f9;};return a249_0x4dc8();}
@@ -1 +1 @@
1
- const a250_0x1c91b3=a250_0x1712;(function(_0x13220e,_0x21b900){const _0x263186=a250_0x1712,_0x1016f7=_0x13220e();while(!![]){try{const _0x334f09=parseInt(_0x263186(0x166))/0x1*(parseInt(_0x263186(0x171))/0x2)+parseInt(_0x263186(0x15f))/0x3*(-parseInt(_0x263186(0x16b))/0x4)+parseInt(_0x263186(0x160))/0x5+-parseInt(_0x263186(0x163))/0x6+-parseInt(_0x263186(0x161))/0x7*(-parseInt(_0x263186(0x169))/0x8)+-parseInt(_0x263186(0x16d))/0x9+parseInt(_0x263186(0x176))/0xa*(parseInt(_0x263186(0x174))/0xb);if(_0x334f09===_0x21b900)break;else _0x1016f7['push'](_0x1016f7['shift']());}catch(_0x21f4ce){_0x1016f7['push'](_0x1016f7['shift']());}}}(a250_0xb39d,0x94fe6));import{executeSql}from'../../core/api-client.js';function a250_0x1712(_0xadca17,_0x27713a){_0xadca17=_0xadca17-0x15e;const _0xb39d51=a250_0xb39d();let _0x1712a2=_0xb39d51[_0xadca17];return _0x1712a2;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a250_0xb39d(){const _0x3ba708=['10jfTECX','read','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','92719CuhiHr','sqlcode','590nmesMz','execSuccess','1194pQJJOj','5214175IKlvHO','14oPJcrh','execError','6213216oMhFGR','length','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','233126nxsXPL','params','appCode','3726152BXFrCt','str','8212axlJLT','SQL\x20execution\x20failed','10569654xiIIeY','Returned\x20','isArray','string'];a250_0xb39d=function(){return _0x3ba708;};return a250_0xb39d();}export const sqlExec={'service':'sql','command':'exec','description':a250_0x1c91b3(0x165),'risk':a250_0x1c91b3(0x172),'flags':[SQLCODE_FLAG,{'name':'params','type':a250_0x1c91b3(0x170),'description':a250_0x1c91b3(0x173)}],async 'execute'(_0x48cf08){const _0x8fc061=a250_0x1c91b3,_0x1a95b7=parseJsonParams(_0x48cf08[_0x8fc061(0x16a)](_0x8fc061(0x167))),_0x4c149c=Date['now'](),_0x5cd7b6=await executeSql(_0x48cf08[_0x8fc061(0x168)],_0x48cf08[_0x8fc061(0x16a)](_0x8fc061(0x175)),_0x1a95b7),_0x11512e=Date['now']()-_0x4c149c,_0x4bef39=_0x5cd7b6?.['execResult']??_0x5cd7b6,_0x369ff5=_0x5cd7b6?.[_0x8fc061(0x15e)]??!![];if(!_0x369ff5)return{'ok':![],'data':{'error':_0x5cd7b6?.[_0x8fc061(0x162)]||_0x8fc061(0x16c),'elapsed':_0x11512e},'message':_0x8fc061(0x16c)};const _0x5eadf8=Array[_0x8fc061(0x16f)](_0x4bef39)?_0x4bef39:[];return{'ok':!![],'data':{'rows':_0x5eadf8,'rowCount':_0x5eadf8['length'],'elapsed':_0x11512e},'message':_0x8fc061(0x16e)+_0x5eadf8[_0x8fc061(0x164)]+'\x20row(s)\x20in\x20'+_0x11512e+'ms'};}};
1
+ const a250_0x4c5090=a250_0x3a2f;function a250_0x3a2f(_0x33f61e,_0x2dc5da){_0x33f61e=_0x33f61e-0x94;const _0x577b9f=a250_0x577b();let _0x3a2f88=_0x577b9f[_0x33f61e];return _0x3a2f88;}(function(_0x27c742,_0x800277){const _0x2dc2b7=a250_0x3a2f,_0x2cf7b8=_0x27c742();while(!![]){try{const _0x2cf19a=parseInt(_0x2dc2b7(0x9d))/0x1*(-parseInt(_0x2dc2b7(0x98))/0x2)+parseInt(_0x2dc2b7(0x96))/0x3+parseInt(_0x2dc2b7(0x9f))/0x4+-parseInt(_0x2dc2b7(0xab))/0x5*(-parseInt(_0x2dc2b7(0x9b))/0x6)+parseInt(_0x2dc2b7(0x9a))/0x7*(-parseInt(_0x2dc2b7(0x9e))/0x8)+parseInt(_0x2dc2b7(0xa4))/0x9+parseInt(_0x2dc2b7(0xa1))/0xa*(-parseInt(_0x2dc2b7(0x9c))/0xb);if(_0x2cf19a===_0x800277)break;else _0x2cf7b8['push'](_0x2cf7b8['shift']());}catch(_0x137222){_0x2cf7b8['push'](_0x2cf7b8['shift']());}}}(a250_0x577b,0xbf3ac));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a250_0x577b(){const _0x92629b=['SQL\x20execution\x20failed','length','11861604dqRGyh','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','appCode','str','string','execSuccess','20EEzWXv','isArray','exec','2161773cMWSOT','params','406vGGnbr','now','105atjXZS','788928lVKsNo','5203LxqAhs','409lrvyVP','474104BgXgyv','5772700FlcDMs','sql','47620nXjEPe'];a250_0x577b=function(){return _0x92629b;};return a250_0x577b();}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a250_0x4c5090(0xa0),'command':a250_0x4c5090(0x95),'description':a250_0x4c5090(0xa6),'risk':'read','flags':[SQLCODE_FLAG,{'name':a250_0x4c5090(0x97),'type':a250_0x4c5090(0xa9),'description':a250_0x4c5090(0xa5)}],async 'execute'(_0x290ce5){const _0x4898db=a250_0x4c5090,_0x2db242=parseJsonParams(_0x290ce5[_0x4898db(0xa8)](_0x4898db(0x97))),_0x16ce6f=Date[_0x4898db(0x99)](),_0x375093=await executeSql(_0x290ce5[_0x4898db(0xa7)],_0x290ce5[_0x4898db(0xa8)]('sqlcode'),_0x2db242),_0x180deb=Date['now']()-_0x16ce6f,_0x2f3236=_0x375093?.['execResult']??_0x375093,_0x5d5310=_0x375093?.[_0x4898db(0xaa)]??!![];if(!_0x5d5310)return{'ok':![],'data':{'error':_0x375093?.['execError']||_0x4898db(0xa2),'elapsed':_0x180deb},'message':_0x4898db(0xa2)};const _0x771224=Array[_0x4898db(0x94)](_0x2f3236)?_0x2f3236:[];return{'ok':!![],'data':{'rows':_0x771224,'rowCount':_0x771224[_0x4898db(0xa3)],'elapsed':_0x180deb},'message':'Returned\x20'+_0x771224[_0x4898db(0xa3)]+'\x20row(s)\x20in\x20'+_0x180deb+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x4b38a4,_0x810df4){const _0x58bdc3=a251_0x2b70,_0x16890f=_0x4b38a4();while(!![]){try{const _0xfaadf3=-parseInt(_0x58bdc3(0x1d6))/0x1*(-parseInt(_0x58bdc3(0x1d9))/0x2)+-parseInt(_0x58bdc3(0x1dd))/0x3+-parseInt(_0x58bdc3(0x1db))/0x4*(parseInt(_0x58bdc3(0x1de))/0x5)+-parseInt(_0x58bdc3(0x1da))/0x6+parseInt(_0x58bdc3(0x1d7))/0x7+-parseInt(_0x58bdc3(0x1d8))/0x8+parseInt(_0x58bdc3(0x1dc))/0x9;if(_0xfaadf3===_0x810df4)break;else _0x16890f['push'](_0x16890f['shift']());}catch(_0x5a4a00){_0x16890f['push'](_0x16890f['shift']());}}}(a251_0x3ad1,0x430c6));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a251_0x3ad1(){const _0x251ab0=['1494465PzxgTC','3709072yIlnVY','2uvQhnx','3047754zrtCNN','4dkhHdD','10360656ZPPIGW','994578MLRHpk','82370UQWjKT','229544owXJxz'];a251_0x3ad1=function(){return _0x251ab0;};return a251_0x3ad1();}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';function a251_0x2b70(_0x547a12,_0x3bbeb5){_0x547a12=_0x547a12-0x1d6;const _0x3ad134=a251_0x3ad1();let _0x2b7096=_0x3ad134[_0x547a12];return _0x2b7096;}export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x5ae38e,_0x9230d4){const _0x55bd4b=a251_0x1ebf,_0x23512e=_0x5ae38e();while(!![]){try{const _0x1a4e63=-parseInt(_0x55bd4b(0x139))/0x1+parseInt(_0x55bd4b(0x13b))/0x2*(parseInt(_0x55bd4b(0x13c))/0x3)+-parseInt(_0x55bd4b(0x13f))/0x4+parseInt(_0x55bd4b(0x138))/0x5+parseInt(_0x55bd4b(0x13a))/0x6+parseInt(_0x55bd4b(0x13e))/0x7+parseInt(_0x55bd4b(0x13d))/0x8;if(_0x1a4e63===_0x9230d4)break;else _0x23512e['push'](_0x23512e['shift']());}catch(_0x355161){_0x23512e['push'](_0x23512e['shift']());}}}(a251_0x5ef6,0xbd3b2));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a251_0x5ef6(){const _0xe29069=['1358644BPBKIK','4135412mwlHJl','3318820rIReTm','1301267zGPDag','3684102cLpUtw','248eVMGZa','30177yEYjRp','3128168puSpKi'];a251_0x5ef6=function(){return _0xe29069;};return a251_0x5ef6();}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';function a251_0x1ebf(_0x5ef449,_0x53dca1){_0x5ef449=_0x5ef449-0x138;const _0x5ef686=a251_0x5ef6();let _0x1ebffb=_0x5ef686[_0x5ef449];return _0x1ebffb;}export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a252_0x486405=a252_0x4f9e;function a252_0x600e(){const _0x3a5912=['Filter\x20by\x20SQL\x20name','2168zdiWnG','No\x20custom\x20SQL\x20queries\x20found.','list','Page\x20number','4088uKfGQu','880517oCqhim','5010SHMiTO','page','1771630prPTlC','8781tPdXFV','sql','str','description','sqlcode','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','76010eLSUxk','name','96qrnNfu','string','appCode','667368aIYbnw','4tJGrVD','map','pagesize','length','all','bool','dbId','verbose','Found\x20','number','totalCount','89vUxuiK','sqlName','List\x20custom\x20SQL\x20queries','num','sqlCode'];a252_0x600e=function(){return _0x3a5912;};return a252_0x600e();}(function(_0x18babc,_0x5615b8){const _0x1db9fb=a252_0x4f9e,_0x50646e=_0x18babc();while(!![]){try{const _0x5bd781=parseInt(_0x1db9fb(0x87))/0x1*(parseInt(_0x1db9fb(0x6d))/0x2)+parseInt(_0x1db9fb(0x70))/0x3*(parseInt(_0x1db9fb(0x7c))/0x4)+parseInt(_0x1db9fb(0x76))/0x5*(-parseInt(_0x1db9fb(0x78))/0x6)+parseInt(_0x1db9fb(0x6b))/0x7*(parseInt(_0x1db9fb(0x67))/0x8)+-parseInt(_0x1db9fb(0x7b))/0x9+parseInt(_0x1db9fb(0x6f))/0xa+-parseInt(_0x1db9fb(0x6c))/0xb;if(_0x5bd781===_0x5615b8)break;else _0x50646e['push'](_0x50646e['shift']());}catch(_0x58d34b){_0x50646e['push'](_0x50646e['shift']());}}}(a252_0x600e,0x2801c));import{listSqlQueries}from'../../core/api-client.js';function a252_0x4f9e(_0x3489ee,_0x7b882c){_0x3489ee=_0x3489ee-0x64;const _0x600ed2=a252_0x600e();let _0x4f9e6c=_0x600ed2[_0x3489ee];return _0x4f9e6c;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a252_0x486405(0x71),'command':a252_0x486405(0x69),'description':a252_0x486405(0x89),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0x486405(0x77),'type':a252_0x486405(0x79),'description':a252_0x486405(0x66)},{'name':a252_0x486405(0x6e),'type':a252_0x486405(0x85),'description':a252_0x486405(0x6a),'default':0x1},{'name':a252_0x486405(0x7e),'type':a252_0x486405(0x85),'description':'Page\x20size'},{'name':a252_0x486405(0x83),'type':'boolean','description':a252_0x486405(0x75)}],async 'execute'(_0x2497fe){const _0x13602d=a252_0x486405,_0x3f5d0a=await listSqlQueries(_0x2497fe[_0x13602d(0x7a)],{'sqlCode':_0x2497fe[_0x13602d(0x72)](_0x13602d(0x74))||undefined,'sqlName':_0x2497fe['str']('name')||undefined,'currentPage':_0x2497fe[_0x13602d(0x64)](_0x13602d(0x6e)),'pageSize':_0x2497fe['num']('pagesize',0x32)}),_0x42eae6=_0x2497fe[_0x13602d(0x81)]('verbose'),_0x1f5128=_0x3f5d0a['tableData']??[],_0x33a84c=_0x3f5d0a['paging']?.[_0x13602d(0x86)]??_0x1f5128[_0x13602d(0x7f)];let _0x11458d;return _0x42eae6?_0x11458d=_0x1f5128:_0x11458d=await Promise[_0x13602d(0x80)](_0x1f5128[_0x13602d(0x7d)](async _0xa7d583=>{const _0x49c9aa=_0x13602d;let _0x114fd4;try{_0x114fd4=_0xa7d583[_0x49c9aa(0x82)]?await getDbName(_0x2497fe[_0x49c9aa(0x7a)],_0xa7d583[_0x49c9aa(0x82)]):undefined;}catch{}return{'sqlCode':_0xa7d583[_0x49c9aa(0x65)],'sqlName':_0xa7d583[_0x49c9aa(0x88)],'description':_0xa7d583[_0x49c9aa(0x73)]??'','db':_0x114fd4?_0x114fd4+'\x20('+_0xa7d583[_0x49c9aa(0x82)]+')':_0xa7d583['dbId']??''};})),{'ok':!![],'data':_0x11458d,'message':_0x1f5128[_0x13602d(0x7f)]===0x0?_0x13602d(0x68):_0x13602d(0x84)+_0x1f5128[_0x13602d(0x7f)]+'\x20SQL\x20queries\x20(total:\x20'+_0x33a84c+').'};}};
1
+ const a252_0x126c6c=a252_0x54aa;(function(_0x3d199d,_0xa8282){const _0x6fba58=a252_0x54aa,_0x3f0944=_0x3d199d();while(!![]){try{const _0x4780b2=-parseInt(_0x6fba58(0xec))/0x1+-parseInt(_0x6fba58(0xf4))/0x2*(-parseInt(_0x6fba58(0xef))/0x3)+parseInt(_0x6fba58(0xe8))/0x4*(parseInt(_0x6fba58(0xfb))/0x5)+-parseInt(_0x6fba58(0xe7))/0x6*(parseInt(_0x6fba58(0xfa))/0x7)+-parseInt(_0x6fba58(0x106))/0x8+parseInt(_0x6fba58(0xea))/0x9+parseInt(_0x6fba58(0xeb))/0xa*(parseInt(_0x6fba58(0xf8))/0xb);if(_0x4780b2===_0xa8282)break;else _0x3f0944['push'](_0x3f0944['shift']());}catch(_0x472b84){_0x3f0944['push'](_0x3f0944['shift']());}}}(a252_0x3d30,0xed129));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a252_0x54aa(_0x32880a,_0x50461d){_0x32880a=_0x32880a-0xe3;const _0x3d3048=a252_0x3d30();let _0x54aa10=_0x3d3048[_0x32880a];return _0x54aa10;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a252_0x3d30(){const _0x2f8207=['bool','7207016JTeWQj','dbId','verbose','Page\x20number','page','6KyiiRO','234188YkiLjk','name','2861604zeUBmI','6775390avoezF','1257896sDjLFF','Filter\x20by\x20SQL\x20name','pagesize','41322JtKMZM','tableData','paging','num','description','88CIAoCC','str','boolean','sqlName','33wpOBaN','length','836794AMrFPu','25zbDjyV','sqlCode','sqlcode','read','No\x20custom\x20SQL\x20queries\x20found.','number','appCode','List\x20custom\x20SQL\x20queries','Page\x20size','\x20SQL\x20queries\x20(total:\x20'];a252_0x3d30=function(){return _0x2f8207;};return a252_0x3d30();}export const sqlList={'service':'sql','command':'list','description':a252_0x126c6c(0x102),'risk':a252_0x126c6c(0xfe),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0x126c6c(0xe9),'type':'string','description':a252_0x126c6c(0xed)},{'name':a252_0x126c6c(0xe6),'type':a252_0x126c6c(0x100),'description':a252_0x126c6c(0xe5),'default':0x1},{'name':a252_0x126c6c(0xee),'type':a252_0x126c6c(0x100),'description':a252_0x126c6c(0x103)},{'name':a252_0x126c6c(0xe4),'type':a252_0x126c6c(0xf6),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x16c9e2){const _0x5d9356=a252_0x126c6c,_0x54c981=await listSqlQueries(_0x16c9e2[_0x5d9356(0x101)],{'sqlCode':_0x16c9e2[_0x5d9356(0xf5)](_0x5d9356(0xfd))||undefined,'sqlName':_0x16c9e2[_0x5d9356(0xf5)](_0x5d9356(0xe9))||undefined,'currentPage':_0x16c9e2[_0x5d9356(0xf2)](_0x5d9356(0xe6)),'pageSize':_0x16c9e2[_0x5d9356(0xf2)](_0x5d9356(0xee),0x32)}),_0xed7157=_0x16c9e2[_0x5d9356(0x105)](_0x5d9356(0xe4)),_0x4065a7=_0x54c981[_0x5d9356(0xf0)]??[],_0x29e0ba=_0x54c981[_0x5d9356(0xf1)]?.['totalCount']??_0x4065a7['length'];let _0x59ac27;return _0xed7157?_0x59ac27=_0x4065a7:_0x59ac27=await Promise['all'](_0x4065a7['map'](async _0x45d708=>{const _0x35f0d6=_0x5d9356;let _0x245735;try{_0x245735=_0x45d708[_0x35f0d6(0xe3)]?await getDbName(_0x16c9e2['appCode'],_0x45d708[_0x35f0d6(0xe3)]):undefined;}catch{}return{'sqlCode':_0x45d708[_0x35f0d6(0xfc)],'sqlName':_0x45d708[_0x35f0d6(0xf7)],'description':_0x45d708[_0x35f0d6(0xf3)]??'','db':_0x245735?_0x245735+'\x20('+_0x45d708[_0x35f0d6(0xe3)]+')':_0x45d708[_0x35f0d6(0xe3)]??''};})),{'ok':!![],'data':_0x59ac27,'message':_0x4065a7[_0x5d9356(0xf9)]===0x0?_0x5d9356(0xff):'Found\x20'+_0x4065a7[_0x5d9356(0xf9)]+_0x5d9356(0x104)+_0x29e0ba+').'};}};
@@ -1 +1 @@
1
- const a253_0x5530e8=a253_0x166c;(function(_0xd5b73b,_0x12bca3){const _0x36997e=a253_0x166c,_0x304652=_0xd5b73b();while(!![]){try{const _0x3d2fb8=parseInt(_0x36997e(0xda))/0x1+-parseInt(_0x36997e(0xc7))/0x2*(parseInt(_0x36997e(0xc1))/0x3)+-parseInt(_0x36997e(0xbf))/0x4+parseInt(_0x36997e(0xdf))/0x5*(-parseInt(_0x36997e(0xde))/0x6)+-parseInt(_0x36997e(0xf1))/0x7*(-parseInt(_0x36997e(0xc9))/0x8)+parseInt(_0x36997e(0xd2))/0x9+-parseInt(_0x36997e(0xb8))/0xa*(-parseInt(_0x36997e(0xdc))/0xb);if(_0x3d2fb8===_0x12bca3)break;else _0x304652['push'](_0x304652['shift']());}catch(_0x1ac0c7){_0x304652['push'](_0x304652['shift']());}}}(a253_0x3810,0x86197));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a253_0x3810(){const _0x705860=['mode','742962YLVjyp','length','90AnZhpg','231185LBqiVp','endsWith','Force\x20pull\x20cancelled.','\x20SQL\x20file(s)\x20into\x20','sqlContent','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','conflict','isCanonical','Would\x20pull\x20','string','Filter\x20by\x20SQL\x20display\x20name','catch','equivalent','test','str','trim','filter','some','283227wGpQJR','cancelled','toLowerCase','push','apps','mybatisXml','skipped','map','replace','Pull\x20complete:\x20','split','appCode','sqls','all','totalCount','sqlRootDir','20unfiAB','sqlcode','content','sqlCode','pull','find','sqlName','3593876aKKTWp','tableData','184887BDNemT','toISOString','sql','Force\x20overwrite\x20local\x20unsynced\x20changes','dbId','\x20failed','18ZemRkk','name','200azSNdA','paging','file','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','.xml','path','lastSync','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','boolean','5956029XKodGt','lockFilePath','unchanged','hash','sqlRoot','filePath','description','message','887566XVoRKb'];a253_0x3810=function(){return _0x705860;};return a253_0x3810();}import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x37bfc3,_0x440738){const _0x2cb512=a253_0x166c,_0x55f41f=[];let _0x4cccfb=0x1;while(!![]){const _0x3a48e6=await listSqlQueries(_0x37bfc3,{'currentPage':_0x4cccfb,'pageSize':PAGE_SIZE,'sqlCode':_0x440738[_0x2cb512(0xbb)],'sqlName':_0x440738[_0x2cb512(0xbe)]}),_0x4aa34f=_0x3a48e6[_0x2cb512(0xc0)]??[];_0x55f41f[_0x2cb512(0xf4)](..._0x4aa34f);if(_0x4aa34f['length']===0x0)break;const _0x432829=_0x3a48e6[_0x2cb512(0xca)]?.[_0x2cb512(0xb6)];if(_0x432829!=null?_0x55f41f[_0x2cb512(0xdd)]>=_0x432829:_0x4aa34f['length']<PAGE_SIZE)break;_0x4cccfb++;}return _0x55f41f;}async function ensureSqlContent(_0x57677c){const _0x2abfe9=a253_0x166c;if(_0x57677c[_0x2abfe9(0xe3)]!=null&&String(_0x57677c[_0x2abfe9(0xe3)])[_0x2abfe9(0xdd)]>0x0)return _0x57677c;return getSqlQueryDetail(_0x57677c[_0x2abfe9(0xbb)]);}export const sqlPull={'service':a253_0x5530e8(0xc3),'command':a253_0x5530e8(0xbc),'description':a253_0x5530e8(0xd0),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x5530e8(0xc8),'type':a253_0x5530e8(0xe8),'description':a253_0x5530e8(0xe9)},{'name':'force','type':a253_0x5530e8(0xd1),'description':a253_0x5530e8(0xc4)}],async 'dryRun'(_0x45641d){const _0x1197ab=a253_0x5530e8,_0x3c608b=loadSqlProjectConfig(_0x45641d[_0x1197ab(0xfc)]),_0x2b18b2=await readSqlLockFile(_0x3c608b[_0x1197ab(0xd3)]),{appLock:_0x1055f9}=ensureSqlLockScope(_0x2b18b2??createEmptySqlLock(),_0x3c608b[_0x1197ab(0xfc)],_0x3c608b[_0x1197ab(0xd6)],'pull'),_0x3ea461=await fetchAllSqlQueries(_0x45641d[_0x1197ab(0xfc)],{'sqlCode':_0x45641d[_0x1197ab(0xed)](_0x1197ab(0xb9))||undefined,'sqlName':_0x45641d['str'](_0x1197ab(0xc8))||undefined}),_0x590147=[];for(const _0x3c8126 of _0x3ea461){const _0x24ba1f=await ensureSqlContent(_0x3c8126),_0x58407b=ensureRemoteSqlContent(_0x24ba1f),_0x28e203=detectSqlMode(_0x58407b),_0x3d0329=_0x24ba1f[_0x1197ab(0xc5)]?await getDbName(_0x45641d[_0x1197ab(0xfc)],Number(_0x24ba1f['dbId']))[_0x1197ab(0xea)](()=>undefined):undefined,_0x2b40e3=buildLocalSqlFileContent({'sqlCode':_0x24ba1f[_0x1197ab(0xbb)],'sqlName':_0x24ba1f[_0x1197ab(0xbe)],'dbId':_0x24ba1f[_0x1197ab(0xc5)]},_0x58407b,{'dbName':_0x3d0329,'mode':_0x28e203,'syncedAt':new Date()[_0x1197ab(0xc2)](),'description':_0x24ba1f['description']}),_0x5ac5a0=buildSqlLockEntry(_0x24ba1f,_0x58407b,'',{'dbName':_0x3d0329}),_0x30ef7c=resolveLocalSqlFilePath(_0x3c608b,_0x24ba1f['sqlCode'],_0x5ac5a0);let _0x4e6ef2='would_pull',_0x2432dd;const _0x142b9f=await findExistingSqlFiles(_0x3c608b,_0x30ef7c,_0x28e203,_0x1055f9[_0x1197ab(0xb4)][_0x24ba1f[_0x1197ab(0xbb)]]);if(_0x142b9f[_0x1197ab(0xdd)]>0x0){const _0x106fcf=await compareExistingSqlFiles(_0x142b9f,_0x2b40e3,_0x28e203);if(_0x106fcf[_0x1197ab(0xf0)](({equivalent:_0x253334})=>!_0x253334))_0x4e6ef2=_0x1197ab(0xe5),_0x2432dd='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)';else _0x106fcf[_0x1197ab(0xdd)]===0x1&&_0x106fcf[0x0]?.[_0x1197ab(0xcb)]['isCanonical']&&(_0x4e6ef2=_0x1197ab(0xf7),_0x2432dd=_0x1197ab(0xd4));}_0x590147[_0x1197ab(0xf4)]({'sqlCode':_0x24ba1f[_0x1197ab(0xbb)],'sqlName':_0x24ba1f[_0x1197ab(0xbe)],'filePath':_0x30ef7c,'status':_0x4e6ef2,'reason':_0x2432dd});}return{'method':'POST','url':_0x1197ab(0xcc),'body':{'appCode':_0x45641d['appCode'],'sqlCode':_0x45641d[_0x1197ab(0xed)](_0x1197ab(0xb9))||null,'sqlName':_0x45641d[_0x1197ab(0xed)]('name')||null,'files':_0x590147},'description':_0x1197ab(0xe7)+_0x590147[_0x1197ab(0xdd)]+_0x1197ab(0xe2)+_0x3c608b[_0x1197ab(0xb7)]};},async 'execute'(_0x5570d7){const _0x3a02a8=a253_0x5530e8,_0x3cfc3c=loadSqlProjectConfig(_0x5570d7[_0x3a02a8(0xfc)]),_0x4a845b=await readSqlLockFile(_0x3cfc3c[_0x3a02a8(0xd3)]),{lockData:_0x349589,appLock:_0x29316d}=ensureSqlLockScope(_0x4a845b??createEmptySqlLock(),_0x3cfc3c[_0x3a02a8(0xfc)],_0x3cfc3c[_0x3a02a8(0xd6)],_0x3a02a8(0xbc)),_0x2d5d4b=_0x5570d7['bool']('force'),_0x2fb976=await fetchAllSqlQueries(_0x5570d7[_0x3a02a8(0xfc)],{'sqlCode':_0x5570d7[_0x3a02a8(0xed)]('sqlcode')||undefined,'sqlName':_0x5570d7['str'](_0x3a02a8(0xc8))||undefined});if(_0x2fb976[_0x3a02a8(0xdd)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x13e18b=[],_0x1a1e67=[];for(const _0x325f77 of _0x2fb976){try{_0x13e18b['push'](await ensureSqlContent(_0x325f77));}catch(_0x50d937){_0x1a1e67[_0x3a02a8(0xf4)]({'sqlCode':_0x325f77[_0x3a02a8(0xbb)],'error':_0x50d937 instanceof Error?_0x50d937[_0x3a02a8(0xd9)]:String(_0x50d937)});}}if(_0x2d5d4b&&!_0x5570d7['nonInteractive']){let _0x3e497b=![];for(const _0x2507cf of _0x13e18b){const _0x131ddd=detectSqlMode(ensureRemoteSqlContent(_0x2507cf)),_0xb5c4b8=_0x2507cf[_0x3a02a8(0xc5)]?await getDbName(_0x5570d7['appCode'],Number(_0x2507cf[_0x3a02a8(0xc5)]))['catch'](()=>undefined):undefined,_0x2c5df0=buildLocalSqlFileContent({'sqlCode':_0x2507cf[_0x3a02a8(0xbb)],'sqlName':_0x2507cf[_0x3a02a8(0xbe)],'dbId':_0x2507cf[_0x3a02a8(0xc5)]},ensureRemoteSqlContent(_0x2507cf),{'dbName':_0xb5c4b8,'mode':_0x131ddd,'syncedAt':new Date()[_0x3a02a8(0xc2)](),'description':_0x2507cf[_0x3a02a8(0xd8)]}),_0x2e3392=resolveLocalSqlFilePath(_0x3cfc3c,_0x2507cf[_0x3a02a8(0xbb)],buildSqlLockEntry(_0x2507cf,ensureRemoteSqlContent(_0x2507cf),'',{'dbName':_0xb5c4b8})),_0x42d092=await findExistingSqlFiles(_0x3cfc3c,_0x2e3392,_0x131ddd,_0x29316d[_0x3a02a8(0xb4)][_0x2507cf[_0x3a02a8(0xbb)]]),_0x126f17=await compareExistingSqlFiles(_0x42d092,_0x2c5df0,_0x131ddd);if(_0x126f17[_0x3a02a8(0xf0)](({equivalent:_0x2e2978})=>!_0x2e2978)){_0x3e497b=!![];break;}}if(_0x3e497b){const _0x4af9e7=await confirmForceOverwrite(_0x3a02a8(0xe4));if(!_0x4af9e7)throw CliErrors[_0x3a02a8(0xf2)](_0x3a02a8(0xe1));}}const _0x48e5c5=cloneSqlLockData(_0x349589),_0x2dfbf1=_0x48e5c5[_0x3a02a8(0xf5)][_0x3cfc3c[_0x3a02a8(0xfc)]],_0x32f02e=[],_0x499bfe=[];for(const _0x20f70a of _0x13e18b){const _0xca10de=_0x2dfbf1[_0x3a02a8(0xb4)][_0x20f70a[_0x3a02a8(0xbb)]],_0xdf0ad0=ensureRemoteSqlContent(_0x20f70a),_0x3b1bf4=detectSqlMode(_0xdf0ad0),_0x33d97b=_0x20f70a[_0x3a02a8(0xc5)]?await getDbName(_0x5570d7[_0x3a02a8(0xfc)],Number(_0x20f70a[_0x3a02a8(0xc5)]))[_0x3a02a8(0xea)](()=>undefined):undefined,_0x5a4e5e=buildLocalSqlFileContent({'sqlCode':_0x20f70a['sqlCode'],'sqlName':_0x20f70a[_0x3a02a8(0xbe)],'dbId':_0x20f70a[_0x3a02a8(0xc5)]},_0xdf0ad0,{'dbName':_0x33d97b,'mode':_0x3b1bf4,'syncedAt':new Date()[_0x3a02a8(0xc2)](),'description':_0x20f70a[_0x3a02a8(0xd8)]}),_0x58dd0e=buildSqlLockEntry(_0x20f70a,_0xdf0ad0,computeSqlContentHash(_0x5a4e5e),{'dbName':_0x33d97b}),_0x45aa69=_0x58dd0e[_0x3a02a8(0xce)],_0x5c41b6=join(_0x3cfc3c[_0x3a02a8(0xb7)],_0x45aa69);try{const _0x445016=await findExistingSqlFiles(_0x3cfc3c,_0x5c41b6,_0x3b1bf4,_0xca10de),_0x4b06c2=await compareExistingSqlFiles(_0x445016,_0x5a4e5e,_0x3b1bf4);if(!_0x2d5d4b&&_0x4b06c2['some'](({equivalent:_0x2b5a91})=>!_0x2b5a91)){_0x499bfe['push']({'sqlCode':_0x20f70a[_0x3a02a8(0xbb)],'reason':'local\x20differs\x20from\x20remote'});continue;}const _0x8d97d6=_0x4b06c2[_0x3a02a8(0xbd)](({file:_0x2c2850})=>_0x2c2850[_0x3a02a8(0xe6)]),_0xe5d73f=_0x4b06c2['find'](({file:_0x19c545})=>!_0x19c545[_0x3a02a8(0xe6)]);if(_0x8d97d6?.[_0x3a02a8(0xeb)]&&!_0xe5d73f){_0x499bfe[_0x3a02a8(0xf4)]({'sqlCode':_0x20f70a['sqlCode'],'reason':_0x3a02a8(0xd4)}),_0x2dfbf1[_0x3a02a8(0xb4)][_0x20f70a['sqlCode']]={..._0x58dd0e,'hash':computeSqlContentHash(_0x8d97d6[_0x3a02a8(0xba)]),'path':_0x45aa69};continue;}!_0x8d97d6?.[_0x3a02a8(0xeb)]&&(await ensureParentDirectory(_0x5c41b6),await writeFile(_0x5c41b6,_0x5a4e5e,'utf8')),_0xe5d73f&&await rm(_0xe5d73f[_0x3a02a8(0xcb)][_0x3a02a8(0xd7)],{'force':!![]}),_0x2dfbf1['sqls'][_0x20f70a[_0x3a02a8(0xbb)]]={..._0x58dd0e,'hash':_0x8d97d6?.[_0x3a02a8(0xeb)]?computeSqlContentHash(_0x8d97d6[_0x3a02a8(0xba)]):_0x58dd0e[_0x3a02a8(0xd5)],'path':_0x45aa69},_0x32f02e['push']({'sqlCode':_0x20f70a['sqlCode'],'filePath':_0x5c41b6});}catch(_0xfaaf48){_0x1a1e67[_0x3a02a8(0xf4)]({'sqlCode':_0x20f70a[_0x3a02a8(0xbb)],'error':_0xfaaf48 instanceof Error?_0xfaaf48['message']:String(_0xfaaf48)});}}return _0x2dfbf1[_0x3a02a8(0xcf)]=new Date()[_0x3a02a8(0xc2)](),await writeSqlLockFile(_0x3cfc3c[_0x3a02a8(0xd3)],_0x48e5c5),{'ok':_0x1a1e67['length']===0x0,'data':{'pulled':_0x32f02e,'skipped':_0x499bfe,'failed':_0x1a1e67},'message':_0x3a02a8(0xfa)+_0x32f02e[_0x3a02a8(0xdd)]+'\x20written,\x20'+_0x499bfe[_0x3a02a8(0xdd)]+'\x20skipped,\x20'+_0x1a1e67[_0x3a02a8(0xdd)]+_0x3a02a8(0xc6)};}};function isEquivalentPulledSqlFile(_0x214ea7,_0x1ccbe6,_0x264e67,_0x1c2866){if(_0x264e67!==_0x1c2866)return normalizePulledSqlBody(_0x214ea7,_0x264e67)===normalizePulledSqlBody(_0x1ccbe6,_0x1c2866);return normalizePullComparableContent(_0x214ea7,_0x264e67)===normalizePullComparableContent(_0x1ccbe6,_0x1c2866);}async function findExistingSqlFiles(_0x554d22,_0x46ef51,_0x5f46e3,_0x17bd4b){const _0x4bcad6=a253_0x5530e8,_0x5cf2e2=[];await fileExists(_0x46ef51)&&_0x5cf2e2[_0x4bcad6(0xf4)]({'filePath':_0x46ef51,'mode':_0x5f46e3,'isCanonical':!![]});if(!_0x17bd4b?.[_0x4bcad6(0xce)])return _0x5cf2e2;const _0x2d38c8=join(_0x554d22[_0x4bcad6(0xb7)],_0x17bd4b['path']);if(_0x2d38c8===_0x46ef51)return _0x5cf2e2;return await fileExists(_0x2d38c8)&&_0x5cf2e2[_0x4bcad6(0xf4)]({'filePath':_0x2d38c8,'mode':_0x17bd4b[_0x4bcad6(0xdb)]??modeFromFilePath(_0x2d38c8),'isCanonical':![]}),_0x5cf2e2;}async function compareExistingSqlFiles(_0x4e77e0,_0x2a8ddf,_0x9e6b24){const _0x1befcf=a253_0x5530e8;return Promise[_0x1befcf(0xb5)](_0x4e77e0[_0x1befcf(0xf8)](async _0x306975=>{const _0x28f2c3=_0x1befcf,_0x31d042=await readFile(_0x306975[_0x28f2c3(0xd7)],'utf8');return{'file':_0x306975,'content':_0x31d042,'equivalent':isEquivalentPulledSqlFile(_0x31d042,_0x2a8ddf,_0x306975[_0x28f2c3(0xdb)],_0x9e6b24)};}));}function modeFromFilePath(_0x22a4b7){const _0xbda81c=a253_0x5530e8;return _0x22a4b7[_0xbda81c(0xf3)]()[_0xbda81c(0xe0)](_0xbda81c(0xcd))?_0xbda81c(0xf6):_0xbda81c(0xc3);}function a253_0x166c(_0x4167c9,_0x41b90f){_0x4167c9=_0x4167c9-0xb4;const _0x381058=a253_0x3810();let _0x166cc1=_0x381058[_0x4167c9];return _0x166cc1;}function normalizePulledSqlBody(_0x244039,_0x2203ec){const _0x3ba881=a253_0x5530e8;return stripLocalSqlMetadata(_0x244039,_0x2203ec)[_0x3ba881(0xf9)](/\r\n/g,'\x0a')[_0x3ba881(0xee)]();}function normalizePullComparableContent(_0x9835fc,_0x5ccde9){const _0x1aa03a=a253_0x5530e8,_0x185d2b=_0x9835fc[_0x1aa03a(0xf9)](/\r\n/g,'\x0a')[_0x1aa03a(0xfb)]('\x0a'),_0x1ad253=_0x185d2b[_0x1aa03a(0xef)](_0x385453=>!isSyncedAtMetadataLine(_0x385453,_0x5ccde9));return _0x1ad253['join']('\x0a');}function isSyncedAtMetadataLine(_0x4c9f4b,_0x42c308){const _0x170bcf=a253_0x5530e8;if(_0x42c308===_0x170bcf(0xf6))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x170bcf(0xec)](_0x4c9f4b);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x4c9f4b);}
1
+ const a253_0x4ba897=a253_0x7b79;(function(_0x2f5d24,_0x2064d7){const _0x29b744=a253_0x7b79,_0x34c6aa=_0x2f5d24();while(!![]){try{const _0x578cce=-parseInt(_0x29b744(0x181))/0x1+parseInt(_0x29b744(0x186))/0x2*(parseInt(_0x29b744(0x158))/0x3)+parseInt(_0x29b744(0x168))/0x4+-parseInt(_0x29b744(0x154))/0x5+parseInt(_0x29b744(0x146))/0x6*(-parseInt(_0x29b744(0x182))/0x7)+parseInt(_0x29b744(0x157))/0x8*(-parseInt(_0x29b744(0x18f))/0x9)+parseInt(_0x29b744(0x14d))/0xa*(parseInt(_0x29b744(0x14e))/0xb);if(_0x578cce===_0x2064d7)break;else _0x34c6aa['push'](_0x34c6aa['shift']());}catch(_0x10a009){_0x34c6aa['push'](_0x34c6aa['shift']());}}}(a253_0x10da,0xaca30));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a253_0x10da(){const _0x3cc881=['toISOString','isCanonical','boolean','Would\x20pull\x20','110kLBcHr','3744323UDOptG','conflict','sqlRoot','split','Filter\x20by\x20SQL\x20display\x20name','appCode','5825305rEjXew','would_pull','paging','8pcdBsZ','3PJiSRd','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','sqlcode','name','all','lockFilePath','string','pull','str','tableData','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','utf8','description','sqlCode','dbId','toLowerCase','1965300hPyCnB','No\x20remote\x20SQL\x20queries\x20matched.','path','catch','\x20failed','push','unchanged','file','content','\x20SQL\x20file(s)\x20into\x20','sqlRootDir','sqlName','sqls','Pull\x20complete:\x20','length','find','force','.xml','mode','some','replace','hash','cancelled','filter','endsWith','852475WuIOCU','7xmcqtj','message','sql','local\x20differs\x20from\x20remote','875314TZgfZn','POST','apps','mybatisXml','\x20skipped,\x20','Force\x20overwrite\x20local\x20unsynced\x20changes','test','filePath','lastSync','7478838HsfFUQ','equivalent','6706002gwHZXK','join','map'];a253_0x10da=function(){return _0x3cc881;};return a253_0x10da();}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(_0x54b3ed,_0x99a053){const _0x193b7d=a253_0x7b79,_0x1c6808=[];let _0x55c76a=0x1;while(!![]){const _0x244695=await listSqlQueries(_0x54b3ed,{'currentPage':_0x55c76a,'pageSize':PAGE_SIZE,'sqlCode':_0x99a053[_0x193b7d(0x165)],'sqlName':_0x99a053[_0x193b7d(0x173)]}),_0x41dab4=_0x244695[_0x193b7d(0x161)]??[];_0x1c6808[_0x193b7d(0x16d)](..._0x41dab4);if(_0x41dab4[_0x193b7d(0x176)]===0x0)break;const _0x237bc1=_0x244695[_0x193b7d(0x156)]?.['totalCount'];if(_0x237bc1!=null?_0x1c6808['length']>=_0x237bc1:_0x41dab4[_0x193b7d(0x176)]<PAGE_SIZE)break;_0x55c76a++;}return _0x1c6808;}async function ensureSqlContent(_0x261d22){const _0x20fc58=a253_0x7b79;if(_0x261d22['sqlContent']!=null&&String(_0x261d22['sqlContent'])['length']>0x0)return _0x261d22;return getSqlQueryDetail(_0x261d22[_0x20fc58(0x165)]);}export const sqlPull={'service':a253_0x4ba897(0x184),'command':a253_0x4ba897(0x15f),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x4ba897(0x15b),'type':a253_0x4ba897(0x15e),'description':a253_0x4ba897(0x152)},{'name':a253_0x4ba897(0x178),'type':a253_0x4ba897(0x14b),'description':a253_0x4ba897(0x18b)}],async 'dryRun'(_0x8c9457){const _0x1a8eb1=a253_0x4ba897,_0x59f4bf=loadSqlProjectConfig(_0x8c9457[_0x1a8eb1(0x153)]),_0x30e7f5=await readSqlLockFile(_0x59f4bf[_0x1a8eb1(0x15d)]),{appLock:_0x1993cd}=ensureSqlLockScope(_0x30e7f5??createEmptySqlLock(),_0x59f4bf[_0x1a8eb1(0x153)],_0x59f4bf[_0x1a8eb1(0x150)],_0x1a8eb1(0x15f)),_0xc7f25f=await fetchAllSqlQueries(_0x8c9457['appCode'],{'sqlCode':_0x8c9457['str'](_0x1a8eb1(0x15a))||undefined,'sqlName':_0x8c9457['str']('name')||undefined}),_0x23e48a=[];for(const _0x33b40a of _0xc7f25f){const _0x49e91f=await ensureSqlContent(_0x33b40a),_0xef3c23=ensureRemoteSqlContent(_0x49e91f),_0x4b601d=detectSqlMode(_0xef3c23),_0x1424b0=_0x49e91f[_0x1a8eb1(0x166)]?await getDbName(_0x8c9457[_0x1a8eb1(0x153)],Number(_0x49e91f['dbId']))['catch'](()=>undefined):undefined,_0x4acc73=buildLocalSqlFileContent({'sqlCode':_0x49e91f[_0x1a8eb1(0x165)],'sqlName':_0x49e91f[_0x1a8eb1(0x173)],'dbId':_0x49e91f['dbId']},_0xef3c23,{'dbName':_0x1424b0,'mode':_0x4b601d,'syncedAt':new Date()[_0x1a8eb1(0x149)](),'description':_0x49e91f['description']}),_0x1987da=buildSqlLockEntry(_0x49e91f,_0xef3c23,'',{'dbName':_0x1424b0}),_0x22faf=resolveLocalSqlFilePath(_0x59f4bf,_0x49e91f[_0x1a8eb1(0x165)],_0x1987da);let _0xf44d4a=_0x1a8eb1(0x155),_0x5d2c20;const _0x1294d1=await findExistingSqlFiles(_0x59f4bf,_0x22faf,_0x4b601d,_0x1993cd[_0x1a8eb1(0x174)][_0x49e91f[_0x1a8eb1(0x165)]]);if(_0x1294d1[_0x1a8eb1(0x176)]>0x0){const _0x38c33a=await compareExistingSqlFiles(_0x1294d1,_0x4acc73,_0x4b601d);if(_0x38c33a[_0x1a8eb1(0x17b)](({equivalent:_0x58e4cd})=>!_0x58e4cd))_0xf44d4a=_0x1a8eb1(0x14f),_0x5d2c20='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)';else _0x38c33a[_0x1a8eb1(0x176)]===0x1&&_0x38c33a[0x0]?.[_0x1a8eb1(0x16f)][_0x1a8eb1(0x14a)]&&(_0xf44d4a='skipped',_0x5d2c20='unchanged');}_0x23e48a[_0x1a8eb1(0x16d)]({'sqlCode':_0x49e91f['sqlCode'],'sqlName':_0x49e91f[_0x1a8eb1(0x173)],'filePath':_0x22faf,'status':_0xf44d4a,'reason':_0x5d2c20});}return{'method':_0x1a8eb1(0x187),'url':_0x1a8eb1(0x159),'body':{'appCode':_0x8c9457[_0x1a8eb1(0x153)],'sqlCode':_0x8c9457[_0x1a8eb1(0x160)](_0x1a8eb1(0x15a))||null,'sqlName':_0x8c9457['str'](_0x1a8eb1(0x15b))||null,'files':_0x23e48a},'description':_0x1a8eb1(0x14c)+_0x23e48a['length']+_0x1a8eb1(0x171)+_0x59f4bf[_0x1a8eb1(0x172)]};},async 'execute'(_0x5d7b6e){const _0x4101cc=a253_0x4ba897,_0x44c33c=loadSqlProjectConfig(_0x5d7b6e[_0x4101cc(0x153)]),_0x2a7195=await readSqlLockFile(_0x44c33c[_0x4101cc(0x15d)]),{lockData:_0x2b29f7,appLock:_0x18460d}=ensureSqlLockScope(_0x2a7195??createEmptySqlLock(),_0x44c33c['appCode'],_0x44c33c['sqlRoot'],_0x4101cc(0x15f)),_0x4335eb=_0x5d7b6e['bool'](_0x4101cc(0x178)),_0x41d388=await fetchAllSqlQueries(_0x5d7b6e[_0x4101cc(0x153)],{'sqlCode':_0x5d7b6e[_0x4101cc(0x160)]('sqlcode')||undefined,'sqlName':_0x5d7b6e['str'](_0x4101cc(0x15b))||undefined});if(_0x41d388['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4101cc(0x169)};const _0x33cfe4=[],_0x1d6964=[];for(const _0x303b4d of _0x41d388){try{_0x33cfe4[_0x4101cc(0x16d)](await ensureSqlContent(_0x303b4d));}catch(_0x568ad6){_0x1d6964[_0x4101cc(0x16d)]({'sqlCode':_0x303b4d[_0x4101cc(0x165)],'error':_0x568ad6 instanceof Error?_0x568ad6[_0x4101cc(0x183)]:String(_0x568ad6)});}}if(_0x4335eb&&!_0x5d7b6e['nonInteractive']){let _0x515976=![];for(const _0x655c7a of _0x33cfe4){const _0x2f5e2c=detectSqlMode(ensureRemoteSqlContent(_0x655c7a)),_0x287477=_0x655c7a['dbId']?await getDbName(_0x5d7b6e[_0x4101cc(0x153)],Number(_0x655c7a['dbId']))[_0x4101cc(0x16b)](()=>undefined):undefined,_0xd4da50=buildLocalSqlFileContent({'sqlCode':_0x655c7a[_0x4101cc(0x165)],'sqlName':_0x655c7a[_0x4101cc(0x173)],'dbId':_0x655c7a['dbId']},ensureRemoteSqlContent(_0x655c7a),{'dbName':_0x287477,'mode':_0x2f5e2c,'syncedAt':new Date()['toISOString'](),'description':_0x655c7a[_0x4101cc(0x164)]}),_0x18c59c=resolveLocalSqlFilePath(_0x44c33c,_0x655c7a[_0x4101cc(0x165)],buildSqlLockEntry(_0x655c7a,ensureRemoteSqlContent(_0x655c7a),'',{'dbName':_0x287477})),_0x21f9f0=await findExistingSqlFiles(_0x44c33c,_0x18c59c,_0x2f5e2c,_0x18460d[_0x4101cc(0x174)][_0x655c7a[_0x4101cc(0x165)]]),_0x5cad1a=await compareExistingSqlFiles(_0x21f9f0,_0xd4da50,_0x2f5e2c);if(_0x5cad1a[_0x4101cc(0x17b)](({equivalent:_0x2bf51f})=>!_0x2bf51f)){_0x515976=!![];break;}}if(_0x515976){const _0x1dacc6=await confirmForceOverwrite(_0x4101cc(0x162));if(!_0x1dacc6)throw CliErrors[_0x4101cc(0x17e)]('Force\x20pull\x20cancelled.');}}const _0x176b1f=cloneSqlLockData(_0x2b29f7),_0x3dac7e=_0x176b1f[_0x4101cc(0x188)][_0x44c33c[_0x4101cc(0x153)]],_0xe18ca7=[],_0x2aeb02=[];for(const _0x250637 of _0x33cfe4){const _0x5b2698=_0x3dac7e[_0x4101cc(0x174)][_0x250637['sqlCode']],_0x5d07db=ensureRemoteSqlContent(_0x250637),_0x15de9b=detectSqlMode(_0x5d07db),_0x88f90f=_0x250637['dbId']?await getDbName(_0x5d7b6e[_0x4101cc(0x153)],Number(_0x250637[_0x4101cc(0x166)]))[_0x4101cc(0x16b)](()=>undefined):undefined,_0x2da80e=buildLocalSqlFileContent({'sqlCode':_0x250637[_0x4101cc(0x165)],'sqlName':_0x250637[_0x4101cc(0x173)],'dbId':_0x250637[_0x4101cc(0x166)]},_0x5d07db,{'dbName':_0x88f90f,'mode':_0x15de9b,'syncedAt':new Date()[_0x4101cc(0x149)](),'description':_0x250637['description']}),_0x15f8ff=buildSqlLockEntry(_0x250637,_0x5d07db,computeSqlContentHash(_0x2da80e),{'dbName':_0x88f90f}),_0x4e540d=_0x15f8ff[_0x4101cc(0x16a)],_0x27bab2=join(_0x44c33c[_0x4101cc(0x172)],_0x4e540d);try{const _0x4f17d7=await findExistingSqlFiles(_0x44c33c,_0x27bab2,_0x15de9b,_0x5b2698),_0x1c66c7=await compareExistingSqlFiles(_0x4f17d7,_0x2da80e,_0x15de9b);if(!_0x4335eb&&_0x1c66c7[_0x4101cc(0x17b)](({equivalent:_0x21ef78})=>!_0x21ef78)){_0x2aeb02[_0x4101cc(0x16d)]({'sqlCode':_0x250637[_0x4101cc(0x165)],'reason':_0x4101cc(0x185)});continue;}const _0x182b9c=_0x1c66c7[_0x4101cc(0x177)](({file:_0x4ec3d4})=>_0x4ec3d4[_0x4101cc(0x14a)]),_0x29f4ac=_0x1c66c7['find'](({file:_0x3714bc})=>!_0x3714bc['isCanonical']);if(_0x182b9c?.[_0x4101cc(0x190)]&&!_0x29f4ac){_0x2aeb02['push']({'sqlCode':_0x250637['sqlCode'],'reason':_0x4101cc(0x16e)}),_0x3dac7e[_0x4101cc(0x174)][_0x250637[_0x4101cc(0x165)]]={..._0x15f8ff,'hash':computeSqlContentHash(_0x182b9c[_0x4101cc(0x170)]),'path':_0x4e540d};continue;}!_0x182b9c?.['equivalent']&&(await ensureParentDirectory(_0x27bab2),await writeFile(_0x27bab2,_0x2da80e,'utf8')),_0x29f4ac&&await rm(_0x29f4ac['file'][_0x4101cc(0x18d)],{'force':!![]}),_0x3dac7e[_0x4101cc(0x174)][_0x250637[_0x4101cc(0x165)]]={..._0x15f8ff,'hash':_0x182b9c?.[_0x4101cc(0x190)]?computeSqlContentHash(_0x182b9c[_0x4101cc(0x170)]):_0x15f8ff[_0x4101cc(0x17d)],'path':_0x4e540d},_0xe18ca7['push']({'sqlCode':_0x250637[_0x4101cc(0x165)],'filePath':_0x27bab2});}catch(_0x29155d){_0x1d6964['push']({'sqlCode':_0x250637[_0x4101cc(0x165)],'error':_0x29155d instanceof Error?_0x29155d[_0x4101cc(0x183)]:String(_0x29155d)});}}return _0x3dac7e[_0x4101cc(0x18e)]=new Date()[_0x4101cc(0x149)](),await writeSqlLockFile(_0x44c33c['lockFilePath'],_0x176b1f),{'ok':_0x1d6964[_0x4101cc(0x176)]===0x0,'data':{'pulled':_0xe18ca7,'skipped':_0x2aeb02,'failed':_0x1d6964},'message':_0x4101cc(0x175)+_0xe18ca7[_0x4101cc(0x176)]+'\x20written,\x20'+_0x2aeb02['length']+_0x4101cc(0x18a)+_0x1d6964['length']+_0x4101cc(0x16c)};}};function isEquivalentPulledSqlFile(_0x5e92c9,_0x3735ca,_0x4ad565,_0x59162e){if(_0x4ad565!==_0x59162e)return normalizePulledSqlBody(_0x5e92c9,_0x4ad565)===normalizePulledSqlBody(_0x3735ca,_0x59162e);return normalizePullComparableContent(_0x5e92c9,_0x4ad565)===normalizePullComparableContent(_0x3735ca,_0x59162e);}async function findExistingSqlFiles(_0x497352,_0x334aa4,_0x1dc6a7,_0x1d32be){const _0x16bd4a=a253_0x4ba897,_0x790a6c=[];await fileExists(_0x334aa4)&&_0x790a6c[_0x16bd4a(0x16d)]({'filePath':_0x334aa4,'mode':_0x1dc6a7,'isCanonical':!![]});if(!_0x1d32be?.[_0x16bd4a(0x16a)])return _0x790a6c;const _0x42f877=join(_0x497352[_0x16bd4a(0x172)],_0x1d32be['path']);if(_0x42f877===_0x334aa4)return _0x790a6c;return await fileExists(_0x42f877)&&_0x790a6c[_0x16bd4a(0x16d)]({'filePath':_0x42f877,'mode':_0x1d32be[_0x16bd4a(0x17a)]??modeFromFilePath(_0x42f877),'isCanonical':![]}),_0x790a6c;}async function compareExistingSqlFiles(_0x43fd75,_0xbe5013,_0x3a78a2){const _0x159f74=a253_0x4ba897;return Promise[_0x159f74(0x15c)](_0x43fd75[_0x159f74(0x148)](async _0xa4a1da=>{const _0x335da5=_0x159f74,_0x102b95=await readFile(_0xa4a1da['filePath'],_0x335da5(0x163));return{'file':_0xa4a1da,'content':_0x102b95,'equivalent':isEquivalentPulledSqlFile(_0x102b95,_0xbe5013,_0xa4a1da['mode'],_0x3a78a2)};}));}function a253_0x7b79(_0x302d0b,_0x294e6c){_0x302d0b=_0x302d0b-0x146;const _0x10da0c=a253_0x10da();let _0x7b7947=_0x10da0c[_0x302d0b];return _0x7b7947;}function modeFromFilePath(_0x361aeb){const _0x1a6371=a253_0x4ba897;return _0x361aeb[_0x1a6371(0x167)]()[_0x1a6371(0x180)](_0x1a6371(0x179))?'mybatisXml':'sql';}function normalizePulledSqlBody(_0x462227,_0x10e7d2){const _0x703b14=a253_0x4ba897;return stripLocalSqlMetadata(_0x462227,_0x10e7d2)[_0x703b14(0x17c)](/\r\n/g,'\x0a')['trim']();}function normalizePullComparableContent(_0x169ea8,_0x343cdc){const _0x5695cd=a253_0x4ba897,_0x325470=_0x169ea8[_0x5695cd(0x17c)](/\r\n/g,'\x0a')[_0x5695cd(0x151)]('\x0a'),_0xfe5a08=_0x325470[_0x5695cd(0x17f)](_0x1f4c62=>!isSyncedAtMetadataLine(_0x1f4c62,_0x343cdc));return _0xfe5a08[_0x5695cd(0x147)]('\x0a');}function isSyncedAtMetadataLine(_0x13f0d2,_0x3193d9){const _0x820359=a253_0x4ba897;if(_0x3193d9===_0x820359(0x189))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x13f0d2);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x820359(0x18c)](_0x13f0d2);}
@@ -1 +1 @@
1
- const a254_0x53ed4d=a254_0x3153;(function(_0x3724d4,_0x548c91){const _0x438c4a=a254_0x3153,_0x29498f=_0x3724d4();while(!![]){try{const _0x276de0=-parseInt(_0x438c4a(0x145))/0x1*(-parseInt(_0x438c4a(0x132))/0x2)+-parseInt(_0x438c4a(0x14c))/0x3*(parseInt(_0x438c4a(0x135))/0x4)+-parseInt(_0x438c4a(0x146))/0x5+-parseInt(_0x438c4a(0x12a))/0x6*(parseInt(_0x438c4a(0x137))/0x7)+parseInt(_0x438c4a(0x136))/0x8*(parseInt(_0x438c4a(0x127))/0x9)+-parseInt(_0x438c4a(0x126))/0xa+parseInt(_0x438c4a(0x140))/0xb*(parseInt(_0x438c4a(0x149))/0xc);if(_0x276de0===_0x548c91)break;else _0x29498f['push'](_0x29498f['shift']());}catch(_0xdb184c){_0x29498f['push'](_0x29498f['shift']());}}}(a254_0x289c,0x4f7ea));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(_0x744d26){const _0x59ed80=a254_0x3153,_0x140d84=stripLocalSqlMetadata(await readFile(_0x744d26[_0x59ed80(0x13e)],_0x59ed80(0x133)),_0x744d26['mode']);if(!_0x140d84[_0x59ed80(0x144)]())throw CliErrors[_0x59ed80(0x148)](_0x744d26['sqlCode']+_0x59ed80(0x12d));return _0x140d84;}async function getTargetSqlQueries(_0x44094f,_0x3f0b03,_0x2a3aeb){const _0x20a6bd=a254_0x3153,_0x26c940=await scanLocalSqlQueries(_0x44094f),_0x5dc518=new Map();for(const _0x58ccf1 of _0x26c940){if(_0x2a3aeb&&_0x58ccf1[_0x20a6bd(0x157)]!==_0x2a3aeb)continue;const _0x111731=_0x5dc518[_0x20a6bd(0x139)](_0x58ccf1['sqlCode'])??[];_0x111731[_0x20a6bd(0x156)](_0x58ccf1),_0x5dc518[_0x20a6bd(0x13a)](_0x58ccf1[_0x20a6bd(0x157)],_0x111731);}if(_0x2a3aeb&&!_0x5dc518[_0x20a6bd(0x13d)](_0x2a3aeb))throw CliErrors[_0x20a6bd(0x148)](_0x20a6bd(0x159)+_0x2a3aeb);const _0x2a6848=[];for(const [_0x14e1c1,_0x461718]of _0x5dc518[_0x20a6bd(0x150)]()){if(_0x461718[_0x20a6bd(0x165)]===0x1){_0x2a6848[_0x20a6bd(0x156)](_0x461718[0x0]);continue;}const _0x559f46=_0x3f0b03['sqls'][_0x14e1c1],_0xefcf80=_0x559f46?.['path'],_0x2fbb2c=_0xefcf80?_0x461718[_0x20a6bd(0x152)](_0x964882=>_0x964882[_0x20a6bd(0x162)]!==_0xefcf80):_0x461718;if(_0x559f46&&_0x2fbb2c[_0x20a6bd(0x165)]===0x1){_0x2a6848['push'](_0x2fbb2c[0x0]);continue;}throw CliErrors[_0x20a6bd(0x148)](_0x20a6bd(0x154)+_0x14e1c1+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x2a6848;}export const sqlPush={'service':a254_0x53ed4d(0x128),'command':a254_0x53ed4d(0x156),'description':a254_0x53ed4d(0x121),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a254_0x53ed4d(0x14d),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x95660){const _0x5ef292=a254_0x53ed4d,_0x392420=loadSqlProjectConfig(_0x95660[_0x5ef292(0x164)]),_0x20959b=await readSqlLockFile(_0x392420['lockFilePath']),{appLock:_0x499154}=ensureSqlLockScope(_0x20959b??createEmptySqlLock(),_0x95660[_0x5ef292(0x164)],_0x392420[_0x5ef292(0x12b)],_0x5ef292(0x156)),_0x1682ee=await getTargetSqlQueries(_0x392420,_0x499154,_0x95660[_0x5ef292(0x125)]('sqlcode')||undefined),_0x42be85=[];for(const _0x263086 of _0x1682ee){const _0xc40eb6=await computeSqlFileHash(_0x263086[_0x5ef292(0x13e)]),_0x57214c=_0x499154[_0x5ef292(0x13c)][_0x263086['sqlCode']],_0x352e1c=!!_0x57214c&&(_0x57214c[_0x5ef292(0x15a)]!==_0x263086[_0x5ef292(0x162)]||!!_0x263086[_0x5ef292(0x153)]&&_0x57214c['sqlName']!==_0x263086[_0x5ef292(0x153)]||_0x57214c[_0x5ef292(0x138)]!==_0x263086[_0x5ef292(0x138)]);if(!_0x95660[_0x5ef292(0x141)](_0x5ef292(0x13f))&&_0x57214c&&_0x57214c[_0x5ef292(0x161)]===_0xc40eb6&&!_0x352e1c)continue;if(!_0x57214c)throw CliErrors['validation'](_0x263086['sqlCode']+_0x5ef292(0x155));if(_0x57214c[_0x5ef292(0x163)]==null)throw CliErrors[_0x5ef292(0x148)](_0x263086['sqlCode']+_0x5ef292(0x143));await resolveTargetDbBinding(_0x95660[_0x5ef292(0x164)],_0x263086,_0x57214c),await readSqlUploadContent(_0x263086),_0x42be85[_0x5ef292(0x156)](_0x263086['sqlCode']);}return{'method':_0x5ef292(0x15b),'url':_0x5ef292(0x12c),'body':{'sqlCodes':_0x42be85,'appCode':_0x95660['appCode']},'description':'Would\x20push\x20'+_0x42be85[_0x5ef292(0x165)]+_0x5ef292(0x147)};},async 'execute'(_0x3481b6){const _0x3ad4c6=a254_0x53ed4d,_0x224cbd=loadSqlProjectConfig(_0x3481b6['appCode']),_0x1db758=await readSqlLockFile(_0x224cbd['lockFilePath']),{lockData:_0x335846,appLock:_0x5e78c6}=ensureSqlLockScope(_0x1db758??createEmptySqlLock(),_0x3481b6[_0x3ad4c6(0x164)],_0x224cbd[_0x3ad4c6(0x12b)],_0x3ad4c6(0x156)),_0x4c2509=await getTargetSqlQueries(_0x224cbd,_0x5e78c6,_0x3481b6[_0x3ad4c6(0x125)](_0x3ad4c6(0x142))||undefined);if(_0x4c2509['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x3ad4c6(0x151)};const _0x359fea=[],_0x32be09=[],_0x3ab938=[];let _0x74a507=![];for(const _0x5b4e34 of _0x4c2509){const _0x51ef52=_0x5e78c6[_0x3ad4c6(0x13c)][_0x5b4e34[_0x3ad4c6(0x157)]];if(!_0x51ef52){_0x3ab938['push']({'sqlCode':_0x5b4e34[_0x3ad4c6(0x157)],'error':_0x3ad4c6(0x130)});continue;}try{const _0x430892=await computeSqlFileHash(_0x5b4e34[_0x3ad4c6(0x13e)]),_0x3d33d4=_0x51ef52[_0x3ad4c6(0x15a)]!==_0x5b4e34[_0x3ad4c6(0x162)]||!!_0x5b4e34[_0x3ad4c6(0x153)]&&_0x51ef52['sqlName']!==_0x5b4e34[_0x3ad4c6(0x153)]||_0x51ef52[_0x3ad4c6(0x138)]!==_0x5b4e34[_0x3ad4c6(0x138)];if(!_0x3481b6[_0x3ad4c6(0x141)](_0x3ad4c6(0x13f))&&_0x51ef52[_0x3ad4c6(0x161)]===_0x430892&&!_0x3d33d4){_0x32be09[_0x3ad4c6(0x156)]({'sqlCode':_0x5b4e34[_0x3ad4c6(0x157)],'reason':'unchanged'});continue;}if(_0x51ef52[_0x3ad4c6(0x163)]==null){_0x3ab938['push']({'sqlCode':_0x5b4e34['sqlCode'],'error':_0x3ad4c6(0x167)});continue;}const _0x20c1a5=_0x5b4e34['sqlName']||_0x51ef52[_0x3ad4c6(0x153)],_0x75d731=await resolveTargetDbBinding(_0x3481b6[_0x3ad4c6(0x164)],_0x5b4e34,_0x51ef52),_0x626a92=await readSqlUploadContent(_0x5b4e34),_0x34b6bc=await updateSqlQuery({'id':_0x51ef52['remoteId'],'appCode':_0x3481b6[_0x3ad4c6(0x164)],'sqlCode':_0x5b4e34[_0x3ad4c6(0x157)],'sqlName':_0x20c1a5,'dbId':_0x75d731['dbId'],'version':_0x51ef52[_0x3ad4c6(0x163)],'sqlContent':_0x626a92,'sqlConfig':_0x51ef52['sqlConfig']??undefined}),_0x3d2c53=_0x34b6bc[_0x3ad4c6(0x15e)]?await getDbName(_0x3481b6[_0x3ad4c6(0x164)],Number(_0x34b6bc[_0x3ad4c6(0x15e)]))[_0x3ad4c6(0x13b)](()=>_0x75d731[_0x3ad4c6(0x129)]):_0x75d731[_0x3ad4c6(0x129)];_0x5e78c6[_0x3ad4c6(0x13c)][_0x5b4e34[_0x3ad4c6(0x157)]]={...buildSqlLockEntry(_0x34b6bc,_0x626a92,_0x430892,{'dbName':_0x3d2c53}),'path':_0x5b4e34[_0x3ad4c6(0x162)],'mode':_0x5b4e34[_0x3ad4c6(0x138)]},_0x74a507=!![],await archivePreviousSqlFileIfNeeded(_0x224cbd,_0x51ef52['path'],_0x5b4e34['relativePath']),_0x359fea[_0x3ad4c6(0x156)]({'sqlCode':_0x5b4e34[_0x3ad4c6(0x157)],'remoteId':_0x51ef52['remoteId']});}catch(_0x485bd9){_0x3ab938['push']({'sqlCode':_0x5b4e34[_0x3ad4c6(0x157)],'error':_0x485bd9 instanceof Error?_0x485bd9[_0x3ad4c6(0x12e)]:String(_0x485bd9)});}}(_0x74a507||_0x3ab938[_0x3ad4c6(0x165)]===0x0)&&(_0x5e78c6['lastSync']=new Date()[_0x3ad4c6(0x122)](),await writeSqlLockFile(_0x224cbd[_0x3ad4c6(0x166)],_0x335846));const _0x44b8d6=_0x3ab938[_0x3ad4c6(0x165)]===0x0;return{'ok':_0x44b8d6,'data':{'pushed':_0x359fea,'skipped':_0x32be09,'failed':_0x3ab938},'message':_0x3ad4c6(0x160)+_0x359fea['length']+_0x3ad4c6(0x14b)+_0x32be09['length']+_0x3ad4c6(0x14e)+_0x3ab938[_0x3ad4c6(0x165)]+_0x3ad4c6(0x15f)};}};async function archivePreviousSqlFileIfNeeded(_0x3992c5,_0x452449,_0xb4d50f){const _0x4f7ce3=a254_0x53ed4d;if(!_0x452449||_0x452449===_0xb4d50f)return;const _0x581694=join(_0x3992c5[_0x4f7ce3(0x123)],_0x452449);if(!await fileExists(_0x581694))return;const _0x278558=await moveToTrash(_0x3992c5[_0x4f7ce3(0x15d)],_0x3992c5[_0x4f7ce3(0x12f)],_0x581694);await cleanupEmptyDirectories(dirname(_0x581694),_0x3992c5[_0x4f7ce3(0x123)]),void _0x278558;}async function moveToTrash(_0xe79344,_0x1dc70f,_0x24c00e){const _0x42ef1f=a254_0x53ed4d,_0x9a132d=new Date()[_0x42ef1f(0x122)]()[_0x42ef1f(0x14a)](/[:.]/g,'-'),_0x46257d=relative(_0xe79344,_0x24c00e),_0x4f12f0=join(_0x1dc70f,_0x9a132d,_0x46257d);return await mkdir(dirname(_0x4f12f0),{'recursive':!![]}),await rename(_0x24c00e,_0x4f12f0),_0x4f12f0;}function a254_0x3153(_0x1afe73,_0x2ac9f3){_0x1afe73=_0x1afe73-0x121;const _0x289c1e=a254_0x289c();let _0x31536a=_0x289c1e[_0x1afe73];return _0x31536a;}async function cleanupEmptyDirectories(_0x92aa47,_0x495400){const _0x214630=a254_0x53ed4d;let _0x45a7d8=resolve(_0x92aa47);const _0x2fd00f=resolve(_0x495400);while(_0x45a7d8['startsWith'](''+_0x2fd00f+sep)||_0x45a7d8===_0x2fd00f){if(_0x45a7d8===_0x2fd00f)return;try{const _0x1473b2=await readdir(_0x45a7d8);if(_0x1473b2[_0x214630(0x165)]>0x0)return;await rmdir(_0x45a7d8);}catch{return;}_0x45a7d8=dirname(_0x45a7d8);}}async function resolveTargetDbBinding(_0x16db96,_0x289527,_0x3e9cd8){const _0x3eea23=a254_0x53ed4d,_0x34818d=_0x289527[_0x3eea23(0x134)];if(!_0x34818d)return{'dbId':_0x3e9cd8[_0x3eea23(0x15e)],'dbName':_0x3e9cd8[_0x3eea23(0x129)]};const _0x5e0688=buildDbDirectoryName(_0x3e9cd8[_0x3eea23(0x129)],_0x3e9cd8[_0x3eea23(0x15e)]);if(_0x34818d===_0x5e0688)return{'dbId':_0x3e9cd8[_0x3eea23(0x15e)],'dbName':_0x3e9cd8[_0x3eea23(0x129)]};const _0x1292cc=parseExplicitDbDirectory(_0x34818d);if(_0x1292cc!=null)return{'dbId':_0x1292cc,'dbName':await getDbName(_0x16db96,_0x1292cc)[_0x3eea23(0x13b)](()=>undefined)};const _0x2990ac=await listDatabases(_0x16db96),_0x3cf10e=_0x2990ac[_0x3eea23(0x152)](_0x351f52=>buildDbDirectoryName(_0x351f52['dbName'],_0x351f52[_0x3eea23(0x15e)])===_0x34818d);if(_0x3cf10e['length']===0x1)return{'dbId':_0x3cf10e[0x0][_0x3eea23(0x15e)],'dbName':_0x3cf10e[0x0][_0x3eea23(0x129)]};if(_0x3cf10e[_0x3eea23(0x165)]===0x0)throw CliErrors['validation']('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x34818d+'\x22\x20for\x20sqlCode\x20'+_0x289527[_0x3eea23(0x157)]+'.');const _0x1530d0=_0x3cf10e[_0x3eea23(0x15c)](_0x4a1e72=>_0x4a1e72[_0x3eea23(0x129)]+'\x20('+_0x4a1e72[_0x3eea23(0x15e)]+')')[_0x3eea23(0x124)](',\x20');throw CliErrors[_0x3eea23(0x148)](_0x3eea23(0x131)+_0x34818d+_0x3eea23(0x158)+_0x289527[_0x3eea23(0x157)]+':\x20'+_0x1530d0);}function parseExplicitDbDirectory(_0xa2560a){const _0x5d823d=a254_0x53ed4d,_0x288144=/^db-(\d+)$/['exec'](_0xa2560a);if(!_0x288144)return null;const _0x4c0b62=Number(_0x288144[0x1]);return Number[_0x5d823d(0x14f)](_0x4c0b62)&&_0x4c0b62>0x0?_0x4c0b62:null;}function a254_0x289c(){const _0x3f7c56=['join','str','5638160imoIaE','9KAxYDs','sql','dbName','6ApselF','sqlRoot','/smartapi/custom/updateUserCustomSql',':\x20SQL\x20content\x20is\x20empty.','message','trashDir','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','Local\x20directory\x20\x22','1138DFAsUC','utf8','dbDirectory','1070420lvjQnu','338520niSONo','3496843JmzcpI','mode','get','set','catch','sqls','has','filePath','force','596266neYbMO','bool','sqlcode',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','trim','348XCjGfN','2692940BhQIZe','\x20SQL\x20file(s)','validation','492AnxHBd','replace','\x20pushed,\x20','6CHBJxS','boolean','\x20skipped,\x20','isFinite','entries','No\x20local\x20SQL\x20files\x20found.','filter','sqlName','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','push','sqlCode','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','Local\x20SQL\x20not\x20found:\x20','path','POST','map','projectRoot','dbId','\x20failed','Push\x20complete:\x20','hash','relativePath','version','appCode','length','lockFilePath','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','Push\x20local\x20SQL\x20files\x20to\x20remote','toISOString','sqlRootDir'];a254_0x289c=function(){return _0x3f7c56;};return a254_0x289c();}
1
+ const a254_0x5e9230=a254_0x40a7;(function(_0x5190fb,_0x54390f){const _0x2868bb=a254_0x40a7,_0x51661d=_0x5190fb();while(!![]){try{const _0x4c78a1=-parseInt(_0x2868bb(0xc6))/0x1+-parseInt(_0x2868bb(0xc4))/0x2+-parseInt(_0x2868bb(0xb7))/0x3+-parseInt(_0x2868bb(0xb4))/0x4+-parseInt(_0x2868bb(0xc5))/0x5+-parseInt(_0x2868bb(0xae))/0x6+parseInt(_0x2868bb(0xbe))/0x7;if(_0x4c78a1===_0x54390f)break;else _0x51661d['push'](_0x51661d['shift']());}catch(_0x359530){_0x51661d['push'](_0x51661d['shift']());}}}(a254_0x23a3,0x920f5));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';function a254_0x23a3(){const _0x6b4905=['toISOString','map','\x20skipped,\x20','isFinite','length','Push\x20local\x20SQL\x20files\x20to\x20remote','push','path','replace','lastSync','bool','get','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','Local\x20directory\x20\x22','mode',':\x20SQL\x20content\x20is\x20empty.','\x20failed','join','sqlConfig','sqlName','boolean','\x22\x20for\x20sqlCode\x20','relativePath','/smartapi/custom/updateUserCustomSql','unchanged','lockFilePath','exec','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','dbDirectory','write','209082ISENHY','sql','sqlcode','\x20SQL\x20file(s)','force','sqls','378260nUHmQT','POST','dbId','2015943XKoCLi','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','sqlRootDir','hash','version','trashDir','Would\x20push\x20','28865900uLZZVE','projectRoot','sqlCode','validation','message','No\x20local\x20SQL\x20files\x20found.','1076360MpguLm','5185840jsxjQp','1148698KSWQye','dbName','sqlRoot','str','utf8','appCode','Push\x20complete:\x20'];a254_0x23a3=function(){return _0x6b4905;};return a254_0x23a3();}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';function a254_0x40a7(_0x44b108,_0x53bfc5){_0x44b108=_0x44b108-0xa6;const _0x23a393=a254_0x23a3();let _0x40a742=_0x23a393[_0x44b108];return _0x40a742;}async function readSqlUploadContent(_0x1e114e){const _0x256198=a254_0x40a7,_0xb7c352=stripLocalSqlMetadata(await readFile(_0x1e114e['filePath'],_0x256198(0xca)),_0x1e114e['mode']);if(!_0xb7c352['trim']())throw CliErrors[_0x256198(0xc1)](_0x1e114e['sqlCode']+_0x256198(0xdc));return _0xb7c352;}async function getTargetSqlQueries(_0x5130c4,_0x4c3363,_0x2daefa){const _0x3ecedd=a254_0x40a7,_0x4b5f07=await scanLocalSqlQueries(_0x5130c4),_0x78919=new Map();for(const _0x52351a of _0x4b5f07){if(_0x2daefa&&_0x52351a[_0x3ecedd(0xc0)]!==_0x2daefa)continue;const _0x4e1f2b=_0x78919[_0x3ecedd(0xd8)](_0x52351a['sqlCode'])??[];_0x4e1f2b[_0x3ecedd(0xd3)](_0x52351a),_0x78919['set'](_0x52351a[_0x3ecedd(0xc0)],_0x4e1f2b);}if(_0x2daefa&&!_0x78919['has'](_0x2daefa))throw CliErrors[_0x3ecedd(0xc1)]('Local\x20SQL\x20not\x20found:\x20'+_0x2daefa);const _0x40461f=[];for(const [_0x3fe31c,_0x2fb7db]of _0x78919['entries']()){if(_0x2fb7db['length']===0x1){_0x40461f[_0x3ecedd(0xd3)](_0x2fb7db[0x0]);continue;}const _0x204808=_0x4c3363[_0x3ecedd(0xb3)][_0x3fe31c],_0x987538=_0x204808?.[_0x3ecedd(0xd4)],_0x23fde3=_0x987538?_0x2fb7db['filter'](_0x1f984e=>_0x1f984e[_0x3ecedd(0xa6)]!==_0x987538):_0x2fb7db;if(_0x204808&&_0x23fde3[_0x3ecedd(0xd1)]===0x1){_0x40461f[_0x3ecedd(0xd3)](_0x23fde3[0x0]);continue;}throw CliErrors['validation'](_0x3ecedd(0xb8)+_0x3fe31c+_0x3ecedd(0xab));}return _0x40461f;}export const sqlPush={'service':a254_0x5e9230(0xaf),'command':'push','description':a254_0x5e9230(0xd2),'risk':a254_0x5e9230(0xad),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a254_0x5e9230(0xe1),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0xcd6256){const _0x423176=a254_0x5e9230,_0x52621f=loadSqlProjectConfig(_0xcd6256[_0x423176(0xcb)]),_0x45d59e=await readSqlLockFile(_0x52621f[_0x423176(0xa9)]),{appLock:_0x538d70}=ensureSqlLockScope(_0x45d59e??createEmptySqlLock(),_0xcd6256[_0x423176(0xcb)],_0x52621f['sqlRoot'],_0x423176(0xd3)),_0x198a01=await getTargetSqlQueries(_0x52621f,_0x538d70,_0xcd6256[_0x423176(0xc9)](_0x423176(0xb0))||undefined),_0x2cea00=[];for(const _0x48038a of _0x198a01){const _0x45c580=await computeSqlFileHash(_0x48038a['filePath']),_0x290701=_0x538d70[_0x423176(0xb3)][_0x48038a['sqlCode']],_0x2cdc28=!!_0x290701&&(_0x290701[_0x423176(0xd4)]!==_0x48038a[_0x423176(0xa6)]||!!_0x48038a[_0x423176(0xe0)]&&_0x290701[_0x423176(0xe0)]!==_0x48038a[_0x423176(0xe0)]||_0x290701[_0x423176(0xdb)]!==_0x48038a['mode']);if(!_0xcd6256[_0x423176(0xd7)]('force')&&_0x290701&&_0x290701[_0x423176(0xba)]===_0x45c580&&!_0x2cdc28)continue;if(!_0x290701)throw CliErrors[_0x423176(0xc1)](_0x48038a[_0x423176(0xc0)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0x290701[_0x423176(0xbb)]==null)throw CliErrors[_0x423176(0xc1)](_0x48038a[_0x423176(0xc0)]+':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.');await resolveTargetDbBinding(_0xcd6256[_0x423176(0xcb)],_0x48038a,_0x290701),await readSqlUploadContent(_0x48038a),_0x2cea00['push'](_0x48038a['sqlCode']);}return{'method':_0x423176(0xb5),'url':_0x423176(0xa7),'body':{'sqlCodes':_0x2cea00,'appCode':_0xcd6256[_0x423176(0xcb)]},'description':_0x423176(0xbd)+_0x2cea00[_0x423176(0xd1)]+_0x423176(0xb1)};},async 'execute'(_0x58ae9e){const _0x22ca18=a254_0x5e9230,_0x10aad2=loadSqlProjectConfig(_0x58ae9e[_0x22ca18(0xcb)]),_0x5c5e97=await readSqlLockFile(_0x10aad2[_0x22ca18(0xa9)]),{lockData:_0x453acf,appLock:_0x288ffe}=ensureSqlLockScope(_0x5c5e97??createEmptySqlLock(),_0x58ae9e['appCode'],_0x10aad2[_0x22ca18(0xc8)],_0x22ca18(0xd3)),_0x2ac655=await getTargetSqlQueries(_0x10aad2,_0x288ffe,_0x58ae9e[_0x22ca18(0xc9)](_0x22ca18(0xb0))||undefined);if(_0x2ac655[_0x22ca18(0xd1)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x22ca18(0xc3)};const _0x2b20b3=[],_0x30aac8=[],_0x1f46e0=[];let _0x4bf5c8=![];for(const _0x449ecd of _0x2ac655){const _0x2b0903=_0x288ffe[_0x22ca18(0xb3)][_0x449ecd['sqlCode']];if(!_0x2b0903){_0x1f46e0['push']({'sqlCode':_0x449ecd[_0x22ca18(0xc0)],'error':_0x22ca18(0xd9)});continue;}try{const _0x1c542f=await computeSqlFileHash(_0x449ecd['filePath']),_0x3b4a8a=_0x2b0903['path']!==_0x449ecd[_0x22ca18(0xa6)]||!!_0x449ecd[_0x22ca18(0xe0)]&&_0x2b0903[_0x22ca18(0xe0)]!==_0x449ecd['sqlName']||_0x2b0903['mode']!==_0x449ecd[_0x22ca18(0xdb)];if(!_0x58ae9e[_0x22ca18(0xd7)](_0x22ca18(0xb2))&&_0x2b0903[_0x22ca18(0xba)]===_0x1c542f&&!_0x3b4a8a){_0x30aac8[_0x22ca18(0xd3)]({'sqlCode':_0x449ecd[_0x22ca18(0xc0)],'reason':_0x22ca18(0xa8)});continue;}if(_0x2b0903[_0x22ca18(0xbb)]==null){_0x1f46e0[_0x22ca18(0xd3)]({'sqlCode':_0x449ecd[_0x22ca18(0xc0)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x12bca8=_0x449ecd['sqlName']||_0x2b0903['sqlName'],_0x4b6c1a=await resolveTargetDbBinding(_0x58ae9e['appCode'],_0x449ecd,_0x2b0903),_0x5e94a5=await readSqlUploadContent(_0x449ecd),_0xa5e621=await updateSqlQuery({'id':_0x2b0903['remoteId'],'appCode':_0x58ae9e['appCode'],'sqlCode':_0x449ecd[_0x22ca18(0xc0)],'sqlName':_0x12bca8,'dbId':_0x4b6c1a['dbId'],'version':_0x2b0903[_0x22ca18(0xbb)],'sqlContent':_0x5e94a5,'sqlConfig':_0x2b0903[_0x22ca18(0xdf)]??undefined}),_0x40c8fe=_0xa5e621['dbId']?await getDbName(_0x58ae9e['appCode'],Number(_0xa5e621[_0x22ca18(0xb6)]))['catch'](()=>_0x4b6c1a['dbName']):_0x4b6c1a[_0x22ca18(0xc7)];_0x288ffe[_0x22ca18(0xb3)][_0x449ecd[_0x22ca18(0xc0)]]={...buildSqlLockEntry(_0xa5e621,_0x5e94a5,_0x1c542f,{'dbName':_0x40c8fe}),'path':_0x449ecd[_0x22ca18(0xa6)],'mode':_0x449ecd[_0x22ca18(0xdb)]},_0x4bf5c8=!![],await archivePreviousSqlFileIfNeeded(_0x10aad2,_0x2b0903[_0x22ca18(0xd4)],_0x449ecd[_0x22ca18(0xa6)]),_0x2b20b3['push']({'sqlCode':_0x449ecd['sqlCode'],'remoteId':_0x2b0903['remoteId']});}catch(_0x181b5a){_0x1f46e0[_0x22ca18(0xd3)]({'sqlCode':_0x449ecd[_0x22ca18(0xc0)],'error':_0x181b5a instanceof Error?_0x181b5a[_0x22ca18(0xc2)]:String(_0x181b5a)});}}(_0x4bf5c8||_0x1f46e0[_0x22ca18(0xd1)]===0x0)&&(_0x288ffe[_0x22ca18(0xd6)]=new Date()['toISOString'](),await writeSqlLockFile(_0x10aad2[_0x22ca18(0xa9)],_0x453acf));const _0x183fd4=_0x1f46e0[_0x22ca18(0xd1)]===0x0;return{'ok':_0x183fd4,'data':{'pushed':_0x2b20b3,'skipped':_0x30aac8,'failed':_0x1f46e0},'message':_0x22ca18(0xcc)+_0x2b20b3[_0x22ca18(0xd1)]+'\x20pushed,\x20'+_0x30aac8[_0x22ca18(0xd1)]+_0x22ca18(0xcf)+_0x1f46e0['length']+_0x22ca18(0xdd)};}};async function archivePreviousSqlFileIfNeeded(_0x1d91bb,_0x36aa72,_0x5da0be){const _0x2fae76=a254_0x5e9230;if(!_0x36aa72||_0x36aa72===_0x5da0be)return;const _0x2578a0=join(_0x1d91bb[_0x2fae76(0xb9)],_0x36aa72);if(!await fileExists(_0x2578a0))return;const _0x4a43d4=await moveToTrash(_0x1d91bb[_0x2fae76(0xbf)],_0x1d91bb[_0x2fae76(0xbc)],_0x2578a0);await cleanupEmptyDirectories(dirname(_0x2578a0),_0x1d91bb[_0x2fae76(0xb9)]),void _0x4a43d4;}async function moveToTrash(_0x1c54b6,_0x1e5e7e,_0x3a1e1e){const _0x282065=a254_0x5e9230,_0x2c2ca9=new Date()[_0x282065(0xcd)]()[_0x282065(0xd5)](/[:.]/g,'-'),_0x486ec4=relative(_0x1c54b6,_0x3a1e1e),_0x262d0b=join(_0x1e5e7e,_0x2c2ca9,_0x486ec4);return await mkdir(dirname(_0x262d0b),{'recursive':!![]}),await rename(_0x3a1e1e,_0x262d0b),_0x262d0b;}async function cleanupEmptyDirectories(_0x129223,_0x1747e0){const _0xd90003=a254_0x5e9230;let _0x57e32c=resolve(_0x129223);const _0x6b53e5=resolve(_0x1747e0);while(_0x57e32c['startsWith'](''+_0x6b53e5+sep)||_0x57e32c===_0x6b53e5){if(_0x57e32c===_0x6b53e5)return;try{const _0xee91c8=await readdir(_0x57e32c);if(_0xee91c8[_0xd90003(0xd1)]>0x0)return;await rmdir(_0x57e32c);}catch{return;}_0x57e32c=dirname(_0x57e32c);}}async function resolveTargetDbBinding(_0x3d8f05,_0x2c1c58,_0x5c3762){const _0x11ffa9=a254_0x5e9230,_0x247db1=_0x2c1c58[_0x11ffa9(0xac)];if(!_0x247db1)return{'dbId':_0x5c3762['dbId'],'dbName':_0x5c3762[_0x11ffa9(0xc7)]};const _0x1d5837=buildDbDirectoryName(_0x5c3762[_0x11ffa9(0xc7)],_0x5c3762[_0x11ffa9(0xb6)]);if(_0x247db1===_0x1d5837)return{'dbId':_0x5c3762[_0x11ffa9(0xb6)],'dbName':_0x5c3762[_0x11ffa9(0xc7)]};const _0x183749=parseExplicitDbDirectory(_0x247db1);if(_0x183749!=null)return{'dbId':_0x183749,'dbName':await getDbName(_0x3d8f05,_0x183749)['catch'](()=>undefined)};const _0x4c3bb2=await listDatabases(_0x3d8f05),_0x5823d1=_0x4c3bb2['filter'](_0x35b4d0=>buildDbDirectoryName(_0x35b4d0[_0x11ffa9(0xc7)],_0x35b4d0[_0x11ffa9(0xb6)])===_0x247db1);if(_0x5823d1[_0x11ffa9(0xd1)]===0x1)return{'dbId':_0x5823d1[0x0][_0x11ffa9(0xb6)],'dbName':_0x5823d1[0x0][_0x11ffa9(0xc7)]};if(_0x5823d1[_0x11ffa9(0xd1)]===0x0)throw CliErrors[_0x11ffa9(0xc1)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x247db1+_0x11ffa9(0xe2)+_0x2c1c58['sqlCode']+'.');const _0x33a9fe=_0x5823d1[_0x11ffa9(0xce)](_0x27072c=>_0x27072c['dbName']+'\x20('+_0x27072c[_0x11ffa9(0xb6)]+')')[_0x11ffa9(0xde)](',\x20');throw CliErrors['validation'](_0x11ffa9(0xda)+_0x247db1+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x2c1c58[_0x11ffa9(0xc0)]+':\x20'+_0x33a9fe);}function parseExplicitDbDirectory(_0x5e3bf7){const _0x24a9c8=a254_0x5e9230,_0x2d9b89=/^db-(\d+)$/[_0x24a9c8(0xaa)](_0x5e3bf7);if(!_0x2d9b89)return null;const _0x2202a5=Number(_0x2d9b89[0x1]);return Number[_0x24a9c8(0xd0)](_0x2202a5)&&_0x2202a5>0x0?_0x2202a5:null;}
@@ -1 +1 @@
1
- const a255_0x5c29f9=a255_0x36b9;(function(_0x342c2c,_0xb6da8a){const _0xd0e3d7=a255_0x36b9,_0x290256=_0x342c2c();while(!![]){try{const _0x2c64cb=parseInt(_0xd0e3d7(0x1f5))/0x1+parseInt(_0xd0e3d7(0x217))/0x2*(parseInt(_0xd0e3d7(0x20f))/0x3)+parseInt(_0xd0e3d7(0x212))/0x4+parseInt(_0xd0e3d7(0x210))/0x5+-parseInt(_0xd0e3d7(0x1f2))/0x6*(-parseInt(_0xd0e3d7(0x1fa))/0x7)+parseInt(_0xd0e3d7(0x209))/0x8+-parseInt(_0xd0e3d7(0x1fc))/0x9;if(_0x2c64cb===_0xb6da8a)break;else _0x290256['push'](_0x290256['shift']());}catch(_0x4f6dbc){_0x290256['push'](_0x290256['shift']());}}}(a255_0x549c,0x21769));function a255_0x549c(){const _0x20729a=['sqlCode','dbName','length','exec','138582kOxctd','trimStart','sqlName','123463iDwjmp','sqlContent','stdin','fromEntries','lastSync','35gNtyrq','dbId','3708567IIwvkV','trim','yes','\x20-->','syncedAt','sqlConfig','.rabetbase/sql','body','path','sqlRoot','description','sqls','\x20[y/N]\x20','756360NhbHMu','split','mode','version','question','map','3rHrnSg','785625UBtZPj','entries','119308LxMEYq','stderr','apps','--\x20@lovrabet.','mybatisXml','57366WFbKSC','replace','join','declaration','slice','endsWith'];a255_0x549c=function(){return _0x20729a;};return a255_0x549c();}import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a255_0x5c29f9(0x202);export function buildSqlLockEntry(_0x5b0186,_0x45ae25,_0x7f088c,_0x1a431c){const _0x72a902=a255_0x5c29f9,_0x5272b9=detectSqlMode(_0x45ae25);return{'path':buildSqlRelativePath(_0x5b0186[_0x72a902(0x21d)],_0x5b0186[_0x72a902(0x1f4)],_0x1a431c?.[_0x72a902(0x21e)],_0x5272b9,_0x5b0186[_0x72a902(0x1fb)]),'hash':_0x7f088c,'remoteId':_0x5b0186['id'],'version':_0x5b0186[_0x72a902(0x20c)],'dbId':Number(_0x5b0186[_0x72a902(0x1fb)]),'dbName':_0x1a431c?.[_0x72a902(0x21e)],'sqlName':_0x5b0186[_0x72a902(0x1f4)],'sqlConfig':_0x5b0186[_0x72a902(0x201)]??undefined,'mode':_0x5272b9};}export function cloneSqlLockData(_0x1b0b07){const _0x3cf0e6=a255_0x5c29f9;return{'apps':Object[_0x3cf0e6(0x1f8)](Object[_0x3cf0e6(0x211)](_0x1b0b07[_0x3cf0e6(0x214)])['map'](([_0x1dab75,_0x2cbe4a])=>[_0x1dab75,{'sqlRoot':_0x2cbe4a[_0x3cf0e6(0x205)],'lastSync':_0x2cbe4a[_0x3cf0e6(0x1f9)],'sqls':{..._0x2cbe4a[_0x3cf0e6(0x207)]}}]))};}export function ensureRemoteSqlContent(_0x1e935b){const _0x47a4ad=a255_0x5c29f9;return _0x1e935b[_0x47a4ad(0x1f6)]??'';}export function buildLocalSqlFileContent(_0x2c6adb,_0x53c7ad,_0x4f39ed){const _0x57b36e=a255_0x5c29f9,_0xfb12fc=_0x4f39ed?.[_0x57b36e(0x20b)]??detectSqlMode(_0x53c7ad),_0x6bdfb6=stripLocalSqlMetadata(_0x53c7ad,_0xfb12fc)[_0x57b36e(0x1fd)](),_0x74b9cf=buildMetadataHeaderLines({'sqlCode':_0x2c6adb[_0x57b36e(0x21d)],'sqlName':_0x2c6adb['sqlName'],'dbId':_0x2c6adb[_0x57b36e(0x1fb)],'dbName':_0x4f39ed?.[_0x57b36e(0x21e)],'mode':_0xfb12fc,'syncedAt':_0x4f39ed?.[_0x57b36e(0x200)],'description':_0x4f39ed?.['description']},_0xfb12fc),_0x280d32=_0xfb12fc===_0x57b36e(0x216)?splitXmlDeclaration(_0x6bdfb6):{'body':_0x6bdfb6},_0x44efb3=[..._0x280d32[_0x57b36e(0x21a)]?[_0x280d32[_0x57b36e(0x21a)]]:[],..._0x74b9cf,'',_0x280d32[_0x57b36e(0x203)]['trimStart']()],_0x29ee90=_0x44efb3[_0x57b36e(0x219)]('\x0a');return _0x29ee90[_0x57b36e(0x21c)]('\x0a')?_0x29ee90:_0x29ee90+'\x0a';}export function stripLocalSqlMetadata(_0x17ba75,_0xd89d36){const _0xf7badf=a255_0x5c29f9;if(_0xd89d36===_0xf7badf(0x216)){const {declaration:_0x4d9687,body:_0x92dd8d}=splitXmlDeclaration(_0x17ba75[_0xf7badf(0x218)](/\r\n/g,'\x0a')),_0x340048=stripLeadingMetadataLines(_0x92dd8d,/^\s*<!--\s*@lovrabet\./);return _0x4d9687?''+_0x4d9687+(_0x340048?'\x0a'+_0x340048:''):_0x340048;}return stripLeadingMetadataLines(_0x17ba75['replace'](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0x36a620,_0x2ad8c9){const _0x11ad8b=a255_0x5c29f9;if(_0x2ad8c9?.['mode'])return _0x2ad8c9[_0x11ad8b(0x20b)];return detectSqlMode(_0x36a620);}export function resolveSqlFileName(_0x58c624,_0x2fc274,_0x434593){const _0x40e60c=a255_0x5c29f9;if(_0x434593?.[_0x40e60c(0x204)])return _0x434593[_0x40e60c(0x204)];if(_0x434593?.[_0x40e60c(0x1f4)]||_0x434593?.['dbName'])return buildSqlRelativePath(_0x58c624,_0x434593?.[_0x40e60c(0x1f4)],_0x434593?.[_0x40e60c(0x21e)],resolveSqlMode(_0x2fc274,_0x434593),_0x434593?.[_0x40e60c(0x1fb)]);return buildDefaultSqlFileName(_0x58c624,resolveSqlMode(_0x2fc274,_0x434593));}export function resolveSqlLocalDir(_0x1d0794,_0x1cf814){return join(_0x1d0794,SQL_LOCAL_REL_DIR,_0x1cf814);}export async function confirmForceOverwrite(_0x138c0e){const _0x4453ab=a255_0x5c29f9,_0x2c2734=createInterface({'input':process[_0x4453ab(0x1f7)],'output':process[_0x4453ab(0x213)]}),_0x1d4cf2=await new Promise(_0x3e3d05=>{const _0x371783=_0x4453ab;_0x2c2734[_0x371783(0x20d)](_0x138c0e+_0x371783(0x208),_0x3e3d05);});return _0x2c2734['close'](),['y',_0x4453ab(0x1fe)]['includes'](_0x1d4cf2[_0x4453ab(0x1fd)]()['toLowerCase']());}export function findSqlLockScope(_0x1e8e38,_0x4ca77d){const _0x32de64=a255_0x5c29f9;return _0x1e8e38[_0x32de64(0x214)][_0x4ca77d];}function buildMetadataHeaderLines(_0x4d9dd5,_0x4e8f20){const _0x45c07e=a255_0x5c29f9,_0x5361d2=[[_0x45c07e(0x21d),_0x4d9dd5['sqlCode']],[_0x45c07e(0x1f4),_0x4d9dd5['sqlName']],[_0x45c07e(0x1fb),_0x4d9dd5[_0x45c07e(0x1fb)]],[_0x45c07e(0x21e),_0x4d9dd5[_0x45c07e(0x21e)]],['mode',_0x4d9dd5['mode']],['syncedAt',_0x4d9dd5['syncedAt']],[_0x45c07e(0x206),_0x4d9dd5[_0x45c07e(0x206)]]];if(_0x4e8f20===_0x45c07e(0x216))return _0x5361d2['filter'](([,_0x37458e])=>_0x37458e!==undefined&&_0x37458e!==null&&String(_0x37458e)[_0x45c07e(0x1fd)]()!=='')[_0x45c07e(0x20e)](([_0x4eee58,_0x3db1fc])=>'<!--\x20@lovrabet.'+_0x4eee58+':\x20'+String(_0x3db1fc)+_0x45c07e(0x1ff));return _0x5361d2['filter'](([,_0x19f12a])=>_0x19f12a!==undefined&&_0x19f12a!==null&&String(_0x19f12a)[_0x45c07e(0x1fd)]()!=='')[_0x45c07e(0x20e)](([_0x3bea1f,_0x3da8be])=>_0x45c07e(0x215)+_0x3bea1f+':\x20'+String(_0x3da8be));}function a255_0x36b9(_0x2c140a,_0x4768de){_0x2c140a=_0x2c140a-0x1f1;const _0x549c65=a255_0x549c();let _0x36b97f=_0x549c65[_0x2c140a];return _0x36b97f;}function splitXmlDeclaration(_0x594046){const _0x10002d=a255_0x5c29f9,_0x50d113=_0x594046['trimStart'](),_0x4d016b=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i[_0x10002d(0x1f1)](_0x50d113);if(!_0x4d016b)return{'body':_0x594046};return{'declaration':_0x4d016b[0x0],'body':_0x50d113[_0x10002d(0x21b)](_0x4d016b[0x0][_0x10002d(0x21f)])};}function stripLeadingMetadataLines(_0x1f1e40,_0x1fe28b){const _0x33d0e8=a255_0x5c29f9,_0x4fe783=_0x1f1e40[_0x33d0e8(0x20a)]('\x0a');let _0x276bf5=0x0;while(_0x276bf5<_0x4fe783[_0x33d0e8(0x21f)]){const _0x1d7abb=_0x4fe783[_0x276bf5]??'';if(_0x1fe28b['test'](_0x1d7abb)||_0x1d7abb['trim']()===''){_0x276bf5++;continue;}break;}return _0x4fe783[_0x33d0e8(0x21b)](_0x276bf5)[_0x33d0e8(0x219)]('\x0a')[_0x33d0e8(0x1f3)]();}
1
+ (function(_0x1c8b56,_0x30de10){const _0x5eabbb=a255_0x46f4,_0x333cb1=_0x1c8b56();while(!![]){try{const _0x4c4030=-parseInt(_0x5eabbb(0x119))/0x1+-parseInt(_0x5eabbb(0x10d))/0x2+parseInt(_0x5eabbb(0x124))/0x3+parseInt(_0x5eabbb(0x132))/0x4+-parseInt(_0x5eabbb(0x10a))/0x5*(-parseInt(_0x5eabbb(0x135))/0x6)+parseInt(_0x5eabbb(0x111))/0x7*(parseInt(_0x5eabbb(0x11d))/0x8)+-parseInt(_0x5eabbb(0x118))/0x9;if(_0x4c4030===_0x30de10)break;else _0x333cb1['push'](_0x333cb1['shift']());}catch(_0x936fc0){_0x333cb1['push'](_0x333cb1['shift']());}}}(a255_0x2a04,0x61634));function a255_0x46f4(_0x16cff5,_0x4e2485){_0x16cff5=_0x16cff5-0x105;const _0x2a04e2=a255_0x2a04();let _0x46f4e3=_0x2a04e2[_0x16cff5];return _0x46f4e3;}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(_0x269e7d,_0x36e87c,_0xf2cc41,_0x44f5e6){const _0x2e68d9=a255_0x46f4,_0xf3d49e=detectSqlMode(_0x36e87c);return{'path':buildSqlRelativePath(_0x269e7d[_0x2e68d9(0x11a)],_0x269e7d[_0x2e68d9(0x133)],_0x44f5e6?.[_0x2e68d9(0x106)],_0xf3d49e,_0x269e7d['dbId']),'hash':_0xf2cc41,'remoteId':_0x269e7d['id'],'version':_0x269e7d[_0x2e68d9(0x11f)],'dbId':Number(_0x269e7d[_0x2e68d9(0x12e)]),'dbName':_0x44f5e6?.[_0x2e68d9(0x106)],'sqlName':_0x269e7d[_0x2e68d9(0x133)],'sqlConfig':_0x269e7d['sqlConfig']??undefined,'mode':_0xf3d49e};}export function cloneSqlLockData(_0x1ee17b){const _0x4144c8=a255_0x46f4;return{'apps':Object[_0x4144c8(0x107)](Object[_0x4144c8(0x12d)](_0x1ee17b['apps'])[_0x4144c8(0x113)](([_0x2c1b6f,_0x20e003])=>[_0x2c1b6f,{'sqlRoot':_0x20e003[_0x4144c8(0x10b)],'lastSync':_0x20e003[_0x4144c8(0x125)],'sqls':{..._0x20e003[_0x4144c8(0x12f)]}}]))};}export function ensureRemoteSqlContent(_0x266e63){const _0x1c9e04=a255_0x46f4;return _0x266e63[_0x1c9e04(0x120)]??'';}export function buildLocalSqlFileContent(_0x3fb9d6,_0x7c5174,_0x1642e6){const _0x560ea1=a255_0x46f4,_0x2a1dc0=_0x1642e6?.['mode']??detectSqlMode(_0x7c5174),_0x5e531e=stripLocalSqlMetadata(_0x7c5174,_0x2a1dc0)['trim'](),_0x5dec39=buildMetadataHeaderLines({'sqlCode':_0x3fb9d6[_0x560ea1(0x11a)],'sqlName':_0x3fb9d6[_0x560ea1(0x133)],'dbId':_0x3fb9d6[_0x560ea1(0x12e)],'dbName':_0x1642e6?.[_0x560ea1(0x106)],'mode':_0x2a1dc0,'syncedAt':_0x1642e6?.[_0x560ea1(0x116)],'description':_0x1642e6?.[_0x560ea1(0x11e)]},_0x2a1dc0),_0x312c96=_0x2a1dc0===_0x560ea1(0x122)?splitXmlDeclaration(_0x5e531e):{'body':_0x5e531e},_0x167bbc=[..._0x312c96['declaration']?[_0x312c96[_0x560ea1(0x10f)]]:[],..._0x5dec39,'',_0x312c96[_0x560ea1(0x131)][_0x560ea1(0x12c)]()],_0x479b86=_0x167bbc[_0x560ea1(0x112)]('\x0a');return _0x479b86[_0x560ea1(0x115)]('\x0a')?_0x479b86:_0x479b86+'\x0a';}export function stripLocalSqlMetadata(_0x540980,_0x204297){const _0x2e6f23=a255_0x46f4;if(_0x204297===_0x2e6f23(0x122)){const {declaration:_0x22495b,body:_0x6fff07}=splitXmlDeclaration(_0x540980[_0x2e6f23(0x105)](/\r\n/g,'\x0a')),_0x1208a2=stripLeadingMetadataLines(_0x6fff07,/^\s*<!--\s*@lovrabet\./);return _0x22495b?''+_0x22495b+(_0x1208a2?'\x0a'+_0x1208a2:''):_0x1208a2;}return stripLeadingMetadataLines(_0x540980[_0x2e6f23(0x105)](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0x2a0737,_0x328146){const _0x27426c=a255_0x46f4;if(_0x328146?.['mode'])return _0x328146[_0x27426c(0x129)];return detectSqlMode(_0x2a0737);}export function resolveSqlFileName(_0x564227,_0x339f83,_0x48b0a3){const _0x25fd69=a255_0x46f4;if(_0x48b0a3?.[_0x25fd69(0x117)])return _0x48b0a3[_0x25fd69(0x117)];if(_0x48b0a3?.['sqlName']||_0x48b0a3?.['dbName'])return buildSqlRelativePath(_0x564227,_0x48b0a3?.[_0x25fd69(0x133)],_0x48b0a3?.[_0x25fd69(0x106)],resolveSqlMode(_0x339f83,_0x48b0a3),_0x48b0a3?.[_0x25fd69(0x12e)]);return buildDefaultSqlFileName(_0x564227,resolveSqlMode(_0x339f83,_0x48b0a3));}export function resolveSqlLocalDir(_0x2cf351,_0x2df306){return join(_0x2cf351,SQL_LOCAL_REL_DIR,_0x2df306);}export async function confirmForceOverwrite(_0x4f756d){const _0x3533a4=a255_0x46f4,_0x3c6df1=createInterface({'input':process[_0x3533a4(0x130)],'output':process[_0x3533a4(0x110)]}),_0xdf4e4d=await new Promise(_0x6aa25d=>{const _0x37b68e=_0x3533a4;_0x3c6df1[_0x37b68e(0x128)](_0x4f756d+_0x37b68e(0x121),_0x6aa25d);});return _0x3c6df1[_0x3533a4(0x10e)](),['y',_0x3533a4(0x114)][_0x3533a4(0x12a)](_0xdf4e4d[_0x3533a4(0x11c)]()[_0x3533a4(0x123)]());}export function findSqlLockScope(_0x5d4ee2,_0x2baf8f){return _0x5d4ee2['apps'][_0x2baf8f];}function buildMetadataHeaderLines(_0x22a627,_0x3f1d08){const _0x35d2d8=a255_0x46f4,_0x833c6a=[[_0x35d2d8(0x11a),_0x22a627[_0x35d2d8(0x11a)]],[_0x35d2d8(0x133),_0x22a627[_0x35d2d8(0x133)]],['dbId',_0x22a627[_0x35d2d8(0x12e)]],[_0x35d2d8(0x106),_0x22a627['dbName']],[_0x35d2d8(0x129),_0x22a627['mode']],[_0x35d2d8(0x116),_0x22a627[_0x35d2d8(0x116)]],[_0x35d2d8(0x11e),_0x22a627[_0x35d2d8(0x11e)]]];if(_0x3f1d08===_0x35d2d8(0x122))return _0x833c6a[_0x35d2d8(0x12b)](([,_0x2aae4a])=>_0x2aae4a!==undefined&&_0x2aae4a!==null&&String(_0x2aae4a)[_0x35d2d8(0x11c)]()!=='')['map'](([_0x2716eb,_0x240f00])=>_0x35d2d8(0x108)+_0x2716eb+':\x20'+String(_0x240f00)+'\x20-->');return _0x833c6a[_0x35d2d8(0x12b)](([,_0xab5fb5])=>_0xab5fb5!==undefined&&_0xab5fb5!==null&&String(_0xab5fb5)[_0x35d2d8(0x11c)]()!=='')[_0x35d2d8(0x113)](([_0x553f2a,_0x5ed6b2])=>_0x35d2d8(0x134)+_0x553f2a+':\x20'+String(_0x5ed6b2));}function splitXmlDeclaration(_0x3c2596){const _0x5345bf=a255_0x46f4,_0x326fd9=_0x3c2596[_0x5345bf(0x12c)](),_0x3675d4=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i[_0x5345bf(0x10c)](_0x326fd9);if(!_0x3675d4)return{'body':_0x3c2596};return{'declaration':_0x3675d4[0x0],'body':_0x326fd9[_0x5345bf(0x127)](_0x3675d4[0x0][_0x5345bf(0x109)])};}function stripLeadingMetadataLines(_0x2a1dcc,_0x561d26){const _0x59a981=a255_0x46f4,_0x1a7c45=_0x2a1dcc[_0x59a981(0x11b)]('\x0a');let _0x28dfcb=0x0;while(_0x28dfcb<_0x1a7c45[_0x59a981(0x109)]){const _0x597e6e=_0x1a7c45[_0x28dfcb]??'';if(_0x561d26[_0x59a981(0x126)](_0x597e6e)||_0x597e6e['trim']()===''){_0x28dfcb++;continue;}break;}return _0x1a7c45[_0x59a981(0x127)](_0x28dfcb)[_0x59a981(0x112)]('\x0a')[_0x59a981(0x12c)]();}function a255_0x2a04(){const _0x2fb7e1=['lastSync','test','slice','question','mode','includes','filter','trimStart','entries','dbId','sqls','stdin','body','2714688tqqzsN','sqlName','--\x20@lovrabet.','108xXkjMW','replace','dbName','fromEntries','<!--\x20@lovrabet.','length','176520CfQAOO','sqlRoot','exec','643786KNSVMG','close','declaration','stderr','826JcxntN','join','map','yes','endsWith','syncedAt','path','10683513YPyeQx','510162JnamMc','sqlCode','split','trim','22648DmSbyJ','description','version','sqlContent','\x20[y/N]\x20','mybatisXml','toLowerCase','2309430FNJiUC'];a255_0x2a04=function(){return _0x2fb7e1;};return a255_0x2a04();}