@lovrabet/rabetbase-cli 2.5.3 → 2.5.4-beta.2

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 (389) hide show
  1. package/README.md +11 -0
  2. package/lib/api/api-doc.js +1 -1
  3. package/lib/api/api-group.js +1 -1
  4. package/lib/api/fetch-model-list.js +1 -1
  5. package/lib/api/generate-api-file.js +1 -1
  6. package/lib/api/generate-sdk-config-file.js +1 -1
  7. package/lib/api/legacy-api-file.js +1 -1
  8. package/lib/api/model-registry-file.js +1 -1
  9. package/lib/api/model-registry-scaffold.js +1 -1
  10. package/lib/api/model-source.js +1 -1
  11. package/lib/auth/auth-server-ui.js +1 -1
  12. package/lib/auth/auth-server.js +1 -1
  13. package/lib/auth/constant.js +1 -1
  14. package/lib/auth/get-cookie.js +1 -1
  15. package/lib/auth/get-session-user.js +1 -1
  16. package/lib/auth/is-session-valid.js +1 -1
  17. package/lib/auth/login-success-html.js +1 -1
  18. package/lib/auth/logout.js +1 -1
  19. package/lib/cli-flags.js +1 -1
  20. package/lib/cli.js +1 -1
  21. package/lib/commands/api/generate.js +1 -1
  22. package/lib/commands/api/index.js +1 -1
  23. package/lib/commands/api/list.js +1 -1
  24. package/lib/commands/api/pull.js +1 -1
  25. package/lib/commands/api/shared.js +1 -1
  26. package/lib/commands/app/index.js +1 -1
  27. package/lib/commands/app/list.js +1 -1
  28. package/lib/commands/app/members-list.js +1 -1
  29. package/lib/commands/app/remote-directory.js +1 -1
  30. package/lib/commands/app/shared.js +1 -1
  31. package/lib/commands/app-config/delete.js +1 -1
  32. package/lib/commands/app-config/get.js +1 -1
  33. package/lib/commands/app-config/index.js +1 -1
  34. package/lib/commands/app-config/list.js +1 -1
  35. package/lib/commands/app-config/set.js +1 -1
  36. package/lib/commands/app-config/shared.js +1 -1
  37. package/lib/commands/auth/index.js +1 -1
  38. package/lib/commands/bff/create.js +1 -1
  39. package/lib/commands/bff/delete.js +1 -1
  40. package/lib/commands/bff/detail.js +1 -1
  41. package/lib/commands/bff/index.js +1 -1
  42. package/lib/commands/bff/list.js +1 -1
  43. package/lib/commands/bff/logs.js +1 -1
  44. package/lib/commands/bff/pull.js +1 -1
  45. package/lib/commands/bff/push.js +1 -1
  46. package/lib/commands/bff/status.js +1 -1
  47. package/lib/commands/cli-skill/index.js +1 -1
  48. package/lib/commands/cli-update.js +1 -1
  49. package/lib/commands/codegen/index.js +1 -1
  50. package/lib/commands/codegen/sdk.js +1 -1
  51. package/lib/commands/codegen/sql.js +1 -1
  52. package/lib/commands/common/app-registry.js +1 -1
  53. package/lib/commands/common/app-selector.js +1 -1
  54. package/lib/commands/common/async-task.js +1 -1
  55. package/lib/commands/common/dry-run.js +1 -1
  56. package/lib/commands/common/flags.js +1 -1
  57. package/lib/commands/common/local-file.js +1 -1
  58. package/lib/commands/common/validate.js +1 -1
  59. package/lib/commands/config/delete.js +1 -1
  60. package/lib/commands/config/get.js +1 -1
  61. package/lib/commands/config/index.js +1 -1
  62. package/lib/commands/config/init.d.ts +1 -1
  63. package/lib/commands/config/init.js +1 -1
  64. package/lib/commands/config/list.js +1 -1
  65. package/lib/commands/config/set.js +1 -1
  66. package/lib/commands/config/shared.js +1 -1
  67. package/lib/commands/dataset/batch-design.js +1 -1
  68. package/lib/commands/dataset/business-group-update.js +1 -1
  69. package/lib/commands/dataset/business-groups.js +1 -1
  70. package/lib/commands/dataset/capability.js +1 -1
  71. package/lib/commands/dataset/cross-relation-create.js +1 -1
  72. package/lib/commands/dataset/cross-relation-delete.js +1 -1
  73. package/lib/commands/dataset/cross-relation-list.js +1 -1
  74. package/lib/commands/dataset/cross-relation-shared.js +1 -1
  75. package/lib/commands/dataset/cross-relation-update.js +1 -1
  76. package/lib/commands/dataset/delete.js +1 -1
  77. package/lib/commands/dataset/detail.js +1 -1
  78. package/lib/commands/dataset/extend-update.js +1 -1
  79. package/lib/commands/dataset/field-restore.js +1 -1
  80. package/lib/commands/dataset/field-update.js +1 -1
  81. package/lib/commands/dataset/generate.js +1 -1
  82. package/lib/commands/dataset/index.js +1 -1
  83. package/lib/commands/dataset/list.js +1 -1
  84. package/lib/commands/dataset/operations.js +1 -1
  85. package/lib/commands/dataset/relation-audit.js +1 -1
  86. package/lib/commands/dataset/relation-create.js +1 -1
  87. package/lib/commands/dataset/relation-delete.js +1 -1
  88. package/lib/commands/dataset/relation-shared.js +1 -1
  89. package/lib/commands/dataset/relation-update.js +1 -1
  90. package/lib/commands/dataset/relations.js +1 -1
  91. package/lib/commands/dataset/rename.js +1 -1
  92. package/lib/commands/dataset/restore.js +1 -1
  93. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  94. package/lib/commands/db/analysis-batching.js +1 -1
  95. package/lib/commands/db/analyze-batch-plan.js +1 -1
  96. package/lib/commands/db/analyze-cancel.js +1 -1
  97. package/lib/commands/db/analyze-start.js +1 -1
  98. package/lib/commands/db/analyze-status.js +1 -1
  99. package/lib/commands/db/create.js +1 -1
  100. package/lib/commands/db/delete.js +1 -1
  101. package/lib/commands/db/detail.js +1 -1
  102. package/lib/commands/db/diff-refresh-start.js +1 -1
  103. package/lib/commands/db/diff-refresh-status.js +1 -1
  104. package/lib/commands/db/diff.js +1 -1
  105. package/lib/commands/db/index.js +1 -1
  106. package/lib/commands/db/list.js +1 -1
  107. package/lib/commands/db/shared.js +1 -1
  108. package/lib/commands/db/table-diff-shared.js +1 -1
  109. package/lib/commands/db/tables.js +1 -1
  110. package/lib/commands/db/test.js +1 -1
  111. package/lib/commands/db/update.js +1 -1
  112. package/lib/commands/deployment/index.js +1 -1
  113. package/lib/commands/deployment/sync-all.js +1 -1
  114. package/lib/commands/deployment/sync-jobs.js +1 -1
  115. package/lib/commands/deployment/sync-status.js +1 -1
  116. package/lib/commands/doctor.js +1 -1
  117. package/lib/commands/file/index.js +1 -1
  118. package/lib/commands/flow/create.js +1 -1
  119. package/lib/commands/flow/detail.js +1 -1
  120. package/lib/commands/flow/index.js +1 -1
  121. package/lib/commands/flow/list.js +1 -1
  122. package/lib/commands/flow/publish.js +1 -1
  123. package/lib/commands/flow/runtime-resources-shared.js +1 -1
  124. package/lib/commands/flow/runtime-role-list.js +1 -1
  125. package/lib/commands/flow/runtime-role-user-list.js +1 -1
  126. package/lib/commands/flow/runtime-user-search.js +1 -1
  127. package/lib/commands/flow/shared.d.ts +2 -0
  128. package/lib/commands/flow/shared.js +1 -1
  129. package/lib/commands/flow/update.js +1 -1
  130. package/lib/commands/flow/validate.js +1 -1
  131. package/lib/commands/instant-api-policy/current.js +1 -1
  132. package/lib/commands/instant-api-policy/index.js +1 -1
  133. package/lib/commands/instant-api-policy/init.js +1 -1
  134. package/lib/commands/instant-api-policy/publish.js +1 -1
  135. package/lib/commands/instant-api-policy/pull.js +1 -1
  136. package/lib/commands/instant-api-policy/revision.js +1 -1
  137. package/lib/commands/instant-api-policy/revisions.js +1 -1
  138. package/lib/commands/instant-api-policy/rollback.js +1 -1
  139. package/lib/commands/instant-api-policy/shared.js +1 -1
  140. package/lib/commands/instant-api-policy/validate.js +1 -1
  141. package/lib/commands/issue/index.js +1 -1
  142. package/lib/commands/issue/nudge.js +1 -1
  143. package/lib/commands/issue/report.js +1 -1
  144. package/lib/commands/issue/shared.js +1 -1
  145. package/lib/commands/kb/create.js +1 -1
  146. package/lib/commands/kb/delete.js +1 -1
  147. package/lib/commands/kb/detail.js +1 -1
  148. package/lib/commands/kb/index.js +1 -1
  149. package/lib/commands/kb/list.js +1 -1
  150. package/lib/commands/kb/search.js +1 -1
  151. package/lib/commands/kb/shared.js +1 -1
  152. package/lib/commands/kb/update.js +1 -1
  153. package/lib/commands/logs/index.js +1 -1
  154. package/lib/commands/menu/asset-update.js +1 -1
  155. package/lib/commands/menu/delete.js +1 -1
  156. package/lib/commands/menu/external-link-create.js +1 -1
  157. package/lib/commands/menu/external-link-update.js +1 -1
  158. package/lib/commands/menu/group-create.js +1 -1
  159. package/lib/commands/menu/group-update.js +1 -1
  160. package/lib/commands/menu/index.js +1 -1
  161. package/lib/commands/menu/list.js +1 -1
  162. package/lib/commands/menu/move.js +1 -1
  163. package/lib/commands/menu/regroup-start.js +1 -1
  164. package/lib/commands/menu/rename.js +1 -1
  165. package/lib/commands/menu/shared/compare-table.js +1 -1
  166. package/lib/commands/menu/shared/delete-plan.js +1 -1
  167. package/lib/commands/menu/shared/facts.js +1 -1
  168. package/lib/commands/menu/shared/index.js +1 -1
  169. package/lib/commands/menu/shared/inquirer.js +1 -1
  170. package/lib/commands/menu/shared/local-pages.js +1 -1
  171. package/lib/commands/menu/shared/logic.js +1 -1
  172. package/lib/commands/menu/shared/mutations.js +1 -1
  173. package/lib/commands/menu/shared/service.js +1 -1
  174. package/lib/commands/menu/shared/sync-core.js +1 -1
  175. package/lib/commands/menu/shared/update-core.js +1 -1
  176. package/lib/commands/menu/shared/valid-url.js +1 -1
  177. package/lib/commands/menu/sync.js +1 -1
  178. package/lib/commands/menu/visibility-update.js +1 -1
  179. package/lib/commands/notification/config-create.js +1 -1
  180. package/lib/commands/notification/config-delete.js +1 -1
  181. package/lib/commands/notification/config-list.js +1 -1
  182. package/lib/commands/notification/config-update.js +1 -1
  183. package/lib/commands/notification/index.js +1 -1
  184. package/lib/commands/notification/shared.js +1 -1
  185. package/lib/commands/ocr/index.js +1 -1
  186. package/lib/commands/page/create.js +1 -1
  187. package/lib/commands/page/custom/detail.js +1 -1
  188. package/lib/commands/page/custom/list.js +1 -1
  189. package/lib/commands/page/custom/publish.js +1 -1
  190. package/lib/commands/page/custom/shared.js +1 -1
  191. package/lib/commands/page/custom/syntax.js +1 -1
  192. package/lib/commands/page/custom/update.js +1 -1
  193. package/lib/commands/page/data-list-status.js +1 -1
  194. package/lib/commands/page/generate-start.js +1 -1
  195. package/lib/commands/page/generate-status.js +1 -1
  196. package/lib/commands/page/index.js +1 -1
  197. package/lib/commands/page/pull.js +1 -1
  198. package/lib/commands/page/push.js +1 -1
  199. package/lib/commands/page/relation-audit.js +1 -1
  200. package/lib/commands/page/restore.js +1 -1
  201. package/lib/commands/page/shared.js +1 -1
  202. package/lib/commands/page/sync.js +1 -1
  203. package/lib/commands/project/api-architecture-upgrade.js +1 -1
  204. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  205. package/lib/commands/project/create/format-elapsed.js +1 -1
  206. package/lib/commands/project/create/main.js +1 -1
  207. package/lib/commands/project/create/materialize-project-template.js +1 -1
  208. package/lib/commands/project/create/project-name.js +1 -1
  209. package/lib/commands/project/create/project-template-archive.js +1 -1
  210. package/lib/commands/project/create/project-template-path.js +1 -1
  211. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  212. package/lib/commands/project/create/use-format-code.js +1 -1
  213. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  214. package/lib/commands/project/domain-routing-sync.js +1 -1
  215. package/lib/commands/project/index.js +1 -1
  216. package/lib/commands/project/upgrade.js +1 -1
  217. package/lib/commands/registry.js +1 -1
  218. package/lib/commands/role/delete.js +1 -1
  219. package/lib/commands/role/detail.js +1 -1
  220. package/lib/commands/role/index.js +1 -1
  221. package/lib/commands/role/list.js +1 -1
  222. package/lib/commands/role/shared.js +1 -1
  223. package/lib/commands/role/update.js +1 -1
  224. package/lib/commands/role/user-add.js +1 -1
  225. package/lib/commands/role/user-remove.js +1 -1
  226. package/lib/commands/role/user-resolve.js +1 -1
  227. package/lib/commands/rule/get.js +1 -1
  228. package/lib/commands/rule/index.js +1 -1
  229. package/lib/commands/rule/list.js +1 -1
  230. package/lib/commands/rule/set.js +1 -1
  231. package/lib/commands/rule/shared.js +1 -1
  232. package/lib/commands/run/index.js +1 -1
  233. package/lib/commands/schema.js +1 -1
  234. package/lib/commands/sql/create.js +1 -1
  235. package/lib/commands/sql/delete.js +1 -1
  236. package/lib/commands/sql/detail.js +1 -1
  237. package/lib/commands/sql/exec.js +1 -1
  238. package/lib/commands/sql/index.js +1 -1
  239. package/lib/commands/sql/list.js +1 -1
  240. package/lib/commands/sql/pull.js +1 -1
  241. package/lib/commands/sql/push.js +1 -1
  242. package/lib/commands/sql/shared.js +1 -1
  243. package/lib/commands/sql/status.js +1 -1
  244. package/lib/commands/sql/validate.js +1 -1
  245. package/lib/commands/task/index.js +1 -1
  246. package/lib/commands/task/status.js +1 -1
  247. package/lib/commands/tenant/index.js +1 -1
  248. package/lib/commands/tenant/members-list.js +1 -1
  249. package/lib/commands/tenant/shared.js +1 -1
  250. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  251. package/lib/commands/user-account/index.js +1 -1
  252. package/lib/commands/workspace/add.js +1 -1
  253. package/lib/commands/workspace/index.js +1 -1
  254. package/lib/commands/workspace/remove.js +1 -1
  255. package/lib/config/domain-config.d.ts +1 -1
  256. package/lib/config/domain-config.js +1 -1
  257. package/lib/config/project-domain-routing.js +1 -1
  258. package/lib/config/region-config.js +1 -1
  259. package/lib/config/schema.d.ts +1 -1
  260. package/lib/config/schema.js +1 -1
  261. package/lib/constant/cdn.js +1 -1
  262. package/lib/constant/cli.js +1 -1
  263. package/lib/constant/defaults.js +1 -1
  264. package/lib/constant/domain.d.ts +4 -0
  265. package/lib/constant/domain.js +1 -1
  266. package/lib/constant/env.js +1 -1
  267. package/lib/constant/output.js +1 -1
  268. package/lib/constant/paths.js +1 -1
  269. package/lib/constant/region.d.ts +1 -1
  270. package/lib/constant/region.js +1 -1
  271. package/lib/constant/risk.js +1 -1
  272. package/lib/constant/routing-profile.d.ts +14 -1
  273. package/lib/constant/routing-profile.js +1 -1
  274. package/lib/context/app-resolver.d.ts +1 -0
  275. package/lib/context/app-resolver.js +1 -1
  276. package/lib/context/auth-resolver.js +1 -1
  277. package/lib/context/config-loader.js +1 -1
  278. package/lib/context.js +1 -1
  279. package/lib/core/alias-resolver.js +1 -1
  280. package/lib/core/api-client.js +1 -1
  281. package/lib/core/bff/config.js +1 -1
  282. package/lib/core/bff/file-system.js +1 -1
  283. package/lib/core/bff/hash.js +1 -1
  284. package/lib/core/bff/hook-directory.js +1 -1
  285. package/lib/core/bff/lock.js +1 -1
  286. package/lib/core/bff/utils.js +1 -1
  287. package/lib/core/cross-db-relation.js +1 -1
  288. package/lib/core/db-resolver.js +1 -1
  289. package/lib/core/flow-config.d.ts +11 -10
  290. package/lib/core/flow-config.js +1 -1
  291. package/lib/core/instant-api-policy/config.js +1 -1
  292. package/lib/core/kb-search-client.d.ts +7 -1
  293. package/lib/core/kb-search-client.js +1 -1
  294. package/lib/core/page/file-system.js +1 -1
  295. package/lib/core/page/hash.js +1 -1
  296. package/lib/core/page/lock.js +1 -1
  297. package/lib/core/page/lr-smart-jsx.js +1 -1
  298. package/lib/core/sql-index-auditor.js +1 -1
  299. package/lib/core/sql-sync/config.js +1 -1
  300. package/lib/core/sql-sync/file-system.js +1 -1
  301. package/lib/core/sql-sync/hash.js +1 -1
  302. package/lib/core/sql-sync/lock.js +1 -1
  303. package/lib/core/sql-sync/utils.js +1 -1
  304. package/lib/core/sql-validator.d.ts +5 -2
  305. package/lib/core/sql-validator.js +1 -1
  306. package/lib/errors.js +1 -1
  307. package/lib/framework/build-all-flags.js +1 -1
  308. package/lib/framework/error-output.js +1 -1
  309. package/lib/framework/explicit-yes.js +1 -1
  310. package/lib/framework/flags.js +1 -1
  311. package/lib/framework/help.js +1 -1
  312. package/lib/framework/index.js +1 -1
  313. package/lib/framework/output.js +1 -1
  314. package/lib/framework/response.js +1 -1
  315. package/lib/framework/runner-alias.js +1 -1
  316. package/lib/framework/runner.js +1 -1
  317. package/lib/framework/schema-export.js +1 -1
  318. package/lib/framework/supported-flags.js +1 -1
  319. package/lib/framework/types.js +1 -1
  320. package/lib/generated/build-info.d.ts +4 -4
  321. package/lib/generated/build-info.js +1 -1
  322. package/lib/generated/official-routing.d.ts +15 -3
  323. package/lib/generated/official-routing.js +1 -1
  324. package/lib/generated/routing-contract.d.ts +2 -2
  325. package/lib/generated/routing-contract.js +1 -1
  326. package/lib/help.js +1 -1
  327. package/lib/postinstall.js +1 -1
  328. package/lib/runtime/confirmation.js +1 -1
  329. package/lib/runtime/event.js +1 -1
  330. package/lib/runtime/index.js +1 -1
  331. package/lib/runtime/queue.js +1 -1
  332. package/lib/runtime/resolve.js +1 -1
  333. package/lib/skills/builtin-skill.js +1 -1
  334. package/lib/skills/main.js +1 -1
  335. package/lib/skills/npx-skills-add.d.ts +5 -0
  336. package/lib/skills/npx-skills-add.js +1 -1
  337. package/lib/skills/skill-presence.js +1 -1
  338. package/lib/telemetry/cli-command-trace.js +1 -1
  339. package/lib/telemetry/cli-help-trace.js +1 -1
  340. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  341. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  342. package/lib/telemetry/send-cli-trace-log.js +1 -1
  343. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  344. package/lib/utils/ai_config.js +1 -1
  345. package/lib/utils/apply-jq-filter.js +1 -1
  346. package/lib/utils/cdn-config.js +1 -1
  347. package/lib/utils/check-sdk-version.js +1 -1
  348. package/lib/utils/cli-version-check.js +1 -1
  349. package/lib/utils/cli-version-policy.js +1 -1
  350. package/lib/utils/config.js +1 -1
  351. package/lib/utils/entity-with-id.js +1 -1
  352. package/lib/utils/file-utils.js +1 -1
  353. package/lib/utils/guides-cdn.js +1 -1
  354. package/lib/utils/http-client.js +1 -1
  355. package/lib/utils/is-non-interactive.js +1 -1
  356. package/lib/utils/logger.js +1 -1
  357. package/lib/utils/params.js +1 -1
  358. package/lib/utils/platform.js +1 -1
  359. package/lib/utils/sleep.js +1 -1
  360. package/lib/utils/template-replacer.js +1 -1
  361. package/lib/utils/update-notice.js +1 -1
  362. package/lib/utils/version.js +1 -1
  363. package/lib/utils/with-active-cookie.js +1 -1
  364. package/lib/utils/write-cli-side-channel.js +1 -1
  365. package/package.json +1 -1
  366. package/skills/rabetbase/SKILL.md +31 -17
  367. package/skills/rabetbase/guides/approval-flow-development-workflow.md +33 -11
  368. package/skills/rabetbase/guides/best-practices.md +1 -1
  369. package/skills/rabetbase/guides/conflict-detection.md +44 -92
  370. package/skills/rabetbase/guides/custom-page-flow-sdk.md +642 -0
  371. package/skills/rabetbase/guides/custom-page-flow-timeline-display.md +289 -0
  372. package/skills/rabetbase/guides/custom-page-workflow.md +12 -3
  373. package/skills/rabetbase/guides/sql-creation-workflow.md +44 -26
  374. package/skills/rabetbase/guides/sql-mybatis.md +18 -49
  375. package/skills/rabetbase/guides/typescript-sdk.md +18 -0
  376. package/skills/rabetbase/knowledge/approval-flow/config-json-schema.md +22 -6
  377. package/skills/rabetbase/knowledge/components.md +34 -28
  378. package/skills/rabetbase/knowledge/custom-page/generation-standards.md +2 -0
  379. package/skills/rabetbase/references/rabetbase-config.md +6 -4
  380. package/skills/rabetbase/references/rabetbase-flow-commands.md +8 -4
  381. package/skills/rabetbase/references/rabetbase-flow-resources.md +3 -3
  382. package/skills/rabetbase/references/rabetbase-flow-runtime-boundary.md +2 -0
  383. package/skills/rabetbase/references/rabetbase-init.md +7 -5
  384. package/skills/rabetbase/references/rabetbase-kb.md +14 -4
  385. package/skills/rabetbase/references/rabetbase-page-custom-detail.md +3 -1
  386. package/skills/rabetbase/references/rabetbase-page-custom-list.md +3 -0
  387. package/skills/rabetbase/references/rabetbase-sql-push.md +5 -0
  388. package/skills/rabetbase/references/rabetbase-sql-validate.md +12 -6
  389. package/skills/rabetbase.manifest.json +5 -3
