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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/api-group.js +1 -1
  3. package/lib/api/fetch-model-list.js +1 -1
  4. package/lib/api/generate-api-file.js +1 -1
  5. package/lib/api/generate-sdk-config-file.js +1 -1
  6. package/lib/api/legacy-api-file.js +1 -1
  7. package/lib/api/model-registry-file.js +1 -1
  8. package/lib/api/model-registry-scaffold.js +1 -1
  9. package/lib/api/model-source.js +1 -1
  10. package/lib/auth/auth-server-ui.js +1 -1
  11. package/lib/auth/auth-server.js +1 -1
  12. package/lib/auth/constant.js +1 -1
  13. package/lib/auth/get-cookie.js +1 -1
  14. package/lib/auth/get-session-user.js +1 -1
  15. package/lib/auth/is-session-valid.js +1 -1
  16. package/lib/auth/login-success-html.js +1 -1
  17. package/lib/auth/logout.js +1 -1
  18. package/lib/cli-flags.js +1 -1
  19. package/lib/cli.js +1 -1
  20. package/lib/commands/api/generate.js +1 -1
  21. package/lib/commands/api/index.js +1 -1
  22. package/lib/commands/api/list.js +1 -1
  23. package/lib/commands/api/pull.js +1 -1
  24. package/lib/commands/api/shared.js +1 -1
  25. package/lib/commands/app/detail.js +1 -1
  26. package/lib/commands/app/index.js +1 -1
  27. package/lib/commands/app/list.js +1 -1
  28. package/lib/commands/app/members-list.js +1 -1
  29. package/lib/commands/app/remote-directory.js +1 -1
  30. package/lib/commands/app/shared.js +1 -1
  31. package/lib/commands/app-config/delete.js +1 -1
  32. package/lib/commands/app-config/get.js +1 -1
  33. package/lib/commands/app-config/index.js +1 -1
  34. package/lib/commands/app-config/list.js +1 -1
  35. package/lib/commands/app-config/set.js +1 -1
  36. package/lib/commands/app-config/shared.js +1 -1
  37. package/lib/commands/auth/index.js +1 -1
  38. package/lib/commands/bff/create.js +1 -1
  39. package/lib/commands/bff/delete.js +1 -1
  40. package/lib/commands/bff/detail.js +1 -1
  41. package/lib/commands/bff/index.js +1 -1
  42. package/lib/commands/bff/list.js +1 -1
  43. package/lib/commands/bff/logs.js +1 -1
  44. package/lib/commands/bff/pull.js +1 -1
  45. package/lib/commands/bff/push.js +1 -1
  46. package/lib/commands/bff/status.js +1 -1
  47. package/lib/commands/cli-skill/index.js +1 -1
  48. package/lib/commands/cli-update.js +1 -1
  49. package/lib/commands/codegen/index.js +1 -1
  50. package/lib/commands/codegen/sdk.js +1 -1
  51. package/lib/commands/codegen/sql.js +1 -1
  52. package/lib/commands/common/app-registry.js +1 -1
  53. package/lib/commands/common/app-selector.js +1 -1
  54. package/lib/commands/common/async-task.js +1 -1
  55. package/lib/commands/common/dry-run.js +1 -1
  56. package/lib/commands/common/flags.js +1 -1
  57. package/lib/commands/common/local-file.js +1 -1
  58. package/lib/commands/common/validate.js +1 -1
  59. package/lib/commands/config/delete.js +1 -1
  60. package/lib/commands/config/get.js +1 -1
  61. package/lib/commands/config/index.js +1 -1
  62. package/lib/commands/config/init.js +1 -1
  63. package/lib/commands/config/list.js +1 -1
  64. package/lib/commands/config/set.js +1 -1
  65. package/lib/commands/config/shared.js +1 -1
  66. package/lib/commands/dataset/batch-design.js +1 -1
  67. package/lib/commands/dataset/business-group-update.js +1 -1
  68. package/lib/commands/dataset/business-groups.js +1 -1
  69. package/lib/commands/dataset/capability.js +1 -1
  70. package/lib/commands/dataset/cross-relation-create.js +1 -1
  71. package/lib/commands/dataset/cross-relation-delete.js +1 -1
  72. package/lib/commands/dataset/cross-relation-list.js +1 -1
  73. package/lib/commands/dataset/cross-relation-shared.js +1 -1
  74. package/lib/commands/dataset/cross-relation-update.js +1 -1
  75. package/lib/commands/dataset/delete.js +1 -1
  76. package/lib/commands/dataset/design-context.js +1 -1
  77. package/lib/commands/dataset/design-start.js +1 -1
  78. package/lib/commands/dataset/design-status.js +1 -1
  79. package/lib/commands/dataset/design-sync-retry.js +1 -1
  80. package/lib/commands/dataset/design-sync-status.js +1 -1
  81. package/lib/commands/dataset/design-validate.js +1 -1
  82. package/lib/commands/dataset/detail.js +1 -1
  83. package/lib/commands/dataset/extend-update.js +1 -1
  84. package/lib/commands/dataset/field-restore.js +1 -1
  85. package/lib/commands/dataset/field-update.js +1 -1
  86. package/lib/commands/dataset/generate.js +1 -1
  87. package/lib/commands/dataset/index.js +1 -1
  88. package/lib/commands/dataset/list.js +1 -1
  89. package/lib/commands/dataset/operations.js +1 -1
  90. package/lib/commands/dataset/relation-audit.js +1 -1
  91. package/lib/commands/dataset/relation-create.js +1 -1
  92. package/lib/commands/dataset/relation-delete.js +1 -1
  93. package/lib/commands/dataset/relation-shared.js +1 -1
  94. package/lib/commands/dataset/relation-update.js +1 -1
  95. package/lib/commands/dataset/relations.js +1 -1
  96. package/lib/commands/dataset/rename.js +1 -1
  97. package/lib/commands/dataset/restore.js +1 -1
  98. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  99. package/lib/commands/db/analysis-batching.js +1 -1
  100. package/lib/commands/db/analyze-batch-plan.js +1 -1
  101. package/lib/commands/db/analyze-cancel.js +1 -1
  102. package/lib/commands/db/analyze-start.js +1 -1
  103. package/lib/commands/db/analyze-status.js +1 -1
  104. package/lib/commands/db/create.js +1 -1
  105. package/lib/commands/db/cross-db-analysis-shared.js +1 -1
  106. package/lib/commands/db/cross-db-analyze-latest.js +1 -1
  107. package/lib/commands/db/cross-db-analyze-start.js +1 -1
  108. package/lib/commands/db/cross-db-analyze-status.js +1 -1
  109. package/lib/commands/db/delete.js +1 -1
  110. package/lib/commands/db/detail.js +1 -1
  111. package/lib/commands/db/diff-refresh-start.js +1 -1
  112. package/lib/commands/db/diff-refresh-status.js +1 -1
  113. package/lib/commands/db/diff.js +1 -1
  114. package/lib/commands/db/index.js +1 -1
  115. package/lib/commands/db/list.js +1 -1
  116. package/lib/commands/db/shared.js +1 -1
  117. package/lib/commands/db/table-diff-shared.js +1 -1
  118. package/lib/commands/db/tables.js +1 -1
  119. package/lib/commands/db/test.js +1 -1
  120. package/lib/commands/db/update.js +1 -1
  121. package/lib/commands/deployment/index.js +1 -1
  122. package/lib/commands/deployment/sync-all.js +1 -1
  123. package/lib/commands/deployment/sync-jobs.js +1 -1
  124. package/lib/commands/deployment/sync-status.js +1 -1
  125. package/lib/commands/doctor.js +1 -1
  126. package/lib/commands/file/index.js +1 -1
  127. package/lib/commands/flow/create.js +1 -1
  128. package/lib/commands/flow/detail.js +1 -1
  129. package/lib/commands/flow/index.js +1 -1
  130. package/lib/commands/flow/list.js +1 -1
  131. package/lib/commands/flow/page-list.js +1 -1
  132. package/lib/commands/flow/publish.js +1 -1
  133. package/lib/commands/flow/runtime-resources-shared.js +1 -1
  134. package/lib/commands/flow/runtime-role-list.js +1 -1
  135. package/lib/commands/flow/runtime-role-user-list.js +1 -1
  136. package/lib/commands/flow/runtime-user-search.js +1 -1
  137. package/lib/commands/flow/shared.js +1 -1
  138. package/lib/commands/flow/update.js +1 -1
  139. package/lib/commands/flow/validate.js +1 -1
  140. package/lib/commands/instant-api-policy/current.js +1 -1
  141. package/lib/commands/instant-api-policy/index.js +1 -1
  142. package/lib/commands/instant-api-policy/init.js +1 -1
  143. package/lib/commands/instant-api-policy/publish.js +1 -1
  144. package/lib/commands/instant-api-policy/pull.js +1 -1
  145. package/lib/commands/instant-api-policy/revision.js +1 -1
  146. package/lib/commands/instant-api-policy/revisions.js +1 -1
  147. package/lib/commands/instant-api-policy/rollback.js +1 -1
  148. package/lib/commands/instant-api-policy/shared.js +1 -1
  149. package/lib/commands/instant-api-policy/validate.js +1 -1
  150. package/lib/commands/issue/index.js +1 -1
  151. package/lib/commands/issue/nudge.js +1 -1
  152. package/lib/commands/issue/report.js +1 -1
  153. package/lib/commands/issue/shared.js +1 -1
  154. package/lib/commands/kb/create.js +1 -1
  155. package/lib/commands/kb/delete.js +1 -1
  156. package/lib/commands/kb/detail.js +1 -1
  157. package/lib/commands/kb/index.js +1 -1
  158. package/lib/commands/kb/list.js +1 -1
  159. package/lib/commands/kb/search.js +1 -1
  160. package/lib/commands/kb/shared.js +1 -1
  161. package/lib/commands/kb/update.js +1 -1
  162. package/lib/commands/logs/index.js +1 -1
  163. package/lib/commands/menu/asset-update.js +1 -1
  164. package/lib/commands/menu/delete.js +1 -1
  165. package/lib/commands/menu/external-link-create.js +1 -1
  166. package/lib/commands/menu/external-link-update.js +1 -1
  167. package/lib/commands/menu/group-create.js +1 -1
  168. package/lib/commands/menu/group-update.js +1 -1
  169. package/lib/commands/menu/index.js +1 -1
  170. package/lib/commands/menu/list.js +1 -1
  171. package/lib/commands/menu/move.js +1 -1
  172. package/lib/commands/menu/regroup-start.js +1 -1
  173. package/lib/commands/menu/rename.js +1 -1
  174. package/lib/commands/menu/shared/compare-table.js +1 -1
  175. package/lib/commands/menu/shared/delete-plan.js +1 -1
  176. package/lib/commands/menu/shared/facts.js +1 -1
  177. package/lib/commands/menu/shared/index.js +1 -1
  178. package/lib/commands/menu/shared/inquirer.js +1 -1
  179. package/lib/commands/menu/shared/local-pages.js +1 -1
  180. package/lib/commands/menu/shared/logic.js +1 -1
  181. package/lib/commands/menu/shared/mutations.js +1 -1
  182. package/lib/commands/menu/shared/path.js +1 -1
  183. package/lib/commands/menu/shared/service.js +1 -1
  184. package/lib/commands/menu/shared/subapp-assets.js +1 -1
  185. package/lib/commands/menu/shared/sync-core.js +1 -1
  186. package/lib/commands/menu/shared/update-core.js +1 -1
  187. package/lib/commands/menu/shared/valid-url.js +1 -1
  188. package/lib/commands/menu/subapp-assets-status.js +1 -1
  189. package/lib/commands/menu/subapp-assets-update.js +1 -1
  190. package/lib/commands/menu/sync.js +1 -1
  191. package/lib/commands/menu/visibility-update.js +1 -1
  192. package/lib/commands/notification/config-create.js +1 -1
  193. package/lib/commands/notification/config-delete.js +1 -1
  194. package/lib/commands/notification/config-list.js +1 -1
  195. package/lib/commands/notification/config-update.js +1 -1
  196. package/lib/commands/notification/index.js +1 -1
  197. package/lib/commands/notification/shared.js +1 -1
  198. package/lib/commands/ocr/index.js +1 -1
  199. package/lib/commands/page/create.js +1 -1
  200. package/lib/commands/page/custom/detail.js +1 -1
  201. package/lib/commands/page/custom/list.js +1 -1
  202. package/lib/commands/page/custom/publish.js +1 -1
  203. package/lib/commands/page/custom/shared.js +1 -1
  204. package/lib/commands/page/custom/syntax.js +1 -1
  205. package/lib/commands/page/custom/update.js +1 -1
  206. package/lib/commands/page/data-list-status.js +1 -1
  207. package/lib/commands/page/generate-start.js +1 -1
  208. package/lib/commands/page/generate-status.js +1 -1
  209. package/lib/commands/page/index.js +1 -1
  210. package/lib/commands/page/pull.js +1 -1
  211. package/lib/commands/page/push.js +1 -1
  212. package/lib/commands/page/relation-audit.js +1 -1
  213. package/lib/commands/page/restore.js +1 -1
  214. package/lib/commands/page/shared.js +1 -1
  215. package/lib/commands/page/sync.js +1 -1
  216. package/lib/commands/project/api-architecture-upgrade.js +1 -1
  217. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  218. package/lib/commands/project/create/format-elapsed.js +1 -1
  219. package/lib/commands/project/create/main.js +1 -1
  220. package/lib/commands/project/create/materialize-project-template.js +1 -1
  221. package/lib/commands/project/create/project-name.js +1 -1
  222. package/lib/commands/project/create/project-template-archive.js +1 -1
  223. package/lib/commands/project/create/project-template-path.js +1 -1
  224. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  225. package/lib/commands/project/create/use-format-code.js +1 -1
  226. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  227. package/lib/commands/project/domain-routing-sync.js +1 -1
  228. package/lib/commands/project/index.js +1 -1
  229. package/lib/commands/project/upgrade.js +1 -1
  230. package/lib/commands/registry.js +1 -1
  231. package/lib/commands/role/delete.js +1 -1
  232. package/lib/commands/role/detail.js +1 -1
  233. package/lib/commands/role/index.js +1 -1
  234. package/lib/commands/role/list.js +1 -1
  235. package/lib/commands/role/shared.js +1 -1
  236. package/lib/commands/role/update.js +1 -1
  237. package/lib/commands/role/user-add.js +1 -1
  238. package/lib/commands/role/user-remove.js +1 -1
  239. package/lib/commands/role/user-resolve.js +1 -1
  240. package/lib/commands/rule/get.js +1 -1
  241. package/lib/commands/rule/index.js +1 -1
  242. package/lib/commands/rule/list.js +1 -1
  243. package/lib/commands/rule/set.js +1 -1
  244. package/lib/commands/rule/shared.js +1 -1
  245. package/lib/commands/run/index.js +1 -1
  246. package/lib/commands/schema.js +1 -1
  247. package/lib/commands/sql/create.js +1 -1
  248. package/lib/commands/sql/delete.js +1 -1
  249. package/lib/commands/sql/detail.js +1 -1
  250. package/lib/commands/sql/exec.js +1 -1
  251. package/lib/commands/sql/index.js +1 -1
  252. package/lib/commands/sql/list.js +1 -1
  253. package/lib/commands/sql/pull.js +1 -1
  254. package/lib/commands/sql/push.js +1 -1
  255. package/lib/commands/sql/shared.js +1 -1
  256. package/lib/commands/sql/status.js +1 -1
  257. package/lib/commands/sql/validate.js +1 -1
  258. package/lib/commands/task/index.js +1 -1
  259. package/lib/commands/task/status.js +1 -1
  260. package/lib/commands/tenant/index.js +1 -1
  261. package/lib/commands/tenant/members-list.js +1 -1
  262. package/lib/commands/tenant/shared.js +1 -1
  263. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  264. package/lib/commands/user-account/feishu-bind.js +1 -1
  265. package/lib/commands/user-account/index.js +1 -1
  266. package/lib/commands/workspace/add.js +1 -1
  267. package/lib/commands/workspace/index.js +1 -1
  268. package/lib/commands/workspace/remove.js +1 -1
  269. package/lib/config/domain-config.js +1 -1
  270. package/lib/config/project-domain-routing.js +1 -1
  271. package/lib/config/region-config.js +1 -1
  272. package/lib/config/schema.js +1 -1
  273. package/lib/constant/cdn.js +1 -1
  274. package/lib/constant/cli.js +1 -1
  275. package/lib/constant/defaults.js +1 -1
  276. package/lib/constant/domain.js +1 -1
  277. package/lib/constant/env.js +1 -1
  278. package/lib/constant/output.js +1 -1
  279. package/lib/constant/paths.js +1 -1
  280. package/lib/constant/region.js +1 -1
  281. package/lib/constant/risk.js +1 -1
  282. package/lib/constant/routing-profile.js +1 -1
  283. package/lib/context/app-resolver.js +1 -1
  284. package/lib/context/auth-resolver.js +1 -1
  285. package/lib/context/config-loader.js +1 -1
  286. package/lib/context.js +1 -1
  287. package/lib/core/alias-resolver.js +1 -1
  288. package/lib/core/api-client.js +1 -1
  289. package/lib/core/bff/config.js +1 -1
  290. package/lib/core/bff/file-system.js +1 -1
  291. package/lib/core/bff/hash.js +1 -1
  292. package/lib/core/bff/hook-directory.js +1 -1
  293. package/lib/core/bff/lock.js +1 -1
  294. package/lib/core/bff/utils.js +1 -1
  295. package/lib/core/cross-db-analysis.js +1 -1
  296. package/lib/core/cross-db-relation.js +1 -1
  297. package/lib/core/db-resolver.js +1 -1
  298. package/lib/core/flow-config.js +1 -1
  299. package/lib/core/instant-api-policy/config.js +1 -1
  300. package/lib/core/kb-search-client.js +1 -1
  301. package/lib/core/page/file-system.js +1 -1
  302. package/lib/core/page/hash.js +1 -1
  303. package/lib/core/page/lock.js +1 -1
  304. package/lib/core/page/lr-smart-jsx.js +1 -1
  305. package/lib/core/sql-index-auditor.js +1 -1
  306. package/lib/core/sql-sync/config.js +1 -1
  307. package/lib/core/sql-sync/file-system.js +1 -1
  308. package/lib/core/sql-sync/hash.js +1 -1
  309. package/lib/core/sql-sync/lock.js +1 -1
  310. package/lib/core/sql-sync/utils.js +1 -1
  311. package/lib/core/sql-validator.js +1 -1
  312. package/lib/errors.js +1 -1
  313. package/lib/framework/build-all-flags.js +1 -1
  314. package/lib/framework/error-output.js +1 -1
  315. package/lib/framework/explicit-yes.js +1 -1
  316. package/lib/framework/flags.js +1 -1
  317. package/lib/framework/help.js +1 -1
  318. package/lib/framework/index.js +1 -1
  319. package/lib/framework/output.js +1 -1
  320. package/lib/framework/response.js +1 -1
  321. package/lib/framework/runner-alias.js +1 -1
  322. package/lib/framework/runner.js +1 -1
  323. package/lib/framework/schema-export.js +1 -1
  324. package/lib/framework/supported-flags.js +1 -1
  325. package/lib/framework/types.js +1 -1
  326. package/lib/generated/build-info.d.ts +4 -4
  327. package/lib/generated/build-info.js +1 -1
  328. package/lib/generated/official-routing.js +1 -1
  329. package/lib/generated/routing-contract.js +1 -1
  330. package/lib/help.js +1 -1
  331. package/lib/postinstall.js +1 -1
  332. package/lib/runtime/confirmation.js +1 -1
  333. package/lib/runtime/event.js +1 -1
  334. package/lib/runtime/index.js +1 -1
  335. package/lib/runtime/queue.js +1 -1
  336. package/lib/runtime/resolve.js +1 -1
  337. package/lib/services/dataset-design/checkpoint.js +1 -1
  338. package/lib/services/dataset-design/commands.js +1 -1
  339. package/lib/services/dataset-design/contract.js +1 -1
  340. package/lib/skills/builtin-skill.js +1 -1
  341. package/lib/skills/main.js +1 -1
  342. package/lib/skills/npx-skills-add.js +1 -1
  343. package/lib/skills/skill-presence.js +1 -1
  344. package/lib/telemetry/cli-command-trace.js +1 -1
  345. package/lib/telemetry/cli-help-trace.js +1 -1
  346. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  347. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  348. package/lib/telemetry/send-cli-trace-log.js +1 -1
  349. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  350. package/lib/utils/ai_config.js +1 -1
  351. package/lib/utils/apply-jq-filter.js +1 -1
  352. package/lib/utils/cdn-config.js +1 -1
  353. package/lib/utils/check-sdk-version.js +1 -1
  354. package/lib/utils/cli-version-check.js +1 -1
  355. package/lib/utils/cli-version-policy.js +1 -1
  356. package/lib/utils/config.js +1 -1
  357. package/lib/utils/entity-with-id.js +1 -1
  358. package/lib/utils/file-utils.js +1 -1
  359. package/lib/utils/guides-cdn.js +1 -1
  360. package/lib/utils/http-client.js +1 -1
  361. package/lib/utils/is-non-interactive.js +1 -1
  362. package/lib/utils/logger.js +1 -1
  363. package/lib/utils/params.js +1 -1
  364. package/lib/utils/platform.js +1 -1
  365. package/lib/utils/sleep.js +1 -1
  366. package/lib/utils/template-replacer.js +1 -1
  367. package/lib/utils/update-notice.js +1 -1
  368. package/lib/utils/version.js +1 -1
  369. package/lib/utils/with-active-cookie.js +1 -1
  370. package/lib/utils/write-cli-side-channel.js +1 -1
  371. package/package.json +1 -1
  372. package/skills/rabetbase/SKILL.md +1 -1
  373. package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
  374. package/skills/rabetbase-page-generation/SKILL.md +1 -1
  375. package/skills/rabetbase.manifest.json +3 -3
