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

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 (375) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/api-group.js +1 -1
  3. package/lib/api/fetch-model-list.js +1 -1
  4. package/lib/api/generate-api-file.js +1 -1
  5. package/lib/api/generate-sdk-config-file.js +1 -1
  6. package/lib/api/legacy-api-file.js +1 -1
  7. package/lib/api/model-registry-file.js +1 -1
  8. package/lib/api/model-registry-scaffold.js +1 -1
  9. package/lib/api/model-source.js +1 -1
  10. package/lib/auth/auth-server-ui.js +1 -1
  11. package/lib/auth/auth-server.js +1 -1
  12. package/lib/auth/constant.js +1 -1
  13. package/lib/auth/get-cookie.js +1 -1
  14. package/lib/auth/get-session-user.js +1 -1
  15. package/lib/auth/is-session-valid.js +1 -1
  16. package/lib/auth/login-success-html.js +1 -1
  17. package/lib/auth/logout.js +1 -1
  18. package/lib/cli-flags.js +1 -1
  19. package/lib/cli.js +1 -1
  20. package/lib/commands/api/generate.js +1 -1
  21. package/lib/commands/api/index.js +1 -1
  22. package/lib/commands/api/list.js +1 -1
  23. package/lib/commands/api/pull.js +1 -1
  24. package/lib/commands/api/shared.js +1 -1
  25. package/lib/commands/app/detail.js +1 -1
  26. package/lib/commands/app/index.js +1 -1
  27. package/lib/commands/app/list.js +1 -1
  28. package/lib/commands/app/members-list.js +1 -1
  29. package/lib/commands/app/remote-directory.js +1 -1
  30. package/lib/commands/app/shared.js +1 -1
  31. package/lib/commands/app-config/delete.js +1 -1
  32. package/lib/commands/app-config/get.js +1 -1
  33. package/lib/commands/app-config/index.js +1 -1
  34. package/lib/commands/app-config/list.js +1 -1
  35. package/lib/commands/app-config/set.js +1 -1
  36. package/lib/commands/app-config/shared.js +1 -1
  37. package/lib/commands/auth/index.js +1 -1
  38. package/lib/commands/bff/create.js +1 -1
  39. package/lib/commands/bff/delete.js +1 -1
  40. package/lib/commands/bff/detail.js +1 -1
  41. package/lib/commands/bff/index.js +1 -1
  42. package/lib/commands/bff/list.js +1 -1
  43. package/lib/commands/bff/logs.js +1 -1
  44. package/lib/commands/bff/pull.js +1 -1
  45. package/lib/commands/bff/push.js +1 -1
  46. package/lib/commands/bff/status.js +1 -1
  47. package/lib/commands/cli-skill/index.js +1 -1
  48. package/lib/commands/cli-update.js +1 -1
  49. package/lib/commands/codegen/index.js +1 -1
  50. package/lib/commands/codegen/sdk.js +1 -1
  51. package/lib/commands/codegen/sql.js +1 -1
  52. package/lib/commands/common/app-registry.js +1 -1
  53. package/lib/commands/common/app-selector.js +1 -1
  54. package/lib/commands/common/async-task.js +1 -1
  55. package/lib/commands/common/dry-run.js +1 -1
  56. package/lib/commands/common/flags.js +1 -1
  57. package/lib/commands/common/local-file.js +1 -1
  58. package/lib/commands/common/validate.js +1 -1
  59. package/lib/commands/config/delete.js +1 -1
  60. package/lib/commands/config/get.js +1 -1
  61. package/lib/commands/config/index.js +1 -1
  62. package/lib/commands/config/init.js +1 -1
  63. package/lib/commands/config/list.js +1 -1
  64. package/lib/commands/config/set.js +1 -1
  65. package/lib/commands/config/shared.js +1 -1
  66. package/lib/commands/dataset/batch-design.js +1 -1
  67. package/lib/commands/dataset/business-group-update.js +1 -1
  68. package/lib/commands/dataset/business-groups.js +1 -1
  69. package/lib/commands/dataset/capability.js +1 -1
  70. package/lib/commands/dataset/cross-relation-create.js +1 -1
  71. package/lib/commands/dataset/cross-relation-delete.js +1 -1
  72. package/lib/commands/dataset/cross-relation-list.js +1 -1
  73. package/lib/commands/dataset/cross-relation-shared.js +1 -1
  74. package/lib/commands/dataset/cross-relation-update.js +1 -1
  75. package/lib/commands/dataset/delete.js +1 -1
  76. package/lib/commands/dataset/design-context.js +1 -1
  77. package/lib/commands/dataset/design-start.js +1 -1
  78. package/lib/commands/dataset/design-status.js +1 -1
  79. package/lib/commands/dataset/design-sync-retry.js +1 -1
  80. package/lib/commands/dataset/design-sync-status.js +1 -1
  81. package/lib/commands/dataset/design-validate.js +1 -1
  82. package/lib/commands/dataset/detail.js +1 -1
  83. package/lib/commands/dataset/extend-update.js +1 -1
  84. package/lib/commands/dataset/field-restore.js +1 -1
  85. package/lib/commands/dataset/field-update.js +1 -1
  86. package/lib/commands/dataset/generate.js +1 -1
  87. package/lib/commands/dataset/index.js +1 -1
  88. package/lib/commands/dataset/list.js +1 -1
  89. package/lib/commands/dataset/operations.js +1 -1
  90. package/lib/commands/dataset/relation-audit.js +1 -1
  91. package/lib/commands/dataset/relation-create.js +1 -1
  92. package/lib/commands/dataset/relation-delete.js +1 -1
  93. package/lib/commands/dataset/relation-shared.js +1 -1
  94. package/lib/commands/dataset/relation-update.js +1 -1
  95. package/lib/commands/dataset/relations.js +1 -1
  96. package/lib/commands/dataset/rename.js +1 -1
  97. package/lib/commands/dataset/restore.js +1 -1
  98. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  99. package/lib/commands/db/analysis-batching.js +1 -1
  100. package/lib/commands/db/analyze-batch-plan.js +1 -1
  101. package/lib/commands/db/analyze-cancel.js +1 -1
  102. package/lib/commands/db/analyze-start.js +1 -1
  103. package/lib/commands/db/analyze-status.js +1 -1
  104. package/lib/commands/db/create.js +1 -1
  105. package/lib/commands/db/cross-db-analysis-shared.js +1 -1
  106. package/lib/commands/db/cross-db-analyze-latest.js +1 -1
  107. package/lib/commands/db/cross-db-analyze-start.js +1 -1
  108. package/lib/commands/db/cross-db-analyze-status.js +1 -1
  109. package/lib/commands/db/delete.js +1 -1
  110. package/lib/commands/db/detail.js +1 -1
  111. package/lib/commands/db/diff-refresh-start.js +1 -1
  112. package/lib/commands/db/diff-refresh-status.js +1 -1
  113. package/lib/commands/db/diff.js +1 -1
  114. package/lib/commands/db/index.js +1 -1
  115. package/lib/commands/db/list.js +1 -1
  116. package/lib/commands/db/shared.js +1 -1
  117. package/lib/commands/db/table-diff-shared.js +1 -1
  118. package/lib/commands/db/tables.js +1 -1
  119. package/lib/commands/db/test.js +1 -1
  120. package/lib/commands/db/update.js +1 -1
  121. package/lib/commands/deployment/index.js +1 -1
  122. package/lib/commands/deployment/sync-all.js +1 -1
  123. package/lib/commands/deployment/sync-jobs.js +1 -1
  124. package/lib/commands/deployment/sync-status.js +1 -1
  125. package/lib/commands/doctor.js +1 -1
  126. package/lib/commands/file/index.js +1 -1
  127. package/lib/commands/flow/create.js +1 -1
  128. package/lib/commands/flow/detail.js +1 -1
  129. package/lib/commands/flow/index.js +1 -1
  130. package/lib/commands/flow/list.js +1 -1
  131. package/lib/commands/flow/page-list.js +1 -1
  132. package/lib/commands/flow/publish.js +1 -1
  133. package/lib/commands/flow/runtime-resources-shared.js +1 -1
  134. package/lib/commands/flow/runtime-role-list.js +1 -1
  135. package/lib/commands/flow/runtime-role-user-list.js +1 -1
  136. package/lib/commands/flow/runtime-user-search.js +1 -1
  137. package/lib/commands/flow/shared.js +1 -1
  138. package/lib/commands/flow/update.js +1 -1
  139. package/lib/commands/flow/validate.js +1 -1
  140. package/lib/commands/instant-api-policy/current.js +1 -1
  141. package/lib/commands/instant-api-policy/index.js +1 -1
  142. package/lib/commands/instant-api-policy/init.js +1 -1
  143. package/lib/commands/instant-api-policy/publish.js +1 -1
  144. package/lib/commands/instant-api-policy/pull.js +1 -1
  145. package/lib/commands/instant-api-policy/revision.js +1 -1
  146. package/lib/commands/instant-api-policy/revisions.js +1 -1
  147. package/lib/commands/instant-api-policy/rollback.js +1 -1
  148. package/lib/commands/instant-api-policy/shared.js +1 -1
  149. package/lib/commands/instant-api-policy/validate.js +1 -1
  150. package/lib/commands/issue/index.js +1 -1
  151. package/lib/commands/issue/nudge.js +1 -1
  152. package/lib/commands/issue/report.js +1 -1
  153. package/lib/commands/issue/shared.js +1 -1
  154. package/lib/commands/kb/create.js +1 -1
  155. package/lib/commands/kb/delete.js +1 -1
  156. package/lib/commands/kb/detail.js +1 -1
  157. package/lib/commands/kb/index.js +1 -1
  158. package/lib/commands/kb/list.js +1 -1
  159. package/lib/commands/kb/search.js +1 -1
  160. package/lib/commands/kb/shared.js +1 -1
  161. package/lib/commands/kb/update.js +1 -1
  162. package/lib/commands/logs/index.js +1 -1
  163. package/lib/commands/menu/asset-update.js +1 -1
  164. package/lib/commands/menu/delete.js +1 -1
  165. package/lib/commands/menu/external-link-create.js +1 -1
  166. package/lib/commands/menu/external-link-update.js +1 -1
  167. package/lib/commands/menu/group-create.js +1 -1
  168. package/lib/commands/menu/group-update.js +1 -1
  169. package/lib/commands/menu/index.js +1 -1
  170. package/lib/commands/menu/list.js +1 -1
  171. package/lib/commands/menu/move.js +1 -1
  172. package/lib/commands/menu/regroup-start.js +1 -1
  173. package/lib/commands/menu/rename.js +1 -1
  174. package/lib/commands/menu/shared/compare-table.js +1 -1
  175. package/lib/commands/menu/shared/delete-plan.js +1 -1
  176. package/lib/commands/menu/shared/facts.js +1 -1
  177. package/lib/commands/menu/shared/index.js +1 -1
  178. package/lib/commands/menu/shared/inquirer.js +1 -1
  179. package/lib/commands/menu/shared/local-pages.js +1 -1
  180. package/lib/commands/menu/shared/logic.js +1 -1
  181. package/lib/commands/menu/shared/mutations.js +1 -1
  182. package/lib/commands/menu/shared/path.js +1 -1
  183. package/lib/commands/menu/shared/service.js +1 -1
  184. package/lib/commands/menu/shared/subapp-assets.js +1 -1
  185. package/lib/commands/menu/shared/sync-core.js +1 -1
  186. package/lib/commands/menu/shared/update-core.js +1 -1
  187. package/lib/commands/menu/shared/valid-url.js +1 -1
  188. package/lib/commands/menu/subapp-assets-status.js +1 -1
  189. package/lib/commands/menu/subapp-assets-update.js +1 -1
  190. package/lib/commands/menu/sync.js +1 -1
  191. package/lib/commands/menu/visibility-update.js +1 -1
  192. package/lib/commands/notification/config-create.js +1 -1
  193. package/lib/commands/notification/config-delete.js +1 -1
  194. package/lib/commands/notification/config-list.js +1 -1
  195. package/lib/commands/notification/config-update.js +1 -1
  196. package/lib/commands/notification/index.js +1 -1
  197. package/lib/commands/notification/shared.js +1 -1
  198. package/lib/commands/ocr/index.js +1 -1
  199. package/lib/commands/page/create.js +1 -1
  200. package/lib/commands/page/custom/detail.js +1 -1
  201. package/lib/commands/page/custom/list.js +1 -1
  202. package/lib/commands/page/custom/publish.js +1 -1
  203. package/lib/commands/page/custom/shared.js +1 -1
  204. package/lib/commands/page/custom/syntax.js +1 -1
  205. package/lib/commands/page/custom/update.js +1 -1
  206. package/lib/commands/page/data-list-status.js +1 -1
  207. package/lib/commands/page/generate-start.js +1 -1
  208. package/lib/commands/page/generate-status.js +1 -1
  209. package/lib/commands/page/index.js +1 -1
  210. package/lib/commands/page/pull.js +1 -1
  211. package/lib/commands/page/push.js +1 -1
  212. package/lib/commands/page/relation-audit.js +1 -1
  213. package/lib/commands/page/restore.js +1 -1
  214. package/lib/commands/page/shared.js +1 -1
  215. package/lib/commands/page/sync.js +1 -1
  216. package/lib/commands/project/api-architecture-upgrade.js +1 -1
  217. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  218. package/lib/commands/project/create/format-elapsed.js +1 -1
  219. package/lib/commands/project/create/main.js +1 -1
  220. package/lib/commands/project/create/materialize-project-template.js +1 -1
  221. package/lib/commands/project/create/project-name.js +1 -1
  222. package/lib/commands/project/create/project-template-archive.js +1 -1
  223. package/lib/commands/project/create/project-template-path.js +1 -1
  224. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  225. package/lib/commands/project/create/use-format-code.js +1 -1
  226. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  227. package/lib/commands/project/domain-routing-sync.js +1 -1
  228. package/lib/commands/project/index.js +1 -1
  229. package/lib/commands/project/upgrade.js +1 -1
  230. package/lib/commands/registry.js +1 -1
  231. package/lib/commands/role/delete.js +1 -1
  232. package/lib/commands/role/detail.js +1 -1
  233. package/lib/commands/role/index.js +1 -1
  234. package/lib/commands/role/list.js +1 -1
  235. package/lib/commands/role/shared.js +1 -1
  236. package/lib/commands/role/update.js +1 -1
  237. package/lib/commands/role/user-add.js +1 -1
  238. package/lib/commands/role/user-remove.js +1 -1
  239. package/lib/commands/role/user-resolve.js +1 -1
  240. package/lib/commands/rule/get.js +1 -1
  241. package/lib/commands/rule/index.js +1 -1
  242. package/lib/commands/rule/list.js +1 -1
  243. package/lib/commands/rule/set.js +1 -1
  244. package/lib/commands/rule/shared.js +1 -1
  245. package/lib/commands/run/index.js +1 -1
  246. package/lib/commands/schema.js +1 -1
  247. package/lib/commands/sql/create.js +1 -1
  248. package/lib/commands/sql/delete.js +1 -1
  249. package/lib/commands/sql/detail.js +1 -1
  250. package/lib/commands/sql/exec.js +1 -1
  251. package/lib/commands/sql/index.js +1 -1
  252. package/lib/commands/sql/list.js +1 -1
  253. package/lib/commands/sql/pull.js +1 -1
  254. package/lib/commands/sql/push.js +1 -1
  255. package/lib/commands/sql/shared.js +1 -1
  256. package/lib/commands/sql/status.js +1 -1
  257. package/lib/commands/sql/validate.js +1 -1
  258. package/lib/commands/task/index.js +1 -1
  259. package/lib/commands/task/status.js +1 -1
  260. package/lib/commands/tenant/index.js +1 -1
  261. package/lib/commands/tenant/members-list.js +1 -1
  262. package/lib/commands/tenant/shared.js +1 -1
  263. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  264. package/lib/commands/user-account/feishu-bind.js +1 -1
  265. package/lib/commands/user-account/index.js +1 -1
  266. package/lib/commands/workspace/add.js +1 -1
  267. package/lib/commands/workspace/index.js +1 -1
  268. package/lib/commands/workspace/remove.js +1 -1
  269. package/lib/config/domain-config.js +1 -1
  270. package/lib/config/project-domain-routing.js +1 -1
  271. package/lib/config/region-config.js +1 -1
  272. package/lib/config/schema.js +1 -1
  273. package/lib/constant/cdn.js +1 -1
  274. package/lib/constant/cli.js +1 -1
  275. package/lib/constant/defaults.js +1 -1
  276. package/lib/constant/domain.js +1 -1
  277. package/lib/constant/env.js +1 -1
  278. package/lib/constant/output.js +1 -1
  279. package/lib/constant/paths.js +1 -1
  280. package/lib/constant/region.js +1 -1
  281. package/lib/constant/risk.js +1 -1
  282. package/lib/constant/routing-profile.js +1 -1
  283. package/lib/context/app-resolver.js +1 -1
  284. package/lib/context/auth-resolver.js +1 -1
  285. package/lib/context/config-loader.js +1 -1
  286. package/lib/context.js +1 -1
  287. package/lib/core/alias-resolver.js +1 -1
  288. package/lib/core/api-client.js +1 -1
  289. package/lib/core/bff/config.js +1 -1
  290. package/lib/core/bff/file-system.js +1 -1
  291. package/lib/core/bff/hash.js +1 -1
  292. package/lib/core/bff/hook-directory.js +1 -1
  293. package/lib/core/bff/lock.js +1 -1
  294. package/lib/core/bff/utils.js +1 -1
  295. package/lib/core/cross-db-analysis.js +1 -1
  296. package/lib/core/cross-db-relation.js +1 -1
  297. package/lib/core/db-resolver.js +1 -1
  298. package/lib/core/flow-config.js +1 -1
  299. package/lib/core/instant-api-policy/config.js +1 -1
  300. package/lib/core/kb-search-client.js +1 -1
  301. package/lib/core/page/file-system.js +1 -1
  302. package/lib/core/page/hash.js +1 -1
  303. package/lib/core/page/lock.js +1 -1
  304. package/lib/core/page/lr-smart-jsx.js +1 -1
  305. package/lib/core/sql-index-auditor.js +1 -1
  306. package/lib/core/sql-sync/config.js +1 -1
  307. package/lib/core/sql-sync/file-system.js +1 -1
  308. package/lib/core/sql-sync/hash.js +1 -1
  309. package/lib/core/sql-sync/lock.js +1 -1
  310. package/lib/core/sql-sync/utils.js +1 -1
  311. package/lib/core/sql-validator.js +1 -1
  312. package/lib/errors.js +1 -1
  313. package/lib/framework/build-all-flags.js +1 -1
  314. package/lib/framework/error-output.js +1 -1
  315. package/lib/framework/explicit-yes.js +1 -1
  316. package/lib/framework/flags.js +1 -1
  317. package/lib/framework/help.js +1 -1
  318. package/lib/framework/index.js +1 -1
  319. package/lib/framework/output.js +1 -1
  320. package/lib/framework/response.js +1 -1
  321. package/lib/framework/runner-alias.js +1 -1
  322. package/lib/framework/runner.js +1 -1
  323. package/lib/framework/schema-export.js +1 -1
  324. package/lib/framework/supported-flags.js +1 -1
  325. package/lib/framework/types.js +1 -1
  326. package/lib/generated/build-info.d.ts +4 -4
  327. package/lib/generated/build-info.js +1 -1
  328. package/lib/generated/official-routing.js +1 -1
  329. package/lib/generated/routing-contract.js +1 -1
  330. package/lib/help.js +1 -1
  331. package/lib/postinstall.js +1 -1
  332. package/lib/runtime/confirmation.js +1 -1
  333. package/lib/runtime/event.js +1 -1
  334. package/lib/runtime/index.js +1 -1
  335. package/lib/runtime/queue.js +1 -1
  336. package/lib/runtime/resolve.js +1 -1
  337. package/lib/services/dataset-design/checkpoint.js +1 -1
  338. package/lib/services/dataset-design/commands.js +1 -1
  339. package/lib/services/dataset-design/contract.js +1 -1
  340. package/lib/skills/builtin-skill.js +1 -1
  341. package/lib/skills/main.js +1 -1
  342. package/lib/skills/npx-skills-add.js +1 -1
  343. package/lib/skills/skill-presence.js +1 -1
  344. package/lib/telemetry/cli-command-trace.js +1 -1
  345. package/lib/telemetry/cli-help-trace.js +1 -1
  346. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  347. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  348. package/lib/telemetry/send-cli-trace-log.js +1 -1
  349. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  350. package/lib/utils/ai_config.js +1 -1
  351. package/lib/utils/apply-jq-filter.js +1 -1
  352. package/lib/utils/cdn-config.js +1 -1
  353. package/lib/utils/check-sdk-version.js +1 -1
  354. package/lib/utils/cli-version-check.js +1 -1
  355. package/lib/utils/cli-version-policy.js +1 -1
  356. package/lib/utils/config.js +1 -1
  357. package/lib/utils/entity-with-id.js +1 -1
  358. package/lib/utils/file-utils.js +1 -1
  359. package/lib/utils/guides-cdn.js +1 -1
  360. package/lib/utils/http-client.js +1 -1
  361. package/lib/utils/is-non-interactive.js +1 -1
  362. package/lib/utils/logger.js +1 -1
  363. package/lib/utils/params.js +1 -1
  364. package/lib/utils/platform.js +1 -1
  365. package/lib/utils/sleep.js +1 -1
  366. package/lib/utils/template-replacer.js +1 -1
  367. package/lib/utils/update-notice.js +1 -1
  368. package/lib/utils/version.js +1 -1
  369. package/lib/utils/with-active-cookie.js +1 -1
  370. package/lib/utils/write-cli-side-channel.js +1 -1
  371. package/package.json +1 -1
  372. package/skills/rabetbase/SKILL.md +1 -1
  373. package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
  374. package/skills/rabetbase-page-generation/SKILL.md +1 -1
  375. package/skills/rabetbase.manifest.json +3 -3