@@ -1 +1 @@
1
- function a228_0x1be9(_0x520990,_0x108b70){_0x520990=_0x520990-0x90;const _0x36f663=a228_0x36f6();let _0x1be99d=_0x36f663[_0x520990];return _0x1be99d;}const a228_0x4c232b=a228_0x1be9;(function(_0x15c7f8,_0x563a6b){const _0x36d9f6=a228_0x1be9,_0x301f15=_0x15c7f8();while(!![]){try{const _0x4a89e4=-parseInt(_0x36d9f6(0x9c))/0x1+-parseInt(_0x36d9f6(0x91))/0x2*(parseInt(_0x36d9f6(0xb1))/0x3)+-parseInt(_0x36d9f6(0xae))/0x4+-parseInt(_0x36d9f6(0x9b))/0x5*(parseInt(_0x36d9f6(0xb9))/0x6)+parseInt(_0x36d9f6(0xb4))/0x7+-parseInt(_0x36d9f6(0xbf))/0x8*(-parseInt(_0x36d9f6(0x95))/0x9)+parseInt(_0x36d9f6(0xb6))/0xa;if(_0x4a89e4===_0x563a6b)break;else _0x301f15['push'](_0x301f15['shift']());}catch(_0x137cec){_0x301f15['push'](_0x301f15['shift']());}}}(a228_0x36f6,0xa23b1));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=[a228_0x4c232b(0x96),a228_0x4c232b(0x94)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a228_0x4c232b(0xbc),'database':a228_0x4c232b(0x9d)},APP_RULE_CONTEXT_SCOPES={'rules':a228_0x4c232b(0xb8),'database':'database-analysis'};function a228_0x36f6(){const _0x45d357=['App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','message','byteSize','type','app_rule_content_too_large','decode','scope','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','4286216bVvDLw','app_rule_file_invalid','app_rule_file_unreadable','159JKwpfz','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','updateTime','6461931bEMRoZ','utf8','15915240oxFYcY','createTime','page-api-development','114bqmzDs','utf-8','Cannot\x20access\x20app\x20rule\x20file:\x20','RULES.md','--file\x20is\x20required.','from','1296gwLsgK','sha256:','Cannot\x20read\x20app\x20rule\x20file:\x20','string','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','6226oaeJJw','app_rule_file_required','contentHash','database','16911CxBARa','rules','Pass\x20a\x20UTF-8\x20Markdown\x20file.','str','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','app_rule_content_invalid','80935JnSSeV','610462ZtOKBo','DATABASE.md','version','app_rule_type_invalid','digest','App\x20rule\x20file\x20is\x20blank:\x20','content','appCode','trim','hex'];a228_0x36f6=function(){return _0x45d357;};return a228_0x36f6();}export function appRuleError(_0x276bc6,_0x17772e,_0x55ede4){return new CliError(_0x276bc6,0x1,_0x17772e,_0x55ede4);}export function readAppRuleType(_0x44a72e){const _0x2495a3=a228_0x4c232b,_0x55dd40=_0x44a72e[_0x2495a3(0x98)](_0x2495a3(0xa9))[_0x2495a3(0xa4)]()['toLowerCase']();if(_0x55dd40!=='rules'&&_0x55dd40!==_0x2495a3(0x94))throw appRuleError(_0x2495a3(0x9f),_0x2495a3(0x90));return _0x55dd40;}export function appRuleFileName(_0x4b8e2f){return APP_RULE_FILES[_0x4b8e2f];}export function appRuleContextScope(_0x45316e){return APP_RULE_CONTEXT_SCOPES[_0x45316e];}export function inspectAppRuleContent(_0x31ac25){const _0x2ba3ac=a228_0x4c232b,_0x39c89a=Buffer[_0x2ba3ac(0xbe)](_0x31ac25,_0x2ba3ac(0xb5));return{'content':_0x31ac25,'byteSize':_0x39c89a['byteLength'],'contentHash':_0x2ba3ac(0xc0)+createHash('sha256')['update'](_0x39c89a)[_0x2ba3ac(0xa0)](_0x2ba3ac(0xa5))};}export async function readAppRuleFile(_0x1d8fe0){const _0x2467bc=a228_0x4c232b,_0xd729ce=_0x1d8fe0[_0x2467bc(0xa4)]();if(!_0xd729ce)throw appRuleError(_0x2467bc(0x92),_0x2467bc(0xbd),_0x2467bc(0x97));const _0x2994ed=resolve(_0xd729ce);let _0x4ec865;try{_0x4ec865=await stat(_0x2994ed);}catch(_0x5ccf8b){throw appRuleError(_0x2467bc(0xb0),_0x2467bc(0xbb)+_0xd729ce,_0x5ccf8b instanceof Error?_0x5ccf8b[_0x2467bc(0xa7)]:String(_0x5ccf8b));}if(!_0x4ec865['isFile']())throw appRuleError(_0x2467bc(0xaf),_0x2467bc(0xb2)+_0xd729ce);if(_0x4ec865['size']>MAX_APP_RULE_BYTES)throw appRuleError('app_rule_content_too_large','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.');let _0x417781;try{_0x417781=await readFile(_0x2994ed);}catch(_0x38b102){throw appRuleError(_0x2467bc(0xb0),_0x2467bc(0xc1)+_0xd729ce,_0x38b102 instanceof Error?_0x38b102[_0x2467bc(0xa7)]:String(_0x38b102));}if(_0x417781['byteLength']>MAX_APP_RULE_BYTES)throw appRuleError(_0x2467bc(0xaa),_0x2467bc(0xa6));let _0x4cb8d4;try{_0x4cb8d4=new TextDecoder(_0x2467bc(0xba),{'fatal':!![],'ignoreBOM':!![]})[_0x2467bc(0xab)](_0x417781);}catch{throw appRuleError(_0x2467bc(0x9a),_0x2467bc(0x99)+_0xd729ce);}if(!_0x4cb8d4[_0x2467bc(0xa4)]())throw appRuleError(_0x2467bc(0x9a),_0x2467bc(0xa1)+_0xd729ce);return inspectAppRuleContent(_0x4cb8d4);}export function projectAppRule(_0x29218f,_0xd96955){const _0x59e4ec=a228_0x4c232b;if(!_0xd96955)return{'type':_0x29218f,'fileName':appRuleFileName(_0x29218f),'contextScope':appRuleContextScope(_0x29218f),'enabled':![]};const _0x157cd2=inspectAppRuleContent(_0xd96955[_0x59e4ec(0xa2)]);return{'type':_0x29218f,'fileName':appRuleFileName(_0x29218f),'contextScope':appRuleContextScope(_0x29218f),'enabled':!![],'id':_0xd96955['id'],'scope':_0xd96955[_0x59e4ec(0xac)],'appCode':_0xd96955[_0x59e4ec(0xa3)],'version':_0xd96955[_0x59e4ec(0x9e)],'contentByteSize':_0x157cd2[_0x59e4ec(0xa8)],'contentHash':_0x157cd2[_0x59e4ec(0x93)],..._0xd96955[_0x59e4ec(0xb7)]!==undefined&&_0xd96955['createTime']!==null?{'createTime':_0xd96955[_0x59e4ec(0xb7)]}:{},..._0xd96955[_0x59e4ec(0xb3)]!==undefined&&_0xd96955[_0x59e4ec(0xb3)]!==null?{'updateTime':_0xd96955['updateTime']}:{}};}export const APP_RULE_TYPE_FLAG={'name':a228_0x4c232b(0xa9),'type':a228_0x4c232b(0xc2),'required':!![],'description':a228_0x4c232b(0xad),'enum':[...APP_RULE_TYPES]};
1
+ const a228_0x24200a=a228_0x439f;(function(_0x410cc0,_0x5e9dbf){const _0x2b4a6a=a228_0x439f,_0x108236=_0x410cc0();while(!![]){try{const _0x12855d=-parseInt(_0x2b4a6a(0x1fd))/0x1*(parseInt(_0x2b4a6a(0x207))/0x2)+-parseInt(_0x2b4a6a(0x1ff))/0x3*(parseInt(_0x2b4a6a(0x219))/0x4)+-parseInt(_0x2b4a6a(0x209))/0x5*(parseInt(_0x2b4a6a(0x201))/0x6)+-parseInt(_0x2b4a6a(0x1ee))/0x7+parseInt(_0x2b4a6a(0x1f5))/0x8+-parseInt(_0x2b4a6a(0x20b))/0x9*(-parseInt(_0x2b4a6a(0x1f7))/0xa)+parseInt(_0x2b4a6a(0x206))/0xb;if(_0x12855d===_0x5e9dbf)break;else _0x108236['push'](_0x108236['shift']());}catch(_0x1e1e84){_0x108236['push'](_0x108236['shift']());}}}(a228_0x5c5e,0x6b8bb));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';function a228_0x5c5e(){const _0x42705d=['RULES.md','app_rule_file_invalid','byteSize','version','Cannot\x20access\x20app\x20rule\x20file:\x20','createTime','appCode','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','type','isFile','944xVicKf','size','message','sha256:','2978584maZkTB','database','decode','app_rule_type_invalid','trim','Cannot\x20read\x20app\x20rule\x20file:\x20','rules','2596064eaGrii','byteLength','1045700MFmPoF','digest','utf8','Pass\x20a\x20UTF-8\x20Markdown\x20file.','--file\x20is\x20required.','app_rule_content_too_large','66026ZUJNgf','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','3324KuvCkZ','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','6lXRGvW','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','utf-8','App\x20rule\x20file\x20is\x20blank:\x20','hex','6045743AsFvBI','2oqBsDo','app_rule_content_invalid','1017190EOYIDP','database-analysis','45AmbTXL','updateTime','sha256','content'];a228_0x5c5e=function(){return _0x42705d;};return a228_0x5c5e();}import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a228_0x24200a(0x1f4),a228_0x24200a(0x1ef)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a228_0x24200a(0x20f),'database':'DATABASE.md'},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':a228_0x24200a(0x20a)};export function appRuleError(_0x369366,_0x37c393,_0x4efedf){return new CliError(_0x369366,0x1,_0x37c393,_0x4efedf);}export function readAppRuleType(_0x210adc){const _0x425407=a228_0x24200a,_0xa19b7e=_0x210adc['str'](_0x425407(0x217))[_0x425407(0x1f2)]()['toLowerCase']();if(_0xa19b7e!==_0x425407(0x1f4)&&_0xa19b7e!==_0x425407(0x1ef))throw appRuleError(_0x425407(0x1f1),_0x425407(0x202));return _0xa19b7e;}export function appRuleFileName(_0x307997){return APP_RULE_FILES[_0x307997];}function a228_0x439f(_0x1a8d17,_0xa3ca3f){_0x1a8d17=_0x1a8d17-0x1ee;const _0x5c5e59=a228_0x5c5e();let _0x439f42=_0x5c5e59[_0x1a8d17];return _0x439f42;}export function appRuleContextScope(_0x484be7){return APP_RULE_CONTEXT_SCOPES[_0x484be7];}export function inspectAppRuleContent(_0x400c68){const _0x46aa27=a228_0x24200a,_0x1c60eb=Buffer['from'](_0x400c68,_0x46aa27(0x1f9));return{'content':_0x400c68,'byteSize':_0x1c60eb[_0x46aa27(0x1f6)],'contentHash':_0x46aa27(0x21c)+createHash(_0x46aa27(0x20d))['update'](_0x1c60eb)[_0x46aa27(0x1f8)](_0x46aa27(0x205))};}export async function readAppRuleFile(_0x4e00ba){const _0xe67d14=a228_0x24200a,_0x59a1f9=_0x4e00ba[_0xe67d14(0x1f2)]();if(!_0x59a1f9)throw appRuleError('app_rule_file_required',_0xe67d14(0x1fb),_0xe67d14(0x1fa));const _0x32043b=resolve(_0x59a1f9);let _0x53df7c;try{_0x53df7c=await stat(_0x32043b);}catch(_0x5a5efc){throw appRuleError('app_rule_file_unreadable',_0xe67d14(0x213)+_0x59a1f9,_0x5a5efc instanceof Error?_0x5a5efc[_0xe67d14(0x21b)]:String(_0x5a5efc));}if(!_0x53df7c[_0xe67d14(0x218)]())throw appRuleError(_0xe67d14(0x210),_0xe67d14(0x216)+_0x59a1f9);if(_0x53df7c[_0xe67d14(0x21a)]>MAX_APP_RULE_BYTES)throw appRuleError('app_rule_content_too_large',_0xe67d14(0x200));let _0x10fd89;try{_0x10fd89=await readFile(_0x32043b);}catch(_0x5a2e98){throw appRuleError('app_rule_file_unreadable',_0xe67d14(0x1f3)+_0x59a1f9,_0x5a2e98 instanceof Error?_0x5a2e98[_0xe67d14(0x21b)]:String(_0x5a2e98));}if(_0x10fd89['byteLength']>MAX_APP_RULE_BYTES)throw appRuleError(_0xe67d14(0x1fc),_0xe67d14(0x200));let _0x4f2897;try{_0x4f2897=new TextDecoder(_0xe67d14(0x203),{'fatal':!![],'ignoreBOM':!![]})[_0xe67d14(0x1f0)](_0x10fd89);}catch{throw appRuleError(_0xe67d14(0x208),_0xe67d14(0x1fe)+_0x59a1f9);}if(!_0x4f2897[_0xe67d14(0x1f2)]())throw appRuleError(_0xe67d14(0x208),_0xe67d14(0x204)+_0x59a1f9);return inspectAppRuleContent(_0x4f2897);}export function projectAppRule(_0x44c6b7,_0x35d3ba){const _0x553c97=a228_0x24200a;if(!_0x35d3ba)return{'type':_0x44c6b7,'fileName':appRuleFileName(_0x44c6b7),'contextScope':appRuleContextScope(_0x44c6b7),'enabled':![]};const _0x2a82fa=inspectAppRuleContent(_0x35d3ba[_0x553c97(0x20e)]);return{'type':_0x44c6b7,'fileName':appRuleFileName(_0x44c6b7),'contextScope':appRuleContextScope(_0x44c6b7),'enabled':!![],'id':_0x35d3ba['id'],'scope':_0x35d3ba['scope'],'appCode':_0x35d3ba[_0x553c97(0x215)],'version':_0x35d3ba[_0x553c97(0x212)],'contentByteSize':_0x2a82fa[_0x553c97(0x211)],'contentHash':_0x2a82fa['contentHash'],..._0x35d3ba[_0x553c97(0x214)]!==undefined&&_0x35d3ba['createTime']!==null?{'createTime':_0x35d3ba[_0x553c97(0x214)]}:{},..._0x35d3ba['updateTime']!==undefined&&_0x35d3ba[_0x553c97(0x20c)]!==null?{'updateTime':_0x35d3ba[_0x553c97(0x20c)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a228_0x24200a(0x217),'type':'string','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 a229_0xc3afe=a229_0xde1a;(function(_0x510abd,_0x55d683){const _0x1601d0=a229_0xde1a,_0x541336=_0x510abd();while(!![]){try{const _0x215f0c=-parseInt(_0x1601d0(0x128))/0x1*(-parseInt(_0x1601d0(0x13b))/0x2)+-parseInt(_0x1601d0(0x134))/0x3*(parseInt(_0x1601d0(0x12e))/0x4)+parseInt(_0x1601d0(0x158))/0x5+parseInt(_0x1601d0(0x145))/0x6*(-parseInt(_0x1601d0(0x15e))/0x7)+-parseInt(_0x1601d0(0x124))/0x8+-parseInt(_0x1601d0(0x144))/0x9*(parseInt(_0x1601d0(0x153))/0xa)+parseInt(_0x1601d0(0x148))/0xb;if(_0x215f0c===_0x55d683)break;else _0x541336['push'](_0x541336['shift']());}catch(_0x456444){_0x541336['push'](_0x541336['shift']());}}}(a229_0x23de,0x8d544));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';function a229_0xde1a(_0x44e8e7,_0x584a96){_0x44e8e7=_0x44e8e7-0x123;const _0x23deaf=a229_0x23de();let _0xde1aa1=_0x23deaf[_0x44e8e7];return _0xde1aa1;}const VERSION_CHECK_SCRIPTS=new Set([a229_0xc3afe(0x14c),a229_0xc3afe(0x14a)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a229_0xc3afe(0x14c),a229_0xc3afe(0x14a),a229_0xc3afe(0x12d),'preview']);export function syncProjectDomainRoutingBeforeScript(_0x240ecd,_0x56398a){const _0x13663b=a229_0xc3afe;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x13663b(0x15f)](_0x56398a))return null;const _0x2e7cdd=findProjectRootDirectory(_0x240ecd);if(!resolveConfigPath(_0x2e7cdd))return null;const _0x1a7f52=writeProjectDomainRoutingManifest(_0x2e7cdd);return{'path':_0x1a7f52[_0x13663b(0x125)],'changed':_0x1a7f52[_0x13663b(0x164)]};}function readPackageScripts(_0x50a574){const _0x5ce4f1=a229_0xc3afe,_0x3c9c54=resolve(_0x50a574,_0x5ce4f1(0x14e));if(!existsSync(_0x3c9c54))return null;try{const _0x48a584=JSON[_0x5ce4f1(0x141)](readFileSync(_0x3c9c54,_0x5ce4f1(0x151)));return _0x48a584[_0x5ce4f1(0x157)]??{};}catch{return null;}}function detectPackageManager(_0xa09152){const _0x11e4cb=a229_0xc3afe;if(existsSync(resolve(_0xa09152,'bun.lockb'))||existsSync(resolve(_0xa09152,_0x11e4cb(0x149))))return'bun';if(existsSync(resolve(_0xa09152,_0x11e4cb(0x159))))return _0x11e4cb(0x14b);if(existsSync(resolve(_0xa09152,_0x11e4cb(0x13f))))return _0x11e4cb(0x140);return'npm';}async function versionCheck(_0x4288c2){const _0x3710b8=a229_0xc3afe,_0x527c34=await checkCliVersion();(_0x527c34[_0x3710b8(0x156)]||_0x527c34['belowMinimum'])&&(printCliUpgradeWarning(_0x527c34),assertCliVersionSupported(_0x527c34));const _0x4ded15=await checkSdkVersion(_0x4288c2);if(_0x4ded15[_0x3710b8(0x156)])printSdkUpgradeWarning(_0x4ded15);}function a229_0x23de(){const _0x2edcd6=['path','error','\x20run\x20preview','337207DkXsff','\x20run\x20<script>\x0a','\x20run\x20build','Run\x20a\x20package.json\x20script','script','build','108kKDSUy','--watch','Enable\x20watch\x20mode\x20for\x20preview','Available:\x20','write','vite','24252yPjUrN','preview','node_modules','bool','.bin','Script\x20\x22','Script\x20name\x20defined\x20in\x20package.json','6GcWpxy','\x20run\x20start','watch','\x0a\x20\x20Usage:\x20','yarn.lock','yarn','parse','push','keys','189XAYljT','1138050FKAfEy','run','\x20run\x20preview\x20--watch','6716677xzaZPK','bun.lock','dev','pnpm','start','No\x20package.json\x20found\x20in\x20current\x20directory.','package.json','inherit','vite\x20preview\x20exited\x20with\x20code\x20','utf-8','join','120340GyLQDc','cwd','close','needsUpgrade','scripts','3110480upQLda','pnpm-lock.yaml','\x20\x20EXAMPLES','\x20\x20\x20\x20','validation','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','42HUIMSG','has','log','\x20exited\x20with\x20code\x20','Domain\x20routing\x20synchronized:\x20','(none)','changed','args','451264xqfLVT'];a229_0x23de=function(){return _0x2edcd6;};return a229_0x23de();}function spawnScript(_0x1e34a9,_0x440d44,_0x23ac1f,_0x16b7b0){return new Promise((_0x526eb9,_0x130a0d)=>{const _0x150e4b=a229_0xde1a,_0x439cc6=['run',_0x440d44,..._0x23ac1f],_0x287b7b=spawn(_0x1e34a9,_0x439cc6,{'cwd':_0x16b7b0,'stdio':_0x150e4b(0x14f),'shell':!![],'env':{...process.env,'PATH':''+join(_0x16b7b0,_0x150e4b(0x136),_0x150e4b(0x138))+delimiter+process.env.PATH}});_0x287b7b['on'](_0x150e4b(0x155),_0x8d68db=>{const _0x144016=_0x150e4b;if(_0x8d68db===0x0||_0x8d68db===null)_0x526eb9();else _0x130a0d(new Error(_0x1e34a9+'\x20run\x20'+_0x440d44+_0x144016(0x161)+_0x8d68db));}),_0x287b7b['on'](_0x150e4b(0x126),_0x130a0d);});}function spawnViteBuildWatch(_0x1c542d){return new Promise((_0x235e64,_0x5ce74d)=>{const _0x1012be=a229_0xde1a,_0xaa1d1d=spawn('vite',[_0x1012be(0x12d),_0x1012be(0x12f)],{'cwd':_0x1c542d,'stdio':_0x1012be(0x14f),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1c542d,_0x1012be(0x136),_0x1012be(0x138))+delimiter+process.env.PATH}});_0xaa1d1d['on'](_0x1012be(0x155),_0x3ec813=>{const _0x2fbb1b=_0x1012be;if(_0x3ec813===0x0||_0x3ec813===null)_0x235e64();else _0x5ce74d(new Error(_0x2fbb1b(0x15d)+_0x3ec813));}),_0xaa1d1d['on'](_0x1012be(0x126),_0x5ce74d);});}function spawnVitePreview(_0x54a97e){return new Promise((_0x34b723,_0x59350b)=>{const _0x2ff307=a229_0xde1a,_0x219255=spawn(_0x2ff307(0x133),[_0x2ff307(0x135)],{'cwd':_0x54a97e,'stdio':_0x2ff307(0x14f),'shell':!![],'env':{...process.env,'PATH':''+join(_0x54a97e,_0x2ff307(0x136),_0x2ff307(0x138))+delimiter+process.env.PATH}});_0x219255['on'](_0x2ff307(0x155),_0x6d10de=>{const _0x360edb=_0x2ff307;if(_0x6d10de===0x0||_0x6d10de===null)_0x34b723();else _0x59350b(new Error(_0x360edb(0x150)+_0x6d10de));}),_0x219255['on'](_0x2ff307(0x126),_0x59350b);});}const runFlags=[{'name':a229_0xc3afe(0x13d),'type':'boolean','description':a229_0xc3afe(0x130),'default':![]}];export const runDefinition={'service':a229_0xc3afe(0x146),'command':'run','description':a229_0xc3afe(0x12b),'risk':a229_0xc3afe(0x132),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a229_0xc3afe(0x12c),'description':a229_0xc3afe(0x13a),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x27d0d3=a229_0xc3afe,_0x564b6e=[];return _0x564b6e[_0x27d0d3(0x142)](_0x27d0d3(0x15a)),_0x564b6e[_0x27d0d3(0x142)](_0x27d0d3(0x15b)+CLI_BIN_NAME+_0x27d0d3(0x13c)),_0x564b6e[_0x27d0d3(0x142)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x27d0d3(0x12a)),_0x564b6e[_0x27d0d3(0x142)](_0x27d0d3(0x15b)+CLI_BIN_NAME+_0x27d0d3(0x127)),_0x564b6e[_0x27d0d3(0x142)](_0x27d0d3(0x15b)+CLI_BIN_NAME+_0x27d0d3(0x147)),_0x564b6e[_0x27d0d3(0x152)]('\x0a');},async 'execute'(_0x594018){const _0x26080b=a229_0xc3afe,_0x223645=process[_0x26080b(0x154)](),_0x16a7c6=_0x594018[_0x26080b(0x123)][0x0],_0x43827b=_0x594018[_0x26080b(0x123)]['slice'](0x1),_0x38165c=readPackageScripts(_0x223645);if(!_0x38165c)throw CliErrors[_0x26080b(0x15c)](_0x26080b(0x14d));if(!_0x16a7c6){const _0x53977f=Object[_0x26080b(0x143)](_0x38165c);if(_0x53977f['length']===0x0)console[_0x26080b(0x160)]('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x26080b(0x160)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0xd26c58 of _0x53977f){console[_0x26080b(0x160)](_0x26080b(0x15b)+_0xd26c58);}console[_0x26080b(0x160)](_0x26080b(0x13e)+CLI_BIN_NAME+_0x26080b(0x129));}return{'ok':!![]};}if(!_0x38165c[_0x16a7c6])throw CliErrors['validation'](_0x26080b(0x139)+_0x16a7c6+'\x22\x20not\x20found\x20in\x20package.json.',_0x26080b(0x131)+(Object['keys'](_0x38165c)['join'](',\x20')||_0x26080b(0x163)));const _0x1a4a48=detectPackageManager(_0x223645),_0x565118=syncProjectDomainRoutingBeforeScript(_0x223645,_0x16a7c6);_0x565118?.['changed']&&console[_0x26080b(0x126)](_0x26080b(0x162)+_0x565118[_0x26080b(0x125)]);VERSION_CHECK_SCRIPTS['has'](_0x16a7c6)&&await versionCheck(_0x223645);if(_0x16a7c6===_0x26080b(0x135)&&_0x594018[_0x26080b(0x137)]('watch'))return await Promise['all']([spawnViteBuildWatch(_0x223645),spawnVitePreview(_0x223645)]),{'ok':!![]};return await spawnScript(_0x1a4a48,_0x16a7c6,_0x43827b,_0x223645),{'ok':!![]};}};
1
+ const a229_0x349cb9=a229_0x1e12;(function(_0x21c7a1,_0x53c9e3){const _0x29a60c=a229_0x1e12,_0x342e10=_0x21c7a1();while(!![]){try{const _0xbe9f41=parseInt(_0x29a60c(0x14f))/0x1+parseInt(_0x29a60c(0x141))/0x2+parseInt(_0x29a60c(0x137))/0x3+-parseInt(_0x29a60c(0x167))/0x4+-parseInt(_0x29a60c(0x140))/0x5+-parseInt(_0x29a60c(0x158))/0x6+parseInt(_0x29a60c(0x133))/0x7;if(_0xbe9f41===_0x53c9e3)break;else _0x342e10['push'](_0x342e10['shift']());}catch(_0x57c11f){_0x342e10['push'](_0x342e10['shift']());}}}(a229_0x518e,0xbfd00));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([a229_0x349cb9(0x169),'dev']),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a229_0x349cb9(0x169),'dev',a229_0x349cb9(0x156),a229_0x349cb9(0x15c)]);export function syncProjectDomainRoutingBeforeScript(_0x1bad76,_0x441322){const _0x80d293=a229_0x349cb9;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x80d293(0x166)](_0x441322))return null;const _0x35b75a=findProjectRootDirectory(_0x1bad76);if(!resolveConfigPath(_0x35b75a))return null;const _0x426d9e=writeProjectDomainRoutingManifest(_0x35b75a);return{'path':_0x426d9e[_0x80d293(0x15b)],'changed':_0x426d9e['changed']};}function readPackageScripts(_0x518f9b){const _0x96a7f=a229_0x349cb9,_0x379c4f=resolve(_0x518f9b,_0x96a7f(0x16c));if(!existsSync(_0x379c4f))return null;try{const _0x49cb05=JSON[_0x96a7f(0x16f)](readFileSync(_0x379c4f,_0x96a7f(0x142)));return _0x49cb05[_0x96a7f(0x168)]??{};}catch{return null;}}function detectPackageManager(_0x156015){const _0x422ad3=a229_0x349cb9;if(existsSync(resolve(_0x156015,_0x422ad3(0x139)))||existsSync(resolve(_0x156015,_0x422ad3(0x138))))return'bun';if(existsSync(resolve(_0x156015,_0x422ad3(0x15d))))return _0x422ad3(0x16b);if(existsSync(resolve(_0x156015,_0x422ad3(0x13d))))return _0x422ad3(0x14c);return _0x422ad3(0x16d);}async function versionCheck(_0x3185f9){const _0x5c5ed7=a229_0x349cb9,_0x121233=await checkCliVersion();(_0x121233['needsUpgrade']||_0x121233[_0x5c5ed7(0x148)])&&(printCliUpgradeWarning(_0x121233),assertCliVersionSupported(_0x121233));const _0x49bf4a=await checkSdkVersion(_0x3185f9);if(_0x49bf4a['needsUpgrade'])printSdkUpgradeWarning(_0x49bf4a);}function a229_0x1e12(_0x148004,_0x2b8426){_0x148004=_0x148004-0x132;const _0x518e66=a229_0x518e();let _0x1e12b7=_0x518e66[_0x148004];return _0x1e12b7;}function spawnScript(_0x1227b4,_0x5d564e,_0x5f30b9,_0x3a7a3b){return new Promise((_0x15bbdf,_0x57fa93)=>{const _0x2a2c99=a229_0x1e12,_0x246102=[_0x2a2c99(0x147),_0x5d564e,..._0x5f30b9],_0x4573b6=spawn(_0x1227b4,_0x246102,{'cwd':_0x3a7a3b,'stdio':_0x2a2c99(0x136),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3a7a3b,'node_modules','.bin')+delimiter+process.env.PATH}});_0x4573b6['on'](_0x2a2c99(0x151),_0x251f8d=>{const _0x405aea=_0x2a2c99;if(_0x251f8d===0x0||_0x251f8d===null)_0x15bbdf();else _0x57fa93(new Error(_0x1227b4+_0x405aea(0x132)+_0x5d564e+_0x405aea(0x162)+_0x251f8d));}),_0x4573b6['on'](_0x2a2c99(0x165),_0x57fa93);});}function spawnViteBuildWatch(_0x3e2367){return new Promise((_0x85a31c,_0x42cf85)=>{const _0x1b0db6=a229_0x1e12,_0x3145c2=spawn(_0x1b0db6(0x161),['build',_0x1b0db6(0x163)],{'cwd':_0x3e2367,'stdio':_0x1b0db6(0x136),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3e2367,_0x1b0db6(0x13f),_0x1b0db6(0x164))+delimiter+process.env.PATH}});_0x3145c2['on'](_0x1b0db6(0x151),_0x1b22ed=>{const _0x30339e=_0x1b0db6;if(_0x1b22ed===0x0||_0x1b22ed===null)_0x85a31c();else _0x42cf85(new Error(_0x30339e(0x13e)+_0x1b22ed));}),_0x3145c2['on'](_0x1b0db6(0x165),_0x42cf85);});}function a229_0x518e(){const _0x489dfc=['2664925XAyvMd','2480156rVTfmU','utf-8','No\x20package.json\x20found\x20in\x20current\x20directory.','Script\x20name\x20defined\x20in\x20package.json','Domain\x20routing\x20synchronized:\x20','No\x20scripts\x20defined\x20in\x20package.json.','run','belowMinimum','keys','\x0a\x20\x20Available\x20scripts:\x0a','script','yarn','\x20run\x20preview\x20--watch','join','423182zQDopm','(none)','close','write','slice','boolean','watch','build','all','3783024yqRuSa','Run\x20a\x20package.json\x20script','Available:\x20','path','preview','pnpm-lock.yaml','log','\x20run\x20build','vite\x20preview\x20exited\x20with\x20code\x20','vite','\x20exited\x20with\x20code\x20','--watch','.bin','error','has','2089200ZCfHzw','scripts','start','\x22\x20not\x20found\x20in\x20package.json.','pnpm','package.json','npm','length','parse','\x20run\x20<script>\x0a','\x20run\x20','2227743BICPZQ','\x20\x20\x20\x20','\x20run\x20start','inherit','1469832UsyPhP','bun.lock','bun.lockb','push','args','bool','yarn.lock','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','node_modules'];a229_0x518e=function(){return _0x489dfc;};return a229_0x518e();}function spawnVitePreview(_0x5c8fc8){return new Promise((_0x3fd97c,_0x2440c0)=>{const _0x407cba=a229_0x1e12,_0x45f665=spawn('vite',[_0x407cba(0x15c)],{'cwd':_0x5c8fc8,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x5c8fc8,'node_modules',_0x407cba(0x164))+delimiter+process.env.PATH}});_0x45f665['on'](_0x407cba(0x151),_0x350093=>{const _0x4131ed=_0x407cba;if(_0x350093===0x0||_0x350093===null)_0x3fd97c();else _0x2440c0(new Error(_0x4131ed(0x160)+_0x350093));}),_0x45f665['on'](_0x407cba(0x165),_0x2440c0);});}const runFlags=[{'name':a229_0x349cb9(0x155),'type':a229_0x349cb9(0x154),'description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':'run','command':a229_0x349cb9(0x147),'description':a229_0x349cb9(0x159),'risk':a229_0x349cb9(0x152),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a229_0x349cb9(0x14b),'description':a229_0x349cb9(0x144),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x3bd597=a229_0x349cb9,_0x421162=[];return _0x421162[_0x3bd597(0x13a)]('\x20\x20EXAMPLES'),_0x421162[_0x3bd597(0x13a)](_0x3bd597(0x134)+CLI_BIN_NAME+_0x3bd597(0x135)),_0x421162[_0x3bd597(0x13a)](_0x3bd597(0x134)+CLI_BIN_NAME+_0x3bd597(0x15f)),_0x421162['push'](_0x3bd597(0x134)+CLI_BIN_NAME+'\x20run\x20preview'),_0x421162[_0x3bd597(0x13a)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x3bd597(0x14d)),_0x421162[_0x3bd597(0x14e)]('\x0a');},async 'execute'(_0x42954c){const _0x55ca8e=a229_0x349cb9,_0x427341=process['cwd'](),_0x2c9050=_0x42954c[_0x55ca8e(0x13b)][0x0],_0x45c97f=_0x42954c[_0x55ca8e(0x13b)][_0x55ca8e(0x153)](0x1),_0xa1a8d4=readPackageScripts(_0x427341);if(!_0xa1a8d4)throw CliErrors['validation'](_0x55ca8e(0x143));if(!_0x2c9050){const _0x22131a=Object[_0x55ca8e(0x149)](_0xa1a8d4);if(_0x22131a[_0x55ca8e(0x16e)]===0x0)console[_0x55ca8e(0x15e)](_0x55ca8e(0x146));else{console[_0x55ca8e(0x15e)](_0x55ca8e(0x14a));for(const _0x27ca0b of _0x22131a){console[_0x55ca8e(0x15e)]('\x20\x20\x20\x20'+_0x27ca0b);}console['log']('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+_0x55ca8e(0x170));}return{'ok':!![]};}if(!_0xa1a8d4[_0x2c9050])throw CliErrors['validation']('Script\x20\x22'+_0x2c9050+_0x55ca8e(0x16a),_0x55ca8e(0x15a)+(Object[_0x55ca8e(0x149)](_0xa1a8d4)[_0x55ca8e(0x14e)](',\x20')||_0x55ca8e(0x150)));const _0x1a43a8=detectPackageManager(_0x427341),_0x495266=syncProjectDomainRoutingBeforeScript(_0x427341,_0x2c9050);_0x495266?.['changed']&&console[_0x55ca8e(0x165)](_0x55ca8e(0x145)+_0x495266[_0x55ca8e(0x15b)]);VERSION_CHECK_SCRIPTS['has'](_0x2c9050)&&await versionCheck(_0x427341);if(_0x2c9050==='preview'&&_0x42954c[_0x55ca8e(0x13c)](_0x55ca8e(0x155)))return await Promise[_0x55ca8e(0x157)]([spawnViteBuildWatch(_0x427341),spawnVitePreview(_0x427341)]),{'ok':!![]};return await spawnScript(_0x1a43a8,_0x2c9050,_0x45c97f,_0x427341),{'ok':!![]};}};
@@ -1 +1 @@
1
- function a230_0xf2d5(){const _0x3ffa29=['13583670GObsXa','135303BIrpYD','96IfTGkz','952074JgCJNj','read','590USZuwj','schema','396890JGhFsK','57368784bCXsjw','5460ckVJiL','3448TDuMML','json','39ciZvml','export','120GOCZdY','Export\x20machine-readable\x20command\x20schema\x20(JSON)'];a230_0xf2d5=function(){return _0x3ffa29;};return a230_0xf2d5();}const a230_0x175f2d=a230_0x234b;(function(_0x1320c7,_0x4e9839){const _0x4423b5=a230_0x234b,_0x30cf28=_0x1320c7();while(!![]){try{const _0x1413f1=parseInt(_0x4423b5(0x1cd))/0x1*(-parseInt(_0x4423b5(0x1d2))/0x2)+parseInt(_0x4423b5(0x1d4))/0x3*(-parseInt(_0x4423b5(0x1d1))/0x4)+parseInt(_0x4423b5(0x1cf))/0x5*(-parseInt(_0x4423b5(0x1d6))/0x6)+-parseInt(_0x4423b5(0x1d9))/0x7*(parseInt(_0x4423b5(0x1da))/0x8)+-parseInt(_0x4423b5(0x1db))/0x9+-parseInt(_0x4423b5(0x1d8))/0xa+parseInt(_0x4423b5(0x1d0))/0xb;if(_0x1413f1===_0x4e9839)break;else _0x30cf28['push'](_0x30cf28['shift']());}catch(_0x393b5f){_0x30cf28['push'](_0x30cf28['shift']());}}}(a230_0xf2d5,0xdaf0a));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0xb8a65a){const _0x3d2c6d=await buildSchemaPayload();return{'ok':!![],'data':_0x3d2c6d};}function a230_0x234b(_0x60fb48,_0x530f14){_0x60fb48=_0x60fb48-0x1cd;const _0xf2d5a3=a230_0xf2d5();let _0x234beb=_0xf2d5a3[_0x60fb48];return _0x234beb;}export const schemaDefinition={'service':a230_0x175f2d(0x1ce),'command':a230_0x175f2d(0x1d5),'description':a230_0x175f2d(0x1d7),'risk':a230_0x175f2d(0x1dc),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a230_0x175f2d(0x1d3),'flags':[],'execute':execute};
1
+ const a230_0x6004b9=a230_0x492a;function a230_0x2569(){const _0x381535=['export','1605717PFUCdK','1011652HUfOaA','read','2228751sLJKmq','434706MKGvpY','3983190cxbspf','693440nnBcvJ','1211920tEyQLf','json','Export\x20machine-readable\x20command\x20schema\x20(JSON)'];a230_0x2569=function(){return _0x381535;};return a230_0x2569();}(function(_0x4bd4a7,_0xecde19){const _0x4631a9=a230_0x492a,_0x3e7b3d=_0x4bd4a7();while(!![]){try{const _0x1c7134=-parseInt(_0x4631a9(0x1f6))/0x1+-parseInt(_0x4631a9(0x1f9))/0x2+parseInt(_0x4631a9(0x1f2))/0x3+-parseInt(_0x4631a9(0x1f3))/0x4+parseInt(_0x4631a9(0x1f8))/0x5+parseInt(_0x4631a9(0x1f7))/0x6+parseInt(_0x4631a9(0x1f5))/0x7;if(_0x1c7134===_0xecde19)break;else _0x3e7b3d['push'](_0x3e7b3d['shift']());}catch(_0x2d46c6){_0x3e7b3d['push'](_0x3e7b3d['shift']());}}}(a230_0x2569,0x5886e));function a230_0x492a(_0x2c3b8c,_0x4f9db8){_0x2c3b8c=_0x2c3b8c-0x1ef;const _0x25691f=a230_0x2569();let _0x492a75=_0x25691f[_0x2c3b8c];return _0x492a75;}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x7d05a7){const _0x1df877=await buildSchemaPayload();return{'ok':!![],'data':_0x1df877};}export const schemaDefinition={'service':'schema','command':a230_0x6004b9(0x1f1),'description':a230_0x6004b9(0x1f0),'risk':a230_0x6004b9(0x1f4),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a230_0x6004b9(0x1ef),'flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a231_0x3de311=a231_0x3758;(function(_0x461504,_0x27d43f){const _0xaff045=a231_0x3758,_0x55ca0=_0x461504();while(!![]){try{const _0x2264e6=parseInt(_0xaff045(0x85))/0x1*(parseInt(_0xaff045(0x97))/0x2)+-parseInt(_0xaff045(0xa2))/0x3+parseInt(_0xaff045(0x6f))/0x4+-parseInt(_0xaff045(0x84))/0x5+-parseInt(_0xaff045(0x7e))/0x6*(-parseInt(_0xaff045(0x9d))/0x7)+parseInt(_0xaff045(0x8d))/0x8+parseInt(_0xaff045(0x7c))/0x9;if(_0x2264e6===_0x27d43f)break;else _0x55ca0['push'](_0x55ca0['shift']());}catch(_0x47c3a5){_0x55ca0['push'](_0x55ca0['shift']());}}}(a231_0x201e,0xa6f5f));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';function a231_0x3758(_0x28e9b7,_0x331ddc){_0x28e9b7=_0x28e9b7-0x6b;const _0x201ea3=a231_0x201e();let _0x3758b0=_0x201ea3[_0x28e9b7];return _0x3758b0;}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(_0x5d3472){const _0xefb885=a231_0x3758;if(_0x5d3472===_0xefb885(0x72))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','\x20\x20SELECT\x201\x20AS\x20id',_0xefb885(0x8e),''][_0xefb885(0x70)]('\x0a');return[_0xefb885(0xa6),''][_0xefb885(0x70)]('\x0a');}export const sqlCreate={'service':a231_0x3de311(0x83),'command':a231_0x3de311(0x82),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a231_0x3de311(0x76),'flags':[{'name':a231_0x3de311(0x75),'type':a231_0x3de311(0x87),'description':a231_0x3de311(0x9a)},{'name':a231_0x3de311(0x90),'type':a231_0x3de311(0x9f),'description':a231_0x3de311(0x71)},{'name':'mode','type':'string','enum':[a231_0x3de311(0x83),a231_0x3de311(0x72)],'description':a231_0x3de311(0x88)}],async 'validate'(_0x428a08){const _0x5948e3=a231_0x3de311;if(!_0x428a08['nonInteractive'])return;if(!_0x428a08['str'](_0x5948e3(0x75))[_0x5948e3(0x96)]())throw CliErrors[_0x5948e3(0x95)](_0x5948e3(0x75),_0x5948e3(0x8a));const _0x1d6c36=resolveProvidedDbId(_0x428a08);if(typeof _0x1d6c36!==_0x5948e3(0x9f)||!Number[_0x5948e3(0x89)](_0x1d6c36)||_0x1d6c36<=0x0)throw CliErrors[_0x5948e3(0x95)](_0x5948e3(0x90),_0x5948e3(0x6e));if(!_0x428a08[_0x5948e3(0x77)](_0x5948e3(0xa7))[_0x5948e3(0x96)]())throw CliErrors[_0x5948e3(0x95)]('mode',_0x5948e3(0x79));},async 'dryRun'(_0x28b62f){const _0x5ad542=a231_0x3de311,_0x40a5e4=loadSqlProjectConfig(_0x28b62f[_0x5ad542(0x91)]),{sqlName:_0xd1a84f,dbId:_0x87ff33,dbName:_0x291d6c,mode:_0x1dba75}=await resolveSqlNewInputs(_0x28b62f),_0x4f476e=buildSqlRelativePath(_0x5ad542(0xa4),_0xd1a84f,_0x291d6c,_0x1dba75,_0x87ff33),_0xb7e2cc=_0x40a5e4['sqlRootDir']+'/'+_0x4f476e;return{'method':_0x5ad542(0x8f),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x28b62f[_0x5ad542(0x91)],'sqlName':_0xd1a84f,'dbId':_0x87ff33,'mode':_0x1dba75,'localPath':_0xb7e2cc},'description':_0x5ad542(0x92)+_0x40a5e4['sqlRootDir']};},async 'execute'(_0x105bd6){const _0x15b883=a231_0x3de311,_0x24fe77=loadSqlProjectConfig(_0x105bd6[_0x15b883(0x91)]),{sqlName:_0xd4b053,dbId:_0xa966da,dbName:_0x20a5f2,mode:_0xdcbd76}=await resolveSqlNewInputs(_0x105bd6),_0x3435f5=generateSqlTemplate(_0xdcbd76),_0x4e07f6=await createSqlQuery({'appCode':_0x105bd6[_0x15b883(0x91)],'sqlName':_0xd4b053,'dbId':_0xa966da,'sqlContent':_0x3435f5}),_0x409ba2=ensureRemoteSqlContent(_0x4e07f6),_0x5d10e1=_0x20a5f2||await getDbName(_0x105bd6['appCode'],_0xa966da)[_0x15b883(0x9c)](()=>undefined),_0x1c3318=buildSqlRelativePath(_0x4e07f6[_0x15b883(0x8b)],_0x4e07f6[_0x15b883(0x7f)],_0x5d10e1,_0xdcbd76,_0xa966da),_0x4ab01d=_0x24fe77[_0x15b883(0xa5)]+'/'+_0x1c3318,_0x32eb9b=buildLocalSqlFileContent({'sqlCode':_0x4e07f6[_0x15b883(0x8b)],'sqlName':_0x4e07f6[_0x15b883(0x7f)],'dbId':_0x4e07f6[_0x15b883(0x9b)]},_0x409ba2,{'dbName':_0x5d10e1,'mode':_0xdcbd76,'syncedAt':new Date()['toISOString'](),'description':_0x4e07f6['description']});if(await fileExists(_0x4ab01d))throw CliErrors[_0x15b883(0x8c)](_0x15b883(0x6d)+_0x4ab01d);await ensureParentDirectory(_0x4ab01d),await writeFile(_0x4ab01d,_0x32eb9b,'utf8');const _0x2dc9b5=await readSqlLockFile(_0x24fe77[_0x15b883(0x94)]),{lockData:_0x174c16,appLock:_0x25cb0c}=ensureSqlLockScope(_0x2dc9b5??createEmptySqlLock(),_0x24fe77['appCode'],_0x24fe77['sqlRoot'],_0x15b883(0xa1));return _0x25cb0c[_0x15b883(0xa0)][_0x4e07f6['sqlCode']]={...buildSqlLockEntry(_0x4e07f6,_0x409ba2,computeSqlContentHash(_0x32eb9b),{'dbName':_0x5d10e1}),'path':_0x1c3318,'mode':_0xdcbd76},_0x25cb0c[_0x15b883(0x9e)]=new Date()[_0x15b883(0xa9)](),await writeSqlLockFile(_0x24fe77['lockFilePath'],_0x174c16),{'ok':!![],'data':{'id':_0x4e07f6['id'],'sqlCode':_0x4e07f6[_0x15b883(0x8b)],'sqlName':_0x4e07f6[_0x15b883(0x7f)],'dbId':_0x4e07f6[_0x15b883(0x9b)],'path':_0x4ab01d,'mode':_0xdcbd76},'message':_0x15b883(0xa8)+_0x4e07f6[_0x15b883(0x8b)]};}};async function resolveSqlNewInputs(_0x3bf1bc){const _0x3400c3=await resolveSqlNameInput(_0x3bf1bc),{dbId:_0x58f913,dbName:_0x54603b}=await resolveDbSelection(_0x3bf1bc),_0x32aff1=await resolveSqlModeInput(_0x3bf1bc);return{'sqlName':_0x3400c3,'dbId':_0x58f913,'dbName':_0x54603b,'mode':_0x32aff1};}async function resolveSqlNameInput(_0x257c24){const _0x3c2f71=a231_0x3de311,_0x55ef7e=_0x257c24['str'](_0x3c2f71(0x75))[_0x3c2f71(0x96)]();if(_0x55ef7e)return _0x55ef7e;if(_0x257c24[_0x3c2f71(0xaa)])throw CliErrors[_0x3c2f71(0x95)](_0x3c2f71(0x75),_0x3c2f71(0x8a));return(await input({'message':_0x3c2f71(0x6c),'validate':_0x6ed25f=>_0x6ed25f[_0x3c2f71(0x96)]()?!![]:_0x3c2f71(0x93)}))['trim']();}async function resolveDbSelection(_0x113fa3){const _0x33828d=a231_0x3de311,_0x3e0233=resolveProvidedDbId(_0x113fa3);if(typeof _0x3e0233==='number'&&Number[_0x33828d(0x89)](_0x3e0233)&&_0x3e0233>0x0)return{'dbId':_0x3e0233,'dbName':await getDbName(_0x113fa3[_0x33828d(0x91)],_0x3e0233)['catch'](()=>undefined)};if(_0x113fa3[_0x33828d(0xaa)])throw CliErrors[_0x33828d(0x95)]('db-id',_0x33828d(0x6e));const _0x2ceade=await listDatabases(_0x113fa3['appCode'])[_0x33828d(0x9c)](()=>[]);if(_0x2ceade['length']===0x1)return{'dbId':_0x2ceade[0x0]['dbId'],'dbName':_0x2ceade[0x0][_0x33828d(0x78)]};if(_0x2ceade[_0x33828d(0x73)]>0x1){const _0x426aa3=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0x2ceade['map'](_0x13f571=>({'name':_0x13f571[_0x33828d(0x78)]+'\x20('+_0x13f571['dbId']+')','value':serializeDbSelection(_0x13f571)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':_0x33828d(0x99)}]});if(_0x426aa3!==_0x33828d(0x99))return deserializeDbSelection(_0x426aa3);}const _0x229a87=await input({'message':_0x33828d(0x81),'validate':_0x4be071=>{const _0x5f516f=_0x33828d,_0x2c6d27=_0x4be071[_0x5f516f(0x96)]();if(!_0x2c6d27)return _0x5f516f(0x7d);const _0x48a986=Number(_0x2c6d27);if(!Number[_0x5f516f(0xa3)](_0x48a986)||_0x48a986<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x229a87[_0x33828d(0x96)]())};}function a231_0x201e(){const _0xe0d065=['For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','Target\x20database\x20dbId:','create','sql','6759820siAKPL','24rzCLPF','flag','string','Local\x20SQL\x20file\x20mode','isFinite','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlCode','validation','3867888YmXGUs','</select>','POST','db-id','appCode','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','SQL\x20name\x20cannot\x20be\x20empty','lockFilePath','flagMissing','trim','64244lXPUYf','stringify','__manual__','SQL\x20query\x20display\x20name','dbId','catch','91WkFfXG','lastSync','number','sqls','new','2389146TJqXgx','isInteger','<server-generated-sqlCode>','sqlRootDir','SELECT\x201\x20AS\x20id;','mode','Created\x20SQL\x20query\x20','toISOString','nonInteractive','Select\x20the\x20local\x20SQL\x20mode:','Invalid\x20database\x20selection\x20payload:\x20','SQL\x20name:','File\x20already\x20exists:\x20','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','4392208UYYNHe','join','Target\x20database\x20ID','mybatisXml','length','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','name','write','str','dbName','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','MyBatis\x20XML\x20(mybatisXml)','Plain\x20SQL\x20(sql)','3307698DXklTG','dbId\x20cannot\x20be\x20empty','51798jVMtux','sqlName'];a231_0x201e=function(){return _0xe0d065;};return a231_0x201e();}async function resolveSqlModeInput(_0x23099c){const _0x3abf89=a231_0x3de311,_0x1c7ae0=_0x23099c[_0x3abf89(0x77)](_0x3abf89(0xa7))[_0x3abf89(0x96)]();if(_0x1c7ae0===_0x3abf89(0x83)||_0x1c7ae0===_0x3abf89(0x72))return _0x1c7ae0;if(_0x23099c[_0x3abf89(0xaa)])throw CliErrors[_0x3abf89(0x95)](_0x3abf89(0xa7),_0x3abf89(0x79));return await select({'message':_0x3abf89(0xab),'choices':[{'name':_0x3abf89(0x7b),'value':_0x3abf89(0x83),'description':_0x3abf89(0x74)},{'name':_0x3abf89(0x7a),'value':_0x3abf89(0x72),'description':_0x3abf89(0x80)}]});}function serializeDbSelection(_0x560b24){const _0x10278f=a231_0x3de311;return JSON[_0x10278f(0x98)]({'dbId':_0x560b24[_0x10278f(0x9b)],'dbName':_0x560b24['dbName']});}function deserializeDbSelection(_0x2087df){const _0x741792=a231_0x3de311;try{const _0x4c986a=JSON['parse'](_0x2087df);if(typeof _0x4c986a['dbId']===_0x741792(0x9f)&&Number[_0x741792(0x89)](_0x4c986a[_0x741792(0x9b)]))return{'dbId':_0x4c986a[_0x741792(0x9b)],'dbName':_0x4c986a[_0x741792(0x78)]};}catch{}throw CliErrors[_0x741792(0x8c)](_0x741792(0x6b)+_0x2087df);}function resolveProvidedDbId(_0x12e557){const _0x4a2409=a231_0x3de311,_0x48a683=_0x12e557[_0x4a2409(0x86)]('db-id');if(typeof _0x48a683===_0x4a2409(0x9f)&&Number[_0x4a2409(0x89)](_0x48a683))return _0x48a683;return undefined;}
1
+ const a231_0x4b010c=a231_0x48fa;(function(_0x3ead00,_0x5efb51){const _0x49ef1a=a231_0x48fa,_0x5b5748=_0x3ead00();while(!![]){try{const _0x5e06be=parseInt(_0x49ef1a(0x87))/0x1+-parseInt(_0x49ef1a(0x8f))/0x2+parseInt(_0x49ef1a(0xc8))/0x3+parseInt(_0x49ef1a(0xcb))/0x4+-parseInt(_0x49ef1a(0xaa))/0x5*(-parseInt(_0x49ef1a(0xbb))/0x6)+-parseInt(_0x49ef1a(0x9a))/0x7*(-parseInt(_0x49ef1a(0xb2))/0x8)+-parseInt(_0x49ef1a(0x92))/0x9;if(_0x5e06be===_0x5efb51)break;else _0x5b5748['push'](_0x5b5748['shift']());}catch(_0x438fbc){_0x5b5748['push'](_0x5b5748['shift']());}}}(a231_0x4c02,0x8f37e));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(_0x47409c){const _0xca4f7f=a231_0x48fa;if(_0x47409c===_0xca4f7f(0xa0))return[_0xca4f7f(0xad),_0xca4f7f(0xc6),_0xca4f7f(0xc9),'']['join']('\x0a');return[_0xca4f7f(0xc5),''][_0xca4f7f(0x9f)]('\x0a');}function a231_0x4c02(){const _0x1265a6=['str','nonInteractive','sqlRoot','Local\x20SQL\x20file\x20mode','join','mybatisXml','SQL\x20name\x20cannot\x20be\x20empty','sqls','validation','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','dbName','<server-generated-sqlCode>','lockFilePath','dbId','name','261235DLfQMs','File\x20already\x20exists:\x20','toISOString','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','Invalid\x20database\x20selection\x20payload:\x20','sqlCode','sql','SQL\x20name:','2776WRZaQD','write','map','dbId\x20cannot\x20be\x20empty','Plain\x20SQL\x20(sql)','__manual__','catch','length','create','42clLhAg','flag','SQL\x20query\x20display\x20name','mode','flagMissing','Created\x20SQL\x20query\x20','new','Select\x20the\x20local\x20SQL\x20mode:','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','number','SELECT\x201\x20AS\x20id;','\x20\x20SELECT\x201\x20AS\x20id','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','1019781NsdGQd','</select>','stringify','3403032Rehczo','POST','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','311459okjIRZ','parse','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','/smartapi/custom/saveUserCustomSql','trim','description','string','sqlName','1589184FIXVYE','Target\x20database\x20dbId:','sqlRootDir','14382900PhtONI','isFinite','db-id','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','utf8','MyBatis\x20XML\x20(mybatisXml)','appCode','isInteger','22421gcWImA'];a231_0x4c02=function(){return _0x1265a6;};return a231_0x4c02();}export const sqlCreate={'service':a231_0x4b010c(0xb0),'command':a231_0x4b010c(0xba),'description':a231_0x4b010c(0xc7),'risk':a231_0x4b010c(0xb3),'flags':[{'name':a231_0x4b010c(0xa9),'type':a231_0x4b010c(0x8d),'description':a231_0x4b010c(0xbd)},{'name':a231_0x4b010c(0x94),'type':a231_0x4b010c(0xc4),'description':'Target\x20database\x20ID'},{'name':a231_0x4b010c(0xbe),'type':a231_0x4b010c(0x8d),'enum':[a231_0x4b010c(0xb0),a231_0x4b010c(0xa0)],'description':a231_0x4b010c(0x9e)}],async 'validate'(_0x55dbb4){const _0x33d0c7=a231_0x4b010c;if(!_0x55dbb4[_0x33d0c7(0x9c)])return;if(!_0x55dbb4['str'](_0x33d0c7(0xa9))[_0x33d0c7(0x8b)]())throw CliErrors['flagMissing'](_0x33d0c7(0xa9),_0x33d0c7(0xa4));const _0x339db4=resolveProvidedDbId(_0x55dbb4);if(typeof _0x339db4!==_0x33d0c7(0xc4)||!Number[_0x33d0c7(0x93)](_0x339db4)||_0x339db4<=0x0)throw CliErrors['flagMissing']('db-id',_0x33d0c7(0x95));if(!_0x55dbb4['str'](_0x33d0c7(0xbe))[_0x33d0c7(0x8b)]())throw CliErrors[_0x33d0c7(0xbf)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x173444){const _0x53dcd4=a231_0x4b010c,_0x5d4ddd=loadSqlProjectConfig(_0x173444[_0x53dcd4(0x98)]),{sqlName:_0x31ee3f,dbId:_0x174083,dbName:_0x4c3095,mode:_0x2bc6e8}=await resolveSqlNewInputs(_0x173444),_0x3c3d11=buildSqlRelativePath(_0x53dcd4(0xa6),_0x31ee3f,_0x4c3095,_0x2bc6e8,_0x174083),_0x2542c8=_0x5d4ddd['sqlRootDir']+'/'+_0x3c3d11;return{'method':_0x53dcd4(0x85),'url':_0x53dcd4(0x8a),'body':{'appCode':_0x173444[_0x53dcd4(0x98)],'sqlName':_0x31ee3f,'dbId':_0x174083,'mode':_0x2bc6e8,'localPath':_0x2542c8},'description':_0x53dcd4(0xc3)+_0x5d4ddd['sqlRootDir']};},async 'execute'(_0x5eb3e1){const _0x2da55f=a231_0x4b010c,_0x1e4d27=loadSqlProjectConfig(_0x5eb3e1[_0x2da55f(0x98)]),{sqlName:_0x1898c9,dbId:_0x1e449d,dbName:_0x2ae2ec,mode:_0x1179a4}=await resolveSqlNewInputs(_0x5eb3e1),_0x521afe=generateSqlTemplate(_0x1179a4),_0x57c225=await createSqlQuery({'appCode':_0x5eb3e1[_0x2da55f(0x98)],'sqlName':_0x1898c9,'dbId':_0x1e449d,'sqlContent':_0x521afe}),_0x47d7a0=ensureRemoteSqlContent(_0x57c225),_0x4fb59e=_0x2ae2ec||await getDbName(_0x5eb3e1[_0x2da55f(0x98)],_0x1e449d)[_0x2da55f(0xb8)](()=>undefined),_0xa7bd80=buildSqlRelativePath(_0x57c225[_0x2da55f(0xaf)],_0x57c225[_0x2da55f(0x8e)],_0x4fb59e,_0x1179a4,_0x1e449d),_0x467c66=_0x1e4d27[_0x2da55f(0x91)]+'/'+_0xa7bd80,_0x35cfd8=buildLocalSqlFileContent({'sqlCode':_0x57c225['sqlCode'],'sqlName':_0x57c225[_0x2da55f(0x8e)],'dbId':_0x57c225[_0x2da55f(0xa8)]},_0x47d7a0,{'dbName':_0x4fb59e,'mode':_0x1179a4,'syncedAt':new Date()[_0x2da55f(0xac)](),'description':_0x57c225[_0x2da55f(0x8c)]});if(await fileExists(_0x467c66))throw CliErrors['validation'](_0x2da55f(0xab)+_0x467c66);await ensureParentDirectory(_0x467c66),await writeFile(_0x467c66,_0x35cfd8,_0x2da55f(0x96));const _0x218604=await readSqlLockFile(_0x1e4d27['lockFilePath']),{lockData:_0x330854,appLock:_0x4905fd}=ensureSqlLockScope(_0x218604??createEmptySqlLock(),_0x1e4d27[_0x2da55f(0x98)],_0x1e4d27[_0x2da55f(0x9d)],_0x2da55f(0xc1));return _0x4905fd[_0x2da55f(0xa2)][_0x57c225['sqlCode']]={...buildSqlLockEntry(_0x57c225,_0x47d7a0,computeSqlContentHash(_0x35cfd8),{'dbName':_0x4fb59e}),'path':_0xa7bd80,'mode':_0x1179a4},_0x4905fd['lastSync']=new Date()[_0x2da55f(0xac)](),await writeSqlLockFile(_0x1e4d27[_0x2da55f(0xa7)],_0x330854),{'ok':!![],'data':{'id':_0x57c225['id'],'sqlCode':_0x57c225['sqlCode'],'sqlName':_0x57c225[_0x2da55f(0x8e)],'dbId':_0x57c225[_0x2da55f(0xa8)],'path':_0x467c66,'mode':_0x1179a4},'message':_0x2da55f(0xc0)+_0x57c225[_0x2da55f(0xaf)]};}};function a231_0x48fa(_0x565727,_0x2c5a80){_0x565727=_0x565727-0x85;const _0x4c02c7=a231_0x4c02();let _0x48fa94=_0x4c02c7[_0x565727];return _0x48fa94;}async function resolveSqlNewInputs(_0x3b6a97){const _0x12ef7d=await resolveSqlNameInput(_0x3b6a97),{dbId:_0x311204,dbName:_0x27bba9}=await resolveDbSelection(_0x3b6a97),_0x4bd148=await resolveSqlModeInput(_0x3b6a97);return{'sqlName':_0x12ef7d,'dbId':_0x311204,'dbName':_0x27bba9,'mode':_0x4bd148};}async function resolveSqlNameInput(_0x2ed70a){const _0x5d1c5d=a231_0x4b010c,_0x4e42b2=_0x2ed70a[_0x5d1c5d(0x9b)](_0x5d1c5d(0xa9))[_0x5d1c5d(0x8b)]();if(_0x4e42b2)return _0x4e42b2;if(_0x2ed70a[_0x5d1c5d(0x9c)])throw CliErrors[_0x5d1c5d(0xbf)]('name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x5d1c5d(0xb1),'validate':_0x3810bd=>_0x3810bd[_0x5d1c5d(0x8b)]()?!![]:_0x5d1c5d(0xa1)}))[_0x5d1c5d(0x8b)]();}async function resolveDbSelection(_0x2121cb){const _0x1628df=a231_0x4b010c,_0x52675d=resolveProvidedDbId(_0x2121cb);if(typeof _0x52675d===_0x1628df(0xc4)&&Number[_0x1628df(0x93)](_0x52675d)&&_0x52675d>0x0)return{'dbId':_0x52675d,'dbName':await getDbName(_0x2121cb['appCode'],_0x52675d)[_0x1628df(0xb8)](()=>undefined)};if(_0x2121cb[_0x1628df(0x9c)])throw CliErrors[_0x1628df(0xbf)](_0x1628df(0x94),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x1455ea=await listDatabases(_0x2121cb[_0x1628df(0x98)])['catch'](()=>[]);if(_0x1455ea[_0x1628df(0xb9)]===0x1)return{'dbId':_0x1455ea[0x0]['dbId'],'dbName':_0x1455ea[0x0][_0x1628df(0xa5)]};if(_0x1455ea['length']>0x1){const _0xc39461=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0x1455ea[_0x1628df(0xb4)](_0x165e61=>({'name':_0x165e61['dbName']+'\x20('+_0x165e61[_0x1628df(0xa8)]+')','value':serializeDbSelection(_0x165e61)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':_0x1628df(0xb7)}]});if(_0xc39461!==_0x1628df(0xb7))return deserializeDbSelection(_0xc39461);}const _0x2de8e7=await input({'message':_0x1628df(0x90),'validate':_0x3969bf=>{const _0x52830d=_0x1628df,_0x4b32b7=_0x3969bf[_0x52830d(0x8b)]();if(!_0x4b32b7)return _0x52830d(0xb5);const _0x50c5ba=Number(_0x4b32b7);if(!Number[_0x52830d(0x99)](_0x50c5ba)||_0x50c5ba<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x2de8e7[_0x1628df(0x8b)]())};}async function resolveSqlModeInput(_0x438072){const _0x2a9c88=a231_0x4b010c,_0x49c88f=_0x438072['str'](_0x2a9c88(0xbe))[_0x2a9c88(0x8b)]();if(_0x49c88f===_0x2a9c88(0xb0)||_0x49c88f==='mybatisXml')return _0x49c88f;if(_0x438072[_0x2a9c88(0x9c)])throw CliErrors[_0x2a9c88(0xbf)](_0x2a9c88(0xbe),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x2a9c88(0xc2),'choices':[{'name':_0x2a9c88(0xb6),'value':_0x2a9c88(0xb0),'description':_0x2a9c88(0x86)},{'name':_0x2a9c88(0x97),'value':_0x2a9c88(0xa0),'description':_0x2a9c88(0x89)}]});}function serializeDbSelection(_0x1b6fb5){const _0x49c86e=a231_0x4b010c;return JSON[_0x49c86e(0xca)]({'dbId':_0x1b6fb5['dbId'],'dbName':_0x1b6fb5['dbName']});}function deserializeDbSelection(_0x4497ea){const _0x41931d=a231_0x4b010c;try{const _0x543e8e=JSON[_0x41931d(0x88)](_0x4497ea);if(typeof _0x543e8e[_0x41931d(0xa8)]===_0x41931d(0xc4)&&Number[_0x41931d(0x93)](_0x543e8e['dbId']))return{'dbId':_0x543e8e[_0x41931d(0xa8)],'dbName':_0x543e8e[_0x41931d(0xa5)]};}catch{}throw CliErrors[_0x41931d(0xa3)](_0x41931d(0xae)+_0x4497ea);}function resolveProvidedDbId(_0x1a88a1){const _0x16d19d=a231_0x4b010c,_0x290856=_0x1a88a1[_0x16d19d(0xbc)](_0x16d19d(0x94));if(typeof _0x290856===_0x16d19d(0xc4)&&Number['isFinite'](_0x290856))return _0x290856;return undefined;}
@@ -1 +1 @@
1
- const a232_0x23d0ff=a232_0xbd2e;(function(_0x131b81,_0x3e8af9){const _0x42fbd9=a232_0xbd2e,_0x3808ef=_0x131b81();while(!![]){try{const _0x30f668=-parseInt(_0x42fbd9(0x1f1))/0x1*(parseInt(_0x42fbd9(0x1e5))/0x2)+-parseInt(_0x42fbd9(0x1f4))/0x3*(-parseInt(_0x42fbd9(0x1ec))/0x4)+-parseInt(_0x42fbd9(0x1fa))/0x5*(parseInt(_0x42fbd9(0x1e1))/0x6)+-parseInt(_0x42fbd9(0x1e3))/0x7*(parseInt(_0x42fbd9(0x1db))/0x8)+-parseInt(_0x42fbd9(0x1f8))/0x9+parseInt(_0x42fbd9(0x1e4))/0xa+-parseInt(_0x42fbd9(0x1dc))/0xb*(-parseInt(_0x42fbd9(0x1eb))/0xc);if(_0x30f668===_0x3e8af9)break;else _0x3808ef['push'](_0x3808ef['shift']());}catch(_0x444d4a){_0x3808ef['push'](_0x3808ef['shift']());}}}(a232_0x3da2,0x9db0a));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a232_0xbd2e(_0x25ab1d,_0x8d563c){_0x25ab1d=_0x25ab1d-0x1d2;const _0x3da200=a232_0x3da2();let _0xbd2ee0=_0x3da200[_0x25ab1d];return _0xbd2ee0;}function a232_0x3da2(){const _0x43ee0e=['validation','Deleted\x20','lockFilePath','delete','13196ftQhSH','sqlcode','replace','228RGwbyD','sql','startsWith','sqlRootDir','73800IzPNqa','length','1881415eAHPSZ','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','sqlRoot','trashDir','lastSync','POST','Would\x20delete\x20SQL\x20','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','remoteId','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','16sqbhuC','3333kWfiRl','filter','\x20(local\x20file\x20moved\x20to\x20trash)','fromEntries','str','18LXXcTD','SQL\x20lock\x20file\x20not\x20found.','2278052rhVSrb','2887740pWZKul','98dIsPLW','sqls','toISOString','trashedTo','appCode','projectRoot','84612oFiNaK','34484RypWHN'];a232_0x3da2=function(){return _0x43ee0e;};return a232_0x3da2();}import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a232_0x23d0ff(0x1f5),'command':'delete','description':a232_0x23d0ff(0x1d2),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x3bdd97){const _0x4a2b9d=a232_0x23d0ff,_0xf5e5df=loadSqlProjectConfig(_0x3bdd97['appCode']),_0x53c5d1=await readSqlLockFile(_0xf5e5df['lockFilePath']);if(!_0x53c5d1)throw CliErrors[_0x4a2b9d(0x1ed)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x352211){const _0x5e8fe4=a232_0x23d0ff,_0x4cca25=loadSqlProjectConfig(_0x352211['appCode']),_0x3e6c0a=await readSqlLockFile(_0x4cca25['lockFilePath']);if(!_0x3e6c0a)throw CliErrors['validation'](_0x5e8fe4(0x1da));const {appLock:_0x2b96aa}=ensureSqlLockScope(_0x3e6c0a,_0x352211[_0x5e8fe4(0x1e9)],_0x4cca25[_0x5e8fe4(0x1d3)],_0x5e8fe4(0x1f0)),_0x513de8=_0x352211[_0x5e8fe4(0x1e0)](_0x5e8fe4(0x1f2)),_0x1572fc=_0x2b96aa[_0x5e8fe4(0x1e6)][_0x513de8];if(!_0x1572fc)throw CliErrors[_0x5e8fe4(0x1ed)](_0x5e8fe4(0x1d8)+_0x513de8+'\x22.');return{'method':_0x5e8fe4(0x1d6),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x513de8,'id':_0x1572fc['remoteId'],'localPath':resolveLocalSqlFilePath(_0x4cca25,_0x513de8,_0x1572fc)},'description':_0x5e8fe4(0x1d7)+_0x513de8+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x4cca25[_0x5e8fe4(0x1d4)]};},async 'execute'(_0x5f3aea){const _0x512eae=a232_0x23d0ff,_0x545e9d=loadSqlProjectConfig(_0x5f3aea[_0x512eae(0x1e9)]),_0x57881e=await readSqlLockFile(_0x545e9d['lockFilePath']);if(!_0x57881e)throw CliErrors['validation'](_0x512eae(0x1e2));const {lockData:_0x430a04,appLock:_0x22f040}=ensureSqlLockScope(_0x57881e,_0x5f3aea['appCode'],_0x545e9d[_0x512eae(0x1d3)],_0x512eae(0x1f0)),_0x539530=_0x5f3aea[_0x512eae(0x1e0)](_0x512eae(0x1f2)),_0x1b0ecf=_0x22f040[_0x512eae(0x1e6)][_0x539530];if(!_0x1b0ecf)throw CliErrors[_0x512eae(0x1ed)](_0x512eae(0x1d8)+_0x539530+'\x22.');await deleteSqlQuery({'id':_0x1b0ecf[_0x512eae(0x1d9)],'sqlCode':_0x539530}),_0x22f040[_0x512eae(0x1e6)]=Object[_0x512eae(0x1df)](Object['entries'](_0x22f040[_0x512eae(0x1e6)])[_0x512eae(0x1dd)](([_0x52f606])=>_0x52f606!==_0x539530)),_0x22f040[_0x512eae(0x1d5)]=new Date()[_0x512eae(0x1e7)](),await writeSqlLockFile(_0x545e9d[_0x512eae(0x1ef)],_0x430a04);const _0x420a13=resolveLocalSqlFilePath(_0x545e9d,_0x539530,_0x1b0ecf);let _0xf3202;await fileExists(_0x420a13)&&(_0xf3202=await moveToTrash(_0x545e9d[_0x512eae(0x1ea)],_0x545e9d[_0x512eae(0x1d4)],_0x420a13),await cleanupEmptyDirectories(dirname(_0x420a13),_0x545e9d[_0x512eae(0x1f7)]));const _0x7d10e={'deleted':_0x539530,'remoteId':_0x1b0ecf[_0x512eae(0x1d9)]};if(_0xf3202)_0x7d10e[_0x512eae(0x1e8)]=_0xf3202;return{'ok':!![],'data':_0x7d10e,'message':_0x512eae(0x1ee)+_0x539530+(_0xf3202?_0x512eae(0x1de):'')};}};async function moveToTrash(_0x38d6b6,_0x156a9a,_0x5c61fd){const _0x17fa52=a232_0x23d0ff,_0x70bd37=new Date()['toISOString']()[_0x17fa52(0x1f3)](/[:.]/g,'-'),_0x42437c=relative(_0x38d6b6,_0x5c61fd),_0xa38921=join(_0x156a9a,_0x70bd37,_0x42437c);return await mkdir(dirname(_0xa38921),{'recursive':!![]}),await rename(_0x5c61fd,_0xa38921),_0xa38921;}async function cleanupEmptyDirectories(_0x112b20,_0x3ee3da){const _0xfa7183=a232_0x23d0ff;let _0x4dc53c=resolve(_0x112b20);const _0x5138ef=resolve(_0x3ee3da);while(_0x4dc53c[_0xfa7183(0x1f6)](''+_0x5138ef+sep)||_0x4dc53c===_0x5138ef){if(_0x4dc53c===_0x5138ef)return;try{const _0x3f9252=await readdir(_0x4dc53c);if(_0x3f9252[_0xfa7183(0x1f9)]>0x0)return;await rmdir(_0x4dc53c);}catch{return;}_0x4dc53c=dirname(_0x4dc53c);}}
1
+ const a232_0x57b157=a232_0xed2d;function a232_0x1968(){const _0x28e098=['3651830waKJuw','409781lIjnnH','557901xtijNB','Deleted\x20','length','16DjOzRH','replace','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','toISOString','validation','trashDir','sqlcode','SQL\x20lock\x20file\x20not\x20found.','fromEntries','1490328MOPyXT','str','sqls','trashedTo','appCode','4gaXuIs','\x20(local\x20file\x20moved\x20to\x20trash)','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','300436WRctSf','lockFilePath','5LQHOGA','remoteId','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','delete','Would\x20delete\x20SQL\x20','high-risk-write','314160ELuddr','293346gFsvBC','entries','lastSync','/smartapi/custom/deleteUserCustomSql','POST','startsWith','sqlRoot','projectRoot'];a232_0x1968=function(){return _0x28e098;};return a232_0x1968();}(function(_0x10009b,_0x29f773){const _0x3d6f3f=a232_0xed2d,_0x298f61=_0x10009b();while(!![]){try{const _0x18f18e=parseInt(_0x3d6f3f(0x184))/0x1+-parseInt(_0x3d6f3f(0x16f))/0x2*(-parseInt(_0x3d6f3f(0x185))/0x3)+-parseInt(_0x3d6f3f(0x172))/0x4*(-parseInt(_0x3d6f3f(0x174))/0x5)+parseInt(_0x3d6f3f(0x17a))/0x6+-parseInt(_0x3d6f3f(0x191))/0x7+parseInt(_0x3d6f3f(0x188))/0x8*(-parseInt(_0x3d6f3f(0x17b))/0x9)+-parseInt(_0x3d6f3f(0x183))/0xa;if(_0x18f18e===_0x29f773)break;else _0x298f61['push'](_0x298f61['shift']());}catch(_0x41bc27){_0x298f61['push'](_0x298f61['shift']());}}}(a232_0x1968,0x40eb5));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a232_0xed2d(_0x27f9ce,_0x4e2b38){_0x27f9ce=_0x27f9ce-0x16c;const _0x19680a=a232_0x1968();let _0xed2dc4=_0x19680a[_0x27f9ce];return _0xed2dc4;}import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':'sql','command':a232_0x57b157(0x177),'description':a232_0x57b157(0x171),'risk':a232_0x57b157(0x179),'flags':[SQLCODE_FLAG],async 'validate'(_0x3ec176){const _0x55354a=a232_0x57b157,_0x4c1033=loadSqlProjectConfig(_0x3ec176[_0x55354a(0x16e)]),_0x10f59f=await readSqlLockFile(_0x4c1033[_0x55354a(0x173)]);if(!_0x10f59f)throw CliErrors[_0x55354a(0x18c)](_0x55354a(0x18a));},async 'dryRun'(_0xa4c9ff){const _0x536ebd=a232_0x57b157,_0x163bc3=loadSqlProjectConfig(_0xa4c9ff['appCode']),_0x1bb5a8=await readSqlLockFile(_0x163bc3[_0x536ebd(0x173)]);if(!_0x1bb5a8)throw CliErrors[_0x536ebd(0x18c)](_0x536ebd(0x18a));const {appLock:_0x3f314e}=ensureSqlLockScope(_0x1bb5a8,_0xa4c9ff['appCode'],_0x163bc3[_0x536ebd(0x181)],_0x536ebd(0x177)),_0x31cd29=_0xa4c9ff['str'](_0x536ebd(0x18e)),_0x2fad94=_0x3f314e[_0x536ebd(0x16c)][_0x31cd29];if(!_0x2fad94)throw CliErrors['validation'](_0x536ebd(0x176)+_0x31cd29+'\x22.');return{'method':_0x536ebd(0x17f),'url':_0x536ebd(0x17e),'body':{'sqlCode':_0x31cd29,'id':_0x2fad94[_0x536ebd(0x175)],'localPath':resolveLocalSqlFilePath(_0x163bc3,_0x31cd29,_0x2fad94)},'description':_0x536ebd(0x178)+_0x31cd29+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x163bc3[_0x536ebd(0x18d)]};},async 'execute'(_0x4a593e){const _0x48d66d=a232_0x57b157,_0x260232=loadSqlProjectConfig(_0x4a593e[_0x48d66d(0x16e)]),_0x1b9e73=await readSqlLockFile(_0x260232[_0x48d66d(0x173)]);if(!_0x1b9e73)throw CliErrors['validation'](_0x48d66d(0x18f));const {lockData:_0x2f5ae0,appLock:_0x210e82}=ensureSqlLockScope(_0x1b9e73,_0x4a593e[_0x48d66d(0x16e)],_0x260232[_0x48d66d(0x181)],'delete'),_0x503c8b=_0x4a593e[_0x48d66d(0x192)](_0x48d66d(0x18e)),_0x8ea62c=_0x210e82[_0x48d66d(0x16c)][_0x503c8b];if(!_0x8ea62c)throw CliErrors['validation'](_0x48d66d(0x176)+_0x503c8b+'\x22.');await deleteSqlQuery({'id':_0x8ea62c['remoteId'],'sqlCode':_0x503c8b}),_0x210e82[_0x48d66d(0x16c)]=Object[_0x48d66d(0x190)](Object[_0x48d66d(0x17c)](_0x210e82[_0x48d66d(0x16c)])['filter'](([_0x3a6771])=>_0x3a6771!==_0x503c8b)),_0x210e82[_0x48d66d(0x17d)]=new Date()[_0x48d66d(0x18b)](),await writeSqlLockFile(_0x260232['lockFilePath'],_0x2f5ae0);const _0x44adf9=resolveLocalSqlFilePath(_0x260232,_0x503c8b,_0x8ea62c);let _0x20ed2c;await fileExists(_0x44adf9)&&(_0x20ed2c=await moveToTrash(_0x260232[_0x48d66d(0x182)],_0x260232[_0x48d66d(0x18d)],_0x44adf9),await cleanupEmptyDirectories(dirname(_0x44adf9),_0x260232['sqlRootDir']));const _0x5a837a={'deleted':_0x503c8b,'remoteId':_0x8ea62c[_0x48d66d(0x175)]};if(_0x20ed2c)_0x5a837a[_0x48d66d(0x16d)]=_0x20ed2c;return{'ok':!![],'data':_0x5a837a,'message':_0x48d66d(0x186)+_0x503c8b+(_0x20ed2c?_0x48d66d(0x170):'')};}};async function moveToTrash(_0x598108,_0x1333e6,_0x4c47f6){const _0x3c5a13=a232_0x57b157,_0x285796=new Date()[_0x3c5a13(0x18b)]()[_0x3c5a13(0x189)](/[:.]/g,'-'),_0x545144=relative(_0x598108,_0x4c47f6),_0x5dc310=join(_0x1333e6,_0x285796,_0x545144);return await mkdir(dirname(_0x5dc310),{'recursive':!![]}),await rename(_0x4c47f6,_0x5dc310),_0x5dc310;}async function cleanupEmptyDirectories(_0x177d3b,_0x5e1a54){const _0x360339=a232_0x57b157;let _0xa60b97=resolve(_0x177d3b);const _0x2ae9c9=resolve(_0x5e1a54);while(_0xa60b97[_0x360339(0x180)](''+_0x2ae9c9+sep)||_0xa60b97===_0x2ae9c9){if(_0xa60b97===_0x2ae9c9)return;try{const _0x42f548=await readdir(_0xa60b97);if(_0x42f548[_0x360339(0x187)]>0x0)return;await rmdir(_0xa60b97);}catch{return;}_0xa60b97=dirname(_0xa60b97);}}
@@ -1 +1 @@
1
- const a233_0x532df3=a233_0x4c55;(function(_0x568b44,_0x350963){const _0x8402cd=a233_0x4c55,_0x270484=_0x568b44();while(!![]){try{const _0x14e7ce=-parseInt(_0x8402cd(0x130))/0x1*(parseInt(_0x8402cd(0x137))/0x2)+-parseInt(_0x8402cd(0x122))/0x3+parseInt(_0x8402cd(0x129))/0x4+parseInt(_0x8402cd(0x134))/0x5+-parseInt(_0x8402cd(0x123))/0x6*(parseInt(_0x8402cd(0x136))/0x7)+-parseInt(_0x8402cd(0x126))/0x8*(parseInt(_0x8402cd(0x12d))/0x9)+parseInt(_0x8402cd(0x120))/0xa*(parseInt(_0x8402cd(0x128))/0xb);if(_0x14e7ce===_0x350963)break;else _0x270484['push'](_0x270484['shift']());}catch(_0x47f88e){_0x270484['push'](_0x270484['shift']());}}}(a233_0xd7fa,0xa4deb));import{getSqlQueryInfo}from'../../core/api-client.js';function a233_0x4c55(_0x134f30,_0x1e4280){_0x134f30=_0x134f30-0x120;const _0xd7fa2e=a233_0xd7fa();let _0x4c55b6=_0xd7fa2e[_0x134f30];return _0x4c55b6;}import{getDbName}from'../../core/db-resolver.js';function a233_0xd7fa(){const _0x219abb=['Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','181yPHsci','read','sql','sqlName','4107895cMMaLz','Return\x20full\x20raw\x20SQL\x20query\x20object','6643GSvhqM','14478MNvllE','appCode','verbose','30JFepby','detail','4030017UbsTOs','1986jsWzsK','bool','dbId','8LEVpis','boolean','10191665zQhOxp','179644DMtzzy','description','sqlcode','sqlContent','27099WXigMM','str'];a233_0xd7fa=function(){return _0x219abb;};return a233_0xd7fa();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a233_0x532df3(0x132),'command':a233_0x532df3(0x121),'description':a233_0x532df3(0x12f),'risk':a233_0x532df3(0x131),'flags':[SQLCODE_FLAG,{'name':a233_0x532df3(0x139),'type':a233_0x532df3(0x127),'description':a233_0x532df3(0x135)}],async 'execute'(_0x22379c){const _0x391f00=a233_0x532df3,_0x5cafba=await getSqlQueryInfo(_0x22379c[_0x391f00(0x138)],_0x22379c[_0x391f00(0x12e)](_0x391f00(0x12b))),_0x307aaf=_0x22379c[_0x391f00(0x124)](_0x391f00(0x139));if(_0x307aaf)return{'ok':!![],'data':_0x5cafba};const _0x28f97b=_0x5cafba[_0x391f00(0x125)]?await getDbName(_0x22379c[_0x391f00(0x138)],_0x5cafba[_0x391f00(0x125)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x5cafba['sqlCode'],'sqlName':_0x5cafba[_0x391f00(0x133)],'db':_0x28f97b?_0x28f97b+'\x20('+_0x5cafba[_0x391f00(0x125)]+')':_0x5cafba[_0x391f00(0x125)]??'','description':_0x5cafba[_0x391f00(0x12a)]??'','sqlContent':_0x5cafba[_0x391f00(0x12c)]??''}};}};
1
+ function a233_0x257d(_0x103661,_0x40e723){_0x103661=_0x103661-0x1b5;const _0x4ef0c6=a233_0x4ef0();let _0x257d22=_0x4ef0c6[_0x103661];return _0x257d22;}const a233_0x51df4f=a233_0x257d;(function(_0x4aedfb,_0x4fb92c){const _0x591e52=a233_0x257d,_0x3dfaad=_0x4aedfb();while(!![]){try{const _0x37f7=parseInt(_0x591e52(0x1bd))/0x1+-parseInt(_0x591e52(0x1c6))/0x2*(parseInt(_0x591e52(0x1c3))/0x3)+parseInt(_0x591e52(0x1c1))/0x4*(-parseInt(_0x591e52(0x1b6))/0x5)+parseInt(_0x591e52(0x1c9))/0x6+-parseInt(_0x591e52(0x1bb))/0x7*(-parseInt(_0x591e52(0x1ba))/0x8)+parseInt(_0x591e52(0x1b8))/0x9+-parseInt(_0x591e52(0x1c0))/0xa;if(_0x37f7===_0x4fb92c)break;else _0x3dfaad['push'](_0x3dfaad['shift']());}catch(_0xf3ab4a){_0x3dfaad['push'](_0x3dfaad['shift']());}}}(a233_0x4ef0,0xf0005));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a233_0x4ef0(){const _0x415ef5=['26277MUtXDp','description','read','66XQxBcL','appCode','Return\x20full\x20raw\x20SQL\x20query\x20object','966096sRqPTZ','sql','sqlCode','dbId','826695LzKNEL','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','11464470BOFXLg','str','525784kxtlbP','175areSyP','sqlName','1256003bqeJej','sqlcode','sqlContent','19044590Dcahfi','28iIHiRA','verbose'];a233_0x4ef0=function(){return _0x415ef5;};return a233_0x4ef0();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a233_0x51df4f(0x1ca),'command':'detail','description':a233_0x51df4f(0x1b7),'risk':a233_0x51df4f(0x1c5),'flags':[SQLCODE_FLAG,{'name':'verbose','type':'boolean','description':a233_0x51df4f(0x1c8)}],async 'execute'(_0x307c5f){const _0x4cfc98=a233_0x51df4f,_0x23fa99=await getSqlQueryInfo(_0x307c5f[_0x4cfc98(0x1c7)],_0x307c5f[_0x4cfc98(0x1b9)](_0x4cfc98(0x1be))),_0x565eaf=_0x307c5f['bool'](_0x4cfc98(0x1c2));if(_0x565eaf)return{'ok':!![],'data':_0x23fa99};const _0x953727=_0x23fa99[_0x4cfc98(0x1b5)]?await getDbName(_0x307c5f[_0x4cfc98(0x1c7)],_0x23fa99[_0x4cfc98(0x1b5)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x23fa99[_0x4cfc98(0x1cb)],'sqlName':_0x23fa99[_0x4cfc98(0x1bc)],'db':_0x953727?_0x953727+'\x20('+_0x23fa99[_0x4cfc98(0x1b5)]+')':_0x23fa99[_0x4cfc98(0x1b5)]??'','description':_0x23fa99[_0x4cfc98(0x1c4)]??'','sqlContent':_0x23fa99[_0x4cfc98(0x1bf)]??''}};}};
@@ -1 +1 @@
1
- const a234_0x137af1=a234_0x4d56;function a234_0x4d56(_0x487afb,_0x287912){_0x487afb=_0x487afb-0x189;const _0x2e5724=a234_0x2e57();let _0x4d566b=_0x2e5724[_0x487afb];return _0x4d566b;}(function(_0x12db70,_0x2d904){const _0x5b3354=a234_0x4d56,_0x1edbb3=_0x12db70();while(!![]){try{const _0x2aaeac=-parseInt(_0x5b3354(0x196))/0x1+-parseInt(_0x5b3354(0x192))/0x2+parseInt(_0x5b3354(0x19a))/0x3*(-parseInt(_0x5b3354(0x189))/0x4)+-parseInt(_0x5b3354(0x19e))/0x5+-parseInt(_0x5b3354(0x1a2))/0x6*(parseInt(_0x5b3354(0x197))/0x7)+parseInt(_0x5b3354(0x190))/0x8*(parseInt(_0x5b3354(0x19c))/0x9)+parseInt(_0x5b3354(0x18d))/0xa*(parseInt(_0x5b3354(0x1a3))/0xb);if(_0x2aaeac===_0x2d904)break;else _0x1edbb3['push'](_0x1edbb3['shift']());}catch(_0x3a31a0){_0x1edbb3['push'](_0x1edbb3['shift']());}}}(a234_0x2e57,0x6658d));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a234_0x137af1(0x1a4),'command':a234_0x137af1(0x18a),'description':a234_0x137af1(0x199),'risk':a234_0x137af1(0x19d),'flags':[SQLCODE_FLAG,{'name':'params','type':a234_0x137af1(0x18f),'description':a234_0x137af1(0x18c)}],async 'execute'(_0x2ce03a){const _0x23f935=a234_0x137af1,_0x1c3116=parseJsonParams(_0x2ce03a['str'](_0x23f935(0x1a0))),_0x2fe75e=Date[_0x23f935(0x193)](),_0x458b63=await executeSql(_0x2ce03a[_0x23f935(0x19b)],_0x2ce03a['str'](_0x23f935(0x18e)),_0x1c3116),_0xa2dfc8=Date[_0x23f935(0x193)]()-_0x2fe75e,_0x122987=_0x458b63?.[_0x23f935(0x194)]??_0x458b63,_0x5104b1=_0x458b63?.[_0x23f935(0x195)]??!![];if(!_0x5104b1)return{'ok':![],'data':{'error':_0x458b63?.[_0x23f935(0x191)]||_0x23f935(0x1a5),'elapsed':_0xa2dfc8},'message':_0x23f935(0x1a5)};const _0xfbc5ba=Array[_0x23f935(0x19f)](_0x122987)?_0x122987:[];return{'ok':!![],'data':{'rows':_0xfbc5ba,'rowCount':_0xfbc5ba[_0x23f935(0x1a1)],'elapsed':_0xa2dfc8},'message':_0x23f935(0x18b)+_0xfbc5ba['length']+_0x23f935(0x198)+_0xa2dfc8+'ms'};}};function a234_0x2e57(){const _0x3acf4f=['450qMoDQc','appCode','18351FoeuCY','read','4185340JdXDol','isArray','params','length','2076RmCBwb','801911fGMvFX','sql','SQL\x20execution\x20failed','12296pdnUuM','exec','Returned\x20','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','430ksQsbl','sqlcode','string','776fENxWZ','execError','1190728PpuxRK','now','execResult','execSuccess','540571LOauhC','9695uQkHyM','\x20row(s)\x20in\x20','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode'];a234_0x2e57=function(){return _0x3acf4f;};return a234_0x2e57();}
1
+ const a234_0x427fe4=a234_0x1a94;function a234_0x1dd4(){const _0x3d473b=['1397765iTbvwG','31044cQNgaK','now','275IewJQR','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','read','execError','execSuccess','params','46249Gatczz','str','4858050YLaBkb','length','SQL\x20execution\x20failed','string','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','13730StaWHV','Returned\x20','1048qIRYib','5454mVZOQJ','sqlcode','274JZnfpg','2871DwUxDM','2452fiykHi','sql','\x20row(s)\x20in\x20','exec','4750EadMvx','execResult'];a234_0x1dd4=function(){return _0x3d473b;};return a234_0x1dd4();}(function(_0x8bfe23,_0x4bbfc0){const _0x492190=a234_0x1a94,_0x4018aa=_0x8bfe23();while(!![]){try{const _0x367a5a=parseInt(_0x492190(0x9e))/0x1*(parseInt(_0x492190(0xb5))/0x2)+-parseInt(_0x492190(0xb6))/0x3*(parseInt(_0x492190(0xb7))/0x4)+-parseInt(_0x492190(0xa0))/0x5+parseInt(_0x492190(0xab))/0x6+-parseInt(_0x492190(0xa9))/0x7*(-parseInt(_0x492190(0xb2))/0x8)+-parseInt(_0x492190(0xb3))/0x9*(parseInt(_0x492190(0xb0))/0xa)+-parseInt(_0x492190(0xa3))/0xb*(parseInt(_0x492190(0xa1))/0xc);if(_0x367a5a===_0x4bbfc0)break;else _0x4018aa['push'](_0x4018aa['shift']());}catch(_0x6fa160){_0x4018aa['push'](_0x4018aa['shift']());}}}(a234_0x1dd4,0x8975b));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a234_0x1a94(_0x4f28d6,_0x552bee){_0x4f28d6=_0x4f28d6-0x9c;const _0x1dd4df=a234_0x1dd4();let _0x1a943c=_0x1dd4df[_0x4f28d6];return _0x1a943c;}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a234_0x427fe4(0xb8),'command':a234_0x427fe4(0x9d),'description':a234_0x427fe4(0xaf),'risk':a234_0x427fe4(0xa5),'flags':[SQLCODE_FLAG,{'name':a234_0x427fe4(0xa8),'type':a234_0x427fe4(0xae),'description':a234_0x427fe4(0xa4)}],async 'execute'(_0x497b99){const _0x43516c=a234_0x427fe4,_0x3f115e=parseJsonParams(_0x497b99[_0x43516c(0xaa)](_0x43516c(0xa8))),_0x4b9251=Date[_0x43516c(0xa2)](),_0x5ab13f=await executeSql(_0x497b99['appCode'],_0x497b99['str'](_0x43516c(0xb4)),_0x3f115e),_0x33f035=Date['now']()-_0x4b9251,_0x1e0da0=_0x5ab13f?.[_0x43516c(0x9f)]??_0x5ab13f,_0x47d601=_0x5ab13f?.[_0x43516c(0xa7)]??!![];if(!_0x47d601)return{'ok':![],'data':{'error':_0x5ab13f?.[_0x43516c(0xa6)]||_0x43516c(0xad),'elapsed':_0x33f035},'message':'SQL\x20execution\x20failed'};const _0x497a27=Array['isArray'](_0x1e0da0)?_0x1e0da0:[];return{'ok':!![],'data':{'rows':_0x497a27,'rowCount':_0x497a27[_0x43516c(0xac)],'elapsed':_0x33f035},'message':_0x43516c(0xb1)+_0x497a27[_0x43516c(0xac)]+_0x43516c(0x9c)+_0x33f035+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x10fc13,_0x2957c8){const _0x26ce3b=a235_0x4336,_0x3e4372=_0x10fc13();while(!![]){try{const _0x2cad8f=-parseInt(_0x26ce3b(0x15e))/0x1*(parseInt(_0x26ce3b(0x15c))/0x2)+-parseInt(_0x26ce3b(0x15a))/0x3*(parseInt(_0x26ce3b(0x157))/0x4)+-parseInt(_0x26ce3b(0x156))/0x5*(parseInt(_0x26ce3b(0x15d))/0x6)+parseInt(_0x26ce3b(0x155))/0x7*(parseInt(_0x26ce3b(0x15f))/0x8)+-parseInt(_0x26ce3b(0x15b))/0x9+-parseInt(_0x26ce3b(0x158))/0xa+parseInt(_0x26ce3b(0x159))/0xb;if(_0x2cad8f===_0x2957c8)break;else _0x3e4372['push'](_0x3e4372['shift']());}catch(_0x10aceb){_0x3e4372['push'](_0x3e4372['shift']());}}}(a235_0x1a6c,0x478f0));function a235_0x1a6c(){const _0x48ff23=['2058904ZrLizo','14fJraPI','1585fyuDlc','116sEFLkE','2891710CphnyF','7864604aWOoLH','453xRTJud','2126007cCXqKV','30444aKvbhS','2802mBaLfb','17APBorR'];a235_0x1a6c=function(){return _0x48ff23;};return a235_0x1a6c();}import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';function a235_0x4336(_0x3dbb9a,_0x610a21){_0x3dbb9a=_0x3dbb9a-0x155;const _0x1a6c08=a235_0x1a6c();let _0x43360c=_0x1a6c08[_0x3dbb9a];return _0x43360c;}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(_0xb1ce34,_0x2efcf5){const _0x3b66cb=a235_0xd542,_0x537412=_0xb1ce34();while(!![]){try{const _0x20fbc0=parseInt(_0x3b66cb(0x16c))/0x1*(-parseInt(_0x3b66cb(0x163))/0x2)+parseInt(_0x3b66cb(0x166))/0x3*(-parseInt(_0x3b66cb(0x16b))/0x4)+parseInt(_0x3b66cb(0x16d))/0x5*(parseInt(_0x3b66cb(0x165))/0x6)+-parseInt(_0x3b66cb(0x162))/0x7*(-parseInt(_0x3b66cb(0x168))/0x8)+parseInt(_0x3b66cb(0x169))/0x9*(-parseInt(_0x3b66cb(0x16a))/0xa)+parseInt(_0x3b66cb(0x164))/0xb+parseInt(_0x3b66cb(0x167))/0xc;if(_0x20fbc0===_0x2efcf5)break;else _0x537412['push'](_0x537412['shift']());}catch(_0x354d1b){_0x537412['push'](_0x537412['shift']());}}}(a235_0x341a,0x550d8));import{sqlList}from'../../commands/sql/list.js';function a235_0xd542(_0x1594f9,_0xa28f2d){_0x1594f9=_0x1594f9-0x162;const _0x341a2f=a235_0x341a();let _0xd542=_0x341a2f[_0x1594f9];return _0xd542;}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';function a235_0x341a(){const _0x23280d=['627630wOZZXH','700MvpDCI','144094jgAsPP','5dfHgxl','35oHURWw','8fVSjzH','1738198VJXoSj','3093576jbRiQX','1026XiBJkv','11073336WNXwSn','25344EpexQd','90dJlHcR'];a235_0x341a=function(){return _0x23280d;};return a235_0x341a();}import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a236_0x4850a7=a236_0x2f5a;(function(_0x450a92,_0x18ce1f){const _0x2f3bf3=a236_0x2f5a,_0x28f666=_0x450a92();while(!![]){try{const _0x30d560=parseInt(_0x2f3bf3(0x92))/0x1+-parseInt(_0x2f3bf3(0x7a))/0x2*(parseInt(_0x2f3bf3(0x7e))/0x3)+-parseInt(_0x2f3bf3(0x8d))/0x4+parseInt(_0x2f3bf3(0x82))/0x5*(-parseInt(_0x2f3bf3(0x8c))/0x6)+parseInt(_0x2f3bf3(0x7d))/0x7+-parseInt(_0x2f3bf3(0x93))/0x8*(parseInt(_0x2f3bf3(0x8f))/0x9)+parseInt(_0x2f3bf3(0x79))/0xa;if(_0x30d560===_0x18ce1f)break;else _0x28f666['push'](_0x28f666['shift']());}catch(_0x264782){_0x28f666['push'](_0x28f666['shift']());}}}(a236_0x211e,0xd0f43));import{listSqlQueries}from'../../core/api-client.js';function a236_0x211e(){const _0xddc76=['Found\x20','Page\x20number','all','appCode','num','50055030cKbzrw','92034jTTKqO','tableData','read','3121447oCBajs','51aVitJx','name','pagesize','page','1045WFBrZj','totalCount','dbId','length','map','sql','string','verbose','str','description','31608oGPZnF','5294900quXQqc','sqlCode','162MUcwRp','\x20SQL\x20queries\x20(total:\x20','sqlName','31173byyKgh','630976vqYXbe','boolean','Filter\x20by\x20SQL\x20name','number','bool','list'];a236_0x211e=function(){return _0xddc76;};return a236_0x211e();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a236_0x2f5a(_0x54534d,_0x56d10d){_0x54534d=_0x54534d-0x70;const _0x211e6f=a236_0x211e();let _0x2f5ac0=_0x211e6f[_0x54534d];return _0x2f5ac0;}export const sqlList={'service':a236_0x4850a7(0x87),'command':a236_0x4850a7(0x73),'description':'List\x20custom\x20SQL\x20queries','risk':a236_0x4850a7(0x7c),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a236_0x4850a7(0x88),'description':a236_0x4850a7(0x70)},{'name':a236_0x4850a7(0x81),'type':'number','description':a236_0x4850a7(0x75),'default':0x1},{'name':'pagesize','type':a236_0x4850a7(0x71),'description':'Page\x20size'},{'name':a236_0x4850a7(0x89),'type':a236_0x4850a7(0x94),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x3806e8){const _0x368726=a236_0x4850a7,_0x1a745d=await listSqlQueries(_0x3806e8['appCode'],{'sqlCode':_0x3806e8[_0x368726(0x8a)]('sqlcode')||undefined,'sqlName':_0x3806e8[_0x368726(0x8a)](_0x368726(0x7f))||undefined,'currentPage':_0x3806e8['num'](_0x368726(0x81)),'pageSize':_0x3806e8[_0x368726(0x78)](_0x368726(0x80),0x32)}),_0x545adb=_0x3806e8[_0x368726(0x72)]('verbose'),_0x12d488=_0x1a745d[_0x368726(0x7b)]??[],_0x9e3a31=_0x1a745d['paging']?.[_0x368726(0x83)]??_0x12d488[_0x368726(0x85)];let _0x30e3ed;return _0x545adb?_0x30e3ed=_0x12d488:_0x30e3ed=await Promise[_0x368726(0x76)](_0x12d488[_0x368726(0x86)](async _0x11f593=>{const _0x477fca=_0x368726;let _0xe310b0;try{_0xe310b0=_0x11f593[_0x477fca(0x84)]?await getDbName(_0x3806e8[_0x477fca(0x77)],_0x11f593['dbId']):undefined;}catch{}return{'sqlCode':_0x11f593[_0x477fca(0x8e)],'sqlName':_0x11f593[_0x477fca(0x91)],'description':_0x11f593[_0x477fca(0x8b)]??'','db':_0xe310b0?_0xe310b0+'\x20('+_0x11f593[_0x477fca(0x84)]+')':_0x11f593[_0x477fca(0x84)]??''};})),{'ok':!![],'data':_0x30e3ed,'message':_0x12d488[_0x368726(0x85)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x368726(0x74)+_0x12d488[_0x368726(0x85)]+_0x368726(0x90)+_0x9e3a31+').'};}};
1
+ const a236_0x190f62=a236_0x5f7d;function a236_0x5f7d(_0x4f4070,_0x15ec71){_0x4f4070=_0x4f4070-0xee;const _0x32908f=a236_0x3290();let _0x5f7dc5=_0x32908f[_0x4f4070];return _0x5f7dc5;}(function(_0x23b616,_0x8d164a){const _0x106938=a236_0x5f7d,_0x5befaa=_0x23b616();while(!![]){try{const _0x5d3266=-parseInt(_0x106938(0xee))/0x1+parseInt(_0x106938(0xf2))/0x2*(parseInt(_0x106938(0xfa))/0x3)+parseInt(_0x106938(0x109))/0x4+-parseInt(_0x106938(0x114))/0x5+parseInt(_0x106938(0xf8))/0x6+-parseInt(_0x106938(0xf1))/0x7*(-parseInt(_0x106938(0xf3))/0x8)+parseInt(_0x106938(0x107))/0x9*(-parseInt(_0x106938(0xef))/0xa);if(_0x5d3266===_0x8d164a)break;else _0x5befaa['push'](_0x5befaa['shift']());}catch(_0xbd2581){_0x5befaa['push'](_0x5befaa['shift']());}}}(a236_0x3290,0x8c877));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a236_0x3290(){const _0x563e6f=['292173yBRElC','166142vGpEZh','136qlIRMY','Found\x20','dbId','sqlcode','Page\x20number','550776CIkTCD','page','30BrvlnL','totalCount','pagesize','No\x20custom\x20SQL\x20queries\x20found.','sqlCode','number','str','num','length','\x20SQL\x20queries\x20(total:\x20','List\x20custom\x20SQL\x20queries','sqlName','paging','621cMXVFt','all','2120084tBtJgj','read','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','name','appCode','tableData','description','verbose','string','sql','bool','1943100xBQOLG','1055585wxMOjZ','20620UsVBGv','list'];a236_0x3290=function(){return _0x563e6f;};return a236_0x3290();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a236_0x190f62(0x112),'command':a236_0x190f62(0xf0),'description':a236_0x190f62(0x104),'risk':a236_0x190f62(0x10a),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a236_0x190f62(0x10c),'type':a236_0x190f62(0x111),'description':'Filter\x20by\x20SQL\x20name'},{'name':a236_0x190f62(0xf9),'type':a236_0x190f62(0xff),'description':a236_0x190f62(0xf7),'default':0x1},{'name':a236_0x190f62(0xfc),'type':a236_0x190f62(0xff),'description':'Page\x20size'},{'name':a236_0x190f62(0x110),'type':'boolean','description':a236_0x190f62(0x10b)}],async 'execute'(_0x3d87cf){const _0x2fb012=a236_0x190f62,_0x27261d=await listSqlQueries(_0x3d87cf['appCode'],{'sqlCode':_0x3d87cf[_0x2fb012(0x100)](_0x2fb012(0xf6))||undefined,'sqlName':_0x3d87cf[_0x2fb012(0x100)](_0x2fb012(0x10c))||undefined,'currentPage':_0x3d87cf[_0x2fb012(0x101)]('page'),'pageSize':_0x3d87cf['num'](_0x2fb012(0xfc),0x32)}),_0x3348ae=_0x3d87cf[_0x2fb012(0x113)](_0x2fb012(0x110)),_0x19a38e=_0x27261d[_0x2fb012(0x10e)]??[],_0x22f78a=_0x27261d[_0x2fb012(0x106)]?.[_0x2fb012(0xfb)]??_0x19a38e[_0x2fb012(0x102)];let _0x2a4574;return _0x3348ae?_0x2a4574=_0x19a38e:_0x2a4574=await Promise[_0x2fb012(0x108)](_0x19a38e['map'](async _0x269db9=>{const _0x16e0c8=_0x2fb012;let _0x39227d;try{_0x39227d=_0x269db9[_0x16e0c8(0xf5)]?await getDbName(_0x3d87cf[_0x16e0c8(0x10d)],_0x269db9[_0x16e0c8(0xf5)]):undefined;}catch{}return{'sqlCode':_0x269db9[_0x16e0c8(0xfe)],'sqlName':_0x269db9[_0x16e0c8(0x105)],'description':_0x269db9[_0x16e0c8(0x10f)]??'','db':_0x39227d?_0x39227d+'\x20('+_0x269db9[_0x16e0c8(0xf5)]+')':_0x269db9[_0x16e0c8(0xf5)]??''};})),{'ok':!![],'data':_0x2a4574,'message':_0x19a38e['length']===0x0?_0x2fb012(0xfd):_0x2fb012(0xf4)+_0x19a38e['length']+_0x2fb012(0x103)+_0x22f78a+').'};}};
@@ -1 +1 @@
1
- const a237_0x30cd6e=a237_0x1f80;function a237_0x252b(){const _0x1b102a=['Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','1282946dqFKoe','tableData','split','30166002MGLahJ','sqlCode','2205464GtZDMH','utf8','sqls','\x20SQL\x20file(s)\x20into\x20','string','sqlName','name','mybatisXml','str','sqlRootDir','lastSync','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sqlRoot','lockFilePath','message','conflict','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','Force\x20overwrite\x20local\x20unsynced\x20changes','dbId','1699128BmCagV','join','sqlContent','push','\x20skipped,\x20','read','6ugdYaW','Pull\x20complete:\x20','unchanged','cancelled','length','description','force','apps','test','boolean','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','\x20failed','1333119UZChiH','Would\x20pull\x20','catch','nonInteractive','toISOString','skipped','Force\x20pull\x20cancelled.','sqlcode','No\x20remote\x20SQL\x20queries\x20matched.','4896948WmNiYO','sql','pull','appCode','bool','path','48iwRrxg','5095430jSDSkJ'];a237_0x252b=function(){return _0x1b102a;};return a237_0x252b();}(function(_0x2f389f,_0x498efe){const _0x2f3c92=a237_0x1f80,_0x39c150=_0x2f389f();while(!![]){try{const _0x4e2ccf=parseInt(_0x2f3c92(0x1bd))/0x1+parseInt(_0x2f3c92(0x1d4))/0x2+parseInt(_0x2f3c92(0x1ab))/0x3+parseInt(_0x2f3c92(0x1c6))/0x4+parseInt(_0x2f3c92(0x1cd))/0x5*(-parseInt(_0x2f3c92(0x1b1))/0x6)+-parseInt(_0x2f3c92(0x1cf))/0x7*(-parseInt(_0x2f3c92(0x1cc))/0x8)+-parseInt(_0x2f3c92(0x1d2))/0x9;if(_0x4e2ccf===_0x498efe)break;else _0x39c150['push'](_0x39c150['shift']());}catch(_0x4b71b8){_0x39c150['push'](_0x39c150['shift']());}}}(a237_0x252b,0xe9384));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{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x465939,_0x275d7f){const _0x549738=a237_0x1f80,_0x2171c1=[];let _0x22515e=0x1;while(!![]){const _0x14a87c=await listSqlQueries(_0x465939,{'currentPage':_0x22515e,'pageSize':PAGE_SIZE,'sqlCode':_0x275d7f['sqlCode'],'sqlName':_0x275d7f[_0x549738(0x19d)]}),_0x59289c=_0x14a87c[_0x549738(0x1d0)]??[];_0x2171c1[_0x549738(0x1ae)](..._0x59289c);if(_0x59289c['length']===0x0)break;const _0x14ee6e=_0x14a87c['paging']?.['totalCount'];if(_0x14ee6e!=null?_0x2171c1['length']>=_0x14ee6e:_0x59289c[_0x549738(0x1b5)]<PAGE_SIZE)break;_0x22515e++;}return _0x2171c1;}async function ensureSqlContent(_0x15bfbf){const _0x178dca=a237_0x1f80;if(_0x15bfbf['sqlContent']!=null&&String(_0x15bfbf[_0x178dca(0x1ad)])[_0x178dca(0x1b5)]>0x0)return _0x15bfbf;return getSqlQueryDetail(_0x15bfbf[_0x178dca(0x1d3)]);}export const sqlPull={'service':a237_0x30cd6e(0x1c7),'command':a237_0x30cd6e(0x1c8),'description':a237_0x30cd6e(0x1ce),'risk':a237_0x30cd6e(0x1b0),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a237_0x30cd6e(0x19e),'type':a237_0x30cd6e(0x19c),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a237_0x30cd6e(0x1b7),'type':a237_0x30cd6e(0x1ba),'description':a237_0x30cd6e(0x1a9)}],async 'dryRun'(_0x382c04){const _0x4e34bf=a237_0x30cd6e,_0x102dcc=loadSqlProjectConfig(_0x382c04[_0x4e34bf(0x1c9)]),_0x357e55=await readSqlLockFile(_0x102dcc[_0x4e34bf(0x1a5)]),{appLock:_0x1776f9}=ensureSqlLockScope(_0x357e55??createEmptySqlLock(),_0x102dcc[_0x4e34bf(0x1c9)],_0x102dcc['sqlRoot'],_0x4e34bf(0x1c8)),_0x470fd3=await fetchAllSqlQueries(_0x382c04[_0x4e34bf(0x1c9)],{'sqlCode':_0x382c04[_0x4e34bf(0x1a0)](_0x4e34bf(0x1c4))||undefined,'sqlName':_0x382c04[_0x4e34bf(0x1a0)]('name')||undefined}),_0x5c5d2b=[];for(const _0x2eda66 of _0x470fd3){const _0xe5fb9a=await ensureSqlContent(_0x2eda66),_0x4fadff=ensureRemoteSqlContent(_0xe5fb9a),_0x2baee5=detectModeFromSql(_0xe5fb9a),_0x224fcf=_0xe5fb9a[_0x4e34bf(0x1aa)]?await getDbName(_0x382c04['appCode'],Number(_0xe5fb9a['dbId']))[_0x4e34bf(0x1bf)](()=>undefined):undefined,_0x1e8f9a=buildLocalSqlFileContent({'sqlCode':_0xe5fb9a[_0x4e34bf(0x1d3)],'sqlName':_0xe5fb9a['sqlName'],'dbId':_0xe5fb9a[_0x4e34bf(0x1aa)]},_0x4fadff,{'dbName':_0x224fcf,'mode':_0x2baee5,'syncedAt':new Date()[_0x4e34bf(0x1c1)](),'description':_0xe5fb9a[_0x4e34bf(0x1b6)]}),_0x5190ee=buildSqlLockEntry(_0xe5fb9a,_0x4fadff,'',{'dbName':_0x224fcf}),_0x48fff4=resolveLocalSqlFilePath(_0x102dcc,_0xe5fb9a[_0x4e34bf(0x1d3)],_0x5190ee);let _0x468253='would_pull',_0x34f137;if(await fileExists(_0x48fff4)){const _0x592fdc=await readFile(_0x48fff4,_0x4e34bf(0x199));isEquivalentPulledSqlFile(_0x592fdc,_0x1e8f9a,_0x2baee5)?(_0x468253=_0x4e34bf(0x1c2),_0x34f137=_0x4e34bf(0x1b3)):(_0x468253=_0x4e34bf(0x1a7),_0x34f137=_0x4e34bf(0x1a3));}_0x5c5d2b[_0x4e34bf(0x1ae)]({'sqlCode':_0xe5fb9a['sqlCode'],'sqlName':_0xe5fb9a[_0x4e34bf(0x19d)],'filePath':_0x48fff4,'status':_0x468253,'reason':_0x34f137});}return{'method':'POST','url':_0x4e34bf(0x1a8),'body':{'appCode':_0x382c04[_0x4e34bf(0x1c9)],'sqlCode':_0x382c04['str'](_0x4e34bf(0x1c4))||null,'sqlName':_0x382c04[_0x4e34bf(0x1a0)](_0x4e34bf(0x19e))||null,'files':_0x5c5d2b},'description':_0x4e34bf(0x1be)+_0x5c5d2b[_0x4e34bf(0x1b5)]+_0x4e34bf(0x19b)+_0x102dcc[_0x4e34bf(0x1a1)]};},async 'execute'(_0x3ce6b4){const _0x24b23b=a237_0x30cd6e,_0x44640e=loadSqlProjectConfig(_0x3ce6b4['appCode']),_0x136a02=await readSqlLockFile(_0x44640e[_0x24b23b(0x1a5)]),{lockData:_0x38dc85,appLock:_0x33c7b9}=ensureSqlLockScope(_0x136a02??createEmptySqlLock(),_0x44640e['appCode'],_0x44640e[_0x24b23b(0x1a4)],'pull'),_0x443688=_0x3ce6b4[_0x24b23b(0x1ca)](_0x24b23b(0x1b7)),_0x1691b3=await fetchAllSqlQueries(_0x3ce6b4[_0x24b23b(0x1c9)],{'sqlCode':_0x3ce6b4['str']('sqlcode')||undefined,'sqlName':_0x3ce6b4[_0x24b23b(0x1a0)](_0x24b23b(0x19e))||undefined});if(_0x1691b3[_0x24b23b(0x1b5)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x24b23b(0x1c5)};const _0xe94aa8=[],_0x28274b=[];for(const _0xe3a131 of _0x1691b3){try{_0xe94aa8[_0x24b23b(0x1ae)](await ensureSqlContent(_0xe3a131));}catch(_0x572c35){_0x28274b[_0x24b23b(0x1ae)]({'sqlCode':_0xe3a131[_0x24b23b(0x1d3)],'error':_0x572c35 instanceof Error?_0x572c35['message']:String(_0x572c35)});}}if(_0x443688&&!_0x3ce6b4[_0x24b23b(0x1c0)]){let _0x10d421=![];for(const _0x4e6d3f of _0xe94aa8){const _0xfba41=detectModeFromSql(_0x4e6d3f),_0x2b79e1=_0x4e6d3f[_0x24b23b(0x1aa)]?await getDbName(_0x3ce6b4[_0x24b23b(0x1c9)],Number(_0x4e6d3f['dbId']))[_0x24b23b(0x1bf)](()=>undefined):undefined,_0x4052c8=buildLocalSqlFileContent({'sqlCode':_0x4e6d3f['sqlCode'],'sqlName':_0x4e6d3f['sqlName'],'dbId':_0x4e6d3f['dbId']},ensureRemoteSqlContent(_0x4e6d3f),{'dbName':_0x2b79e1,'mode':_0xfba41,'syncedAt':new Date()[_0x24b23b(0x1c1)](),'description':_0x4e6d3f[_0x24b23b(0x1b6)]}),_0x51c792=resolveLocalSqlFilePath(_0x44640e,_0x4e6d3f[_0x24b23b(0x1d3)],buildSqlLockEntry(_0x4e6d3f,ensureRemoteSqlContent(_0x4e6d3f),'',{'dbName':_0x2b79e1}));if(await fileExists(_0x51c792)){const _0x28a516=await readFile(_0x51c792,_0x24b23b(0x199));if(!isEquivalentPulledSqlFile(_0x28a516,_0x4052c8,_0xfba41)){_0x10d421=!![];break;}}}if(_0x10d421){const _0x59a8c9=await confirmForceOverwrite(_0x24b23b(0x1bb));if(!_0x59a8c9)throw CliErrors[_0x24b23b(0x1b4)](_0x24b23b(0x1c3));}}const _0x43199f=cloneSqlLockData(_0x38dc85),_0x263f9c=_0x43199f[_0x24b23b(0x1b8)][_0x44640e[_0x24b23b(0x1c9)]],_0x3086f8=[],_0x4c6190=[];for(const _0x275e95 of _0xe94aa8){const _0x347d11=_0x263f9c[_0x24b23b(0x19a)][_0x275e95[_0x24b23b(0x1d3)]],_0x211630=ensureRemoteSqlContent(_0x275e95),_0x4d4cfb=detectModeFromSql(_0x275e95),_0x491e13=_0x275e95[_0x24b23b(0x1aa)]?await getDbName(_0x3ce6b4[_0x24b23b(0x1c9)],Number(_0x275e95[_0x24b23b(0x1aa)]))[_0x24b23b(0x1bf)](()=>undefined):undefined,_0x522f95=buildLocalSqlFileContent({'sqlCode':_0x275e95[_0x24b23b(0x1d3)],'sqlName':_0x275e95[_0x24b23b(0x19d)],'dbId':_0x275e95[_0x24b23b(0x1aa)]},_0x211630,{'dbName':_0x491e13,'mode':_0x4d4cfb,'syncedAt':new Date()[_0x24b23b(0x1c1)](),'description':_0x275e95[_0x24b23b(0x1b6)]}),_0xf57208=buildSqlLockEntry(_0x275e95,_0x211630,computeSqlContentHash(_0x522f95),{'dbName':_0x491e13}),_0x427645=_0xf57208['path'],_0x48d7b5=join(_0x44640e['sqlRootDir'],_0x427645);try{if(await fileExists(_0x48d7b5)){const _0xd797aa=await readFile(_0x48d7b5,_0x24b23b(0x199));if(isEquivalentPulledSqlFile(_0xd797aa,_0x522f95,_0x4d4cfb)){_0x4c6190['push']({'sqlCode':_0x275e95['sqlCode'],'reason':_0x24b23b(0x1b3)}),_0x263f9c['sqls'][_0x275e95[_0x24b23b(0x1d3)]]={..._0xf57208,'hash':computeSqlContentHash(_0xd797aa),'path':_0x427645};continue;}if(!_0x443688){_0x4c6190[_0x24b23b(0x1ae)]({'sqlCode':_0x275e95['sqlCode'],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0xf3e9a6=_0x347d11?.[_0x24b23b(0x1cb)]?join(_0x44640e[_0x24b23b(0x1a1)],_0x347d11[_0x24b23b(0x1cb)]):undefined;_0xf3e9a6&&_0xf3e9a6!==_0x48d7b5&&await fileExists(_0xf3e9a6)&&await rm(_0xf3e9a6,{'force':!![]}),await ensureParentDirectory(_0x48d7b5),await writeFile(_0x48d7b5,_0x522f95,_0x24b23b(0x199)),_0x263f9c[_0x24b23b(0x19a)][_0x275e95[_0x24b23b(0x1d3)]]={..._0xf57208,'path':_0x427645},_0x3086f8['push']({'sqlCode':_0x275e95['sqlCode'],'filePath':_0x48d7b5});}catch(_0x573291){_0x28274b['push']({'sqlCode':_0x275e95['sqlCode'],'error':_0x573291 instanceof Error?_0x573291[_0x24b23b(0x1a6)]:String(_0x573291)});}}return _0x263f9c[_0x24b23b(0x1a2)]=new Date()['toISOString'](),await writeSqlLockFile(_0x44640e['lockFilePath'],_0x43199f),{'ok':_0x28274b[_0x24b23b(0x1b5)]===0x0,'data':{'pulled':_0x3086f8,'skipped':_0x4c6190,'failed':_0x28274b},'message':_0x24b23b(0x1b2)+_0x3086f8[_0x24b23b(0x1b5)]+'\x20written,\x20'+_0x4c6190[_0x24b23b(0x1b5)]+_0x24b23b(0x1af)+_0x28274b[_0x24b23b(0x1b5)]+_0x24b23b(0x1bc)};}};function detectModeFromSql(_0x2c2b53){const _0x1d4ef9=a237_0x30cd6e,_0x39b631=ensureRemoteSqlContent(_0x2c2b53),_0x57374f=stripLocalSqlMetadata(_0x39b631,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x1d4ef9(0x1b9)](_0x57374f))return _0x1d4ef9(0x19f);return'sql';}function isEquivalentPulledSqlFile(_0x339014,_0x414bbe,_0x2073d9){return normalizePullComparableContent(_0x339014,_0x2073d9)===normalizePullComparableContent(_0x414bbe,_0x2073d9);}function a237_0x1f80(_0x157bdd,_0xd70716){_0x157bdd=_0x157bdd-0x199;const _0x252b55=a237_0x252b();let _0x1f8094=_0x252b55[_0x157bdd];return _0x1f8094;}function normalizePullComparableContent(_0x50f292,_0x1e21c6){const _0x48e53e=a237_0x30cd6e,_0x2a2b05=_0x50f292['replace'](/\r\n/g,'\x0a')[_0x48e53e(0x1d1)]('\x0a'),_0x35281a=_0x2a2b05['filter'](_0x50e40b=>!isSyncedAtMetadataLine(_0x50e40b,_0x1e21c6));return _0x35281a[_0x48e53e(0x1ac)]('\x0a');}function isSyncedAtMetadataLine(_0x4f7aa8,_0x1df3ce){const _0x10357e=a237_0x30cd6e;if(_0x1df3ce===_0x10357e(0x19f))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x4f7aa8);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x10357e(0x1b9)](_0x4f7aa8);}
1
+ const a237_0x330ae5=a237_0x482c;(function(_0x1b1531,_0x4d7392){const _0x513070=a237_0x482c,_0x1cd1a1=_0x1b1531();while(!![]){try{const _0x525b0c=parseInt(_0x513070(0xe0))/0x1*(-parseInt(_0x513070(0xd1))/0x2)+parseInt(_0x513070(0xde))/0x3*(parseInt(_0x513070(0xee))/0x4)+-parseInt(_0x513070(0xb8))/0x5+-parseInt(_0x513070(0xc9))/0x6*(parseInt(_0x513070(0xb1))/0x7)+parseInt(_0x513070(0xec))/0x8*(-parseInt(_0x513070(0xd0))/0x9)+-parseInt(_0x513070(0xcb))/0xa+-parseInt(_0x513070(0xc2))/0xb*(-parseInt(_0x513070(0xc5))/0xc);if(_0x525b0c===_0x4d7392)break;else _0x1cd1a1['push'](_0x1cd1a1['shift']());}catch(_0x337e78){_0x1cd1a1['push'](_0x1cd1a1['shift']());}}}(a237_0x55f8,0x88609));function a237_0x55f8(){const _0x448a24=['\x20skipped,\x20','test','mybatisXml','sqlcode','tableData','equivalent','file','3800TGvgAC','catch','44048XqoWFe','replace','toLowerCase','utf8','skipped','find','read','.xml','unchanged','7xNxQwB','hash','lockFilePath','filePath','paging','str','string','2378790ivahKQ','name','pull','isCanonical','content','length','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','appCode','dbId','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','682Csmoaa','POST','sqlContent','376140tjUJMR','would_pull','some','cancelled','3835578jhpBil','sql','864480QnOccv','Force\x20overwrite\x20local\x20unsynced\x20changes','sqlRootDir','filter','message','3186DJCSzn','2FRAFxs','sqlRoot','mode','bool','push','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sqlName','endsWith','toISOString','apps','description','path','No\x20remote\x20SQL\x20queries\x20matched.','132CMjRMm','\x20failed','499698eeHDys','force','split','sqlCode','sqls'];a237_0x55f8=function(){return _0x448a24;};return a237_0x55f8();}import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x81fdd9,_0x431b90){const _0x58d157=a237_0x482c,_0x4a0dc1=[];let _0x5e7814=0x1;while(!![]){const _0x50d696=await listSqlQueries(_0x81fdd9,{'currentPage':_0x5e7814,'pageSize':PAGE_SIZE,'sqlCode':_0x431b90[_0x58d157(0xe3)],'sqlName':_0x431b90[_0x58d157(0xd7)]}),_0x1e8a7d=_0x50d696[_0x58d157(0xe9)]??[];_0x4a0dc1[_0x58d157(0xd5)](..._0x1e8a7d);if(_0x1e8a7d[_0x58d157(0xbd)]===0x0)break;const _0x213293=_0x50d696[_0x58d157(0xb5)]?.['totalCount'];if(_0x213293!=null?_0x4a0dc1[_0x58d157(0xbd)]>=_0x213293:_0x1e8a7d[_0x58d157(0xbd)]<PAGE_SIZE)break;_0x5e7814++;}return _0x4a0dc1;}async function ensureSqlContent(_0x1d211a){const _0x3d22ac=a237_0x482c;if(_0x1d211a[_0x3d22ac(0xc4)]!=null&&String(_0x1d211a[_0x3d22ac(0xc4)])[_0x3d22ac(0xbd)]>0x0)return _0x1d211a;return getSqlQueryDetail(_0x1d211a[_0x3d22ac(0xe3)]);}export const sqlPull={'service':'sql','command':a237_0x330ae5(0xba),'description':a237_0x330ae5(0xc1),'risk':a237_0x330ae5(0xf4),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a237_0x330ae5(0xb9),'type':a237_0x330ae5(0xb7),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':'force','type':'boolean','description':a237_0x330ae5(0xcc)}],async 'dryRun'(_0x466922){const _0x1059f5=a237_0x330ae5,_0x4067d8=loadSqlProjectConfig(_0x466922['appCode']),_0x154e84=await readSqlLockFile(_0x4067d8[_0x1059f5(0xb3)]),{appLock:_0xc6c435}=ensureSqlLockScope(_0x154e84??createEmptySqlLock(),_0x4067d8[_0x1059f5(0xbf)],_0x4067d8[_0x1059f5(0xd2)],_0x1059f5(0xba)),_0xf62819=await fetchAllSqlQueries(_0x466922[_0x1059f5(0xbf)],{'sqlCode':_0x466922['str']('sqlcode')||undefined,'sqlName':_0x466922[_0x1059f5(0xb6)](_0x1059f5(0xb9))||undefined}),_0x1c4aa6=[];for(const _0x22eff7 of _0xf62819){const _0x1b20a9=await ensureSqlContent(_0x22eff7),_0x456e14=ensureRemoteSqlContent(_0x1b20a9),_0x263cbc=detectSqlMode(_0x456e14),_0x476b54=_0x1b20a9['dbId']?await getDbName(_0x466922[_0x1059f5(0xbf)],Number(_0x1b20a9[_0x1059f5(0xc0)]))[_0x1059f5(0xed)](()=>undefined):undefined,_0x1dcc68=buildLocalSqlFileContent({'sqlCode':_0x1b20a9[_0x1059f5(0xe3)],'sqlName':_0x1b20a9['sqlName'],'dbId':_0x1b20a9[_0x1059f5(0xc0)]},_0x456e14,{'dbName':_0x476b54,'mode':_0x263cbc,'syncedAt':new Date()[_0x1059f5(0xd9)](),'description':_0x1b20a9[_0x1059f5(0xdb)]}),_0x23a141=buildSqlLockEntry(_0x1b20a9,_0x456e14,'',{'dbName':_0x476b54}),_0x579fcd=resolveLocalSqlFilePath(_0x4067d8,_0x1b20a9[_0x1059f5(0xe3)],_0x23a141);let _0x1d39e2=_0x1059f5(0xc6),_0xe2f3b1;const _0x57dd3f=await findExistingSqlFiles(_0x4067d8,_0x579fcd,_0x263cbc,_0xc6c435[_0x1059f5(0xe4)][_0x1b20a9[_0x1059f5(0xe3)]]);if(_0x57dd3f[_0x1059f5(0xbd)]>0x0){const _0x24da7a=await compareExistingSqlFiles(_0x57dd3f,_0x1dcc68,_0x263cbc);if(_0x24da7a[_0x1059f5(0xc7)](({equivalent:_0x50fa0c})=>!_0x50fa0c))_0x1d39e2='conflict',_0xe2f3b1=_0x1059f5(0xd6);else _0x24da7a[_0x1059f5(0xbd)]===0x1&&_0x24da7a[0x0]?.['file'][_0x1059f5(0xbb)]&&(_0x1d39e2=_0x1059f5(0xf2),_0xe2f3b1=_0x1059f5(0xb0));}_0x1c4aa6['push']({'sqlCode':_0x1b20a9['sqlCode'],'sqlName':_0x1b20a9[_0x1059f5(0xd7)],'filePath':_0x579fcd,'status':_0x1d39e2,'reason':_0xe2f3b1});}return{'method':_0x1059f5(0xc3),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x466922[_0x1059f5(0xbf)],'sqlCode':_0x466922[_0x1059f5(0xb6)](_0x1059f5(0xe8))||null,'sqlName':_0x466922[_0x1059f5(0xb6)](_0x1059f5(0xb9))||null,'files':_0x1c4aa6},'description':'Would\x20pull\x20'+_0x1c4aa6[_0x1059f5(0xbd)]+'\x20SQL\x20file(s)\x20into\x20'+_0x4067d8[_0x1059f5(0xcd)]};},async 'execute'(_0x534123){const _0x33e000=a237_0x330ae5,_0x468a9e=loadSqlProjectConfig(_0x534123[_0x33e000(0xbf)]),_0x134767=await readSqlLockFile(_0x468a9e[_0x33e000(0xb3)]),{lockData:_0x204e7c,appLock:_0x99064b}=ensureSqlLockScope(_0x134767??createEmptySqlLock(),_0x468a9e[_0x33e000(0xbf)],_0x468a9e['sqlRoot'],_0x33e000(0xba)),_0x1ba44e=_0x534123[_0x33e000(0xd4)](_0x33e000(0xe1)),_0x32a0b5=await fetchAllSqlQueries(_0x534123[_0x33e000(0xbf)],{'sqlCode':_0x534123[_0x33e000(0xb6)]('sqlcode')||undefined,'sqlName':_0x534123['str'](_0x33e000(0xb9))||undefined});if(_0x32a0b5[_0x33e000(0xbd)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x33e000(0xdd)};const _0x34017f=[],_0x31a040=[];for(const _0x5ecf54 of _0x32a0b5){try{_0x34017f[_0x33e000(0xd5)](await ensureSqlContent(_0x5ecf54));}catch(_0x44a759){_0x31a040[_0x33e000(0xd5)]({'sqlCode':_0x5ecf54['sqlCode'],'error':_0x44a759 instanceof Error?_0x44a759['message']:String(_0x44a759)});}}if(_0x1ba44e&&!_0x534123['nonInteractive']){let _0x30258e=![];for(const _0x1fe7e7 of _0x34017f){const _0x43f8fd=detectSqlMode(ensureRemoteSqlContent(_0x1fe7e7)),_0x5c33f8=_0x1fe7e7[_0x33e000(0xc0)]?await getDbName(_0x534123[_0x33e000(0xbf)],Number(_0x1fe7e7[_0x33e000(0xc0)]))['catch'](()=>undefined):undefined,_0x3c06e3=buildLocalSqlFileContent({'sqlCode':_0x1fe7e7[_0x33e000(0xe3)],'sqlName':_0x1fe7e7[_0x33e000(0xd7)],'dbId':_0x1fe7e7['dbId']},ensureRemoteSqlContent(_0x1fe7e7),{'dbName':_0x5c33f8,'mode':_0x43f8fd,'syncedAt':new Date()[_0x33e000(0xd9)](),'description':_0x1fe7e7[_0x33e000(0xdb)]}),_0x24f9e6=resolveLocalSqlFilePath(_0x468a9e,_0x1fe7e7[_0x33e000(0xe3)],buildSqlLockEntry(_0x1fe7e7,ensureRemoteSqlContent(_0x1fe7e7),'',{'dbName':_0x5c33f8})),_0x3e251c=await findExistingSqlFiles(_0x468a9e,_0x24f9e6,_0x43f8fd,_0x99064b[_0x33e000(0xe4)][_0x1fe7e7[_0x33e000(0xe3)]]),_0x421fe5=await compareExistingSqlFiles(_0x3e251c,_0x3c06e3,_0x43f8fd);if(_0x421fe5[_0x33e000(0xc7)](({equivalent:_0x181f2c})=>!_0x181f2c)){_0x30258e=!![];break;}}if(_0x30258e){const _0x2950fc=await confirmForceOverwrite(_0x33e000(0xbe));if(!_0x2950fc)throw CliErrors[_0x33e000(0xc8)]('Force\x20pull\x20cancelled.');}}const _0x2604fc=cloneSqlLockData(_0x204e7c),_0x337902=_0x2604fc[_0x33e000(0xda)][_0x468a9e['appCode']],_0x3586e6=[],_0x3c2467=[];for(const _0x4cd8f3 of _0x34017f){const _0x2df611=_0x337902[_0x33e000(0xe4)][_0x4cd8f3[_0x33e000(0xe3)]],_0x52f046=ensureRemoteSqlContent(_0x4cd8f3),_0x2e6d2e=detectSqlMode(_0x52f046),_0x32bfe2=_0x4cd8f3[_0x33e000(0xc0)]?await getDbName(_0x534123[_0x33e000(0xbf)],Number(_0x4cd8f3['dbId']))['catch'](()=>undefined):undefined,_0x11efd1=buildLocalSqlFileContent({'sqlCode':_0x4cd8f3[_0x33e000(0xe3)],'sqlName':_0x4cd8f3[_0x33e000(0xd7)],'dbId':_0x4cd8f3[_0x33e000(0xc0)]},_0x52f046,{'dbName':_0x32bfe2,'mode':_0x2e6d2e,'syncedAt':new Date()['toISOString'](),'description':_0x4cd8f3[_0x33e000(0xdb)]}),_0x32e5f5=buildSqlLockEntry(_0x4cd8f3,_0x52f046,computeSqlContentHash(_0x11efd1),{'dbName':_0x32bfe2}),_0x4e3a8d=_0x32e5f5[_0x33e000(0xdc)],_0x44d559=join(_0x468a9e[_0x33e000(0xcd)],_0x4e3a8d);try{const _0x4aef4a=await findExistingSqlFiles(_0x468a9e,_0x44d559,_0x2e6d2e,_0x2df611),_0x3e84f3=await compareExistingSqlFiles(_0x4aef4a,_0x11efd1,_0x2e6d2e);if(!_0x1ba44e&&_0x3e84f3['some'](({equivalent:_0x445eb5})=>!_0x445eb5)){_0x3c2467[_0x33e000(0xd5)]({'sqlCode':_0x4cd8f3[_0x33e000(0xe3)],'reason':'local\x20differs\x20from\x20remote'});continue;}const _0x8c7c1d=_0x3e84f3[_0x33e000(0xf3)](({file:_0x4dd9d3})=>_0x4dd9d3[_0x33e000(0xbb)]),_0x3bdbc0=_0x3e84f3[_0x33e000(0xf3)](({file:_0x34d54d})=>!_0x34d54d['isCanonical']);if(_0x8c7c1d?.[_0x33e000(0xea)]&&!_0x3bdbc0){_0x3c2467[_0x33e000(0xd5)]({'sqlCode':_0x4cd8f3['sqlCode'],'reason':_0x33e000(0xb0)}),_0x337902[_0x33e000(0xe4)][_0x4cd8f3[_0x33e000(0xe3)]]={..._0x32e5f5,'hash':computeSqlContentHash(_0x8c7c1d[_0x33e000(0xbc)]),'path':_0x4e3a8d};continue;}!_0x8c7c1d?.['equivalent']&&(await ensureParentDirectory(_0x44d559),await writeFile(_0x44d559,_0x11efd1,_0x33e000(0xf1))),_0x3bdbc0&&await rm(_0x3bdbc0[_0x33e000(0xeb)][_0x33e000(0xb4)],{'force':!![]}),_0x337902['sqls'][_0x4cd8f3[_0x33e000(0xe3)]]={..._0x32e5f5,'hash':_0x8c7c1d?.[_0x33e000(0xea)]?computeSqlContentHash(_0x8c7c1d['content']):_0x32e5f5[_0x33e000(0xb2)],'path':_0x4e3a8d},_0x3586e6[_0x33e000(0xd5)]({'sqlCode':_0x4cd8f3[_0x33e000(0xe3)],'filePath':_0x44d559});}catch(_0x538383){_0x31a040[_0x33e000(0xd5)]({'sqlCode':_0x4cd8f3['sqlCode'],'error':_0x538383 instanceof Error?_0x538383[_0x33e000(0xcf)]:String(_0x538383)});}}return _0x337902['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x468a9e[_0x33e000(0xb3)],_0x2604fc),{'ok':_0x31a040[_0x33e000(0xbd)]===0x0,'data':{'pulled':_0x3586e6,'skipped':_0x3c2467,'failed':_0x31a040},'message':'Pull\x20complete:\x20'+_0x3586e6[_0x33e000(0xbd)]+'\x20written,\x20'+_0x3c2467[_0x33e000(0xbd)]+_0x33e000(0xe5)+_0x31a040['length']+_0x33e000(0xdf)};}};function isEquivalentPulledSqlFile(_0x3fa540,_0x11d495,_0x3078dc,_0x3cda51){if(_0x3078dc!==_0x3cda51)return normalizePulledSqlBody(_0x3fa540,_0x3078dc)===normalizePulledSqlBody(_0x11d495,_0x3cda51);return normalizePullComparableContent(_0x3fa540,_0x3078dc)===normalizePullComparableContent(_0x11d495,_0x3cda51);}function a237_0x482c(_0x234a0e,_0x579229){_0x234a0e=_0x234a0e-0xaf;const _0x55f85b=a237_0x55f8();let _0x482c93=_0x55f85b[_0x234a0e];return _0x482c93;}async function findExistingSqlFiles(_0x504244,_0x474bfd,_0x211fc0,_0x133666){const _0x74eb7e=a237_0x330ae5,_0x233937=[];await fileExists(_0x474bfd)&&_0x233937['push']({'filePath':_0x474bfd,'mode':_0x211fc0,'isCanonical':!![]});if(!_0x133666?.[_0x74eb7e(0xdc)])return _0x233937;const _0x2f9e8a=join(_0x504244[_0x74eb7e(0xcd)],_0x133666['path']);if(_0x2f9e8a===_0x474bfd)return _0x233937;return await fileExists(_0x2f9e8a)&&_0x233937[_0x74eb7e(0xd5)]({'filePath':_0x2f9e8a,'mode':_0x133666[_0x74eb7e(0xd3)]??modeFromFilePath(_0x2f9e8a),'isCanonical':![]}),_0x233937;}async function compareExistingSqlFiles(_0x16693c,_0x4ed68b,_0xe6c92a){return Promise['all'](_0x16693c['map'](async _0x24e25c=>{const _0x34008e=a237_0x482c,_0x4601af=await readFile(_0x24e25c['filePath'],_0x34008e(0xf1));return{'file':_0x24e25c,'content':_0x4601af,'equivalent':isEquivalentPulledSqlFile(_0x4601af,_0x4ed68b,_0x24e25c[_0x34008e(0xd3)],_0xe6c92a)};}));}function modeFromFilePath(_0x5a378c){const _0x32e04a=a237_0x330ae5;return _0x5a378c[_0x32e04a(0xf0)]()[_0x32e04a(0xd8)](_0x32e04a(0xaf))?_0x32e04a(0xe7):_0x32e04a(0xca);}function normalizePulledSqlBody(_0x23a3d0,_0x93bd87){const _0x184f0e=a237_0x330ae5;return stripLocalSqlMetadata(_0x23a3d0,_0x93bd87)[_0x184f0e(0xef)](/\r\n/g,'\x0a')['trim']();}function normalizePullComparableContent(_0x15f976,_0x265fd6){const _0x263fee=a237_0x330ae5,_0x41d106=_0x15f976[_0x263fee(0xef)](/\r\n/g,'\x0a')[_0x263fee(0xe2)]('\x0a'),_0x503706=_0x41d106[_0x263fee(0xce)](_0x27ae62=>!isSyncedAtMetadataLine(_0x27ae62,_0x265fd6));return _0x503706['join']('\x0a');}function isSyncedAtMetadataLine(_0x2c2917,_0x53a6ff){const _0x1ce83f=a237_0x330ae5;if(_0x53a6ff==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x1ce83f(0xe6)](_0x2c2917);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x2c2917);}
@@ -1 +1 @@
1
- const a238_0x2cf8ba=a238_0x538e;(function(_0x4b9c50,_0x3c434d){const _0x1e009c=a238_0x538e,_0x22dbb2=_0x4b9c50();while(!![]){try{const _0x411751=-parseInt(_0x1e009c(0x1f5))/0x1*(parseInt(_0x1e009c(0x1ed))/0x2)+parseInt(_0x1e009c(0x1ff))/0x3*(-parseInt(_0x1e009c(0x1f8))/0x4)+-parseInt(_0x1e009c(0x1e3))/0x5+parseInt(_0x1e009c(0x205))/0x6+-parseInt(_0x1e009c(0x207))/0x7+parseInt(_0x1e009c(0x1fe))/0x8*(-parseInt(_0x1e009c(0x1ea))/0x9)+parseInt(_0x1e009c(0x1e2))/0xa;if(_0x411751===_0x3c434d)break;else _0x22dbb2['push'](_0x22dbb2['shift']());}catch(_0x2b22e3){_0x22dbb2['push'](_0x22dbb2['shift']());}}}(a238_0x1d43,0xef3e6));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a238_0x538e(_0x1bd3ec,_0x422b3c){_0x1bd3ec=_0x1bd3ec-0x1dd;const _0x1d43d4=a238_0x1d43();let _0x538e0b=_0x1d43d4[_0x1bd3ec];return _0x538e0b;}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 getTargetSqlQueries(_0x102cf5,_0x45c897,_0x2d2fdb){const _0x4bfe9d=a238_0x538e,_0xdcb40c=await scanLocalSqlQueries(_0x102cf5),_0x91c4ca=new Map();for(const _0x310beb of _0xdcb40c){if(_0x2d2fdb&&_0x310beb['sqlCode']!==_0x2d2fdb)continue;const _0x3baafb=_0x91c4ca[_0x4bfe9d(0x214)](_0x310beb[_0x4bfe9d(0x213)])??[];_0x3baafb[_0x4bfe9d(0x1fb)](_0x310beb),_0x91c4ca['set'](_0x310beb[_0x4bfe9d(0x213)],_0x3baafb);}if(_0x2d2fdb&&!_0x91c4ca['has'](_0x2d2fdb))throw CliErrors[_0x4bfe9d(0x21d)](_0x4bfe9d(0x200)+_0x2d2fdb);const _0x1fd7fa=[];for(const [_0x4c95d0,_0x431a40]of _0x91c4ca[_0x4bfe9d(0x1f6)]()){if(_0x431a40['length']===0x1){_0x1fd7fa[_0x4bfe9d(0x1fb)](_0x431a40[0x0]);continue;}const _0x2a2df4=_0x45c897[_0x4bfe9d(0x209)][_0x4c95d0],_0x2391dc=_0x2a2df4?.[_0x4bfe9d(0x1e4)],_0x569544=_0x2391dc?_0x431a40[_0x4bfe9d(0x1ef)](_0x19389a=>_0x19389a[_0x4bfe9d(0x20e)]!==_0x2391dc):_0x431a40;if(_0x2a2df4&&_0x569544[_0x4bfe9d(0x1f0)]===0x1){_0x1fd7fa['push'](_0x569544[0x0]);continue;}throw CliErrors[_0x4bfe9d(0x21d)](_0x4bfe9d(0x1f9)+_0x4c95d0+_0x4bfe9d(0x1f2));}return _0x1fd7fa;}export const sqlPush={'service':a238_0x2cf8ba(0x20d),'command':a238_0x2cf8ba(0x1fb),'description':a238_0x2cf8ba(0x211),'risk':a238_0x2cf8ba(0x1e8),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a238_0x2cf8ba(0x204),'type':'boolean','description':a238_0x2cf8ba(0x1f4)}],async 'dryRun'(_0x5b813b){const _0x1dd3f5=a238_0x2cf8ba,_0x6a4a7b=loadSqlProjectConfig(_0x5b813b[_0x1dd3f5(0x1fa)]),_0x5044ff=await readSqlLockFile(_0x6a4a7b[_0x1dd3f5(0x1e6)]),{appLock:_0x5ac5ff}=ensureSqlLockScope(_0x5044ff??createEmptySqlLock(),_0x5b813b['appCode'],_0x6a4a7b[_0x1dd3f5(0x1dd)],'push'),_0x58f4bc=await getTargetSqlQueries(_0x6a4a7b,_0x5ac5ff,_0x5b813b[_0x1dd3f5(0x1f3)](_0x1dd3f5(0x201))||undefined),_0x2bc164=[];for(const _0x1d3b29 of _0x58f4bc){const _0x16486e=await computeSqlFileHash(_0x1d3b29[_0x1dd3f5(0x21e)]),_0x32df9d=_0x5ac5ff[_0x1dd3f5(0x209)][_0x1d3b29[_0x1dd3f5(0x213)]],_0x3846fa=!!_0x32df9d&&(_0x32df9d[_0x1dd3f5(0x1e4)]!==_0x1d3b29[_0x1dd3f5(0x20e)]||!!_0x1d3b29[_0x1dd3f5(0x212)]&&_0x32df9d[_0x1dd3f5(0x212)]!==_0x1d3b29['sqlName']);if(!_0x5b813b[_0x1dd3f5(0x1fc)](_0x1dd3f5(0x204))&&_0x32df9d&&_0x32df9d['hash']===_0x16486e&&!_0x3846fa)continue;_0x2bc164[_0x1dd3f5(0x1fb)](_0x1d3b29['sqlCode']);}return{'method':_0x1dd3f5(0x219),'url':_0x1dd3f5(0x20f),'body':{'sqlCodes':_0x2bc164,'appCode':_0x5b813b[_0x1dd3f5(0x1fa)]},'description':_0x1dd3f5(0x202)+_0x2bc164[_0x1dd3f5(0x1f0)]+_0x1dd3f5(0x1eb)};},async 'execute'(_0x32de87){const _0x5eb2c5=a238_0x2cf8ba,_0xb23ae8=loadSqlProjectConfig(_0x32de87[_0x5eb2c5(0x1fa)]),_0x27a060=await readSqlLockFile(_0xb23ae8[_0x5eb2c5(0x1e6)]),{lockData:_0x47ca91,appLock:_0x229579}=ensureSqlLockScope(_0x27a060??createEmptySqlLock(),_0x32de87['appCode'],_0xb23ae8[_0x5eb2c5(0x1dd)],_0x5eb2c5(0x1fb)),_0x3f13a4=await getTargetSqlQueries(_0xb23ae8,_0x229579,_0x32de87[_0x5eb2c5(0x1f3)](_0x5eb2c5(0x201))||undefined);if(_0x3f13a4[_0x5eb2c5(0x1f0)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x38624c=[],_0x4dc412=[],_0x19d92c=[];for(const _0x47baac of _0x3f13a4){const _0x34e179=_0x229579[_0x5eb2c5(0x209)][_0x47baac['sqlCode']];if(!_0x34e179){_0x19d92c[_0x5eb2c5(0x1fb)]({'sqlCode':_0x47baac[_0x5eb2c5(0x213)],'error':_0x5eb2c5(0x1ec)});continue;}try{const _0x34bd99=await computeSqlFileHash(_0x47baac[_0x5eb2c5(0x21e)]),_0x16c6e7=_0x34e179[_0x5eb2c5(0x1e4)]!==_0x47baac['relativePath']||!!_0x47baac[_0x5eb2c5(0x212)]&&_0x34e179['sqlName']!==_0x47baac[_0x5eb2c5(0x212)];if(!_0x32de87['bool'](_0x5eb2c5(0x204))&&_0x34e179[_0x5eb2c5(0x1ee)]===_0x34bd99&&!_0x16c6e7){_0x4dc412[_0x5eb2c5(0x1fb)]({'sqlCode':_0x47baac['sqlCode'],'reason':_0x5eb2c5(0x208)});continue;}if(_0x34e179[_0x5eb2c5(0x21c)]==null){_0x19d92c[_0x5eb2c5(0x1fb)]({'sqlCode':_0x47baac[_0x5eb2c5(0x213)],'error':_0x5eb2c5(0x20a)});continue;}const _0x2d3300=await readFile(_0x47baac['filePath'],_0x5eb2c5(0x1e1)),_0x5cbc1a=stripLocalSqlMetadata(_0x2d3300,_0x47baac['mode']),_0x5eccb8=_0x47baac[_0x5eb2c5(0x212)]||_0x34e179['sqlName'],_0x5179ad=await resolveTargetDbBinding(_0x32de87[_0x5eb2c5(0x1fa)],_0x47baac,_0x34e179),_0x361558=await updateSqlQuery({'id':_0x34e179['remoteId'],'appCode':_0x32de87[_0x5eb2c5(0x1fa)],'sqlCode':_0x47baac['sqlCode'],'sqlName':_0x5eccb8,'dbId':_0x5179ad['dbId'],'version':_0x34e179['version'],'sqlContent':_0x5cbc1a,'sqlConfig':_0x34e179[_0x5eb2c5(0x210)]??undefined}),_0x1580a1=_0x361558['dbId']?await getDbName(_0x32de87['appCode'],Number(_0x361558['dbId']))['catch'](()=>_0x5179ad[_0x5eb2c5(0x206)]):_0x5179ad[_0x5eb2c5(0x206)];_0x229579[_0x5eb2c5(0x209)][_0x47baac['sqlCode']]={...buildSqlLockEntry(_0x361558,_0x5cbc1a,_0x34bd99,{'dbName':_0x1580a1}),'path':_0x47baac[_0x5eb2c5(0x20e)],'mode':_0x34e179['mode']},await archivePreviousSqlFileIfNeeded(_0xb23ae8,_0x34e179[_0x5eb2c5(0x1e4)],_0x47baac[_0x5eb2c5(0x20e)]),_0x38624c[_0x5eb2c5(0x1fb)]({'sqlCode':_0x47baac[_0x5eb2c5(0x213)],'remoteId':_0x34e179[_0x5eb2c5(0x1e5)]});}catch(_0x2759d1){_0x19d92c[_0x5eb2c5(0x1fb)]({'sqlCode':_0x47baac[_0x5eb2c5(0x213)],'error':_0x2759d1 instanceof Error?_0x2759d1['message']:String(_0x2759d1)});}}_0x229579['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0xb23ae8[_0x5eb2c5(0x1e6)],_0x47ca91);const _0x2d2801=_0x19d92c['length']===0x0;return{'ok':_0x2d2801,'data':{'pushed':_0x38624c,'skipped':_0x4dc412,'failed':_0x19d92c},'message':'Push\x20complete:\x20'+_0x38624c[_0x5eb2c5(0x1f0)]+_0x5eb2c5(0x20c)+_0x4dc412[_0x5eb2c5(0x1f0)]+_0x5eb2c5(0x1de)+_0x19d92c[_0x5eb2c5(0x1f0)]+_0x5eb2c5(0x1e0)};}};async function archivePreviousSqlFileIfNeeded(_0xebda0b,_0x19463b,_0x12ace8){const _0x18b8ff=a238_0x2cf8ba;if(!_0x19463b||_0x19463b===_0x12ace8)return;const _0x2d5fcd=join(_0xebda0b['sqlRootDir'],_0x19463b);if(!await fileExists(_0x2d5fcd))return;const _0x4ab9e3=await moveToTrash(_0xebda0b[_0x18b8ff(0x1f7)],_0xebda0b[_0x18b8ff(0x21b)],_0x2d5fcd);await cleanupEmptyDirectories(dirname(_0x2d5fcd),_0xebda0b['sqlRootDir']),void _0x4ab9e3;}async function moveToTrash(_0x520f37,_0x4d6377,_0x3fbe16){const _0x28a6af=a238_0x2cf8ba,_0x13745e=new Date()[_0x28a6af(0x203)]()['replace'](/[:.]/g,'-'),_0xaa90a9=relative(_0x520f37,_0x3fbe16),_0x506622=join(_0x4d6377,_0x13745e,_0xaa90a9);return await mkdir(dirname(_0x506622),{'recursive':!![]}),await rename(_0x3fbe16,_0x506622),_0x506622;}async function cleanupEmptyDirectories(_0x3915a5,_0x1c3178){const _0xb3537a=a238_0x2cf8ba;let _0x1a249b=resolve(_0x3915a5);const _0x5872ff=resolve(_0x1c3178);while(_0x1a249b[_0xb3537a(0x1fd)](''+_0x5872ff+sep)||_0x1a249b===_0x5872ff){if(_0x1a249b===_0x5872ff)return;try{const _0x2a4065=await readdir(_0x1a249b);if(_0x2a4065[_0xb3537a(0x1f0)]>0x0)return;await rmdir(_0x1a249b);}catch{return;}_0x1a249b=dirname(_0x1a249b);}}async function resolveTargetDbBinding(_0x567aa2,_0x129e80,_0x1da2be){const _0x45825e=a238_0x2cf8ba,_0x5bb89e=_0x129e80[_0x45825e(0x217)];if(!_0x5bb89e)return{'dbId':_0x1da2be[_0x45825e(0x215)],'dbName':_0x1da2be[_0x45825e(0x206)]};const _0x2dfdd0=buildDbDirectoryName(_0x1da2be[_0x45825e(0x206)],_0x1da2be[_0x45825e(0x215)]);if(_0x5bb89e===_0x2dfdd0)return{'dbId':_0x1da2be['dbId'],'dbName':_0x1da2be[_0x45825e(0x206)]};const _0x3487c0=parseExplicitDbDirectory(_0x5bb89e);if(_0x3487c0!=null)return{'dbId':_0x3487c0,'dbName':await getDbName(_0x567aa2,_0x3487c0)[_0x45825e(0x216)](()=>undefined)};const _0x45984c=await listDatabases(_0x567aa2),_0x1d0850=_0x45984c[_0x45825e(0x1ef)](_0x4bc5c6=>buildDbDirectoryName(_0x4bc5c6[_0x45825e(0x206)],_0x4bc5c6[_0x45825e(0x215)])===_0x5bb89e);if(_0x1d0850[_0x45825e(0x1f0)]===0x1)return{'dbId':_0x1d0850[0x0][_0x45825e(0x215)],'dbName':_0x1d0850[0x0]['dbName']};if(_0x1d0850['length']===0x0)throw CliErrors[_0x45825e(0x21d)](_0x45825e(0x218)+_0x5bb89e+_0x45825e(0x1f1)+_0x129e80['sqlCode']+'.');const _0x303152=_0x1d0850[_0x45825e(0x20b)](_0x36d044=>_0x36d044[_0x45825e(0x206)]+'\x20('+_0x36d044[_0x45825e(0x215)]+')')[_0x45825e(0x1df)](',\x20');throw CliErrors[_0x45825e(0x21d)]('Local\x20directory\x20\x22'+_0x5bb89e+_0x45825e(0x1e7)+_0x129e80[_0x45825e(0x213)]+':\x20'+_0x303152);}function a238_0x1d43(){const _0x20335f=['write','isFinite','2259XxcKza','\x20SQL\x20file(s)','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','12HihJeR','hash','filter','length','\x22\x20for\x20sqlCode\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','str','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','303349JYpAhJ','entries','projectRoot','4lyyXTK','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','appCode','push','bool','startsWith','50936pMfnpD','3935820auTvCn','Local\x20SQL\x20not\x20found:\x20','sqlcode','Would\x20push\x20','toISOString','force','3180480MpqkRo','dbName','11640286ZsJGPa','unchanged','sqls','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','map','\x20pushed,\x20','sql','relativePath','/smartapi/custom/updateUserCustomSql','sqlConfig','Push\x20local\x20SQL\x20files\x20to\x20remote','sqlName','sqlCode','get','dbId','catch','dbDirectory','No\x20database\x20matches\x20local\x20directory\x20\x22','POST','exec','trashDir','version','validation','filePath','sqlRoot','\x20skipped,\x20','join','\x20failed','utf8','85325310tVvTyN','8448100lTcQFK','path','remoteId','lockFilePath','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'];a238_0x1d43=function(){return _0x20335f;};return a238_0x1d43();}function parseExplicitDbDirectory(_0x408a2b){const _0x7cc57d=a238_0x2cf8ba,_0x272047=/^db-(\d+)$/[_0x7cc57d(0x21a)](_0x408a2b);if(!_0x272047)return null;const _0x313208=Number(_0x272047[0x1]);return Number[_0x7cc57d(0x1e9)](_0x313208)&&_0x313208>0x0?_0x313208:null;}
1
+ const a238_0x1be499=a238_0x1ff3;(function(_0xd3d11d,_0x468dc1){const _0x1f6c89=a238_0x1ff3,_0xa3cd8b=_0xd3d11d();while(!![]){try{const _0x5402e2=parseInt(_0x1f6c89(0x1ea))/0x1+-parseInt(_0x1f6c89(0x207))/0x2*(parseInt(_0x1f6c89(0x206))/0x3)+parseInt(_0x1f6c89(0x1eb))/0x4+-parseInt(_0x1f6c89(0x20d))/0x5+-parseInt(_0x1f6c89(0x201))/0x6*(-parseInt(_0x1f6c89(0x21c))/0x7)+parseInt(_0x1f6c89(0x1fb))/0x8+-parseInt(_0x1f6c89(0x214))/0x9;if(_0x5402e2===_0x468dc1)break;else _0xa3cd8b['push'](_0xa3cd8b['shift']());}catch(_0x338dc9){_0xa3cd8b['push'](_0xa3cd8b['shift']());}}}(a238_0x2711,0xc88ea));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a238_0x1ff3(_0x489a81,_0x2a0c08){_0x489a81=_0x489a81-0x1e7;const _0x2711a8=a238_0x2711();let _0x1ff327=_0x2711a8[_0x489a81];return _0x1ff327;}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';function a238_0x2711(){const _0x32bd5f=['startsWith','81GeaRPr','27870ywDkKN','map','dbName','sql','\x20failed','length','869670GihXDQ','dbId','relativePath','sqlName','isFinite','remoteId','validation','18573345qlgfLb','trim','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','hash','sqlcode','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','str','336399JrMGHF','Local\x20SQL\x20not\x20found:\x20','No\x20local\x20SQL\x20files\x20found.','path','unchanged','trashDir','filter',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','dbDirectory','toISOString','boolean','mode','force','sqlRoot','sqlRootDir','1118809HVwAyn','4754300bIocQg','get','appCode','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','bool','join','filePath','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqls',':\x20SQL\x20content\x20is\x20empty.','has','lockFilePath','version','catch','message','write','5563752xNtPWr','replace','sqlCode','Would\x20push\x20','entries','Local\x20directory\x20\x22','54qhRDKy','/smartapi/custom/updateUserCustomSql','set','push'];a238_0x2711=function(){return _0x32bd5f;};return a238_0x2711();}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(_0x1ff53d){const _0x12a2b5=a238_0x1ff3,_0x285a49=stripLocalSqlMetadata(await readFile(_0x1ff53d[_0x12a2b5(0x1f1)],'utf8'),_0x1ff53d['mode']);if(!_0x285a49[_0x12a2b5(0x215)]())throw CliErrors[_0x12a2b5(0x213)](_0x1ff53d[_0x12a2b5(0x1fd)]+_0x12a2b5(0x1f4));return _0x285a49;}async function getTargetSqlQueries(_0x197c4c,_0x4d1f5f,_0x2d1262){const _0x224dab=a238_0x1ff3,_0x34136e=await scanLocalSqlQueries(_0x197c4c),_0x380744=new Map();for(const _0x1d344d of _0x34136e){if(_0x2d1262&&_0x1d344d[_0x224dab(0x1fd)]!==_0x2d1262)continue;const _0x4fe14a=_0x380744[_0x224dab(0x1ec)](_0x1d344d[_0x224dab(0x1fd)])??[];_0x4fe14a[_0x224dab(0x204)](_0x1d344d),_0x380744[_0x224dab(0x203)](_0x1d344d['sqlCode'],_0x4fe14a);}if(_0x2d1262&&!_0x380744[_0x224dab(0x1f5)](_0x2d1262))throw CliErrors['validation'](_0x224dab(0x21d)+_0x2d1262);const _0x4fc284=[];for(const [_0x2c0f7a,_0x244546]of _0x380744[_0x224dab(0x1ff)]()){if(_0x244546[_0x224dab(0x20c)]===0x1){_0x4fc284[_0x224dab(0x204)](_0x244546[0x0]);continue;}const _0x16331a=_0x4d1f5f['sqls'][_0x2c0f7a],_0x54fe26=_0x16331a?.[_0x224dab(0x21f)],_0x14195d=_0x54fe26?_0x244546[_0x224dab(0x222)](_0x22aebd=>_0x22aebd[_0x224dab(0x20f)]!==_0x54fe26):_0x244546;if(_0x16331a&&_0x14195d[_0x224dab(0x20c)]===0x1){_0x4fc284[_0x224dab(0x204)](_0x14195d[0x0]);continue;}throw CliErrors[_0x224dab(0x213)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x2c0f7a+_0x224dab(0x216));}return _0x4fc284;}export const sqlPush={'service':a238_0x1be499(0x20a),'command':a238_0x1be499(0x204),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a238_0x1be499(0x1fa),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a238_0x1be499(0x1e7),'type':a238_0x1be499(0x226),'description':a238_0x1be499(0x1f2)}],async 'dryRun'(_0xf0f7e7){const _0x39fa88=a238_0x1be499,_0x837875=loadSqlProjectConfig(_0xf0f7e7['appCode']),_0x439422=await readSqlLockFile(_0x837875['lockFilePath']),{appLock:_0x23a3b5}=ensureSqlLockScope(_0x439422??createEmptySqlLock(),_0xf0f7e7[_0x39fa88(0x1ed)],_0x837875['sqlRoot'],_0x39fa88(0x204)),_0x97e103=await getTargetSqlQueries(_0x837875,_0x23a3b5,_0xf0f7e7[_0x39fa88(0x21b)](_0x39fa88(0x218))||undefined),_0x2ddc5d=[];for(const _0xc70a83 of _0x97e103){const _0x5d33eb=await computeSqlFileHash(_0xc70a83['filePath']),_0x3c4da1=_0x23a3b5['sqls'][_0xc70a83[_0x39fa88(0x1fd)]],_0xe61371=!!_0x3c4da1&&(_0x3c4da1[_0x39fa88(0x21f)]!==_0xc70a83['relativePath']||!!_0xc70a83['sqlName']&&_0x3c4da1[_0x39fa88(0x210)]!==_0xc70a83[_0x39fa88(0x210)]||_0x3c4da1['mode']!==_0xc70a83['mode']);if(!_0xf0f7e7['bool'](_0x39fa88(0x1e7))&&_0x3c4da1&&_0x3c4da1['hash']===_0x5d33eb&&!_0xe61371)continue;if(!_0x3c4da1)throw CliErrors['validation'](_0xc70a83[_0x39fa88(0x1fd)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0x3c4da1[_0x39fa88(0x1f7)]==null)throw CliErrors['validation'](_0xc70a83[_0x39fa88(0x1fd)]+_0x39fa88(0x223));await resolveTargetDbBinding(_0xf0f7e7[_0x39fa88(0x1ed)],_0xc70a83,_0x3c4da1),await readSqlUploadContent(_0xc70a83),_0x2ddc5d['push'](_0xc70a83[_0x39fa88(0x1fd)]);}return{'method':'POST','url':_0x39fa88(0x202),'body':{'sqlCodes':_0x2ddc5d,'appCode':_0xf0f7e7[_0x39fa88(0x1ed)]},'description':_0x39fa88(0x1fe)+_0x2ddc5d['length']+'\x20SQL\x20file(s)'};},async 'execute'(_0xdced10){const _0x41e867=a238_0x1be499,_0x2c89c6=loadSqlProjectConfig(_0xdced10['appCode']),_0xe2c43d=await readSqlLockFile(_0x2c89c6[_0x41e867(0x1f6)]),{lockData:_0x1deef6,appLock:_0x2fa0c3}=ensureSqlLockScope(_0xe2c43d??createEmptySqlLock(),_0xdced10[_0x41e867(0x1ed)],_0x2c89c6[_0x41e867(0x1e8)],_0x41e867(0x204)),_0x5b9562=await getTargetSqlQueries(_0x2c89c6,_0x2fa0c3,_0xdced10[_0x41e867(0x21b)](_0x41e867(0x218))||undefined);if(_0x5b9562[_0x41e867(0x20c)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x41e867(0x21e)};const _0xb44afd=[],_0x17da75=[],_0x1dd911=[];let _0x43470b=![];for(const _0x11bc5a of _0x5b9562){const _0x1036e0=_0x2fa0c3[_0x41e867(0x1f3)][_0x11bc5a[_0x41e867(0x1fd)]];if(!_0x1036e0){_0x1dd911[_0x41e867(0x204)]({'sqlCode':_0x11bc5a[_0x41e867(0x1fd)],'error':_0x41e867(0x219)});continue;}try{const _0x38bd39=await computeSqlFileHash(_0x11bc5a['filePath']),_0x1ab767=_0x1036e0[_0x41e867(0x21f)]!==_0x11bc5a['relativePath']||!!_0x11bc5a['sqlName']&&_0x1036e0['sqlName']!==_0x11bc5a['sqlName']||_0x1036e0[_0x41e867(0x227)]!==_0x11bc5a[_0x41e867(0x227)];if(!_0xdced10[_0x41e867(0x1ef)](_0x41e867(0x1e7))&&_0x1036e0[_0x41e867(0x217)]===_0x38bd39&&!_0x1ab767){_0x17da75[_0x41e867(0x204)]({'sqlCode':_0x11bc5a['sqlCode'],'reason':_0x41e867(0x220)});continue;}if(_0x1036e0[_0x41e867(0x1f7)]==null){_0x1dd911[_0x41e867(0x204)]({'sqlCode':_0x11bc5a[_0x41e867(0x1fd)],'error':_0x41e867(0x21a)});continue;}const _0x297552=_0x11bc5a[_0x41e867(0x210)]||_0x1036e0[_0x41e867(0x210)],_0x525c45=await resolveTargetDbBinding(_0xdced10[_0x41e867(0x1ed)],_0x11bc5a,_0x1036e0),_0x117fd4=await readSqlUploadContent(_0x11bc5a),_0x2c307f=await updateSqlQuery({'id':_0x1036e0[_0x41e867(0x212)],'appCode':_0xdced10[_0x41e867(0x1ed)],'sqlCode':_0x11bc5a['sqlCode'],'sqlName':_0x297552,'dbId':_0x525c45[_0x41e867(0x20e)],'version':_0x1036e0['version'],'sqlContent':_0x117fd4,'sqlConfig':_0x1036e0['sqlConfig']??undefined}),_0x5b0c6a=_0x2c307f['dbId']?await getDbName(_0xdced10['appCode'],Number(_0x2c307f[_0x41e867(0x20e)]))[_0x41e867(0x1f8)](()=>_0x525c45[_0x41e867(0x209)]):_0x525c45[_0x41e867(0x209)];_0x2fa0c3[_0x41e867(0x1f3)][_0x11bc5a[_0x41e867(0x1fd)]]={...buildSqlLockEntry(_0x2c307f,_0x117fd4,_0x38bd39,{'dbName':_0x5b0c6a}),'path':_0x11bc5a['relativePath'],'mode':_0x11bc5a[_0x41e867(0x227)]},_0x43470b=!![],await archivePreviousSqlFileIfNeeded(_0x2c89c6,_0x1036e0[_0x41e867(0x21f)],_0x11bc5a[_0x41e867(0x20f)]),_0xb44afd[_0x41e867(0x204)]({'sqlCode':_0x11bc5a[_0x41e867(0x1fd)],'remoteId':_0x1036e0[_0x41e867(0x212)]});}catch(_0x2a0322){_0x1dd911[_0x41e867(0x204)]({'sqlCode':_0x11bc5a[_0x41e867(0x1fd)],'error':_0x2a0322 instanceof Error?_0x2a0322[_0x41e867(0x1f9)]:String(_0x2a0322)});}}(_0x43470b||_0x1dd911[_0x41e867(0x20c)]===0x0)&&(_0x2fa0c3['lastSync']=new Date()[_0x41e867(0x225)](),await writeSqlLockFile(_0x2c89c6['lockFilePath'],_0x1deef6));const _0x1dbc5c=_0x1dd911['length']===0x0;return{'ok':_0x1dbc5c,'data':{'pushed':_0xb44afd,'skipped':_0x17da75,'failed':_0x1dd911},'message':'Push\x20complete:\x20'+_0xb44afd[_0x41e867(0x20c)]+'\x20pushed,\x20'+_0x17da75[_0x41e867(0x20c)]+'\x20skipped,\x20'+_0x1dd911['length']+_0x41e867(0x20b)};}};async function archivePreviousSqlFileIfNeeded(_0x5106e8,_0x110c42,_0x3df9c6){const _0x97b2a=a238_0x1be499;if(!_0x110c42||_0x110c42===_0x3df9c6)return;const _0x248fe8=join(_0x5106e8[_0x97b2a(0x1e9)],_0x110c42);if(!await fileExists(_0x248fe8))return;const _0x5e07ab=await moveToTrash(_0x5106e8['projectRoot'],_0x5106e8[_0x97b2a(0x221)],_0x248fe8);await cleanupEmptyDirectories(dirname(_0x248fe8),_0x5106e8[_0x97b2a(0x1e9)]),void _0x5e07ab;}async function moveToTrash(_0x4cf971,_0x325aef,_0x93b4b){const _0x2c4c49=a238_0x1be499,_0x4e4c0e=new Date()['toISOString']()[_0x2c4c49(0x1fc)](/[:.]/g,'-'),_0x3fcb19=relative(_0x4cf971,_0x93b4b),_0xf1fca9=join(_0x325aef,_0x4e4c0e,_0x3fcb19);return await mkdir(dirname(_0xf1fca9),{'recursive':!![]}),await rename(_0x93b4b,_0xf1fca9),_0xf1fca9;}async function cleanupEmptyDirectories(_0x10f3f0,_0x29efac){const _0x276b32=a238_0x1be499;let _0x418315=resolve(_0x10f3f0);const _0x2a9245=resolve(_0x29efac);while(_0x418315[_0x276b32(0x205)](''+_0x2a9245+sep)||_0x418315===_0x2a9245){if(_0x418315===_0x2a9245)return;try{const _0x3a16b7=await readdir(_0x418315);if(_0x3a16b7[_0x276b32(0x20c)]>0x0)return;await rmdir(_0x418315);}catch{return;}_0x418315=dirname(_0x418315);}}async function resolveTargetDbBinding(_0x5a3099,_0x47f913,_0x4a39ac){const _0x3955d6=a238_0x1be499,_0x5ef354=_0x47f913[_0x3955d6(0x224)];if(!_0x5ef354)return{'dbId':_0x4a39ac[_0x3955d6(0x20e)],'dbName':_0x4a39ac[_0x3955d6(0x209)]};const _0x53f527=buildDbDirectoryName(_0x4a39ac[_0x3955d6(0x209)],_0x4a39ac[_0x3955d6(0x20e)]);if(_0x5ef354===_0x53f527)return{'dbId':_0x4a39ac['dbId'],'dbName':_0x4a39ac['dbName']};const _0x45ff27=parseExplicitDbDirectory(_0x5ef354);if(_0x45ff27!=null)return{'dbId':_0x45ff27,'dbName':await getDbName(_0x5a3099,_0x45ff27)[_0x3955d6(0x1f8)](()=>undefined)};const _0x15045d=await listDatabases(_0x5a3099),_0xe31b6=_0x15045d[_0x3955d6(0x222)](_0x4bc9d2=>buildDbDirectoryName(_0x4bc9d2[_0x3955d6(0x209)],_0x4bc9d2[_0x3955d6(0x20e)])===_0x5ef354);if(_0xe31b6[_0x3955d6(0x20c)]===0x1)return{'dbId':_0xe31b6[0x0][_0x3955d6(0x20e)],'dbName':_0xe31b6[0x0][_0x3955d6(0x209)]};if(_0xe31b6[_0x3955d6(0x20c)]===0x0)throw CliErrors[_0x3955d6(0x213)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x5ef354+'\x22\x20for\x20sqlCode\x20'+_0x47f913['sqlCode']+'.');const _0x43a6da=_0xe31b6[_0x3955d6(0x208)](_0xf47d78=>_0xf47d78[_0x3955d6(0x209)]+'\x20('+_0xf47d78[_0x3955d6(0x20e)]+')')[_0x3955d6(0x1f0)](',\x20');throw CliErrors[_0x3955d6(0x213)](_0x3955d6(0x200)+_0x5ef354+_0x3955d6(0x1ee)+_0x47f913[_0x3955d6(0x1fd)]+':\x20'+_0x43a6da);}function parseExplicitDbDirectory(_0x1608f5){const _0x1c3ad4=a238_0x1be499,_0x5d1537=/^db-(\d+)$/['exec'](_0x1608f5);if(!_0x5d1537)return null;const _0x2ecc5d=Number(_0x5d1537[0x1]);return Number[_0x1c3ad4(0x211)](_0x2ecc5d)&&_0x2ecc5d>0x0?_0x2ecc5d:null;}
@@ -1 +1 @@
1
- const a239_0x337c83=a239_0x1100;function a239_0x1100(_0x4b5a5d,_0xfc7fac){_0x4b5a5d=_0x4b5a5d-0x119;const _0x419537=a239_0x4195();let _0x110016=_0x419537[_0x4b5a5d];return _0x110016;}(function(_0x1f4ecc,_0x1e2953){const _0x1f28e1=a239_0x1100,_0x565694=_0x1f4ecc();while(!![]){try{const _0x353bad=parseInt(_0x1f28e1(0x130))/0x1+-parseInt(_0x1f28e1(0x136))/0x2+-parseInt(_0x1f28e1(0x12a))/0x3+parseInt(_0x1f28e1(0x11e))/0x4+parseInt(_0x1f28e1(0x128))/0x5*(-parseInt(_0x1f28e1(0x131))/0x6)+-parseInt(_0x1f28e1(0x12e))/0x7+-parseInt(_0x1f28e1(0x119))/0x8*(-parseInt(_0x1f28e1(0x11b))/0x9);if(_0x353bad===_0x1e2953)break;else _0x565694['push'](_0x565694['shift']());}catch(_0x2dcd14){_0x565694['push'](_0x565694['shift']());}}}(a239_0x4195,0x5400e));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=a239_0x337c83(0x13c);export function buildSqlLockEntry(_0x4802a0,_0xfa5502,_0x4c9506,_0x4c673e){const _0x597c3b=a239_0x337c83,_0x338472=detectSqlMode(_0xfa5502);return{'path':buildSqlRelativePath(_0x4802a0[_0x597c3b(0x125)],_0x4802a0[_0x597c3b(0x12b)],_0x4c673e?.[_0x597c3b(0x12d)],_0x338472,_0x4802a0[_0x597c3b(0x13a)]),'hash':_0x4c9506,'remoteId':_0x4802a0['id'],'version':_0x4802a0[_0x597c3b(0x13e)],'dbId':Number(_0x4802a0[_0x597c3b(0x13a)]),'dbName':_0x4c673e?.['dbName'],'sqlName':_0x4802a0[_0x597c3b(0x12b)],'sqlConfig':_0x4802a0[_0x597c3b(0x13d)]??undefined,'mode':_0x338472};}export function cloneSqlLockData(_0x591010){const _0x43fe93=a239_0x337c83;return{'apps':Object[_0x43fe93(0x140)](Object[_0x43fe93(0x141)](_0x591010[_0x43fe93(0x133)])[_0x43fe93(0x11c)](([_0x36969c,_0x843a38])=>[_0x36969c,{'sqlRoot':_0x843a38[_0x43fe93(0x137)],'lastSync':_0x843a38[_0x43fe93(0x138)],'sqls':{..._0x843a38[_0x43fe93(0x11d)]}}]))};}function a239_0x4195(){const _0x3c4b27=['dbId','toLowerCase','.rabetbase/sql','sqlConfig','version','filter','fromEntries','entries','mode','732288zVWVZG','syncedAt','18AJHEeK','map','sqls','2260736rtjpNH','<!--\x20@lovrabet.','yes','endsWith','mybatisXml','join','sqlContent','sqlCode','description','length','26425kAdoDJ','trim','567336qJOJbJ','sqlName','test','dbName','877142RpkvyD','--\x20@lovrabet.','242720NIAgze','174KUzCrf','replace','apps','push','includes','358430SFOUOD','sqlRoot','lastSync','close'];a239_0x4195=function(){return _0x3c4b27;};return a239_0x4195();}export function ensureRemoteSqlContent(_0x493e98){const _0x3592ab=a239_0x337c83;return _0x493e98[_0x3592ab(0x124)]??'';}export function buildLocalSqlFileContent(_0x5b72b6,_0x33473a,_0x5aa7da){const _0x3ba7f4=a239_0x337c83,_0x2be139=_0x5aa7da?.['mode']??detectSqlMode(_0x33473a),_0x15060f=stripLocalSqlMetadata(_0x33473a,_0x2be139)[_0x3ba7f4(0x129)](),_0x117501=[...buildMetadataHeaderLines({'sqlCode':_0x5b72b6['sqlCode'],'sqlName':_0x5b72b6[_0x3ba7f4(0x12b)],'dbId':_0x5b72b6[_0x3ba7f4(0x13a)],'dbName':_0x5aa7da?.[_0x3ba7f4(0x12d)],'mode':_0x2be139,'syncedAt':_0x5aa7da?.[_0x3ba7f4(0x11a)],'description':_0x5aa7da?.['description']},_0x2be139),'',_0x15060f],_0x56e574=_0x117501['join']('\x0a');return _0x56e574[_0x3ba7f4(0x121)]('\x0a')?_0x56e574:_0x56e574+'\x0a';}export function stripLocalSqlMetadata(_0x113ecc,_0x3afda9){const _0x3595ba=a239_0x337c83,_0x4c83f9=_0x113ecc[_0x3595ba(0x132)](/\r\n/g,'\x0a')['split']('\x0a'),_0x113c01=[];let _0x496b52=0x0;if(_0x3afda9==='mybatisXml')while(_0x496b52<_0x4c83f9['length']){const _0x10fb24=_0x4c83f9[_0x496b52]??'';if(/^\s*<!--\s*@lovrabet\./[_0x3595ba(0x12c)](_0x10fb24)){_0x496b52++;continue;}if(_0x10fb24[_0x3595ba(0x129)]()===''&&_0x496b52>0x0){_0x496b52++;continue;}break;}else while(_0x496b52<_0x4c83f9[_0x3595ba(0x127)]){const _0x128fc5=_0x4c83f9[_0x496b52]??'';if(/^\s*--\s*@lovrabet\./[_0x3595ba(0x12c)](_0x128fc5)){_0x496b52++;continue;}if(_0x128fc5['trim']()===''&&_0x496b52>0x0){_0x496b52++;continue;}break;}for(;_0x496b52<_0x4c83f9[_0x3595ba(0x127)];_0x496b52++){_0x113c01[_0x3595ba(0x134)](_0x4c83f9[_0x496b52]);}return _0x113c01[_0x3595ba(0x123)]('\x0a')['trimStart']();}export function resolveSqlMode(_0x3f1a15,_0x2abd54){const _0x586421=a239_0x337c83;if(_0x2abd54?.[_0x586421(0x142)])return _0x2abd54[_0x586421(0x142)];return detectSqlMode(_0x3f1a15);}export function resolveSqlFileName(_0x37c470,_0x452ef7,_0x1b902e){const _0x3c8083=a239_0x337c83;if(_0x1b902e?.['path'])return _0x1b902e['path'];if(_0x1b902e?.[_0x3c8083(0x12b)]||_0x1b902e?.['dbName'])return buildSqlRelativePath(_0x37c470,_0x1b902e?.[_0x3c8083(0x12b)],_0x1b902e?.[_0x3c8083(0x12d)],resolveSqlMode(_0x452ef7,_0x1b902e),_0x1b902e?.[_0x3c8083(0x13a)]);return buildDefaultSqlFileName(_0x37c470,resolveSqlMode(_0x452ef7,_0x1b902e));}export function resolveSqlLocalDir(_0x6a9a92,_0x3f537d){return join(_0x6a9a92,SQL_LOCAL_REL_DIR,_0x3f537d);}export async function confirmForceOverwrite(_0x1b4811){const _0x6d51f5=a239_0x337c83,_0x3b5122=createInterface({'input':process['stdin'],'output':process['stderr']}),_0x1a6d5f=await new Promise(_0x149065=>{_0x3b5122['question'](_0x1b4811+'\x20[y/N]\x20',_0x149065);});return _0x3b5122[_0x6d51f5(0x139)](),['y',_0x6d51f5(0x120)][_0x6d51f5(0x135)](_0x1a6d5f[_0x6d51f5(0x129)]()[_0x6d51f5(0x13b)]());}export function findSqlLockScope(_0x4b2789,_0x22e0bf){return _0x4b2789['apps'][_0x22e0bf];}function buildMetadataHeaderLines(_0xe5c959,_0x4e3774){const _0x7e895a=a239_0x337c83,_0x2abcfa=[[_0x7e895a(0x125),_0xe5c959[_0x7e895a(0x125)]],[_0x7e895a(0x12b),_0xe5c959[_0x7e895a(0x12b)]],[_0x7e895a(0x13a),_0xe5c959[_0x7e895a(0x13a)]],[_0x7e895a(0x12d),_0xe5c959[_0x7e895a(0x12d)]],[_0x7e895a(0x142),_0xe5c959[_0x7e895a(0x142)]],[_0x7e895a(0x11a),_0xe5c959[_0x7e895a(0x11a)]],[_0x7e895a(0x126),_0xe5c959[_0x7e895a(0x126)]]];if(_0x4e3774===_0x7e895a(0x122))return _0x2abcfa[_0x7e895a(0x13f)](([,_0x3d90ff])=>_0x3d90ff!==undefined&&_0x3d90ff!==null&&String(_0x3d90ff)[_0x7e895a(0x129)]()!=='')[_0x7e895a(0x11c)](([_0x330058,_0x2adb51])=>_0x7e895a(0x11f)+_0x330058+':\x20'+String(_0x2adb51)+'\x20-->');return _0x2abcfa['filter'](([,_0x35e6c0])=>_0x35e6c0!==undefined&&_0x35e6c0!==null&&String(_0x35e6c0)[_0x7e895a(0x129)]()!=='')['map'](([_0x31773a,_0x536710])=>_0x7e895a(0x12f)+_0x31773a+':\x20'+String(_0x536710));}
1
+ const a239_0x46fd74=a239_0x51cd;(function(_0x430be1,_0x2e819f){const _0x4d6c8c=a239_0x51cd,_0x396a3d=_0x430be1();while(!![]){try{const _0x3d131a=parseInt(_0x4d6c8c(0x8f))/0x1+parseInt(_0x4d6c8c(0x9f))/0x2*(parseInt(_0x4d6c8c(0x9e))/0x3)+parseInt(_0x4d6c8c(0xb8))/0x4+parseInt(_0x4d6c8c(0x93))/0x5+-parseInt(_0x4d6c8c(0xb1))/0x6*(parseInt(_0x4d6c8c(0x90))/0x7)+parseInt(_0x4d6c8c(0x96))/0x8+parseInt(_0x4d6c8c(0xaa))/0x9*(-parseInt(_0x4d6c8c(0xa6))/0xa);if(_0x3d131a===_0x2e819f)break;else _0x396a3d['push'](_0x396a3d['shift']());}catch(_0x42d4fd){_0x396a3d['push'](_0x396a3d['shift']());}}}(a239_0x26ec,0xd162b));import{createInterface}from'node:readline';function a239_0x26ec(){const _0x5cdfa4=['fromEntries','path','6292692iMYXeC','sqlRoot','exec','slice','1241427QfaVhh','868987rOmOJQ','sqlConfig','description','6235780aqduQr','--\x20@lovrabet.','declaration','9356816yQDVTO','mybatisXml','apps','trimStart','dbName','split','stderr','filter','69SXTgWK','105862nBMPRs','map','replace','trim','test','sqlCode','sqlName','378790abIMZD','close','endsWith','includes','945ffdXmq','\x20-->','dbId','syncedAt','.rabetbase/sql','toLowerCase','body','78Wpiiro','length','mode','version','join'];a239_0x26ec=function(){return _0x5cdfa4;};return a239_0x26ec();}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a239_0x46fd74(0xae);export function buildSqlLockEntry(_0x1feac3,_0x3bbffb,_0x280ebd,_0x3a5a4a){const _0x2d95a0=a239_0x46fd74,_0x25925d=detectSqlMode(_0x3bbffb);return{'path':buildSqlRelativePath(_0x1feac3[_0x2d95a0(0xa4)],_0x1feac3[_0x2d95a0(0xa5)],_0x3a5a4a?.[_0x2d95a0(0x9a)],_0x25925d,_0x1feac3['dbId']),'hash':_0x280ebd,'remoteId':_0x1feac3['id'],'version':_0x1feac3[_0x2d95a0(0xb4)],'dbId':Number(_0x1feac3[_0x2d95a0(0xac)]),'dbName':_0x3a5a4a?.['dbName'],'sqlName':_0x1feac3['sqlName'],'sqlConfig':_0x1feac3[_0x2d95a0(0x91)]??undefined,'mode':_0x25925d};}export function cloneSqlLockData(_0x2e0fc3){const _0x3fd084=a239_0x46fd74;return{'apps':Object[_0x3fd084(0xb6)](Object['entries'](_0x2e0fc3[_0x3fd084(0x98)])[_0x3fd084(0xa0)](([_0x27495c,_0x16cf39])=>[_0x27495c,{'sqlRoot':_0x16cf39[_0x3fd084(0xb9)],'lastSync':_0x16cf39['lastSync'],'sqls':{..._0x16cf39['sqls']}}]))};}export function ensureRemoteSqlContent(_0x2dae7e){return _0x2dae7e['sqlContent']??'';}export function buildLocalSqlFileContent(_0x5591d9,_0x3b22d5,_0x3cd695){const _0x1c3ad2=a239_0x46fd74,_0x5906ce=_0x3cd695?.[_0x1c3ad2(0xb3)]??detectSqlMode(_0x3b22d5),_0x5b501b=stripLocalSqlMetadata(_0x3b22d5,_0x5906ce)[_0x1c3ad2(0xa2)](),_0xfeee66=buildMetadataHeaderLines({'sqlCode':_0x5591d9['sqlCode'],'sqlName':_0x5591d9['sqlName'],'dbId':_0x5591d9[_0x1c3ad2(0xac)],'dbName':_0x3cd695?.[_0x1c3ad2(0x9a)],'mode':_0x5906ce,'syncedAt':_0x3cd695?.[_0x1c3ad2(0xad)],'description':_0x3cd695?.[_0x1c3ad2(0x92)]},_0x5906ce),_0x5b7297=_0x5906ce===_0x1c3ad2(0x97)?splitXmlDeclaration(_0x5b501b):{'body':_0x5b501b},_0x4d5ef4=[..._0x5b7297[_0x1c3ad2(0x95)]?[_0x5b7297[_0x1c3ad2(0x95)]]:[],..._0xfeee66,'',_0x5b7297[_0x1c3ad2(0xb0)][_0x1c3ad2(0x99)]()],_0xe8805c=_0x4d5ef4[_0x1c3ad2(0xb5)]('\x0a');return _0xe8805c[_0x1c3ad2(0xa8)]('\x0a')?_0xe8805c:_0xe8805c+'\x0a';}export function stripLocalSqlMetadata(_0x4a46f8,_0x2e016c){const _0x54e226=a239_0x46fd74;if(_0x2e016c===_0x54e226(0x97)){const {declaration:_0x572b08,body:_0x199e5b}=splitXmlDeclaration(_0x4a46f8[_0x54e226(0xa1)](/\r\n/g,'\x0a')),_0x34834a=stripLeadingMetadataLines(_0x199e5b,/^\s*<!--\s*@lovrabet\./);return _0x572b08?''+_0x572b08+(_0x34834a?'\x0a'+_0x34834a:''):_0x34834a;}return stripLeadingMetadataLines(_0x4a46f8[_0x54e226(0xa1)](/\r\n/g,'\x0a'),/^\s*--\s*@lovrabet\./);}export function resolveSqlMode(_0x46e170,_0x18c039){const _0x564c83=a239_0x46fd74;if(_0x18c039?.['mode'])return _0x18c039[_0x564c83(0xb3)];return detectSqlMode(_0x46e170);}export function resolveSqlFileName(_0x1c498b,_0x3d1e21,_0x33c2ef){const _0x31f630=a239_0x46fd74;if(_0x33c2ef?.['path'])return _0x33c2ef[_0x31f630(0xb7)];if(_0x33c2ef?.['sqlName']||_0x33c2ef?.[_0x31f630(0x9a)])return buildSqlRelativePath(_0x1c498b,_0x33c2ef?.[_0x31f630(0xa5)],_0x33c2ef?.['dbName'],resolveSqlMode(_0x3d1e21,_0x33c2ef),_0x33c2ef?.[_0x31f630(0xac)]);return buildDefaultSqlFileName(_0x1c498b,resolveSqlMode(_0x3d1e21,_0x33c2ef));}export function resolveSqlLocalDir(_0x228520,_0x177d4c){return join(_0x228520,SQL_LOCAL_REL_DIR,_0x177d4c);}export async function confirmForceOverwrite(_0x445693){const _0x247505=a239_0x46fd74,_0x389c79=createInterface({'input':process['stdin'],'output':process[_0x247505(0x9c)]}),_0x1b7deb=await new Promise(_0x4a61e3=>{_0x389c79['question'](_0x445693+'\x20[y/N]\x20',_0x4a61e3);});return _0x389c79[_0x247505(0xa7)](),['y','yes'][_0x247505(0xa9)](_0x1b7deb[_0x247505(0xa2)]()[_0x247505(0xaf)]());}export function findSqlLockScope(_0x248a82,_0x26a7c7){const _0x3d2dff=a239_0x46fd74;return _0x248a82[_0x3d2dff(0x98)][_0x26a7c7];}function buildMetadataHeaderLines(_0x13bda5,_0x1405da){const _0x16cb25=a239_0x46fd74,_0x4058c5=[[_0x16cb25(0xa4),_0x13bda5['sqlCode']],[_0x16cb25(0xa5),_0x13bda5['sqlName']],[_0x16cb25(0xac),_0x13bda5[_0x16cb25(0xac)]],[_0x16cb25(0x9a),_0x13bda5['dbName']],[_0x16cb25(0xb3),_0x13bda5[_0x16cb25(0xb3)]],['syncedAt',_0x13bda5[_0x16cb25(0xad)]],['description',_0x13bda5[_0x16cb25(0x92)]]];if(_0x1405da===_0x16cb25(0x97))return _0x4058c5[_0x16cb25(0x9d)](([,_0x154f51])=>_0x154f51!==undefined&&_0x154f51!==null&&String(_0x154f51)[_0x16cb25(0xa2)]()!=='')['map'](([_0x275ef7,_0x53075d])=>'<!--\x20@lovrabet.'+_0x275ef7+':\x20'+String(_0x53075d)+_0x16cb25(0xab));return _0x4058c5[_0x16cb25(0x9d)](([,_0x3cc7ed])=>_0x3cc7ed!==undefined&&_0x3cc7ed!==null&&String(_0x3cc7ed)[_0x16cb25(0xa2)]()!=='')[_0x16cb25(0xa0)](([_0x35658d,_0x12eaa1])=>_0x16cb25(0x94)+_0x35658d+':\x20'+String(_0x12eaa1));}function splitXmlDeclaration(_0x7852d8){const _0x1792d9=a239_0x46fd74,_0x448d24=_0x7852d8[_0x1792d9(0x99)](),_0x645b45=/^<\?xml(?=\s|\?>)[\s\S]*?\?>/i[_0x1792d9(0x8d)](_0x448d24);if(!_0x645b45)return{'body':_0x7852d8};return{'declaration':_0x645b45[0x0],'body':_0x448d24[_0x1792d9(0x8e)](_0x645b45[0x0][_0x1792d9(0xb2)])};}function a239_0x51cd(_0x118c11,_0x1f1710){_0x118c11=_0x118c11-0x8d;const _0x26ecef=a239_0x26ec();let _0x51cde5=_0x26ecef[_0x118c11];return _0x51cde5;}function stripLeadingMetadataLines(_0x35b0db,_0x555cd4){const _0x5aab1d=a239_0x46fd74,_0x199fb6=_0x35b0db[_0x5aab1d(0x9b)]('\x0a');let _0x37290e=0x0;while(_0x37290e<_0x199fb6[_0x5aab1d(0xb2)]){const _0x37f2b9=_0x199fb6[_0x37290e]??'';if(_0x555cd4[_0x5aab1d(0xa3)](_0x37f2b9)||_0x37f2b9[_0x5aab1d(0xa2)]()===''){_0x37290e++;continue;}break;}return _0x199fb6[_0x5aab1d(0x8e)](_0x37290e)[_0x5aab1d(0xb5)]('\x0a')[_0x5aab1d(0x99)]();}
@@ -1 +1 @@
1
- const a240_0x239e87=a240_0xa059;(function(_0x554a52,_0x22465b){const _0x4bc64b=a240_0xa059,_0x4393b3=_0x554a52();while(!![]){try{const _0x2c27ab=-parseInt(_0x4bc64b(0x1ba))/0x1*(parseInt(_0x4bc64b(0x1b3))/0x2)+-parseInt(_0x4bc64b(0x1c8))/0x3*(-parseInt(_0x4bc64b(0x1bf))/0x4)+-parseInt(_0x4bc64b(0x1ab))/0x5*(parseInt(_0x4bc64b(0x1b0))/0x6)+parseInt(_0x4bc64b(0x1c7))/0x7*(-parseInt(_0x4bc64b(0x1c9))/0x8)+parseInt(_0x4bc64b(0x1ac))/0x9*(parseInt(_0x4bc64b(0x1c5))/0xa)+-parseInt(_0x4bc64b(0x1b8))/0xb+parseInt(_0x4bc64b(0x1b2))/0xc;if(_0x2c27ab===_0x22465b)break;else _0x4393b3['push'](_0x4393b3['shift']());}catch(_0x5f43fc){_0x4393b3['push'](_0x4393b3['shift']());}}}(a240_0x5ae5,0x59405));function a240_0xa059(_0x322a80,_0x209d89){_0x322a80=_0x322a80-0x1a1;const _0x5ae5f6=a240_0x5ae5();let _0xa05914=_0x5ae5f6[_0x322a80];return _0xa05914;}import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x36562c){const _0x27f016=a240_0xa059,_0x231f5e=[];let _0x4b15b5=0x1;while(!![]){const _0x46241a=await listSqlQueries(_0x36562c,{'currentPage':_0x4b15b5,'pageSize':PAGE_SIZE}),_0x475db2=_0x46241a[_0x27f016(0x1c3)]??[];_0x231f5e[_0x27f016(0x1a2)](..._0x475db2[_0x27f016(0x1a6)](_0xaf3b05=>_0xaf3b05[_0x27f016(0x1ca)]));if(_0x475db2[_0x27f016(0x1a1)]===0x0)break;const _0x5f2a94=_0x46241a[_0x27f016(0x1a4)]?.[_0x27f016(0x1bc)];if(_0x5f2a94!=null?_0x231f5e[_0x27f016(0x1a1)]>=_0x5f2a94:_0x475db2[_0x27f016(0x1a1)]<PAGE_SIZE)break;_0x4b15b5++;}return _0x231f5e;}export const sqlStatus={'service':a240_0x239e87(0x1b7),'command':a240_0x239e87(0x1c4),'description':a240_0x239e87(0x1a9),'risk':a240_0x239e87(0x1aa),'flags':[{'name':'remote','type':a240_0x239e87(0x1c0),'description':a240_0x239e87(0x1a7)}],async 'execute'(_0x24926c){const _0x3a5787=a240_0x239e87,_0x57104b=loadSqlProjectConfig(_0x24926c[_0x3a5787(0x1c2)]),_0x3ce341=await readSqlLockFile(_0x57104b[_0x3a5787(0x1b5)]),{appLock:_0x38fb8b}=ensureSqlLockScope(_0x3ce341??createEmptySqlLock(),_0x57104b['appCode'],_0x57104b[_0x3a5787(0x1be)],_0x3a5787(0x1c4)),_0x44636c=await scanLocalSqlQueries(_0x57104b),_0x16270a=[],_0x1e3343=[],_0x2b2a9e=[],_0x32e51d=[],_0x5731cc=new Set(_0x44636c['map'](_0x1ce399=>_0x1ce399[_0x3a5787(0x1ad)]));for(const _0x7fa03e of _0x44636c){const _0x55d326=await computeSqlFileHash(_0x7fa03e[_0x3a5787(0x1b4)]),_0x7632a6=_0x38fb8b['sqls'][_0x7fa03e[_0x3a5787(0x1ad)]],_0x203b2e=!!_0x7632a6&&_0x7632a6[_0x3a5787(0x1af)]!==_0x7fa03e['relativePath'],_0x255d0e=!!_0x7632a6&&!!_0x7fa03e[_0x3a5787(0x1a3)]&&_0x7632a6[_0x3a5787(0x1a3)]!==_0x7fa03e[_0x3a5787(0x1a3)];if(!_0x7632a6)_0x16270a[_0x3a5787(0x1a2)](_0x7fa03e[_0x3a5787(0x1ad)]);else _0x7632a6['hash']!==_0x55d326||_0x203b2e||_0x255d0e?_0x1e3343['push'](_0x7fa03e[_0x3a5787(0x1ad)]):_0x2b2a9e['push'](_0x7fa03e['lockKey']);}for(const _0x2d228f of Object[_0x3a5787(0x1b6)](_0x38fb8b[_0x3a5787(0x1a5)])){!_0x5731cc['has'](_0x2d228f)&&_0x32e51d['push'](_0x2d228f);}const _0x3cdcc0=[];if(_0x24926c[_0x3a5787(0x1c6)](_0x3a5787(0x1a8))){const _0x24423a=await fetchAllSqlCodes(_0x24926c[_0x3a5787(0x1c2)]);for(const _0x49f444 of _0x24423a){!_0x5731cc[_0x3a5787(0x1cb)](_0x49f444)&&!_0x38fb8b[_0x3a5787(0x1a5)][_0x49f444]&&_0x3cdcc0['push'](_0x49f444);}}const _0x22b99e=_0x16270a[_0x3a5787(0x1a1)]===0x0&&_0x1e3343[_0x3a5787(0x1a1)]===0x0&&_0x32e51d[_0x3a5787(0x1a1)]===0x0&&_0x3cdcc0[_0x3a5787(0x1a1)]===0x0;return{'ok':!![],'data':{'added':_0x16270a,'modified':_0x1e3343,'missing':_0x32e51d,'unchanged':_0x2b2a9e,'remoteOnly':_0x3cdcc0},'message':_0x22b99e?_0x3a5787(0x1c1):_0x16270a[_0x3a5787(0x1a1)]+_0x3a5787(0x1ae)+_0x1e3343[_0x3a5787(0x1a1)]+_0x3a5787(0x1b1)+_0x32e51d[_0x3a5787(0x1a1)]+_0x3a5787(0x1b9)+_0x2b2a9e[_0x3a5787(0x1a1)]+_0x3a5787(0x1bb)+(_0x3cdcc0[_0x3a5787(0x1a1)]>0x0?',\x20'+_0x3cdcc0[_0x3a5787(0x1a1)]+_0x3a5787(0x1bd):'')};}};function a240_0x5ae5(){const _0x483cfc=['48STnBKL','sqlCode','has','length','push','sqlName','paging','sqls','map','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','remote','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','read','90isfpBP','3040155ZBQalj','lockKey','\x20added,\x20','path','226452hfXKlw','\x20modified,\x20','13348332YrbIUw','158ZmXMFG','filePath','lockFilePath','keys','sql','7587756LpYFiF','\x20missing,\x20','4073lKbAZY','\x20unchanged','totalCount','\x20remote-only','sqlRoot','8bOBNVW','boolean','All\x20SQL\x20queries\x20are\x20in\x20sync.','appCode','tableData','status','10NcCRjS','bool','75817FrrnOm','1006983HsLZUb'];a240_0x5ae5=function(){return _0x483cfc;};return a240_0x5ae5();}
1
+ const a240_0x39417e=a240_0x14e1;(function(_0x194f00,_0x2a8cbd){const _0x2cad31=a240_0x14e1,_0x1ceb81=_0x194f00();while(!![]){try{const _0x181e14=-parseInt(_0x2cad31(0x1fd))/0x1+-parseInt(_0x2cad31(0x1f2))/0x2+-parseInt(_0x2cad31(0x1fe))/0x3+-parseInt(_0x2cad31(0x1ef))/0x4*(parseInt(_0x2cad31(0x1fa))/0x5)+parseInt(_0x2cad31(0x1f5))/0x6+parseInt(_0x2cad31(0x1fc))/0x7*(parseInt(_0x2cad31(0x1fb))/0x8)+parseInt(_0x2cad31(0x1f7))/0x9;if(_0x181e14===_0x2a8cbd)break;else _0x1ceb81['push'](_0x1ceb81['shift']());}catch(_0x5bc6e5){_0x1ceb81['push'](_0x1ceb81['shift']());}}}(a240_0x3e38,0x767d9));function a240_0x14e1(_0x15a202,_0x4d3ad8){_0x15a202=_0x15a202-0x1e3;const _0x3e38d4=a240_0x3e38();let _0x14e197=_0x3e38d4[_0x15a202];return _0x14e197;}import{listSqlQueries}from'../../core/api-client.js';function a240_0x3e38(){const _0x461fcd=['\x20missing,\x20','1169358dtTAVy','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','keys','4646814zabzll','has','11822031rjgIwP','map','appCode','5LGeSZe','8tkCVeV','4491438vgJsLU','816861gYkgKk','50928GaYrDP','hash','\x20added,\x20','\x20modified,\x20','\x20remote-only','sqlRoot','sqls','paging','push','lockFilePath','relativePath','remote','lockKey','\x20unchanged','tableData','status','read','sqlName','length','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','3303236aHNgXl','sql'];a240_0x3e38=function(){return _0x461fcd;};return a240_0x3e38();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x536548){const _0x1ccc17=a240_0x14e1,_0x2bf69d=[];let _0x282430=0x1;while(!![]){const _0x3971a7=await listSqlQueries(_0x536548,{'currentPage':_0x282430,'pageSize':PAGE_SIZE}),_0x4056e9=_0x3971a7[_0x1ccc17(0x1e9)]??[];_0x2bf69d[_0x1ccc17(0x1e3)](..._0x4056e9[_0x1ccc17(0x1f8)](_0x393136=>_0x393136['sqlCode']));if(_0x4056e9[_0x1ccc17(0x1ed)]===0x0)break;const _0x52771d=_0x3971a7[_0x1ccc17(0x205)]?.['totalCount'];if(_0x52771d!=null?_0x2bf69d[_0x1ccc17(0x1ed)]>=_0x52771d:_0x4056e9[_0x1ccc17(0x1ed)]<PAGE_SIZE)break;_0x282430++;}return _0x2bf69d;}export const sqlStatus={'service':a240_0x39417e(0x1f0),'command':'status','description':a240_0x39417e(0x1ee),'risk':a240_0x39417e(0x1eb),'flags':[{'name':'remote','type':'boolean','description':a240_0x39417e(0x1f3)}],async 'execute'(_0x853731){const _0x1fe09c=a240_0x39417e,_0x298061=loadSqlProjectConfig(_0x853731[_0x1fe09c(0x1f9)]),_0x34ef06=await readSqlLockFile(_0x298061[_0x1fe09c(0x1e4)]),{appLock:_0x2f5359}=ensureSqlLockScope(_0x34ef06??createEmptySqlLock(),_0x298061['appCode'],_0x298061[_0x1fe09c(0x203)],_0x1fe09c(0x1ea)),_0xe27a31=await scanLocalSqlQueries(_0x298061),_0x164a10=[],_0x13f1a1=[],_0x1d6595=[],_0x5c4b01=[],_0x45b994=new Set(_0xe27a31[_0x1fe09c(0x1f8)](_0x28055d=>_0x28055d[_0x1fe09c(0x1e7)]));for(const _0x141b3c of _0xe27a31){const _0x58f312=await computeSqlFileHash(_0x141b3c['filePath']),_0x178208=_0x2f5359[_0x1fe09c(0x204)][_0x141b3c[_0x1fe09c(0x1e7)]],_0x44dc95=!!_0x178208&&_0x178208['path']!==_0x141b3c[_0x1fe09c(0x1e5)],_0x2f0e5c=!!_0x178208&&!!_0x141b3c[_0x1fe09c(0x1ec)]&&_0x178208[_0x1fe09c(0x1ec)]!==_0x141b3c['sqlName'];if(!_0x178208)_0x164a10[_0x1fe09c(0x1e3)](_0x141b3c[_0x1fe09c(0x1e7)]);else _0x178208[_0x1fe09c(0x1ff)]!==_0x58f312||_0x44dc95||_0x2f0e5c?_0x13f1a1[_0x1fe09c(0x1e3)](_0x141b3c[_0x1fe09c(0x1e7)]):_0x1d6595[_0x1fe09c(0x1e3)](_0x141b3c[_0x1fe09c(0x1e7)]);}for(const _0xc2aa1 of Object[_0x1fe09c(0x1f4)](_0x2f5359[_0x1fe09c(0x204)])){!_0x45b994[_0x1fe09c(0x1f6)](_0xc2aa1)&&_0x5c4b01[_0x1fe09c(0x1e3)](_0xc2aa1);}const _0x75f2d2=[];if(_0x853731['bool'](_0x1fe09c(0x1e6))){const _0x5b6fdb=await fetchAllSqlCodes(_0x853731[_0x1fe09c(0x1f9)]);for(const _0x15aeaa of _0x5b6fdb){!_0x45b994[_0x1fe09c(0x1f6)](_0x15aeaa)&&!_0x2f5359[_0x1fe09c(0x204)][_0x15aeaa]&&_0x75f2d2['push'](_0x15aeaa);}}const _0x3c2100=_0x164a10[_0x1fe09c(0x1ed)]===0x0&&_0x13f1a1['length']===0x0&&_0x5c4b01['length']===0x0&&_0x75f2d2['length']===0x0;return{'ok':!![],'data':{'added':_0x164a10,'modified':_0x13f1a1,'missing':_0x5c4b01,'unchanged':_0x1d6595,'remoteOnly':_0x75f2d2},'message':_0x3c2100?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x164a10[_0x1fe09c(0x1ed)]+_0x1fe09c(0x200)+_0x13f1a1[_0x1fe09c(0x1ed)]+_0x1fe09c(0x201)+_0x5c4b01[_0x1fe09c(0x1ed)]+_0x1fe09c(0x1f1)+_0x1d6595[_0x1fe09c(0x1ed)]+_0x1fe09c(0x1e8)+(_0x75f2d2[_0x1fe09c(0x1ed)]>0x0?',\x20'+_0x75f2d2['length']+_0x1fe09c(0x202):'')};}};