@@ -1 +1 @@
1
- function a242_0x46fb(){const _0x2e0666=['12JjsUsO','rule','1208aWIpiv','17493QEwOHv','read','appCode','map','863DuwHix','6utrTXb','7443CnGOol','1257080xTSbBl','2279460JKbkFB','Loaded\x20app\x20rule\x20configuration\x20for\x20','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','2586518VnPyVi','cookie','4177062qemLTZ','length','1214OtvORn'];a242_0x46fb=function(){return _0x2e0666;};return a242_0x46fb();}const a242_0x3089d4=a242_0x307a;(function(_0x311c4c,_0x395d92){const _0x3c924d=a242_0x307a,_0x57a865=_0x311c4c();while(!![]){try{const _0x399024=-parseInt(_0x3c924d(0x16b))/0x1*(-parseInt(_0x3c924d(0x176))/0x2)+-parseInt(_0x3c924d(0x16d))/0x3*(-parseInt(_0x3c924d(0x177))/0x4)+-parseInt(_0x3c924d(0x16f))/0x5*(parseInt(_0x3c924d(0x16c))/0x6)+-parseInt(_0x3c924d(0x167))/0x7*(-parseInt(_0x3c924d(0x166))/0x8)+-parseInt(_0x3c924d(0x174))/0x9+parseInt(_0x3c924d(0x16e))/0xa+parseInt(_0x3c924d(0x172))/0xb;if(_0x399024===_0x395d92)break;else _0x57a865['push'](_0x57a865['shift']());}catch(_0x4ff6b6){_0x57a865['push'](_0x57a865['shift']());}}}(a242_0x46fb,0x5551d));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';function a242_0x307a(_0x2d2ec7,_0x2a24a0){_0x2d2ec7=_0x2d2ec7-0x165;const _0x46fb77=a242_0x46fb();let _0x307ad7=_0x46fb77[_0x2d2ec7];return _0x307ad7;}export const ruleList={'service':a242_0x3089d4(0x165),'command':'list','description':a242_0x3089d4(0x171),'risk':a242_0x3089d4(0x168),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x354026){const _0x5eb69e=a242_0x3089d4,_0x12875e=await Promise['all'](APP_RULE_TYPES[_0x5eb69e(0x16a)](_0x556d05=>getAppRule(_0x354026[_0x5eb69e(0x173)],{'appCode':_0x354026[_0x5eb69e(0x169)],'type':_0x556d05}))),_0x62f985=APP_RULE_TYPES['map']((_0x395988,_0x23ddd1)=>projectAppRule(_0x395988,_0x12875e[_0x23ddd1]??null));return{'ok':!![],'data':{'total':_0x62f985[_0x5eb69e(0x175)],'rules':_0x62f985},'message':_0x5eb69e(0x170)+_0x354026[_0x5eb69e(0x169)]};}};
1
+ function a242_0x27e6(_0x4ad9a4,_0x292acb){_0x4ad9a4=_0x4ad9a4-0x85;const _0x108bee=a242_0x108b();let _0x27e69d=_0x108bee[_0x4ad9a4];return _0x27e69d;}const a242_0x35ae16=a242_0x27e6;(function(_0x1c3453,_0x44a929){const _0x3dbbc7=a242_0x27e6,_0x1ab1bd=_0x1c3453();while(!![]){try{const _0x39cace=parseInt(_0x3dbbc7(0x92))/0x1*(parseInt(_0x3dbbc7(0x8a))/0x2)+-parseInt(_0x3dbbc7(0x91))/0x3*(-parseInt(_0x3dbbc7(0x86))/0x4)+-parseInt(_0x3dbbc7(0x87))/0x5+-parseInt(_0x3dbbc7(0x95))/0x6+-parseInt(_0x3dbbc7(0x94))/0x7*(-parseInt(_0x3dbbc7(0x8e))/0x8)+-parseInt(_0x3dbbc7(0x8b))/0x9+-parseInt(_0x3dbbc7(0x89))/0xa*(parseInt(_0x3dbbc7(0x8d))/0xb);if(_0x39cace===_0x44a929)break;else _0x1ab1bd['push'](_0x1ab1bd['shift']());}catch(_0x37718e){_0x1ab1bd['push'](_0x1ab1bd['shift']());}}}(a242_0x108b,0x3c209));import{getAppRule}from'../../core/api-client.js';function a242_0x108b(){const _0x1454db=['70TLoXDC','2802726nySlaR','cookie','647084ycFAeM','1245uVmKXG','map','30pTtkAB','68DkyWFV','649575ANSXnc','Loaded\x20app\x20rule\x20configuration\x20for\x20','105919omUHAp','355808rUkXWN','appCode','all','3CgvLHh','6123ggmqCx','rule'];a242_0x108b=function(){return _0x1454db;};return a242_0x108b();}import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':a242_0x35ae16(0x93),'command':'list','description':'List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','risk':'read','requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x33397c){const _0x20f7bf=a242_0x35ae16,_0x379f7e=await Promise[_0x20f7bf(0x90)](APP_RULE_TYPES['map'](_0x3c3e71=>getAppRule(_0x33397c[_0x20f7bf(0x85)],{'appCode':_0x33397c[_0x20f7bf(0x8f)],'type':_0x3c3e71}))),_0xad2e4d=APP_RULE_TYPES[_0x20f7bf(0x88)]((_0x68510e,_0xfea073)=>projectAppRule(_0x68510e,_0x379f7e[_0xfea073]??null));return{'ok':!![],'data':{'total':_0xad2e4d['length'],'rules':_0xad2e4d},'message':_0x20f7bf(0x8c)+_0x33397c[_0x20f7bf(0x8f)]};}};
@@ -1 +1 @@
1
- const a243_0xada9bc=a243_0x2601;function a243_0x1bae(){const _0x439b89=['number','write','Expected\x20','contentHash','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','Pass\x20a\x20UTF-8\x20Markdown\x20file.','rule','version','flag','\x20for\x20','expectedVersion','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','\x20--format\x20compress','app_rule_version_mismatch','412948OIahnK','--file\x20is\x20required.','/smartapi/knowledge-base/save','Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version','4543506bzLDSd','push','cookie','beforeRecord','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','str','isSafeInteger','app_rule_set_outcome_unknown','type','rules','before','content','POST','appCode','Set\x20','byteSize','4984QjBcua','input',';\x20current\x20version\x20is\x20','replacement','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','trim','set','533093meJvIz','verified','5736960jGisKx','defineProperty','file','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','3952SroWWz','12383RUBnpB','410nVjCtr','60YnLdQc','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','string','\x20version\x20changed\x20before\x20write.','1002ADPfWr','rabetbase\x20rule\x20get\x20--type\x20','cause','43768zetZkk','app_rule_expected_version_invalid','unconfigured'];a243_0x1bae=function(){return _0x439b89;};return a243_0x1bae();}(function(_0x22d2a7,_0x52bca5){const _0x17f47c=a243_0x2601,_0x5dec2d=_0x22d2a7();while(!![]){try{const _0x28f370=-parseInt(_0x17f47c(0x16f))/0x1+parseInt(_0x17f47c(0x183))/0x2*(-parseInt(_0x17f47c(0x197))/0x3)+-parseInt(_0x17f47c(0x15e))/0x4*(parseInt(_0x17f47c(0x192))/0x5)+parseInt(_0x17f47c(0x18c))/0x6+-parseInt(_0x17f47c(0x191))/0x7*(-parseInt(_0x17f47c(0x190))/0x8)+parseInt(_0x17f47c(0x173))/0x9+parseInt(_0x17f47c(0x193))/0xa*(parseInt(_0x17f47c(0x18a))/0xb);if(_0x28f370===_0x52bca5)break;else _0x5dec2d['push'](_0x5dec2d['shift']());}catch(_0xacb31e){_0x5dec2d['push'](_0x5dec2d['shift']());}}}(a243_0x1bae,0x75f42));import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';function a243_0x2601(_0x412ede,_0x2c3489){_0x412ede=_0x412ede-0x15d;const _0x1bae4d=a243_0x1bae();let _0x260110=_0x1bae4d[_0x412ede];return _0x260110;}const SAVE_PATH=a243_0xada9bc(0x171),NON_ATOMIC_WARNING='--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.';function readSetInput(_0x2772cd){const _0x12e1f6=a243_0xada9bc,_0x398bd3=readAppRuleType(_0x2772cd),_0x42953c=_0x2772cd[_0x12e1f6(0x178)](_0x12e1f6(0x18e))[_0x12e1f6(0x188)]();if(!_0x42953c)throw appRuleError('app_rule_file_required',_0x12e1f6(0x170),_0x12e1f6(0x166));const _0x8273c0=_0x2772cd[_0x12e1f6(0x169)]('expected-version');let _0x485e35;if(_0x8273c0!==undefined){_0x485e35=Number(_0x8273c0);if(!Number[_0x12e1f6(0x179)](_0x485e35)||_0x485e35<0x0)throw appRuleError(_0x12e1f6(0x15f),_0x12e1f6(0x194));}return{'type':_0x398bd3,'file':_0x42953c,'expectedVersion':_0x485e35};}async function prepareSet(_0x53d0e0){const _0x38ba87=a243_0xada9bc,_0x120463=readSetInput(_0x53d0e0),_0x1b067a=await readAppRuleFile(_0x120463[_0x38ba87(0x18e)]),_0x599fe7=await getAppRule(_0x53d0e0[_0x38ba87(0x175)],{'appCode':_0x53d0e0[_0x38ba87(0x180)],'type':_0x120463['type']});if(_0x120463[_0x38ba87(0x16b)]!==undefined&&_0x599fe7?.[_0x38ba87(0x168)]!==_0x120463[_0x38ba87(0x16b)])throw appRuleError(_0x38ba87(0x16e),appRuleFileName(_0x120463[_0x38ba87(0x17b)])+_0x38ba87(0x196),_0x38ba87(0x163)+_0x120463[_0x38ba87(0x16b)]+_0x38ba87(0x185)+(_0x599fe7?.[_0x38ba87(0x168)]??_0x38ba87(0x160))+_0x38ba87(0x187));return{'input':_0x120463,'replacement':_0x1b067a,'beforeRecord':_0x599fe7,'before':projectAppRule(_0x120463['type'],_0x599fe7),'planned':{'type':_0x120463[_0x38ba87(0x17b)],'fileName':appRuleFileName(_0x120463[_0x38ba87(0x17b)]),'contextScope':appRuleContextScope(_0x120463[_0x38ba87(0x17b)]),'enabled':!![],'appCode':_0x53d0e0[_0x38ba87(0x180)],'scope':_0x38ba87(0x17c),'contentByteSize':_0x1b067a[_0x38ba87(0x182)],'contentHash':_0x1b067a[_0x38ba87(0x164)]}};}function warningsFor(_0x4364a2){return _0x4364a2===undefined?[]:[NON_ATOMIC_WARNING];}export const ruleSet={'service':a243_0xada9bc(0x167),'command':'set','description':'Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','risk':a243_0xada9bc(0x162),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a243_0xada9bc(0x18e),'type':a243_0xada9bc(0x195),'required':!![],'description':'UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)'},{'name':'expected-version','type':a243_0xada9bc(0x161),'required':![],'description':a243_0xada9bc(0x172)}],async 'validate'(_0x12260b){readSetInput(_0x12260b);},async 'dryRun'(_0x1aa3a5){const _0x85bcf4=a243_0xada9bc,_0x1207ad=await prepareSet(_0x1aa3a5);return asDryRunResult({'operation':_0x85bcf4(0x189),'selector':{'appCode':_0x1aa3a5[_0x85bcf4(0x180)],'scope':_0x85bcf4(0x17c),'type':_0x1207ad[_0x85bcf4(0x184)]['type']},'before':_0x1207ad[_0x85bcf4(0x17d)],'after':_0x1207ad['planned'],'dryRun':!![],'backend':{'method':_0x85bcf4(0x17f),'path':SAVE_PATH},'warnings':warningsFor(_0x1207ad[_0x85bcf4(0x184)][_0x85bcf4(0x16b)]),'verification':{'expectedVersion':_0x1207ad[_0x85bcf4(0x184)][_0x85bcf4(0x16b)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x85bcf4(0x198)+_0x1207ad['input'][_0x85bcf4(0x17b)]+_0x85bcf4(0x16d)}},{'method':_0x85bcf4(0x17f),'url':SAVE_PATH});},async 'execute'(_0x404106){const _0x3704cd=a243_0xada9bc,_0x273114=await prepareSet(_0x404106);let _0x2ee331=![];try{await saveAppRule(_0x404106[_0x3704cd(0x175)],{'appCode':_0x404106[_0x3704cd(0x180)],'type':_0x273114[_0x3704cd(0x184)]['type'],'content':_0x273114['replacement'][_0x3704cd(0x17e)]});}catch(_0x42aa79){if(!isPlatformTransportFailure(_0x42aa79))throw _0x42aa79;_0x2ee331=!![];}let _0x2f9d12;try{_0x2f9d12=await getAppRule(_0x404106[_0x3704cd(0x175)],{'appCode':_0x404106[_0x3704cd(0x180)],'type':_0x273114[_0x3704cd(0x184)][_0x3704cd(0x17b)]});}catch(_0x4e2302){const _0x45c2cc=appRuleError(_0x2ee331?_0x3704cd(0x17a):'app_rule_verification_unavailable','The\x20set\x20request\x20was\x20sent,\x20but\x20'+appRuleFileName(_0x273114['input'][_0x3704cd(0x17b)])+'\x20could\x20not\x20be\x20verified.',_0x3704cd(0x16c));Object[_0x3704cd(0x18d)](_0x45c2cc,_0x3704cd(0x15d),{'value':_0x4e2302,'enumerable':![]});throw _0x45c2cc;}const _0x128312=_0x2f9d12&&inspectAppRuleContent(_0x2f9d12[_0x3704cd(0x17e)])[_0x3704cd(0x164)]===_0x273114[_0x3704cd(0x186)][_0x3704cd(0x164)],_0x2af342=_0x2f9d12&&(_0x273114[_0x3704cd(0x176)]===null||_0x2f9d12[_0x3704cd(0x168)]>_0x273114[_0x3704cd(0x176)][_0x3704cd(0x168)]);if(!_0x2f9d12||!_0x128312||!_0x2af342)throw appRuleError(_0x2ee331?_0x3704cd(0x17a):'app_rule_verification_failed',appRuleFileName(_0x273114[_0x3704cd(0x184)]['type'])+_0x3704cd(0x177),_0x3704cd(0x165)+_0x273114['input']['type']+'\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.');const _0x38af85=warningsFor(_0x273114[_0x3704cd(0x184)][_0x3704cd(0x16b)]);_0x2ee331&&_0x38af85[_0x3704cd(0x174)](_0x3704cd(0x18f));const _0x27aa73=projectAppRule(_0x273114['input']['type'],_0x2f9d12);return{'ok':!![],'data':{'operation':_0x3704cd(0x189),'selector':{'appCode':_0x404106['appCode'],'scope':_0x3704cd(0x17c),'type':_0x273114[_0x3704cd(0x184)][_0x3704cd(0x17b)]},'before':_0x273114['before'],'after':_0x27aa73,'dryRun':![],'backend':{'method':_0x3704cd(0x17f),'path':SAVE_PATH},'warnings':_0x38af85,'verification':{'status':_0x3704cd(0x18b),'recoveredAfterUnknownResponse':_0x2ee331,'expectedVersion':_0x273114[_0x3704cd(0x184)]['expectedVersion']??null,'atomicCompareAndSet':![],'lookupCommand':_0x3704cd(0x198)+_0x273114[_0x3704cd(0x184)]['type']+'\x20--format\x20compress'}},'message':_0x3704cd(0x181)+appRuleFileName(_0x273114[_0x3704cd(0x184)][_0x3704cd(0x17b)])+_0x3704cd(0x16a)+_0x404106[_0x3704cd(0x180)]};}};
1
+ const a243_0x103d70=a243_0x10a1;function a243_0x2ff3(){const _0x49e2ca=['app_rule_set_outcome_unknown','trim','file','Expected\x20','The\x20set\x20request\x20was\x20sent,\x20but\x20','input','app_rule_file_required','rules','appCode','Set\x20','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','\x20--format\x20compress','contentHash','6652TwhIlq','version','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','app_rule_expected_version_invalid','50Nbuqbn','app_rule_verification_unavailable','verified','540wDKcsf','2252761mpUMbE','app_rule_version_mismatch','5774700SDNnEa','app_rule_verification_failed','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','type','1815471QvUpFm','\x20version\x20changed\x20before\x20write.','byteSize','cookie','/smartapi/knowledge-base/save','\x20could\x20not\x20be\x20verified.','82vsdqNA','defineProperty','6HoVKXL','689634TsSvXW','UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)','flag','planned','16GmQINo','str','rule','expectedVersion','1824135nizcFu','content',';\x20current\x20version\x20is\x20','\x20for\x20','replacement','string','POST','set','rabetbase\x20rule\x20get\x20--type\x20','write','--file\x20is\x20required.','before','2110DkiFCj','expected-version','cause','beforeRecord','push'];a243_0x2ff3=function(){return _0x49e2ca;};return a243_0x2ff3();}(function(_0x3123a6,_0x1b3c1a){const _0x547e28=a243_0x10a1,_0x1b3015=_0x3123a6();while(!![]){try{const _0x29a4ed=parseInt(_0x547e28(0x8b))/0x1*(-parseInt(_0x547e28(0xa2))/0x2)+parseInt(_0x547e28(0x7e))/0x3*(-parseInt(_0x547e28(0xb4))/0x4)+parseInt(_0x547e28(0x96))/0x5+parseInt(_0x547e28(0x8d))/0x6*(-parseInt(_0x547e28(0x7f))/0x7)+parseInt(_0x547e28(0x92))/0x8*(parseInt(_0x547e28(0x85))/0x9)+parseInt(_0x547e28(0x7b))/0xa*(-parseInt(_0x547e28(0x8e))/0xb)+parseInt(_0x547e28(0x81))/0xc;if(_0x29a4ed===_0x1b3c1a)break;else _0x1b3015['push'](_0x1b3015['shift']());}catch(_0x56e5e9){_0x1b3015['push'](_0x1b3015['shift']());}}}(a243_0x2ff3,0x37bfb));import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';const SAVE_PATH=a243_0x103d70(0x89),NON_ATOMIC_WARNING='--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.';function readSetInput(_0x2f6609){const _0x1a596d=a243_0x103d70,_0x2b5e38=readAppRuleType(_0x2f6609),_0x5cad1d=_0x2f6609[_0x1a596d(0x93)]('file')[_0x1a596d(0xa8)]();if(!_0x5cad1d)throw appRuleError(_0x1a596d(0xad),_0x1a596d(0xa0),'Pass\x20a\x20UTF-8\x20Markdown\x20file.');const _0x2f2d71=_0x2f6609[_0x1a596d(0x90)](_0x1a596d(0xa3));let _0x1a6b21;if(_0x2f2d71!==undefined){_0x1a6b21=Number(_0x2f2d71);if(!Number['isSafeInteger'](_0x1a6b21)||_0x1a6b21<0x0)throw appRuleError(_0x1a596d(0x7a),_0x1a596d(0xb1));}return{'type':_0x2b5e38,'file':_0x5cad1d,'expectedVersion':_0x1a6b21};}async function prepareSet(_0xbe2b47){const _0x1208a1=a243_0x103d70,_0xcc0d87=readSetInput(_0xbe2b47),_0x46190e=await readAppRuleFile(_0xcc0d87[_0x1208a1(0xa9)]),_0x426f81=await getAppRule(_0xbe2b47['cookie'],{'appCode':_0xbe2b47[_0x1208a1(0xaf)],'type':_0xcc0d87[_0x1208a1(0x84)]});if(_0xcc0d87[_0x1208a1(0x95)]!==undefined&&_0x426f81?.[_0x1208a1(0xb5)]!==_0xcc0d87[_0x1208a1(0x95)])throw appRuleError(_0x1208a1(0x80),appRuleFileName(_0xcc0d87['type'])+_0x1208a1(0x86),_0x1208a1(0xaa)+_0xcc0d87[_0x1208a1(0x95)]+_0x1208a1(0x98)+(_0x426f81?.[_0x1208a1(0xb5)]??'unconfigured')+'.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.');return{'input':_0xcc0d87,'replacement':_0x46190e,'beforeRecord':_0x426f81,'before':projectAppRule(_0xcc0d87[_0x1208a1(0x84)],_0x426f81),'planned':{'type':_0xcc0d87[_0x1208a1(0x84)],'fileName':appRuleFileName(_0xcc0d87[_0x1208a1(0x84)]),'contextScope':appRuleContextScope(_0xcc0d87[_0x1208a1(0x84)]),'enabled':!![],'appCode':_0xbe2b47[_0x1208a1(0xaf)],'scope':'rules','contentByteSize':_0x46190e[_0x1208a1(0x87)],'contentHash':_0x46190e[_0x1208a1(0xb3)]}};}function warningsFor(_0x17ed88){return _0x17ed88===undefined?[]:[NON_ATOMIC_WARNING];}function a243_0x10a1(_0x3d0882,_0x1bb550){_0x3d0882=_0x3d0882-0x7a;const _0x2ff390=a243_0x2ff3();let _0x10a1d1=_0x2ff390[_0x3d0882];return _0x10a1d1;}export const ruleSet={'service':a243_0x103d70(0x94),'command':'set','description':a243_0x103d70(0x83),'risk':a243_0x103d70(0x9f),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a243_0x103d70(0xa9),'type':a243_0x103d70(0x9b),'required':!![],'description':a243_0x103d70(0x8f)},{'name':a243_0x103d70(0xa3),'type':'number','required':![],'description':'Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version'}],async 'validate'(_0x25d609){readSetInput(_0x25d609);},async 'dryRun'(_0x4ff095){const _0x5603d6=a243_0x103d70,_0x3c4f28=await prepareSet(_0x4ff095);return asDryRunResult({'operation':_0x5603d6(0x9d),'selector':{'appCode':_0x4ff095[_0x5603d6(0xaf)],'scope':_0x5603d6(0xae),'type':_0x3c4f28[_0x5603d6(0xac)][_0x5603d6(0x84)]},'before':_0x3c4f28[_0x5603d6(0xa1)],'after':_0x3c4f28[_0x5603d6(0x91)],'dryRun':!![],'backend':{'method':_0x5603d6(0x9c),'path':SAVE_PATH},'warnings':warningsFor(_0x3c4f28[_0x5603d6(0xac)][_0x5603d6(0x95)]),'verification':{'expectedVersion':_0x3c4f28[_0x5603d6(0xac)][_0x5603d6(0x95)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x5603d6(0x9e)+_0x3c4f28[_0x5603d6(0xac)][_0x5603d6(0x84)]+_0x5603d6(0xb2)}},{'method':_0x5603d6(0x9c),'url':SAVE_PATH});},async 'execute'(_0x596c47){const _0xd02c4b=a243_0x103d70,_0x3cdd23=await prepareSet(_0x596c47);let _0x484c74=![];try{await saveAppRule(_0x596c47['cookie'],{'appCode':_0x596c47['appCode'],'type':_0x3cdd23[_0xd02c4b(0xac)][_0xd02c4b(0x84)],'content':_0x3cdd23[_0xd02c4b(0x9a)][_0xd02c4b(0x97)]});}catch(_0x5dadb3){if(!isPlatformTransportFailure(_0x5dadb3))throw _0x5dadb3;_0x484c74=!![];}let _0x8922c2;try{_0x8922c2=await getAppRule(_0x596c47[_0xd02c4b(0x88)],{'appCode':_0x596c47[_0xd02c4b(0xaf)],'type':_0x3cdd23[_0xd02c4b(0xac)][_0xd02c4b(0x84)]});}catch(_0x56fcea){const _0xd96771=appRuleError(_0x484c74?'app_rule_set_outcome_unknown':_0xd02c4b(0x7c),_0xd02c4b(0xab)+appRuleFileName(_0x3cdd23['input']['type'])+_0xd02c4b(0x8a),'Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.');Object[_0xd02c4b(0x8c)](_0xd96771,_0xd02c4b(0xa4),{'value':_0x56fcea,'enumerable':![]});throw _0xd96771;}const _0x121dc5=_0x8922c2&&inspectAppRuleContent(_0x8922c2['content'])[_0xd02c4b(0xb3)]===_0x3cdd23[_0xd02c4b(0x9a)][_0xd02c4b(0xb3)],_0x37be4a=_0x8922c2&&(_0x3cdd23['beforeRecord']===null||_0x8922c2[_0xd02c4b(0xb5)]>_0x3cdd23[_0xd02c4b(0xa5)][_0xd02c4b(0xb5)]);if(!_0x8922c2||!_0x121dc5||!_0x37be4a)throw appRuleError(_0x484c74?_0xd02c4b(0xa7):_0xd02c4b(0x82),appRuleFileName(_0x3cdd23[_0xd02c4b(0xac)][_0xd02c4b(0x84)])+'\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20'+_0x3cdd23['input']['type']+_0xd02c4b(0xb6));const _0x32ed59=warningsFor(_0x3cdd23[_0xd02c4b(0xac)][_0xd02c4b(0x95)]);_0x484c74&&_0x32ed59[_0xd02c4b(0xa6)]('Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.');const _0x561b35=projectAppRule(_0x3cdd23['input'][_0xd02c4b(0x84)],_0x8922c2);return{'ok':!![],'data':{'operation':_0xd02c4b(0x9d),'selector':{'appCode':_0x596c47[_0xd02c4b(0xaf)],'scope':_0xd02c4b(0xae),'type':_0x3cdd23[_0xd02c4b(0xac)][_0xd02c4b(0x84)]},'before':_0x3cdd23['before'],'after':_0x561b35,'dryRun':![],'backend':{'method':'POST','path':SAVE_PATH},'warnings':_0x32ed59,'verification':{'status':_0xd02c4b(0x7d),'recoveredAfterUnknownResponse':_0x484c74,'expectedVersion':_0x3cdd23[_0xd02c4b(0xac)][_0xd02c4b(0x95)]??null,'atomicCompareAndSet':![],'lookupCommand':_0xd02c4b(0x9e)+_0x3cdd23[_0xd02c4b(0xac)][_0xd02c4b(0x84)]+_0xd02c4b(0xb2)}},'message':_0xd02c4b(0xb0)+appRuleFileName(_0x3cdd23[_0xd02c4b(0xac)][_0xd02c4b(0x84)])+_0xd02c4b(0x99)+_0x596c47[_0xd02c4b(0xaf)]};}};
@@ -1 +1 @@
1
- const a244_0x445382=a244_0x29b2;(function(_0x5a56dc,_0xe34643){const _0x1706be=a244_0x29b2,_0x48f065=_0x5a56dc();while(!![]){try{const _0x47ef84=parseInt(_0x1706be(0x183))/0x1+parseInt(_0x1706be(0x190))/0x2+-parseInt(_0x1706be(0x1a9))/0x3*(-parseInt(_0x1706be(0x196))/0x4)+parseInt(_0x1706be(0x19d))/0x5+parseInt(_0x1706be(0x19b))/0x6+parseInt(_0x1706be(0x197))/0x7*(parseInt(_0x1706be(0x199))/0x8)+-parseInt(_0x1706be(0x1a7))/0x9*(parseInt(_0x1706be(0x185))/0xa);if(_0x47ef84===_0xe34643)break;else _0x48f065['push'](_0x48f065['shift']());}catch(_0x49e033){_0x48f065['push'](_0x48f065['shift']());}}}(a244_0x39de,0x389be));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a244_0x445382(0x189),'database'];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a244_0x445382(0x1b0),'database':a244_0x445382(0x193)},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':a244_0x445382(0x19e)};export function appRuleError(_0x5b877b,_0x48e3b9,_0x4aeb25){return new CliError(_0x5b877b,0x1,_0x48e3b9,_0x4aeb25);}export function readAppRuleType(_0x4a68e8){const _0xe95eef=a244_0x445382,_0x20c2e8=_0x4a68e8['str'](_0xe95eef(0x18d))['trim']()['toLowerCase']();if(_0x20c2e8!=='rules'&&_0x20c2e8!==_0xe95eef(0x198))throw appRuleError(_0xe95eef(0x1a6),_0xe95eef(0x18b));return _0x20c2e8;}export function appRuleFileName(_0x590c49){return APP_RULE_FILES[_0x590c49];}export function appRuleContextScope(_0x4ef5aa){return APP_RULE_CONTEXT_SCOPES[_0x4ef5aa];}function a244_0x39de(){const _0x3d2790=['from','1143QhWcsb','decode','Pass\x20a\x20UTF-8\x20Markdown\x20file.','digest','appCode','sha256:','app_rule_content_invalid','RULES.md','message','byteLength','hex','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','contentHash','431057fQkeTD','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','40920BAhdzx','trim','sha256','isFile','rules','app_rule_file_unreadable','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','utf8','type','--file\x20is\x20required.','size','334190nVsdNr','App\x20rule\x20file\x20is\x20blank:\x20','Cannot\x20access\x20app\x20rule\x20file:\x20','DATABASE.md','updateTime','Cannot\x20read\x20app\x20rule\x20file:\x20','788PuzLWe','35ddachf','database','639096mLdGOY','app_rule_content_too_large','1494684zUFjDi','createTime','1159140gsUIZx','database-analysis','scope','app_rule_file_invalid','content','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','update','string','byteSize','app_rule_type_invalid','2907QVGUgy'];a244_0x39de=function(){return _0x3d2790;};return a244_0x39de();}export function inspectAppRuleContent(_0x3e661f){const _0x1ec3a8=a244_0x445382,_0x13900b=Buffer[_0x1ec3a8(0x1a8)](_0x3e661f,_0x1ec3a8(0x18c));return{'content':_0x3e661f,'byteSize':_0x13900b[_0x1ec3a8(0x1b2)],'contentHash':_0x1ec3a8(0x1ae)+createHash(_0x1ec3a8(0x187))[_0x1ec3a8(0x1a3)](_0x13900b)[_0x1ec3a8(0x1ac)](_0x1ec3a8(0x1b3))};}function a244_0x29b2(_0xd9e870,_0xb8806a){_0xd9e870=_0xd9e870-0x181;const _0x39de4a=a244_0x39de();let _0x29b2bd=_0x39de4a[_0xd9e870];return _0x29b2bd;}export async function readAppRuleFile(_0x241b02){const _0x1e66f1=a244_0x445382,_0x5920bb=_0x241b02[_0x1e66f1(0x186)]();if(!_0x5920bb)throw appRuleError('app_rule_file_required',_0x1e66f1(0x18e),_0x1e66f1(0x1ab));const _0x408053=resolve(_0x5920bb);let _0x27c457;try{_0x27c457=await stat(_0x408053);}catch(_0x43a8d1){throw appRuleError(_0x1e66f1(0x18a),_0x1e66f1(0x192)+_0x5920bb,_0x43a8d1 instanceof Error?_0x43a8d1[_0x1e66f1(0x1b1)]:String(_0x43a8d1));}if(!_0x27c457[_0x1e66f1(0x188)]())throw appRuleError(_0x1e66f1(0x1a0),_0x1e66f1(0x181)+_0x5920bb);if(_0x27c457[_0x1e66f1(0x18f)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x1e66f1(0x19a),_0x1e66f1(0x184));let _0xaf3d4a;try{_0xaf3d4a=await readFile(_0x408053);}catch(_0x143b21){throw appRuleError(_0x1e66f1(0x18a),_0x1e66f1(0x195)+_0x5920bb,_0x143b21 instanceof Error?_0x143b21[_0x1e66f1(0x1b1)]:String(_0x143b21));}if(_0xaf3d4a[_0x1e66f1(0x1b2)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x1e66f1(0x19a),_0x1e66f1(0x184));let _0x8346da;try{_0x8346da=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})[_0x1e66f1(0x1aa)](_0xaf3d4a);}catch{throw appRuleError(_0x1e66f1(0x1af),_0x1e66f1(0x1a2)+_0x5920bb);}if(!_0x8346da['trim']())throw appRuleError('app_rule_content_invalid',_0x1e66f1(0x191)+_0x5920bb);return inspectAppRuleContent(_0x8346da);}export function projectAppRule(_0x5ed4c3,_0x354771){const _0x33176a=a244_0x445382;if(!_0x354771)return{'type':_0x5ed4c3,'fileName':appRuleFileName(_0x5ed4c3),'contextScope':appRuleContextScope(_0x5ed4c3),'enabled':![]};const _0x56c3b6=inspectAppRuleContent(_0x354771[_0x33176a(0x1a1)]);return{'type':_0x5ed4c3,'fileName':appRuleFileName(_0x5ed4c3),'contextScope':appRuleContextScope(_0x5ed4c3),'enabled':!![],'id':_0x354771['id'],'scope':_0x354771[_0x33176a(0x19f)],'appCode':_0x354771[_0x33176a(0x1ad)],'version':_0x354771['version'],'contentByteSize':_0x56c3b6[_0x33176a(0x1a5)],'contentHash':_0x56c3b6[_0x33176a(0x182)],..._0x354771['createTime']!==undefined&&_0x354771['createTime']!==null?{'createTime':_0x354771[_0x33176a(0x19c)]}:{},..._0x354771[_0x33176a(0x194)]!==undefined&&_0x354771['updateTime']!==null?{'updateTime':_0x354771[_0x33176a(0x194)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x445382(0x18d),'type':a244_0x445382(0x1a4),'required':!![],'description':'Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','enum':[...APP_RULE_TYPES]};
1
+ const a244_0x269911=a244_0x2983;(function(_0x4163ae,_0x280032){const _0x969be7=a244_0x2983,_0x3d0d06=_0x4163ae();while(!![]){try{const _0x5d384a=-parseInt(_0x969be7(0x204))/0x1+parseInt(_0x969be7(0x223))/0x2*(-parseInt(_0x969be7(0x20f))/0x3)+parseInt(_0x969be7(0x216))/0x4+-parseInt(_0x969be7(0x203))/0x5*(-parseInt(_0x969be7(0x1fd))/0x6)+-parseInt(_0x969be7(0x217))/0x7*(parseInt(_0x969be7(0x1f5))/0x8)+parseInt(_0x969be7(0x1f3))/0x9+parseInt(_0x969be7(0x1ff))/0xa*(parseInt(_0x969be7(0x21e))/0xb);if(_0x5d384a===_0x280032)break;else _0x3d0d06['push'](_0x3d0d06['shift']());}catch(_0x44d821){_0x3d0d06['push'](_0x3d0d06['shift']());}}}(a244_0x2011,0xf1ae9));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a244_0x269911(0x1f4),a244_0x269911(0x211)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a244_0x269911(0x201),'database':a244_0x269911(0x209)},APP_RULE_CONTEXT_SCOPES={'rules':a244_0x269911(0x212),'database':'database-analysis'};export function appRuleError(_0x1c86d4,_0x3dccb5,_0x49e73d){return new CliError(_0x1c86d4,0x1,_0x3dccb5,_0x49e73d);}export function readAppRuleType(_0x473ee1){const _0x53a469=a244_0x269911,_0x480dc0=_0x473ee1[_0x53a469(0x21b)](_0x53a469(0x220))[_0x53a469(0x210)]()[_0x53a469(0x1fa)]();if(_0x480dc0!==_0x53a469(0x1f4)&&_0x480dc0!=='database')throw appRuleError(_0x53a469(0x20a),'--type\x20must\x20be\x20either\x20rules\x20or\x20database.');return _0x480dc0;}function a244_0x2983(_0x3c52b4,_0x27951d){_0x3c52b4=_0x3c52b4-0x1f2;const _0x2011fe=a244_0x2011();let _0x2983f6=_0x2011fe[_0x3c52b4];return _0x2983f6;}export function appRuleFileName(_0x32d411){return APP_RULE_FILES[_0x32d411];}export function appRuleContextScope(_0x2571b7){return APP_RULE_CONTEXT_SCOPES[_0x2571b7];}export function inspectAppRuleContent(_0x2f390a){const _0x32e196=a244_0x269911,_0x45c384=Buffer[_0x32e196(0x219)](_0x2f390a,'utf8');return{'content':_0x2f390a,'byteSize':_0x45c384[_0x32e196(0x1fe)],'contentHash':_0x32e196(0x205)+createHash(_0x32e196(0x1f9))[_0x32e196(0x21c)](_0x45c384)[_0x32e196(0x20c)](_0x32e196(0x1fc))};}export async function readAppRuleFile(_0x4c3905){const _0x45a91a=a244_0x269911,_0x111442=_0x4c3905[_0x45a91a(0x210)]();if(!_0x111442)throw appRuleError(_0x45a91a(0x1f7),_0x45a91a(0x1f2),_0x45a91a(0x1fb));const _0x5bb3ec=resolve(_0x111442);let _0x1a7a8c;try{_0x1a7a8c=await stat(_0x5bb3ec);}catch(_0x21f717){throw appRuleError(_0x45a91a(0x218),_0x45a91a(0x206)+_0x111442,_0x21f717 instanceof Error?_0x21f717[_0x45a91a(0x207)]:String(_0x21f717));}if(!_0x1a7a8c[_0x45a91a(0x214)]())throw appRuleError(_0x45a91a(0x21d),_0x45a91a(0x21a)+_0x111442);if(_0x1a7a8c['size']>MAX_APP_RULE_BYTES)throw appRuleError(_0x45a91a(0x1f6),_0x45a91a(0x208));let _0xbd5e6f;try{_0xbd5e6f=await readFile(_0x5bb3ec);}catch(_0x581357){throw appRuleError('app_rule_file_unreadable',_0x45a91a(0x213)+_0x111442,_0x581357 instanceof Error?_0x581357[_0x45a91a(0x207)]:String(_0x581357));}if(_0xbd5e6f[_0x45a91a(0x1fe)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x45a91a(0x1f6),'App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.');let _0x183cad;try{_0x183cad=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})[_0x45a91a(0x202)](_0xbd5e6f);}catch{throw appRuleError('app_rule_content_invalid',_0x45a91a(0x20d)+_0x111442);}if(!_0x183cad[_0x45a91a(0x210)]())throw appRuleError(_0x45a91a(0x221),_0x45a91a(0x1f8)+_0x111442);return inspectAppRuleContent(_0x183cad);}function a244_0x2011(){const _0x3bb42d=['app_rule_content_too_large','app_rule_file_required','App\x20rule\x20file\x20is\x20blank:\x20','sha256','toLowerCase','Pass\x20a\x20UTF-8\x20Markdown\x20file.','hex','408FCszRM','byteLength','2350ulbOBk','content','RULES.md','decode','104700VDiWnD','201436fBiiHt','sha256:','Cannot\x20access\x20app\x20rule\x20file:\x20','message','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','DATABASE.md','app_rule_type_invalid','appCode','digest','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','createTime','173721bZshJP','trim','database','page-api-development','Cannot\x20read\x20app\x20rule\x20file:\x20','isFile','string','2034276WLoNTN','14WZFQgS','app_rule_file_unreadable','from','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','str','update','app_rule_file_invalid','84469zZanBA','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','type','app_rule_content_invalid','updateTime','60AWCsbT','--file\x20is\x20required.','7973901VmMZNl','rules','6777872vNhCie'];a244_0x2011=function(){return _0x3bb42d;};return a244_0x2011();}export function projectAppRule(_0x34deaa,_0x34bf4d){const _0x59f380=a244_0x269911;if(!_0x34bf4d)return{'type':_0x34deaa,'fileName':appRuleFileName(_0x34deaa),'contextScope':appRuleContextScope(_0x34deaa),'enabled':![]};const _0x5ce4ee=inspectAppRuleContent(_0x34bf4d[_0x59f380(0x200)]);return{'type':_0x34deaa,'fileName':appRuleFileName(_0x34deaa),'contextScope':appRuleContextScope(_0x34deaa),'enabled':!![],'id':_0x34bf4d['id'],'scope':_0x34bf4d['scope'],'appCode':_0x34bf4d[_0x59f380(0x20b)],'version':_0x34bf4d['version'],'contentByteSize':_0x5ce4ee['byteSize'],'contentHash':_0x5ce4ee['contentHash'],..._0x34bf4d[_0x59f380(0x20e)]!==undefined&&_0x34bf4d[_0x59f380(0x20e)]!==null?{'createTime':_0x34bf4d[_0x59f380(0x20e)]}:{},..._0x34bf4d[_0x59f380(0x222)]!==undefined&&_0x34bf4d['updateTime']!==null?{'updateTime':_0x34bf4d[_0x59f380(0x222)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x269911(0x220),'type':a244_0x269911(0x215),'required':!![],'description':a244_0x269911(0x21f),'enum':[...APP_RULE_TYPES]};
@@ -1 +1 @@
1
- const a245_0x3bd918=a245_0x2bae;(function(_0x24841f,_0x1a6e56){const _0x5666de=a245_0x2bae,_0x348925=_0x24841f();while(!![]){try{const _0x2d83df=parseInt(_0x5666de(0x140))/0x1*(parseInt(_0x5666de(0x13b))/0x2)+parseInt(_0x5666de(0x114))/0x3+-parseInt(_0x5666de(0x13d))/0x4+-parseInt(_0x5666de(0x11d))/0x5*(parseInt(_0x5666de(0x109))/0x6)+-parseInt(_0x5666de(0x10c))/0x7+parseInt(_0x5666de(0x146))/0x8*(parseInt(_0x5666de(0x131))/0x9)+parseInt(_0x5666de(0x134))/0xa;if(_0x2d83df===_0x1a6e56)break;else _0x348925['push'](_0x348925['shift']());}catch(_0x512551){_0x348925['push'](_0x348925['shift']());}}}(a245_0x32c0,0x3613f));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a245_0x3bd918(0x10e),a245_0x3bd918(0x11e)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set(['start',a245_0x3bd918(0x11e),a245_0x3bd918(0x149),a245_0x3bd918(0x126)]);export function syncProjectDomainRoutingBeforeScript(_0x188f55,_0x270e27){const _0x36e918=a245_0x3bd918;if(!DOMAIN_ROUTING_SYNC_SCRIPTS['has'](_0x270e27))return null;const _0x59e9b6=findProjectRootDirectory(_0x188f55);if(!resolveConfigPath(_0x59e9b6))return null;const _0x5b77d0=writeProjectDomainRoutingManifest(_0x59e9b6);return{'path':_0x5b77d0[_0x36e918(0x10a)],'changed':_0x5b77d0['changed']};}function readPackageScripts(_0x4e37c6){const _0x5a865b=a245_0x3bd918,_0x5a9acb=resolve(_0x4e37c6,_0x5a865b(0x133));if(!existsSync(_0x5a9acb))return null;try{const _0x44f533=JSON[_0x5a865b(0x115)](readFileSync(_0x5a9acb,_0x5a865b(0x120)));return _0x44f533['scripts']??{};}catch{return null;}}function detectPackageManager(_0x5a4cf7){const _0x398350=a245_0x3bd918;if(existsSync(resolve(_0x5a4cf7,_0x398350(0x136)))||existsSync(resolve(_0x5a4cf7,'bun.lock')))return _0x398350(0x13a);if(existsSync(resolve(_0x5a4cf7,_0x398350(0x12a))))return _0x398350(0x128);if(existsSync(resolve(_0x5a4cf7,'yarn.lock')))return'yarn';return _0x398350(0x130);}function a245_0x32c0(){const _0x2f0600=['bun.lockb','run','--watch','Domain\x20routing\x20synchronized:\x20','bun','2AdSqzb','Script\x20name\x20defined\x20in\x20package.json','516156ORPKda','error','\x20run\x20preview\x20--watch','137033mJxRjV','watch','Script\x20\x22','args','\x20run\x20start','close','48miLOvG','\x20run\x20','\x0a\x20\x20Usage:\x20','build','10902cvRmHN','path','\x20exited\x20with\x20code\x20','2038778GiqbaH','push','start','belowMinimum','\x22\x20not\x20found\x20in\x20package.json.','\x0a\x20\x20Available\x20scripts:\x0a','No\x20package.json\x20found\x20in\x20current\x20directory.','script','398862jVLnfE','parse','vite\x20preview\x20exited\x20with\x20code\x20','needsUpgrade','changed','\x20\x20EXAMPLES','Run\x20a\x20package.json\x20script','Available:\x20','\x20run\x20build','965bBhMtL','dev','\x20run\x20preview','utf-8','log','inherit','has','No\x20scripts\x20defined\x20in\x20package.json.','\x20\x20\x20\x20','preview','join','pnpm','slice','pnpm-lock.yaml','all','keys','node_modules','vite','validation','npm','627957XRCZoF','\x20run\x20<script>\x0a','package.json','3038520BWGEqM','vite\x20build\x20--watch\x20exited\x20with\x20code\x20'];a245_0x32c0=function(){return _0x2f0600;};return a245_0x32c0();}async function versionCheck(_0x53980f){const _0x1c9348=a245_0x3bd918,_0x5538b8=await checkCliVersion();(_0x5538b8[_0x1c9348(0x117)]||_0x5538b8[_0x1c9348(0x10f)])&&(printCliUpgradeWarning(_0x5538b8),assertCliVersionSupported(_0x5538b8));const _0x4360cb=await checkSdkVersion(_0x53980f);if(_0x4360cb[_0x1c9348(0x117)])printSdkUpgradeWarning(_0x4360cb);}function a245_0x2bae(_0x165529,_0x3e9084){_0x165529=_0x165529-0x109;const _0x32c08=a245_0x32c0();let _0x2baeda=_0x32c08[_0x165529];return _0x2baeda;}function spawnScript(_0x5a0080,_0x35f376,_0x429d9e,_0x327cde){return new Promise((_0x293f60,_0x3c9720)=>{const _0x4b3ee6=a245_0x2bae,_0x2fee5f=[_0x4b3ee6(0x137),_0x35f376,..._0x429d9e],_0x362f95=spawn(_0x5a0080,_0x2fee5f,{'cwd':_0x327cde,'stdio':_0x4b3ee6(0x122),'shell':!![],'env':{...process.env,'PATH':''+join(_0x327cde,_0x4b3ee6(0x12d),'.bin')+delimiter+process.env.PATH}});_0x362f95['on'](_0x4b3ee6(0x145),_0x500da7=>{const _0x457aa5=_0x4b3ee6;if(_0x500da7===0x0||_0x500da7===null)_0x293f60();else _0x3c9720(new Error(_0x5a0080+_0x457aa5(0x147)+_0x35f376+_0x457aa5(0x10b)+_0x500da7));}),_0x362f95['on'](_0x4b3ee6(0x13e),_0x3c9720);});}function spawnViteBuildWatch(_0x4ac8a5){return new Promise((_0x29077f,_0xa83967)=>{const _0x1a5633=a245_0x2bae,_0x404a8a=spawn(_0x1a5633(0x12e),['build',_0x1a5633(0x138)],{'cwd':_0x4ac8a5,'stdio':_0x1a5633(0x122),'shell':!![],'env':{...process.env,'PATH':''+join(_0x4ac8a5,'node_modules','.bin')+delimiter+process.env.PATH}});_0x404a8a['on'](_0x1a5633(0x145),_0x1813fc=>{const _0x2fad92=_0x1a5633;if(_0x1813fc===0x0||_0x1813fc===null)_0x29077f();else _0xa83967(new Error(_0x2fad92(0x135)+_0x1813fc));}),_0x404a8a['on'](_0x1a5633(0x13e),_0xa83967);});}function spawnVitePreview(_0x4b70d3){return new Promise((_0x5ba26b,_0x3a7ea9)=>{const _0x560eb3=a245_0x2bae,_0x6e2634=spawn(_0x560eb3(0x12e),[_0x560eb3(0x126)],{'cwd':_0x4b70d3,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x4b70d3,_0x560eb3(0x12d),'.bin')+delimiter+process.env.PATH}});_0x6e2634['on']('close',_0x217dc3=>{const _0xa66bad=_0x560eb3;if(_0x217dc3===0x0||_0x217dc3===null)_0x5ba26b();else _0x3a7ea9(new Error(_0xa66bad(0x116)+_0x217dc3));}),_0x6e2634['on'](_0x560eb3(0x13e),_0x3a7ea9);});}const runFlags=[{'name':a245_0x3bd918(0x141),'type':'boolean','description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':'run','command':'run','description':a245_0x3bd918(0x11a),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a245_0x3bd918(0x113),'description':a245_0x3bd918(0x13c),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x1e5471=a245_0x3bd918,_0x14e726=[];return _0x14e726[_0x1e5471(0x10d)](_0x1e5471(0x119)),_0x14e726['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x1e5471(0x144)),_0x14e726[_0x1e5471(0x10d)](_0x1e5471(0x125)+CLI_BIN_NAME+_0x1e5471(0x11c)),_0x14e726[_0x1e5471(0x10d)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x1e5471(0x11f)),_0x14e726['push'](_0x1e5471(0x125)+CLI_BIN_NAME+_0x1e5471(0x13f)),_0x14e726[_0x1e5471(0x127)]('\x0a');},async 'execute'(_0x13ad01){const _0x59723b=a245_0x3bd918,_0x37c66a=process['cwd'](),_0x434d68=_0x13ad01[_0x59723b(0x143)][0x0],_0x254458=_0x13ad01['args'][_0x59723b(0x129)](0x1),_0x60482c=readPackageScripts(_0x37c66a);if(!_0x60482c)throw CliErrors[_0x59723b(0x12f)](_0x59723b(0x112));if(!_0x434d68){const _0x4004d2=Object[_0x59723b(0x12c)](_0x60482c);if(_0x4004d2['length']===0x0)console[_0x59723b(0x121)](_0x59723b(0x124));else{console[_0x59723b(0x121)](_0x59723b(0x111));for(const _0x49a773 of _0x4004d2){console['log'](_0x59723b(0x125)+_0x49a773);}console['log'](_0x59723b(0x148)+CLI_BIN_NAME+_0x59723b(0x132));}return{'ok':!![]};}if(!_0x60482c[_0x434d68])throw CliErrors['validation'](_0x59723b(0x142)+_0x434d68+_0x59723b(0x110),_0x59723b(0x11b)+(Object[_0x59723b(0x12c)](_0x60482c)[_0x59723b(0x127)](',\x20')||'(none)'));const _0x28babe=detectPackageManager(_0x37c66a),_0x437d0d=syncProjectDomainRoutingBeforeScript(_0x37c66a,_0x434d68);_0x437d0d?.[_0x59723b(0x118)]&&console[_0x59723b(0x13e)](_0x59723b(0x139)+_0x437d0d[_0x59723b(0x10a)]);VERSION_CHECK_SCRIPTS[_0x59723b(0x123)](_0x434d68)&&await versionCheck(_0x37c66a);if(_0x434d68==='preview'&&_0x13ad01['bool'](_0x59723b(0x141)))return await Promise[_0x59723b(0x12b)]([spawnViteBuildWatch(_0x37c66a),spawnVitePreview(_0x37c66a)]),{'ok':!![]};return await spawnScript(_0x28babe,_0x434d68,_0x254458,_0x37c66a),{'ok':!![]};}};
1
+ const a245_0xb41bcc=a245_0x1b1f;(function(_0x1e7ca3,_0x2f4237){const _0x29c44e=a245_0x1b1f,_0x881c14=_0x1e7ca3();while(!![]){try{const _0x277719=parseInt(_0x29c44e(0xd3))/0x1*(-parseInt(_0x29c44e(0xd1))/0x2)+-parseInt(_0x29c44e(0xbf))/0x3+-parseInt(_0x29c44e(0xbc))/0x4+parseInt(_0x29c44e(0xc8))/0x5*(-parseInt(_0x29c44e(0xbd))/0x6)+-parseInt(_0x29c44e(0xb5))/0x7+-parseInt(_0x29c44e(0xe4))/0x8*(-parseInt(_0x29c44e(0xe0))/0x9)+parseInt(_0x29c44e(0xd4))/0xa;if(_0x277719===_0x2f4237)break;else _0x881c14['push'](_0x881c14['shift']());}catch(_0x3c3881){_0x881c14['push'](_0x881c14['shift']());}}}(a245_0x513d,0x802ce));import{readFileSync,existsSync}from'node:fs';function a245_0x513d(){const _0x28a909=['node_modules','Available:\x20','\x20run\x20preview','push','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','build','\x20exited\x20with\x20code\x20','278975PFxnuC','.bin','Script\x20\x22','--watch','args','(none)','npm','Enable\x20watch\x20mode\x20for\x20preview','run','382NChHTN','dev','3317oKJmpy','33887780UbzgFG','pnpm-lock.yaml','\x20run\x20preview\x20--watch','vite\x20preview\x20exited\x20with\x20code\x20','yarn','No\x20package.json\x20found\x20in\x20current\x20directory.','error','belowMinimum','\x20\x20EXAMPLES','parse','watch','start','91980UttqOX','bun.lockb','has','Script\x20name\x20defined\x20in\x20package.json','720wVMeJQ','all','utf-8','No\x20scripts\x20defined\x20in\x20package.json.','validation','Run\x20a\x20package.json\x20script','package.json','preview','cwd','join','scripts','script','close','Domain\x20routing\x20synchronized:\x20','\x20\x20\x20\x20','length','6738928ESDtMX','changed','\x0a\x20\x20Available\x20scripts:\x0a','needsUpgrade','log','vite','inherit','3462084ZTnPTY','54FUOQcK','\x20run\x20build','2458935yseBli','path'];a245_0x513d=function(){return _0x28a909;};return a245_0x513d();}import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';function a245_0x1b1f(_0x353a6c,_0x31bdc5){_0x353a6c=_0x353a6c-0xa6;const _0x513d76=a245_0x513d();let _0x1b1f2b=_0x513d76[_0x353a6c];return _0x1b1f2b;}import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a245_0xb41bcc(0xdf),a245_0xb41bcc(0xd2)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a245_0xb41bcc(0xdf),a245_0xb41bcc(0xd2),a245_0xb41bcc(0xc6),'preview']);export function syncProjectDomainRoutingBeforeScript(_0x2c881a,_0x2c8265){const _0x33e830=a245_0xb41bcc;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x33e830(0xe2)](_0x2c8265))return null;const _0xf9eea2=findProjectRootDirectory(_0x2c881a);if(!resolveConfigPath(_0xf9eea2))return null;const _0x5d7fe9=writeProjectDomainRoutingManifest(_0xf9eea2);return{'path':_0x5d7fe9[_0x33e830(0xc0)],'changed':_0x5d7fe9[_0x33e830(0xb6)]};}function readPackageScripts(_0x4a03a5){const _0x1820de=a245_0xb41bcc,_0x169c30=resolve(_0x4a03a5,_0x1820de(0xab));if(!existsSync(_0x169c30))return null;try{const _0xd129af=JSON[_0x1820de(0xdd)](readFileSync(_0x169c30,_0x1820de(0xa7)));return _0xd129af[_0x1820de(0xaf)]??{};}catch{return null;}}function detectPackageManager(_0xd801a5){const _0x52757f=a245_0xb41bcc;if(existsSync(resolve(_0xd801a5,_0x52757f(0xe1)))||existsSync(resolve(_0xd801a5,'bun.lock')))return'bun';if(existsSync(resolve(_0xd801a5,_0x52757f(0xd5))))return'pnpm';if(existsSync(resolve(_0xd801a5,'yarn.lock')))return _0x52757f(0xd8);return _0x52757f(0xce);}async function versionCheck(_0x2c9f59){const _0x2f39bd=a245_0xb41bcc,_0x19e66a=await checkCliVersion();(_0x19e66a['needsUpgrade']||_0x19e66a[_0x2f39bd(0xdb)])&&(printCliUpgradeWarning(_0x19e66a),assertCliVersionSupported(_0x19e66a));const _0x36edf0=await checkSdkVersion(_0x2c9f59);if(_0x36edf0[_0x2f39bd(0xb8)])printSdkUpgradeWarning(_0x36edf0);}function spawnScript(_0x2ffca6,_0x2a5fe1,_0x4fcc36,_0x5a52d6){return new Promise((_0x3a3aa3,_0x52e9cd)=>{const _0x1d2a6a=a245_0x1b1f,_0x1887af=[_0x1d2a6a(0xd0),_0x2a5fe1,..._0x4fcc36],_0x48b756=spawn(_0x2ffca6,_0x1887af,{'cwd':_0x5a52d6,'stdio':_0x1d2a6a(0xbb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x5a52d6,_0x1d2a6a(0xc1),'.bin')+delimiter+process.env.PATH}});_0x48b756['on'](_0x1d2a6a(0xb1),_0x16174f=>{const _0x202be3=_0x1d2a6a;if(_0x16174f===0x0||_0x16174f===null)_0x3a3aa3();else _0x52e9cd(new Error(_0x2ffca6+'\x20run\x20'+_0x2a5fe1+_0x202be3(0xc7)+_0x16174f));}),_0x48b756['on'](_0x1d2a6a(0xda),_0x52e9cd);});}function spawnViteBuildWatch(_0x1e37ac){return new Promise((_0x210ed6,_0x16b194)=>{const _0x4638af=a245_0x1b1f,_0x205e36=spawn(_0x4638af(0xba),[_0x4638af(0xc6),_0x4638af(0xcb)],{'cwd':_0x1e37ac,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x1e37ac,_0x4638af(0xc1),_0x4638af(0xc9))+delimiter+process.env.PATH}});_0x205e36['on'](_0x4638af(0xb1),_0x4d4ed9=>{const _0x147c4b=_0x4638af;if(_0x4d4ed9===0x0||_0x4d4ed9===null)_0x210ed6();else _0x16b194(new Error(_0x147c4b(0xc5)+_0x4d4ed9));}),_0x205e36['on'](_0x4638af(0xda),_0x16b194);});}function spawnVitePreview(_0xd2ca67){return new Promise((_0x28d0b3,_0x5dbc5d)=>{const _0x58c94b=a245_0x1b1f,_0x11670b=spawn(_0x58c94b(0xba),['preview'],{'cwd':_0xd2ca67,'stdio':_0x58c94b(0xbb),'shell':!![],'env':{...process.env,'PATH':''+join(_0xd2ca67,_0x58c94b(0xc1),_0x58c94b(0xc9))+delimiter+process.env.PATH}});_0x11670b['on']('close',_0x12ff18=>{const _0x4824ed=_0x58c94b;if(_0x12ff18===0x0||_0x12ff18===null)_0x28d0b3();else _0x5dbc5d(new Error(_0x4824ed(0xd7)+_0x12ff18));}),_0x11670b['on']('error',_0x5dbc5d);});}const runFlags=[{'name':a245_0xb41bcc(0xde),'type':'boolean','description':a245_0xb41bcc(0xcf),'default':![]}];export const runDefinition={'service':'run','command':a245_0xb41bcc(0xd0),'description':a245_0xb41bcc(0xaa),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a245_0xb41bcc(0xb0),'description':a245_0xb41bcc(0xe3),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x34681f=a245_0xb41bcc,_0x2623d3=[];return _0x2623d3[_0x34681f(0xc4)](_0x34681f(0xdc)),_0x2623d3[_0x34681f(0xc4)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20start'),_0x2623d3[_0x34681f(0xc4)](_0x34681f(0xb3)+CLI_BIN_NAME+_0x34681f(0xbe)),_0x2623d3['push'](_0x34681f(0xb3)+CLI_BIN_NAME+_0x34681f(0xc3)),_0x2623d3[_0x34681f(0xc4)](_0x34681f(0xb3)+CLI_BIN_NAME+_0x34681f(0xd6)),_0x2623d3[_0x34681f(0xae)]('\x0a');},async 'execute'(_0x11ec05){const _0x52b515=a245_0xb41bcc,_0x7c0097=process[_0x52b515(0xad)](),_0x262b00=_0x11ec05[_0x52b515(0xcc)][0x0],_0x3bac64=_0x11ec05['args']['slice'](0x1),_0x5eb49e=readPackageScripts(_0x7c0097);if(!_0x5eb49e)throw CliErrors[_0x52b515(0xa9)](_0x52b515(0xd9));if(!_0x262b00){const _0x10669a=Object['keys'](_0x5eb49e);if(_0x10669a[_0x52b515(0xb4)]===0x0)console['log'](_0x52b515(0xa8));else{console[_0x52b515(0xb9)](_0x52b515(0xb7));for(const _0x55db15 of _0x10669a){console['log'](_0x52b515(0xb3)+_0x55db15);}console['log']('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x5eb49e[_0x262b00])throw CliErrors[_0x52b515(0xa9)](_0x52b515(0xca)+_0x262b00+'\x22\x20not\x20found\x20in\x20package.json.',_0x52b515(0xc2)+(Object['keys'](_0x5eb49e)['join'](',\x20')||_0x52b515(0xcd)));const _0xfec3ae=detectPackageManager(_0x7c0097),_0x13db2b=syncProjectDomainRoutingBeforeScript(_0x7c0097,_0x262b00);_0x13db2b?.[_0x52b515(0xb6)]&&console[_0x52b515(0xda)](_0x52b515(0xb2)+_0x13db2b[_0x52b515(0xc0)]);VERSION_CHECK_SCRIPTS[_0x52b515(0xe2)](_0x262b00)&&await versionCheck(_0x7c0097);if(_0x262b00===_0x52b515(0xac)&&_0x11ec05['bool'](_0x52b515(0xde)))return await Promise[_0x52b515(0xa6)]([spawnViteBuildWatch(_0x7c0097),spawnVitePreview(_0x7c0097)]),{'ok':!![]};return await spawnScript(_0xfec3ae,_0x262b00,_0x3bac64,_0x7c0097),{'ok':!![]};}};
@@ -1 +1 @@
1
- function a246_0x5029(){const _0x3645c7=['20221900KqFFhR','read','6rZNgTQ','99985uZJvTP','867944RBbACt','188ICqjMJ','export','schema','821668ysPuRS','3314794IkCvFD','9iYrWlc','1247118mEmpVU','11DHqRaS','Export\x20machine-readable\x20command\x20schema\x20(JSON)','304311qLeuYN'];a246_0x5029=function(){return _0x3645c7;};return a246_0x5029();}const a246_0x42a19a=a246_0x2c8f;function a246_0x2c8f(_0x581af6,_0x375f75){_0x581af6=_0x581af6-0x70;const _0x502997=a246_0x5029();let _0x2c8ff2=_0x502997[_0x581af6];return _0x2c8ff2;}(function(_0x843805,_0x57cca9){const _0x23692c=a246_0x2c8f,_0x3dca10=_0x843805();while(!![]){try{const _0x3b6407=parseInt(_0x23692c(0x73))/0x1+-parseInt(_0x23692c(0x7c))/0x2*(parseInt(_0x23692c(0x76))/0x3)+-parseInt(_0x23692c(0x79))/0x4*(parseInt(_0x23692c(0x77))/0x5)+-parseInt(_0x23692c(0x70))/0x6+parseInt(_0x23692c(0x7d))/0x7+-parseInt(_0x23692c(0x78))/0x8*(parseInt(_0x23692c(0x7e))/0x9)+-parseInt(_0x23692c(0x74))/0xa*(-parseInt(_0x23692c(0x71))/0xb);if(_0x3b6407===_0x57cca9)break;else _0x3dca10['push'](_0x3dca10['shift']());}catch(_0x5dc12a){_0x3dca10['push'](_0x3dca10['shift']());}}}(a246_0x5029,0xb04fa));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x4fbfc8){const _0x2fafab=await buildSchemaPayload();return{'ok':!![],'data':_0x2fafab};}export const schemaDefinition={'service':a246_0x42a19a(0x7b),'command':a246_0x42a19a(0x7a),'description':a246_0x42a19a(0x72),'risk':a246_0x42a19a(0x75),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
1
+ function a246_0x352b(_0x3c4d31,_0x4e49be){_0x3c4d31=_0x3c4d31-0x1d4;const _0x71d2d0=a246_0x71d2();let _0x352b3c=_0x71d2d0[_0x3c4d31];return _0x352b3c;}const a246_0x5cee64=a246_0x352b;(function(_0x3ea9eb,_0x41a98d){const _0x5a123f=a246_0x352b,_0x5b55b0=_0x3ea9eb();while(!![]){try{const _0x23cd25=-parseInt(_0x5a123f(0x1d6))/0x1+parseInt(_0x5a123f(0x1de))/0x2*(parseInt(_0x5a123f(0x1d9))/0x3)+-parseInt(_0x5a123f(0x1d5))/0x4*(parseInt(_0x5a123f(0x1d8))/0x5)+parseInt(_0x5a123f(0x1e2))/0x6+-parseInt(_0x5a123f(0x1dc))/0x7*(-parseInt(_0x5a123f(0x1d7))/0x8)+parseInt(_0x5a123f(0x1e0))/0x9+-parseInt(_0x5a123f(0x1e1))/0xa*(parseInt(_0x5a123f(0x1db))/0xb);if(_0x23cd25===_0x41a98d)break;else _0x5b55b0['push'](_0x5b55b0['shift']());}catch(_0x4bfdf2){_0x5b55b0['push'](_0x5b55b0['shift']());}}}(a246_0x71d2,0x92748));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x6b7de9){const _0x5c6e96=await buildSchemaPayload();return{'ok':!![],'data':_0x5c6e96};}export const schemaDefinition={'service':a246_0x5cee64(0x1df),'command':a246_0x5cee64(0x1da),'description':a246_0x5cee64(0x1d4),'risk':a246_0x5cee64(0x1dd),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};function a246_0x71d2(){const _0x55a4e3=['export','22WimeKm','3472VdXdLB','read','30cZmjGi','schema','8242938IxWQiM','8122920LgyGAc','4281846ZQAxLg','Export\x20machine-readable\x20command\x20schema\x20(JSON)','232GkUmpa','1005401OkRUzG','10432dUymCy','8795BzOtjJ','211116KJdCKh'];a246_0x71d2=function(){return _0x55a4e3;};return a246_0x71d2();}
@@ -1 +1 @@
1
- const a247_0x4f9cfe=a247_0x3960;(function(_0x223618,_0x47d4f4){const _0x59d42d=a247_0x3960,_0x51f883=_0x223618();while(!![]){try{const _0x2c29a5=-parseInt(_0x59d42d(0xa3))/0x1*(parseInt(_0x59d42d(0x79))/0x2)+-parseInt(_0x59d42d(0x8e))/0x3*(parseInt(_0x59d42d(0x85))/0x4)+-parseInt(_0x59d42d(0xb6))/0x5+parseInt(_0x59d42d(0xb1))/0x6+-parseInt(_0x59d42d(0x88))/0x7*(parseInt(_0x59d42d(0x8f))/0x8)+parseInt(_0x59d42d(0x80))/0x9*(parseInt(_0x59d42d(0x8a))/0xa)+parseInt(_0x59d42d(0x93))/0xb;if(_0x2c29a5===_0x47d4f4)break;else _0x51f883['push'](_0x51f883['shift']());}catch(_0x3c4725){_0x51f883['push'](_0x51f883['shift']());}}}(a247_0x5d99,0xa0d98));import{writeFile}from'node:fs/promises';function a247_0x5d99(){const _0x1e0355=['db-id','lockFilePath','validation','isFinite','Local\x20SQL\x20file\x20mode','sql','7271fdCLJF','create','toISOString','SELECT\x201\x20AS\x20id;','number','MyBatis\x20XML\x20(mybatisXml)','<server-generated-sqlCode>','dbName','File\x20already\x20exists:\x20','__manual__','flag','sqlRootDir','name','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','2596632zFpuLO','dbId','Target\x20database\x20ID','parse','sqlName','1708670ojChNs','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlCode','dbId\x20cannot\x20be\x20empty','lastSync','222EcYvvp','trim','isInteger','</select>','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','new','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','37953zxqgHX','str','catch','flagMissing','string','1096yvRsTf','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','Select\x20the\x20local\x20SQL\x20mode:','7YkWblg','SQL\x20name:','2830BbPbii','nonInteractive','mybatisXml','length','2067GfVrpx','2179344KMYeSG','sqlRoot','Select\x20the\x20target\x20database:','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','7069436hOioVh','Created\x20SQL\x20query\x20','write','sqls','appCode','mode','join','description','SQL\x20query\x20display\x20name','POST'];a247_0x5d99=function(){return _0x1e0355;};return a247_0x5d99();}import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x34e9a9){const _0x35b590=a247_0x3960;if(_0x34e9a9===_0x35b590(0x8c))return[_0x35b590(0xb0),'\x20\x20SELECT\x201\x20AS\x20id',_0x35b590(0x7c),''][_0x35b590(0x99)]('\x0a');return[_0x35b590(0xa6),''][_0x35b590(0x99)]('\x0a');}export const sqlCreate={'service':a247_0x4f9cfe(0xa2),'command':a247_0x4f9cfe(0xa4),'description':a247_0x4f9cfe(0x7d),'risk':a247_0x4f9cfe(0x95),'flags':[{'name':a247_0x4f9cfe(0xaf),'type':a247_0x4f9cfe(0x84),'description':a247_0x4f9cfe(0x9b)},{'name':a247_0x4f9cfe(0x9d),'type':a247_0x4f9cfe(0xa7),'description':a247_0x4f9cfe(0xb3)},{'name':'mode','type':a247_0x4f9cfe(0x84),'enum':[a247_0x4f9cfe(0xa2),a247_0x4f9cfe(0x8c)],'description':a247_0x4f9cfe(0xa1)}],async 'validate'(_0x2a5970){const _0x2b0a56=a247_0x4f9cfe;if(!_0x2a5970[_0x2b0a56(0x8b)])return;if(!_0x2a5970[_0x2b0a56(0x81)]('name')[_0x2b0a56(0x7a)]())throw CliErrors[_0x2b0a56(0x83)](_0x2b0a56(0xaf),_0x2b0a56(0x86));const _0x189ebb=resolveProvidedDbId(_0x2a5970);if(typeof _0x189ebb!=='number'||!Number['isFinite'](_0x189ebb)||_0x189ebb<=0x0)throw CliErrors[_0x2b0a56(0x83)]('db-id',_0x2b0a56(0xb7));if(!_0x2a5970[_0x2b0a56(0x81)](_0x2b0a56(0x98))[_0x2b0a56(0x7a)]())throw CliErrors[_0x2b0a56(0x83)](_0x2b0a56(0x98),_0x2b0a56(0x92));},async 'dryRun'(_0x13394f){const _0x18f095=a247_0x4f9cfe,_0x331dc4=loadSqlProjectConfig(_0x13394f[_0x18f095(0x97)]),{sqlName:_0x845ddb,dbId:_0x294e25,dbName:_0x543bc0,mode:_0x55332a}=await resolveSqlNewInputs(_0x13394f),_0x38712b=buildSqlRelativePath(_0x18f095(0xa9),_0x845ddb,_0x543bc0,_0x55332a,_0x294e25),_0x5e5673=_0x331dc4[_0x18f095(0xae)]+'/'+_0x38712b;return{'method':_0x18f095(0x9c),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x13394f['appCode'],'sqlName':_0x845ddb,'dbId':_0x294e25,'mode':_0x55332a,'localPath':_0x5e5673},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x331dc4[_0x18f095(0xae)]};},async 'execute'(_0x361629){const _0x3b0ae2=a247_0x4f9cfe,_0x1eb171=loadSqlProjectConfig(_0x361629[_0x3b0ae2(0x97)]),{sqlName:_0x355fe4,dbId:_0x2905a8,dbName:_0x55c954,mode:_0x2afbcc}=await resolveSqlNewInputs(_0x361629),_0x4087e4=generateSqlTemplate(_0x2afbcc),_0x38fead=await createSqlQuery({'appCode':_0x361629[_0x3b0ae2(0x97)],'sqlName':_0x355fe4,'dbId':_0x2905a8,'sqlContent':_0x4087e4}),_0x3dee2f=ensureRemoteSqlContent(_0x38fead),_0x5c9ae2=_0x55c954||await getDbName(_0x361629[_0x3b0ae2(0x97)],_0x2905a8)['catch'](()=>undefined),_0x5d8d06=buildSqlRelativePath(_0x38fead[_0x3b0ae2(0xb8)],_0x38fead['sqlName'],_0x5c9ae2,_0x2afbcc,_0x2905a8),_0x231171=_0x1eb171['sqlRootDir']+'/'+_0x5d8d06,_0x59262d=buildLocalSqlFileContent({'sqlCode':_0x38fead[_0x3b0ae2(0xb8)],'sqlName':_0x38fead[_0x3b0ae2(0xb5)],'dbId':_0x38fead['dbId']},_0x3dee2f,{'dbName':_0x5c9ae2,'mode':_0x2afbcc,'syncedAt':new Date()[_0x3b0ae2(0xa5)](),'description':_0x38fead[_0x3b0ae2(0x9a)]});if(await fileExists(_0x231171))throw CliErrors[_0x3b0ae2(0x9f)](_0x3b0ae2(0xab)+_0x231171);await ensureParentDirectory(_0x231171),await writeFile(_0x231171,_0x59262d,'utf8');const _0x442271=await readSqlLockFile(_0x1eb171[_0x3b0ae2(0x9e)]),{lockData:_0x4a7074,appLock:_0x2c6981}=ensureSqlLockScope(_0x442271??createEmptySqlLock(),_0x1eb171[_0x3b0ae2(0x97)],_0x1eb171[_0x3b0ae2(0x90)],_0x3b0ae2(0x7e));return _0x2c6981[_0x3b0ae2(0x96)][_0x38fead[_0x3b0ae2(0xb8)]]={...buildSqlLockEntry(_0x38fead,_0x3dee2f,computeSqlContentHash(_0x59262d),{'dbName':_0x5c9ae2}),'path':_0x5d8d06,'mode':_0x2afbcc},_0x2c6981[_0x3b0ae2(0x78)]=new Date()['toISOString'](),await writeSqlLockFile(_0x1eb171[_0x3b0ae2(0x9e)],_0x4a7074),{'ok':!![],'data':{'id':_0x38fead['id'],'sqlCode':_0x38fead['sqlCode'],'sqlName':_0x38fead['sqlName'],'dbId':_0x38fead[_0x3b0ae2(0xb2)],'path':_0x231171,'mode':_0x2afbcc},'message':_0x3b0ae2(0x94)+_0x38fead[_0x3b0ae2(0xb8)]};}};async function resolveSqlNewInputs(_0x194041){const _0x5e30b1=await resolveSqlNameInput(_0x194041),{dbId:_0x26ed6d,dbName:_0x9d170f}=await resolveDbSelection(_0x194041),_0x229454=await resolveSqlModeInput(_0x194041);return{'sqlName':_0x5e30b1,'dbId':_0x26ed6d,'dbName':_0x9d170f,'mode':_0x229454};}async function resolveSqlNameInput(_0x7adb13){const _0x1a2a3d=a247_0x4f9cfe,_0x233946=_0x7adb13[_0x1a2a3d(0x81)](_0x1a2a3d(0xaf))[_0x1a2a3d(0x7a)]();if(_0x233946)return _0x233946;if(_0x7adb13[_0x1a2a3d(0x8b)])throw CliErrors[_0x1a2a3d(0x83)](_0x1a2a3d(0xaf),_0x1a2a3d(0x86));return(await input({'message':_0x1a2a3d(0x89),'validate':_0x525904=>_0x525904[_0x1a2a3d(0x7a)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))[_0x1a2a3d(0x7a)]();}async function resolveDbSelection(_0x47ddc5){const _0x249e84=a247_0x4f9cfe,_0x5afd09=resolveProvidedDbId(_0x47ddc5);if(typeof _0x5afd09===_0x249e84(0xa7)&&Number['isFinite'](_0x5afd09)&&_0x5afd09>0x0)return{'dbId':_0x5afd09,'dbName':await getDbName(_0x47ddc5['appCode'],_0x5afd09)[_0x249e84(0x82)](()=>undefined)};if(_0x47ddc5[_0x249e84(0x8b)])throw CliErrors[_0x249e84(0x83)](_0x249e84(0x9d),_0x249e84(0xb7));const _0x322e86=await listDatabases(_0x47ddc5[_0x249e84(0x97)])[_0x249e84(0x82)](()=>[]);if(_0x322e86[_0x249e84(0x8d)]===0x1)return{'dbId':_0x322e86[0x0][_0x249e84(0xb2)],'dbName':_0x322e86[0x0][_0x249e84(0xaa)]};if(_0x322e86[_0x249e84(0x8d)]>0x1){const _0x9b00b9=await select({'message':_0x249e84(0x91),'choices':[..._0x322e86['map'](_0x3d0bd4=>({'name':_0x3d0bd4['dbName']+'\x20('+_0x3d0bd4[_0x249e84(0xb2)]+')','value':serializeDbSelection(_0x3d0bd4)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':'__manual__'}]});if(_0x9b00b9!==_0x249e84(0xac))return deserializeDbSelection(_0x9b00b9);}const _0x2f918b=await input({'message':'Target\x20database\x20dbId:','validate':_0xfc23fe=>{const _0x280e2f=_0x249e84,_0x5a80cc=_0xfc23fe[_0x280e2f(0x7a)]();if(!_0x5a80cc)return _0x280e2f(0xb9);const _0x445212=Number(_0x5a80cc);if(!Number[_0x280e2f(0x7b)](_0x445212)||_0x445212<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x2f918b[_0x249e84(0x7a)]())};}async function resolveSqlModeInput(_0x66e691){const _0x58c7ec=a247_0x4f9cfe,_0x31c999=_0x66e691['str']('mode')['trim']();if(_0x31c999===_0x58c7ec(0xa2)||_0x31c999===_0x58c7ec(0x8c))return _0x31c999;if(_0x66e691[_0x58c7ec(0x8b)])throw CliErrors[_0x58c7ec(0x83)](_0x58c7ec(0x98),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x58c7ec(0x87),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':'sql','description':_0x58c7ec(0x7f)},{'name':_0x58c7ec(0xa8),'value':_0x58c7ec(0x8c),'description':'For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags'}]});}function a247_0x3960(_0x5071f5,_0x32eb15){_0x5071f5=_0x5071f5-0x78;const _0x5d9922=a247_0x5d99();let _0x396052=_0x5d9922[_0x5071f5];return _0x396052;}function serializeDbSelection(_0x1905e2){const _0x437316=a247_0x4f9cfe;return JSON['stringify']({'dbId':_0x1905e2[_0x437316(0xb2)],'dbName':_0x1905e2[_0x437316(0xaa)]});}function deserializeDbSelection(_0xb1a289){const _0x7d01a1=a247_0x4f9cfe;try{const _0x3d108f=JSON[_0x7d01a1(0xb4)](_0xb1a289);if(typeof _0x3d108f[_0x7d01a1(0xb2)]==='number'&&Number[_0x7d01a1(0xa0)](_0x3d108f['dbId']))return{'dbId':_0x3d108f['dbId'],'dbName':_0x3d108f[_0x7d01a1(0xaa)]};}catch{}throw CliErrors[_0x7d01a1(0x9f)]('Invalid\x20database\x20selection\x20payload:\x20'+_0xb1a289);}function resolveProvidedDbId(_0x244c31){const _0x178e2f=a247_0x4f9cfe,_0x2a719e=_0x244c31[_0x178e2f(0xad)]('db-id');if(typeof _0x2a719e===_0x178e2f(0xa7)&&Number[_0x178e2f(0xa0)](_0x2a719e))return _0x2a719e;return undefined;}
1
+ const a247_0x3fcf3a=a247_0x3869;function a247_0x338b(){const _0x1e4c7c=['number','toISOString','new','mybatisXml','Local\x20SQL\x20file\x20mode','lastSync','sqlCode','flag','Select\x20the\x20local\x20SQL\x20mode:','dbName','3495023ydTvdr','stringify','sql','map','SELECT\x201\x20AS\x20id;','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','Plain\x20SQL\x20(sql)','dbId\x20cannot\x20be\x20empty','591616toikWQ','dbId\x20must\x20be\x20a\x20positive\x20integer','nonInteractive','write','isFinite','utf8','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlRoot','validation','MyBatis\x20XML\x20(mybatisXml)','appCode','4020032olQyaV','3871509fEQLfm','File\x20already\x20exists:\x20','description','SQL\x20query\x20display\x20name','str','length','string','name','896143zmpFRq','join','SQL\x20name:','flagMissing','3366414mMWOzR','db-id','trim','isInteger','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Select\x20the\x20target\x20database:','/smartapi/custom/saveUserCustomSql','catch','\x20\x20SELECT\x201\x20AS\x20id','<server-generated-sqlCode>','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','sqlName','mode','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','Invalid\x20database\x20selection\x20payload:\x20','Target\x20database\x20dbId:','84RksqWJ','parse','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','lockFilePath','dbId','169585YmLHvY','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>'];a247_0x338b=function(){return _0x1e4c7c;};return a247_0x338b();}(function(_0x1c55bc,_0x15e3f5){const _0x418ad7=a247_0x3869,_0x16653b=_0x1c55bc();while(!![]){try{const _0xe487b=-parseInt(_0x418ad7(0x14c))/0x1+parseInt(_0x418ad7(0x138))/0x2+parseInt(_0x418ad7(0x144))/0x3+-parseInt(_0x418ad7(0x160))/0x4*(-parseInt(_0x418ad7(0x166))/0x5)+-parseInt(_0x418ad7(0x150))/0x6+-parseInt(_0x418ad7(0x172))/0x7+parseInt(_0x418ad7(0x143))/0x8;if(_0xe487b===_0x15e3f5)break;else _0x16653b['push'](_0x16653b['shift']());}catch(_0x2654c6){_0x16653b['push'](_0x16653b['shift']());}}}(a247_0x338b,0xce31b));function a247_0x3869(_0x2052f2,_0x159e98){_0x2052f2=_0x2052f2-0x137;const _0x338b43=a247_0x338b();let _0x386962=_0x338b43[_0x2052f2];return _0x386962;}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(_0x61f927){const _0x114ac1=a247_0x3869;if(_0x61f927===_0x114ac1(0x16b))return[_0x114ac1(0x167),_0x114ac1(0x158),'</select>',''][_0x114ac1(0x14d)]('\x0a');return[_0x114ac1(0x176),''][_0x114ac1(0x14d)]('\x0a');}export const sqlCreate={'service':a247_0x3fcf3a(0x174),'command':'create','description':a247_0x3fcf3a(0x154),'risk':a247_0x3fcf3a(0x13b),'flags':[{'name':a247_0x3fcf3a(0x14b),'type':a247_0x3fcf3a(0x14a),'description':a247_0x3fcf3a(0x147)},{'name':a247_0x3fcf3a(0x151),'type':a247_0x3fcf3a(0x168),'description':'Target\x20database\x20ID'},{'name':a247_0x3fcf3a(0x15c),'type':a247_0x3fcf3a(0x14a),'enum':[a247_0x3fcf3a(0x174),a247_0x3fcf3a(0x16b)],'description':a247_0x3fcf3a(0x16c)}],async 'validate'(_0x1151ee){const _0x5e6956=a247_0x3fcf3a;if(!_0x1151ee[_0x5e6956(0x13a)])return;if(!_0x1151ee[_0x5e6956(0x148)](_0x5e6956(0x14b))[_0x5e6956(0x152)]())throw CliErrors[_0x5e6956(0x14f)](_0x5e6956(0x14b),_0x5e6956(0x15d));const _0x1f8ec5=resolveProvidedDbId(_0x1151ee);if(typeof _0x1f8ec5!==_0x5e6956(0x168)||!Number[_0x5e6956(0x13c)](_0x1f8ec5)||_0x1f8ec5<=0x0)throw CliErrors[_0x5e6956(0x14f)](_0x5e6956(0x151),_0x5e6956(0x13e));if(!_0x1151ee[_0x5e6956(0x148)]('mode')[_0x5e6956(0x152)]())throw CliErrors[_0x5e6956(0x14f)](_0x5e6956(0x15c),_0x5e6956(0x177));},async 'dryRun'(_0x24a01b){const _0x581784=a247_0x3fcf3a,_0xcc108c=loadSqlProjectConfig(_0x24a01b['appCode']),{sqlName:_0x3a03c2,dbId:_0x2a9ec4,dbName:_0x57a1ef,mode:_0x6db661}=await resolveSqlNewInputs(_0x24a01b),_0x138a14=buildSqlRelativePath(_0x581784(0x159),_0x3a03c2,_0x57a1ef,_0x6db661,_0x2a9ec4),_0x4873bc=_0xcc108c['sqlRootDir']+'/'+_0x138a14;return{'method':'POST','url':_0x581784(0x156),'body':{'appCode':_0x24a01b[_0x581784(0x142)],'sqlName':_0x3a03c2,'dbId':_0x2a9ec4,'mode':_0x6db661,'localPath':_0x4873bc},'description':_0x581784(0x15a)+_0xcc108c['sqlRootDir']};},async 'execute'(_0x590a51){const _0x142767=a247_0x3fcf3a,_0x291a91=loadSqlProjectConfig(_0x590a51[_0x142767(0x142)]),{sqlName:_0x15d0cf,dbId:_0x1b2df5,dbName:_0x4306b4,mode:_0x2ae698}=await resolveSqlNewInputs(_0x590a51),_0x3bb4fd=generateSqlTemplate(_0x2ae698),_0x325e57=await createSqlQuery({'appCode':_0x590a51[_0x142767(0x142)],'sqlName':_0x15d0cf,'dbId':_0x1b2df5,'sqlContent':_0x3bb4fd}),_0x365c48=ensureRemoteSqlContent(_0x325e57),_0x87a2bf=_0x4306b4||await getDbName(_0x590a51['appCode'],_0x1b2df5)[_0x142767(0x157)](()=>undefined),_0x50ca23=buildSqlRelativePath(_0x325e57[_0x142767(0x16e)],_0x325e57[_0x142767(0x15b)],_0x87a2bf,_0x2ae698,_0x1b2df5),_0x379471=_0x291a91['sqlRootDir']+'/'+_0x50ca23,_0x1241f7=buildLocalSqlFileContent({'sqlCode':_0x325e57['sqlCode'],'sqlName':_0x325e57['sqlName'],'dbId':_0x325e57[_0x142767(0x165)]},_0x365c48,{'dbName':_0x87a2bf,'mode':_0x2ae698,'syncedAt':new Date()[_0x142767(0x169)](),'description':_0x325e57[_0x142767(0x146)]});if(await fileExists(_0x379471))throw CliErrors[_0x142767(0x140)](_0x142767(0x145)+_0x379471);await ensureParentDirectory(_0x379471),await writeFile(_0x379471,_0x1241f7,_0x142767(0x13d));const _0x3f8236=await readSqlLockFile(_0x291a91['lockFilePath']),{lockData:_0x147006,appLock:_0x5b5675}=ensureSqlLockScope(_0x3f8236??createEmptySqlLock(),_0x291a91[_0x142767(0x142)],_0x291a91[_0x142767(0x13f)],_0x142767(0x16a));return _0x5b5675['sqls'][_0x325e57[_0x142767(0x16e)]]={...buildSqlLockEntry(_0x325e57,_0x365c48,computeSqlContentHash(_0x1241f7),{'dbName':_0x87a2bf}),'path':_0x50ca23,'mode':_0x2ae698},_0x5b5675[_0x142767(0x16d)]=new Date()[_0x142767(0x169)](),await writeSqlLockFile(_0x291a91[_0x142767(0x164)],_0x147006),{'ok':!![],'data':{'id':_0x325e57['id'],'sqlCode':_0x325e57['sqlCode'],'sqlName':_0x325e57['sqlName'],'dbId':_0x325e57[_0x142767(0x165)],'path':_0x379471,'mode':_0x2ae698},'message':'Created\x20SQL\x20query\x20'+_0x325e57[_0x142767(0x16e)]};}};async function resolveSqlNewInputs(_0x2687f4){const _0xde4d19=await resolveSqlNameInput(_0x2687f4),{dbId:_0x4f3669,dbName:_0x3f4bb0}=await resolveDbSelection(_0x2687f4),_0x11f890=await resolveSqlModeInput(_0x2687f4);return{'sqlName':_0xde4d19,'dbId':_0x4f3669,'dbName':_0x3f4bb0,'mode':_0x11f890};}async function resolveSqlNameInput(_0x3d53d9){const _0x12b390=a247_0x3fcf3a,_0x2742f4=_0x3d53d9[_0x12b390(0x148)](_0x12b390(0x14b))[_0x12b390(0x152)]();if(_0x2742f4)return _0x2742f4;if(_0x3d53d9['nonInteractive'])throw CliErrors[_0x12b390(0x14f)](_0x12b390(0x14b),_0x12b390(0x15d));return(await input({'message':_0x12b390(0x14e),'validate':_0x447ed5=>_0x447ed5[_0x12b390(0x152)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))[_0x12b390(0x152)]();}async function resolveDbSelection(_0x4bb99e){const _0x10233f=a247_0x3fcf3a,_0x199be2=resolveProvidedDbId(_0x4bb99e);if(typeof _0x199be2===_0x10233f(0x168)&&Number[_0x10233f(0x13c)](_0x199be2)&&_0x199be2>0x0)return{'dbId':_0x199be2,'dbName':await getDbName(_0x4bb99e[_0x10233f(0x142)],_0x199be2)[_0x10233f(0x157)](()=>undefined)};if(_0x4bb99e[_0x10233f(0x13a)])throw CliErrors[_0x10233f(0x14f)](_0x10233f(0x151),_0x10233f(0x13e));const _0x47712d=await listDatabases(_0x4bb99e[_0x10233f(0x142)])[_0x10233f(0x157)](()=>[]);if(_0x47712d[_0x10233f(0x149)]===0x1)return{'dbId':_0x47712d[0x0][_0x10233f(0x165)],'dbName':_0x47712d[0x0][_0x10233f(0x171)]};if(_0x47712d['length']>0x1){const _0x25db42=await select({'message':_0x10233f(0x155),'choices':[..._0x47712d[_0x10233f(0x175)](_0x3228bb=>({'name':_0x3228bb['dbName']+'\x20('+_0x3228bb[_0x10233f(0x165)]+')','value':serializeDbSelection(_0x3228bb)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':'__manual__'}]});if(_0x25db42!=='__manual__')return deserializeDbSelection(_0x25db42);}const _0x4a6e7d=await input({'message':_0x10233f(0x15f),'validate':_0xeffc84=>{const _0x177a06=_0x10233f,_0x12f623=_0xeffc84[_0x177a06(0x152)]();if(!_0x12f623)return _0x177a06(0x137);const _0x5d2f9f=Number(_0x12f623);if(!Number[_0x177a06(0x153)](_0x5d2f9f)||_0x5d2f9f<=0x0)return _0x177a06(0x139);return!![];}});return{'dbId':Number(_0x4a6e7d[_0x10233f(0x152)]())};}async function resolveSqlModeInput(_0x334337){const _0x932aaa=a247_0x3fcf3a,_0x11910e=_0x334337['str']('mode')[_0x932aaa(0x152)]();if(_0x11910e===_0x932aaa(0x174)||_0x11910e===_0x932aaa(0x16b))return _0x11910e;if(_0x334337[_0x932aaa(0x13a)])throw CliErrors['flagMissing'](_0x932aaa(0x15c),_0x932aaa(0x177));return await select({'message':_0x932aaa(0x170),'choices':[{'name':_0x932aaa(0x178),'value':_0x932aaa(0x174),'description':_0x932aaa(0x162)},{'name':_0x932aaa(0x141),'value':_0x932aaa(0x16b),'description':_0x932aaa(0x163)}]});}function serializeDbSelection(_0x408e61){const _0x293fcb=a247_0x3fcf3a;return JSON[_0x293fcb(0x173)]({'dbId':_0x408e61[_0x293fcb(0x165)],'dbName':_0x408e61[_0x293fcb(0x171)]});}function deserializeDbSelection(_0x2286a1){const _0x10d44c=a247_0x3fcf3a;try{const _0x537636=JSON[_0x10d44c(0x161)](_0x2286a1);if(typeof _0x537636['dbId']===_0x10d44c(0x168)&&Number[_0x10d44c(0x13c)](_0x537636['dbId']))return{'dbId':_0x537636[_0x10d44c(0x165)],'dbName':_0x537636[_0x10d44c(0x171)]};}catch{}throw CliErrors[_0x10d44c(0x140)](_0x10d44c(0x15e)+_0x2286a1);}function resolveProvidedDbId(_0x483265){const _0x477bca=a247_0x3fcf3a,_0x461cdf=_0x483265[_0x477bca(0x16f)](_0x477bca(0x151));if(typeof _0x461cdf===_0x477bca(0x168)&&Number[_0x477bca(0x13c)](_0x461cdf))return _0x461cdf;return undefined;}
@@ -1 +1 @@
1
- const a248_0x17c547=a248_0x8be7;(function(_0x44395c,_0x2ec1de){const _0x199cdc=a248_0x8be7,_0x85fa87=_0x44395c();while(!![]){try{const _0x4d404d=-parseInt(_0x199cdc(0xc1))/0x1*(parseInt(_0x199cdc(0xb9))/0x2)+-parseInt(_0x199cdc(0xc0))/0x3+parseInt(_0x199cdc(0xae))/0x4*(-parseInt(_0x199cdc(0xc6))/0x5)+-parseInt(_0x199cdc(0xaa))/0x6*(parseInt(_0x199cdc(0xb2))/0x7)+parseInt(_0x199cdc(0xbd))/0x8*(parseInt(_0x199cdc(0xbc))/0x9)+parseInt(_0x199cdc(0xa9))/0xa+parseInt(_0x199cdc(0xbf))/0xb*(parseInt(_0x199cdc(0xb3))/0xc);if(_0x4d404d===_0x2ec1de)break;else _0x85fa87['push'](_0x85fa87['shift']());}catch(_0xb29fc2){_0x85fa87['push'](_0x85fa87['shift']());}}}(a248_0x5397,0xd7036));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a248_0x5397(){const _0x6c5fcc=['delete','638SwMVQs','2633511lAAUHI','41eXnFgY','replace','Deleted\x20','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','projectRoot','170915diTwBD','Would\x20delete\x20SQL\x20','/smartapi/custom/deleteUserCustomSql','sqlRootDir','appCode','toISOString','sql','sqlcode','sqls','filter','high-risk-write','trashedTo','12717310IxPveb','12pwAuOa','remoteId','length','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','16teKcLD','lockFilePath','trashDir','lastSync','1034663RiZutS','365388ZUFCIV','fromEntries','validation','str','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','POST','62134InqYFo','sqlRoot','\x20(local\x20file\x20moved\x20to\x20trash)','9GAYJRt','3414840YgKHKv'];a248_0x5397=function(){return _0x6c5fcc;};return a248_0x5397();}import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';function a248_0x8be7(_0x325f9a,_0x3da44e){_0x325f9a=_0x325f9a-0xa4;const _0x5397f5=a248_0x5397();let _0x8be7e9=_0x5397f5[_0x325f9a];return _0x8be7e9;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a248_0x17c547(0xcc),'command':'delete','description':a248_0x17c547(0xc4),'risk':a248_0x17c547(0xa7),'flags':[SQLCODE_FLAG],async 'validate'(_0x29dce3){const _0x44539b=a248_0x17c547,_0x4bcda2=loadSqlProjectConfig(_0x29dce3[_0x44539b(0xca)]),_0x32192c=await readSqlLockFile(_0x4bcda2['lockFilePath']);if(!_0x32192c)throw CliErrors[_0x44539b(0xb5)](_0x44539b(0xad));},async 'dryRun'(_0x50ccee){const _0x511dd6=a248_0x17c547,_0x5a35d2=loadSqlProjectConfig(_0x50ccee['appCode']),_0x4437b2=await readSqlLockFile(_0x5a35d2[_0x511dd6(0xaf)]);if(!_0x4437b2)throw CliErrors[_0x511dd6(0xb5)](_0x511dd6(0xad));const {appLock:_0x3b42b4}=ensureSqlLockScope(_0x4437b2,_0x50ccee[_0x511dd6(0xca)],_0x5a35d2[_0x511dd6(0xba)],'delete'),_0x57c3c3=_0x50ccee[_0x511dd6(0xb6)](_0x511dd6(0xa4)),_0x31d5dc=_0x3b42b4[_0x511dd6(0xa5)][_0x57c3c3];if(!_0x31d5dc)throw CliErrors[_0x511dd6(0xb5)](_0x511dd6(0xb7)+_0x57c3c3+'\x22.');return{'method':_0x511dd6(0xb8),'url':_0x511dd6(0xc8),'body':{'sqlCode':_0x57c3c3,'id':_0x31d5dc[_0x511dd6(0xab)],'localPath':resolveLocalSqlFilePath(_0x5a35d2,_0x57c3c3,_0x31d5dc)},'description':_0x511dd6(0xc7)+_0x57c3c3+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x5a35d2[_0x511dd6(0xb0)]};},async 'execute'(_0x439434){const _0x249c96=a248_0x17c547,_0x3bc3dc=loadSqlProjectConfig(_0x439434[_0x249c96(0xca)]),_0x422ecf=await readSqlLockFile(_0x3bc3dc[_0x249c96(0xaf)]);if(!_0x422ecf)throw CliErrors[_0x249c96(0xb5)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x1a2986,appLock:_0x1db9e6}=ensureSqlLockScope(_0x422ecf,_0x439434['appCode'],_0x3bc3dc[_0x249c96(0xba)],_0x249c96(0xbe)),_0x3eef55=_0x439434['str'](_0x249c96(0xa4)),_0x464e67=_0x1db9e6[_0x249c96(0xa5)][_0x3eef55];if(!_0x464e67)throw CliErrors[_0x249c96(0xb5)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x3eef55+'\x22.');await deleteSqlQuery({'id':_0x464e67[_0x249c96(0xab)],'sqlCode':_0x3eef55}),_0x1db9e6[_0x249c96(0xa5)]=Object[_0x249c96(0xb4)](Object['entries'](_0x1db9e6[_0x249c96(0xa5)])[_0x249c96(0xa6)](([_0x28bd58])=>_0x28bd58!==_0x3eef55)),_0x1db9e6[_0x249c96(0xb1)]=new Date()['toISOString'](),await writeSqlLockFile(_0x3bc3dc[_0x249c96(0xaf)],_0x1a2986);const _0x24f2d8=resolveLocalSqlFilePath(_0x3bc3dc,_0x3eef55,_0x464e67);let _0x4e5812;await fileExists(_0x24f2d8)&&(_0x4e5812=await moveToTrash(_0x3bc3dc[_0x249c96(0xc5)],_0x3bc3dc[_0x249c96(0xb0)],_0x24f2d8),await cleanupEmptyDirectories(dirname(_0x24f2d8),_0x3bc3dc[_0x249c96(0xc9)]));const _0x38a306={'deleted':_0x3eef55,'remoteId':_0x464e67[_0x249c96(0xab)]};if(_0x4e5812)_0x38a306[_0x249c96(0xa8)]=_0x4e5812;return{'ok':!![],'data':_0x38a306,'message':_0x249c96(0xc3)+_0x3eef55+(_0x4e5812?_0x249c96(0xbb):'')};}};async function moveToTrash(_0x3fd0a4,_0x596e0d,_0x83bd25){const _0x4a6cc3=a248_0x17c547,_0x2b05df=new Date()[_0x4a6cc3(0xcb)]()[_0x4a6cc3(0xc2)](/[:.]/g,'-'),_0x429274=relative(_0x3fd0a4,_0x83bd25),_0x244498=join(_0x596e0d,_0x2b05df,_0x429274);return await mkdir(dirname(_0x244498),{'recursive':!![]}),await rename(_0x83bd25,_0x244498),_0x244498;}async function cleanupEmptyDirectories(_0x5906f1,_0x428679){const _0x4e33bb=a248_0x17c547;let _0x4d101f=resolve(_0x5906f1);const _0x2bdc86=resolve(_0x428679);while(_0x4d101f['startsWith'](''+_0x2bdc86+sep)||_0x4d101f===_0x2bdc86){if(_0x4d101f===_0x2bdc86)return;try{const _0x529445=await readdir(_0x4d101f);if(_0x529445[_0x4e33bb(0xac)]>0x0)return;await rmdir(_0x4d101f);}catch{return;}_0x4d101f=dirname(_0x4d101f);}}
1
+ function a248_0x544c(){const _0x61380f=['validation','4936ByoqKt','10PGtSqg','319944UnZJXR','remoteId','sql','fromEntries','toISOString','replace','5nKwbei','sqls','\x20(local\x20file\x20moved\x20to\x20trash)','appCode','SQL\x20lock\x20file\x20not\x20found.','filter','trashDir','length','Deleted\x20','Would\x20delete\x20SQL\x20','lockFilePath','sqlRootDir','1062589dBpiGM','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','startsWith','2987418ESpHWu','sqlRoot','sqlcode','532676lCdDuA','delete','3033IDsjHG','4AEgJwu','1144254JSvxpd','41129kdeyMj','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','projectRoot','high-risk-write','entries','str','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.'];a248_0x544c=function(){return _0x61380f;};return a248_0x544c();}const a248_0x5e04a8=a248_0x52ac;function a248_0x52ac(_0x1bcc1e,_0x3f60ab){_0x1bcc1e=_0x1bcc1e-0xcb;const _0x544c6a=a248_0x544c();let _0x52acd9=_0x544c6a[_0x1bcc1e];return _0x52acd9;}(function(_0x3c469f,_0x51d699){const _0x5b748b=a248_0x52ac,_0x59cdfe=_0x3c469f();while(!![]){try{const _0x50f744=parseInt(_0x5b748b(0xd2))/0x1*(-parseInt(_0x5b748b(0xd0))/0x2)+-parseInt(_0x5b748b(0xdc))/0x3+parseInt(_0x5b748b(0xcd))/0x4*(-parseInt(_0x5b748b(0xe2))/0x5)+-parseInt(_0x5b748b(0xd1))/0x6+parseInt(_0x5b748b(0xf1))/0x7+parseInt(_0x5b748b(0xda))/0x8*(parseInt(_0x5b748b(0xcf))/0x9)+parseInt(_0x5b748b(0xdb))/0xa*(parseInt(_0x5b748b(0xee))/0xb);if(_0x50f744===_0x51d699)break;else _0x59cdfe['push'](_0x59cdfe['shift']());}catch(_0x7e696c){_0x59cdfe['push'](_0x59cdfe['shift']());}}}(a248_0x544c,0x35596));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a248_0x5e04a8(0xde),'command':a248_0x5e04a8(0xce),'description':a248_0x5e04a8(0xef),'risk':a248_0x5e04a8(0xd5),'flags':[SQLCODE_FLAG],async 'validate'(_0x169832){const _0x27b492=a248_0x5e04a8,_0x51290b=loadSqlProjectConfig(_0x169832[_0x27b492(0xe5)]),_0x3789c6=await readSqlLockFile(_0x51290b[_0x27b492(0xec)]);if(!_0x3789c6)throw CliErrors['validation'](_0x27b492(0xd8));},async 'dryRun'(_0x4dda49){const _0xcd1c78=a248_0x5e04a8,_0x43a8d9=loadSqlProjectConfig(_0x4dda49[_0xcd1c78(0xe5)]),_0x2d6718=await readSqlLockFile(_0x43a8d9[_0xcd1c78(0xec)]);if(!_0x2d6718)throw CliErrors[_0xcd1c78(0xd9)](_0xcd1c78(0xd8));const {appLock:_0x233acd}=ensureSqlLockScope(_0x2d6718,_0x4dda49[_0xcd1c78(0xe5)],_0x43a8d9[_0xcd1c78(0xcb)],_0xcd1c78(0xce)),_0x24a205=_0x4dda49[_0xcd1c78(0xd7)](_0xcd1c78(0xcc)),_0x1446d1=_0x233acd[_0xcd1c78(0xe3)][_0x24a205];if(!_0x1446d1)throw CliErrors[_0xcd1c78(0xd9)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x24a205+'\x22.');return{'method':'POST','url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x24a205,'id':_0x1446d1[_0xcd1c78(0xdd)],'localPath':resolveLocalSqlFilePath(_0x43a8d9,_0x24a205,_0x1446d1)},'description':_0xcd1c78(0xeb)+_0x24a205+_0xcd1c78(0xd3)+_0x43a8d9[_0xcd1c78(0xe8)]};},async 'execute'(_0x59ee02){const _0x1dfbb0=a248_0x5e04a8,_0x4efab6=loadSqlProjectConfig(_0x59ee02['appCode']),_0xf4535a=await readSqlLockFile(_0x4efab6[_0x1dfbb0(0xec)]);if(!_0xf4535a)throw CliErrors[_0x1dfbb0(0xd9)](_0x1dfbb0(0xe6));const {lockData:_0x129fbb,appLock:_0x572c12}=ensureSqlLockScope(_0xf4535a,_0x59ee02['appCode'],_0x4efab6[_0x1dfbb0(0xcb)],_0x1dfbb0(0xce)),_0x3d32fd=_0x59ee02[_0x1dfbb0(0xd7)](_0x1dfbb0(0xcc)),_0x2a81c9=_0x572c12[_0x1dfbb0(0xe3)][_0x3d32fd];if(!_0x2a81c9)throw CliErrors[_0x1dfbb0(0xd9)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x3d32fd+'\x22.');await deleteSqlQuery({'id':_0x2a81c9[_0x1dfbb0(0xdd)],'sqlCode':_0x3d32fd}),_0x572c12[_0x1dfbb0(0xe3)]=Object[_0x1dfbb0(0xdf)](Object[_0x1dfbb0(0xd6)](_0x572c12[_0x1dfbb0(0xe3)])[_0x1dfbb0(0xe7)](([_0x46d608])=>_0x46d608!==_0x3d32fd)),_0x572c12['lastSync']=new Date()[_0x1dfbb0(0xe0)](),await writeSqlLockFile(_0x4efab6['lockFilePath'],_0x129fbb);const _0x27ef65=resolveLocalSqlFilePath(_0x4efab6,_0x3d32fd,_0x2a81c9);let _0x37ec2b;await fileExists(_0x27ef65)&&(_0x37ec2b=await moveToTrash(_0x4efab6[_0x1dfbb0(0xd4)],_0x4efab6[_0x1dfbb0(0xe8)],_0x27ef65),await cleanupEmptyDirectories(dirname(_0x27ef65),_0x4efab6[_0x1dfbb0(0xed)]));const _0x31d999={'deleted':_0x3d32fd,'remoteId':_0x2a81c9['remoteId']};if(_0x37ec2b)_0x31d999['trashedTo']=_0x37ec2b;return{'ok':!![],'data':_0x31d999,'message':_0x1dfbb0(0xea)+_0x3d32fd+(_0x37ec2b?_0x1dfbb0(0xe4):'')};}};async function moveToTrash(_0x5b1103,_0x5f817d,_0x3fb661){const _0x5125a9=a248_0x5e04a8,_0x318af0=new Date()[_0x5125a9(0xe0)]()[_0x5125a9(0xe1)](/[:.]/g,'-'),_0x1232c4=relative(_0x5b1103,_0x3fb661),_0x22e439=join(_0x5f817d,_0x318af0,_0x1232c4);return await mkdir(dirname(_0x22e439),{'recursive':!![]}),await rename(_0x3fb661,_0x22e439),_0x22e439;}async function cleanupEmptyDirectories(_0x39fdd3,_0x2e3062){const _0x5231c6=a248_0x5e04a8;let _0x4cc2b4=resolve(_0x39fdd3);const _0x1e3f97=resolve(_0x2e3062);while(_0x4cc2b4[_0x5231c6(0xf0)](''+_0x1e3f97+sep)||_0x4cc2b4===_0x1e3f97){if(_0x4cc2b4===_0x1e3f97)return;try{const _0x52691e=await readdir(_0x4cc2b4);if(_0x52691e[_0x5231c6(0xe9)]>0x0)return;await rmdir(_0x4cc2b4);}catch{return;}_0x4cc2b4=dirname(_0x4cc2b4);}}
@@ -1 +1 @@
1
- const a249_0x398fcf=a249_0x1d03;function a249_0x1d03(_0x4bc139,_0x136e4d){_0x4bc139=_0x4bc139-0x1df;const _0x9ddc7c=a249_0x9ddc();let _0x1d0391=_0x9ddc7c[_0x4bc139];return _0x1d0391;}function a249_0x9ddc(){const _0x2ae253=['boolean','read','144mwkdjU','str','22424nRKily','6KXaPCx','3426008CekaqP','796640qbgDsX','verbose','sql','4124449GFzWjE','dbId','sqlName','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','22314300bmepzv','441RTbunV','2485750loiEgY','description','22TTbWzM','bool','32072DghDIC','5hiKERK','sqlcode'];a249_0x9ddc=function(){return _0x2ae253;};return a249_0x9ddc();}(function(_0x3ea4c2,_0x14aa80){const _0x5029aa=a249_0x1d03,_0x33cff3=_0x3ea4c2();while(!![]){try{const _0x44ef6a=-parseInt(_0x5029aa(0x1df))/0x1+parseInt(_0x5029aa(0x1ec))/0x2*(-parseInt(_0x5029aa(0x1f1))/0x3)+-parseInt(_0x5029aa(0x1f5))/0x4*(parseInt(_0x5029aa(0x1ed))/0x5)+-parseInt(_0x5029aa(0x1f4))/0x6*(parseInt(_0x5029aa(0x1e2))/0x7)+parseInt(_0x5029aa(0x1f3))/0x8*(parseInt(_0x5029aa(0x1e7))/0x9)+-parseInt(_0x5029aa(0x1e8))/0xa+parseInt(_0x5029aa(0x1ea))/0xb*(parseInt(_0x5029aa(0x1e6))/0xc);if(_0x44ef6a===_0x14aa80)break;else _0x33cff3['push'](_0x33cff3['shift']());}catch(_0x28b4fe){_0x33cff3['push'](_0x33cff3['shift']());}}}(a249_0x9ddc,0x91721));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a249_0x398fcf(0x1e1),'command':'detail','description':a249_0x398fcf(0x1e5),'risk':a249_0x398fcf(0x1f0),'flags':[SQLCODE_FLAG,{'name':a249_0x398fcf(0x1e0),'type':a249_0x398fcf(0x1ef),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x530004){const _0x5c22a7=a249_0x398fcf,_0x1587c8=await getSqlQueryInfo(_0x530004['appCode'],_0x530004[_0x5c22a7(0x1f2)](_0x5c22a7(0x1ee))),_0x21e7f8=_0x530004[_0x5c22a7(0x1eb)](_0x5c22a7(0x1e0));if(_0x21e7f8)return{'ok':!![],'data':_0x1587c8};const _0x125e96=_0x1587c8['dbId']?await getDbName(_0x530004['appCode'],_0x1587c8[_0x5c22a7(0x1e3)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x1587c8['sqlCode'],'sqlName':_0x1587c8[_0x5c22a7(0x1e4)],'db':_0x125e96?_0x125e96+'\x20('+_0x1587c8[_0x5c22a7(0x1e3)]+')':_0x1587c8[_0x5c22a7(0x1e3)]??'','description':_0x1587c8[_0x5c22a7(0x1e9)]??'','sqlContent':_0x1587c8['sqlContent']??''}};}};
1
+ const a249_0x2f568d=a249_0x3979;(function(_0x577843,_0x25fe87){const _0x485026=a249_0x3979,_0x18851d=_0x577843();while(!![]){try{const _0x483dfd=-parseInt(_0x485026(0x15d))/0x1*(parseInt(_0x485026(0x159))/0x2)+-parseInt(_0x485026(0x163))/0x3*(parseInt(_0x485026(0x15a))/0x4)+parseInt(_0x485026(0x157))/0x5*(-parseInt(_0x485026(0x155))/0x6)+-parseInt(_0x485026(0x164))/0x7+-parseInt(_0x485026(0x156))/0x8*(-parseInt(_0x485026(0x158))/0x9)+-parseInt(_0x485026(0x167))/0xa+-parseInt(_0x485026(0x166))/0xb*(-parseInt(_0x485026(0x161))/0xc);if(_0x483dfd===_0x25fe87)break;else _0x18851d['push'](_0x18851d['shift']());}catch(_0x471f11){_0x18851d['push'](_0x18851d['shift']());}}}(a249_0x47d1,0x1f721));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a249_0x2f568d(0x15e),'command':a249_0x2f568d(0x15c),'description':a249_0x2f568d(0x165),'risk':'read','flags':[SQLCODE_FLAG,{'name':a249_0x2f568d(0x168),'type':a249_0x2f568d(0x152),'description':a249_0x2f568d(0x150)}],async 'execute'(_0x535b7f){const _0x4f85e4=a249_0x2f568d,_0x28be69=await getSqlQueryInfo(_0x535b7f[_0x4f85e4(0x154)],_0x535b7f[_0x4f85e4(0x15b)]('sqlcode')),_0x3b1217=_0x535b7f[_0x4f85e4(0x15f)](_0x4f85e4(0x168));if(_0x3b1217)return{'ok':!![],'data':_0x28be69};const _0x5de214=_0x28be69[_0x4f85e4(0x153)]?await getDbName(_0x535b7f['appCode'],_0x28be69[_0x4f85e4(0x153)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x28be69[_0x4f85e4(0x151)],'sqlName':_0x28be69[_0x4f85e4(0x162)],'db':_0x5de214?_0x5de214+'\x20('+_0x28be69['dbId']+')':_0x28be69[_0x4f85e4(0x153)]??'','description':_0x28be69['description']??'','sqlContent':_0x28be69[_0x4f85e4(0x160)]??''}};}};function a249_0x3979(_0xa1b45f,_0x35b20e){_0xa1b45f=_0xa1b45f-0x150;const _0x47d11f=a249_0x47d1();let _0x3979ad=_0x47d11f[_0xa1b45f];return _0x3979ad;}function a249_0x47d1(){const _0x3c16a8=['8511173GWwKPX','2109450aplDTE','verbose','Return\x20full\x20raw\x20SQL\x20query\x20object','sqlCode','boolean','dbId','appCode','6QZVvWa','40flEFID','1184905YJGJlg','35487rrHtFH','10CiyNEt','10408aotGVR','str','detail','28635KcQIKT','sql','bool','sqlContent','12qZzFWh','sqlName','12zVdXkV','442036fpjTpL','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode'];a249_0x47d1=function(){return _0x3c16a8;};return a249_0x47d1();}
@@ -1 +1 @@
1
- const a250_0x29a797=a250_0x4194;(function(_0x4eb329,_0xda0068){const _0xdf439e=a250_0x4194,_0x38d8a6=_0x4eb329();while(!![]){try{const _0x39de50=parseInt(_0xdf439e(0x1c8))/0x1+parseInt(_0xdf439e(0x1ce))/0x2+-parseInt(_0xdf439e(0x1c2))/0x3+parseInt(_0xdf439e(0x1d0))/0x4*(parseInt(_0xdf439e(0x1c9))/0x5)+parseInt(_0xdf439e(0x1c5))/0x6*(-parseInt(_0xdf439e(0x1c4))/0x7)+-parseInt(_0xdf439e(0x1ca))/0x8*(-parseInt(_0xdf439e(0x1d1))/0x9)+-parseInt(_0xdf439e(0x1bd))/0xa;if(_0x39de50===_0xda0068)break;else _0x38d8a6['push'](_0x38d8a6['shift']());}catch(_0x11fa61){_0x38d8a6['push'](_0x38d8a6['shift']());}}}(a250_0x1f51,0x36a6f));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a250_0x4194(_0x43c8a,_0x427c61){_0x43c8a=_0x43c8a-0x1ba;const _0x1f51f5=a250_0x1f51();let _0x419447=_0x1f51f5[_0x43c8a];return _0x419447;}function a250_0x1f51(){const _0x1b0c8b=['2801620ZNDTIM','SQL\x20execution\x20failed','Returned\x20','sqlcode','isArray','998727AOeKKU','appCode','63EblUJq','54018YDiRUk','now','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','89140RfaCPC','59855Fbvmof','877792GFlkuH','read','length','\x20row(s)\x20in\x20','791744eOHvhq','str','108tOUgaG','9bvYQgA','params','execSuccess','exec'];a250_0x1f51=function(){return _0x1b0c8b;};return a250_0x1f51();}export const sqlExec={'service':'sql','command':a250_0x29a797(0x1bc),'description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a250_0x29a797(0x1cb),'flags':[SQLCODE_FLAG,{'name':a250_0x29a797(0x1ba),'type':'string','description':a250_0x29a797(0x1c7)}],async 'execute'(_0x3eeb7e){const _0x229ed0=a250_0x29a797,_0x38a1fc=parseJsonParams(_0x3eeb7e[_0x229ed0(0x1cf)](_0x229ed0(0x1ba))),_0x1ae0ed=Date[_0x229ed0(0x1c6)](),_0x502631=await executeSql(_0x3eeb7e[_0x229ed0(0x1c3)],_0x3eeb7e[_0x229ed0(0x1cf)](_0x229ed0(0x1c0)),_0x38a1fc),_0x5bca02=Date[_0x229ed0(0x1c6)]()-_0x1ae0ed,_0x426a17=_0x502631?.['execResult']??_0x502631,_0x10ff2c=_0x502631?.[_0x229ed0(0x1bb)]??!![];if(!_0x10ff2c)return{'ok':![],'data':{'error':_0x502631?.['execError']||_0x229ed0(0x1be),'elapsed':_0x5bca02},'message':_0x229ed0(0x1be)};const _0x45f57a=Array[_0x229ed0(0x1c1)](_0x426a17)?_0x426a17:[];return{'ok':!![],'data':{'rows':_0x45f57a,'rowCount':_0x45f57a['length'],'elapsed':_0x5bca02},'message':_0x229ed0(0x1bf)+_0x45f57a[_0x229ed0(0x1cc)]+_0x229ed0(0x1cd)+_0x5bca02+'ms'};}};
1
+ const a250_0x1b8aec=a250_0x4303;(function(_0x4db206,_0x1df158){const _0x2335d2=a250_0x4303,_0x2cbb79=_0x4db206();while(!![]){try{const _0x34f026=parseInt(_0x2335d2(0x157))/0x1+parseInt(_0x2335d2(0x156))/0x2+-parseInt(_0x2335d2(0x162))/0x3*(parseInt(_0x2335d2(0x159))/0x4)+-parseInt(_0x2335d2(0x16b))/0x5+-parseInt(_0x2335d2(0x15a))/0x6+parseInt(_0x2335d2(0x163))/0x7+parseInt(_0x2335d2(0x16a))/0x8*(parseInt(_0x2335d2(0x160))/0x9);if(_0x34f026===_0x1df158)break;else _0x2cbb79['push'](_0x2cbb79['shift']());}catch(_0x211de0){_0x2cbb79['push'](_0x2cbb79['shift']());}}}(a250_0xe41d,0x52ff4));function a250_0x4303(_0xd2c4f8,_0x4ecf6b){_0xd2c4f8=_0xd2c4f8-0x154;const _0xe41d5b=a250_0xe41d();let _0x43037c=_0xe41d5b[_0xd2c4f8];return _0x43037c;}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':'sql','command':a250_0x1b8aec(0x15c),'description':a250_0x1b8aec(0x15d),'risk':a250_0x1b8aec(0x167),'flags':[SQLCODE_FLAG,{'name':a250_0x1b8aec(0x169),'type':a250_0x1b8aec(0x166),'description':a250_0x1b8aec(0x15b)}],async 'execute'(_0x32ed78){const _0x5b5bad=a250_0x1b8aec,_0x2c4bfd=parseJsonParams(_0x32ed78['str'](_0x5b5bad(0x169))),_0x5763b4=Date[_0x5b5bad(0x164)](),_0x55da0e=await executeSql(_0x32ed78[_0x5b5bad(0x15f)],_0x32ed78[_0x5b5bad(0x15e)](_0x5b5bad(0x154)),_0x2c4bfd),_0x240abb=Date[_0x5b5bad(0x164)]()-_0x5763b4,_0x2cc150=_0x55da0e?.[_0x5b5bad(0x165)]??_0x55da0e,_0x1a0960=_0x55da0e?.[_0x5b5bad(0x155)]??!![];if(!_0x1a0960)return{'ok':![],'data':{'error':_0x55da0e?.[_0x5b5bad(0x158)]||'SQL\x20execution\x20failed','elapsed':_0x240abb},'message':_0x5b5bad(0x168)};const _0x129e91=Array['isArray'](_0x2cc150)?_0x2cc150:[];return{'ok':!![],'data':{'rows':_0x129e91,'rowCount':_0x129e91[_0x5b5bad(0x161)],'elapsed':_0x240abb},'message':'Returned\x20'+_0x129e91[_0x5b5bad(0x161)]+_0x5b5bad(0x16c)+_0x240abb+'ms'};}};function a250_0xe41d(){const _0x1b9f15=['length','937155VKKpBt','3224095Xmrtte','now','execResult','string','read','SQL\x20execution\x20failed','params','344rFpIRs','3335035WRttuK','\x20row(s)\x20in\x20','sqlcode','execSuccess','1043712CQwLjK','171940RpkVCj','execError','8ZIILGQ','378432zwWrlG','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','exec','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','str','appCode','113112DHpAPL'];a250_0xe41d=function(){return _0x1b9f15;};return a250_0xe41d();}
@@ -1 +1 @@
1
- (function(_0x308c0e,_0x1fbfc9){const _0x19a851=a251_0x4dc5,_0x38c75e=_0x308c0e();while(!![]){try{const _0x2db681=parseInt(_0x19a851(0x99))/0x1+parseInt(_0x19a851(0x98))/0x2+parseInt(_0x19a851(0x96))/0x3*(parseInt(_0x19a851(0x9b))/0x4)+-parseInt(_0x19a851(0x9c))/0x5+-parseInt(_0x19a851(0x95))/0x6+-parseInt(_0x19a851(0x97))/0x7*(-parseInt(_0x19a851(0x9a))/0x8)+-parseInt(_0x19a851(0x9d))/0x9;if(_0x2db681===_0x1fbfc9)break;else _0x38c75e['push'](_0x38c75e['shift']());}catch(_0x58976){_0x38c75e['push'](_0x38c75e['shift']());}}}(a251_0x2401,0x8f4a4));function a251_0x2401(){const _0x48e307=['433906oqOUjN','801746EDeAUr','90056yXtMej','8pGZuDu','2024015AKFXlu','839889qEejYf','3311202WEGsyQ','420747TUYJuM','210yztIol'];a251_0x2401=function(){return _0x48e307;};return a251_0x2401();}import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';function a251_0x4dc5(_0x3e566e,_0x1b69d6){_0x3e566e=_0x3e566e-0x95;const _0x24019f=a251_0x2401();let _0x4dc5d5=_0x24019f[_0x3e566e];return _0x4dc5d5;}import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x32c9bc,_0x2e5e1e){const _0x4f44b7=a251_0x43a0,_0x35daf0=_0x32c9bc();while(!![]){try{const _0xea33fb=-parseInt(_0x4f44b7(0xf4))/0x1*(-parseInt(_0x4f44b7(0xf5))/0x2)+-parseInt(_0x4f44b7(0xec))/0x3+parseInt(_0x4f44b7(0xf2))/0x4+parseInt(_0x4f44b7(0xeb))/0x5*(parseInt(_0x4f44b7(0xf3))/0x6)+-parseInt(_0x4f44b7(0xf1))/0x7*(-parseInt(_0x4f44b7(0xed))/0x8)+-parseInt(_0x4f44b7(0xf0))/0x9*(parseInt(_0x4f44b7(0xef))/0xa)+parseInt(_0x4f44b7(0xee))/0xb;if(_0xea33fb===_0x2e5e1e)break;else _0x35daf0['push'](_0x35daf0['shift']());}catch(_0x2e50b7){_0x35daf0['push'](_0x35daf0['shift']());}}}(a251_0x580e,0x8270a));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';function a251_0x580e(){const _0x615a31=['30bGePXl','3101508liExYW','287RWzvGR','1703320gXtpHd','572376eFGpSU','1fAFYGF','1197048kMcwvn','25ZOTqQJ','575358OpJLbU','18632FJoPpn','1793891ZUmbas'];a251_0x580e=function(){return _0x615a31;};return a251_0x580e();}import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';function a251_0x43a0(_0x579ea5,_0x2b59b4){_0x579ea5=_0x579ea5-0xeb;const _0x580e84=a251_0x580e();let _0x43a0ff=_0x580e84[_0x579ea5];return _0x43a0ff;}export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a252_0x3d4597=a252_0x5354;function a252_0x3e8b(){const _0x4d2fd1=['sqlCode','Filter\x20by\x20SQL\x20name','appCode','length','sqlName','read','List\x20custom\x20SQL\x20queries','63430cZzkEb','848066DYMWzN','dbId','327950WtNOrl','string','all','str','7208pKGswK','516TKfioh','6BVZCip','number','bool','126079mRlwRm','verbose','list','Page\x20number','\x20SQL\x20queries\x20(total:\x20','map','1623704IFLRAG','Found\x20','description','totalCount','num','pagesize','Page\x20size','sql','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','1061770XlsNWt','9hLCvip','name','tableData'];a252_0x3e8b=function(){return _0x4d2fd1;};return a252_0x3e8b();}(function(_0x1fa2a7,_0x492bc2){const _0xdf5367=a252_0x5354,_0x2b5ab2=_0x1fa2a7();while(!![]){try{const _0x438fe7=-parseInt(_0xdf5367(0x13b))/0x1+parseInt(_0xdf5367(0x156))/0x2+parseInt(_0xdf5367(0x15d))/0x3*(parseInt(_0xdf5367(0x15c))/0x4)+parseInt(_0xdf5367(0x155))/0x5*(parseInt(_0xdf5367(0x138))/0x6)+-parseInt(_0xdf5367(0x158))/0x7+-parseInt(_0xdf5367(0x141))/0x8+parseInt(_0xdf5367(0x14b))/0x9*(-parseInt(_0xdf5367(0x14a))/0xa);if(_0x438fe7===_0x492bc2)break;else _0x2b5ab2['push'](_0x2b5ab2['shift']());}catch(_0x5566ea){_0x2b5ab2['push'](_0x2b5ab2['shift']());}}}(a252_0x3e8b,0x40992));import{listSqlQueries}from'../../core/api-client.js';function a252_0x5354(_0x3a75a4,_0x58e033){_0x3a75a4=_0x3a75a4-0x138;const _0x3e8b4a=a252_0x3e8b();let _0x5354d4=_0x3e8b4a[_0x3a75a4];return _0x5354d4;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a252_0x3d4597(0x148),'command':a252_0x3d4597(0x13d),'description':a252_0x3d4597(0x154),'risk':a252_0x3d4597(0x153),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0x3d4597(0x14c),'type':a252_0x3d4597(0x159),'description':a252_0x3d4597(0x14f)},{'name':'page','type':a252_0x3d4597(0x139),'description':a252_0x3d4597(0x13e),'default':0x1},{'name':'pagesize','type':a252_0x3d4597(0x139),'description':a252_0x3d4597(0x147)},{'name':a252_0x3d4597(0x13c),'type':'boolean','description':a252_0x3d4597(0x149)}],async 'execute'(_0x232774){const _0x5bf692=a252_0x3d4597,_0x52df2e=await listSqlQueries(_0x232774[_0x5bf692(0x150)],{'sqlCode':_0x232774[_0x5bf692(0x15b)]('sqlcode')||undefined,'sqlName':_0x232774['str'](_0x5bf692(0x14c))||undefined,'currentPage':_0x232774[_0x5bf692(0x145)]('page'),'pageSize':_0x232774['num'](_0x5bf692(0x146),0x32)}),_0x1d5bb3=_0x232774[_0x5bf692(0x13a)](_0x5bf692(0x13c)),_0x5dc258=_0x52df2e[_0x5bf692(0x14d)]??[],_0x407246=_0x52df2e['paging']?.[_0x5bf692(0x144)]??_0x5dc258[_0x5bf692(0x151)];let _0x292df6;return _0x1d5bb3?_0x292df6=_0x5dc258:_0x292df6=await Promise[_0x5bf692(0x15a)](_0x5dc258[_0x5bf692(0x140)](async _0x1bade7=>{const _0x5ed799=_0x5bf692;let _0x5c0d56;try{_0x5c0d56=_0x1bade7[_0x5ed799(0x157)]?await getDbName(_0x232774[_0x5ed799(0x150)],_0x1bade7[_0x5ed799(0x157)]):undefined;}catch{}return{'sqlCode':_0x1bade7[_0x5ed799(0x14e)],'sqlName':_0x1bade7[_0x5ed799(0x152)],'description':_0x1bade7[_0x5ed799(0x143)]??'','db':_0x5c0d56?_0x5c0d56+'\x20('+_0x1bade7[_0x5ed799(0x157)]+')':_0x1bade7[_0x5ed799(0x157)]??''};})),{'ok':!![],'data':_0x292df6,'message':_0x5dc258[_0x5bf692(0x151)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x5bf692(0x142)+_0x5dc258['length']+_0x5bf692(0x13f)+_0x407246+').'};}};
1
+ const a252_0x271b6a=a252_0x6431;function a252_0x330f(){const _0x276cfd=['No\x20custom\x20SQL\x20queries\x20found.','paging','pagesize','3198540DxqsVH','string','10aSupCJ','\x20SQL\x20queries\x20(total:\x20','dbId','Page\x20number','479436CvRZDL','2846OZcRSv','verbose','sqlName','109896CKssDq','1050XkzZyD','48hqvEFx','Page\x20size','appCode','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','sqlcode','List\x20custom\x20SQL\x20queries','page','sql','boolean','27aXOQKB','tableData','Filter\x20by\x20SQL\x20name','1042632DOxtLO','number','231114SAFdBl','description','name','28anrkqF','bool','length','3942466EIDfIp','totalCount','read','num','sqlCode','str'];a252_0x330f=function(){return _0x276cfd;};return a252_0x330f();}(function(_0x1b0fac,_0x437b7b){const _0x4793e5=a252_0x6431,_0x5c79ad=_0x1b0fac();while(!![]){try{const _0x52d718=parseInt(_0x4793e5(0x127))/0x1+-parseInt(_0x4793e5(0x124))/0x2*(-parseInt(_0x4793e5(0x128))/0x3)+-parseInt(_0x4793e5(0x123))/0x4*(-parseInt(_0x4793e5(0x11f))/0x5)+-parseInt(_0x4793e5(0x10e))/0x6*(-parseInt(_0x4793e5(0x111))/0x7)+-parseInt(_0x4793e5(0x10c))/0x8*(-parseInt(_0x4793e5(0x132))/0x9)+parseInt(_0x4793e5(0x11d))/0xa+parseInt(_0x4793e5(0x114))/0xb*(-parseInt(_0x4793e5(0x129))/0xc);if(_0x52d718===_0x437b7b)break;else _0x5c79ad['push'](_0x5c79ad['shift']());}catch(_0x5b0705){_0x5c79ad['push'](_0x5c79ad['shift']());}}}(a252_0x330f,0x441ad));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a252_0x6431(_0x2515c6,_0x3b9c02){_0x2515c6=_0x2515c6-0x10c;const _0x330f4d=a252_0x330f();let _0x6431cd=_0x330f4d[_0x2515c6];return _0x6431cd;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a252_0x271b6a(0x130),'command':'list','description':a252_0x271b6a(0x12e),'risk':a252_0x271b6a(0x116),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a252_0x271b6a(0x11e),'description':a252_0x271b6a(0x134)},{'name':a252_0x271b6a(0x12f),'type':'number','description':a252_0x271b6a(0x122),'default':0x1},{'name':'pagesize','type':a252_0x271b6a(0x10d),'description':a252_0x271b6a(0x12a)},{'name':a252_0x271b6a(0x125),'type':a252_0x271b6a(0x131),'description':a252_0x271b6a(0x12c)}],async 'execute'(_0xb5340f){const _0xba9955=a252_0x271b6a,_0x53c94d=await listSqlQueries(_0xb5340f[_0xba9955(0x12b)],{'sqlCode':_0xb5340f[_0xba9955(0x119)](_0xba9955(0x12d))||undefined,'sqlName':_0xb5340f[_0xba9955(0x119)](_0xba9955(0x110))||undefined,'currentPage':_0xb5340f[_0xba9955(0x117)](_0xba9955(0x12f)),'pageSize':_0xb5340f['num'](_0xba9955(0x11c),0x32)}),_0x32e89c=_0xb5340f[_0xba9955(0x112)](_0xba9955(0x125)),_0x1942b2=_0x53c94d[_0xba9955(0x133)]??[],_0xce18be=_0x53c94d[_0xba9955(0x11b)]?.[_0xba9955(0x115)]??_0x1942b2['length'];let _0x5c9ca9;return _0x32e89c?_0x5c9ca9=_0x1942b2:_0x5c9ca9=await Promise['all'](_0x1942b2['map'](async _0x175a61=>{const _0x323c4e=_0xba9955;let _0x4027b0;try{_0x4027b0=_0x175a61[_0x323c4e(0x121)]?await getDbName(_0xb5340f[_0x323c4e(0x12b)],_0x175a61[_0x323c4e(0x121)]):undefined;}catch{}return{'sqlCode':_0x175a61[_0x323c4e(0x118)],'sqlName':_0x175a61[_0x323c4e(0x126)],'description':_0x175a61[_0x323c4e(0x10f)]??'','db':_0x4027b0?_0x4027b0+'\x20('+_0x175a61[_0x323c4e(0x121)]+')':_0x175a61[_0x323c4e(0x121)]??''};})),{'ok':!![],'data':_0x5c9ca9,'message':_0x1942b2[_0xba9955(0x113)]===0x0?_0xba9955(0x11a):'Found\x20'+_0x1942b2['length']+_0xba9955(0x120)+_0xce18be+').'};}};
@@ -1 +1 @@
1
- const a253_0x45e837=a253_0x4729;(function(_0x2251ca,_0x5a2176){const _0x72d556=a253_0x4729,_0x1bbb30=_0x2251ca();while(!![]){try{const _0x38bb27=-parseInt(_0x72d556(0x205))/0x1*(parseInt(_0x72d556(0x1e3))/0x2)+parseInt(_0x72d556(0x1e9))/0x3+parseInt(_0x72d556(0x1d9))/0x4*(-parseInt(_0x72d556(0x1fe))/0x5)+parseInt(_0x72d556(0x1fb))/0x6*(-parseInt(_0x72d556(0x1c2))/0x7)+parseInt(_0x72d556(0x1d6))/0x8+-parseInt(_0x72d556(0x1c3))/0x9*(parseInt(_0x72d556(0x1c7))/0xa)+parseInt(_0x72d556(0x1f2))/0xb;if(_0x38bb27===_0x5a2176)break;else _0x1bbb30['push'](_0x1bbb30['shift']());}catch(_0x5d9f74){_0x1bbb30['push'](_0x1bbb30['shift']());}}}(a253_0xd133,0xc7e68));function a253_0xd133(){const _0x5e6d45=['387FUDXEi','Force\x20overwrite\x20local\x20unsynced\x20changes','filter','map','357950goFFbg','paging','Filter\x20by\x20SQL\x20display\x20name','split','No\x20remote\x20SQL\x20queries\x20matched.','toISOString','utf8','sqlRoot','some','\x20SQL\x20file(s)\x20into\x20','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','filePath','conflict','skipped','Pull\x20complete:\x20','12557640bsVggT','all','sqlCode','12nFzrwk','equivalent','pull','Would\x20pull\x20','sql','would_pull','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqls','sqlcode','tableData','1578lxDqfF','push','test','catch','description','\x20skipped,\x20','2736924hplCAR','replace','str','sqlName','\x20failed','nonInteractive','.xml','totalCount','sqlRootDir','7951174zOqjff','find','file','path','length','boolean','sqlContent','mode','mybatisXml','135060DnWlGO','message','force','132095svaYMs','\x20written,\x20','unchanged','isCanonical','string','POST','lockFilePath','117rCCNFl','dbId','hash','content','appCode','cancelled','join','read','name','210iORJJZ'];a253_0xd133=function(){return _0x5e6d45;};return a253_0xd133();}import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';function a253_0x4729(_0x266638,_0x1159be){_0x266638=_0x266638-0x1bc;const _0xd13358=a253_0xd133();let _0x4729a5=_0xd13358[_0x266638];return _0x4729a5;}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x442961,_0x1731cb){const _0x5c59a8=a253_0x4729,_0x271dae=[];let _0x50d2ce=0x1;while(!![]){const _0x382ce3=await listSqlQueries(_0x442961,{'currentPage':_0x50d2ce,'pageSize':PAGE_SIZE,'sqlCode':_0x1731cb['sqlCode'],'sqlName':_0x1731cb[_0x5c59a8(0x1ec)]}),_0x39c32e=_0x382ce3[_0x5c59a8(0x1e2)]??[];_0x271dae[_0x5c59a8(0x1e4)](..._0x39c32e);if(_0x39c32e['length']===0x0)break;const _0xd0274d=_0x382ce3[_0x5c59a8(0x1c8)]?.[_0x5c59a8(0x1f0)];if(_0xd0274d!=null?_0x271dae[_0x5c59a8(0x1f6)]>=_0xd0274d:_0x39c32e[_0x5c59a8(0x1f6)]<PAGE_SIZE)break;_0x50d2ce++;}return _0x271dae;}async function ensureSqlContent(_0x3fd441){const _0x896c2a=a253_0x4729;if(_0x3fd441[_0x896c2a(0x1f8)]!=null&&String(_0x3fd441['sqlContent'])[_0x896c2a(0x1f6)]>0x0)return _0x3fd441;return getSqlQueryDetail(_0x3fd441[_0x896c2a(0x1d8)]);}export const sqlPull={'service':'sql','command':a253_0x45e837(0x1db),'description':a253_0x45e837(0x1df),'risk':a253_0x45e837(0x1c0),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x45e837(0x1c1),'type':a253_0x45e837(0x202),'description':a253_0x45e837(0x1c9)},{'name':a253_0x45e837(0x1fd),'type':a253_0x45e837(0x1f7),'description':a253_0x45e837(0x1c4)}],async 'dryRun'(_0x16a970){const _0x439c2b=a253_0x45e837,_0x4b4ab3=loadSqlProjectConfig(_0x16a970['appCode']),_0x39347f=await readSqlLockFile(_0x4b4ab3['lockFilePath']),{appLock:_0x22828d}=ensureSqlLockScope(_0x39347f??createEmptySqlLock(),_0x4b4ab3[_0x439c2b(0x1bd)],_0x4b4ab3[_0x439c2b(0x1ce)],_0x439c2b(0x1db)),_0x448ce6=await fetchAllSqlQueries(_0x16a970[_0x439c2b(0x1bd)],{'sqlCode':_0x16a970[_0x439c2b(0x1eb)](_0x439c2b(0x1e1))||undefined,'sqlName':_0x16a970['str'](_0x439c2b(0x1c1))||undefined}),_0xb39782=[];for(const _0x41526b of _0x448ce6){const _0x470a44=await ensureSqlContent(_0x41526b),_0x55f11a=ensureRemoteSqlContent(_0x470a44),_0x39634c=detectSqlMode(_0x55f11a),_0x5472a0=_0x470a44[_0x439c2b(0x206)]?await getDbName(_0x16a970['appCode'],Number(_0x470a44[_0x439c2b(0x206)]))[_0x439c2b(0x1e6)](()=>undefined):undefined,_0x52931e=buildLocalSqlFileContent({'sqlCode':_0x470a44[_0x439c2b(0x1d8)],'sqlName':_0x470a44[_0x439c2b(0x1ec)],'dbId':_0x470a44['dbId']},_0x55f11a,{'dbName':_0x5472a0,'mode':_0x39634c,'syncedAt':new Date()['toISOString'](),'description':_0x470a44['description']}),_0x14e16c=buildSqlLockEntry(_0x470a44,_0x55f11a,'',{'dbName':_0x5472a0}),_0x1f3ecb=resolveLocalSqlFilePath(_0x4b4ab3,_0x470a44[_0x439c2b(0x1d8)],_0x14e16c);let _0x35fbe8=_0x439c2b(0x1de),_0x5bcb86;const _0x12db4c=await findExistingSqlFiles(_0x4b4ab3,_0x1f3ecb,_0x39634c,_0x22828d['sqls'][_0x470a44[_0x439c2b(0x1d8)]]);if(_0x12db4c[_0x439c2b(0x1f6)]>0x0){const _0x4e1eb1=await compareExistingSqlFiles(_0x12db4c,_0x52931e,_0x39634c);if(_0x4e1eb1[_0x439c2b(0x1cf)](({equivalent:_0x5b54d5})=>!_0x5b54d5))_0x35fbe8=_0x439c2b(0x1d3),_0x5bcb86='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)';else _0x4e1eb1[_0x439c2b(0x1f6)]===0x1&&_0x4e1eb1[0x0]?.[_0x439c2b(0x1f4)][_0x439c2b(0x201)]&&(_0x35fbe8=_0x439c2b(0x1d4),_0x5bcb86=_0x439c2b(0x200));}_0xb39782[_0x439c2b(0x1e4)]({'sqlCode':_0x470a44[_0x439c2b(0x1d8)],'sqlName':_0x470a44['sqlName'],'filePath':_0x1f3ecb,'status':_0x35fbe8,'reason':_0x5bcb86});}return{'method':_0x439c2b(0x203),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x16a970[_0x439c2b(0x1bd)],'sqlCode':_0x16a970['str'](_0x439c2b(0x1e1))||null,'sqlName':_0x16a970[_0x439c2b(0x1eb)](_0x439c2b(0x1c1))||null,'files':_0xb39782},'description':_0x439c2b(0x1dc)+_0xb39782[_0x439c2b(0x1f6)]+_0x439c2b(0x1d0)+_0x4b4ab3[_0x439c2b(0x1f1)]};},async 'execute'(_0x401e46){const _0x31a170=a253_0x45e837,_0x49c765=loadSqlProjectConfig(_0x401e46[_0x31a170(0x1bd)]),_0x54e331=await readSqlLockFile(_0x49c765[_0x31a170(0x204)]),{lockData:_0x848df,appLock:_0x27c70c}=ensureSqlLockScope(_0x54e331??createEmptySqlLock(),_0x49c765['appCode'],_0x49c765['sqlRoot'],_0x31a170(0x1db)),_0x2b1c22=_0x401e46['bool']('force'),_0xfb8191=await fetchAllSqlQueries(_0x401e46[_0x31a170(0x1bd)],{'sqlCode':_0x401e46['str'](_0x31a170(0x1e1))||undefined,'sqlName':_0x401e46[_0x31a170(0x1eb)]('name')||undefined});if(_0xfb8191[_0x31a170(0x1f6)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x31a170(0x1cb)};const _0x2ba31e=[],_0x4d3fff=[];for(const _0x5a4196 of _0xfb8191){try{_0x2ba31e[_0x31a170(0x1e4)](await ensureSqlContent(_0x5a4196));}catch(_0x20f1b8){_0x4d3fff['push']({'sqlCode':_0x5a4196['sqlCode'],'error':_0x20f1b8 instanceof Error?_0x20f1b8['message']:String(_0x20f1b8)});}}if(_0x2b1c22&&!_0x401e46[_0x31a170(0x1ee)]){let _0x508699=![];for(const _0x146ae9 of _0x2ba31e){const _0x1ded8c=detectSqlMode(ensureRemoteSqlContent(_0x146ae9)),_0x3d149e=_0x146ae9['dbId']?await getDbName(_0x401e46[_0x31a170(0x1bd)],Number(_0x146ae9[_0x31a170(0x206)]))[_0x31a170(0x1e6)](()=>undefined):undefined,_0x30e73d=buildLocalSqlFileContent({'sqlCode':_0x146ae9[_0x31a170(0x1d8)],'sqlName':_0x146ae9['sqlName'],'dbId':_0x146ae9['dbId']},ensureRemoteSqlContent(_0x146ae9),{'dbName':_0x3d149e,'mode':_0x1ded8c,'syncedAt':new Date()[_0x31a170(0x1cc)](),'description':_0x146ae9[_0x31a170(0x1e7)]}),_0x4c2702=resolveLocalSqlFilePath(_0x49c765,_0x146ae9[_0x31a170(0x1d8)],buildSqlLockEntry(_0x146ae9,ensureRemoteSqlContent(_0x146ae9),'',{'dbName':_0x3d149e})),_0x589fe9=await findExistingSqlFiles(_0x49c765,_0x4c2702,_0x1ded8c,_0x27c70c[_0x31a170(0x1e0)][_0x146ae9[_0x31a170(0x1d8)]]),_0x40517e=await compareExistingSqlFiles(_0x589fe9,_0x30e73d,_0x1ded8c);if(_0x40517e['some'](({equivalent:_0xe2769b})=>!_0xe2769b)){_0x508699=!![];break;}}if(_0x508699){const _0xaa7732=await confirmForceOverwrite(_0x31a170(0x1d1));if(!_0xaa7732)throw CliErrors[_0x31a170(0x1be)]('Force\x20pull\x20cancelled.');}}const _0x4313dd=cloneSqlLockData(_0x848df),_0x3f445e=_0x4313dd['apps'][_0x49c765['appCode']],_0x593e16=[],_0x221499=[];for(const _0x1471f4 of _0x2ba31e){const _0x39fd49=_0x3f445e[_0x31a170(0x1e0)][_0x1471f4[_0x31a170(0x1d8)]],_0x52b7bd=ensureRemoteSqlContent(_0x1471f4),_0x5ce21f=detectSqlMode(_0x52b7bd),_0x24a34d=_0x1471f4[_0x31a170(0x206)]?await getDbName(_0x401e46[_0x31a170(0x1bd)],Number(_0x1471f4[_0x31a170(0x206)]))[_0x31a170(0x1e6)](()=>undefined):undefined,_0x383412=buildLocalSqlFileContent({'sqlCode':_0x1471f4[_0x31a170(0x1d8)],'sqlName':_0x1471f4[_0x31a170(0x1ec)],'dbId':_0x1471f4['dbId']},_0x52b7bd,{'dbName':_0x24a34d,'mode':_0x5ce21f,'syncedAt':new Date()[_0x31a170(0x1cc)](),'description':_0x1471f4[_0x31a170(0x1e7)]}),_0x49cdb1=buildSqlLockEntry(_0x1471f4,_0x52b7bd,computeSqlContentHash(_0x383412),{'dbName':_0x24a34d}),_0x375e19=_0x49cdb1[_0x31a170(0x1f5)],_0x2302ce=join(_0x49c765[_0x31a170(0x1f1)],_0x375e19);try{const _0x5037b3=await findExistingSqlFiles(_0x49c765,_0x2302ce,_0x5ce21f,_0x39fd49),_0xc065a9=await compareExistingSqlFiles(_0x5037b3,_0x383412,_0x5ce21f);if(!_0x2b1c22&&_0xc065a9['some'](({equivalent:_0x50bba7})=>!_0x50bba7)){_0x221499[_0x31a170(0x1e4)]({'sqlCode':_0x1471f4[_0x31a170(0x1d8)],'reason':'local\x20differs\x20from\x20remote'});continue;}const _0x5d0a38=_0xc065a9[_0x31a170(0x1f3)](({file:_0xf784a6})=>_0xf784a6['isCanonical']),_0x596852=_0xc065a9[_0x31a170(0x1f3)](({file:_0x1185bd})=>!_0x1185bd['isCanonical']);if(_0x5d0a38?.[_0x31a170(0x1da)]&&!_0x596852){_0x221499[_0x31a170(0x1e4)]({'sqlCode':_0x1471f4[_0x31a170(0x1d8)],'reason':_0x31a170(0x200)}),_0x3f445e[_0x31a170(0x1e0)][_0x1471f4[_0x31a170(0x1d8)]]={..._0x49cdb1,'hash':computeSqlContentHash(_0x5d0a38[_0x31a170(0x1bc)]),'path':_0x375e19};continue;}!_0x5d0a38?.['equivalent']&&(await ensureParentDirectory(_0x2302ce),await writeFile(_0x2302ce,_0x383412,_0x31a170(0x1cd))),_0x596852&&await rm(_0x596852[_0x31a170(0x1f4)]['filePath'],{'force':!![]}),_0x3f445e[_0x31a170(0x1e0)][_0x1471f4['sqlCode']]={..._0x49cdb1,'hash':_0x5d0a38?.[_0x31a170(0x1da)]?computeSqlContentHash(_0x5d0a38[_0x31a170(0x1bc)]):_0x49cdb1[_0x31a170(0x207)],'path':_0x375e19},_0x593e16[_0x31a170(0x1e4)]({'sqlCode':_0x1471f4[_0x31a170(0x1d8)],'filePath':_0x2302ce});}catch(_0x289a6d){_0x4d3fff[_0x31a170(0x1e4)]({'sqlCode':_0x1471f4[_0x31a170(0x1d8)],'error':_0x289a6d instanceof Error?_0x289a6d[_0x31a170(0x1fc)]:String(_0x289a6d)});}}return _0x3f445e['lastSync']=new Date()[_0x31a170(0x1cc)](),await writeSqlLockFile(_0x49c765[_0x31a170(0x204)],_0x4313dd),{'ok':_0x4d3fff[_0x31a170(0x1f6)]===0x0,'data':{'pulled':_0x593e16,'skipped':_0x221499,'failed':_0x4d3fff},'message':_0x31a170(0x1d5)+_0x593e16[_0x31a170(0x1f6)]+_0x31a170(0x1ff)+_0x221499[_0x31a170(0x1f6)]+_0x31a170(0x1e8)+_0x4d3fff[_0x31a170(0x1f6)]+_0x31a170(0x1ed)};}};function isEquivalentPulledSqlFile(_0xffc9f4,_0x3b36e8,_0x133f38,_0x34392b){if(_0x133f38!==_0x34392b)return normalizePulledSqlBody(_0xffc9f4,_0x133f38)===normalizePulledSqlBody(_0x3b36e8,_0x34392b);return normalizePullComparableContent(_0xffc9f4,_0x133f38)===normalizePullComparableContent(_0x3b36e8,_0x34392b);}async function findExistingSqlFiles(_0x5b5da0,_0x40a1d9,_0x2eb291,_0x464531){const _0x16a416=a253_0x45e837,_0x3e201c=[];await fileExists(_0x40a1d9)&&_0x3e201c[_0x16a416(0x1e4)]({'filePath':_0x40a1d9,'mode':_0x2eb291,'isCanonical':!![]});if(!_0x464531?.[_0x16a416(0x1f5)])return _0x3e201c;const _0x3ceea7=join(_0x5b5da0[_0x16a416(0x1f1)],_0x464531[_0x16a416(0x1f5)]);if(_0x3ceea7===_0x40a1d9)return _0x3e201c;return await fileExists(_0x3ceea7)&&_0x3e201c[_0x16a416(0x1e4)]({'filePath':_0x3ceea7,'mode':_0x464531[_0x16a416(0x1f9)]??modeFromFilePath(_0x3ceea7),'isCanonical':![]}),_0x3e201c;}async function compareExistingSqlFiles(_0xb3738c,_0x5e8cb3,_0x5b3da9){const _0x5ad54c=a253_0x45e837;return Promise[_0x5ad54c(0x1d7)](_0xb3738c[_0x5ad54c(0x1c6)](async _0x365429=>{const _0xef890b=_0x5ad54c,_0x547035=await readFile(_0x365429[_0xef890b(0x1d2)],_0xef890b(0x1cd));return{'file':_0x365429,'content':_0x547035,'equivalent':isEquivalentPulledSqlFile(_0x547035,_0x5e8cb3,_0x365429[_0xef890b(0x1f9)],_0x5b3da9)};}));}function modeFromFilePath(_0x4d05b6){const _0x2ae7a7=a253_0x45e837;return _0x4d05b6['toLowerCase']()['endsWith'](_0x2ae7a7(0x1ef))?'mybatisXml':_0x2ae7a7(0x1dd);}function normalizePulledSqlBody(_0x39ad05,_0x435bb5){return stripLocalSqlMetadata(_0x39ad05,_0x435bb5)['replace'](/\r\n/g,'\x0a')['trim']();}function normalizePullComparableContent(_0x7220a6,_0x4e812b){const _0x59d89e=a253_0x45e837,_0x395816=_0x7220a6[_0x59d89e(0x1ea)](/\r\n/g,'\x0a')[_0x59d89e(0x1ca)]('\x0a'),_0x51a69a=_0x395816[_0x59d89e(0x1c5)](_0x57e798=>!isSyncedAtMetadataLine(_0x57e798,_0x4e812b));return _0x51a69a[_0x59d89e(0x1bf)]('\x0a');}function isSyncedAtMetadataLine(_0x10ed7,_0x423bef){const _0x2a1b5a=a253_0x45e837;if(_0x423bef===_0x2a1b5a(0x1fa))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x2a1b5a(0x1e5)](_0x10ed7);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x2a1b5a(0x1e5)](_0x10ed7);}
1
+ function a253_0x5c2d(_0x5e993c,_0xd35125){_0x5e993c=_0x5e993c-0xea;const _0x42169e=a253_0x4216();let _0x5c2d06=_0x42169e[_0x5e993c];return _0x5c2d06;}const a253_0x3c610b=a253_0x5c2d;(function(_0x564075,_0x4713b7){const _0x3745f9=a253_0x5c2d,_0x3733d2=_0x564075();while(!![]){try{const _0xf5bc23=parseInt(_0x3745f9(0x12d))/0x1+-parseInt(_0x3745f9(0x116))/0x2+-parseInt(_0x3745f9(0x109))/0x3+parseInt(_0x3745f9(0xf6))/0x4*(-parseInt(_0x3745f9(0x113))/0x5)+-parseInt(_0x3745f9(0xf9))/0x6*(parseInt(_0x3745f9(0x129))/0x7)+parseInt(_0x3745f9(0x117))/0x8+parseInt(_0x3745f9(0xfb))/0x9;if(_0xf5bc23===_0x4713b7)break;else _0x3733d2['push'](_0x3733d2['shift']());}catch(_0x3b7a05){_0x3733d2['push'](_0x3733d2['shift']());}}}(a253_0x4216,0xd2347));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(_0x65cd7a,_0x2d4d43){const _0x1f3455=a253_0x5c2d,_0x1c33bd=[];let _0x777da8=0x1;while(!![]){const _0x5a2bcb=await listSqlQueries(_0x65cd7a,{'currentPage':_0x777da8,'pageSize':PAGE_SIZE,'sqlCode':_0x2d4d43[_0x1f3455(0xea)],'sqlName':_0x2d4d43[_0x1f3455(0x10a)]}),_0x2bd9fb=_0x5a2bcb[_0x1f3455(0x114)]??[];_0x1c33bd[_0x1f3455(0x108)](..._0x2bd9fb);if(_0x2bd9fb['length']===0x0)break;const _0x5b6246=_0x5a2bcb[_0x1f3455(0x110)]?.[_0x1f3455(0x12f)];if(_0x5b6246!=null?_0x1c33bd[_0x1f3455(0x104)]>=_0x5b6246:_0x2bd9fb[_0x1f3455(0x104)]<PAGE_SIZE)break;_0x777da8++;}return _0x1c33bd;}async function ensureSqlContent(_0xce28b4){const _0x13584f=a253_0x5c2d;if(_0xce28b4[_0x13584f(0xf2)]!=null&&String(_0xce28b4[_0x13584f(0xf2)])[_0x13584f(0x104)]>0x0)return _0xce28b4;return getSqlQueryDetail(_0xce28b4[_0x13584f(0xea)]);}function a253_0x4216(){const _0x240e0a=['appCode','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','string','endsWith','force','would_pull','sql','apps','length','\x20skipped,\x20','equivalent','bool','push','2151258TcPpsE','sqlName','message','\x20SQL\x20file(s)\x20into\x20','description','sqlRoot','skipped','paging','Would\x20pull\x20','replace','1434305JkUGbI','tableData','toLowerCase','1964296bRAbvz','7041600wQqwfr','filter','path','sqlRootDir','unchanged','content','mode','isCanonical','Pull\x20complete:\x20','pull','sqls','file','POST','boolean','sqlcode','filePath','nonInteractive','name','28jOFvCN','utf8','dbId','str','1293034SKhkmg','find','totalCount','cancelled','trim','sqlCode','test','No\x20remote\x20SQL\x20queries\x20matched.','.xml','all','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','map','split','sqlContent','lastSync','some','toISOString','4szhApn','mybatisXml','\x20failed','543534HzDLOM','catch','9325944SBRIav'];a253_0x4216=function(){return _0x240e0a;};return a253_0x4216();}export const sqlPull={'service':'sql','command':a253_0x3c610b(0x120),'description':a253_0x3c610b(0xfd),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x3c610b(0x128),'type':a253_0x3c610b(0xfe),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a253_0x3c610b(0x100),'type':a253_0x3c610b(0x124),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x5b1fea){const _0x26c36c=a253_0x3c610b,_0x5e84e4=loadSqlProjectConfig(_0x5b1fea['appCode']),_0x552dc8=await readSqlLockFile(_0x5e84e4['lockFilePath']),{appLock:_0x45e51b}=ensureSqlLockScope(_0x552dc8??createEmptySqlLock(),_0x5e84e4[_0x26c36c(0xfc)],_0x5e84e4[_0x26c36c(0x10e)],_0x26c36c(0x120)),_0x5b1842=await fetchAllSqlQueries(_0x5b1fea[_0x26c36c(0xfc)],{'sqlCode':_0x5b1fea[_0x26c36c(0x12c)](_0x26c36c(0x125))||undefined,'sqlName':_0x5b1fea[_0x26c36c(0x12c)](_0x26c36c(0x128))||undefined}),_0xa38cc5=[];for(const _0x3fcca8 of _0x5b1842){const _0x2a9d96=await ensureSqlContent(_0x3fcca8),_0x133db9=ensureRemoteSqlContent(_0x2a9d96),_0x5c9dbb=detectSqlMode(_0x133db9),_0x9ba50d=_0x2a9d96[_0x26c36c(0x12b)]?await getDbName(_0x5b1fea['appCode'],Number(_0x2a9d96[_0x26c36c(0x12b)]))[_0x26c36c(0xfa)](()=>undefined):undefined,_0x53fdb4=buildLocalSqlFileContent({'sqlCode':_0x2a9d96[_0x26c36c(0xea)],'sqlName':_0x2a9d96[_0x26c36c(0x10a)],'dbId':_0x2a9d96[_0x26c36c(0x12b)]},_0x133db9,{'dbName':_0x9ba50d,'mode':_0x5c9dbb,'syncedAt':new Date()[_0x26c36c(0xf5)](),'description':_0x2a9d96[_0x26c36c(0x10d)]}),_0x1c19fb=buildSqlLockEntry(_0x2a9d96,_0x133db9,'',{'dbName':_0x9ba50d}),_0x347aff=resolveLocalSqlFilePath(_0x5e84e4,_0x2a9d96['sqlCode'],_0x1c19fb);let _0x528df0=_0x26c36c(0x101),_0x2dfdcc;const _0x67371b=await findExistingSqlFiles(_0x5e84e4,_0x347aff,_0x5c9dbb,_0x45e51b[_0x26c36c(0x121)][_0x2a9d96[_0x26c36c(0xea)]]);if(_0x67371b[_0x26c36c(0x104)]>0x0){const _0x5f208a=await compareExistingSqlFiles(_0x67371b,_0x53fdb4,_0x5c9dbb);if(_0x5f208a['some'](({equivalent:_0x2e57d9})=>!_0x2e57d9))_0x528df0='conflict',_0x2dfdcc=_0x26c36c(0xef);else _0x5f208a[_0x26c36c(0x104)]===0x1&&_0x5f208a[0x0]?.[_0x26c36c(0x122)]['isCanonical']&&(_0x528df0=_0x26c36c(0x10f),_0x2dfdcc='unchanged');}_0xa38cc5[_0x26c36c(0x108)]({'sqlCode':_0x2a9d96[_0x26c36c(0xea)],'sqlName':_0x2a9d96[_0x26c36c(0x10a)],'filePath':_0x347aff,'status':_0x528df0,'reason':_0x2dfdcc});}return{'method':_0x26c36c(0x123),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x5b1fea[_0x26c36c(0xfc)],'sqlCode':_0x5b1fea['str'](_0x26c36c(0x125))||null,'sqlName':_0x5b1fea['str'](_0x26c36c(0x128))||null,'files':_0xa38cc5},'description':_0x26c36c(0x111)+_0xa38cc5[_0x26c36c(0x104)]+_0x26c36c(0x10c)+_0x5e84e4[_0x26c36c(0x11a)]};},async 'execute'(_0x339fbc){const _0x3cd686=a253_0x3c610b,_0x379e82=loadSqlProjectConfig(_0x339fbc[_0x3cd686(0xfc)]),_0x30fcd8=await readSqlLockFile(_0x379e82['lockFilePath']),{lockData:_0xfeda5a,appLock:_0x14a4a9}=ensureSqlLockScope(_0x30fcd8??createEmptySqlLock(),_0x379e82['appCode'],_0x379e82[_0x3cd686(0x10e)],'pull'),_0x180d86=_0x339fbc[_0x3cd686(0x107)]('force'),_0x146ea1=await fetchAllSqlQueries(_0x339fbc[_0x3cd686(0xfc)],{'sqlCode':_0x339fbc['str'](_0x3cd686(0x125))||undefined,'sqlName':_0x339fbc[_0x3cd686(0x12c)](_0x3cd686(0x128))||undefined});if(_0x146ea1[_0x3cd686(0x104)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x3cd686(0xec)};const _0x29aa24=[],_0x2c4252=[];for(const _0x3371c4 of _0x146ea1){try{_0x29aa24['push'](await ensureSqlContent(_0x3371c4));}catch(_0x2d628c){_0x2c4252[_0x3cd686(0x108)]({'sqlCode':_0x3371c4[_0x3cd686(0xea)],'error':_0x2d628c instanceof Error?_0x2d628c[_0x3cd686(0x10b)]:String(_0x2d628c)});}}if(_0x180d86&&!_0x339fbc[_0x3cd686(0x127)]){let _0x1058b8=![];for(const _0x45f10f of _0x29aa24){const _0x2444f2=detectSqlMode(ensureRemoteSqlContent(_0x45f10f)),_0x536e9d=_0x45f10f['dbId']?await getDbName(_0x339fbc[_0x3cd686(0xfc)],Number(_0x45f10f[_0x3cd686(0x12b)]))[_0x3cd686(0xfa)](()=>undefined):undefined,_0xb4a3e=buildLocalSqlFileContent({'sqlCode':_0x45f10f[_0x3cd686(0xea)],'sqlName':_0x45f10f[_0x3cd686(0x10a)],'dbId':_0x45f10f[_0x3cd686(0x12b)]},ensureRemoteSqlContent(_0x45f10f),{'dbName':_0x536e9d,'mode':_0x2444f2,'syncedAt':new Date()[_0x3cd686(0xf5)](),'description':_0x45f10f[_0x3cd686(0x10d)]}),_0x1f99b4=resolveLocalSqlFilePath(_0x379e82,_0x45f10f['sqlCode'],buildSqlLockEntry(_0x45f10f,ensureRemoteSqlContent(_0x45f10f),'',{'dbName':_0x536e9d})),_0x2f3c70=await findExistingSqlFiles(_0x379e82,_0x1f99b4,_0x2444f2,_0x14a4a9[_0x3cd686(0x121)][_0x45f10f[_0x3cd686(0xea)]]),_0x226565=await compareExistingSqlFiles(_0x2f3c70,_0xb4a3e,_0x2444f2);if(_0x226565[_0x3cd686(0xf4)](({equivalent:_0x206ff7})=>!_0x206ff7)){_0x1058b8=!![];break;}}if(_0x1058b8){const _0x518fb2=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x518fb2)throw CliErrors[_0x3cd686(0x130)]('Force\x20pull\x20cancelled.');}}const _0x844c5=cloneSqlLockData(_0xfeda5a),_0x5481d1=_0x844c5[_0x3cd686(0x103)][_0x379e82[_0x3cd686(0xfc)]],_0x2acc0a=[],_0x5adcb8=[];for(const _0x3836f0 of _0x29aa24){const _0x34c082=_0x5481d1[_0x3cd686(0x121)][_0x3836f0['sqlCode']],_0x5bb4b2=ensureRemoteSqlContent(_0x3836f0),_0x9c4f25=detectSqlMode(_0x5bb4b2),_0x464b7f=_0x3836f0[_0x3cd686(0x12b)]?await getDbName(_0x339fbc[_0x3cd686(0xfc)],Number(_0x3836f0['dbId']))[_0x3cd686(0xfa)](()=>undefined):undefined,_0x2d6486=buildLocalSqlFileContent({'sqlCode':_0x3836f0[_0x3cd686(0xea)],'sqlName':_0x3836f0[_0x3cd686(0x10a)],'dbId':_0x3836f0['dbId']},_0x5bb4b2,{'dbName':_0x464b7f,'mode':_0x9c4f25,'syncedAt':new Date()[_0x3cd686(0xf5)](),'description':_0x3836f0[_0x3cd686(0x10d)]}),_0x328853=buildSqlLockEntry(_0x3836f0,_0x5bb4b2,computeSqlContentHash(_0x2d6486),{'dbName':_0x464b7f}),_0x32e8a8=_0x328853[_0x3cd686(0x119)],_0x1e51a5=join(_0x379e82['sqlRootDir'],_0x32e8a8);try{const _0x5e02b1=await findExistingSqlFiles(_0x379e82,_0x1e51a5,_0x9c4f25,_0x34c082),_0x4114ab=await compareExistingSqlFiles(_0x5e02b1,_0x2d6486,_0x9c4f25);if(!_0x180d86&&_0x4114ab[_0x3cd686(0xf4)](({equivalent:_0x4913b1})=>!_0x4913b1)){_0x5adcb8[_0x3cd686(0x108)]({'sqlCode':_0x3836f0[_0x3cd686(0xea)],'reason':'local\x20differs\x20from\x20remote'});continue;}const _0x5eedbe=_0x4114ab[_0x3cd686(0x12e)](({file:_0xdd9ffc})=>_0xdd9ffc['isCanonical']),_0x1c59fe=_0x4114ab[_0x3cd686(0x12e)](({file:_0x116a51})=>!_0x116a51[_0x3cd686(0x11e)]);if(_0x5eedbe?.[_0x3cd686(0x106)]&&!_0x1c59fe){_0x5adcb8['push']({'sqlCode':_0x3836f0[_0x3cd686(0xea)],'reason':_0x3cd686(0x11b)}),_0x5481d1['sqls'][_0x3836f0[_0x3cd686(0xea)]]={..._0x328853,'hash':computeSqlContentHash(_0x5eedbe[_0x3cd686(0x11c)]),'path':_0x32e8a8};continue;}!_0x5eedbe?.[_0x3cd686(0x106)]&&(await ensureParentDirectory(_0x1e51a5),await writeFile(_0x1e51a5,_0x2d6486,_0x3cd686(0x12a))),_0x1c59fe&&await rm(_0x1c59fe[_0x3cd686(0x122)]['filePath'],{'force':!![]}),_0x5481d1[_0x3cd686(0x121)][_0x3836f0['sqlCode']]={..._0x328853,'hash':_0x5eedbe?.[_0x3cd686(0x106)]?computeSqlContentHash(_0x5eedbe[_0x3cd686(0x11c)]):_0x328853['hash'],'path':_0x32e8a8},_0x2acc0a[_0x3cd686(0x108)]({'sqlCode':_0x3836f0[_0x3cd686(0xea)],'filePath':_0x1e51a5});}catch(_0x232ad1){_0x2c4252[_0x3cd686(0x108)]({'sqlCode':_0x3836f0[_0x3cd686(0xea)],'error':_0x232ad1 instanceof Error?_0x232ad1[_0x3cd686(0x10b)]:String(_0x232ad1)});}}return _0x5481d1[_0x3cd686(0xf3)]=new Date()['toISOString'](),await writeSqlLockFile(_0x379e82['lockFilePath'],_0x844c5),{'ok':_0x2c4252[_0x3cd686(0x104)]===0x0,'data':{'pulled':_0x2acc0a,'skipped':_0x5adcb8,'failed':_0x2c4252},'message':_0x3cd686(0x11f)+_0x2acc0a[_0x3cd686(0x104)]+'\x20written,\x20'+_0x5adcb8[_0x3cd686(0x104)]+_0x3cd686(0x105)+_0x2c4252[_0x3cd686(0x104)]+_0x3cd686(0xf8)};}};function isEquivalentPulledSqlFile(_0x501006,_0x141238,_0x13e762,_0x46ec22){if(_0x13e762!==_0x46ec22)return normalizePulledSqlBody(_0x501006,_0x13e762)===normalizePulledSqlBody(_0x141238,_0x46ec22);return normalizePullComparableContent(_0x501006,_0x13e762)===normalizePullComparableContent(_0x141238,_0x46ec22);}async function findExistingSqlFiles(_0xd654f6,_0x1b873f,_0x539809,_0x184c37){const _0x34a586=a253_0x3c610b,_0x2e2a5e=[];await fileExists(_0x1b873f)&&_0x2e2a5e[_0x34a586(0x108)]({'filePath':_0x1b873f,'mode':_0x539809,'isCanonical':!![]});if(!_0x184c37?.[_0x34a586(0x119)])return _0x2e2a5e;const _0x54adea=join(_0xd654f6[_0x34a586(0x11a)],_0x184c37[_0x34a586(0x119)]);if(_0x54adea===_0x1b873f)return _0x2e2a5e;return await fileExists(_0x54adea)&&_0x2e2a5e['push']({'filePath':_0x54adea,'mode':_0x184c37[_0x34a586(0x11d)]??modeFromFilePath(_0x54adea),'isCanonical':![]}),_0x2e2a5e;}async function compareExistingSqlFiles(_0x364fb3,_0x135516,_0x57e74e){const _0x4169a5=a253_0x3c610b;return Promise[_0x4169a5(0xee)](_0x364fb3[_0x4169a5(0xf0)](async _0x11f523=>{const _0x5ef3bb=_0x4169a5,_0x213020=await readFile(_0x11f523[_0x5ef3bb(0x126)],'utf8');return{'file':_0x11f523,'content':_0x213020,'equivalent':isEquivalentPulledSqlFile(_0x213020,_0x135516,_0x11f523[_0x5ef3bb(0x11d)],_0x57e74e)};}));}function modeFromFilePath(_0x106f32){const _0x2ccf4a=a253_0x3c610b;return _0x106f32[_0x2ccf4a(0x115)]()[_0x2ccf4a(0xff)](_0x2ccf4a(0xed))?'mybatisXml':_0x2ccf4a(0x102);}function normalizePulledSqlBody(_0x20fb33,_0x548592){const _0x1529df=a253_0x3c610b;return stripLocalSqlMetadata(_0x20fb33,_0x548592)[_0x1529df(0x112)](/\r\n/g,'\x0a')[_0x1529df(0x131)]();}function normalizePullComparableContent(_0x33b4a9,_0xc44767){const _0x5d10c4=a253_0x3c610b,_0x264eb1=_0x33b4a9[_0x5d10c4(0x112)](/\r\n/g,'\x0a')[_0x5d10c4(0xf1)]('\x0a'),_0x7859fa=_0x264eb1[_0x5d10c4(0x118)](_0x1bd2ac=>!isSyncedAtMetadataLine(_0x1bd2ac,_0xc44767));return _0x7859fa['join']('\x0a');}function isSyncedAtMetadataLine(_0x2aa292,_0x64e0db){const _0xea6e5e=a253_0x3c610b;if(_0x64e0db===_0xea6e5e(0xf7))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0xea6e5e(0xeb)](_0x2aa292);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x2aa292);}
@@ -1 +1 @@
1
- const a254_0x3ddd04=a254_0x4124;(function(_0x47b576,_0xd95e1c){const _0x167919=a254_0x4124,_0x37ff54=_0x47b576();while(!![]){try{const _0x1a80fe=parseInt(_0x167919(0x11c))/0x1+parseInt(_0x167919(0x130))/0x2+-parseInt(_0x167919(0x143))/0x3+-parseInt(_0x167919(0x12f))/0x4*(-parseInt(_0x167919(0x148))/0x5)+parseInt(_0x167919(0x13b))/0x6+parseInt(_0x167919(0x122))/0x7*(parseInt(_0x167919(0x13d))/0x8)+parseInt(_0x167919(0x11f))/0x9*(-parseInt(_0x167919(0x115))/0xa);if(_0x1a80fe===_0xd95e1c)break;else _0x37ff54['push'](_0x37ff54['shift']());}catch(_0x22d7a7){_0x37ff54['push'](_0x37ff54['shift']());}}}(a254_0x5995,0x86a17));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';function a254_0x5995(){const _0x5349b2=['filter',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','hash','Push\x20local\x20SQL\x20files\x20to\x20remote','force','2566428DqdVGr','1185146leHzNe','push','length','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','Local\x20directory\x20\x22','str','projectRoot','relativePath','\x20skipped,\x20','\x20SQL\x20file(s)',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','508728mEWKwB','\x22\x20for\x20sqlCode\x20','149592PkzKoI','has','sqlcode','utf8','sqlRootDir','catch','2409189FUvbJz','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','isFinite','startsWith','exec','5GyLtcL','toISOString','message','validation','\x20failed','dbId','filePath','appCode','No\x20local\x20SQL\x20files\x20found.','Would\x20push\x20','Push\x20complete:\x20','replace','Local\x20SQL\x20not\x20found:\x20','lockFilePath','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','mode','210ZopjDr','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqlConfig','path',':\x20SQL\x20content\x20is\x20empty.','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','write','342313LhySss','sqlCode','No\x20database\x20matches\x20local\x20directory\x20\x22','147501ycrPqT','version','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','14KOtpyY','sqls','unchanged','dbName','POST','bool','get','sqlName'];a254_0x5995=function(){return _0x5349b2;};return a254_0x5995();}async function readSqlUploadContent(_0x4bb8d1){const _0xc65b24=a254_0x4124,_0x187f4d=stripLocalSqlMetadata(await readFile(_0x4bb8d1[_0xc65b24(0x10b)],_0xc65b24(0x140)),_0x4bb8d1[_0xc65b24(0x114)]);if(!_0x187f4d['trim']())throw CliErrors['validation'](_0x4bb8d1[_0xc65b24(0x11d)]+_0xc65b24(0x119));return _0x187f4d;}async function getTargetSqlQueries(_0x1f9309,_0x81055a,_0x356d5e){const _0x31d68b=a254_0x4124,_0x4e6e87=await scanLocalSqlQueries(_0x1f9309),_0x2c474e=new Map();for(const _0x57ee0f of _0x4e6e87){if(_0x356d5e&&_0x57ee0f[_0x31d68b(0x11d)]!==_0x356d5e)continue;const _0x157873=_0x2c474e[_0x31d68b(0x128)](_0x57ee0f[_0x31d68b(0x11d)])??[];_0x157873[_0x31d68b(0x131)](_0x57ee0f),_0x2c474e['set'](_0x57ee0f[_0x31d68b(0x11d)],_0x157873);}if(_0x356d5e&&!_0x2c474e[_0x31d68b(0x13e)](_0x356d5e))throw CliErrors['validation'](_0x31d68b(0x111)+_0x356d5e);const _0x1ecc46=[];for(const [_0x4573ab,_0x2b98a5]of _0x2c474e['entries']()){if(_0x2b98a5[_0x31d68b(0x132)]===0x1){_0x1ecc46[_0x31d68b(0x131)](_0x2b98a5[0x0]);continue;}const _0x5f0ce2=_0x81055a['sqls'][_0x4573ab],_0x128ace=_0x5f0ce2?.[_0x31d68b(0x118)],_0x3f7d58=_0x128ace?_0x2b98a5[_0x31d68b(0x12a)](_0x222fc1=>_0x222fc1[_0x31d68b(0x137)]!==_0x128ace):_0x2b98a5;if(_0x5f0ce2&&_0x3f7d58[_0x31d68b(0x132)]===0x1){_0x1ecc46[_0x31d68b(0x131)](_0x3f7d58[0x0]);continue;}throw CliErrors['validation'](_0x31d68b(0x144)+_0x4573ab+_0x31d68b(0x113));}return _0x1ecc46;}export const sqlPush={'service':'sql','command':'push','description':a254_0x3ddd04(0x12d),'risk':a254_0x3ddd04(0x11b),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':'boolean','description':a254_0x3ddd04(0x11a)}],async 'dryRun'(_0x55b129){const _0x3b0d47=a254_0x3ddd04,_0x3b03da=loadSqlProjectConfig(_0x55b129[_0x3b0d47(0x10c)]),_0x4b13cf=await readSqlLockFile(_0x3b03da[_0x3b0d47(0x112)]),{appLock:_0x17f8ca}=ensureSqlLockScope(_0x4b13cf??createEmptySqlLock(),_0x55b129[_0x3b0d47(0x10c)],_0x3b03da['sqlRoot'],_0x3b0d47(0x131)),_0x21847e=await getTargetSqlQueries(_0x3b03da,_0x17f8ca,_0x55b129['str'](_0x3b0d47(0x13f))||undefined),_0x2af14f=[];for(const _0x56403e of _0x21847e){const _0x5ebb23=await computeSqlFileHash(_0x56403e['filePath']),_0x586bb8=_0x17f8ca[_0x3b0d47(0x123)][_0x56403e[_0x3b0d47(0x11d)]],_0x1965a4=!!_0x586bb8&&(_0x586bb8['path']!==_0x56403e[_0x3b0d47(0x137)]||!!_0x56403e['sqlName']&&_0x586bb8[_0x3b0d47(0x129)]!==_0x56403e[_0x3b0d47(0x129)]||_0x586bb8['mode']!==_0x56403e[_0x3b0d47(0x114)]);if(!_0x55b129[_0x3b0d47(0x127)]('force')&&_0x586bb8&&_0x586bb8['hash']===_0x5ebb23&&!_0x1965a4)continue;if(!_0x586bb8)throw CliErrors['validation'](_0x56403e[_0x3b0d47(0x11d)]+_0x3b0d47(0x12b));if(_0x586bb8[_0x3b0d47(0x120)]==null)throw CliErrors[_0x3b0d47(0x14b)](_0x56403e[_0x3b0d47(0x11d)]+_0x3b0d47(0x13a));await resolveTargetDbBinding(_0x55b129[_0x3b0d47(0x10c)],_0x56403e,_0x586bb8),await readSqlUploadContent(_0x56403e),_0x2af14f['push'](_0x56403e[_0x3b0d47(0x11d)]);}return{'method':_0x3b0d47(0x126),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x2af14f,'appCode':_0x55b129[_0x3b0d47(0x10c)]},'description':_0x3b0d47(0x10e)+_0x2af14f['length']+_0x3b0d47(0x139)};},async 'execute'(_0x327ffa){const _0x392c87=a254_0x3ddd04,_0x2468fb=loadSqlProjectConfig(_0x327ffa[_0x392c87(0x10c)]),_0x229d65=await readSqlLockFile(_0x2468fb[_0x392c87(0x112)]),{lockData:_0x10b25c,appLock:_0x4e15c5}=ensureSqlLockScope(_0x229d65??createEmptySqlLock(),_0x327ffa[_0x392c87(0x10c)],_0x2468fb['sqlRoot'],_0x392c87(0x131)),_0xc9622c=await getTargetSqlQueries(_0x2468fb,_0x4e15c5,_0x327ffa[_0x392c87(0x135)](_0x392c87(0x13f))||undefined);if(_0xc9622c[_0x392c87(0x132)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x392c87(0x10d)};const _0x15bffd=[],_0x41df4e=[],_0x485652=[];let _0x1a16f8=![];for(const _0x2630b3 of _0xc9622c){const _0x549f85=_0x4e15c5[_0x392c87(0x123)][_0x2630b3[_0x392c87(0x11d)]];if(!_0x549f85){_0x485652[_0x392c87(0x131)]({'sqlCode':_0x2630b3[_0x392c87(0x11d)],'error':_0x392c87(0x133)});continue;}try{const _0x4e7ff1=await computeSqlFileHash(_0x2630b3[_0x392c87(0x10b)]),_0x5db465=_0x549f85[_0x392c87(0x118)]!==_0x2630b3[_0x392c87(0x137)]||!!_0x2630b3['sqlName']&&_0x549f85[_0x392c87(0x129)]!==_0x2630b3[_0x392c87(0x129)]||_0x549f85[_0x392c87(0x114)]!==_0x2630b3[_0x392c87(0x114)];if(!_0x327ffa['bool'](_0x392c87(0x12e))&&_0x549f85[_0x392c87(0x12c)]===_0x4e7ff1&&!_0x5db465){_0x41df4e['push']({'sqlCode':_0x2630b3[_0x392c87(0x11d)],'reason':_0x392c87(0x124)});continue;}if(_0x549f85['version']==null){_0x485652[_0x392c87(0x131)]({'sqlCode':_0x2630b3['sqlCode'],'error':_0x392c87(0x116)});continue;}const _0x2d1cbc=_0x2630b3[_0x392c87(0x129)]||_0x549f85[_0x392c87(0x129)],_0x175278=await resolveTargetDbBinding(_0x327ffa['appCode'],_0x2630b3,_0x549f85),_0x479ebc=await readSqlUploadContent(_0x2630b3),_0x277c63=await updateSqlQuery({'id':_0x549f85['remoteId'],'appCode':_0x327ffa['appCode'],'sqlCode':_0x2630b3[_0x392c87(0x11d)],'sqlName':_0x2d1cbc,'dbId':_0x175278['dbId'],'version':_0x549f85[_0x392c87(0x120)],'sqlContent':_0x479ebc,'sqlConfig':_0x549f85[_0x392c87(0x117)]??undefined}),_0xdb600b=_0x277c63[_0x392c87(0x10a)]?await getDbName(_0x327ffa[_0x392c87(0x10c)],Number(_0x277c63[_0x392c87(0x10a)]))[_0x392c87(0x142)](()=>_0x175278[_0x392c87(0x125)]):_0x175278[_0x392c87(0x125)];_0x4e15c5[_0x392c87(0x123)][_0x2630b3[_0x392c87(0x11d)]]={...buildSqlLockEntry(_0x277c63,_0x479ebc,_0x4e7ff1,{'dbName':_0xdb600b}),'path':_0x2630b3[_0x392c87(0x137)],'mode':_0x2630b3[_0x392c87(0x114)]},_0x1a16f8=!![],await archivePreviousSqlFileIfNeeded(_0x2468fb,_0x549f85[_0x392c87(0x118)],_0x2630b3['relativePath']),_0x15bffd[_0x392c87(0x131)]({'sqlCode':_0x2630b3[_0x392c87(0x11d)],'remoteId':_0x549f85['remoteId']});}catch(_0x56c397){_0x485652[_0x392c87(0x131)]({'sqlCode':_0x2630b3[_0x392c87(0x11d)],'error':_0x56c397 instanceof Error?_0x56c397[_0x392c87(0x14a)]:String(_0x56c397)});}}(_0x1a16f8||_0x485652[_0x392c87(0x132)]===0x0)&&(_0x4e15c5['lastSync']=new Date()[_0x392c87(0x149)](),await writeSqlLockFile(_0x2468fb['lockFilePath'],_0x10b25c));const _0x4bafbd=_0x485652['length']===0x0;return{'ok':_0x4bafbd,'data':{'pushed':_0x15bffd,'skipped':_0x41df4e,'failed':_0x485652},'message':_0x392c87(0x10f)+_0x15bffd[_0x392c87(0x132)]+'\x20pushed,\x20'+_0x41df4e['length']+_0x392c87(0x138)+_0x485652[_0x392c87(0x132)]+_0x392c87(0x109)};}};function a254_0x4124(_0x2b9078,_0x51b9a7){_0x2b9078=_0x2b9078-0x109;const _0x59951f=a254_0x5995();let _0x412400=_0x59951f[_0x2b9078];return _0x412400;}async function archivePreviousSqlFileIfNeeded(_0x26e207,_0x4d35f2,_0x11a372){const _0x4501fa=a254_0x3ddd04;if(!_0x4d35f2||_0x4d35f2===_0x11a372)return;const _0x2285a3=join(_0x26e207[_0x4501fa(0x141)],_0x4d35f2);if(!await fileExists(_0x2285a3))return;const _0x1f043a=await moveToTrash(_0x26e207[_0x4501fa(0x136)],_0x26e207['trashDir'],_0x2285a3);await cleanupEmptyDirectories(dirname(_0x2285a3),_0x26e207['sqlRootDir']),void _0x1f043a;}async function moveToTrash(_0x3fad7f,_0x7515af,_0x37e63e){const _0x491156=a254_0x3ddd04,_0x179161=new Date()['toISOString']()[_0x491156(0x110)](/[:.]/g,'-'),_0x1bc827=relative(_0x3fad7f,_0x37e63e),_0x18e6f4=join(_0x7515af,_0x179161,_0x1bc827);return await mkdir(dirname(_0x18e6f4),{'recursive':!![]}),await rename(_0x37e63e,_0x18e6f4),_0x18e6f4;}async function cleanupEmptyDirectories(_0x4d6b09,_0x4b142e){const _0x5f0b18=a254_0x3ddd04;let _0x2b3f17=resolve(_0x4d6b09);const _0x5c6051=resolve(_0x4b142e);while(_0x2b3f17[_0x5f0b18(0x146)](''+_0x5c6051+sep)||_0x2b3f17===_0x5c6051){if(_0x2b3f17===_0x5c6051)return;try{const _0x1682db=await readdir(_0x2b3f17);if(_0x1682db[_0x5f0b18(0x132)]>0x0)return;await rmdir(_0x2b3f17);}catch{return;}_0x2b3f17=dirname(_0x2b3f17);}}async function resolveTargetDbBinding(_0x6df093,_0x5d4ecb,_0x5a5e73){const _0x322e89=a254_0x3ddd04,_0x39ed9e=_0x5d4ecb['dbDirectory'];if(!_0x39ed9e)return{'dbId':_0x5a5e73[_0x322e89(0x10a)],'dbName':_0x5a5e73[_0x322e89(0x125)]};const _0x3bab4f=buildDbDirectoryName(_0x5a5e73['dbName'],_0x5a5e73[_0x322e89(0x10a)]);if(_0x39ed9e===_0x3bab4f)return{'dbId':_0x5a5e73[_0x322e89(0x10a)],'dbName':_0x5a5e73[_0x322e89(0x125)]};const _0x4b1236=parseExplicitDbDirectory(_0x39ed9e);if(_0x4b1236!=null)return{'dbId':_0x4b1236,'dbName':await getDbName(_0x6df093,_0x4b1236)[_0x322e89(0x142)](()=>undefined)};const _0x405213=await listDatabases(_0x6df093),_0x48d5db=_0x405213[_0x322e89(0x12a)](_0x339d5d=>buildDbDirectoryName(_0x339d5d[_0x322e89(0x125)],_0x339d5d[_0x322e89(0x10a)])===_0x39ed9e);if(_0x48d5db[_0x322e89(0x132)]===0x1)return{'dbId':_0x48d5db[0x0][_0x322e89(0x10a)],'dbName':_0x48d5db[0x0][_0x322e89(0x125)]};if(_0x48d5db[_0x322e89(0x132)]===0x0)throw CliErrors[_0x322e89(0x14b)](_0x322e89(0x11e)+_0x39ed9e+_0x322e89(0x13c)+_0x5d4ecb[_0x322e89(0x11d)]+'.');const _0x2692c8=_0x48d5db['map'](_0x134294=>_0x134294[_0x322e89(0x125)]+'\x20('+_0x134294[_0x322e89(0x10a)]+')')['join'](',\x20');throw CliErrors['validation'](_0x322e89(0x134)+_0x39ed9e+_0x322e89(0x121)+_0x5d4ecb[_0x322e89(0x11d)]+':\x20'+_0x2692c8);}function parseExplicitDbDirectory(_0x176836){const _0x1b47c6=a254_0x3ddd04,_0x7ad30=/^db-(\d+)$/[_0x1b47c6(0x147)](_0x176836);if(!_0x7ad30)return null;const _0x493741=Number(_0x7ad30[0x1]);return Number[_0x1b47c6(0x145)](_0x493741)&&_0x493741>0x0?_0x493741:null;}
1
+ const a254_0x48fb18=a254_0x37aa;(function(_0x461e96,_0xa2894f){const _0x27d04c=a254_0x37aa,_0x545ad2=_0x461e96();while(!![]){try{const _0x222249=-parseInt(_0x27d04c(0x15b))/0x1*(-parseInt(_0x27d04c(0x14b))/0x2)+-parseInt(_0x27d04c(0x149))/0x3+parseInt(_0x27d04c(0x157))/0x4+-parseInt(_0x27d04c(0x127))/0x5*(-parseInt(_0x27d04c(0x168))/0x6)+-parseInt(_0x27d04c(0x153))/0x7+parseInt(_0x27d04c(0x142))/0x8+-parseInt(_0x27d04c(0x155))/0x9;if(_0x222249===_0xa2894f)break;else _0x545ad2['push'](_0x545ad2['shift']());}catch(_0x2ce041){_0x545ad2['push'](_0x545ad2['shift']());}}}(a254_0x34db,0xe3e12));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function readSqlUploadContent(_0x29437a){const _0x3a9fda=a254_0x37aa,_0x2cfbf1=stripLocalSqlMetadata(await readFile(_0x29437a[_0x3a9fda(0x14d)],_0x3a9fda(0x15a)),_0x29437a[_0x3a9fda(0x147)]);if(!_0x2cfbf1[_0x3a9fda(0x12d)]())throw CliErrors[_0x3a9fda(0x125)](_0x29437a[_0x3a9fda(0x15d)]+_0x3a9fda(0x133));return _0x2cfbf1;}async function getTargetSqlQueries(_0x1b1c42,_0x236f24,_0x5c70e8){const _0x592871=a254_0x37aa,_0x428142=await scanLocalSqlQueries(_0x1b1c42),_0x3e922c=new Map();for(const _0x2fd37e of _0x428142){if(_0x5c70e8&&_0x2fd37e[_0x592871(0x15d)]!==_0x5c70e8)continue;const _0x3b4f43=_0x3e922c[_0x592871(0x14e)](_0x2fd37e[_0x592871(0x15d)])??[];_0x3b4f43[_0x592871(0x164)](_0x2fd37e),_0x3e922c[_0x592871(0x16a)](_0x2fd37e[_0x592871(0x15d)],_0x3b4f43);}if(_0x5c70e8&&!_0x3e922c[_0x592871(0x140)](_0x5c70e8))throw CliErrors[_0x592871(0x125)](_0x592871(0x146)+_0x5c70e8);const _0x1cd50c=[];for(const [_0x50a96e,_0x6223fc]of _0x3e922c[_0x592871(0x128)]()){if(_0x6223fc[_0x592871(0x154)]===0x1){_0x1cd50c['push'](_0x6223fc[0x0]);continue;}const _0x2ee5b3=_0x236f24[_0x592871(0x15c)][_0x50a96e],_0x412cbf=_0x2ee5b3?.[_0x592871(0x135)],_0x56353b=_0x412cbf?_0x6223fc[_0x592871(0x136)](_0x2f9aff=>_0x2f9aff['relativePath']!==_0x412cbf):_0x6223fc;if(_0x2ee5b3&&_0x56353b[_0x592871(0x154)]===0x1){_0x1cd50c[_0x592871(0x164)](_0x56353b[0x0]);continue;}throw CliErrors[_0x592871(0x125)](_0x592871(0x144)+_0x50a96e+_0x592871(0x12f));}return _0x1cd50c;}export const sqlPush={'service':a254_0x48fb18(0x134),'command':a254_0x48fb18(0x164),'description':a254_0x48fb18(0x161),'risk':a254_0x48fb18(0x12b),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a254_0x48fb18(0x162),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x1b6917){const _0x85a483=a254_0x48fb18,_0x3c5c4d=loadSqlProjectConfig(_0x1b6917[_0x85a483(0x126)]),_0x5b0837=await readSqlLockFile(_0x3c5c4d['lockFilePath']),{appLock:_0x51e185}=ensureSqlLockScope(_0x5b0837??createEmptySqlLock(),_0x1b6917[_0x85a483(0x126)],_0x3c5c4d[_0x85a483(0x169)],_0x85a483(0x164)),_0x5f2ea9=await getTargetSqlQueries(_0x3c5c4d,_0x51e185,_0x1b6917[_0x85a483(0x152)](_0x85a483(0x141))||undefined),_0x542db9=[];for(const _0x469075 of _0x5f2ea9){const _0x1d943d=await computeSqlFileHash(_0x469075[_0x85a483(0x14d)]),_0x3b7bb7=_0x51e185[_0x85a483(0x15c)][_0x469075[_0x85a483(0x15d)]],_0x2aa8a7=!!_0x3b7bb7&&(_0x3b7bb7['path']!==_0x469075[_0x85a483(0x12e)]||!!_0x469075[_0x85a483(0x13b)]&&_0x3b7bb7[_0x85a483(0x13b)]!==_0x469075[_0x85a483(0x13b)]||_0x3b7bb7['mode']!==_0x469075[_0x85a483(0x147)]);if(!_0x1b6917['bool'](_0x85a483(0x148))&&_0x3b7bb7&&_0x3b7bb7[_0x85a483(0x166)]===_0x1d943d&&!_0x2aa8a7)continue;if(!_0x3b7bb7)throw CliErrors['validation'](_0x469075[_0x85a483(0x15d)]+_0x85a483(0x13f));if(_0x3b7bb7[_0x85a483(0x131)]==null)throw CliErrors[_0x85a483(0x125)](_0x469075[_0x85a483(0x15d)]+_0x85a483(0x15f));await resolveTargetDbBinding(_0x1b6917[_0x85a483(0x126)],_0x469075,_0x3b7bb7),await readSqlUploadContent(_0x469075),_0x542db9[_0x85a483(0x164)](_0x469075[_0x85a483(0x15d)]);}return{'method':'POST','url':_0x85a483(0x139),'body':{'sqlCodes':_0x542db9,'appCode':_0x1b6917['appCode']},'description':_0x85a483(0x14a)+_0x542db9['length']+_0x85a483(0x130)};},async 'execute'(_0x5e5527){const _0x31c456=a254_0x48fb18,_0xce16f=loadSqlProjectConfig(_0x5e5527[_0x31c456(0x126)]),_0x5baf8a=await readSqlLockFile(_0xce16f['lockFilePath']),{lockData:_0x494d5e,appLock:_0x291dd8}=ensureSqlLockScope(_0x5baf8a??createEmptySqlLock(),_0x5e5527['appCode'],_0xce16f[_0x31c456(0x169)],_0x31c456(0x164)),_0x258ee0=await getTargetSqlQueries(_0xce16f,_0x291dd8,_0x5e5527['str']('sqlcode')||undefined);if(_0x258ee0['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x3e3666=[],_0x528d6a=[],_0x498dfd=[];let _0xc2be3e=![];for(const _0x28b154 of _0x258ee0){const _0x21e13a=_0x291dd8[_0x31c456(0x15c)][_0x28b154['sqlCode']];if(!_0x21e13a){_0x498dfd[_0x31c456(0x164)]({'sqlCode':_0x28b154[_0x31c456(0x15d)],'error':_0x31c456(0x156)});continue;}try{const _0x330e4c=await computeSqlFileHash(_0x28b154[_0x31c456(0x14d)]),_0x3dd450=_0x21e13a[_0x31c456(0x135)]!==_0x28b154[_0x31c456(0x12e)]||!!_0x28b154[_0x31c456(0x13b)]&&_0x21e13a[_0x31c456(0x13b)]!==_0x28b154['sqlName']||_0x21e13a[_0x31c456(0x147)]!==_0x28b154[_0x31c456(0x147)];if(!_0x5e5527[_0x31c456(0x158)](_0x31c456(0x148))&&_0x21e13a['hash']===_0x330e4c&&!_0x3dd450){_0x528d6a['push']({'sqlCode':_0x28b154['sqlCode'],'reason':_0x31c456(0x132)});continue;}if(_0x21e13a[_0x31c456(0x131)]==null){_0x498dfd[_0x31c456(0x164)]({'sqlCode':_0x28b154[_0x31c456(0x15d)],'error':_0x31c456(0x129)});continue;}const _0x21bc46=_0x28b154[_0x31c456(0x13b)]||_0x21e13a[_0x31c456(0x13b)],_0x123ae2=await resolveTargetDbBinding(_0x5e5527[_0x31c456(0x126)],_0x28b154,_0x21e13a),_0x48b3f8=await readSqlUploadContent(_0x28b154),_0x341211=await updateSqlQuery({'id':_0x21e13a[_0x31c456(0x14f)],'appCode':_0x5e5527[_0x31c456(0x126)],'sqlCode':_0x28b154[_0x31c456(0x15d)],'sqlName':_0x21bc46,'dbId':_0x123ae2['dbId'],'version':_0x21e13a[_0x31c456(0x131)],'sqlContent':_0x48b3f8,'sqlConfig':_0x21e13a['sqlConfig']??undefined}),_0x234204=_0x341211['dbId']?await getDbName(_0x5e5527[_0x31c456(0x126)],Number(_0x341211[_0x31c456(0x13d)]))['catch'](()=>_0x123ae2[_0x31c456(0x13e)]):_0x123ae2[_0x31c456(0x13e)];_0x291dd8['sqls'][_0x28b154[_0x31c456(0x15d)]]={...buildSqlLockEntry(_0x341211,_0x48b3f8,_0x330e4c,{'dbName':_0x234204}),'path':_0x28b154[_0x31c456(0x12e)],'mode':_0x28b154['mode']},_0xc2be3e=!![],await archivePreviousSqlFileIfNeeded(_0xce16f,_0x21e13a[_0x31c456(0x135)],_0x28b154['relativePath']),_0x3e3666[_0x31c456(0x164)]({'sqlCode':_0x28b154['sqlCode'],'remoteId':_0x21e13a[_0x31c456(0x14f)]});}catch(_0x4201cd){_0x498dfd[_0x31c456(0x164)]({'sqlCode':_0x28b154[_0x31c456(0x15d)],'error':_0x4201cd instanceof Error?_0x4201cd[_0x31c456(0x163)]:String(_0x4201cd)});}}(_0xc2be3e||_0x498dfd['length']===0x0)&&(_0x291dd8[_0x31c456(0x15e)]=new Date()[_0x31c456(0x13a)](),await writeSqlLockFile(_0xce16f[_0x31c456(0x13c)],_0x494d5e));const _0x4eb648=_0x498dfd[_0x31c456(0x154)]===0x0;return{'ok':_0x4eb648,'data':{'pushed':_0x3e3666,'skipped':_0x528d6a,'failed':_0x498dfd},'message':_0x31c456(0x12a)+_0x3e3666['length']+_0x31c456(0x143)+_0x528d6a['length']+_0x31c456(0x150)+_0x498dfd[_0x31c456(0x154)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x1d1e6c,_0x339534,_0x4ac66e){const _0x2d92ff=a254_0x48fb18;if(!_0x339534||_0x339534===_0x4ac66e)return;const _0x3366d7=join(_0x1d1e6c[_0x2d92ff(0x124)],_0x339534);if(!await fileExists(_0x3366d7))return;const _0xb830e1=await moveToTrash(_0x1d1e6c[_0x2d92ff(0x138)],_0x1d1e6c['trashDir'],_0x3366d7);await cleanupEmptyDirectories(dirname(_0x3366d7),_0x1d1e6c[_0x2d92ff(0x124)]),void _0xb830e1;}function a254_0x37aa(_0x217d41,_0x3bdb06){_0x217d41=_0x217d41-0x124;const _0x34db8e=a254_0x34db();let _0x37aa35=_0x34db8e[_0x217d41];return _0x37aa35;}function a254_0x34db(){const _0x9eb974=['2gXGala','sqls','sqlCode','lastSync',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','\x22\x20for\x20sqlCode\x20','Push\x20local\x20SQL\x20files\x20to\x20remote','boolean','message','push','join','hash','map','4854FCgCSi','sqlRoot','set','sqlRootDir','validation','appCode','5480ZlfOAZ','entries','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','Push\x20complete:\x20','write','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','trim','relativePath','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','\x20SQL\x20file(s)','version','unchanged',':\x20SQL\x20content\x20is\x20empty.','sql','path','filter','No\x20database\x20matches\x20local\x20directory\x20\x22','projectRoot','/smartapi/custom/updateUserCustomSql','toISOString','sqlName','lockFilePath','dbId','dbName',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','has','sqlcode','7397184hnWcRT','\x20pushed,\x20','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','replace','Local\x20SQL\x20not\x20found:\x20','mode','force','1203684mqZSNM','Would\x20push\x20','114406UqHoZU','dbDirectory','filePath','get','remoteId','\x20skipped,\x20','Local\x20directory\x20\x22','str','8317855VlbTou','length','4003272eWRqwM','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','4167908wqiDez','bool','isFinite','utf8'];a254_0x34db=function(){return _0x9eb974;};return a254_0x34db();}async function moveToTrash(_0x1a1561,_0xcdf006,_0x14f8c5){const _0x286494=a254_0x48fb18,_0x33e5c6=new Date()[_0x286494(0x13a)]()[_0x286494(0x145)](/[:.]/g,'-'),_0x37a85b=relative(_0x1a1561,_0x14f8c5),_0x2690ca=join(_0xcdf006,_0x33e5c6,_0x37a85b);return await mkdir(dirname(_0x2690ca),{'recursive':!![]}),await rename(_0x14f8c5,_0x2690ca),_0x2690ca;}async function cleanupEmptyDirectories(_0x3f6e64,_0x26c54f){const _0x3fef4c=a254_0x48fb18;let _0x27abee=resolve(_0x3f6e64);const _0x1e8f5c=resolve(_0x26c54f);while(_0x27abee['startsWith'](''+_0x1e8f5c+sep)||_0x27abee===_0x1e8f5c){if(_0x27abee===_0x1e8f5c)return;try{const _0x14b1a6=await readdir(_0x27abee);if(_0x14b1a6[_0x3fef4c(0x154)]>0x0)return;await rmdir(_0x27abee);}catch{return;}_0x27abee=dirname(_0x27abee);}}async function resolveTargetDbBinding(_0x4a6411,_0xe9d2e5,_0x51ed81){const _0xa209=a254_0x48fb18,_0x426d85=_0xe9d2e5[_0xa209(0x14c)];if(!_0x426d85)return{'dbId':_0x51ed81[_0xa209(0x13d)],'dbName':_0x51ed81['dbName']};const _0x434627=buildDbDirectoryName(_0x51ed81[_0xa209(0x13e)],_0x51ed81[_0xa209(0x13d)]);if(_0x426d85===_0x434627)return{'dbId':_0x51ed81[_0xa209(0x13d)],'dbName':_0x51ed81['dbName']};const _0x18ef30=parseExplicitDbDirectory(_0x426d85);if(_0x18ef30!=null)return{'dbId':_0x18ef30,'dbName':await getDbName(_0x4a6411,_0x18ef30)['catch'](()=>undefined)};const _0x4f40a8=await listDatabases(_0x4a6411),_0x414c9f=_0x4f40a8[_0xa209(0x136)](_0x57ab68=>buildDbDirectoryName(_0x57ab68['dbName'],_0x57ab68[_0xa209(0x13d)])===_0x426d85);if(_0x414c9f[_0xa209(0x154)]===0x1)return{'dbId':_0x414c9f[0x0][_0xa209(0x13d)],'dbName':_0x414c9f[0x0][_0xa209(0x13e)]};if(_0x414c9f['length']===0x0)throw CliErrors[_0xa209(0x125)](_0xa209(0x137)+_0x426d85+_0xa209(0x160)+_0xe9d2e5[_0xa209(0x15d)]+'.');const _0x57a439=_0x414c9f[_0xa209(0x167)](_0x4c66a3=>_0x4c66a3[_0xa209(0x13e)]+'\x20('+_0x4c66a3[_0xa209(0x13d)]+')')[_0xa209(0x165)](',\x20');throw CliErrors[_0xa209(0x125)](_0xa209(0x151)+_0x426d85+_0xa209(0x12c)+_0xe9d2e5[_0xa209(0x15d)]+':\x20'+_0x57a439);}function parseExplicitDbDirectory(_0x71ffaf){const _0x16ddea=a254_0x48fb18,_0x414d48=/^db-(\d+)$/['exec'](_0x71ffaf);if(!_0x414d48)return null;const _0xb1d069=Number(_0x414d48[0x1]);return Number[_0x16ddea(0x159)](_0xb1d069)&&_0xb1d069>0x0?_0xb1d069:null;}