@@ -1 +1 @@
1
- const a244_0x39dc7b=a244_0x3c8b;(function(_0x35ebdc,_0x1da223){const _0x32e282=a244_0x3c8b,_0x58ddd7=_0x35ebdc();while(!![]){try{const _0x58c8f5=-parseInt(_0x32e282(0xc2))/0x1+-parseInt(_0x32e282(0xc5))/0x2*(-parseInt(_0x32e282(0xac))/0x3)+parseInt(_0x32e282(0xb7))/0x4*(parseInt(_0x32e282(0xb5))/0x5)+-parseInt(_0x32e282(0xba))/0x6*(-parseInt(_0x32e282(0xbf))/0x7)+-parseInt(_0x32e282(0xc3))/0x8*(parseInt(_0x32e282(0xd2))/0x9)+parseInt(_0x32e282(0xce))/0xa*(parseInt(_0x32e282(0xcf))/0xb)+parseInt(_0x32e282(0xb1))/0xc*(-parseInt(_0x32e282(0xb9))/0xd);if(_0x58c8f5===_0x1da223)break;else _0x58ddd7['push'](_0x58ddd7['shift']());}catch(_0x547993){_0x58ddd7['push'](_0x58ddd7['shift']());}}}(a244_0x5292,0xb86f4));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_0x39dc7b(0xa8),a244_0x39dc7b(0xc7)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;function a244_0x5292(){const _0x11e16f=['App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','createTime','10152MxAvqZ','hex','utf-8','Cannot\x20read\x20app\x20rule\x20file:\x20','from','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','appCode','type','DATABASE.md','app_rule_content_too_large','app_rule_content_invalid','Cannot\x20access\x20app\x20rule\x20file:\x20','database-analysis','rules','size','page-api-development','utf8','62409bhZkZV','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','Pass\x20a\x20UTF-8\x20Markdown\x20file.','byteSize','digest','8254476svLPcE','byteLength','sha256','version','281455ZgqseP','trim','60VLyNeZ','contentHash','13PupEGA','6333258ToGZdy','message','decode','app_rule_file_required','string','7edetvl','str','RULES.md','984429LfwCuW','5200JYDHNn','App\x20rule\x20file\x20is\x20blank:\x20','40DTZSfp','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','database','--file\x20is\x20required.','updateTime','app_rule_file_invalid','app_rule_type_invalid','isFile','content','31180lMBlLR','2981wYqCjx'];a244_0x5292=function(){return _0x11e16f;};return a244_0x5292();}const APP_RULE_FILES={'rules':a244_0x39dc7b(0xc1),'database':a244_0x39dc7b(0xa3)},APP_RULE_CONTEXT_SCOPES={'rules':a244_0x39dc7b(0xaa),'database':a244_0x39dc7b(0xa7)};export function appRuleError(_0x225085,_0x51c74e,_0x3b9289){return new CliError(_0x225085,0x1,_0x51c74e,_0x3b9289);}function a244_0x3c8b(_0xd87fc4,_0x3a1e67){_0xd87fc4=_0xd87fc4-0x9c;const _0x529237=a244_0x5292();let _0x3c8bbe=_0x529237[_0xd87fc4];return _0x3c8bbe;}export function readAppRuleType(_0x43cd67){const _0x108503=a244_0x39dc7b,_0x49139a=_0x43cd67[_0x108503(0xc0)]('type')[_0x108503(0xb6)]()['toLowerCase']();if(_0x49139a!==_0x108503(0xa8)&&_0x49139a!==_0x108503(0xc7))throw appRuleError(_0x108503(0xcb),'--type\x20must\x20be\x20either\x20rules\x20or\x20database.');return _0x49139a;}export function appRuleFileName(_0x20c5eb){return APP_RULE_FILES[_0x20c5eb];}export function appRuleContextScope(_0x341bbd){return APP_RULE_CONTEXT_SCOPES[_0x341bbd];}export function inspectAppRuleContent(_0x4df157){const _0x494f77=a244_0x39dc7b,_0xcc26ec=Buffer[_0x494f77(0x9f)](_0x4df157,_0x494f77(0xab));return{'content':_0x4df157,'byteSize':_0xcc26ec[_0x494f77(0xb2)],'contentHash':'sha256:'+createHash(_0x494f77(0xb3))['update'](_0xcc26ec)[_0x494f77(0xb0)](_0x494f77(0x9c))};}export async function readAppRuleFile(_0x322da2){const _0x555dba=a244_0x39dc7b,_0x2fb1a6=_0x322da2[_0x555dba(0xb6)]();if(!_0x2fb1a6)throw appRuleError(_0x555dba(0xbd),_0x555dba(0xc8),_0x555dba(0xae));const _0x2ec8cc=resolve(_0x2fb1a6);let _0x1ea73c;try{_0x1ea73c=await stat(_0x2ec8cc);}catch(_0x36de3d){throw appRuleError('app_rule_file_unreadable',_0x555dba(0xa6)+_0x2fb1a6,_0x36de3d instanceof Error?_0x36de3d['message']:String(_0x36de3d));}if(!_0x1ea73c[_0x555dba(0xcc)]())throw appRuleError(_0x555dba(0xca),_0x555dba(0xa0)+_0x2fb1a6);if(_0x1ea73c[_0x555dba(0xa9)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x555dba(0xa4),'App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.');let _0x2151ab;try{_0x2151ab=await readFile(_0x2ec8cc);}catch(_0x4d49cf){throw appRuleError('app_rule_file_unreadable',_0x555dba(0x9e)+_0x2fb1a6,_0x4d49cf instanceof Error?_0x4d49cf[_0x555dba(0xbb)]:String(_0x4d49cf));}if(_0x2151ab[_0x555dba(0xb2)]>MAX_APP_RULE_BYTES)throw appRuleError('app_rule_content_too_large',_0x555dba(0xd0));let _0x4115b8;try{_0x4115b8=new TextDecoder(_0x555dba(0x9d),{'fatal':!![],'ignoreBOM':!![]})[_0x555dba(0xbc)](_0x2151ab);}catch{throw appRuleError(_0x555dba(0xa5),_0x555dba(0xc6)+_0x2fb1a6);}if(!_0x4115b8[_0x555dba(0xb6)]())throw appRuleError(_0x555dba(0xa5),_0x555dba(0xc4)+_0x2fb1a6);return inspectAppRuleContent(_0x4115b8);}export function projectAppRule(_0x1ad921,_0x4df02b){const _0x400efa=a244_0x39dc7b;if(!_0x4df02b)return{'type':_0x1ad921,'fileName':appRuleFileName(_0x1ad921),'contextScope':appRuleContextScope(_0x1ad921),'enabled':![]};const _0x323841=inspectAppRuleContent(_0x4df02b[_0x400efa(0xcd)]);return{'type':_0x1ad921,'fileName':appRuleFileName(_0x1ad921),'contextScope':appRuleContextScope(_0x1ad921),'enabled':!![],'id':_0x4df02b['id'],'scope':_0x4df02b['scope'],'appCode':_0x4df02b[_0x400efa(0xa1)],'version':_0x4df02b[_0x400efa(0xb4)],'contentByteSize':_0x323841[_0x400efa(0xaf)],'contentHash':_0x323841[_0x400efa(0xb8)],..._0x4df02b['createTime']!==undefined&&_0x4df02b[_0x400efa(0xd1)]!==null?{'createTime':_0x4df02b['createTime']}:{},..._0x4df02b[_0x400efa(0xc9)]!==undefined&&_0x4df02b['updateTime']!==null?{'updateTime':_0x4df02b[_0x400efa(0xc9)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x39dc7b(0xa2),'type':a244_0x39dc7b(0xbe),'required':!![],'description':a244_0x39dc7b(0xad),'enum':[...APP_RULE_TYPES]};
1
+ const a244_0x445382=a244_0x29b2;(function(_0x5a56dc,_0xe34643){const _0x1706be=a244_0x29b2,_0x48f065=_0x5a56dc();while(!![]){try{const _0x47ef84=parseInt(_0x1706be(0x183))/0x1+parseInt(_0x1706be(0x190))/0x2+-parseInt(_0x1706be(0x1a9))/0x3*(-parseInt(_0x1706be(0x196))/0x4)+parseInt(_0x1706be(0x19d))/0x5+parseInt(_0x1706be(0x19b))/0x6+parseInt(_0x1706be(0x197))/0x7*(parseInt(_0x1706be(0x199))/0x8)+-parseInt(_0x1706be(0x1a7))/0x9*(parseInt(_0x1706be(0x185))/0xa);if(_0x47ef84===_0xe34643)break;else _0x48f065['push'](_0x48f065['shift']());}catch(_0x49e033){_0x48f065['push'](_0x48f065['shift']());}}}(a244_0x39de,0x389be));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_0x445382(0x189),'database'];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a244_0x445382(0x1b0),'database':a244_0x445382(0x193)},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':a244_0x445382(0x19e)};export function appRuleError(_0x5b877b,_0x48e3b9,_0x4aeb25){return new CliError(_0x5b877b,0x1,_0x48e3b9,_0x4aeb25);}export function readAppRuleType(_0x4a68e8){const _0xe95eef=a244_0x445382,_0x20c2e8=_0x4a68e8['str'](_0xe95eef(0x18d))['trim']()['toLowerCase']();if(_0x20c2e8!=='rules'&&_0x20c2e8!==_0xe95eef(0x198))throw appRuleError(_0xe95eef(0x1a6),_0xe95eef(0x18b));return _0x20c2e8;}export function appRuleFileName(_0x590c49){return APP_RULE_FILES[_0x590c49];}export function appRuleContextScope(_0x4ef5aa){return APP_RULE_CONTEXT_SCOPES[_0x4ef5aa];}function a244_0x39de(){const _0x3d2790=['from','1143QhWcsb','decode','Pass\x20a\x20UTF-8\x20Markdown\x20file.','digest','appCode','sha256:','app_rule_content_invalid','RULES.md','message','byteLength','hex','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','contentHash','431057fQkeTD','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','40920BAhdzx','trim','sha256','isFile','rules','app_rule_file_unreadable','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','utf8','type','--file\x20is\x20required.','size','334190nVsdNr','App\x20rule\x20file\x20is\x20blank:\x20','Cannot\x20access\x20app\x20rule\x20file:\x20','DATABASE.md','updateTime','Cannot\x20read\x20app\x20rule\x20file:\x20','788PuzLWe','35ddachf','database','639096mLdGOY','app_rule_content_too_large','1494684zUFjDi','createTime','1159140gsUIZx','database-analysis','scope','app_rule_file_invalid','content','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','update','string','byteSize','app_rule_type_invalid','2907QVGUgy'];a244_0x39de=function(){return _0x3d2790;};return a244_0x39de();}export function inspectAppRuleContent(_0x3e661f){const _0x1ec3a8=a244_0x445382,_0x13900b=Buffer[_0x1ec3a8(0x1a8)](_0x3e661f,_0x1ec3a8(0x18c));return{'content':_0x3e661f,'byteSize':_0x13900b[_0x1ec3a8(0x1b2)],'contentHash':_0x1ec3a8(0x1ae)+createHash(_0x1ec3a8(0x187))[_0x1ec3a8(0x1a3)](_0x13900b)[_0x1ec3a8(0x1ac)](_0x1ec3a8(0x1b3))};}function a244_0x29b2(_0xd9e870,_0xb8806a){_0xd9e870=_0xd9e870-0x181;const _0x39de4a=a244_0x39de();let _0x29b2bd=_0x39de4a[_0xd9e870];return _0x29b2bd;}export async function readAppRuleFile(_0x241b02){const _0x1e66f1=a244_0x445382,_0x5920bb=_0x241b02[_0x1e66f1(0x186)]();if(!_0x5920bb)throw appRuleError('app_rule_file_required',_0x1e66f1(0x18e),_0x1e66f1(0x1ab));const _0x408053=resolve(_0x5920bb);let _0x27c457;try{_0x27c457=await stat(_0x408053);}catch(_0x43a8d1){throw appRuleError(_0x1e66f1(0x18a),_0x1e66f1(0x192)+_0x5920bb,_0x43a8d1 instanceof Error?_0x43a8d1[_0x1e66f1(0x1b1)]:String(_0x43a8d1));}if(!_0x27c457[_0x1e66f1(0x188)]())throw appRuleError(_0x1e66f1(0x1a0),_0x1e66f1(0x181)+_0x5920bb);if(_0x27c457[_0x1e66f1(0x18f)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x1e66f1(0x19a),_0x1e66f1(0x184));let _0xaf3d4a;try{_0xaf3d4a=await readFile(_0x408053);}catch(_0x143b21){throw appRuleError(_0x1e66f1(0x18a),_0x1e66f1(0x195)+_0x5920bb,_0x143b21 instanceof Error?_0x143b21[_0x1e66f1(0x1b1)]:String(_0x143b21));}if(_0xaf3d4a[_0x1e66f1(0x1b2)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x1e66f1(0x19a),_0x1e66f1(0x184));let _0x8346da;try{_0x8346da=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})[_0x1e66f1(0x1aa)](_0xaf3d4a);}catch{throw appRuleError(_0x1e66f1(0x1af),_0x1e66f1(0x1a2)+_0x5920bb);}if(!_0x8346da['trim']())throw appRuleError('app_rule_content_invalid',_0x1e66f1(0x191)+_0x5920bb);return inspectAppRuleContent(_0x8346da);}export function projectAppRule(_0x5ed4c3,_0x354771){const _0x33176a=a244_0x445382;if(!_0x354771)return{'type':_0x5ed4c3,'fileName':appRuleFileName(_0x5ed4c3),'contextScope':appRuleContextScope(_0x5ed4c3),'enabled':![]};const _0x56c3b6=inspectAppRuleContent(_0x354771[_0x33176a(0x1a1)]);return{'type':_0x5ed4c3,'fileName':appRuleFileName(_0x5ed4c3),'contextScope':appRuleContextScope(_0x5ed4c3),'enabled':!![],'id':_0x354771['id'],'scope':_0x354771[_0x33176a(0x19f)],'appCode':_0x354771[_0x33176a(0x1ad)],'version':_0x354771['version'],'contentByteSize':_0x56c3b6[_0x33176a(0x1a5)],'contentHash':_0x56c3b6[_0x33176a(0x182)],..._0x354771['createTime']!==undefined&&_0x354771['createTime']!==null?{'createTime':_0x354771[_0x33176a(0x19c)]}:{},..._0x354771[_0x33176a(0x194)]!==undefined&&_0x354771['updateTime']!==null?{'updateTime':_0x354771[_0x33176a(0x194)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x445382(0x18d),'type':a244_0x445382(0x1a4),'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 +1 @@
1
- const a245_0x3d43cf=a245_0x3a42;(function(_0x524f34,_0x14599c){const _0x52302a=a245_0x3a42,_0x126355=_0x524f34();while(!![]){try{const _0x1a9523=parseInt(_0x52302a(0x1a7))/0x1+parseInt(_0x52302a(0x174))/0x2*(-parseInt(_0x52302a(0x191))/0x3)+parseInt(_0x52302a(0x17f))/0x4*(parseInt(_0x52302a(0x169))/0x5)+-parseInt(_0x52302a(0x183))/0x6+parseInt(_0x52302a(0x195))/0x7*(-parseInt(_0x52302a(0x16f))/0x8)+-parseInt(_0x52302a(0x18f))/0x9*(parseInt(_0x52302a(0x19b))/0xa)+-parseInt(_0x52302a(0x17c))/0xb*(-parseInt(_0x52302a(0x172))/0xc);if(_0x1a9523===_0x14599c)break;else _0x126355['push'](_0x126355['shift']());}catch(_0x304b9d){_0x126355['push'](_0x126355['shift']());}}}(a245_0x1fdb,0xba7bb));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a245_0x3d43cf(0x178),a245_0x3d43cf(0x18a)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a245_0x3d43cf(0x178),a245_0x3d43cf(0x18a),a245_0x3d43cf(0x19e),a245_0x3d43cf(0x16e)]);function a245_0x1fdb(){const _0x5839eb=['dev','\x20run\x20<script>\x0a','utf-8','Enable\x20watch\x20mode\x20for\x20preview','No\x20scripts\x20defined\x20in\x20package.json.','63576mDFkfK','write','795ZtGUVQ','inherit','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','error','25837Sifqxx','log','--watch','close','bun','bun.lock','470GnTsty','pnpm-lock.yaml','.bin','build','changed','join','vite','node_modules','length','Script\x20\x22','package.json','needsUpgrade','101884JBUqwX','args','Domain\x20routing\x20synchronized:\x20','yarn.lock','1907630BAgvZV','push','Available:\x20','(none)','\x20run\x20','preview','592nxlhsz','No\x20package.json\x20found\x20in\x20current\x20directory.','yarn','26184ftzIOv','Run\x20a\x20package.json\x20script','596Zcugmt','cwd','\x20run\x20preview','\x20run\x20preview\x20--watch','start','vite\x20preview\x20exited\x20with\x20code\x20','\x20\x20\x20\x20','watch','8239lFauXW','has','keys','8USTgdp','scripts','run','parse','6307842PYTkMO','path','npm','bun.lockb','validation','belowMinimum','all'];a245_0x1fdb=function(){return _0x5839eb;};return a245_0x1fdb();}export function syncProjectDomainRoutingBeforeScript(_0x5a4734,_0x2ade79){const _0x5e03d7=a245_0x3d43cf;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x5e03d7(0x17d)](_0x2ade79))return null;const _0x5e2458=findProjectRootDirectory(_0x5a4734);if(!resolveConfigPath(_0x5e2458))return null;const _0x21a853=writeProjectDomainRoutingManifest(_0x5e2458);return{'path':_0x21a853[_0x5e03d7(0x184)],'changed':_0x21a853['changed']};}function readPackageScripts(_0x18fdeb){const _0xce9430=a245_0x3d43cf,_0x20f7b0=resolve(_0x18fdeb,_0xce9430(0x1a5));if(!existsSync(_0x20f7b0))return null;try{const _0x5debf4=JSON[_0xce9430(0x182)](readFileSync(_0x20f7b0,_0xce9430(0x18c)));return _0x5debf4[_0xce9430(0x180)]??{};}catch{return null;}}function detectPackageManager(_0x4ae305){const _0x7a22f0=a245_0x3d43cf;if(existsSync(resolve(_0x4ae305,_0x7a22f0(0x186)))||existsSync(resolve(_0x4ae305,_0x7a22f0(0x19a))))return _0x7a22f0(0x199);if(existsSync(resolve(_0x4ae305,_0x7a22f0(0x19c))))return'pnpm';if(existsSync(resolve(_0x4ae305,_0x7a22f0(0x1aa))))return _0x7a22f0(0x171);return _0x7a22f0(0x185);}async function versionCheck(_0x507902){const _0x343dcc=a245_0x3d43cf,_0x41891d=await checkCliVersion();(_0x41891d['needsUpgrade']||_0x41891d[_0x343dcc(0x188)])&&(printCliUpgradeWarning(_0x41891d),assertCliVersionSupported(_0x41891d));const _0x1243a6=await checkSdkVersion(_0x507902);if(_0x1243a6[_0x343dcc(0x1a6)])printSdkUpgradeWarning(_0x1243a6);}function spawnScript(_0x24f52e,_0x6683d3,_0x109d66,_0x164415){return new Promise((_0x4fbf29,_0x3aa532)=>{const _0x3a9bcd=a245_0x3a42,_0x169ad3=[_0x3a9bcd(0x181),_0x6683d3,..._0x109d66],_0x4433c2=spawn(_0x24f52e,_0x169ad3,{'cwd':_0x164415,'stdio':_0x3a9bcd(0x192),'shell':!![],'env':{...process.env,'PATH':''+join(_0x164415,_0x3a9bcd(0x1a2),_0x3a9bcd(0x19d))+delimiter+process.env.PATH}});_0x4433c2['on'](_0x3a9bcd(0x198),_0x1f77f8=>{const _0x56e9bb=_0x3a9bcd;if(_0x1f77f8===0x0||_0x1f77f8===null)_0x4fbf29();else _0x3aa532(new Error(_0x24f52e+_0x56e9bb(0x16d)+_0x6683d3+'\x20exited\x20with\x20code\x20'+_0x1f77f8));}),_0x4433c2['on'](_0x3a9bcd(0x194),_0x3aa532);});}function spawnViteBuildWatch(_0x2a6f7b){return new Promise((_0x2a2476,_0x2893f1)=>{const _0x298a77=a245_0x3a42,_0x1b0431=spawn('vite',[_0x298a77(0x19e),_0x298a77(0x197)],{'cwd':_0x2a6f7b,'stdio':_0x298a77(0x192),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2a6f7b,_0x298a77(0x1a2),_0x298a77(0x19d))+delimiter+process.env.PATH}});_0x1b0431['on'](_0x298a77(0x198),_0x29ace2=>{const _0x2ad84f=_0x298a77;if(_0x29ace2===0x0||_0x29ace2===null)_0x2a2476();else _0x2893f1(new Error(_0x2ad84f(0x193)+_0x29ace2));}),_0x1b0431['on'](_0x298a77(0x194),_0x2893f1);});}function spawnVitePreview(_0x4fdaf5){return new Promise((_0x4f2280,_0x2ca8b8)=>{const _0x1832a7=a245_0x3a42,_0x39d194=spawn(_0x1832a7(0x1a1),[_0x1832a7(0x16e)],{'cwd':_0x4fdaf5,'stdio':_0x1832a7(0x192),'shell':!![],'env':{...process.env,'PATH':''+join(_0x4fdaf5,_0x1832a7(0x1a2),_0x1832a7(0x19d))+delimiter+process.env.PATH}});_0x39d194['on']('close',_0x4abfe6=>{const _0x4035af=_0x1832a7;if(_0x4abfe6===0x0||_0x4abfe6===null)_0x4f2280();else _0x2ca8b8(new Error(_0x4035af(0x179)+_0x4abfe6));}),_0x39d194['on']('error',_0x2ca8b8);});}const runFlags=[{'name':a245_0x3d43cf(0x17b),'type':'boolean','description':a245_0x3d43cf(0x18d),'default':![]}];function a245_0x3a42(_0x508947,_0xefe306){_0x508947=_0x508947-0x169;const _0x1fdb7e=a245_0x1fdb();let _0x3a425b=_0x1fdb7e[_0x508947];return _0x3a425b;}export const runDefinition={'service':a245_0x3d43cf(0x181),'command':a245_0x3d43cf(0x181),'description':a245_0x3d43cf(0x173),'risk':a245_0x3d43cf(0x190),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x581a39=a245_0x3d43cf,_0x3eb9f1=[];return _0x3eb9f1['push']('\x20\x20EXAMPLES'),_0x3eb9f1[_0x581a39(0x16a)](_0x581a39(0x17a)+CLI_BIN_NAME+'\x20run\x20start'),_0x3eb9f1[_0x581a39(0x16a)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20build'),_0x3eb9f1[_0x581a39(0x16a)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x581a39(0x176)),_0x3eb9f1[_0x581a39(0x16a)](_0x581a39(0x17a)+CLI_BIN_NAME+_0x581a39(0x177)),_0x3eb9f1[_0x581a39(0x1a0)]('\x0a');},async 'execute'(_0x2bbbb8){const _0x4ba160=a245_0x3d43cf,_0x10b0dd=process[_0x4ba160(0x175)](),_0xd46026=_0x2bbbb8[_0x4ba160(0x1a8)][0x0],_0x51b6dc=_0x2bbbb8[_0x4ba160(0x1a8)]['slice'](0x1),_0x6240e4=readPackageScripts(_0x10b0dd);if(!_0x6240e4)throw CliErrors[_0x4ba160(0x187)](_0x4ba160(0x170));if(!_0xd46026){const _0x3a22f7=Object['keys'](_0x6240e4);if(_0x3a22f7[_0x4ba160(0x1a3)]===0x0)console[_0x4ba160(0x196)](_0x4ba160(0x18e));else{console[_0x4ba160(0x196)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x306f70 of _0x3a22f7){console[_0x4ba160(0x196)](_0x4ba160(0x17a)+_0x306f70);}console[_0x4ba160(0x196)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+_0x4ba160(0x18b));}return{'ok':!![]};}if(!_0x6240e4[_0xd46026])throw CliErrors['validation'](_0x4ba160(0x1a4)+_0xd46026+'\x22\x20not\x20found\x20in\x20package.json.',_0x4ba160(0x16b)+(Object[_0x4ba160(0x17e)](_0x6240e4)[_0x4ba160(0x1a0)](',\x20')||_0x4ba160(0x16c)));const _0x4db9d6=detectPackageManager(_0x10b0dd),_0x4849e1=syncProjectDomainRoutingBeforeScript(_0x10b0dd,_0xd46026);_0x4849e1?.[_0x4ba160(0x19f)]&&console[_0x4ba160(0x194)](_0x4ba160(0x1a9)+_0x4849e1[_0x4ba160(0x184)]);VERSION_CHECK_SCRIPTS[_0x4ba160(0x17d)](_0xd46026)&&await versionCheck(_0x10b0dd);if(_0xd46026===_0x4ba160(0x16e)&&_0x2bbbb8['bool']('watch'))return await Promise[_0x4ba160(0x189)]([spawnViteBuildWatch(_0x10b0dd),spawnVitePreview(_0x10b0dd)]),{'ok':!![]};return await spawnScript(_0x4db9d6,_0xd46026,_0x51b6dc,_0x10b0dd),{'ok':!![]};}};
1
+ const a245_0x3bd918=a245_0x2bae;(function(_0x24841f,_0x1a6e56){const _0x5666de=a245_0x2bae,_0x348925=_0x24841f();while(!![]){try{const _0x2d83df=parseInt(_0x5666de(0x140))/0x1*(parseInt(_0x5666de(0x13b))/0x2)+parseInt(_0x5666de(0x114))/0x3+-parseInt(_0x5666de(0x13d))/0x4+-parseInt(_0x5666de(0x11d))/0x5*(parseInt(_0x5666de(0x109))/0x6)+-parseInt(_0x5666de(0x10c))/0x7+parseInt(_0x5666de(0x146))/0x8*(parseInt(_0x5666de(0x131))/0x9)+parseInt(_0x5666de(0x134))/0xa;if(_0x2d83df===_0x1a6e56)break;else _0x348925['push'](_0x348925['shift']());}catch(_0x512551){_0x348925['push'](_0x348925['shift']());}}}(a245_0x32c0,0x3613f));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a245_0x3bd918(0x10e),a245_0x3bd918(0x11e)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set(['start',a245_0x3bd918(0x11e),a245_0x3bd918(0x149),a245_0x3bd918(0x126)]);export function syncProjectDomainRoutingBeforeScript(_0x188f55,_0x270e27){const _0x36e918=a245_0x3bd918;if(!DOMAIN_ROUTING_SYNC_SCRIPTS['has'](_0x270e27))return null;const _0x59e9b6=findProjectRootDirectory(_0x188f55);if(!resolveConfigPath(_0x59e9b6))return null;const _0x5b77d0=writeProjectDomainRoutingManifest(_0x59e9b6);return{'path':_0x5b77d0[_0x36e918(0x10a)],'changed':_0x5b77d0['changed']};}function readPackageScripts(_0x4e37c6){const _0x5a865b=a245_0x3bd918,_0x5a9acb=resolve(_0x4e37c6,_0x5a865b(0x133));if(!existsSync(_0x5a9acb))return null;try{const _0x44f533=JSON[_0x5a865b(0x115)](readFileSync(_0x5a9acb,_0x5a865b(0x120)));return _0x44f533['scripts']??{};}catch{return null;}}function detectPackageManager(_0x5a4cf7){const _0x398350=a245_0x3bd918;if(existsSync(resolve(_0x5a4cf7,_0x398350(0x136)))||existsSync(resolve(_0x5a4cf7,'bun.lock')))return _0x398350(0x13a);if(existsSync(resolve(_0x5a4cf7,_0x398350(0x12a))))return _0x398350(0x128);if(existsSync(resolve(_0x5a4cf7,'yarn.lock')))return'yarn';return _0x398350(0x130);}function a245_0x32c0(){const _0x2f0600=['bun.lockb','run','--watch','Domain\x20routing\x20synchronized:\x20','bun','2AdSqzb','Script\x20name\x20defined\x20in\x20package.json','516156ORPKda','error','\x20run\x20preview\x20--watch','137033mJxRjV','watch','Script\x20\x22','args','\x20run\x20start','close','48miLOvG','\x20run\x20','\x0a\x20\x20Usage:\x20','build','10902cvRmHN','path','\x20exited\x20with\x20code\x20','2038778GiqbaH','push','start','belowMinimum','\x22\x20not\x20found\x20in\x20package.json.','\x0a\x20\x20Available\x20scripts:\x0a','No\x20package.json\x20found\x20in\x20current\x20directory.','script','398862jVLnfE','parse','vite\x20preview\x20exited\x20with\x20code\x20','needsUpgrade','changed','\x20\x20EXAMPLES','Run\x20a\x20package.json\x20script','Available:\x20','\x20run\x20build','965bBhMtL','dev','\x20run\x20preview','utf-8','log','inherit','has','No\x20scripts\x20defined\x20in\x20package.json.','\x20\x20\x20\x20','preview','join','pnpm','slice','pnpm-lock.yaml','all','keys','node_modules','vite','validation','npm','627957XRCZoF','\x20run\x20<script>\x0a','package.json','3038520BWGEqM','vite\x20build\x20--watch\x20exited\x20with\x20code\x20'];a245_0x32c0=function(){return _0x2f0600;};return a245_0x32c0();}async function versionCheck(_0x53980f){const _0x1c9348=a245_0x3bd918,_0x5538b8=await checkCliVersion();(_0x5538b8[_0x1c9348(0x117)]||_0x5538b8[_0x1c9348(0x10f)])&&(printCliUpgradeWarning(_0x5538b8),assertCliVersionSupported(_0x5538b8));const _0x4360cb=await checkSdkVersion(_0x53980f);if(_0x4360cb[_0x1c9348(0x117)])printSdkUpgradeWarning(_0x4360cb);}function a245_0x2bae(_0x165529,_0x3e9084){_0x165529=_0x165529-0x109;const _0x32c08=a245_0x32c0();let _0x2baeda=_0x32c08[_0x165529];return _0x2baeda;}function spawnScript(_0x5a0080,_0x35f376,_0x429d9e,_0x327cde){return new Promise((_0x293f60,_0x3c9720)=>{const _0x4b3ee6=a245_0x2bae,_0x2fee5f=[_0x4b3ee6(0x137),_0x35f376,..._0x429d9e],_0x362f95=spawn(_0x5a0080,_0x2fee5f,{'cwd':_0x327cde,'stdio':_0x4b3ee6(0x122),'shell':!![],'env':{...process.env,'PATH':''+join(_0x327cde,_0x4b3ee6(0x12d),'.bin')+delimiter+process.env.PATH}});_0x362f95['on'](_0x4b3ee6(0x145),_0x500da7=>{const _0x457aa5=_0x4b3ee6;if(_0x500da7===0x0||_0x500da7===null)_0x293f60();else _0x3c9720(new Error(_0x5a0080+_0x457aa5(0x147)+_0x35f376+_0x457aa5(0x10b)+_0x500da7));}),_0x362f95['on'](_0x4b3ee6(0x13e),_0x3c9720);});}function spawnViteBuildWatch(_0x4ac8a5){return new Promise((_0x29077f,_0xa83967)=>{const _0x1a5633=a245_0x2bae,_0x404a8a=spawn(_0x1a5633(0x12e),['build',_0x1a5633(0x138)],{'cwd':_0x4ac8a5,'stdio':_0x1a5633(0x122),'shell':!![],'env':{...process.env,'PATH':''+join(_0x4ac8a5,'node_modules','.bin')+delimiter+process.env.PATH}});_0x404a8a['on'](_0x1a5633(0x145),_0x1813fc=>{const _0x2fad92=_0x1a5633;if(_0x1813fc===0x0||_0x1813fc===null)_0x29077f();else _0xa83967(new Error(_0x2fad92(0x135)+_0x1813fc));}),_0x404a8a['on'](_0x1a5633(0x13e),_0xa83967);});}function spawnVitePreview(_0x4b70d3){return new Promise((_0x5ba26b,_0x3a7ea9)=>{const _0x560eb3=a245_0x2bae,_0x6e2634=spawn(_0x560eb3(0x12e),[_0x560eb3(0x126)],{'cwd':_0x4b70d3,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x4b70d3,_0x560eb3(0x12d),'.bin')+delimiter+process.env.PATH}});_0x6e2634['on']('close',_0x217dc3=>{const _0xa66bad=_0x560eb3;if(_0x217dc3===0x0||_0x217dc3===null)_0x5ba26b();else _0x3a7ea9(new Error(_0xa66bad(0x116)+_0x217dc3));}),_0x6e2634['on'](_0x560eb3(0x13e),_0x3a7ea9);});}const runFlags=[{'name':a245_0x3bd918(0x141),'type':'boolean','description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':'run','command':'run','description':a245_0x3bd918(0x11a),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a245_0x3bd918(0x113),'description':a245_0x3bd918(0x13c),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x1e5471=a245_0x3bd918,_0x14e726=[];return _0x14e726[_0x1e5471(0x10d)](_0x1e5471(0x119)),_0x14e726['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x1e5471(0x144)),_0x14e726[_0x1e5471(0x10d)](_0x1e5471(0x125)+CLI_BIN_NAME+_0x1e5471(0x11c)),_0x14e726[_0x1e5471(0x10d)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x1e5471(0x11f)),_0x14e726['push'](_0x1e5471(0x125)+CLI_BIN_NAME+_0x1e5471(0x13f)),_0x14e726[_0x1e5471(0x127)]('\x0a');},async 'execute'(_0x13ad01){const _0x59723b=a245_0x3bd918,_0x37c66a=process['cwd'](),_0x434d68=_0x13ad01[_0x59723b(0x143)][0x0],_0x254458=_0x13ad01['args'][_0x59723b(0x129)](0x1),_0x60482c=readPackageScripts(_0x37c66a);if(!_0x60482c)throw CliErrors[_0x59723b(0x12f)](_0x59723b(0x112));if(!_0x434d68){const _0x4004d2=Object[_0x59723b(0x12c)](_0x60482c);if(_0x4004d2['length']===0x0)console[_0x59723b(0x121)](_0x59723b(0x124));else{console[_0x59723b(0x121)](_0x59723b(0x111));for(const _0x49a773 of _0x4004d2){console['log'](_0x59723b(0x125)+_0x49a773);}console['log'](_0x59723b(0x148)+CLI_BIN_NAME+_0x59723b(0x132));}return{'ok':!![]};}if(!_0x60482c[_0x434d68])throw CliErrors['validation'](_0x59723b(0x142)+_0x434d68+_0x59723b(0x110),_0x59723b(0x11b)+(Object[_0x59723b(0x12c)](_0x60482c)[_0x59723b(0x127)](',\x20')||'(none)'));const _0x28babe=detectPackageManager(_0x37c66a),_0x437d0d=syncProjectDomainRoutingBeforeScript(_0x37c66a,_0x434d68);_0x437d0d?.[_0x59723b(0x118)]&&console[_0x59723b(0x13e)](_0x59723b(0x139)+_0x437d0d[_0x59723b(0x10a)]);VERSION_CHECK_SCRIPTS[_0x59723b(0x123)](_0x434d68)&&await versionCheck(_0x37c66a);if(_0x434d68==='preview'&&_0x13ad01['bool'](_0x59723b(0x141)))return await Promise[_0x59723b(0x12b)]([spawnViteBuildWatch(_0x37c66a),spawnVitePreview(_0x37c66a)]),{'ok':!![]};return await spawnScript(_0x28babe,_0x434d68,_0x254458,_0x37c66a),{'ok':!![]};}};
@@ -1 +1 @@
1
- function a246_0x4fd6(_0x49a26c,_0x4473df){_0x49a26c=_0x49a26c-0xc4;const _0x3fc841=a246_0x3fc8();let _0x4fd6e0=_0x3fc841[_0x49a26c];return _0x4fd6e0;}const a246_0x33df0a=a246_0x4fd6;function a246_0x3fc8(){const _0x3c524e=['schema','read','export','476SzGpoD','1JiwCpc','756132Wmmfni','87219HMocyx','377298ZxIunl','421760oHQrPa','15824yGVMPa','Export\x20machine-readable\x20command\x20schema\x20(JSON)','119666lNByEN','507612DNJEVe'];a246_0x3fc8=function(){return _0x3c524e;};return a246_0x3fc8();}(function(_0x2bc0e5,_0x39c2aa){const _0x2eda6c=a246_0x4fd6,_0x9a11d2=_0x2bc0e5();while(!![]){try{const _0x1354e9=parseInt(_0x2eda6c(0xcd))/0x1*(parseInt(_0x2eda6c(0xc7))/0x2)+parseInt(_0x2eda6c(0xcf))/0x3+parseInt(_0x2eda6c(0xce))/0x4+parseInt(_0x2eda6c(0xc4))/0x5+-parseInt(_0x2eda6c(0xc8))/0x6+-parseInt(_0x2eda6c(0xcc))/0x7*(parseInt(_0x2eda6c(0xc5))/0x8)+-parseInt(_0x2eda6c(0xd0))/0x9;if(_0x1354e9===_0x39c2aa)break;else _0x9a11d2['push'](_0x9a11d2['shift']());}catch(_0x24c4e7){_0x9a11d2['push'](_0x9a11d2['shift']());}}}(a246_0x3fc8,0x18b8f));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x5635dd){const _0x4b30e6=await buildSchemaPayload();return{'ok':!![],'data':_0x4b30e6};}export const schemaDefinition={'service':a246_0x33df0a(0xc9),'command':a246_0x33df0a(0xcb),'description':a246_0x33df0a(0xc6),'risk':a246_0x33df0a(0xca),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
1
+ function a246_0x5029(){const _0x3645c7=['20221900KqFFhR','read','6rZNgTQ','99985uZJvTP','867944RBbACt','188ICqjMJ','export','schema','821668ysPuRS','3314794IkCvFD','9iYrWlc','1247118mEmpVU','11DHqRaS','Export\x20machine-readable\x20command\x20schema\x20(JSON)','304311qLeuYN'];a246_0x5029=function(){return _0x3645c7;};return a246_0x5029();}const a246_0x42a19a=a246_0x2c8f;function a246_0x2c8f(_0x581af6,_0x375f75){_0x581af6=_0x581af6-0x70;const _0x502997=a246_0x5029();let _0x2c8ff2=_0x502997[_0x581af6];return _0x2c8ff2;}(function(_0x843805,_0x57cca9){const _0x23692c=a246_0x2c8f,_0x3dca10=_0x843805();while(!![]){try{const _0x3b6407=parseInt(_0x23692c(0x73))/0x1+-parseInt(_0x23692c(0x7c))/0x2*(parseInt(_0x23692c(0x76))/0x3)+-parseInt(_0x23692c(0x79))/0x4*(parseInt(_0x23692c(0x77))/0x5)+-parseInt(_0x23692c(0x70))/0x6+parseInt(_0x23692c(0x7d))/0x7+-parseInt(_0x23692c(0x78))/0x8*(parseInt(_0x23692c(0x7e))/0x9)+-parseInt(_0x23692c(0x74))/0xa*(-parseInt(_0x23692c(0x71))/0xb);if(_0x3b6407===_0x57cca9)break;else _0x3dca10['push'](_0x3dca10['shift']());}catch(_0x5dc12a){_0x3dca10['push'](_0x3dca10['shift']());}}}(a246_0x5029,0xb04fa));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x4fbfc8){const _0x2fafab=await buildSchemaPayload();return{'ok':!![],'data':_0x2fafab};}export const schemaDefinition={'service':a246_0x42a19a(0x7b),'command':a246_0x42a19a(0x7a),'description':a246_0x42a19a(0x72),'risk':a246_0x42a19a(0x75),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a247_0x42abe5=a247_0x3a28;(function(_0x141233,_0x27231c){const _0x52ffff=a247_0x3a28,_0x40aa71=_0x141233();while(!![]){try{const _0xfb596f=parseInt(_0x52ffff(0xb3))/0x1*(parseInt(_0x52ffff(0x99))/0x2)+-parseInt(_0x52ffff(0xbf))/0x3+-parseInt(_0x52ffff(0xc4))/0x4+parseInt(_0x52ffff(0xda))/0x5+parseInt(_0x52ffff(0x98))/0x6*(-parseInt(_0x52ffff(0xc9))/0x7)+-parseInt(_0x52ffff(0xd0))/0x8*(parseInt(_0x52ffff(0xba))/0x9)+parseInt(_0x52ffff(0xae))/0xa;if(_0xfb596f===_0x27231c)break;else _0x40aa71['push'](_0x40aa71['shift']());}catch(_0xc3a2e2){_0x40aa71['push'](_0x40aa71['shift']());}}}(a247_0x5b29,0x992f5));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 generateSqlTemplate(_0x123170){const _0x351872=a247_0x3a28;if(_0x123170==='mybatisXml')return[_0x351872(0xbc),_0x351872(0xdc),_0x351872(0xab),''][_0x351872(0xbe)]('\x0a');return[_0x351872(0xbb),''][_0x351872(0xbe)]('\x0a');}export const sqlCreate={'service':'sql','command':a247_0x42abe5(0xa4),'description':a247_0x42abe5(0xd6),'risk':a247_0x42abe5(0xb6),'flags':[{'name':a247_0x42abe5(0xcc),'type':'string','description':'SQL\x20query\x20display\x20name'},{'name':'db-id','type':a247_0x42abe5(0xd5),'description':'Target\x20database\x20ID'},{'name':a247_0x42abe5(0xca),'type':a247_0x42abe5(0xcb),'enum':['sql',a247_0x42abe5(0xa5)],'description':a247_0x42abe5(0xa0)}],async 'validate'(_0x2e237f){const _0x4c9f7a=a247_0x42abe5;if(!_0x2e237f[_0x4c9f7a(0x9f)])return;if(!_0x2e237f[_0x4c9f7a(0xb4)](_0x4c9f7a(0xcc))['trim']())throw CliErrors['flagMissing'](_0x4c9f7a(0xcc),_0x4c9f7a(0xdb));const _0x104914=resolveProvidedDbId(_0x2e237f);if(typeof _0x104914!=='number'||!Number[_0x4c9f7a(0xa1)](_0x104914)||_0x104914<=0x0)throw CliErrors[_0x4c9f7a(0xa8)](_0x4c9f7a(0xb0),_0x4c9f7a(0xd2));if(!_0x2e237f['str']('mode')['trim']())throw CliErrors['flagMissing'](_0x4c9f7a(0xca),_0x4c9f7a(0xd9));},async 'dryRun'(_0x3935bf){const _0x4965c8=a247_0x42abe5,_0x106f97=loadSqlProjectConfig(_0x3935bf[_0x4965c8(0xa6)]),{sqlName:_0x5e9a45,dbId:_0x3c45a8,dbName:_0x45e1ac,mode:_0xd7c730}=await resolveSqlNewInputs(_0x3935bf),_0x5ca3d8=buildSqlRelativePath(_0x4965c8(0x9a),_0x5e9a45,_0x45e1ac,_0xd7c730,_0x3c45a8),_0x814565=_0x106f97['sqlRootDir']+'/'+_0x5ca3d8;return{'method':_0x4965c8(0xd4),'url':_0x4965c8(0xaf),'body':{'appCode':_0x3935bf[_0x4965c8(0xa6)],'sqlName':_0x5e9a45,'dbId':_0x3c45a8,'mode':_0xd7c730,'localPath':_0x814565},'description':_0x4965c8(0xb9)+_0x106f97[_0x4965c8(0xb7)]};},async 'execute'(_0x21b42a){const _0x5b2b1c=a247_0x42abe5,_0x4088fa=loadSqlProjectConfig(_0x21b42a[_0x5b2b1c(0xa6)]),{sqlName:_0x322b3a,dbId:_0x36f515,dbName:_0x1b41bd,mode:_0x3a6fc6}=await resolveSqlNewInputs(_0x21b42a),_0x2a68c0=generateSqlTemplate(_0x3a6fc6),_0x27c501=await createSqlQuery({'appCode':_0x21b42a[_0x5b2b1c(0xa6)],'sqlName':_0x322b3a,'dbId':_0x36f515,'sqlContent':_0x2a68c0}),_0x3ddaa2=ensureRemoteSqlContent(_0x27c501),_0x552dd0=_0x1b41bd||await getDbName(_0x21b42a[_0x5b2b1c(0xa6)],_0x36f515)[_0x5b2b1c(0x9c)](()=>undefined),_0x176834=buildSqlRelativePath(_0x27c501[_0x5b2b1c(0xad)],_0x27c501[_0x5b2b1c(0xa2)],_0x552dd0,_0x3a6fc6,_0x36f515),_0x809c0c=_0x4088fa[_0x5b2b1c(0xb7)]+'/'+_0x176834,_0x5dbe62=buildLocalSqlFileContent({'sqlCode':_0x27c501[_0x5b2b1c(0xad)],'sqlName':_0x27c501[_0x5b2b1c(0xa2)],'dbId':_0x27c501['dbId']},_0x3ddaa2,{'dbName':_0x552dd0,'mode':_0x3a6fc6,'syncedAt':new Date()[_0x5b2b1c(0xc7)](),'description':_0x27c501[_0x5b2b1c(0xc3)]});if(await fileExists(_0x809c0c))throw CliErrors[_0x5b2b1c(0xb8)](_0x5b2b1c(0xaa)+_0x809c0c);await ensureParentDirectory(_0x809c0c),await writeFile(_0x809c0c,_0x5dbe62,_0x5b2b1c(0xcf));const _0xddd362=await readSqlLockFile(_0x4088fa['lockFilePath']),{lockData:_0x4c1507,appLock:_0x211888}=ensureSqlLockScope(_0xddd362??createEmptySqlLock(),_0x4088fa[_0x5b2b1c(0xa6)],_0x4088fa['sqlRoot'],_0x5b2b1c(0xd8));return _0x211888['sqls'][_0x27c501['sqlCode']]={...buildSqlLockEntry(_0x27c501,_0x3ddaa2,computeSqlContentHash(_0x5dbe62),{'dbName':_0x552dd0}),'path':_0x176834,'mode':_0x3a6fc6},_0x211888[_0x5b2b1c(0xc2)]=new Date()[_0x5b2b1c(0xc7)](),await writeSqlLockFile(_0x4088fa[_0x5b2b1c(0xc8)],_0x4c1507),{'ok':!![],'data':{'id':_0x27c501['id'],'sqlCode':_0x27c501['sqlCode'],'sqlName':_0x27c501[_0x5b2b1c(0xa2)],'dbId':_0x27c501[_0x5b2b1c(0xac)],'path':_0x809c0c,'mode':_0x3a6fc6},'message':_0x5b2b1c(0x9e)+_0x27c501[_0x5b2b1c(0xad)]};}};function a247_0x3a28(_0xaf427c,_0x1e584c){_0xaf427c=_0xaf427c-0x95;const _0x5b29bc=a247_0x5b29();let _0x3a283b=_0x5b29bc[_0xaf427c];return _0x3a283b;}function a247_0x5b29(){const _0x54fe2f=['For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','Created\x20SQL\x20query\x20','nonInteractive','Local\x20SQL\x20file\x20mode','isFinite','sqlName','SQL\x20name:','create','mybatisXml','appCode','Target\x20database\x20dbId:','flagMissing','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','File\x20already\x20exists:\x20','</select>','dbId','sqlCode','8992700cVoxza','/smartapi/custom/saveUserCustomSql','db-id','Select\x20the\x20target\x20database:','length','6HsieVn','str','parse','write','sqlRootDir','validation','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','3294xrQygs','SELECT\x201\x20AS\x20id;','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','flag','join','1904820YagBhx','dbName','✎\x20Enter\x20dbId\x20manually','lastSync','description','478244ZqWVuM','sql','isInteger','toISOString','lockFilePath','154119GDfTjF','mode','string','name','dbId\x20must\x20be\x20a\x20positive\x20integer','trim','utf8','10208CFbRcf','__manual__','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','MyBatis\x20XML\x20(mybatisXml)','POST','number','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Invalid\x20database\x20selection\x20payload:\x20','new','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','1804470eZYRdO','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','\x20\x20SELECT\x201\x20AS\x20id','dbId\x20cannot\x20be\x20empty','SQL\x20name\x20cannot\x20be\x20empty','map','180HcgjCq','416436nvVQJM','<server-generated-sqlCode>','Select\x20the\x20local\x20SQL\x20mode:','catch'];a247_0x5b29=function(){return _0x54fe2f;};return a247_0x5b29();}async function resolveSqlNewInputs(_0x477db1){const _0xc6e290=await resolveSqlNameInput(_0x477db1),{dbId:_0x235da4,dbName:_0x25b2d0}=await resolveDbSelection(_0x477db1),_0x3539c7=await resolveSqlModeInput(_0x477db1);return{'sqlName':_0xc6e290,'dbId':_0x235da4,'dbName':_0x25b2d0,'mode':_0x3539c7};}async function resolveSqlNameInput(_0x7e3fad){const _0x1c9cc2=a247_0x42abe5,_0x2c64e8=_0x7e3fad[_0x1c9cc2(0xb4)](_0x1c9cc2(0xcc))[_0x1c9cc2(0xce)]();if(_0x2c64e8)return _0x2c64e8;if(_0x7e3fad[_0x1c9cc2(0x9f)])throw CliErrors[_0x1c9cc2(0xa8)](_0x1c9cc2(0xcc),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x1c9cc2(0xa3),'validate':_0x1ad88f=>_0x1ad88f[_0x1c9cc2(0xce)]()?!![]:_0x1c9cc2(0x96)}))[_0x1c9cc2(0xce)]();}async function resolveDbSelection(_0x18fa5b){const _0x5e49f3=a247_0x42abe5,_0x4c361a=resolveProvidedDbId(_0x18fa5b);if(typeof _0x4c361a==='number'&&Number[_0x5e49f3(0xa1)](_0x4c361a)&&_0x4c361a>0x0)return{'dbId':_0x4c361a,'dbName':await getDbName(_0x18fa5b[_0x5e49f3(0xa6)],_0x4c361a)['catch'](()=>undefined)};if(_0x18fa5b[_0x5e49f3(0x9f)])throw CliErrors[_0x5e49f3(0xa8)](_0x5e49f3(0xb0),_0x5e49f3(0xd2));const _0x2c3938=await listDatabases(_0x18fa5b[_0x5e49f3(0xa6)])[_0x5e49f3(0x9c)](()=>[]);if(_0x2c3938[_0x5e49f3(0xb2)]===0x1)return{'dbId':_0x2c3938[0x0][_0x5e49f3(0xac)],'dbName':_0x2c3938[0x0][_0x5e49f3(0xc0)]};if(_0x2c3938['length']>0x1){const _0xa9d820=await select({'message':_0x5e49f3(0xb1),'choices':[..._0x2c3938[_0x5e49f3(0x97)](_0x56b973=>({'name':_0x56b973['dbName']+'\x20('+_0x56b973[_0x5e49f3(0xac)]+')','value':serializeDbSelection(_0x56b973)})),{'name':_0x5e49f3(0xc1),'value':'__manual__'}]});if(_0xa9d820!==_0x5e49f3(0xd1))return deserializeDbSelection(_0xa9d820);}const _0x249455=await input({'message':_0x5e49f3(0xa7),'validate':_0x228c33=>{const _0x46ba7d=_0x5e49f3,_0x250973=_0x228c33[_0x46ba7d(0xce)]();if(!_0x250973)return _0x46ba7d(0x95);const _0x3cf7e9=Number(_0x250973);if(!Number[_0x46ba7d(0xc6)](_0x3cf7e9)||_0x3cf7e9<=0x0)return _0x46ba7d(0xcd);return!![];}});return{'dbId':Number(_0x249455['trim']())};}async function resolveSqlModeInput(_0x1e3455){const _0x521f80=a247_0x42abe5,_0x14c0ca=_0x1e3455['str'](_0x521f80(0xca))[_0x521f80(0xce)]();if(_0x14c0ca===_0x521f80(0xc5)||_0x14c0ca===_0x521f80(0xa5))return _0x14c0ca;if(_0x1e3455[_0x521f80(0x9f)])throw CliErrors[_0x521f80(0xa8)](_0x521f80(0xca),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x521f80(0x9b),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':_0x521f80(0xc5),'description':_0x521f80(0x9d)},{'name':_0x521f80(0xd3),'value':_0x521f80(0xa5),'description':_0x521f80(0xa9)}]});}function serializeDbSelection(_0x5a02a4){const _0x178eb6=a247_0x42abe5;return JSON['stringify']({'dbId':_0x5a02a4[_0x178eb6(0xac)],'dbName':_0x5a02a4[_0x178eb6(0xc0)]});}function deserializeDbSelection(_0x3da69e){const _0x23e02d=a247_0x42abe5;try{const _0x26806e=JSON[_0x23e02d(0xb5)](_0x3da69e);if(typeof _0x26806e['dbId']===_0x23e02d(0xd5)&&Number['isFinite'](_0x26806e[_0x23e02d(0xac)]))return{'dbId':_0x26806e[_0x23e02d(0xac)],'dbName':_0x26806e[_0x23e02d(0xc0)]};}catch{}throw CliErrors[_0x23e02d(0xb8)](_0x23e02d(0xd7)+_0x3da69e);}function resolveProvidedDbId(_0x41619f){const _0x5474d2=a247_0x42abe5,_0x2e83fa=_0x41619f[_0x5474d2(0xbd)](_0x5474d2(0xb0));if(typeof _0x2e83fa===_0x5474d2(0xd5)&&Number[_0x5474d2(0xa1)](_0x2e83fa))return _0x2e83fa;return undefined;}
1
+ const a247_0x4f9cfe=a247_0x3960;(function(_0x223618,_0x47d4f4){const _0x59d42d=a247_0x3960,_0x51f883=_0x223618();while(!![]){try{const _0x2c29a5=-parseInt(_0x59d42d(0xa3))/0x1*(parseInt(_0x59d42d(0x79))/0x2)+-parseInt(_0x59d42d(0x8e))/0x3*(parseInt(_0x59d42d(0x85))/0x4)+-parseInt(_0x59d42d(0xb6))/0x5+parseInt(_0x59d42d(0xb1))/0x6+-parseInt(_0x59d42d(0x88))/0x7*(parseInt(_0x59d42d(0x8f))/0x8)+parseInt(_0x59d42d(0x80))/0x9*(parseInt(_0x59d42d(0x8a))/0xa)+parseInt(_0x59d42d(0x93))/0xb;if(_0x2c29a5===_0x47d4f4)break;else _0x51f883['push'](_0x51f883['shift']());}catch(_0x3c4725){_0x51f883['push'](_0x51f883['shift']());}}}(a247_0x5d99,0xa0d98));import{writeFile}from'node:fs/promises';function a247_0x5d99(){const _0x1e0355=['db-id','lockFilePath','validation','isFinite','Local\x20SQL\x20file\x20mode','sql','7271fdCLJF','create','toISOString','SELECT\x201\x20AS\x20id;','number','MyBatis\x20XML\x20(mybatisXml)','<server-generated-sqlCode>','dbName','File\x20already\x20exists:\x20','__manual__','flag','sqlRootDir','name','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','2596632zFpuLO','dbId','Target\x20database\x20ID','parse','sqlName','1708670ojChNs','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlCode','dbId\x20cannot\x20be\x20empty','lastSync','222EcYvvp','trim','isInteger','</select>','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','new','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','37953zxqgHX','str','catch','flagMissing','string','1096yvRsTf','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','Select\x20the\x20local\x20SQL\x20mode:','7YkWblg','SQL\x20name:','2830BbPbii','nonInteractive','mybatisXml','length','2067GfVrpx','2179344KMYeSG','sqlRoot','Select\x20the\x20target\x20database:','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','7069436hOioVh','Created\x20SQL\x20query\x20','write','sqls','appCode','mode','join','description','SQL\x20query\x20display\x20name','POST'];a247_0x5d99=function(){return _0x1e0355;};return a247_0x5d99();}import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x34e9a9){const _0x35b590=a247_0x3960;if(_0x34e9a9===_0x35b590(0x8c))return[_0x35b590(0xb0),'\x20\x20SELECT\x201\x20AS\x20id',_0x35b590(0x7c),''][_0x35b590(0x99)]('\x0a');return[_0x35b590(0xa6),''][_0x35b590(0x99)]('\x0a');}export const sqlCreate={'service':a247_0x4f9cfe(0xa2),'command':a247_0x4f9cfe(0xa4),'description':a247_0x4f9cfe(0x7d),'risk':a247_0x4f9cfe(0x95),'flags':[{'name':a247_0x4f9cfe(0xaf),'type':a247_0x4f9cfe(0x84),'description':a247_0x4f9cfe(0x9b)},{'name':a247_0x4f9cfe(0x9d),'type':a247_0x4f9cfe(0xa7),'description':a247_0x4f9cfe(0xb3)},{'name':'mode','type':a247_0x4f9cfe(0x84),'enum':[a247_0x4f9cfe(0xa2),a247_0x4f9cfe(0x8c)],'description':a247_0x4f9cfe(0xa1)}],async 'validate'(_0x2a5970){const _0x2b0a56=a247_0x4f9cfe;if(!_0x2a5970[_0x2b0a56(0x8b)])return;if(!_0x2a5970[_0x2b0a56(0x81)]('name')[_0x2b0a56(0x7a)]())throw CliErrors[_0x2b0a56(0x83)](_0x2b0a56(0xaf),_0x2b0a56(0x86));const _0x189ebb=resolveProvidedDbId(_0x2a5970);if(typeof _0x189ebb!=='number'||!Number['isFinite'](_0x189ebb)||_0x189ebb<=0x0)throw CliErrors[_0x2b0a56(0x83)]('db-id',_0x2b0a56(0xb7));if(!_0x2a5970[_0x2b0a56(0x81)](_0x2b0a56(0x98))[_0x2b0a56(0x7a)]())throw CliErrors[_0x2b0a56(0x83)](_0x2b0a56(0x98),_0x2b0a56(0x92));},async 'dryRun'(_0x13394f){const _0x18f095=a247_0x4f9cfe,_0x331dc4=loadSqlProjectConfig(_0x13394f[_0x18f095(0x97)]),{sqlName:_0x845ddb,dbId:_0x294e25,dbName:_0x543bc0,mode:_0x55332a}=await resolveSqlNewInputs(_0x13394f),_0x38712b=buildSqlRelativePath(_0x18f095(0xa9),_0x845ddb,_0x543bc0,_0x55332a,_0x294e25),_0x5e5673=_0x331dc4[_0x18f095(0xae)]+'/'+_0x38712b;return{'method':_0x18f095(0x9c),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x13394f['appCode'],'sqlName':_0x845ddb,'dbId':_0x294e25,'mode':_0x55332a,'localPath':_0x5e5673},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x331dc4[_0x18f095(0xae)]};},async 'execute'(_0x361629){const _0x3b0ae2=a247_0x4f9cfe,_0x1eb171=loadSqlProjectConfig(_0x361629[_0x3b0ae2(0x97)]),{sqlName:_0x355fe4,dbId:_0x2905a8,dbName:_0x55c954,mode:_0x2afbcc}=await resolveSqlNewInputs(_0x361629),_0x4087e4=generateSqlTemplate(_0x2afbcc),_0x38fead=await createSqlQuery({'appCode':_0x361629[_0x3b0ae2(0x97)],'sqlName':_0x355fe4,'dbId':_0x2905a8,'sqlContent':_0x4087e4}),_0x3dee2f=ensureRemoteSqlContent(_0x38fead),_0x5c9ae2=_0x55c954||await getDbName(_0x361629[_0x3b0ae2(0x97)],_0x2905a8)['catch'](()=>undefined),_0x5d8d06=buildSqlRelativePath(_0x38fead[_0x3b0ae2(0xb8)],_0x38fead['sqlName'],_0x5c9ae2,_0x2afbcc,_0x2905a8),_0x231171=_0x1eb171['sqlRootDir']+'/'+_0x5d8d06,_0x59262d=buildLocalSqlFileContent({'sqlCode':_0x38fead[_0x3b0ae2(0xb8)],'sqlName':_0x38fead[_0x3b0ae2(0xb5)],'dbId':_0x38fead['dbId']},_0x3dee2f,{'dbName':_0x5c9ae2,'mode':_0x2afbcc,'syncedAt':new Date()[_0x3b0ae2(0xa5)](),'description':_0x38fead[_0x3b0ae2(0x9a)]});if(await fileExists(_0x231171))throw CliErrors[_0x3b0ae2(0x9f)](_0x3b0ae2(0xab)+_0x231171);await ensureParentDirectory(_0x231171),await writeFile(_0x231171,_0x59262d,'utf8');const _0x442271=await readSqlLockFile(_0x1eb171[_0x3b0ae2(0x9e)]),{lockData:_0x4a7074,appLock:_0x2c6981}=ensureSqlLockScope(_0x442271??createEmptySqlLock(),_0x1eb171[_0x3b0ae2(0x97)],_0x1eb171[_0x3b0ae2(0x90)],_0x3b0ae2(0x7e));return _0x2c6981[_0x3b0ae2(0x96)][_0x38fead[_0x3b0ae2(0xb8)]]={...buildSqlLockEntry(_0x38fead,_0x3dee2f,computeSqlContentHash(_0x59262d),{'dbName':_0x5c9ae2}),'path':_0x5d8d06,'mode':_0x2afbcc},_0x2c6981[_0x3b0ae2(0x78)]=new Date()['toISOString'](),await writeSqlLockFile(_0x1eb171[_0x3b0ae2(0x9e)],_0x4a7074),{'ok':!![],'data':{'id':_0x38fead['id'],'sqlCode':_0x38fead['sqlCode'],'sqlName':_0x38fead['sqlName'],'dbId':_0x38fead[_0x3b0ae2(0xb2)],'path':_0x231171,'mode':_0x2afbcc},'message':_0x3b0ae2(0x94)+_0x38fead[_0x3b0ae2(0xb8)]};}};async function resolveSqlNewInputs(_0x194041){const _0x5e30b1=await resolveSqlNameInput(_0x194041),{dbId:_0x26ed6d,dbName:_0x9d170f}=await resolveDbSelection(_0x194041),_0x229454=await resolveSqlModeInput(_0x194041);return{'sqlName':_0x5e30b1,'dbId':_0x26ed6d,'dbName':_0x9d170f,'mode':_0x229454};}async function resolveSqlNameInput(_0x7adb13){const _0x1a2a3d=a247_0x4f9cfe,_0x233946=_0x7adb13[_0x1a2a3d(0x81)](_0x1a2a3d(0xaf))[_0x1a2a3d(0x7a)]();if(_0x233946)return _0x233946;if(_0x7adb13[_0x1a2a3d(0x8b)])throw CliErrors[_0x1a2a3d(0x83)](_0x1a2a3d(0xaf),_0x1a2a3d(0x86));return(await input({'message':_0x1a2a3d(0x89),'validate':_0x525904=>_0x525904[_0x1a2a3d(0x7a)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))[_0x1a2a3d(0x7a)]();}async function resolveDbSelection(_0x47ddc5){const _0x249e84=a247_0x4f9cfe,_0x5afd09=resolveProvidedDbId(_0x47ddc5);if(typeof _0x5afd09===_0x249e84(0xa7)&&Number['isFinite'](_0x5afd09)&&_0x5afd09>0x0)return{'dbId':_0x5afd09,'dbName':await getDbName(_0x47ddc5['appCode'],_0x5afd09)[_0x249e84(0x82)](()=>undefined)};if(_0x47ddc5[_0x249e84(0x8b)])throw CliErrors[_0x249e84(0x83)](_0x249e84(0x9d),_0x249e84(0xb7));const _0x322e86=await listDatabases(_0x47ddc5[_0x249e84(0x97)])[_0x249e84(0x82)](()=>[]);if(_0x322e86[_0x249e84(0x8d)]===0x1)return{'dbId':_0x322e86[0x0][_0x249e84(0xb2)],'dbName':_0x322e86[0x0][_0x249e84(0xaa)]};if(_0x322e86[_0x249e84(0x8d)]>0x1){const _0x9b00b9=await select({'message':_0x249e84(0x91),'choices':[..._0x322e86['map'](_0x3d0bd4=>({'name':_0x3d0bd4['dbName']+'\x20('+_0x3d0bd4[_0x249e84(0xb2)]+')','value':serializeDbSelection(_0x3d0bd4)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':'__manual__'}]});if(_0x9b00b9!==_0x249e84(0xac))return deserializeDbSelection(_0x9b00b9);}const _0x2f918b=await input({'message':'Target\x20database\x20dbId:','validate':_0xfc23fe=>{const _0x280e2f=_0x249e84,_0x5a80cc=_0xfc23fe[_0x280e2f(0x7a)]();if(!_0x5a80cc)return _0x280e2f(0xb9);const _0x445212=Number(_0x5a80cc);if(!Number[_0x280e2f(0x7b)](_0x445212)||_0x445212<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x2f918b[_0x249e84(0x7a)]())};}async function resolveSqlModeInput(_0x66e691){const _0x58c7ec=a247_0x4f9cfe,_0x31c999=_0x66e691['str']('mode')['trim']();if(_0x31c999===_0x58c7ec(0xa2)||_0x31c999===_0x58c7ec(0x8c))return _0x31c999;if(_0x66e691[_0x58c7ec(0x8b)])throw CliErrors[_0x58c7ec(0x83)](_0x58c7ec(0x98),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x58c7ec(0x87),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':'sql','description':_0x58c7ec(0x7f)},{'name':_0x58c7ec(0xa8),'value':_0x58c7ec(0x8c),'description':'For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags'}]});}function a247_0x3960(_0x5071f5,_0x32eb15){_0x5071f5=_0x5071f5-0x78;const _0x5d9922=a247_0x5d99();let _0x396052=_0x5d9922[_0x5071f5];return _0x396052;}function serializeDbSelection(_0x1905e2){const _0x437316=a247_0x4f9cfe;return JSON['stringify']({'dbId':_0x1905e2[_0x437316(0xb2)],'dbName':_0x1905e2[_0x437316(0xaa)]});}function deserializeDbSelection(_0xb1a289){const _0x7d01a1=a247_0x4f9cfe;try{const _0x3d108f=JSON[_0x7d01a1(0xb4)](_0xb1a289);if(typeof _0x3d108f[_0x7d01a1(0xb2)]==='number'&&Number[_0x7d01a1(0xa0)](_0x3d108f['dbId']))return{'dbId':_0x3d108f['dbId'],'dbName':_0x3d108f[_0x7d01a1(0xaa)]};}catch{}throw CliErrors[_0x7d01a1(0x9f)]('Invalid\x20database\x20selection\x20payload:\x20'+_0xb1a289);}function resolveProvidedDbId(_0x244c31){const _0x178e2f=a247_0x4f9cfe,_0x2a719e=_0x244c31[_0x178e2f(0xad)]('db-id');if(typeof _0x2a719e===_0x178e2f(0xa7)&&Number[_0x178e2f(0xa0)](_0x2a719e))return _0x2a719e;return undefined;}
@@ -1 +1 @@
1
- const a248_0xe7b3f0=a248_0xec28;(function(_0x253c04,_0x1c5694){const _0x590a17=a248_0xec28,_0x2e40ce=_0x253c04();while(!![]){try{const _0xf8005b=-parseInt(_0x590a17(0x1e5))/0x1*(-parseInt(_0x590a17(0x1e4))/0x2)+parseInt(_0x590a17(0x1dc))/0x3*(-parseInt(_0x590a17(0x1e8))/0x4)+-parseInt(_0x590a17(0x1e0))/0x5+parseInt(_0x590a17(0x1ec))/0x6*(-parseInt(_0x590a17(0x1e7))/0x7)+-parseInt(_0x590a17(0x1df))/0x8+-parseInt(_0x590a17(0x1e9))/0x9+parseInt(_0x590a17(0x1ed))/0xa;if(_0xf8005b===_0x1c5694)break;else _0x2e40ce['push'](_0x2e40ce['shift']());}catch(_0x355576){_0x2e40ce['push'](_0x2e40ce['shift']());}}}(a248_0x2c36,0xafeca));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a248_0xec28(_0xe85000,_0x3b1cdc){_0xe85000=_0xe85000-0x1dc;const _0x2c36d4=a248_0x2c36();let _0xec2824=_0x2c36d4[_0xe85000];return _0xec2824;}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_0xe7b3f0(0x1eb),'command':a248_0xe7b3f0(0x1fc),'description':a248_0xe7b3f0(0x1e2),'risk':a248_0xe7b3f0(0x1f6),'flags':[SQLCODE_FLAG],async 'validate'(_0x13fe09){const _0x248e1c=a248_0xe7b3f0,_0x114abf=loadSqlProjectConfig(_0x13fe09['appCode']),_0x35bb99=await readSqlLockFile(_0x114abf[_0x248e1c(0x1fe)]);if(!_0x35bb99)throw CliErrors[_0x248e1c(0x1f0)](_0x248e1c(0x1f8));},async 'dryRun'(_0x36eecf){const _0x434a89=a248_0xe7b3f0,_0xbcbbff=loadSqlProjectConfig(_0x36eecf[_0x434a89(0x1ff)]),_0x45ff81=await readSqlLockFile(_0xbcbbff[_0x434a89(0x1fe)]);if(!_0x45ff81)throw CliErrors[_0x434a89(0x1f0)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x42cf91}=ensureSqlLockScope(_0x45ff81,_0x36eecf[_0x434a89(0x1ff)],_0xbcbbff[_0x434a89(0x1ef)],_0x434a89(0x1fc)),_0x25ae5a=_0x36eecf[_0x434a89(0x1f1)](_0x434a89(0x1f3)),_0x239971=_0x42cf91[_0x434a89(0x1fa)][_0x25ae5a];if(!_0x239971)throw CliErrors[_0x434a89(0x1f0)](_0x434a89(0x1ea)+_0x25ae5a+'\x22.');return{'method':_0x434a89(0x1f5),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x25ae5a,'id':_0x239971[_0x434a89(0x1e6)],'localPath':resolveLocalSqlFilePath(_0xbcbbff,_0x25ae5a,_0x239971)},'description':'Would\x20delete\x20SQL\x20'+_0x25ae5a+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0xbcbbff['trashDir']};},async 'execute'(_0x4047c0){const _0x4f0710=a248_0xe7b3f0,_0x2eb4a6=loadSqlProjectConfig(_0x4047c0[_0x4f0710(0x1ff)]),_0x3d0ed6=await readSqlLockFile(_0x2eb4a6[_0x4f0710(0x1fe)]);if(!_0x3d0ed6)throw CliErrors['validation'](_0x4f0710(0x1fd));const {lockData:_0x37506a,appLock:_0x240915}=ensureSqlLockScope(_0x3d0ed6,_0x4047c0[_0x4f0710(0x1ff)],_0x2eb4a6[_0x4f0710(0x1ef)],_0x4f0710(0x1fc)),_0x3da983=_0x4047c0[_0x4f0710(0x1f1)](_0x4f0710(0x1f3)),_0x3dd0cc=_0x240915['sqls'][_0x3da983];if(!_0x3dd0cc)throw CliErrors[_0x4f0710(0x1f0)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x3da983+'\x22.');await deleteSqlQuery({'id':_0x3dd0cc[_0x4f0710(0x1e6)],'sqlCode':_0x3da983}),_0x240915[_0x4f0710(0x1fa)]=Object[_0x4f0710(0x1f2)](Object['entries'](_0x240915[_0x4f0710(0x1fa)])['filter'](([_0x283c25])=>_0x283c25!==_0x3da983)),_0x240915[_0x4f0710(0x1dd)]=new Date()[_0x4f0710(0x1ee)](),await writeSqlLockFile(_0x2eb4a6[_0x4f0710(0x1fe)],_0x37506a);const _0x33988b=resolveLocalSqlFilePath(_0x2eb4a6,_0x3da983,_0x3dd0cc);let _0x524b41;await fileExists(_0x33988b)&&(_0x524b41=await moveToTrash(_0x2eb4a6[_0x4f0710(0x1de)],_0x2eb4a6[_0x4f0710(0x1f7)],_0x33988b),await cleanupEmptyDirectories(dirname(_0x33988b),_0x2eb4a6['sqlRootDir']));const _0x3fddfe={'deleted':_0x3da983,'remoteId':_0x3dd0cc[_0x4f0710(0x1e6)]};if(_0x524b41)_0x3fddfe[_0x4f0710(0x1f4)]=_0x524b41;return{'ok':!![],'data':_0x3fddfe,'message':_0x4f0710(0x1fb)+_0x3da983+(_0x524b41?_0x4f0710(0x1e1):'')};}};function a248_0x2c36(){const _0x250b42=['trashedTo','POST','high-risk-write','trashDir','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','replace','sqls','Deleted\x20','delete','SQL\x20lock\x20file\x20not\x20found.','lockFilePath','appCode','1515tUWDRU','lastSync','projectRoot','4382144OFRuhe','5666515nvNdgO','\x20(local\x20file\x20moved\x20to\x20trash)','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','startsWith','4EsfJnW','625398ZhnqwO','remoteId','202265VaqLkc','10436QCstsy','11860578hJPCiw','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','sql','90spyFqo','42196730uYonej','toISOString','sqlRoot','validation','str','fromEntries','sqlcode'];a248_0x2c36=function(){return _0x250b42;};return a248_0x2c36();}async function moveToTrash(_0xe0c8ac,_0x5db0e1,_0x41fb18){const _0x212018=a248_0xe7b3f0,_0xa6d585=new Date()[_0x212018(0x1ee)]()[_0x212018(0x1f9)](/[:.]/g,'-'),_0x5f417a=relative(_0xe0c8ac,_0x41fb18),_0x4e6144=join(_0x5db0e1,_0xa6d585,_0x5f417a);return await mkdir(dirname(_0x4e6144),{'recursive':!![]}),await rename(_0x41fb18,_0x4e6144),_0x4e6144;}async function cleanupEmptyDirectories(_0x113030,_0x2da003){const _0x7a7a40=a248_0xe7b3f0;let _0x1d3447=resolve(_0x113030);const _0x45c6a1=resolve(_0x2da003);while(_0x1d3447[_0x7a7a40(0x1e3)](''+_0x45c6a1+sep)||_0x1d3447===_0x45c6a1){if(_0x1d3447===_0x45c6a1)return;try{const _0x3edbb0=await readdir(_0x1d3447);if(_0x3edbb0['length']>0x0)return;await rmdir(_0x1d3447);}catch{return;}_0x1d3447=dirname(_0x1d3447);}}
1
+ const a248_0x17c547=a248_0x8be7;(function(_0x44395c,_0x2ec1de){const _0x199cdc=a248_0x8be7,_0x85fa87=_0x44395c();while(!![]){try{const _0x4d404d=-parseInt(_0x199cdc(0xc1))/0x1*(parseInt(_0x199cdc(0xb9))/0x2)+-parseInt(_0x199cdc(0xc0))/0x3+parseInt(_0x199cdc(0xae))/0x4*(-parseInt(_0x199cdc(0xc6))/0x5)+-parseInt(_0x199cdc(0xaa))/0x6*(parseInt(_0x199cdc(0xb2))/0x7)+parseInt(_0x199cdc(0xbd))/0x8*(parseInt(_0x199cdc(0xbc))/0x9)+parseInt(_0x199cdc(0xa9))/0xa+parseInt(_0x199cdc(0xbf))/0xb*(parseInt(_0x199cdc(0xb3))/0xc);if(_0x4d404d===_0x2ec1de)break;else _0x85fa87['push'](_0x85fa87['shift']());}catch(_0xb29fc2){_0x85fa87['push'](_0x85fa87['shift']());}}}(a248_0x5397,0xd7036));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a248_0x5397(){const _0x6c5fcc=['delete','638SwMVQs','2633511lAAUHI','41eXnFgY','replace','Deleted\x20','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','projectRoot','170915diTwBD','Would\x20delete\x20SQL\x20','/smartapi/custom/deleteUserCustomSql','sqlRootDir','appCode','toISOString','sql','sqlcode','sqls','filter','high-risk-write','trashedTo','12717310IxPveb','12pwAuOa','remoteId','length','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','16teKcLD','lockFilePath','trashDir','lastSync','1034663RiZutS','365388ZUFCIV','fromEntries','validation','str','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','POST','62134InqYFo','sqlRoot','\x20(local\x20file\x20moved\x20to\x20trash)','9GAYJRt','3414840YgKHKv'];a248_0x5397=function(){return _0x6c5fcc;};return a248_0x5397();}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';function a248_0x8be7(_0x325f9a,_0x3da44e){_0x325f9a=_0x325f9a-0xa4;const _0x5397f5=a248_0x5397();let _0x8be7e9=_0x5397f5[_0x325f9a];return _0x8be7e9;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a248_0x17c547(0xcc),'command':'delete','description':a248_0x17c547(0xc4),'risk':a248_0x17c547(0xa7),'flags':[SQLCODE_FLAG],async 'validate'(_0x29dce3){const _0x44539b=a248_0x17c547,_0x4bcda2=loadSqlProjectConfig(_0x29dce3[_0x44539b(0xca)]),_0x32192c=await readSqlLockFile(_0x4bcda2['lockFilePath']);if(!_0x32192c)throw CliErrors[_0x44539b(0xb5)](_0x44539b(0xad));},async 'dryRun'(_0x50ccee){const _0x511dd6=a248_0x17c547,_0x5a35d2=loadSqlProjectConfig(_0x50ccee['appCode']),_0x4437b2=await readSqlLockFile(_0x5a35d2[_0x511dd6(0xaf)]);if(!_0x4437b2)throw CliErrors[_0x511dd6(0xb5)](_0x511dd6(0xad));const {appLock:_0x3b42b4}=ensureSqlLockScope(_0x4437b2,_0x50ccee[_0x511dd6(0xca)],_0x5a35d2[_0x511dd6(0xba)],'delete'),_0x57c3c3=_0x50ccee[_0x511dd6(0xb6)](_0x511dd6(0xa4)),_0x31d5dc=_0x3b42b4[_0x511dd6(0xa5)][_0x57c3c3];if(!_0x31d5dc)throw CliErrors[_0x511dd6(0xb5)](_0x511dd6(0xb7)+_0x57c3c3+'\x22.');return{'method':_0x511dd6(0xb8),'url':_0x511dd6(0xc8),'body':{'sqlCode':_0x57c3c3,'id':_0x31d5dc[_0x511dd6(0xab)],'localPath':resolveLocalSqlFilePath(_0x5a35d2,_0x57c3c3,_0x31d5dc)},'description':_0x511dd6(0xc7)+_0x57c3c3+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x5a35d2[_0x511dd6(0xb0)]};},async 'execute'(_0x439434){const _0x249c96=a248_0x17c547,_0x3bc3dc=loadSqlProjectConfig(_0x439434[_0x249c96(0xca)]),_0x422ecf=await readSqlLockFile(_0x3bc3dc[_0x249c96(0xaf)]);if(!_0x422ecf)throw CliErrors[_0x249c96(0xb5)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x1a2986,appLock:_0x1db9e6}=ensureSqlLockScope(_0x422ecf,_0x439434['appCode'],_0x3bc3dc[_0x249c96(0xba)],_0x249c96(0xbe)),_0x3eef55=_0x439434['str'](_0x249c96(0xa4)),_0x464e67=_0x1db9e6[_0x249c96(0xa5)][_0x3eef55];if(!_0x464e67)throw CliErrors[_0x249c96(0xb5)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x3eef55+'\x22.');await deleteSqlQuery({'id':_0x464e67[_0x249c96(0xab)],'sqlCode':_0x3eef55}),_0x1db9e6[_0x249c96(0xa5)]=Object[_0x249c96(0xb4)](Object['entries'](_0x1db9e6[_0x249c96(0xa5)])[_0x249c96(0xa6)](([_0x28bd58])=>_0x28bd58!==_0x3eef55)),_0x1db9e6[_0x249c96(0xb1)]=new Date()['toISOString'](),await writeSqlLockFile(_0x3bc3dc[_0x249c96(0xaf)],_0x1a2986);const _0x24f2d8=resolveLocalSqlFilePath(_0x3bc3dc,_0x3eef55,_0x464e67);let _0x4e5812;await fileExists(_0x24f2d8)&&(_0x4e5812=await moveToTrash(_0x3bc3dc[_0x249c96(0xc5)],_0x3bc3dc[_0x249c96(0xb0)],_0x24f2d8),await cleanupEmptyDirectories(dirname(_0x24f2d8),_0x3bc3dc[_0x249c96(0xc9)]));const _0x38a306={'deleted':_0x3eef55,'remoteId':_0x464e67[_0x249c96(0xab)]};if(_0x4e5812)_0x38a306[_0x249c96(0xa8)]=_0x4e5812;return{'ok':!![],'data':_0x38a306,'message':_0x249c96(0xc3)+_0x3eef55+(_0x4e5812?_0x249c96(0xbb):'')};}};async function moveToTrash(_0x3fd0a4,_0x596e0d,_0x83bd25){const _0x4a6cc3=a248_0x17c547,_0x2b05df=new Date()[_0x4a6cc3(0xcb)]()[_0x4a6cc3(0xc2)](/[:.]/g,'-'),_0x429274=relative(_0x3fd0a4,_0x83bd25),_0x244498=join(_0x596e0d,_0x2b05df,_0x429274);return await mkdir(dirname(_0x244498),{'recursive':!![]}),await rename(_0x83bd25,_0x244498),_0x244498;}async function cleanupEmptyDirectories(_0x5906f1,_0x428679){const _0x4e33bb=a248_0x17c547;let _0x4d101f=resolve(_0x5906f1);const _0x2bdc86=resolve(_0x428679);while(_0x4d101f['startsWith'](''+_0x2bdc86+sep)||_0x4d101f===_0x2bdc86){if(_0x4d101f===_0x2bdc86)return;try{const _0x529445=await readdir(_0x4d101f);if(_0x529445[_0x4e33bb(0xac)]>0x0)return;await rmdir(_0x4d101f);}catch{return;}_0x4d101f=dirname(_0x4d101f);}}
@@ -1 +1 @@
1
- const a249_0x3bc68b=a249_0x118e;function a249_0x36f4(){const _0x3841df=['str','boolean','7762216HPRawW','113576DtPDCl','657UlpqML','sqlCode','bool','detail','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','appCode','Return\x20full\x20raw\x20SQL\x20query\x20object','verbose','18qhAhyJ','read','sqlName','946122XgKqZV','2404490jnRlqO','8OLFqqt','214484uPykpb','1235878RKiOZt','sqlContent','8AiMQcv','727880yTWVVv','dbId'];a249_0x36f4=function(){return _0x3841df;};return a249_0x36f4();}function a249_0x118e(_0x15279b,_0x299b36){_0x15279b=_0x15279b-0x1c5;const _0x36f425=a249_0x36f4();let _0x118e2=_0x36f425[_0x15279b];return _0x118e2;}(function(_0x3a651e,_0x2e8f1d){const _0x53ce38=a249_0x118e,_0x23f9cc=_0x3a651e();while(!![]){try{const _0x1e5180=-parseInt(_0x53ce38(0x1c5))/0x1*(parseInt(_0x53ce38(0x1dc))/0x2)+-parseInt(_0x53ce38(0x1da))/0x3*(-parseInt(_0x53ce38(0x1c8))/0x4)+-parseInt(_0x53ce38(0x1db))/0x5+-parseInt(_0x53ce38(0x1d7))/0x6*(parseInt(_0x53ce38(0x1c6))/0x7)+parseInt(_0x53ce38(0x1ce))/0x8*(parseInt(_0x53ce38(0x1cf))/0x9)+parseInt(_0x53ce38(0x1c9))/0xa+parseInt(_0x53ce38(0x1cd))/0xb;if(_0x1e5180===_0x2e8f1d)break;else _0x23f9cc['push'](_0x23f9cc['shift']());}catch(_0x265da6){_0x23f9cc['push'](_0x23f9cc['shift']());}}}(a249_0x36f4,0x8ce35));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':'sql','command':a249_0x3bc68b(0x1d2),'description':a249_0x3bc68b(0x1d3),'risk':a249_0x3bc68b(0x1d8),'flags':[SQLCODE_FLAG,{'name':a249_0x3bc68b(0x1d6),'type':a249_0x3bc68b(0x1cc),'description':a249_0x3bc68b(0x1d5)}],async 'execute'(_0x27e8cf){const _0x18b117=a249_0x3bc68b,_0x1b3ff0=await getSqlQueryInfo(_0x27e8cf['appCode'],_0x27e8cf[_0x18b117(0x1cb)]('sqlcode')),_0x16bfe4=_0x27e8cf[_0x18b117(0x1d1)](_0x18b117(0x1d6));if(_0x16bfe4)return{'ok':!![],'data':_0x1b3ff0};const _0x3fbe41=_0x1b3ff0[_0x18b117(0x1ca)]?await getDbName(_0x27e8cf[_0x18b117(0x1d4)],_0x1b3ff0[_0x18b117(0x1ca)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x1b3ff0[_0x18b117(0x1d0)],'sqlName':_0x1b3ff0[_0x18b117(0x1d9)],'db':_0x3fbe41?_0x3fbe41+'\x20('+_0x1b3ff0[_0x18b117(0x1ca)]+')':_0x1b3ff0['dbId']??'','description':_0x1b3ff0['description']??'','sqlContent':_0x1b3ff0[_0x18b117(0x1c7)]??''}};}};
1
+ const a249_0x398fcf=a249_0x1d03;function a249_0x1d03(_0x4bc139,_0x136e4d){_0x4bc139=_0x4bc139-0x1df;const _0x9ddc7c=a249_0x9ddc();let _0x1d0391=_0x9ddc7c[_0x4bc139];return _0x1d0391;}function a249_0x9ddc(){const _0x2ae253=['boolean','read','144mwkdjU','str','22424nRKily','6KXaPCx','3426008CekaqP','796640qbgDsX','verbose','sql','4124449GFzWjE','dbId','sqlName','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','22314300bmepzv','441RTbunV','2485750loiEgY','description','22TTbWzM','bool','32072DghDIC','5hiKERK','sqlcode'];a249_0x9ddc=function(){return _0x2ae253;};return a249_0x9ddc();}(function(_0x3ea4c2,_0x14aa80){const _0x5029aa=a249_0x1d03,_0x33cff3=_0x3ea4c2();while(!![]){try{const _0x44ef6a=-parseInt(_0x5029aa(0x1df))/0x1+parseInt(_0x5029aa(0x1ec))/0x2*(-parseInt(_0x5029aa(0x1f1))/0x3)+-parseInt(_0x5029aa(0x1f5))/0x4*(parseInt(_0x5029aa(0x1ed))/0x5)+-parseInt(_0x5029aa(0x1f4))/0x6*(parseInt(_0x5029aa(0x1e2))/0x7)+parseInt(_0x5029aa(0x1f3))/0x8*(parseInt(_0x5029aa(0x1e7))/0x9)+-parseInt(_0x5029aa(0x1e8))/0xa+parseInt(_0x5029aa(0x1ea))/0xb*(parseInt(_0x5029aa(0x1e6))/0xc);if(_0x44ef6a===_0x14aa80)break;else _0x33cff3['push'](_0x33cff3['shift']());}catch(_0x28b4fe){_0x33cff3['push'](_0x33cff3['shift']());}}}(a249_0x9ddc,0x91721));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_0x398fcf(0x1e1),'command':'detail','description':a249_0x398fcf(0x1e5),'risk':a249_0x398fcf(0x1f0),'flags':[SQLCODE_FLAG,{'name':a249_0x398fcf(0x1e0),'type':a249_0x398fcf(0x1ef),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x530004){const _0x5c22a7=a249_0x398fcf,_0x1587c8=await getSqlQueryInfo(_0x530004['appCode'],_0x530004[_0x5c22a7(0x1f2)](_0x5c22a7(0x1ee))),_0x21e7f8=_0x530004[_0x5c22a7(0x1eb)](_0x5c22a7(0x1e0));if(_0x21e7f8)return{'ok':!![],'data':_0x1587c8};const _0x125e96=_0x1587c8['dbId']?await getDbName(_0x530004['appCode'],_0x1587c8[_0x5c22a7(0x1e3)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x1587c8['sqlCode'],'sqlName':_0x1587c8[_0x5c22a7(0x1e4)],'db':_0x125e96?_0x125e96+'\x20('+_0x1587c8[_0x5c22a7(0x1e3)]+')':_0x1587c8[_0x5c22a7(0x1e3)]??'','description':_0x1587c8[_0x5c22a7(0x1e9)]??'','sqlContent':_0x1587c8['sqlContent']??''}};}};
@@ -1 +1 @@
1
- const a250_0x28ab67=a250_0x67c3;(function(_0x412c2a,_0x5f1772){const _0x52c5a2=a250_0x67c3,_0x53fb9f=_0x412c2a();while(!![]){try{const _0x2ca7c3=-parseInt(_0x52c5a2(0xdd))/0x1+parseInt(_0x52c5a2(0xe9))/0x2*(-parseInt(_0x52c5a2(0xd6))/0x3)+parseInt(_0x52c5a2(0xd8))/0x4*(-parseInt(_0x52c5a2(0xd4))/0x5)+parseInt(_0x52c5a2(0xdb))/0x6+-parseInt(_0x52c5a2(0xe7))/0x7+-parseInt(_0x52c5a2(0xeb))/0x8*(-parseInt(_0x52c5a2(0xdf))/0x9)+parseInt(_0x52c5a2(0xde))/0xa;if(_0x2ca7c3===_0x5f1772)break;else _0x53fb9f['push'](_0x53fb9f['shift']());}catch(_0x13b0f7){_0x53fb9f['push'](_0x53fb9f['shift']());}}}(a250_0x17f7,0xd1aa8));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a250_0x67c3(_0x596247,_0x6d292d){_0x596247=_0x596247-0xd4;const _0x17f78b=a250_0x17f7();let _0x67c384=_0x17f78b[_0x596247];return _0x67c384;}export const sqlExec={'service':a250_0x28ab67(0xe1),'command':a250_0x28ab67(0xe0),'description':a250_0x28ab67(0xe2),'risk':a250_0x28ab67(0xdc),'flags':[SQLCODE_FLAG,{'name':a250_0x28ab67(0xe6),'type':a250_0x28ab67(0xe5),'description':a250_0x28ab67(0xda)}],async 'execute'(_0x7256b){const _0x4828d2=a250_0x28ab67,_0xb8567c=parseJsonParams(_0x7256b['str']('params')),_0x49fe14=Date[_0x4828d2(0xd5)](),_0x50a801=await executeSql(_0x7256b['appCode'],_0x7256b[_0x4828d2(0xea)]('sqlcode'),_0xb8567c),_0x3f49ff=Date[_0x4828d2(0xd5)]()-_0x49fe14,_0x17f9a1=_0x50a801?.['execResult']??_0x50a801,_0x570a42=_0x50a801?.[_0x4828d2(0xe3)]??!![];if(!_0x570a42)return{'ok':![],'data':{'error':_0x50a801?.['execError']||'SQL\x20execution\x20failed','elapsed':_0x3f49ff},'message':_0x4828d2(0xe4)};const _0x24da9d=Array[_0x4828d2(0xe8)](_0x17f9a1)?_0x17f9a1:[];return{'ok':!![],'data':{'rows':_0x24da9d,'rowCount':_0x24da9d[_0x4828d2(0xd7)],'elapsed':_0x3f49ff},'message':_0x4828d2(0xec)+_0x24da9d[_0x4828d2(0xd7)]+_0x4828d2(0xd9)+_0x3f49ff+'ms'};}};function a250_0x17f7(){const _0x267075=['exec','sql','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','execSuccess','SQL\x20execution\x20failed','string','params','2514323BbTaal','isArray','65746xxgkZr','str','56XaDdLx','Returned\x20','5QQalfU','now','21KOuXVB','length','6849016YsoTjF','\x20row(s)\x20in\x20','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','9234312sIhYKv','read','1365390SDAnzG','20552570yfvnfK','1197549MYCxaD'];a250_0x17f7=function(){return _0x267075;};return a250_0x17f7();}
1
+ const a250_0x29a797=a250_0x4194;(function(_0x4eb329,_0xda0068){const _0xdf439e=a250_0x4194,_0x38d8a6=_0x4eb329();while(!![]){try{const _0x39de50=parseInt(_0xdf439e(0x1c8))/0x1+parseInt(_0xdf439e(0x1ce))/0x2+-parseInt(_0xdf439e(0x1c2))/0x3+parseInt(_0xdf439e(0x1d0))/0x4*(parseInt(_0xdf439e(0x1c9))/0x5)+parseInt(_0xdf439e(0x1c5))/0x6*(-parseInt(_0xdf439e(0x1c4))/0x7)+-parseInt(_0xdf439e(0x1ca))/0x8*(-parseInt(_0xdf439e(0x1d1))/0x9)+-parseInt(_0xdf439e(0x1bd))/0xa;if(_0x39de50===_0xda0068)break;else _0x38d8a6['push'](_0x38d8a6['shift']());}catch(_0x11fa61){_0x38d8a6['push'](_0x38d8a6['shift']());}}}(a250_0x1f51,0x36a6f));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a250_0x4194(_0x43c8a,_0x427c61){_0x43c8a=_0x43c8a-0x1ba;const _0x1f51f5=a250_0x1f51();let _0x419447=_0x1f51f5[_0x43c8a];return _0x419447;}function a250_0x1f51(){const _0x1b0c8b=['2801620ZNDTIM','SQL\x20execution\x20failed','Returned\x20','sqlcode','isArray','998727AOeKKU','appCode','63EblUJq','54018YDiRUk','now','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','89140RfaCPC','59855Fbvmof','877792GFlkuH','read','length','\x20row(s)\x20in\x20','791744eOHvhq','str','108tOUgaG','9bvYQgA','params','execSuccess','exec'];a250_0x1f51=function(){return _0x1b0c8b;};return a250_0x1f51();}export const sqlExec={'service':'sql','command':a250_0x29a797(0x1bc),'description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a250_0x29a797(0x1cb),'flags':[SQLCODE_FLAG,{'name':a250_0x29a797(0x1ba),'type':'string','description':a250_0x29a797(0x1c7)}],async 'execute'(_0x3eeb7e){const _0x229ed0=a250_0x29a797,_0x38a1fc=parseJsonParams(_0x3eeb7e[_0x229ed0(0x1cf)](_0x229ed0(0x1ba))),_0x1ae0ed=Date[_0x229ed0(0x1c6)](),_0x502631=await executeSql(_0x3eeb7e[_0x229ed0(0x1c3)],_0x3eeb7e[_0x229ed0(0x1cf)](_0x229ed0(0x1c0)),_0x38a1fc),_0x5bca02=Date[_0x229ed0(0x1c6)]()-_0x1ae0ed,_0x426a17=_0x502631?.['execResult']??_0x502631,_0x10ff2c=_0x502631?.[_0x229ed0(0x1bb)]??!![];if(!_0x10ff2c)return{'ok':![],'data':{'error':_0x502631?.['execError']||_0x229ed0(0x1be),'elapsed':_0x5bca02},'message':_0x229ed0(0x1be)};const _0x45f57a=Array[_0x229ed0(0x1c1)](_0x426a17)?_0x426a17:[];return{'ok':!![],'data':{'rows':_0x45f57a,'rowCount':_0x45f57a['length'],'elapsed':_0x5bca02},'message':_0x229ed0(0x1bf)+_0x45f57a[_0x229ed0(0x1cc)]+_0x229ed0(0x1cd)+_0x5bca02+'ms'};}};
@@ -1 +1 @@
1
- (function(_0xd77006,_0x3a7cd4){const _0x338e40=a251_0x40ee,_0x5362db=_0xd77006();while(!![]){try{const _0x2bbaaa=-parseInt(_0x338e40(0x15c))/0x1*(-parseInt(_0x338e40(0x160))/0x2)+parseInt(_0x338e40(0x157))/0x3+parseInt(_0x338e40(0x156))/0x4+-parseInt(_0x338e40(0x15b))/0x5*(parseInt(_0x338e40(0x15f))/0x6)+-parseInt(_0x338e40(0x159))/0x7*(parseInt(_0x338e40(0x15d))/0x8)+parseInt(_0x338e40(0x15e))/0x9+-parseInt(_0x338e40(0x158))/0xa*(-parseInt(_0x338e40(0x15a))/0xb);if(_0x2bbaaa===_0x3a7cd4)break;else _0x5362db['push'](_0x5362db['shift']());}catch(_0x4d1ff8){_0x5362db['push'](_0x5362db['shift']());}}}(a251_0x4709,0xcf721));function a251_0x40ee(_0x2013c3,_0x58bc9e){_0x2013c3=_0x2013c3-0x156;const _0x470911=a251_0x4709();let _0x40eec6=_0x470911[_0x2013c3];return _0x40eec6;}import{sqlList}from'../../commands/sql/list.js';function a251_0x4709(){const _0x46e047=['2278397rCvgsP','2531240zmUtcu','1IbgsaF','48yBjAZu','5971734AdjmOL','6jyOuKD','1238650IAcvZx','878024cgBKMs','1980573NPYYou','10OxvePR','1182685xJtOzB'];a251_0x4709=function(){return _0x46e047;};return a251_0x4709();}import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x308c0e,_0x1fbfc9){const _0x19a851=a251_0x4dc5,_0x38c75e=_0x308c0e();while(!![]){try{const _0x2db681=parseInt(_0x19a851(0x99))/0x1+parseInt(_0x19a851(0x98))/0x2+parseInt(_0x19a851(0x96))/0x3*(parseInt(_0x19a851(0x9b))/0x4)+-parseInt(_0x19a851(0x9c))/0x5+-parseInt(_0x19a851(0x95))/0x6+-parseInt(_0x19a851(0x97))/0x7*(-parseInt(_0x19a851(0x9a))/0x8)+-parseInt(_0x19a851(0x9d))/0x9;if(_0x2db681===_0x1fbfc9)break;else _0x38c75e['push'](_0x38c75e['shift']());}catch(_0x58976){_0x38c75e['push'](_0x38c75e['shift']());}}}(a251_0x2401,0x8f4a4));function a251_0x2401(){const _0x48e307=['433906oqOUjN','801746EDeAUr','90056yXtMej','8pGZuDu','2024015AKFXlu','839889qEejYf','3311202WEGsyQ','420747TUYJuM','210yztIol'];a251_0x2401=function(){return _0x48e307;};return a251_0x2401();}import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';function a251_0x4dc5(_0x3e566e,_0x1b69d6){_0x3e566e=_0x3e566e-0x95;const _0x24019f=a251_0x2401();let _0x4dc5d5=_0x24019f[_0x3e566e];return _0x4dc5d5;}import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- function a252_0xc681(_0x296bfc,_0x2c5e8c){_0x296bfc=_0x296bfc-0x18f;const _0x7b66bf=a252_0x7b66();let _0xc68196=_0x7b66bf[_0x296bfc];return _0xc68196;}const a252_0x590de2=a252_0xc681;(function(_0x36d167,_0x64dde5){const _0x43001a=a252_0xc681,_0x3b91c7=_0x36d167();while(!![]){try{const _0x176f9c=-parseInt(_0x43001a(0x1a2))/0x1+-parseInt(_0x43001a(0x1ad))/0x2*(parseInt(_0x43001a(0x196))/0x3)+-parseInt(_0x43001a(0x19a))/0x4*(-parseInt(_0x43001a(0x192))/0x5)+-parseInt(_0x43001a(0x197))/0x6+parseInt(_0x43001a(0x1aa))/0x7*(parseInt(_0x43001a(0x19f))/0x8)+parseInt(_0x43001a(0x1a5))/0x9+-parseInt(_0x43001a(0x1a3))/0xa*(parseInt(_0x43001a(0x1a8))/0xb);if(_0x176f9c===_0x64dde5)break;else _0x3b91c7['push'](_0x3b91c7['shift']());}catch(_0x33b530){_0x3b91c7['push'](_0x3b91c7['shift']());}}}(a252_0x7b66,0xf1c5b));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a252_0x590de2(0x1a6),'command':'list','description':a252_0x590de2(0x198),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0x590de2(0x19c),'type':'string','description':a252_0x590de2(0x1ac)},{'name':a252_0x590de2(0x1af),'type':a252_0x590de2(0x194),'description':'Page\x20number','default':0x1},{'name':a252_0x590de2(0x1a0),'type':a252_0x590de2(0x194),'description':a252_0x590de2(0x1b2)},{'name':'verbose','type':'boolean','description':a252_0x590de2(0x1a7)}],async 'execute'(_0x2d151e){const _0x47aa4d=a252_0x590de2,_0x427322=await listSqlQueries(_0x2d151e[_0x47aa4d(0x1a9)],{'sqlCode':_0x2d151e[_0x47aa4d(0x195)](_0x47aa4d(0x19d))||undefined,'sqlName':_0x2d151e[_0x47aa4d(0x195)](_0x47aa4d(0x19c))||undefined,'currentPage':_0x2d151e[_0x47aa4d(0x1a4)](_0x47aa4d(0x1af)),'pageSize':_0x2d151e[_0x47aa4d(0x1a4)](_0x47aa4d(0x1a0),0x32)}),_0x4ff9c6=_0x2d151e['bool'](_0x47aa4d(0x1ae)),_0x4efbc8=_0x427322[_0x47aa4d(0x18f)]??[],_0x42bca9=_0x427322[_0x47aa4d(0x191)]?.[_0x47aa4d(0x19e)]??_0x4efbc8[_0x47aa4d(0x1b0)];let _0x28bd22;return _0x4ff9c6?_0x28bd22=_0x4efbc8:_0x28bd22=await Promise[_0x47aa4d(0x1b1)](_0x4efbc8[_0x47aa4d(0x193)](async _0xa0fe5a=>{const _0x549c8d=_0x47aa4d;let _0x409f14;try{_0x409f14=_0xa0fe5a[_0x549c8d(0x19b)]?await getDbName(_0x2d151e[_0x549c8d(0x1a9)],_0xa0fe5a[_0x549c8d(0x19b)]):undefined;}catch{}return{'sqlCode':_0xa0fe5a[_0x549c8d(0x199)],'sqlName':_0xa0fe5a[_0x549c8d(0x1a1)],'description':_0xa0fe5a[_0x549c8d(0x190)]??'','db':_0x409f14?_0x409f14+'\x20('+_0xa0fe5a[_0x549c8d(0x19b)]+')':_0xa0fe5a[_0x549c8d(0x19b)]??''};})),{'ok':!![],'data':_0x28bd22,'message':_0x4efbc8['length']===0x0?_0x47aa4d(0x1ab):'Found\x20'+_0x4efbc8[_0x47aa4d(0x1b0)]+'\x20SQL\x20queries\x20(total:\x20'+_0x42bca9+').'};}};function a252_0x7b66(){const _0x2f477f=['243rKlIFL','4208076Xczjcy','List\x20custom\x20SQL\x20queries','sqlCode','6641764zYKHEW','dbId','name','sqlcode','totalCount','16FQmIjk','pagesize','sqlName','222066YnuIjj','7057870JNHTou','num','5351184bFLDfG','sql','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','11ugVAFl','appCode','3671542xyWPXB','No\x20custom\x20SQL\x20queries\x20found.','Filter\x20by\x20SQL\x20name','16902avUSsr','verbose','page','length','all','Page\x20size','tableData','description','paging','5ZUXfUx','map','number','str'];a252_0x7b66=function(){return _0x2f477f;};return a252_0x7b66();}
1
+ const a252_0x3d4597=a252_0x5354;function a252_0x3e8b(){const _0x4d2fd1=['sqlCode','Filter\x20by\x20SQL\x20name','appCode','length','sqlName','read','List\x20custom\x20SQL\x20queries','63430cZzkEb','848066DYMWzN','dbId','327950WtNOrl','string','all','str','7208pKGswK','516TKfioh','6BVZCip','number','bool','126079mRlwRm','verbose','list','Page\x20number','\x20SQL\x20queries\x20(total:\x20','map','1623704IFLRAG','Found\x20','description','totalCount','num','pagesize','Page\x20size','sql','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','1061770XlsNWt','9hLCvip','name','tableData'];a252_0x3e8b=function(){return _0x4d2fd1;};return a252_0x3e8b();}(function(_0x1fa2a7,_0x492bc2){const _0xdf5367=a252_0x5354,_0x2b5ab2=_0x1fa2a7();while(!![]){try{const _0x438fe7=-parseInt(_0xdf5367(0x13b))/0x1+parseInt(_0xdf5367(0x156))/0x2+parseInt(_0xdf5367(0x15d))/0x3*(parseInt(_0xdf5367(0x15c))/0x4)+parseInt(_0xdf5367(0x155))/0x5*(parseInt(_0xdf5367(0x138))/0x6)+-parseInt(_0xdf5367(0x158))/0x7+-parseInt(_0xdf5367(0x141))/0x8+parseInt(_0xdf5367(0x14b))/0x9*(-parseInt(_0xdf5367(0x14a))/0xa);if(_0x438fe7===_0x492bc2)break;else _0x2b5ab2['push'](_0x2b5ab2['shift']());}catch(_0x5566ea){_0x2b5ab2['push'](_0x2b5ab2['shift']());}}}(a252_0x3e8b,0x40992));import{listSqlQueries}from'../../core/api-client.js';function a252_0x5354(_0x3a75a4,_0x58e033){_0x3a75a4=_0x3a75a4-0x138;const _0x3e8b4a=a252_0x3e8b();let _0x5354d4=_0x3e8b4a[_0x3a75a4];return _0x5354d4;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a252_0x3d4597(0x148),'command':a252_0x3d4597(0x13d),'description':a252_0x3d4597(0x154),'risk':a252_0x3d4597(0x153),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0x3d4597(0x14c),'type':a252_0x3d4597(0x159),'description':a252_0x3d4597(0x14f)},{'name':'page','type':a252_0x3d4597(0x139),'description':a252_0x3d4597(0x13e),'default':0x1},{'name':'pagesize','type':a252_0x3d4597(0x139),'description':a252_0x3d4597(0x147)},{'name':a252_0x3d4597(0x13c),'type':'boolean','description':a252_0x3d4597(0x149)}],async 'execute'(_0x232774){const _0x5bf692=a252_0x3d4597,_0x52df2e=await listSqlQueries(_0x232774[_0x5bf692(0x150)],{'sqlCode':_0x232774[_0x5bf692(0x15b)]('sqlcode')||undefined,'sqlName':_0x232774['str'](_0x5bf692(0x14c))||undefined,'currentPage':_0x232774[_0x5bf692(0x145)]('page'),'pageSize':_0x232774['num'](_0x5bf692(0x146),0x32)}),_0x1d5bb3=_0x232774[_0x5bf692(0x13a)](_0x5bf692(0x13c)),_0x5dc258=_0x52df2e[_0x5bf692(0x14d)]??[],_0x407246=_0x52df2e['paging']?.[_0x5bf692(0x144)]??_0x5dc258[_0x5bf692(0x151)];let _0x292df6;return _0x1d5bb3?_0x292df6=_0x5dc258:_0x292df6=await Promise[_0x5bf692(0x15a)](_0x5dc258[_0x5bf692(0x140)](async _0x1bade7=>{const _0x5ed799=_0x5bf692;let _0x5c0d56;try{_0x5c0d56=_0x1bade7[_0x5ed799(0x157)]?await getDbName(_0x232774[_0x5ed799(0x150)],_0x1bade7[_0x5ed799(0x157)]):undefined;}catch{}return{'sqlCode':_0x1bade7[_0x5ed799(0x14e)],'sqlName':_0x1bade7[_0x5ed799(0x152)],'description':_0x1bade7[_0x5ed799(0x143)]??'','db':_0x5c0d56?_0x5c0d56+'\x20('+_0x1bade7[_0x5ed799(0x157)]+')':_0x1bade7[_0x5ed799(0x157)]??''};})),{'ok':!![],'data':_0x292df6,'message':_0x5dc258[_0x5bf692(0x151)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x5bf692(0x142)+_0x5dc258['length']+_0x5bf692(0x13f)+_0x407246+').'};}};
@@ -1 +1 @@
1
- const a253_0x4a9810=a253_0x5b6e;(function(_0x4a653e,_0xb06ce9){const _0x118bf5=a253_0x5b6e,_0x35ec40=_0x4a653e();while(!![]){try{const _0x274e4e=-parseInt(_0x118bf5(0x1b7))/0x1*(parseInt(_0x118bf5(0x1af))/0x2)+parseInt(_0x118bf5(0x1c2))/0x3+-parseInt(_0x118bf5(0x193))/0x4+-parseInt(_0x118bf5(0x1d3))/0x5+parseInt(_0x118bf5(0x1a3))/0x6+-parseInt(_0x118bf5(0x1be))/0x7*(-parseInt(_0x118bf5(0x1ae))/0x8)+parseInt(_0x118bf5(0x1c4))/0x9*(-parseInt(_0x118bf5(0x1cd))/0xa);if(_0x274e4e===_0xb06ce9)break;else _0x35ec40['push'](_0x35ec40['shift']());}catch(_0x1a2928){_0x35ec40['push'](_0x35ec40['shift']());}}}(a253_0x37a3,0x6496f));import{readFile,rm,writeFile}from'node:fs/promises';function a253_0x37a3(){const _0x1e8d27=['file','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','utf8','2xhHjDl','sqlName','unchanged','length','description','push','dbId','189URYYTQ','local\x20differs\x20from\x20remote','would_pull','name','1946298sOztHp','conflict','9YlbnYk','appCode','sqls','\x20failed','filePath','cancelled','read','path','find','1444150FJaVEv','sql','sqlRoot','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','str','replace','1855395MSUnnZ','toLowerCase','mode','join','.xml','boolean','equivalent','hash','1567972RCxZom','message','trim','POST','content','lockFilePath','No\x20remote\x20SQL\x20queries\x20matched.','paging','toISOString','mybatisXml','sqlCode','\x20SQL\x20file(s)\x20into\x20','skipped','Filter\x20by\x20SQL\x20display\x20name','isCanonical','sqlRootDir','2285664piIvBZ','filter','tableData','catch','sqlcode','pull','sqlContent','string','Pull\x20complete:\x20','Force\x20pull\x20cancelled.','lastSync','236432vwGtLe','508166jkVGbt','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','some','test'];a253_0x37a3=function(){return _0x1e8d27;};return a253_0x37a3();}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_0x5b6e(_0x23e53b,_0x5b0dc7){_0x23e53b=_0x23e53b-0x193;const _0x37a39d=a253_0x37a3();let _0x5b6ee5=_0x37a39d[_0x23e53b];return _0x5b6ee5;}import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x135855,_0x184b5e){const _0x5820a8=a253_0x5b6e,_0x3b0e91=[];let _0x4d2875=0x1;while(!![]){const _0x2ccf16=await listSqlQueries(_0x135855,{'currentPage':_0x4d2875,'pageSize':PAGE_SIZE,'sqlCode':_0x184b5e[_0x5820a8(0x19d)],'sqlName':_0x184b5e[_0x5820a8(0x1b8)]}),_0x28186e=_0x2ccf16[_0x5820a8(0x1a5)]??[];_0x3b0e91[_0x5820a8(0x1bc)](..._0x28186e);if(_0x28186e['length']===0x0)break;const _0x1437b5=_0x2ccf16[_0x5820a8(0x19a)]?.['totalCount'];if(_0x1437b5!=null?_0x3b0e91[_0x5820a8(0x1ba)]>=_0x1437b5:_0x28186e[_0x5820a8(0x1ba)]<PAGE_SIZE)break;_0x4d2875++;}return _0x3b0e91;}async function ensureSqlContent(_0x299bbc){const _0x4b7cad=a253_0x5b6e;if(_0x299bbc[_0x4b7cad(0x1a9)]!=null&&String(_0x299bbc[_0x4b7cad(0x1a9)])['length']>0x0)return _0x299bbc;return getSqlQueryDetail(_0x299bbc[_0x4b7cad(0x19d)]);}export const sqlPull={'service':a253_0x4a9810(0x1ce),'command':a253_0x4a9810(0x1a8),'description':a253_0x4a9810(0x1b0),'risk':a253_0x4a9810(0x1ca),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x4a9810(0x1c1),'type':a253_0x4a9810(0x1aa),'description':a253_0x4a9810(0x1a0)},{'name':'force','type':a253_0x4a9810(0x1d8),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x582949){const _0x54aa7d=a253_0x4a9810,_0x11f92e=loadSqlProjectConfig(_0x582949[_0x54aa7d(0x1c5)]),_0x1f8c78=await readSqlLockFile(_0x11f92e[_0x54aa7d(0x198)]),{appLock:_0x1e0c7c}=ensureSqlLockScope(_0x1f8c78??createEmptySqlLock(),_0x11f92e[_0x54aa7d(0x1c5)],_0x11f92e[_0x54aa7d(0x1cf)],'pull'),_0xceb65=await fetchAllSqlQueries(_0x582949[_0x54aa7d(0x1c5)],{'sqlCode':_0x582949['str']('sqlcode')||undefined,'sqlName':_0x582949[_0x54aa7d(0x1d1)](_0x54aa7d(0x1c1))||undefined}),_0xd291ec=[];for(const _0x4cfc15 of _0xceb65){const _0x1afba1=await ensureSqlContent(_0x4cfc15),_0x3e39d2=ensureRemoteSqlContent(_0x1afba1),_0x55e0d8=detectSqlMode(_0x3e39d2),_0x56b063=_0x1afba1[_0x54aa7d(0x1bd)]?await getDbName(_0x582949[_0x54aa7d(0x1c5)],Number(_0x1afba1[_0x54aa7d(0x1bd)]))[_0x54aa7d(0x1a6)](()=>undefined):undefined,_0x2f089e=buildLocalSqlFileContent({'sqlCode':_0x1afba1[_0x54aa7d(0x19d)],'sqlName':_0x1afba1[_0x54aa7d(0x1b8)],'dbId':_0x1afba1[_0x54aa7d(0x1bd)]},_0x3e39d2,{'dbName':_0x56b063,'mode':_0x55e0d8,'syncedAt':new Date()[_0x54aa7d(0x19b)](),'description':_0x1afba1['description']}),_0x3f6cd3=buildSqlLockEntry(_0x1afba1,_0x3e39d2,'',{'dbName':_0x56b063}),_0x55c66c=resolveLocalSqlFilePath(_0x11f92e,_0x1afba1['sqlCode'],_0x3f6cd3);let _0x23f083=_0x54aa7d(0x1c0),_0xa62e61;const _0x480aec=await findExistingSqlFiles(_0x11f92e,_0x55c66c,_0x55e0d8,_0x1e0c7c['sqls'][_0x1afba1['sqlCode']]);if(_0x480aec[_0x54aa7d(0x1ba)]>0x0){const _0x58d6bd=await compareExistingSqlFiles(_0x480aec,_0x2f089e,_0x55e0d8);if(_0x58d6bd['some'](({equivalent:_0x596c52})=>!_0x596c52))_0x23f083=_0x54aa7d(0x1c3),_0xa62e61=_0x54aa7d(0x1d0);else _0x58d6bd['length']===0x1&&_0x58d6bd[0x0]?.['file'][_0x54aa7d(0x1a1)]&&(_0x23f083=_0x54aa7d(0x19f),_0xa62e61='unchanged');}_0xd291ec[_0x54aa7d(0x1bc)]({'sqlCode':_0x1afba1[_0x54aa7d(0x19d)],'sqlName':_0x1afba1[_0x54aa7d(0x1b8)],'filePath':_0x55c66c,'status':_0x23f083,'reason':_0xa62e61});}return{'method':_0x54aa7d(0x196),'url':_0x54aa7d(0x1b4),'body':{'appCode':_0x582949['appCode'],'sqlCode':_0x582949[_0x54aa7d(0x1d1)](_0x54aa7d(0x1a7))||null,'sqlName':_0x582949[_0x54aa7d(0x1d1)](_0x54aa7d(0x1c1))||null,'files':_0xd291ec},'description':'Would\x20pull\x20'+_0xd291ec['length']+_0x54aa7d(0x19e)+_0x11f92e[_0x54aa7d(0x1a2)]};},async 'execute'(_0x4238db){const _0x332a56=a253_0x4a9810,_0x367b66=loadSqlProjectConfig(_0x4238db[_0x332a56(0x1c5)]),_0x41e78a=await readSqlLockFile(_0x367b66[_0x332a56(0x198)]),{lockData:_0x3cec87,appLock:_0x2ef236}=ensureSqlLockScope(_0x41e78a??createEmptySqlLock(),_0x367b66[_0x332a56(0x1c5)],_0x367b66['sqlRoot'],_0x332a56(0x1a8)),_0xf8528f=_0x4238db['bool']('force'),_0x408235=await fetchAllSqlQueries(_0x4238db[_0x332a56(0x1c5)],{'sqlCode':_0x4238db['str'](_0x332a56(0x1a7))||undefined,'sqlName':_0x4238db['str'](_0x332a56(0x1c1))||undefined});if(_0x408235['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x332a56(0x199)};const _0x4beb3f=[],_0x13d7e9=[];for(const _0x34e155 of _0x408235){try{_0x4beb3f['push'](await ensureSqlContent(_0x34e155));}catch(_0x382875){_0x13d7e9['push']({'sqlCode':_0x34e155[_0x332a56(0x19d)],'error':_0x382875 instanceof Error?_0x382875['message']:String(_0x382875)});}}if(_0xf8528f&&!_0x4238db['nonInteractive']){let _0x4c71dd=![];for(const _0x7ed117 of _0x4beb3f){const _0x463435=detectSqlMode(ensureRemoteSqlContent(_0x7ed117)),_0x2a5b52=_0x7ed117[_0x332a56(0x1bd)]?await getDbName(_0x4238db['appCode'],Number(_0x7ed117[_0x332a56(0x1bd)]))[_0x332a56(0x1a6)](()=>undefined):undefined,_0x471f65=buildLocalSqlFileContent({'sqlCode':_0x7ed117[_0x332a56(0x19d)],'sqlName':_0x7ed117[_0x332a56(0x1b8)],'dbId':_0x7ed117[_0x332a56(0x1bd)]},ensureRemoteSqlContent(_0x7ed117),{'dbName':_0x2a5b52,'mode':_0x463435,'syncedAt':new Date()['toISOString'](),'description':_0x7ed117['description']}),_0x50f79e=resolveLocalSqlFilePath(_0x367b66,_0x7ed117[_0x332a56(0x19d)],buildSqlLockEntry(_0x7ed117,ensureRemoteSqlContent(_0x7ed117),'',{'dbName':_0x2a5b52})),_0x55337c=await findExistingSqlFiles(_0x367b66,_0x50f79e,_0x463435,_0x2ef236['sqls'][_0x7ed117[_0x332a56(0x19d)]]),_0x244c25=await compareExistingSqlFiles(_0x55337c,_0x471f65,_0x463435);if(_0x244c25[_0x332a56(0x1b1)](({equivalent:_0x53d7a2})=>!_0x53d7a2)){_0x4c71dd=!![];break;}}if(_0x4c71dd){const _0x38cf91=await confirmForceOverwrite(_0x332a56(0x1b5));if(!_0x38cf91)throw CliErrors[_0x332a56(0x1c9)](_0x332a56(0x1ac));}}const _0x2dd17f=cloneSqlLockData(_0x3cec87),_0x442b43=_0x2dd17f['apps'][_0x367b66[_0x332a56(0x1c5)]],_0x5bfde5=[],_0x39509c=[];for(const _0x274b8f of _0x4beb3f){const _0x5cb8e1=_0x442b43[_0x332a56(0x1c6)][_0x274b8f[_0x332a56(0x19d)]],_0x3e5a7c=ensureRemoteSqlContent(_0x274b8f),_0x4bba59=detectSqlMode(_0x3e5a7c),_0x46bb94=_0x274b8f['dbId']?await getDbName(_0x4238db['appCode'],Number(_0x274b8f[_0x332a56(0x1bd)]))[_0x332a56(0x1a6)](()=>undefined):undefined,_0x3f12af=buildLocalSqlFileContent({'sqlCode':_0x274b8f[_0x332a56(0x19d)],'sqlName':_0x274b8f[_0x332a56(0x1b8)],'dbId':_0x274b8f['dbId']},_0x3e5a7c,{'dbName':_0x46bb94,'mode':_0x4bba59,'syncedAt':new Date()[_0x332a56(0x19b)](),'description':_0x274b8f[_0x332a56(0x1bb)]}),_0x208978=buildSqlLockEntry(_0x274b8f,_0x3e5a7c,computeSqlContentHash(_0x3f12af),{'dbName':_0x46bb94}),_0x4f43dc=_0x208978[_0x332a56(0x1cb)],_0x2f8cc6=join(_0x367b66[_0x332a56(0x1a2)],_0x4f43dc);try{const _0x5c4436=await findExistingSqlFiles(_0x367b66,_0x2f8cc6,_0x4bba59,_0x5cb8e1),_0x4b6c60=await compareExistingSqlFiles(_0x5c4436,_0x3f12af,_0x4bba59);if(!_0xf8528f&&_0x4b6c60[_0x332a56(0x1b1)](({equivalent:_0x2b10ad})=>!_0x2b10ad)){_0x39509c[_0x332a56(0x1bc)]({'sqlCode':_0x274b8f[_0x332a56(0x19d)],'reason':_0x332a56(0x1bf)});continue;}const _0xfaa030=_0x4b6c60[_0x332a56(0x1cc)](({file:_0x513f87})=>_0x513f87[_0x332a56(0x1a1)]),_0x137005=_0x4b6c60[_0x332a56(0x1cc)](({file:_0x3ba545})=>!_0x3ba545['isCanonical']);if(_0xfaa030?.[_0x332a56(0x1d9)]&&!_0x137005){_0x39509c[_0x332a56(0x1bc)]({'sqlCode':_0x274b8f[_0x332a56(0x19d)],'reason':_0x332a56(0x1b9)}),_0x442b43[_0x332a56(0x1c6)][_0x274b8f['sqlCode']]={..._0x208978,'hash':computeSqlContentHash(_0xfaa030['content']),'path':_0x4f43dc};continue;}!_0xfaa030?.['equivalent']&&(await ensureParentDirectory(_0x2f8cc6),await writeFile(_0x2f8cc6,_0x3f12af,_0x332a56(0x1b6))),_0x137005&&await rm(_0x137005[_0x332a56(0x1b3)][_0x332a56(0x1c8)],{'force':!![]}),_0x442b43['sqls'][_0x274b8f['sqlCode']]={..._0x208978,'hash':_0xfaa030?.[_0x332a56(0x1d9)]?computeSqlContentHash(_0xfaa030[_0x332a56(0x197)]):_0x208978[_0x332a56(0x1da)],'path':_0x4f43dc},_0x5bfde5[_0x332a56(0x1bc)]({'sqlCode':_0x274b8f[_0x332a56(0x19d)],'filePath':_0x2f8cc6});}catch(_0x3e00b6){_0x13d7e9[_0x332a56(0x1bc)]({'sqlCode':_0x274b8f[_0x332a56(0x19d)],'error':_0x3e00b6 instanceof Error?_0x3e00b6[_0x332a56(0x194)]:String(_0x3e00b6)});}}return _0x442b43[_0x332a56(0x1ad)]=new Date()[_0x332a56(0x19b)](),await writeSqlLockFile(_0x367b66[_0x332a56(0x198)],_0x2dd17f),{'ok':_0x13d7e9[_0x332a56(0x1ba)]===0x0,'data':{'pulled':_0x5bfde5,'skipped':_0x39509c,'failed':_0x13d7e9},'message':_0x332a56(0x1ab)+_0x5bfde5[_0x332a56(0x1ba)]+'\x20written,\x20'+_0x39509c[_0x332a56(0x1ba)]+'\x20skipped,\x20'+_0x13d7e9[_0x332a56(0x1ba)]+_0x332a56(0x1c7)};}};function isEquivalentPulledSqlFile(_0x5bb416,_0x3cfff7,_0x5daa4d,_0x1873d6){if(_0x5daa4d!==_0x1873d6)return normalizePulledSqlBody(_0x5bb416,_0x5daa4d)===normalizePulledSqlBody(_0x3cfff7,_0x1873d6);return normalizePullComparableContent(_0x5bb416,_0x5daa4d)===normalizePullComparableContent(_0x3cfff7,_0x1873d6);}async function findExistingSqlFiles(_0x4e102f,_0x1d9bc1,_0x35bacc,_0x423cfc){const _0x181706=a253_0x4a9810,_0x44981b=[];await fileExists(_0x1d9bc1)&&_0x44981b[_0x181706(0x1bc)]({'filePath':_0x1d9bc1,'mode':_0x35bacc,'isCanonical':!![]});if(!_0x423cfc?.[_0x181706(0x1cb)])return _0x44981b;const _0x437f0f=join(_0x4e102f[_0x181706(0x1a2)],_0x423cfc[_0x181706(0x1cb)]);if(_0x437f0f===_0x1d9bc1)return _0x44981b;return await fileExists(_0x437f0f)&&_0x44981b[_0x181706(0x1bc)]({'filePath':_0x437f0f,'mode':_0x423cfc['mode']??modeFromFilePath(_0x437f0f),'isCanonical':![]}),_0x44981b;}async function compareExistingSqlFiles(_0x1b00d9,_0x25c19d,_0x3d4e6a){return Promise['all'](_0x1b00d9['map'](async _0x271fff=>{const _0x2da366=a253_0x5b6e,_0x3d101a=await readFile(_0x271fff[_0x2da366(0x1c8)],_0x2da366(0x1b6));return{'file':_0x271fff,'content':_0x3d101a,'equivalent':isEquivalentPulledSqlFile(_0x3d101a,_0x25c19d,_0x271fff[_0x2da366(0x1d5)],_0x3d4e6a)};}));}function modeFromFilePath(_0x5f27c7){const _0x536711=a253_0x4a9810;return _0x5f27c7[_0x536711(0x1d4)]()['endsWith'](_0x536711(0x1d7))?_0x536711(0x19c):_0x536711(0x1ce);}function normalizePulledSqlBody(_0x32c8d6,_0x55557f){const _0x1feec6=a253_0x4a9810;return stripLocalSqlMetadata(_0x32c8d6,_0x55557f)['replace'](/\r\n/g,'\x0a')[_0x1feec6(0x195)]();}function normalizePullComparableContent(_0x31ab57,_0xd375cc){const _0x3b65ad=a253_0x4a9810,_0x4ec8fd=_0x31ab57[_0x3b65ad(0x1d2)](/\r\n/g,'\x0a')['split']('\x0a'),_0x58f827=_0x4ec8fd[_0x3b65ad(0x1a4)](_0x1c2437=>!isSyncedAtMetadataLine(_0x1c2437,_0xd375cc));return _0x58f827[_0x3b65ad(0x1d6)]('\x0a');}function isSyncedAtMetadataLine(_0x19e0a7,_0x4d88b6){const _0x15e26f=a253_0x4a9810;if(_0x4d88b6==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x15e26f(0x1b2)](_0x19e0a7);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x15e26f(0x1b2)](_0x19e0a7);}
1
+ const a253_0x45e837=a253_0x4729;(function(_0x2251ca,_0x5a2176){const _0x72d556=a253_0x4729,_0x1bbb30=_0x2251ca();while(!![]){try{const _0x38bb27=-parseInt(_0x72d556(0x205))/0x1*(parseInt(_0x72d556(0x1e3))/0x2)+parseInt(_0x72d556(0x1e9))/0x3+parseInt(_0x72d556(0x1d9))/0x4*(-parseInt(_0x72d556(0x1fe))/0x5)+parseInt(_0x72d556(0x1fb))/0x6*(-parseInt(_0x72d556(0x1c2))/0x7)+parseInt(_0x72d556(0x1d6))/0x8+-parseInt(_0x72d556(0x1c3))/0x9*(parseInt(_0x72d556(0x1c7))/0xa)+parseInt(_0x72d556(0x1f2))/0xb;if(_0x38bb27===_0x5a2176)break;else _0x1bbb30['push'](_0x1bbb30['shift']());}catch(_0x5d9f74){_0x1bbb30['push'](_0x1bbb30['shift']());}}}(a253_0xd133,0xc7e68));function a253_0xd133(){const _0x5e6d45=['387FUDXEi','Force\x20overwrite\x20local\x20unsynced\x20changes','filter','map','357950goFFbg','paging','Filter\x20by\x20SQL\x20display\x20name','split','No\x20remote\x20SQL\x20queries\x20matched.','toISOString','utf8','sqlRoot','some','\x20SQL\x20file(s)\x20into\x20','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','filePath','conflict','skipped','Pull\x20complete:\x20','12557640bsVggT','all','sqlCode','12nFzrwk','equivalent','pull','Would\x20pull\x20','sql','would_pull','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqls','sqlcode','tableData','1578lxDqfF','push','test','catch','description','\x20skipped,\x20','2736924hplCAR','replace','str','sqlName','\x20failed','nonInteractive','.xml','totalCount','sqlRootDir','7951174zOqjff','find','file','path','length','boolean','sqlContent','mode','mybatisXml','135060DnWlGO','message','force','132095svaYMs','\x20written,\x20','unchanged','isCanonical','string','POST','lockFilePath','117rCCNFl','dbId','hash','content','appCode','cancelled','join','read','name','210iORJJZ'];a253_0xd133=function(){return _0x5e6d45;};return a253_0xd133();}import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';function a253_0x4729(_0x266638,_0x1159be){_0x266638=_0x266638-0x1bc;const _0xd13358=a253_0xd133();let _0x4729a5=_0xd13358[_0x266638];return _0x4729a5;}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x442961,_0x1731cb){const _0x5c59a8=a253_0x4729,_0x271dae=[];let _0x50d2ce=0x1;while(!![]){const _0x382ce3=await listSqlQueries(_0x442961,{'currentPage':_0x50d2ce,'pageSize':PAGE_SIZE,'sqlCode':_0x1731cb['sqlCode'],'sqlName':_0x1731cb[_0x5c59a8(0x1ec)]}),_0x39c32e=_0x382ce3[_0x5c59a8(0x1e2)]??[];_0x271dae[_0x5c59a8(0x1e4)](..._0x39c32e);if(_0x39c32e['length']===0x0)break;const _0xd0274d=_0x382ce3[_0x5c59a8(0x1c8)]?.[_0x5c59a8(0x1f0)];if(_0xd0274d!=null?_0x271dae[_0x5c59a8(0x1f6)]>=_0xd0274d:_0x39c32e[_0x5c59a8(0x1f6)]<PAGE_SIZE)break;_0x50d2ce++;}return _0x271dae;}async function ensureSqlContent(_0x3fd441){const _0x896c2a=a253_0x4729;if(_0x3fd441[_0x896c2a(0x1f8)]!=null&&String(_0x3fd441['sqlContent'])[_0x896c2a(0x1f6)]>0x0)return _0x3fd441;return getSqlQueryDetail(_0x3fd441[_0x896c2a(0x1d8)]);}export const sqlPull={'service':'sql','command':a253_0x45e837(0x1db),'description':a253_0x45e837(0x1df),'risk':a253_0x45e837(0x1c0),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x45e837(0x1c1),'type':a253_0x45e837(0x202),'description':a253_0x45e837(0x1c9)},{'name':a253_0x45e837(0x1fd),'type':a253_0x45e837(0x1f7),'description':a253_0x45e837(0x1c4)}],async 'dryRun'(_0x16a970){const _0x439c2b=a253_0x45e837,_0x4b4ab3=loadSqlProjectConfig(_0x16a970['appCode']),_0x39347f=await readSqlLockFile(_0x4b4ab3['lockFilePath']),{appLock:_0x22828d}=ensureSqlLockScope(_0x39347f??createEmptySqlLock(),_0x4b4ab3[_0x439c2b(0x1bd)],_0x4b4ab3[_0x439c2b(0x1ce)],_0x439c2b(0x1db)),_0x448ce6=await fetchAllSqlQueries(_0x16a970[_0x439c2b(0x1bd)],{'sqlCode':_0x16a970[_0x439c2b(0x1eb)](_0x439c2b(0x1e1))||undefined,'sqlName':_0x16a970['str'](_0x439c2b(0x1c1))||undefined}),_0xb39782=[];for(const _0x41526b of _0x448ce6){const _0x470a44=await ensureSqlContent(_0x41526b),_0x55f11a=ensureRemoteSqlContent(_0x470a44),_0x39634c=detectSqlMode(_0x55f11a),_0x5472a0=_0x470a44[_0x439c2b(0x206)]?await getDbName(_0x16a970['appCode'],Number(_0x470a44[_0x439c2b(0x206)]))[_0x439c2b(0x1e6)](()=>undefined):undefined,_0x52931e=buildLocalSqlFileContent({'sqlCode':_0x470a44[_0x439c2b(0x1d8)],'sqlName':_0x470a44[_0x439c2b(0x1ec)],'dbId':_0x470a44['dbId']},_0x55f11a,{'dbName':_0x5472a0,'mode':_0x39634c,'syncedAt':new Date()['toISOString'](),'description':_0x470a44['description']}),_0x14e16c=buildSqlLockEntry(_0x470a44,_0x55f11a,'',{'dbName':_0x5472a0}),_0x1f3ecb=resolveLocalSqlFilePath(_0x4b4ab3,_0x470a44[_0x439c2b(0x1d8)],_0x14e16c);let _0x35fbe8=_0x439c2b(0x1de),_0x5bcb86;const _0x12db4c=await findExistingSqlFiles(_0x4b4ab3,_0x1f3ecb,_0x39634c,_0x22828d['sqls'][_0x470a44[_0x439c2b(0x1d8)]]);if(_0x12db4c[_0x439c2b(0x1f6)]>0x0){const _0x4e1eb1=await compareExistingSqlFiles(_0x12db4c,_0x52931e,_0x39634c);if(_0x4e1eb1[_0x439c2b(0x1cf)](({equivalent:_0x5b54d5})=>!_0x5b54d5))_0x35fbe8=_0x439c2b(0x1d3),_0x5bcb86='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)';else _0x4e1eb1[_0x439c2b(0x1f6)]===0x1&&_0x4e1eb1[0x0]?.[_0x439c2b(0x1f4)][_0x439c2b(0x201)]&&(_0x35fbe8=_0x439c2b(0x1d4),_0x5bcb86=_0x439c2b(0x200));}_0xb39782[_0x439c2b(0x1e4)]({'sqlCode':_0x470a44[_0x439c2b(0x1d8)],'sqlName':_0x470a44['sqlName'],'filePath':_0x1f3ecb,'status':_0x35fbe8,'reason':_0x5bcb86});}return{'method':_0x439c2b(0x203),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x16a970[_0x439c2b(0x1bd)],'sqlCode':_0x16a970['str'](_0x439c2b(0x1e1))||null,'sqlName':_0x16a970[_0x439c2b(0x1eb)](_0x439c2b(0x1c1))||null,'files':_0xb39782},'description':_0x439c2b(0x1dc)+_0xb39782[_0x439c2b(0x1f6)]+_0x439c2b(0x1d0)+_0x4b4ab3[_0x439c2b(0x1f1)]};},async 'execute'(_0x401e46){const _0x31a170=a253_0x45e837,_0x49c765=loadSqlProjectConfig(_0x401e46[_0x31a170(0x1bd)]),_0x54e331=await readSqlLockFile(_0x49c765[_0x31a170(0x204)]),{lockData:_0x848df,appLock:_0x27c70c}=ensureSqlLockScope(_0x54e331??createEmptySqlLock(),_0x49c765['appCode'],_0x49c765['sqlRoot'],_0x31a170(0x1db)),_0x2b1c22=_0x401e46['bool']('force'),_0xfb8191=await fetchAllSqlQueries(_0x401e46[_0x31a170(0x1bd)],{'sqlCode':_0x401e46['str'](_0x31a170(0x1e1))||undefined,'sqlName':_0x401e46[_0x31a170(0x1eb)]('name')||undefined});if(_0xfb8191[_0x31a170(0x1f6)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x31a170(0x1cb)};const _0x2ba31e=[],_0x4d3fff=[];for(const _0x5a4196 of _0xfb8191){try{_0x2ba31e[_0x31a170(0x1e4)](await ensureSqlContent(_0x5a4196));}catch(_0x20f1b8){_0x4d3fff['push']({'sqlCode':_0x5a4196['sqlCode'],'error':_0x20f1b8 instanceof Error?_0x20f1b8['message']:String(_0x20f1b8)});}}if(_0x2b1c22&&!_0x401e46[_0x31a170(0x1ee)]){let _0x508699=![];for(const _0x146ae9 of _0x2ba31e){const _0x1ded8c=detectSqlMode(ensureRemoteSqlContent(_0x146ae9)),_0x3d149e=_0x146ae9['dbId']?await getDbName(_0x401e46[_0x31a170(0x1bd)],Number(_0x146ae9[_0x31a170(0x206)]))[_0x31a170(0x1e6)](()=>undefined):undefined,_0x30e73d=buildLocalSqlFileContent({'sqlCode':_0x146ae9[_0x31a170(0x1d8)],'sqlName':_0x146ae9['sqlName'],'dbId':_0x146ae9['dbId']},ensureRemoteSqlContent(_0x146ae9),{'dbName':_0x3d149e,'mode':_0x1ded8c,'syncedAt':new Date()[_0x31a170(0x1cc)](),'description':_0x146ae9[_0x31a170(0x1e7)]}),_0x4c2702=resolveLocalSqlFilePath(_0x49c765,_0x146ae9[_0x31a170(0x1d8)],buildSqlLockEntry(_0x146ae9,ensureRemoteSqlContent(_0x146ae9),'',{'dbName':_0x3d149e})),_0x589fe9=await findExistingSqlFiles(_0x49c765,_0x4c2702,_0x1ded8c,_0x27c70c[_0x31a170(0x1e0)][_0x146ae9[_0x31a170(0x1d8)]]),_0x40517e=await compareExistingSqlFiles(_0x589fe9,_0x30e73d,_0x1ded8c);if(_0x40517e['some'](({equivalent:_0xe2769b})=>!_0xe2769b)){_0x508699=!![];break;}}if(_0x508699){const _0xaa7732=await confirmForceOverwrite(_0x31a170(0x1d1));if(!_0xaa7732)throw CliErrors[_0x31a170(0x1be)]('Force\x20pull\x20cancelled.');}}const _0x4313dd=cloneSqlLockData(_0x848df),_0x3f445e=_0x4313dd['apps'][_0x49c765['appCode']],_0x593e16=[],_0x221499=[];for(const _0x1471f4 of _0x2ba31e){const _0x39fd49=_0x3f445e[_0x31a170(0x1e0)][_0x1471f4[_0x31a170(0x1d8)]],_0x52b7bd=ensureRemoteSqlContent(_0x1471f4),_0x5ce21f=detectSqlMode(_0x52b7bd),_0x24a34d=_0x1471f4[_0x31a170(0x206)]?await getDbName(_0x401e46[_0x31a170(0x1bd)],Number(_0x1471f4[_0x31a170(0x206)]))[_0x31a170(0x1e6)](()=>undefined):undefined,_0x383412=buildLocalSqlFileContent({'sqlCode':_0x1471f4[_0x31a170(0x1d8)],'sqlName':_0x1471f4[_0x31a170(0x1ec)],'dbId':_0x1471f4['dbId']},_0x52b7bd,{'dbName':_0x24a34d,'mode':_0x5ce21f,'syncedAt':new Date()[_0x31a170(0x1cc)](),'description':_0x1471f4[_0x31a170(0x1e7)]}),_0x49cdb1=buildSqlLockEntry(_0x1471f4,_0x52b7bd,computeSqlContentHash(_0x383412),{'dbName':_0x24a34d}),_0x375e19=_0x49cdb1[_0x31a170(0x1f5)],_0x2302ce=join(_0x49c765[_0x31a170(0x1f1)],_0x375e19);try{const _0x5037b3=await findExistingSqlFiles(_0x49c765,_0x2302ce,_0x5ce21f,_0x39fd49),_0xc065a9=await compareExistingSqlFiles(_0x5037b3,_0x383412,_0x5ce21f);if(!_0x2b1c22&&_0xc065a9['some'](({equivalent:_0x50bba7})=>!_0x50bba7)){_0x221499[_0x31a170(0x1e4)]({'sqlCode':_0x1471f4[_0x31a170(0x1d8)],'reason':'local\x20differs\x20from\x20remote'});continue;}const _0x5d0a38=_0xc065a9[_0x31a170(0x1f3)](({file:_0xf784a6})=>_0xf784a6['isCanonical']),_0x596852=_0xc065a9[_0x31a170(0x1f3)](({file:_0x1185bd})=>!_0x1185bd['isCanonical']);if(_0x5d0a38?.[_0x31a170(0x1da)]&&!_0x596852){_0x221499[_0x31a170(0x1e4)]({'sqlCode':_0x1471f4[_0x31a170(0x1d8)],'reason':_0x31a170(0x200)}),_0x3f445e[_0x31a170(0x1e0)][_0x1471f4[_0x31a170(0x1d8)]]={..._0x49cdb1,'hash':computeSqlContentHash(_0x5d0a38[_0x31a170(0x1bc)]),'path':_0x375e19};continue;}!_0x5d0a38?.['equivalent']&&(await ensureParentDirectory(_0x2302ce),await writeFile(_0x2302ce,_0x383412,_0x31a170(0x1cd))),_0x596852&&await rm(_0x596852[_0x31a170(0x1f4)]['filePath'],{'force':!![]}),_0x3f445e[_0x31a170(0x1e0)][_0x1471f4['sqlCode']]={..._0x49cdb1,'hash':_0x5d0a38?.[_0x31a170(0x1da)]?computeSqlContentHash(_0x5d0a38[_0x31a170(0x1bc)]):_0x49cdb1[_0x31a170(0x207)],'path':_0x375e19},_0x593e16[_0x31a170(0x1e4)]({'sqlCode':_0x1471f4[_0x31a170(0x1d8)],'filePath':_0x2302ce});}catch(_0x289a6d){_0x4d3fff[_0x31a170(0x1e4)]({'sqlCode':_0x1471f4[_0x31a170(0x1d8)],'error':_0x289a6d instanceof Error?_0x289a6d[_0x31a170(0x1fc)]:String(_0x289a6d)});}}return _0x3f445e['lastSync']=new Date()[_0x31a170(0x1cc)](),await writeSqlLockFile(_0x49c765[_0x31a170(0x204)],_0x4313dd),{'ok':_0x4d3fff[_0x31a170(0x1f6)]===0x0,'data':{'pulled':_0x593e16,'skipped':_0x221499,'failed':_0x4d3fff},'message':_0x31a170(0x1d5)+_0x593e16[_0x31a170(0x1f6)]+_0x31a170(0x1ff)+_0x221499[_0x31a170(0x1f6)]+_0x31a170(0x1e8)+_0x4d3fff[_0x31a170(0x1f6)]+_0x31a170(0x1ed)};}};function isEquivalentPulledSqlFile(_0xffc9f4,_0x3b36e8,_0x133f38,_0x34392b){if(_0x133f38!==_0x34392b)return normalizePulledSqlBody(_0xffc9f4,_0x133f38)===normalizePulledSqlBody(_0x3b36e8,_0x34392b);return normalizePullComparableContent(_0xffc9f4,_0x133f38)===normalizePullComparableContent(_0x3b36e8,_0x34392b);}async function findExistingSqlFiles(_0x5b5da0,_0x40a1d9,_0x2eb291,_0x464531){const _0x16a416=a253_0x45e837,_0x3e201c=[];await fileExists(_0x40a1d9)&&_0x3e201c[_0x16a416(0x1e4)]({'filePath':_0x40a1d9,'mode':_0x2eb291,'isCanonical':!![]});if(!_0x464531?.[_0x16a416(0x1f5)])return _0x3e201c;const _0x3ceea7=join(_0x5b5da0[_0x16a416(0x1f1)],_0x464531[_0x16a416(0x1f5)]);if(_0x3ceea7===_0x40a1d9)return _0x3e201c;return await fileExists(_0x3ceea7)&&_0x3e201c[_0x16a416(0x1e4)]({'filePath':_0x3ceea7,'mode':_0x464531[_0x16a416(0x1f9)]??modeFromFilePath(_0x3ceea7),'isCanonical':![]}),_0x3e201c;}async function compareExistingSqlFiles(_0xb3738c,_0x5e8cb3,_0x5b3da9){const _0x5ad54c=a253_0x45e837;return Promise[_0x5ad54c(0x1d7)](_0xb3738c[_0x5ad54c(0x1c6)](async _0x365429=>{const _0xef890b=_0x5ad54c,_0x547035=await readFile(_0x365429[_0xef890b(0x1d2)],_0xef890b(0x1cd));return{'file':_0x365429,'content':_0x547035,'equivalent':isEquivalentPulledSqlFile(_0x547035,_0x5e8cb3,_0x365429[_0xef890b(0x1f9)],_0x5b3da9)};}));}function modeFromFilePath(_0x4d05b6){const _0x2ae7a7=a253_0x45e837;return _0x4d05b6['toLowerCase']()['endsWith'](_0x2ae7a7(0x1ef))?'mybatisXml':_0x2ae7a7(0x1dd);}function normalizePulledSqlBody(_0x39ad05,_0x435bb5){return stripLocalSqlMetadata(_0x39ad05,_0x435bb5)['replace'](/\r\n/g,'\x0a')['trim']();}function normalizePullComparableContent(_0x7220a6,_0x4e812b){const _0x59d89e=a253_0x45e837,_0x395816=_0x7220a6[_0x59d89e(0x1ea)](/\r\n/g,'\x0a')[_0x59d89e(0x1ca)]('\x0a'),_0x51a69a=_0x395816[_0x59d89e(0x1c5)](_0x57e798=>!isSyncedAtMetadataLine(_0x57e798,_0x4e812b));return _0x51a69a[_0x59d89e(0x1bf)]('\x0a');}function isSyncedAtMetadataLine(_0x10ed7,_0x423bef){const _0x2a1b5a=a253_0x45e837;if(_0x423bef===_0x2a1b5a(0x1fa))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x2a1b5a(0x1e5)](_0x10ed7);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x2a1b5a(0x1e5)](_0x10ed7);}
@@ -1 +1 @@
1
- const a254_0x3b7f8e=a254_0x125c;(function(_0x433bd9,_0x1fb3a5){const _0x2bcc0d=a254_0x125c,_0x36cafa=_0x433bd9();while(!![]){try{const _0x113554=parseInt(_0x2bcc0d(0xc2))/0x1*(-parseInt(_0x2bcc0d(0x91))/0x2)+parseInt(_0x2bcc0d(0x97))/0x3+-parseInt(_0x2bcc0d(0xa7))/0x4+-parseInt(_0x2bcc0d(0xc1))/0x5+-parseInt(_0x2bcc0d(0xa2))/0x6+-parseInt(_0x2bcc0d(0xb6))/0x7+parseInt(_0x2bcc0d(0x96))/0x8;if(_0x113554===_0x1fb3a5)break;else _0x36cafa['push'](_0x36cafa['shift']());}catch(_0x5dd1c2){_0x36cafa['push'](_0x36cafa['shift']());}}}(a254_0x58b2,0x36e1b));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a254_0x125c(_0x5741cc,_0x4570c0){_0x5741cc=_0x5741cc-0x83;const _0x58b201=a254_0x58b2();let _0x125c77=_0x58b201[_0x5741cc];return _0x125c77;}import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a254_0x58b2(){const _0x56c302=['\x20pushed,\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','dbName','hash','Local\x20SQL\x20not\x20found:\x20','toISOString','trim','filter','Push\x20local\x20SQL\x20files\x20to\x20remote','sqls','bool','sqlRoot','6bXXPSz',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','has','length','validation','6060656SZJOWO','1182798sPpGDR','sqlConfig','appCode','sqlCode','remoteId','force','version','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','\x20failed','lockFilePath','sqlRootDir','1885878ilkDem','mode','startsWith','projectRoot','write','1587744JmMCDm','No\x20database\x20matches\x20local\x20directory\x20\x22','lastSync','Would\x20push\x20','relativePath','unchanged','boolean','set',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','get','sqlName','\x20SQL\x20file(s)','message','dbId','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','855596udwUxz','isFinite','replace','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first',':\x20SQL\x20content\x20is\x20empty.','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','No\x20local\x20SQL\x20files\x20found.','path','catch','str','sql','279495EaucgJ','12559iOmpjT','push','entries','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','filePath'];a254_0x58b2=function(){return _0x56c302;};return a254_0x58b2();}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(_0x422f87){const _0x204f97=a254_0x125c,_0x1df030=stripLocalSqlMetadata(await readFile(_0x422f87[_0x204f97(0x84)],'utf8'),_0x422f87[_0x204f97(0xa3)]);if(!_0x1df030[_0x204f97(0x8b)]())throw CliErrors[_0x204f97(0x95)](_0x422f87['sqlCode']+_0x204f97(0xba));return _0x1df030;}async function getTargetSqlQueries(_0x5ca594,_0x2c3085,_0x1554de){const _0x189f0e=a254_0x125c,_0x4068c1=await scanLocalSqlQueries(_0x5ca594),_0x2a589e=new Map();for(const _0x4decbe of _0x4068c1){if(_0x1554de&&_0x4decbe[_0x189f0e(0x9a)]!==_0x1554de)continue;const _0x258f0c=_0x2a589e[_0x189f0e(0xb0)](_0x4decbe['sqlCode'])??[];_0x258f0c[_0x189f0e(0xc3)](_0x4decbe),_0x2a589e[_0x189f0e(0xae)](_0x4decbe[_0x189f0e(0x9a)],_0x258f0c);}if(_0x1554de&&!_0x2a589e[_0x189f0e(0x93)](_0x1554de))throw CliErrors['validation'](_0x189f0e(0x89)+_0x1554de);const _0x58ad44=[];for(const [_0x28955f,_0x2340fc]of _0x2a589e[_0x189f0e(0xc4)]()){if(_0x2340fc[_0x189f0e(0x94)]===0x1){_0x58ad44[_0x189f0e(0xc3)](_0x2340fc[0x0]);continue;}const _0x4b66a6=_0x2c3085[_0x189f0e(0x8e)][_0x28955f],_0x3b6f0d=_0x4b66a6?.[_0x189f0e(0xbd)],_0xc501ed=_0x3b6f0d?_0x2340fc[_0x189f0e(0x8c)](_0x27e244=>_0x27e244['relativePath']!==_0x3b6f0d):_0x2340fc;if(_0x4b66a6&&_0xc501ed[_0x189f0e(0x94)]===0x1){_0x58ad44[_0x189f0e(0xc3)](_0xc501ed[0x0]);continue;}throw CliErrors[_0x189f0e(0x95)](_0x189f0e(0x83)+_0x28955f+_0x189f0e(0x86));}return _0x58ad44;}export const sqlPush={'service':a254_0x3b7f8e(0xc0),'command':'push','description':a254_0x3b7f8e(0x8d),'risk':a254_0x3b7f8e(0xa6),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a254_0x3b7f8e(0xad),'description':a254_0x3b7f8e(0xbb)}],async 'dryRun'(_0x111b19){const _0x3daa2d=a254_0x3b7f8e,_0xd2717b=loadSqlProjectConfig(_0x111b19[_0x3daa2d(0x99)]),_0x91d3d8=await readSqlLockFile(_0xd2717b[_0x3daa2d(0xa0)]),{appLock:_0x52aac0}=ensureSqlLockScope(_0x91d3d8??createEmptySqlLock(),_0x111b19['appCode'],_0xd2717b[_0x3daa2d(0x90)],_0x3daa2d(0xc3)),_0x4c0f95=await getTargetSqlQueries(_0xd2717b,_0x52aac0,_0x111b19[_0x3daa2d(0xbf)]('sqlcode')||undefined),_0x363625=[];for(const _0x1ade64 of _0x4c0f95){const _0x3a255e=await computeSqlFileHash(_0x1ade64[_0x3daa2d(0x84)]),_0x4a732b=_0x52aac0[_0x3daa2d(0x8e)][_0x1ade64[_0x3daa2d(0x9a)]],_0x14f69e=!!_0x4a732b&&(_0x4a732b[_0x3daa2d(0xbd)]!==_0x1ade64[_0x3daa2d(0xab)]||!!_0x1ade64[_0x3daa2d(0xb1)]&&_0x4a732b['sqlName']!==_0x1ade64['sqlName']||_0x4a732b[_0x3daa2d(0xa3)]!==_0x1ade64[_0x3daa2d(0xa3)]);if(!_0x111b19[_0x3daa2d(0x8f)](_0x3daa2d(0x9c))&&_0x4a732b&&_0x4a732b[_0x3daa2d(0x88)]===_0x3a255e&&!_0x14f69e)continue;if(!_0x4a732b)throw CliErrors[_0x3daa2d(0x95)](_0x1ade64[_0x3daa2d(0x9a)]+_0x3daa2d(0x92));if(_0x4a732b[_0x3daa2d(0x9d)]==null)throw CliErrors[_0x3daa2d(0x95)](_0x1ade64[_0x3daa2d(0x9a)]+_0x3daa2d(0xaf));await resolveTargetDbBinding(_0x111b19[_0x3daa2d(0x99)],_0x1ade64,_0x4a732b),await readSqlUploadContent(_0x1ade64),_0x363625[_0x3daa2d(0xc3)](_0x1ade64['sqlCode']);}return{'method':'POST','url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x363625,'appCode':_0x111b19[_0x3daa2d(0x99)]},'description':_0x3daa2d(0xaa)+_0x363625[_0x3daa2d(0x94)]+_0x3daa2d(0xb2)};},async 'execute'(_0x211f1b){const _0x19b6da=a254_0x3b7f8e,_0x2d0f56=loadSqlProjectConfig(_0x211f1b[_0x19b6da(0x99)]),_0x462e6d=await readSqlLockFile(_0x2d0f56['lockFilePath']),{lockData:_0x19f285,appLock:_0x36b8d3}=ensureSqlLockScope(_0x462e6d??createEmptySqlLock(),_0x211f1b[_0x19b6da(0x99)],_0x2d0f56[_0x19b6da(0x90)],_0x19b6da(0xc3)),_0x3c5f68=await getTargetSqlQueries(_0x2d0f56,_0x36b8d3,_0x211f1b[_0x19b6da(0xbf)]('sqlcode')||undefined);if(_0x3c5f68['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x19b6da(0xbc)};const _0x2c2823=[],_0x3d8dd6=[],_0x5aeedb=[];let _0x1b5961=![];for(const _0x379d01 of _0x3c5f68){const _0x9e068d=_0x36b8d3['sqls'][_0x379d01[_0x19b6da(0x9a)]];if(!_0x9e068d){_0x5aeedb['push']({'sqlCode':_0x379d01[_0x19b6da(0x9a)],'error':_0x19b6da(0x9e)});continue;}try{const _0x4cedc2=await computeSqlFileHash(_0x379d01['filePath']),_0x5f3d36=_0x9e068d[_0x19b6da(0xbd)]!==_0x379d01['relativePath']||!!_0x379d01[_0x19b6da(0xb1)]&&_0x9e068d[_0x19b6da(0xb1)]!==_0x379d01['sqlName']||_0x9e068d['mode']!==_0x379d01['mode'];if(!_0x211f1b[_0x19b6da(0x8f)](_0x19b6da(0x9c))&&_0x9e068d[_0x19b6da(0x88)]===_0x4cedc2&&!_0x5f3d36){_0x3d8dd6[_0x19b6da(0xc3)]({'sqlCode':_0x379d01[_0x19b6da(0x9a)],'reason':_0x19b6da(0xac)});continue;}if(_0x9e068d[_0x19b6da(0x9d)]==null){_0x5aeedb['push']({'sqlCode':_0x379d01[_0x19b6da(0x9a)],'error':_0x19b6da(0xb9)});continue;}const _0x248bf3=_0x379d01[_0x19b6da(0xb1)]||_0x9e068d[_0x19b6da(0xb1)],_0x3c834f=await resolveTargetDbBinding(_0x211f1b['appCode'],_0x379d01,_0x9e068d),_0x3c0882=await readSqlUploadContent(_0x379d01),_0x2976b8=await updateSqlQuery({'id':_0x9e068d[_0x19b6da(0x9b)],'appCode':_0x211f1b[_0x19b6da(0x99)],'sqlCode':_0x379d01[_0x19b6da(0x9a)],'sqlName':_0x248bf3,'dbId':_0x3c834f[_0x19b6da(0xb4)],'version':_0x9e068d['version'],'sqlContent':_0x3c0882,'sqlConfig':_0x9e068d[_0x19b6da(0x98)]??undefined}),_0x284aed=_0x2976b8['dbId']?await getDbName(_0x211f1b[_0x19b6da(0x99)],Number(_0x2976b8[_0x19b6da(0xb4)]))[_0x19b6da(0xbe)](()=>_0x3c834f[_0x19b6da(0x87)]):_0x3c834f[_0x19b6da(0x87)];_0x36b8d3[_0x19b6da(0x8e)][_0x379d01['sqlCode']]={...buildSqlLockEntry(_0x2976b8,_0x3c0882,_0x4cedc2,{'dbName':_0x284aed}),'path':_0x379d01['relativePath'],'mode':_0x379d01['mode']},_0x1b5961=!![],await archivePreviousSqlFileIfNeeded(_0x2d0f56,_0x9e068d['path'],_0x379d01[_0x19b6da(0xab)]),_0x2c2823[_0x19b6da(0xc3)]({'sqlCode':_0x379d01[_0x19b6da(0x9a)],'remoteId':_0x9e068d['remoteId']});}catch(_0x199695){_0x5aeedb['push']({'sqlCode':_0x379d01[_0x19b6da(0x9a)],'error':_0x199695 instanceof Error?_0x199695[_0x19b6da(0xb3)]:String(_0x199695)});}}(_0x1b5961||_0x5aeedb[_0x19b6da(0x94)]===0x0)&&(_0x36b8d3[_0x19b6da(0xa9)]=new Date()['toISOString'](),await writeSqlLockFile(_0x2d0f56[_0x19b6da(0xa0)],_0x19f285));const _0x362952=_0x5aeedb[_0x19b6da(0x94)]===0x0;return{'ok':_0x362952,'data':{'pushed':_0x2c2823,'skipped':_0x3d8dd6,'failed':_0x5aeedb},'message':'Push\x20complete:\x20'+_0x2c2823[_0x19b6da(0x94)]+_0x19b6da(0x85)+_0x3d8dd6['length']+'\x20skipped,\x20'+_0x5aeedb[_0x19b6da(0x94)]+_0x19b6da(0x9f)};}};async function archivePreviousSqlFileIfNeeded(_0x58b4d1,_0x35869d,_0x17bc8f){const _0x417c0b=a254_0x3b7f8e;if(!_0x35869d||_0x35869d===_0x17bc8f)return;const _0x47b15f=join(_0x58b4d1[_0x417c0b(0xa1)],_0x35869d);if(!await fileExists(_0x47b15f))return;const _0x5eefb8=await moveToTrash(_0x58b4d1[_0x417c0b(0xa5)],_0x58b4d1['trashDir'],_0x47b15f);await cleanupEmptyDirectories(dirname(_0x47b15f),_0x58b4d1[_0x417c0b(0xa1)]),void _0x5eefb8;}async function moveToTrash(_0x286484,_0x50513e,_0x5e6d93){const _0x1832d4=a254_0x3b7f8e,_0x53b093=new Date()[_0x1832d4(0x8a)]()[_0x1832d4(0xb8)](/[:.]/g,'-'),_0x44d2f7=relative(_0x286484,_0x5e6d93),_0x2550ad=join(_0x50513e,_0x53b093,_0x44d2f7);return await mkdir(dirname(_0x2550ad),{'recursive':!![]}),await rename(_0x5e6d93,_0x2550ad),_0x2550ad;}async function cleanupEmptyDirectories(_0x589054,_0x3e05f4){const _0x1ef57b=a254_0x3b7f8e;let _0x13d3e3=resolve(_0x589054);const _0x3b8d38=resolve(_0x3e05f4);while(_0x13d3e3[_0x1ef57b(0xa4)](''+_0x3b8d38+sep)||_0x13d3e3===_0x3b8d38){if(_0x13d3e3===_0x3b8d38)return;try{const _0xa86a1f=await readdir(_0x13d3e3);if(_0xa86a1f[_0x1ef57b(0x94)]>0x0)return;await rmdir(_0x13d3e3);}catch{return;}_0x13d3e3=dirname(_0x13d3e3);}}async function resolveTargetDbBinding(_0x5479ec,_0xd8166c,_0x2133b7){const _0x1489e4=a254_0x3b7f8e,_0x3450b6=_0xd8166c['dbDirectory'];if(!_0x3450b6)return{'dbId':_0x2133b7[_0x1489e4(0xb4)],'dbName':_0x2133b7[_0x1489e4(0x87)]};const _0x3f9d5f=buildDbDirectoryName(_0x2133b7[_0x1489e4(0x87)],_0x2133b7['dbId']);if(_0x3450b6===_0x3f9d5f)return{'dbId':_0x2133b7[_0x1489e4(0xb4)],'dbName':_0x2133b7[_0x1489e4(0x87)]};const _0x48c36f=parseExplicitDbDirectory(_0x3450b6);if(_0x48c36f!=null)return{'dbId':_0x48c36f,'dbName':await getDbName(_0x5479ec,_0x48c36f)[_0x1489e4(0xbe)](()=>undefined)};const _0x1fd432=await listDatabases(_0x5479ec),_0x23b442=_0x1fd432[_0x1489e4(0x8c)](_0x36a9aa=>buildDbDirectoryName(_0x36a9aa[_0x1489e4(0x87)],_0x36a9aa[_0x1489e4(0xb4)])===_0x3450b6);if(_0x23b442[_0x1489e4(0x94)]===0x1)return{'dbId':_0x23b442[0x0]['dbId'],'dbName':_0x23b442[0x0]['dbName']};if(_0x23b442[_0x1489e4(0x94)]===0x0)throw CliErrors[_0x1489e4(0x95)](_0x1489e4(0xa8)+_0x3450b6+'\x22\x20for\x20sqlCode\x20'+_0xd8166c[_0x1489e4(0x9a)]+'.');const _0x1171ca=_0x23b442['map'](_0x1a90c9=>_0x1a90c9[_0x1489e4(0x87)]+'\x20('+_0x1a90c9['dbId']+')')['join'](',\x20');throw CliErrors[_0x1489e4(0x95)]('Local\x20directory\x20\x22'+_0x3450b6+_0x1489e4(0xb5)+_0xd8166c['sqlCode']+':\x20'+_0x1171ca);}function parseExplicitDbDirectory(_0x38b497){const _0x3972a0=a254_0x3b7f8e,_0x280042=/^db-(\d+)$/['exec'](_0x38b497);if(!_0x280042)return null;const _0x24678d=Number(_0x280042[0x1]);return Number[_0x3972a0(0xb7)](_0x24678d)&&_0x24678d>0x0?_0x24678d:null;}
1
+ const a254_0x3ddd04=a254_0x4124;(function(_0x47b576,_0xd95e1c){const _0x167919=a254_0x4124,_0x37ff54=_0x47b576();while(!![]){try{const _0x1a80fe=parseInt(_0x167919(0x11c))/0x1+parseInt(_0x167919(0x130))/0x2+-parseInt(_0x167919(0x143))/0x3+-parseInt(_0x167919(0x12f))/0x4*(-parseInt(_0x167919(0x148))/0x5)+parseInt(_0x167919(0x13b))/0x6+parseInt(_0x167919(0x122))/0x7*(parseInt(_0x167919(0x13d))/0x8)+parseInt(_0x167919(0x11f))/0x9*(-parseInt(_0x167919(0x115))/0xa);if(_0x1a80fe===_0xd95e1c)break;else _0x37ff54['push'](_0x37ff54['shift']());}catch(_0x22d7a7){_0x37ff54['push'](_0x37ff54['shift']());}}}(a254_0x5995,0x86a17));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';function a254_0x5995(){const _0x5349b2=['filter',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','hash','Push\x20local\x20SQL\x20files\x20to\x20remote','force','2566428DqdVGr','1185146leHzNe','push','length','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','Local\x20directory\x20\x22','str','projectRoot','relativePath','\x20skipped,\x20','\x20SQL\x20file(s)',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','508728mEWKwB','\x22\x20for\x20sqlCode\x20','149592PkzKoI','has','sqlcode','utf8','sqlRootDir','catch','2409189FUvbJz','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','isFinite','startsWith','exec','5GyLtcL','toISOString','message','validation','\x20failed','dbId','filePath','appCode','No\x20local\x20SQL\x20files\x20found.','Would\x20push\x20','Push\x20complete:\x20','replace','Local\x20SQL\x20not\x20found:\x20','lockFilePath','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','mode','210ZopjDr','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqlConfig','path',':\x20SQL\x20content\x20is\x20empty.','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','write','342313LhySss','sqlCode','No\x20database\x20matches\x20local\x20directory\x20\x22','147501ycrPqT','version','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','14KOtpyY','sqls','unchanged','dbName','POST','bool','get','sqlName'];a254_0x5995=function(){return _0x5349b2;};return a254_0x5995();}async function readSqlUploadContent(_0x4bb8d1){const _0xc65b24=a254_0x4124,_0x187f4d=stripLocalSqlMetadata(await readFile(_0x4bb8d1[_0xc65b24(0x10b)],_0xc65b24(0x140)),_0x4bb8d1[_0xc65b24(0x114)]);if(!_0x187f4d['trim']())throw CliErrors['validation'](_0x4bb8d1[_0xc65b24(0x11d)]+_0xc65b24(0x119));return _0x187f4d;}async function getTargetSqlQueries(_0x1f9309,_0x81055a,_0x356d5e){const _0x31d68b=a254_0x4124,_0x4e6e87=await scanLocalSqlQueries(_0x1f9309),_0x2c474e=new Map();for(const _0x57ee0f of _0x4e6e87){if(_0x356d5e&&_0x57ee0f[_0x31d68b(0x11d)]!==_0x356d5e)continue;const _0x157873=_0x2c474e[_0x31d68b(0x128)](_0x57ee0f[_0x31d68b(0x11d)])??[];_0x157873[_0x31d68b(0x131)](_0x57ee0f),_0x2c474e['set'](_0x57ee0f[_0x31d68b(0x11d)],_0x157873);}if(_0x356d5e&&!_0x2c474e[_0x31d68b(0x13e)](_0x356d5e))throw CliErrors['validation'](_0x31d68b(0x111)+_0x356d5e);const _0x1ecc46=[];for(const [_0x4573ab,_0x2b98a5]of _0x2c474e['entries']()){if(_0x2b98a5[_0x31d68b(0x132)]===0x1){_0x1ecc46[_0x31d68b(0x131)](_0x2b98a5[0x0]);continue;}const _0x5f0ce2=_0x81055a['sqls'][_0x4573ab],_0x128ace=_0x5f0ce2?.[_0x31d68b(0x118)],_0x3f7d58=_0x128ace?_0x2b98a5[_0x31d68b(0x12a)](_0x222fc1=>_0x222fc1[_0x31d68b(0x137)]!==_0x128ace):_0x2b98a5;if(_0x5f0ce2&&_0x3f7d58[_0x31d68b(0x132)]===0x1){_0x1ecc46[_0x31d68b(0x131)](_0x3f7d58[0x0]);continue;}throw CliErrors['validation'](_0x31d68b(0x144)+_0x4573ab+_0x31d68b(0x113));}return _0x1ecc46;}export const sqlPush={'service':'sql','command':'push','description':a254_0x3ddd04(0x12d),'risk':a254_0x3ddd04(0x11b),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':'boolean','description':a254_0x3ddd04(0x11a)}],async 'dryRun'(_0x55b129){const _0x3b0d47=a254_0x3ddd04,_0x3b03da=loadSqlProjectConfig(_0x55b129[_0x3b0d47(0x10c)]),_0x4b13cf=await readSqlLockFile(_0x3b03da[_0x3b0d47(0x112)]),{appLock:_0x17f8ca}=ensureSqlLockScope(_0x4b13cf??createEmptySqlLock(),_0x55b129[_0x3b0d47(0x10c)],_0x3b03da['sqlRoot'],_0x3b0d47(0x131)),_0x21847e=await getTargetSqlQueries(_0x3b03da,_0x17f8ca,_0x55b129['str'](_0x3b0d47(0x13f))||undefined),_0x2af14f=[];for(const _0x56403e of _0x21847e){const _0x5ebb23=await computeSqlFileHash(_0x56403e['filePath']),_0x586bb8=_0x17f8ca[_0x3b0d47(0x123)][_0x56403e[_0x3b0d47(0x11d)]],_0x1965a4=!!_0x586bb8&&(_0x586bb8['path']!==_0x56403e[_0x3b0d47(0x137)]||!!_0x56403e['sqlName']&&_0x586bb8[_0x3b0d47(0x129)]!==_0x56403e[_0x3b0d47(0x129)]||_0x586bb8['mode']!==_0x56403e[_0x3b0d47(0x114)]);if(!_0x55b129[_0x3b0d47(0x127)]('force')&&_0x586bb8&&_0x586bb8['hash']===_0x5ebb23&&!_0x1965a4)continue;if(!_0x586bb8)throw CliErrors['validation'](_0x56403e[_0x3b0d47(0x11d)]+_0x3b0d47(0x12b));if(_0x586bb8[_0x3b0d47(0x120)]==null)throw CliErrors[_0x3b0d47(0x14b)](_0x56403e[_0x3b0d47(0x11d)]+_0x3b0d47(0x13a));await resolveTargetDbBinding(_0x55b129[_0x3b0d47(0x10c)],_0x56403e,_0x586bb8),await readSqlUploadContent(_0x56403e),_0x2af14f['push'](_0x56403e[_0x3b0d47(0x11d)]);}return{'method':_0x3b0d47(0x126),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x2af14f,'appCode':_0x55b129[_0x3b0d47(0x10c)]},'description':_0x3b0d47(0x10e)+_0x2af14f['length']+_0x3b0d47(0x139)};},async 'execute'(_0x327ffa){const _0x392c87=a254_0x3ddd04,_0x2468fb=loadSqlProjectConfig(_0x327ffa[_0x392c87(0x10c)]),_0x229d65=await readSqlLockFile(_0x2468fb[_0x392c87(0x112)]),{lockData:_0x10b25c,appLock:_0x4e15c5}=ensureSqlLockScope(_0x229d65??createEmptySqlLock(),_0x327ffa[_0x392c87(0x10c)],_0x2468fb['sqlRoot'],_0x392c87(0x131)),_0xc9622c=await getTargetSqlQueries(_0x2468fb,_0x4e15c5,_0x327ffa[_0x392c87(0x135)](_0x392c87(0x13f))||undefined);if(_0xc9622c[_0x392c87(0x132)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x392c87(0x10d)};const _0x15bffd=[],_0x41df4e=[],_0x485652=[];let _0x1a16f8=![];for(const _0x2630b3 of _0xc9622c){const _0x549f85=_0x4e15c5[_0x392c87(0x123)][_0x2630b3[_0x392c87(0x11d)]];if(!_0x549f85){_0x485652[_0x392c87(0x131)]({'sqlCode':_0x2630b3[_0x392c87(0x11d)],'error':_0x392c87(0x133)});continue;}try{const _0x4e7ff1=await computeSqlFileHash(_0x2630b3[_0x392c87(0x10b)]),_0x5db465=_0x549f85[_0x392c87(0x118)]!==_0x2630b3[_0x392c87(0x137)]||!!_0x2630b3['sqlName']&&_0x549f85[_0x392c87(0x129)]!==_0x2630b3[_0x392c87(0x129)]||_0x549f85[_0x392c87(0x114)]!==_0x2630b3[_0x392c87(0x114)];if(!_0x327ffa['bool'](_0x392c87(0x12e))&&_0x549f85[_0x392c87(0x12c)]===_0x4e7ff1&&!_0x5db465){_0x41df4e['push']({'sqlCode':_0x2630b3[_0x392c87(0x11d)],'reason':_0x392c87(0x124)});continue;}if(_0x549f85['version']==null){_0x485652[_0x392c87(0x131)]({'sqlCode':_0x2630b3['sqlCode'],'error':_0x392c87(0x116)});continue;}const _0x2d1cbc=_0x2630b3[_0x392c87(0x129)]||_0x549f85[_0x392c87(0x129)],_0x175278=await resolveTargetDbBinding(_0x327ffa['appCode'],_0x2630b3,_0x549f85),_0x479ebc=await readSqlUploadContent(_0x2630b3),_0x277c63=await updateSqlQuery({'id':_0x549f85['remoteId'],'appCode':_0x327ffa['appCode'],'sqlCode':_0x2630b3[_0x392c87(0x11d)],'sqlName':_0x2d1cbc,'dbId':_0x175278['dbId'],'version':_0x549f85[_0x392c87(0x120)],'sqlContent':_0x479ebc,'sqlConfig':_0x549f85[_0x392c87(0x117)]??undefined}),_0xdb600b=_0x277c63[_0x392c87(0x10a)]?await getDbName(_0x327ffa[_0x392c87(0x10c)],Number(_0x277c63[_0x392c87(0x10a)]))[_0x392c87(0x142)](()=>_0x175278[_0x392c87(0x125)]):_0x175278[_0x392c87(0x125)];_0x4e15c5[_0x392c87(0x123)][_0x2630b3[_0x392c87(0x11d)]]={...buildSqlLockEntry(_0x277c63,_0x479ebc,_0x4e7ff1,{'dbName':_0xdb600b}),'path':_0x2630b3[_0x392c87(0x137)],'mode':_0x2630b3[_0x392c87(0x114)]},_0x1a16f8=!![],await archivePreviousSqlFileIfNeeded(_0x2468fb,_0x549f85[_0x392c87(0x118)],_0x2630b3['relativePath']),_0x15bffd[_0x392c87(0x131)]({'sqlCode':_0x2630b3[_0x392c87(0x11d)],'remoteId':_0x549f85['remoteId']});}catch(_0x56c397){_0x485652[_0x392c87(0x131)]({'sqlCode':_0x2630b3[_0x392c87(0x11d)],'error':_0x56c397 instanceof Error?_0x56c397[_0x392c87(0x14a)]:String(_0x56c397)});}}(_0x1a16f8||_0x485652[_0x392c87(0x132)]===0x0)&&(_0x4e15c5['lastSync']=new Date()[_0x392c87(0x149)](),await writeSqlLockFile(_0x2468fb['lockFilePath'],_0x10b25c));const _0x4bafbd=_0x485652['length']===0x0;return{'ok':_0x4bafbd,'data':{'pushed':_0x15bffd,'skipped':_0x41df4e,'failed':_0x485652},'message':_0x392c87(0x10f)+_0x15bffd[_0x392c87(0x132)]+'\x20pushed,\x20'+_0x41df4e['length']+_0x392c87(0x138)+_0x485652[_0x392c87(0x132)]+_0x392c87(0x109)};}};function a254_0x4124(_0x2b9078,_0x51b9a7){_0x2b9078=_0x2b9078-0x109;const _0x59951f=a254_0x5995();let _0x412400=_0x59951f[_0x2b9078];return _0x412400;}async function archivePreviousSqlFileIfNeeded(_0x26e207,_0x4d35f2,_0x11a372){const _0x4501fa=a254_0x3ddd04;if(!_0x4d35f2||_0x4d35f2===_0x11a372)return;const _0x2285a3=join(_0x26e207[_0x4501fa(0x141)],_0x4d35f2);if(!await fileExists(_0x2285a3))return;const _0x1f043a=await moveToTrash(_0x26e207[_0x4501fa(0x136)],_0x26e207['trashDir'],_0x2285a3);await cleanupEmptyDirectories(dirname(_0x2285a3),_0x26e207['sqlRootDir']),void _0x1f043a;}async function moveToTrash(_0x3fad7f,_0x7515af,_0x37e63e){const _0x491156=a254_0x3ddd04,_0x179161=new Date()['toISOString']()[_0x491156(0x110)](/[:.]/g,'-'),_0x1bc827=relative(_0x3fad7f,_0x37e63e),_0x18e6f4=join(_0x7515af,_0x179161,_0x1bc827);return await mkdir(dirname(_0x18e6f4),{'recursive':!![]}),await rename(_0x37e63e,_0x18e6f4),_0x18e6f4;}async function cleanupEmptyDirectories(_0x4d6b09,_0x4b142e){const _0x5f0b18=a254_0x3ddd04;let _0x2b3f17=resolve(_0x4d6b09);const _0x5c6051=resolve(_0x4b142e);while(_0x2b3f17[_0x5f0b18(0x146)](''+_0x5c6051+sep)||_0x2b3f17===_0x5c6051){if(_0x2b3f17===_0x5c6051)return;try{const _0x1682db=await readdir(_0x2b3f17);if(_0x1682db[_0x5f0b18(0x132)]>0x0)return;await rmdir(_0x2b3f17);}catch{return;}_0x2b3f17=dirname(_0x2b3f17);}}async function resolveTargetDbBinding(_0x6df093,_0x5d4ecb,_0x5a5e73){const _0x322e89=a254_0x3ddd04,_0x39ed9e=_0x5d4ecb['dbDirectory'];if(!_0x39ed9e)return{'dbId':_0x5a5e73[_0x322e89(0x10a)],'dbName':_0x5a5e73[_0x322e89(0x125)]};const _0x3bab4f=buildDbDirectoryName(_0x5a5e73['dbName'],_0x5a5e73[_0x322e89(0x10a)]);if(_0x39ed9e===_0x3bab4f)return{'dbId':_0x5a5e73[_0x322e89(0x10a)],'dbName':_0x5a5e73[_0x322e89(0x125)]};const _0x4b1236=parseExplicitDbDirectory(_0x39ed9e);if(_0x4b1236!=null)return{'dbId':_0x4b1236,'dbName':await getDbName(_0x6df093,_0x4b1236)[_0x322e89(0x142)](()=>undefined)};const _0x405213=await listDatabases(_0x6df093),_0x48d5db=_0x405213[_0x322e89(0x12a)](_0x339d5d=>buildDbDirectoryName(_0x339d5d[_0x322e89(0x125)],_0x339d5d[_0x322e89(0x10a)])===_0x39ed9e);if(_0x48d5db[_0x322e89(0x132)]===0x1)return{'dbId':_0x48d5db[0x0][_0x322e89(0x10a)],'dbName':_0x48d5db[0x0][_0x322e89(0x125)]};if(_0x48d5db[_0x322e89(0x132)]===0x0)throw CliErrors[_0x322e89(0x14b)](_0x322e89(0x11e)+_0x39ed9e+_0x322e89(0x13c)+_0x5d4ecb[_0x322e89(0x11d)]+'.');const _0x2692c8=_0x48d5db['map'](_0x134294=>_0x134294[_0x322e89(0x125)]+'\x20('+_0x134294[_0x322e89(0x10a)]+')')['join'](',\x20');throw CliErrors['validation'](_0x322e89(0x134)+_0x39ed9e+_0x322e89(0x121)+_0x5d4ecb[_0x322e89(0x11d)]+':\x20'+_0x2692c8);}function parseExplicitDbDirectory(_0x176836){const _0x1b47c6=a254_0x3ddd04,_0x7ad30=/^db-(\d+)$/[_0x1b47c6(0x147)](_0x176836);if(!_0x7ad30)return null;const _0x493741=Number(_0x7ad30[0x1]);return Number[_0x1b47c6(0x145)](_0x493741)&&_0x493741>0x0?_0x493741:null;}
@@ -1 +1 @@
1
- function a255_0x13ae(_0x1b92e9,_0x416bb5){_0x1b92e9=_0x1b92e9-0x8b;const _0x12b3c0=a255_0x12b3();let _0x13aeec=_0x12b3c0[_0x1b92e9];return _0x13aeec;}const a255_0x5e47cc=a255_0x13ae;(function(_0x19e19e,_0x5d5ff2){const _0x185295=a255_0x13ae,_0x21152e=_0x19e19e();while(!![]){try{const _0x20cb48=-parseInt(_0x185295(0xb3))/0x1*(-parseInt(_0x185295(0xa4))/0x2)+-parseInt(_0x185295(0xa2))/0x3*(parseInt(_0x185295(0xb5))/0x4)+parseInt(_0x185295(0x8e))/0x5*(-parseInt(_0x185295(0xb0))/0x6)+-parseInt(_0x185295(0x95))/0x7+parseInt(_0x185295(0xac))/0x8*(parseInt(_0x185295(0xb1))/0x9)+parseInt(_0x185295(0x9a))/0xa+-parseInt(_0x185295(0x8c))/0xb;if(_0x20cb48===_0x5d5ff2)break;else _0x21152e['push'](_0x21152e['shift']());}catch(_0x3ffab1){_0x21152e['push'](_0x21152e['shift']());}}}(a255_0x12b3,0x78e3f));import{createInterface}from'node:readline';function a255_0x12b3(){const _0x27030b=['dbId','sqlCode','\x20[y/N]\x20','mybatisXml','3555ZGApQL','fromEntries','9394cVXMsN','length','slice','<!--\x20@lovrabet.','path','trim','syncedAt','declaration','80EaXrEM','mode','\x20-->','endsWith','126njtbuf','322479SpTKxe','stderr','193Yysalx','sqlName','884IVsoCh','filter','join','includes','--\x20@lovrabet.','description','close','stdin','2953313UozBDd','test','158265fTfUAT','version','yes','sqlRoot','lastSync','sqlContent','dbName','2230956PLyauw','replace','split','toLowerCase','map','7441250afajYN','trimStart','.rabetbase/sql','exec'];a255_0x12b3=function(){return _0x27030b;};return a255_0x12b3();}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a255_0x5e47cc(0x9c);export function buildSqlLockEntry(_0x43eac8,_0x314cdc,_0x59acf7,_0x2c9475){const _0x4d7ca8=a255_0x5e47cc,_0x50e147=detectSqlMode(_0x314cdc);return{'path':buildSqlRelativePath(_0x43eac8[_0x4d7ca8(0x9f)],_0x43eac8[_0x4d7ca8(0xb4)],_0x2c9475?.[_0x4d7ca8(0x94)],_0x50e147,_0x43eac8['dbId']),'hash':_0x59acf7,'remoteId':_0x43eac8['id'],'version':_0x43eac8[_0x4d7ca8(0x8f)],'dbId':Number(_0x43eac8[_0x4d7ca8(0x9e)]),'dbName':_0x2c9475?.['dbName'],'sqlName':_0x43eac8[_0x4d7ca8(0xb4)],'sqlConfig':_0x43eac8['sqlConfig']??undefined,'mode':_0x50e147};}export function cloneSqlLockData(_0x1c6d86){const _0xd622ff=a255_0x5e47cc;return{'apps':Object[_0xd622ff(0xa3)](Object['entries'](_0x1c6d86['apps'])[_0xd622ff(0x99)](([_0x17f753,_0x20d0ac])=>[_0x17f753,{'sqlRoot':_0x20d0ac[_0xd622ff(0x91)],'lastSync':_0x20d0ac[_0xd622ff(0x92)],'sqls':{..._0x20d0ac['sqls']}}]))};}export function ensureRemoteSqlContent(_0x11192e){const _0x5db4a2=a255_0x5e47cc;return _0x11192e[_0x5db4a2(0x93)]??'';}export function buildLocalSqlFileContent(_0x2c31ea,_0x43d0ba,_0xbaf384){const _0x57aa19=a255_0x5e47cc,_0xb47f34=_0xbaf384?.[_0x57aa19(0xad)]??detectSqlMode(_0x43d0ba),_0x32f2da=stripLocalSqlMetadata(_0x43d0ba,_0xb47f34)[_0x57aa19(0xa9)](),_0x4ba3b0=buildMetadataHeaderLines({'sqlCode':_0x2c31ea['sqlCode'],'sqlName':_0x2c31ea[_0x57aa19(0xb4)],'dbId':_0x2c31ea[_0x57aa19(0x9e)],'dbName':_0xbaf384?.['dbName'],'mode':_0xb47f34,'syncedAt':_0xbaf384?.[_0x57aa19(0xaa)],'description':_0xbaf384?.[_0x57aa19(0xba)]},_0xb47f34),_0x47fb03=_0xb47f34===_0x57aa19(0xa1)?splitXmlDeclaration(_0x32f2da):{'body':_0x32f2da},_0x53d24e=[..._0x47fb03[_0x57aa19(0xab)]?[_0x47fb03[_0x57aa19(0xab)]]:[],..._0x4ba3b0,'',_0x47fb03['body'][_0x57aa19(0x9b)]()],_0xbcf214=_0x53d24e[_0x57aa19(0xb7)]('\x0a');return _0xbcf214[_0x57aa19(0xaf)]('\x0a')?_0xbcf214:_0xbcf214+'\x0a';}export function stripLocalSqlMetadata(_0x3d639b,_0x34333e){const _0x14cfa3=a255_0x5e47cc;if(_0x34333e==='mybatisXml'){const {declaration:_0x59b710,body:_0x2f48ec}=splitXmlDeclaration(_0x3d639b[_0x14cfa3(0x96)](/\r\n/g,'\x0a')),_0x2338ff=stripLeadingMetadataLines(_0x2f48ec,/^\s*<!--\s*@lovrabet\./);return _0x59b710?''+_0x59b710+(_0x2338ff?'\x0a'+_0x2338ff:''):_0x2338ff;}return stripLeadingMetadataLines(_0x3d639b[_0x14cfa3(0x96)](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0x1c050b,_0x5cc8ed){const _0x4aba1e=a255_0x5e47cc;if(_0x5cc8ed?.[_0x4aba1e(0xad)])return _0x5cc8ed['mode'];return detectSqlMode(_0x1c050b);}export function resolveSqlFileName(_0x2b0c89,_0x174cff,_0xc79900){const _0x2011de=a255_0x5e47cc;if(_0xc79900?.[_0x2011de(0xa8)])return _0xc79900[_0x2011de(0xa8)];if(_0xc79900?.[_0x2011de(0xb4)]||_0xc79900?.[_0x2011de(0x94)])return buildSqlRelativePath(_0x2b0c89,_0xc79900?.[_0x2011de(0xb4)],_0xc79900?.[_0x2011de(0x94)],resolveSqlMode(_0x174cff,_0xc79900),_0xc79900?.[_0x2011de(0x9e)]);return buildDefaultSqlFileName(_0x2b0c89,resolveSqlMode(_0x174cff,_0xc79900));}export function resolveSqlLocalDir(_0x3b120d,_0x5939c3){return join(_0x3b120d,SQL_LOCAL_REL_DIR,_0x5939c3);}export async function confirmForceOverwrite(_0x3143e3){const _0x4ce281=a255_0x5e47cc,_0x282dbf=createInterface({'input':process[_0x4ce281(0x8b)],'output':process[_0x4ce281(0xb2)]}),_0x3f3fe5=await new Promise(_0x4e2525=>{const _0x464f6c=_0x4ce281;_0x282dbf['question'](_0x3143e3+_0x464f6c(0xa0),_0x4e2525);});return _0x282dbf[_0x4ce281(0xbb)](),['y',_0x4ce281(0x90)][_0x4ce281(0xb8)](_0x3f3fe5[_0x4ce281(0xa9)]()[_0x4ce281(0x98)]());}export function findSqlLockScope(_0x359b81,_0x3f8746){return _0x359b81['apps'][_0x3f8746];}function buildMetadataHeaderLines(_0x184d32,_0x382c74){const _0x1d132a=a255_0x5e47cc,_0x287500=[[_0x1d132a(0x9f),_0x184d32[_0x1d132a(0x9f)]],[_0x1d132a(0xb4),_0x184d32[_0x1d132a(0xb4)]],['dbId',_0x184d32[_0x1d132a(0x9e)]],[_0x1d132a(0x94),_0x184d32[_0x1d132a(0x94)]],['mode',_0x184d32['mode']],['syncedAt',_0x184d32['syncedAt']],[_0x1d132a(0xba),_0x184d32['description']]];if(_0x382c74===_0x1d132a(0xa1))return _0x287500[_0x1d132a(0xb6)](([,_0x52db21])=>_0x52db21!==undefined&&_0x52db21!==null&&String(_0x52db21)[_0x1d132a(0xa9)]()!=='')[_0x1d132a(0x99)](([_0x1db499,_0x53de0f])=>_0x1d132a(0xa7)+_0x1db499+':\x20'+String(_0x53de0f)+_0x1d132a(0xae));return _0x287500['filter'](([,_0x4bb533])=>_0x4bb533!==undefined&&_0x4bb533!==null&&String(_0x4bb533)[_0x1d132a(0xa9)]()!=='')[_0x1d132a(0x99)](([_0x41988b,_0x2e4d35])=>_0x1d132a(0xb9)+_0x41988b+':\x20'+String(_0x2e4d35));}function splitXmlDeclaration(_0x14013e){const _0x39eeb2=a255_0x5e47cc,_0x4c76e2=_0x14013e[_0x39eeb2(0x9b)](),_0x3714e2=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i[_0x39eeb2(0x9d)](_0x4c76e2);if(!_0x3714e2)return{'body':_0x14013e};return{'declaration':_0x3714e2[0x0],'body':_0x4c76e2[_0x39eeb2(0xa6)](_0x3714e2[0x0][_0x39eeb2(0xa5)])};}function stripLeadingMetadataLines(_0x21d1a3,_0x4f2b85){const _0x4fa3be=a255_0x5e47cc,_0x3877c7=_0x21d1a3[_0x4fa3be(0x97)]('\x0a');let _0x1da842=0x0;while(_0x1da842<_0x3877c7['length']){const _0x17c58b=_0x3877c7[_0x1da842]??'';if(_0x4f2b85[_0x4fa3be(0x8d)](_0x17c58b)||_0x17c58b[_0x4fa3be(0xa9)]()===''){_0x1da842++;continue;}break;}return _0x3877c7['slice'](_0x1da842)['join']('\x0a')['trimStart']();}
1
+ (function(_0x2e64b8,_0x80e925){const _0x162498=a255_0x18b7,_0x2ecc98=_0x2e64b8();while(!![]){try{const _0x3d3238=parseInt(_0x162498(0x178))/0x1*(-parseInt(_0x162498(0x189))/0x2)+parseInt(_0x162498(0x181))/0x3+parseInt(_0x162498(0x188))/0x4+-parseInt(_0x162498(0x173))/0x5+parseInt(_0x162498(0x18a))/0x6+parseInt(_0x162498(0x16c))/0x7+parseInt(_0x162498(0x190))/0x8*(parseInt(_0x162498(0x194))/0x9);if(_0x3d3238===_0x80e925)break;else _0x2ecc98['push'](_0x2ecc98['shift']());}catch(_0x15ecdc){_0x2ecc98['push'](_0x2ecc98['shift']());}}}(a255_0x1911,0xe77d5));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(_0x52b08f,_0x652f79,_0x3d5b24,_0x59ebc0){const _0x4ba2b5=a255_0x18b7,_0x4a4d19=detectSqlMode(_0x652f79);return{'path':buildSqlRelativePath(_0x52b08f[_0x4ba2b5(0x186)],_0x52b08f[_0x4ba2b5(0x17d)],_0x59ebc0?.[_0x4ba2b5(0x183)],_0x4a4d19,_0x52b08f[_0x4ba2b5(0x185)]),'hash':_0x3d5b24,'remoteId':_0x52b08f['id'],'version':_0x52b08f[_0x4ba2b5(0x16f)],'dbId':Number(_0x52b08f[_0x4ba2b5(0x185)]),'dbName':_0x59ebc0?.[_0x4ba2b5(0x183)],'sqlName':_0x52b08f['sqlName'],'sqlConfig':_0x52b08f[_0x4ba2b5(0x191)]??undefined,'mode':_0x4a4d19};}export function cloneSqlLockData(_0x5e3cba){const _0x11e8d3=a255_0x18b7;return{'apps':Object[_0x11e8d3(0x196)](Object[_0x11e8d3(0x18f)](_0x5e3cba['apps'])[_0x11e8d3(0x16e)](([_0x572bc1,_0x4a0b60])=>[_0x572bc1,{'sqlRoot':_0x4a0b60['sqlRoot'],'lastSync':_0x4a0b60[_0x11e8d3(0x169)],'sqls':{..._0x4a0b60[_0x11e8d3(0x182)]}}]))};}export function ensureRemoteSqlContent(_0xbbc26d){return _0xbbc26d['sqlContent']??'';}export function buildLocalSqlFileContent(_0x3ab242,_0x50e2a1,_0x6de7b6){const _0x31cb74=a255_0x18b7,_0x40fd4a=_0x6de7b6?.[_0x31cb74(0x179)]??detectSqlMode(_0x50e2a1),_0x428078=stripLocalSqlMetadata(_0x50e2a1,_0x40fd4a)[_0x31cb74(0x16b)](),_0x219ee3=buildMetadataHeaderLines({'sqlCode':_0x3ab242['sqlCode'],'sqlName':_0x3ab242['sqlName'],'dbId':_0x3ab242['dbId'],'dbName':_0x6de7b6?.[_0x31cb74(0x183)],'mode':_0x40fd4a,'syncedAt':_0x6de7b6?.[_0x31cb74(0x17f)],'description':_0x6de7b6?.[_0x31cb74(0x184)]},_0x40fd4a),_0x276028=_0x40fd4a===_0x31cb74(0x171)?splitXmlDeclaration(_0x428078):{'body':_0x428078},_0x23cf84=[..._0x276028[_0x31cb74(0x174)]?[_0x276028[_0x31cb74(0x174)]]:[],..._0x219ee3,'',_0x276028[_0x31cb74(0x17e)][_0x31cb74(0x18b)]()],_0x21c9e1=_0x23cf84[_0x31cb74(0x177)]('\x0a');return _0x21c9e1[_0x31cb74(0x176)]('\x0a')?_0x21c9e1:_0x21c9e1+'\x0a';}export function stripLocalSqlMetadata(_0x3f34d5,_0xa1eb4f){const _0x271875=a255_0x18b7;if(_0xa1eb4f===_0x271875(0x171)){const {declaration:_0x11befd,body:_0x892e64}=splitXmlDeclaration(_0x3f34d5[_0x271875(0x17c)](/\r\n/g,'\x0a')),_0x5e9862=stripLeadingMetadataLines(_0x892e64,/^\s*<!--\s*@lovrabet\./);return _0x11befd?''+_0x11befd+(_0x5e9862?'\x0a'+_0x5e9862:''):_0x5e9862;}return stripLeadingMetadataLines(_0x3f34d5[_0x271875(0x17c)](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0x41f256,_0x5c4d5c){const _0x827ecb=a255_0x18b7;if(_0x5c4d5c?.[_0x827ecb(0x179)])return _0x5c4d5c['mode'];return detectSqlMode(_0x41f256);}export function resolveSqlFileName(_0x37c336,_0x3d8d84,_0x49a134){const _0x150b52=a255_0x18b7;if(_0x49a134?.[_0x150b52(0x17a)])return _0x49a134[_0x150b52(0x17a)];if(_0x49a134?.[_0x150b52(0x17d)]||_0x49a134?.[_0x150b52(0x183)])return buildSqlRelativePath(_0x37c336,_0x49a134?.[_0x150b52(0x17d)],_0x49a134?.[_0x150b52(0x183)],resolveSqlMode(_0x3d8d84,_0x49a134),_0x49a134?.[_0x150b52(0x185)]);return buildDefaultSqlFileName(_0x37c336,resolveSqlMode(_0x3d8d84,_0x49a134));}export function resolveSqlLocalDir(_0x25ce75,_0x2cfaff){return join(_0x25ce75,SQL_LOCAL_REL_DIR,_0x2cfaff);}export async function confirmForceOverwrite(_0xffa382){const _0x5da6ed=a255_0x18b7,_0x3bdf53=createInterface({'input':process[_0x5da6ed(0x192)],'output':process['stderr']}),_0x1774ff=await new Promise(_0x957916=>{const _0x2ed99f=_0x5da6ed;_0x3bdf53[_0x2ed99f(0x16d)](_0xffa382+_0x2ed99f(0x172),_0x957916);});return _0x3bdf53['close'](),['y',_0x5da6ed(0x195)][_0x5da6ed(0x180)](_0x1774ff[_0x5da6ed(0x16b)]()[_0x5da6ed(0x18c)]());}export function findSqlLockScope(_0x40d52d,_0x3754f3){const _0x51cb1c=a255_0x18b7;return _0x40d52d[_0x51cb1c(0x18e)][_0x3754f3];}function buildMetadataHeaderLines(_0x2ec175,_0x3490f2){const _0x57c895=a255_0x18b7,_0x5e6f38=[['sqlCode',_0x2ec175['sqlCode']],[_0x57c895(0x17d),_0x2ec175[_0x57c895(0x17d)]],[_0x57c895(0x185),_0x2ec175['dbId']],[_0x57c895(0x183),_0x2ec175[_0x57c895(0x183)]],[_0x57c895(0x179),_0x2ec175[_0x57c895(0x179)]],[_0x57c895(0x17f),_0x2ec175[_0x57c895(0x17f)]],['description',_0x2ec175[_0x57c895(0x184)]]];if(_0x3490f2===_0x57c895(0x171))return _0x5e6f38[_0x57c895(0x16a)](([,_0x5d4f8c])=>_0x5d4f8c!==undefined&&_0x5d4f8c!==null&&String(_0x5d4f8c)[_0x57c895(0x16b)]()!=='')[_0x57c895(0x16e)](([_0x3e8051,_0x1f5f6d])=>'<!--\x20@lovrabet.'+_0x3e8051+':\x20'+String(_0x1f5f6d)+_0x57c895(0x18d));return _0x5e6f38[_0x57c895(0x16a)](([,_0x37055f])=>_0x37055f!==undefined&&_0x37055f!==null&&String(_0x37055f)[_0x57c895(0x16b)]()!=='')[_0x57c895(0x16e)](([_0x5de4a4,_0x5dbed6])=>_0x57c895(0x175)+_0x5de4a4+':\x20'+String(_0x5dbed6));}function a255_0x1911(){const _0x5d6485=['version','test','mybatisXml','\x20[y/N]\x20','9029265xwzsto','declaration','--\x20@lovrabet.','endsWith','join','382549JTIgds','mode','path','length','replace','sqlName','body','syncedAt','includes','2929602AVNoIw','sqls','dbName','description','dbId','sqlCode','exec','3434888HdPKZc','8cBuYcz','1694136QyEGPm','trimStart','toLowerCase','\x20-->','apps','entries','64WLrKfw','sqlConfig','stdin','slice','735093MVWDEc','yes','fromEntries','lastSync','filter','trim','10592414YrUlaX','question','map'];a255_0x1911=function(){return _0x5d6485;};return a255_0x1911();}function splitXmlDeclaration(_0x2aac29){const _0x3e2803=a255_0x18b7,_0x22f4ab=_0x2aac29[_0x3e2803(0x18b)](),_0x59e42e=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i[_0x3e2803(0x187)](_0x22f4ab);if(!_0x59e42e)return{'body':_0x2aac29};return{'declaration':_0x59e42e[0x0],'body':_0x22f4ab[_0x3e2803(0x193)](_0x59e42e[0x0][_0x3e2803(0x17b)])};}function a255_0x18b7(_0x560b51,_0x4f019b){_0x560b51=_0x560b51-0x169;const _0x1911d9=a255_0x1911();let _0x18b794=_0x1911d9[_0x560b51];return _0x18b794;}function stripLeadingMetadataLines(_0x9c5d1a,_0x2687a7){const _0x27e73d=a255_0x18b7,_0x20f45a=_0x9c5d1a['split']('\x0a');let _0x7f1639=0x0;while(_0x7f1639<_0x20f45a['length']){const _0x6fbe4d=_0x20f45a[_0x7f1639]??'';if(_0x2687a7[_0x27e73d(0x170)](_0x6fbe4d)||_0x6fbe4d[_0x27e73d(0x16b)]()===''){_0x7f1639++;continue;}break;}return _0x20f45a['slice'](_0x7f1639)[_0x27e73d(0x177)]('\x0a')[_0x27e73d(0x18b)]();}