@lovrabet/rabetbase-cli 2.5.4-beta.4 → 2.5.4-beta.5

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 (388) hide show
  1. package/README.md +8 -2
  2. package/lib/api/api-doc.js +1 -1
  3. package/lib/api/api-group.js +1 -1
  4. package/lib/api/fetch-model-list.js +1 -1
  5. package/lib/api/generate-api-file.js +1 -1
  6. package/lib/api/generate-sdk-config-file.js +1 -1
  7. package/lib/api/legacy-api-file.js +1 -1
  8. package/lib/api/model-registry-file.js +1 -1
  9. package/lib/api/model-registry-scaffold.js +1 -1
  10. package/lib/api/model-source.js +1 -1
  11. package/lib/auth/auth-server-ui.js +1 -1
  12. package/lib/auth/auth-server.js +1 -1
  13. package/lib/auth/constant.js +1 -1
  14. package/lib/auth/get-cookie.js +1 -1
  15. package/lib/auth/get-session-user.js +1 -1
  16. package/lib/auth/is-session-valid.js +1 -1
  17. package/lib/auth/login-success-html.js +1 -1
  18. package/lib/auth/logout.js +1 -1
  19. package/lib/cli-flags.js +1 -1
  20. package/lib/cli.js +1 -1
  21. package/lib/commands/api/generate.js +1 -1
  22. package/lib/commands/api/index.js +1 -1
  23. package/lib/commands/api/list.js +1 -1
  24. package/lib/commands/api/pull.js +1 -1
  25. package/lib/commands/api/shared.js +1 -1
  26. package/lib/commands/app/detail.d.ts +2 -0
  27. package/lib/commands/app/detail.js +1 -0
  28. package/lib/commands/app/index.js +1 -1
  29. package/lib/commands/app/list.js +1 -1
  30. package/lib/commands/app/members-list.js +1 -1
  31. package/lib/commands/app/remote-directory.js +1 -1
  32. package/lib/commands/app/shared.js +1 -1
  33. package/lib/commands/app-config/delete.js +1 -1
  34. package/lib/commands/app-config/get.js +1 -1
  35. package/lib/commands/app-config/index.js +1 -1
  36. package/lib/commands/app-config/list.js +1 -1
  37. package/lib/commands/app-config/set.js +1 -1
  38. package/lib/commands/app-config/shared.js +1 -1
  39. package/lib/commands/auth/index.js +1 -1
  40. package/lib/commands/bff/create.js +1 -1
  41. package/lib/commands/bff/delete.js +1 -1
  42. package/lib/commands/bff/detail.js +1 -1
  43. package/lib/commands/bff/index.js +1 -1
  44. package/lib/commands/bff/list.js +1 -1
  45. package/lib/commands/bff/logs.js +1 -1
  46. package/lib/commands/bff/pull.js +1 -1
  47. package/lib/commands/bff/push.js +1 -1
  48. package/lib/commands/bff/status.js +1 -1
  49. package/lib/commands/cli-skill/index.js +1 -1
  50. package/lib/commands/cli-update.js +1 -1
  51. package/lib/commands/codegen/index.js +1 -1
  52. package/lib/commands/codegen/sdk.js +1 -1
  53. package/lib/commands/codegen/sql.js +1 -1
  54. package/lib/commands/common/app-registry.js +1 -1
  55. package/lib/commands/common/app-selector.js +1 -1
  56. package/lib/commands/common/async-task.js +1 -1
  57. package/lib/commands/common/dry-run.js +1 -1
  58. package/lib/commands/common/flags.js +1 -1
  59. package/lib/commands/common/local-file.js +1 -1
  60. package/lib/commands/common/validate.js +1 -1
  61. package/lib/commands/config/delete.js +1 -1
  62. package/lib/commands/config/get.js +1 -1
  63. package/lib/commands/config/index.js +1 -1
  64. package/lib/commands/config/init.js +1 -1
  65. package/lib/commands/config/list.js +1 -1
  66. package/lib/commands/config/set.js +1 -1
  67. package/lib/commands/config/shared.js +1 -1
  68. package/lib/commands/dataset/batch-design.js +1 -1
  69. package/lib/commands/dataset/business-group-update.js +1 -1
  70. package/lib/commands/dataset/business-groups.js +1 -1
  71. package/lib/commands/dataset/capability.js +1 -1
  72. package/lib/commands/dataset/cross-relation-create.js +1 -1
  73. package/lib/commands/dataset/cross-relation-delete.js +1 -1
  74. package/lib/commands/dataset/cross-relation-list.js +1 -1
  75. package/lib/commands/dataset/cross-relation-shared.js +1 -1
  76. package/lib/commands/dataset/cross-relation-update.js +1 -1
  77. package/lib/commands/dataset/delete.js +1 -1
  78. package/lib/commands/dataset/detail.js +1 -1
  79. package/lib/commands/dataset/extend-update.js +1 -1
  80. package/lib/commands/dataset/field-restore.js +1 -1
  81. package/lib/commands/dataset/field-update.js +1 -1
  82. package/lib/commands/dataset/generate.js +1 -1
  83. package/lib/commands/dataset/index.js +1 -1
  84. package/lib/commands/dataset/list.js +1 -1
  85. package/lib/commands/dataset/operations.js +1 -1
  86. package/lib/commands/dataset/relation-audit.js +1 -1
  87. package/lib/commands/dataset/relation-create.js +1 -1
  88. package/lib/commands/dataset/relation-delete.js +1 -1
  89. package/lib/commands/dataset/relation-shared.js +1 -1
  90. package/lib/commands/dataset/relation-update.js +1 -1
  91. package/lib/commands/dataset/relations.js +1 -1
  92. package/lib/commands/dataset/rename.js +1 -1
  93. package/lib/commands/dataset/restore.js +1 -1
  94. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  95. package/lib/commands/db/analysis-batching.js +1 -1
  96. package/lib/commands/db/analyze-batch-plan.js +1 -1
  97. package/lib/commands/db/analyze-cancel.js +1 -1
  98. package/lib/commands/db/analyze-start.js +1 -1
  99. package/lib/commands/db/analyze-status.js +1 -1
  100. package/lib/commands/db/create.js +1 -1
  101. package/lib/commands/db/delete.js +1 -1
  102. package/lib/commands/db/detail.js +1 -1
  103. package/lib/commands/db/diff-refresh-start.js +1 -1
  104. package/lib/commands/db/diff-refresh-status.js +1 -1
  105. package/lib/commands/db/diff.js +1 -1
  106. package/lib/commands/db/index.js +1 -1
  107. package/lib/commands/db/list.js +1 -1
  108. package/lib/commands/db/shared.js +1 -1
  109. package/lib/commands/db/table-diff-shared.js +1 -1
  110. package/lib/commands/db/tables.js +1 -1
  111. package/lib/commands/db/test.js +1 -1
  112. package/lib/commands/db/update.js +1 -1
  113. package/lib/commands/deployment/index.js +1 -1
  114. package/lib/commands/deployment/sync-all.js +1 -1
  115. package/lib/commands/deployment/sync-jobs.js +1 -1
  116. package/lib/commands/deployment/sync-status.js +1 -1
  117. package/lib/commands/doctor.js +1 -1
  118. package/lib/commands/file/index.js +1 -1
  119. package/lib/commands/flow/create.js +1 -1
  120. package/lib/commands/flow/detail.js +1 -1
  121. package/lib/commands/flow/index.js +1 -1
  122. package/lib/commands/flow/list.js +1 -1
  123. package/lib/commands/flow/publish.js +1 -1
  124. package/lib/commands/flow/runtime-resources-shared.js +1 -1
  125. package/lib/commands/flow/runtime-role-list.js +1 -1
  126. package/lib/commands/flow/runtime-role-user-list.js +1 -1
  127. package/lib/commands/flow/runtime-user-search.js +1 -1
  128. package/lib/commands/flow/shared.js +1 -1
  129. package/lib/commands/flow/update.js +1 -1
  130. package/lib/commands/flow/validate.js +1 -1
  131. package/lib/commands/instant-api-policy/current.js +1 -1
  132. package/lib/commands/instant-api-policy/index.js +1 -1
  133. package/lib/commands/instant-api-policy/init.js +1 -1
  134. package/lib/commands/instant-api-policy/publish.js +1 -1
  135. package/lib/commands/instant-api-policy/pull.js +1 -1
  136. package/lib/commands/instant-api-policy/revision.js +1 -1
  137. package/lib/commands/instant-api-policy/revisions.js +1 -1
  138. package/lib/commands/instant-api-policy/rollback.js +1 -1
  139. package/lib/commands/instant-api-policy/shared.js +1 -1
  140. package/lib/commands/instant-api-policy/validate.js +1 -1
  141. package/lib/commands/issue/index.js +1 -1
  142. package/lib/commands/issue/nudge.js +1 -1
  143. package/lib/commands/issue/report.js +1 -1
  144. package/lib/commands/issue/shared.js +1 -1
  145. package/lib/commands/kb/create.js +1 -1
  146. package/lib/commands/kb/delete.js +1 -1
  147. package/lib/commands/kb/detail.js +1 -1
  148. package/lib/commands/kb/index.js +1 -1
  149. package/lib/commands/kb/list.js +1 -1
  150. package/lib/commands/kb/search.js +1 -1
  151. package/lib/commands/kb/shared.js +1 -1
  152. package/lib/commands/kb/update.js +1 -1
  153. package/lib/commands/logs/index.js +1 -1
  154. package/lib/commands/menu/asset-update.js +1 -1
  155. package/lib/commands/menu/delete.js +1 -1
  156. package/lib/commands/menu/external-link-create.js +1 -1
  157. package/lib/commands/menu/external-link-update.js +1 -1
  158. package/lib/commands/menu/group-create.js +1 -1
  159. package/lib/commands/menu/group-update.js +1 -1
  160. package/lib/commands/menu/index.js +1 -1
  161. package/lib/commands/menu/list.js +1 -1
  162. package/lib/commands/menu/move.js +1 -1
  163. package/lib/commands/menu/regroup-start.js +1 -1
  164. package/lib/commands/menu/rename.js +1 -1
  165. package/lib/commands/menu/shared/compare-table.js +1 -1
  166. package/lib/commands/menu/shared/delete-plan.js +1 -1
  167. package/lib/commands/menu/shared/facts.js +1 -1
  168. package/lib/commands/menu/shared/index.js +1 -1
  169. package/lib/commands/menu/shared/inquirer.js +1 -1
  170. package/lib/commands/menu/shared/local-pages.d.ts +1 -1
  171. package/lib/commands/menu/shared/local-pages.js +1 -1
  172. package/lib/commands/menu/shared/logic.d.ts +3 -1
  173. package/lib/commands/menu/shared/logic.js +1 -1
  174. package/lib/commands/menu/shared/mutations.js +1 -1
  175. package/lib/commands/menu/shared/path.d.ts +2 -0
  176. package/lib/commands/menu/shared/path.js +1 -0
  177. package/lib/commands/menu/shared/service.d.ts +6 -1
  178. package/lib/commands/menu/shared/service.js +1 -1
  179. package/lib/commands/menu/shared/subapp-assets.d.ts +28 -0
  180. package/lib/commands/menu/shared/subapp-assets.js +1 -0
  181. package/lib/commands/menu/shared/sync-core.d.ts +2 -1
  182. package/lib/commands/menu/shared/sync-core.js +1 -1
  183. package/lib/commands/menu/shared/types.d.ts +14 -4
  184. package/lib/commands/menu/shared/update-core.js +1 -1
  185. package/lib/commands/menu/shared/valid-url.js +1 -1
  186. package/lib/commands/menu/subapp-assets-status.d.ts +2 -0
  187. package/lib/commands/menu/subapp-assets-status.js +1 -0
  188. package/lib/commands/menu/subapp-assets-update.d.ts +2 -0
  189. package/lib/commands/menu/subapp-assets-update.js +1 -0
  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.d.ts +15 -0
  289. package/lib/core/api-client.js +1 -1
  290. package/lib/core/bff/config.js +1 -1
  291. package/lib/core/bff/file-system.js +1 -1
  292. package/lib/core/bff/hash.js +1 -1
  293. package/lib/core/bff/hook-directory.js +1 -1
  294. package/lib/core/bff/lock.js +1 -1
  295. package/lib/core/bff/utils.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/skills/builtin-skill.js +1 -1
  338. package/lib/skills/main.js +1 -1
  339. package/lib/skills/npx-skills-add.js +1 -1
  340. package/lib/skills/skill-presence.js +1 -1
  341. package/lib/telemetry/cli-command-trace.js +1 -1
  342. package/lib/telemetry/cli-help-trace.js +1 -1
  343. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  344. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  345. package/lib/telemetry/send-cli-trace-log.js +1 -1
  346. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  347. package/lib/utils/ai_config.js +1 -1
  348. package/lib/utils/apply-jq-filter.js +1 -1
  349. package/lib/utils/cdn-config.js +1 -1
  350. package/lib/utils/check-sdk-version.js +1 -1
  351. package/lib/utils/cli-version-check.js +1 -1
  352. package/lib/utils/cli-version-policy.js +1 -1
  353. package/lib/utils/config.js +1 -1
  354. package/lib/utils/entity-with-id.js +1 -1
  355. package/lib/utils/file-utils.js +1 -1
  356. package/lib/utils/guides-cdn.js +1 -1
  357. package/lib/utils/http-client.js +1 -1
  358. package/lib/utils/is-non-interactive.js +1 -1
  359. package/lib/utils/logger.js +1 -1
  360. package/lib/utils/params.js +1 -1
  361. package/lib/utils/platform.js +1 -1
  362. package/lib/utils/sleep.js +1 -1
  363. package/lib/utils/template-replacer.js +1 -1
  364. package/lib/utils/update-notice.js +1 -1
  365. package/lib/utils/version.js +1 -1
  366. package/lib/utils/with-active-cookie.js +1 -1
  367. package/lib/utils/write-cli-side-channel.js +1 -1
  368. package/package.json +1 -1
  369. package/skills/rabetbase/SKILL.md +21 -12
  370. package/skills/rabetbase/guides/backend-function.md +2 -7
  371. package/skills/rabetbase/guides/bff-creation-workflow.md +24 -23
  372. package/skills/rabetbase/guides/host-frontend-integration.md +62 -0
  373. package/skills/rabetbase/guides/independent-deployment.md +45 -0
  374. package/skills/rabetbase/guides/troubleshooting.md +9 -1
  375. package/skills/rabetbase/references/rabetbase-app-detail.md +31 -0
  376. package/skills/rabetbase/references/rabetbase-bff-detail.md +1 -1
  377. package/skills/rabetbase/references/rabetbase-bff-push.md +2 -2
  378. package/skills/rabetbase/references/rabetbase-data-list-status.md +1 -0
  379. package/skills/rabetbase/references/rabetbase-deployment-sync-all.md +5 -1
  380. package/skills/rabetbase/references/rabetbase-menu-asset-update.md +9 -7
  381. package/skills/rabetbase/references/rabetbase-menu-list.md +2 -2
  382. package/skills/rabetbase/references/rabetbase-menu-subapp-assets-status.md +19 -0
  383. package/skills/rabetbase/references/rabetbase-menu-subapp-assets-update.md +27 -0
  384. package/skills/rabetbase/references/rabetbase-menu-sync.md +40 -14
  385. package/skills/rabetbase/references/rabetbase-page-create.md +1 -1
  386. package/skills/rabetbase/references/rabetbase-page-generate-start.md +5 -3
  387. package/skills/rabetbase/references/rabetbase-page-generate-status.md +1 -0
  388. package/skills/rabetbase.manifest.json +8 -3
@@ -1 +1 @@
1
- const a226_0x3ea05e=a226_0x46eb;function a226_0x5a39(){const _0x561cc3=['160yHgfVB','365717LcZBOI','5000lpncVZ','49ermseV','160NqGLcf','9nwnyBD','appCode','101eWvtcE','read','map','cookie','318732AtweeO','rule','Loaded\x20app\x20rule\x20configuration\x20for\x20','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','17496300tbBKpi','1648JKOxZq','286890HMPHyA','917848xDFWPG'];a226_0x5a39=function(){return _0x561cc3;};return a226_0x5a39();}(function(_0x49a5a6,_0x5cfd7a){const _0x3b1eea=a226_0x46eb,_0x445c91=_0x49a5a6();while(!![]){try{const _0x394776=-parseInt(_0x3b1eea(0x172))/0x1*(parseInt(_0x3b1eea(0x168))/0x2)+-parseInt(_0x3b1eea(0x169))/0x3+-parseInt(_0x3b1eea(0x16f))/0x4*(-parseInt(_0x3b1eea(0x16d))/0x5)+-parseInt(_0x3b1eea(0x176))/0x6*(parseInt(_0x3b1eea(0x16e))/0x7)+parseInt(_0x3b1eea(0x16a))/0x8*(-parseInt(_0x3b1eea(0x170))/0x9)+parseInt(_0x3b1eea(0x16b))/0xa*(-parseInt(_0x3b1eea(0x16c))/0xb)+parseInt(_0x3b1eea(0x17a))/0xc;if(_0x394776===_0x5cfd7a)break;else _0x445c91['push'](_0x445c91['shift']());}catch(_0x4c69dc){_0x445c91['push'](_0x445c91['shift']());}}}(a226_0x5a39,0x4965a));function a226_0x46eb(_0x28db85,_0x2e2d46){_0x28db85=_0x28db85-0x168;const _0x5a39c4=a226_0x5a39();let _0x46eb25=_0x5a39c4[_0x28db85];return _0x46eb25;}import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':a226_0x3ea05e(0x177),'command':'list','description':a226_0x3ea05e(0x179),'risk':a226_0x3ea05e(0x173),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x275af4){const _0x28c2b5=a226_0x3ea05e,_0x493c4a=await Promise['all'](APP_RULE_TYPES[_0x28c2b5(0x174)](_0x405a2c=>getAppRule(_0x275af4[_0x28c2b5(0x175)],{'appCode':_0x275af4[_0x28c2b5(0x171)],'type':_0x405a2c}))),_0x4bf38e=APP_RULE_TYPES[_0x28c2b5(0x174)]((_0x1f14a8,_0x30b11)=>projectAppRule(_0x1f14a8,_0x493c4a[_0x30b11]??null));return{'ok':!![],'data':{'total':_0x4bf38e['length'],'rules':_0x4bf38e},'message':_0x28c2b5(0x178)+_0x275af4[_0x28c2b5(0x171)]};}};
1
+ function a231_0x3e0b(_0x4222e8,_0x13ac16){_0x4222e8=_0x4222e8-0x1c0;const _0x4e9601=a231_0x4e96();let _0x3e0b39=_0x4e9601[_0x4222e8];return _0x3e0b39;}const a231_0x4a0f7d=a231_0x3e0b;function a231_0x4e96(){const _0x1773a9=['5089536hQwtSt','3534984fgjciz','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','list','3519425rROVkK','43511430IPDFXl','all','8NZNJUp','103245LihtJc','3xnyyYo','9wSceVc','7121100wFxQkn','map','734834EgVAOg','read','length'];a231_0x4e96=function(){return _0x1773a9;};return a231_0x4e96();}(function(_0x2087a5,_0x459727){const _0x34d181=a231_0x3e0b,_0x583373=_0x2087a5();while(!![]){try{const _0x1638c8=parseInt(_0x34d181(0x1cf))/0x1*(-parseInt(_0x34d181(0x1c3))/0x2)+-parseInt(_0x34d181(0x1ce))/0x3*(parseInt(_0x34d181(0x1cd))/0x4)+-parseInt(_0x34d181(0x1c1))/0x5+-parseInt(_0x34d181(0x1c6))/0x6+-parseInt(_0x34d181(0x1ca))/0x7+parseInt(_0x34d181(0x1c7))/0x8+parseInt(_0x34d181(0x1c0))/0x9*(parseInt(_0x34d181(0x1cb))/0xa);if(_0x1638c8===_0x459727)break;else _0x583373['push'](_0x583373['shift']());}catch(_0x1e07d4){_0x583373['push'](_0x583373['shift']());}}}(a231_0x4e96,0xceb5c));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':'rule','command':a231_0x4a0f7d(0x1c9),'description':a231_0x4a0f7d(0x1c8),'risk':a231_0x4a0f7d(0x1c4),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x518e44){const _0x256435=a231_0x4a0f7d,_0x26e771=await Promise[_0x256435(0x1cc)](APP_RULE_TYPES['map'](_0x2b0c1c=>getAppRule(_0x518e44['cookie'],{'appCode':_0x518e44['appCode'],'type':_0x2b0c1c}))),_0x4b6fd9=APP_RULE_TYPES[_0x256435(0x1c2)]((_0x14f26f,_0x51b65f)=>projectAppRule(_0x14f26f,_0x26e771[_0x51b65f]??null));return{'ok':!![],'data':{'total':_0x4b6fd9[_0x256435(0x1c5)],'rules':_0x4b6fd9},'message':'Loaded\x20app\x20rule\x20configuration\x20for\x20'+_0x518e44['appCode']};}};
@@ -1 +1 @@
1
- function a227_0x2010(_0x426341,_0x310611){_0x426341=_0x426341-0xe5;const _0x55213a=a227_0x5521();let _0x2010d4=_0x55213a[_0x426341];return _0x2010d4;}const a227_0x59df97=a227_0x2010;(function(_0xdddfe8,_0x334ba8){const _0x5b3157=a227_0x2010,_0x950bf1=_0xdddfe8();while(!![]){try{const _0x31d967=parseInt(_0x5b3157(0x10b))/0x1*(parseInt(_0x5b3157(0x120))/0x2)+parseInt(_0x5b3157(0xfd))/0x3+parseInt(_0x5b3157(0x104))/0x4+-parseInt(_0x5b3157(0x102))/0x5+-parseInt(_0x5b3157(0xf8))/0x6+parseInt(_0x5b3157(0xeb))/0x7*(parseInt(_0x5b3157(0x10c))/0x8)+-parseInt(_0x5b3157(0x107))/0x9;if(_0x31d967===_0x334ba8)break;else _0x950bf1['push'](_0x950bf1['shift']());}catch(_0x1d13e3){_0x950bf1['push'](_0x950bf1['shift']());}}}(a227_0x5521,0xcc508));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=a227_0x59df97(0x101),NON_ATOMIC_WARNING=a227_0x59df97(0xf5);function readSetInput(_0x492d6e){const _0x487ded=a227_0x59df97,_0x5d8a52=readAppRuleType(_0x492d6e),_0x37e3b4=_0x492d6e['str'](_0x487ded(0x122))['trim']();if(!_0x37e3b4)throw appRuleError(_0x487ded(0x116),_0x487ded(0xe6),_0x487ded(0xed));const _0x5f44f4=_0x492d6e[_0x487ded(0xee)](_0x487ded(0xe5));let _0x381805;if(_0x5f44f4!==undefined){_0x381805=Number(_0x5f44f4);if(!Number[_0x487ded(0x108)](_0x381805)||_0x381805<0x0)throw appRuleError(_0x487ded(0x118),'--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.');}return{'type':_0x5d8a52,'file':_0x37e3b4,'expectedVersion':_0x381805};}async function prepareSet(_0x4fff9c){const _0x1b6c76=a227_0x59df97,_0x33f96d=readSetInput(_0x4fff9c),_0x2af1e2=await readAppRuleFile(_0x33f96d[_0x1b6c76(0x122)]),_0x1847ca=await getAppRule(_0x4fff9c[_0x1b6c76(0xfa)],{'appCode':_0x4fff9c[_0x1b6c76(0xf4)],'type':_0x33f96d[_0x1b6c76(0xef)]});if(_0x33f96d[_0x1b6c76(0xe7)]!==undefined&&_0x1847ca?.[_0x1b6c76(0x117)]!==_0x33f96d[_0x1b6c76(0xe7)])throw appRuleError(_0x1b6c76(0xea),appRuleFileName(_0x33f96d[_0x1b6c76(0xef)])+_0x1b6c76(0x11c),_0x1b6c76(0x10d)+_0x33f96d[_0x1b6c76(0xe7)]+';\x20current\x20version\x20is\x20'+(_0x1847ca?.[_0x1b6c76(0x117)]??_0x1b6c76(0x11b))+_0x1b6c76(0x115));return{'input':_0x33f96d,'replacement':_0x2af1e2,'beforeRecord':_0x1847ca,'before':projectAppRule(_0x33f96d[_0x1b6c76(0xef)],_0x1847ca),'planned':{'type':_0x33f96d[_0x1b6c76(0xef)],'fileName':appRuleFileName(_0x33f96d[_0x1b6c76(0xef)]),'contextScope':appRuleContextScope(_0x33f96d['type']),'enabled':!![],'appCode':_0x4fff9c[_0x1b6c76(0xf4)],'scope':_0x1b6c76(0xf9),'contentByteSize':_0x2af1e2[_0x1b6c76(0x11a)],'contentHash':_0x2af1e2[_0x1b6c76(0xe9)]}};}function warningsFor(_0x5c41a6){return _0x5c41a6===undefined?[]:[NON_ATOMIC_WARNING];}function a227_0x5521(){const _0x46cb66=['Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','Pass\x20a\x20UTF-8\x20Markdown\x20file.','flag','type','\x20--format\x20compress','before','app_rule_set_outcome_unknown','rabetbase\x20rule\x20get\x20--type\x20','appCode','--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.','set','Set\x20','5851302TuHqPN','rules','cookie','POST','verified','1903977rDilOt','\x20for\x20','number','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','/smartapi/knowledge-base/save','2945975iuVzXZ','cause','3167988ltyGQo','planned','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','2691234yBjXGq','isSafeInteger','app_rule_verification_unavailable','Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version','2ODBSYL','288tImnTh','Expected\x20','string','push','rule','input','content','\x20could\x20not\x20be\x20verified.','replacement','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','app_rule_file_required','version','app_rule_expected_version_invalid','write','byteSize','unconfigured','\x20version\x20changed\x20before\x20write.','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','beforeRecord','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','259066OiNgAS','UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)','file','expected-version','--file\x20is\x20required.','expectedVersion','defineProperty','contentHash','app_rule_version_mismatch','197281MbAJcS'];a227_0x5521=function(){return _0x46cb66;};return a227_0x5521();}export const ruleSet={'service':a227_0x59df97(0x110),'command':a227_0x59df97(0xf6),'description':'Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','risk':a227_0x59df97(0x119),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a227_0x59df97(0x122),'type':a227_0x59df97(0x10e),'required':!![],'description':a227_0x59df97(0x121)},{'name':a227_0x59df97(0xe5),'type':a227_0x59df97(0xff),'required':![],'description':a227_0x59df97(0x10a)}],async 'validate'(_0x2aad95){readSetInput(_0x2aad95);},async 'dryRun'(_0x13d43e){const _0x2fdb1e=a227_0x59df97,_0xe958b3=await prepareSet(_0x13d43e);return asDryRunResult({'operation':'set','selector':{'appCode':_0x13d43e[_0x2fdb1e(0xf4)],'scope':_0x2fdb1e(0xf9),'type':_0xe958b3[_0x2fdb1e(0x111)]['type']},'before':_0xe958b3['before'],'after':_0xe958b3[_0x2fdb1e(0x105)],'dryRun':!![],'backend':{'method':_0x2fdb1e(0xfb),'path':SAVE_PATH},'warnings':warningsFor(_0xe958b3[_0x2fdb1e(0x111)][_0x2fdb1e(0xe7)]),'verification':{'expectedVersion':_0xe958b3[_0x2fdb1e(0x111)][_0x2fdb1e(0xe7)]??null,'atomicCompareAndSet':![],'lookupCommand':'rabetbase\x20rule\x20get\x20--type\x20'+_0xe958b3[_0x2fdb1e(0x111)][_0x2fdb1e(0xef)]+_0x2fdb1e(0xf0)}},{'method':_0x2fdb1e(0xfb),'url':SAVE_PATH});},async 'execute'(_0x1939ff){const _0x262aad=a227_0x59df97,_0x100c2c=await prepareSet(_0x1939ff);let _0x139c61=![];try{await saveAppRule(_0x1939ff['cookie'],{'appCode':_0x1939ff[_0x262aad(0xf4)],'type':_0x100c2c[_0x262aad(0x111)][_0x262aad(0xef)],'content':_0x100c2c[_0x262aad(0x114)][_0x262aad(0x112)]});}catch(_0x1e19a2){if(!isPlatformTransportFailure(_0x1e19a2))throw _0x1e19a2;_0x139c61=!![];}let _0x35531c;try{_0x35531c=await getAppRule(_0x1939ff[_0x262aad(0xfa)],{'appCode':_0x1939ff[_0x262aad(0xf4)],'type':_0x100c2c[_0x262aad(0x111)][_0x262aad(0xef)]});}catch(_0x2ba5dd){const _0x3545b8=appRuleError(_0x139c61?_0x262aad(0xf2):_0x262aad(0x109),'The\x20set\x20request\x20was\x20sent,\x20but\x20'+appRuleFileName(_0x100c2c[_0x262aad(0x111)]['type'])+_0x262aad(0x113),_0x262aad(0xec));Object[_0x262aad(0xe8)](_0x3545b8,_0x262aad(0x103),{'value':_0x2ba5dd,'enumerable':![]});throw _0x3545b8;}const _0x490a8f=_0x35531c&&inspectAppRuleContent(_0x35531c[_0x262aad(0x112)])[_0x262aad(0xe9)]===_0x100c2c[_0x262aad(0x114)][_0x262aad(0xe9)],_0x2a79ce=_0x35531c&&(_0x100c2c[_0x262aad(0x11e)]===null||_0x35531c['version']>_0x100c2c[_0x262aad(0x11e)][_0x262aad(0x117)]);if(!_0x35531c||!_0x490a8f||!_0x2a79ce)throw appRuleError(_0x139c61?_0x262aad(0xf2):'app_rule_verification_failed',appRuleFileName(_0x100c2c[_0x262aad(0x111)][_0x262aad(0xef)])+_0x262aad(0x106),_0x262aad(0x11d)+_0x100c2c[_0x262aad(0x111)][_0x262aad(0xef)]+_0x262aad(0x11f));const _0x12fff5=warningsFor(_0x100c2c['input']['expectedVersion']);_0x139c61&&_0x12fff5[_0x262aad(0x10f)](_0x262aad(0x100));const _0x34a247=projectAppRule(_0x100c2c['input']['type'],_0x35531c);return{'ok':!![],'data':{'operation':_0x262aad(0xf6),'selector':{'appCode':_0x1939ff['appCode'],'scope':'rules','type':_0x100c2c[_0x262aad(0x111)][_0x262aad(0xef)]},'before':_0x100c2c[_0x262aad(0xf1)],'after':_0x34a247,'dryRun':![],'backend':{'method':'POST','path':SAVE_PATH},'warnings':_0x12fff5,'verification':{'status':_0x262aad(0xfc),'recoveredAfterUnknownResponse':_0x139c61,'expectedVersion':_0x100c2c[_0x262aad(0x111)][_0x262aad(0xe7)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x262aad(0xf3)+_0x100c2c[_0x262aad(0x111)][_0x262aad(0xef)]+_0x262aad(0xf0)}},'message':_0x262aad(0xf7)+appRuleFileName(_0x100c2c['input'][_0x262aad(0xef)])+_0x262aad(0xfe)+_0x1939ff[_0x262aad(0xf4)]};}};
1
+ const a232_0xabb6ce=a232_0x1577;(function(_0x444b9a,_0x5201b8){const _0x59d7c6=a232_0x1577,_0xccab0c=_0x444b9a();while(!![]){try{const _0x1167cc=parseInt(_0x59d7c6(0x149))/0x1+-parseInt(_0x59d7c6(0x139))/0x2+-parseInt(_0x59d7c6(0x144))/0x3+parseInt(_0x59d7c6(0x12e))/0x4*(-parseInt(_0x59d7c6(0x157))/0x5)+parseInt(_0x59d7c6(0x143))/0x6+-parseInt(_0x59d7c6(0x163))/0x7+parseInt(_0x59d7c6(0x162))/0x8;if(_0x1167cc===_0x5201b8)break;else _0xccab0c['push'](_0xccab0c['shift']());}catch(_0xba0b20){_0xccab0c['push'](_0xccab0c['shift']());}}}(a232_0x127f,0xb25b6));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 a232_0x127f(){const _0x370ad7=['rules','1171484euQskD','app_rule_verification_failed','number','planned','app_rule_set_outcome_unknown','cause','flag','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','Expected\x20','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','830054UcyduU','The\x20set\x20request\x20was\x20sent,\x20but\x20','byteSize','rule','\x20version\x20changed\x20before\x20write.','POST','expectedVersion','beforeRecord','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','type','6634230PdZQsp','2233719QBAvTq','file','string','str','trim','142235qGOScn','content','app_rule_verification_unavailable','--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','replacement','contentHash','defineProperty','app_rule_expected_version_invalid','Pass\x20a\x20UTF-8\x20Markdown\x20file.','app_rule_version_mismatch','input','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','cookie','5vTDwSs','unconfigured','rabetbase\x20rule\x20get\x20--type\x20','version','appCode','push','--file\x20is\x20required.','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.',';\x20current\x20version\x20is\x20','set','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','18207776kHzRJT','9386237vALBTj','expected-version','before','app_rule_file_required','\x20--format\x20compress'];a232_0x127f=function(){return _0x370ad7;};return a232_0x127f();}function a232_0x1577(_0x2366b0,_0x344692){_0x2366b0=_0x2366b0-0x12b;const _0x127f20=a232_0x127f();let _0x15774b=_0x127f20[_0x2366b0];return _0x15774b;}const SAVE_PATH='/smartapi/knowledge-base/save',NON_ATOMIC_WARNING=a232_0xabb6ce(0x14c);function readSetInput(_0x2c2921){const _0x20507a=a232_0xabb6ce,_0x4945fe=readAppRuleType(_0x2c2921),_0x3752ee=_0x2c2921[_0x20507a(0x147)](_0x20507a(0x145))[_0x20507a(0x148)]();if(!_0x3752ee)throw appRuleError(_0x20507a(0x12b),_0x20507a(0x15d),_0x20507a(0x152));const _0xbfa3d7=_0x2c2921[_0x20507a(0x134)](_0x20507a(0x164));let _0x598e38;if(_0xbfa3d7!==undefined){_0x598e38=Number(_0xbfa3d7);if(!Number['isSafeInteger'](_0x598e38)||_0x598e38<0x0)throw appRuleError(_0x20507a(0x151),_0x20507a(0x136));}return{'type':_0x4945fe,'file':_0x3752ee,'expectedVersion':_0x598e38};}async function prepareSet(_0x5d0be9){const _0x4db0ec=a232_0xabb6ce,_0x3c57af=readSetInput(_0x5d0be9),_0x5e2229=await readAppRuleFile(_0x3c57af['file']),_0x3e16bc=await getAppRule(_0x5d0be9[_0x4db0ec(0x156)],{'appCode':_0x5d0be9[_0x4db0ec(0x15b)],'type':_0x3c57af[_0x4db0ec(0x142)]});if(_0x3c57af[_0x4db0ec(0x13f)]!==undefined&&_0x3e16bc?.[_0x4db0ec(0x15a)]!==_0x3c57af[_0x4db0ec(0x13f)])throw appRuleError(_0x4db0ec(0x153),appRuleFileName(_0x3c57af[_0x4db0ec(0x142)])+_0x4db0ec(0x13d),_0x4db0ec(0x137)+_0x3c57af[_0x4db0ec(0x13f)]+_0x4db0ec(0x15f)+(_0x3e16bc?.[_0x4db0ec(0x15a)]??_0x4db0ec(0x158))+_0x4db0ec(0x135));return{'input':_0x3c57af,'replacement':_0x5e2229,'beforeRecord':_0x3e16bc,'before':projectAppRule(_0x3c57af[_0x4db0ec(0x142)],_0x3e16bc),'planned':{'type':_0x3c57af[_0x4db0ec(0x142)],'fileName':appRuleFileName(_0x3c57af[_0x4db0ec(0x142)]),'contextScope':appRuleContextScope(_0x3c57af['type']),'enabled':!![],'appCode':_0x5d0be9[_0x4db0ec(0x15b)],'scope':_0x4db0ec(0x12d),'contentByteSize':_0x5e2229[_0x4db0ec(0x13b)],'contentHash':_0x5e2229[_0x4db0ec(0x14f)]}};}function warningsFor(_0x2b00b0){return _0x2b00b0===undefined?[]:[NON_ATOMIC_WARNING];}export const ruleSet={'service':a232_0xabb6ce(0x13c),'command':a232_0xabb6ce(0x160),'description':a232_0xabb6ce(0x161),'risk':'write','requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a232_0xabb6ce(0x145),'type':a232_0xabb6ce(0x146),'required':!![],'description':'UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)'},{'name':'expected-version','type':a232_0xabb6ce(0x130),'required':![],'description':'Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version'}],async 'validate'(_0x2d1582){readSetInput(_0x2d1582);},async 'dryRun'(_0x16b753){const _0x286dd2=a232_0xabb6ce,_0x46ca0a=await prepareSet(_0x16b753);return asDryRunResult({'operation':'set','selector':{'appCode':_0x16b753[_0x286dd2(0x15b)],'scope':_0x286dd2(0x12d),'type':_0x46ca0a[_0x286dd2(0x154)][_0x286dd2(0x142)]},'before':_0x46ca0a[_0x286dd2(0x165)],'after':_0x46ca0a[_0x286dd2(0x131)],'dryRun':!![],'backend':{'method':_0x286dd2(0x13e),'path':SAVE_PATH},'warnings':warningsFor(_0x46ca0a[_0x286dd2(0x154)][_0x286dd2(0x13f)]),'verification':{'expectedVersion':_0x46ca0a[_0x286dd2(0x154)]['expectedVersion']??null,'atomicCompareAndSet':![],'lookupCommand':_0x286dd2(0x159)+_0x46ca0a[_0x286dd2(0x154)][_0x286dd2(0x142)]+'\x20--format\x20compress'}},{'method':'POST','url':SAVE_PATH});},async 'execute'(_0x2c016c){const _0x4dcb64=a232_0xabb6ce,_0x244f1a=await prepareSet(_0x2c016c);let _0x170348=![];try{await saveAppRule(_0x2c016c[_0x4dcb64(0x156)],{'appCode':_0x2c016c['appCode'],'type':_0x244f1a[_0x4dcb64(0x154)][_0x4dcb64(0x142)],'content':_0x244f1a[_0x4dcb64(0x14e)][_0x4dcb64(0x14a)]});}catch(_0x516896){if(!isPlatformTransportFailure(_0x516896))throw _0x516896;_0x170348=!![];}let _0x5b5a3d;try{_0x5b5a3d=await getAppRule(_0x2c016c[_0x4dcb64(0x156)],{'appCode':_0x2c016c[_0x4dcb64(0x15b)],'type':_0x244f1a[_0x4dcb64(0x154)][_0x4dcb64(0x142)]});}catch(_0xbb2807){const _0x18406a=appRuleError(_0x170348?_0x4dcb64(0x132):_0x4dcb64(0x14b),_0x4dcb64(0x13a)+appRuleFileName(_0x244f1a[_0x4dcb64(0x154)][_0x4dcb64(0x142)])+'\x20could\x20not\x20be\x20verified.',_0x4dcb64(0x155));Object[_0x4dcb64(0x150)](_0x18406a,_0x4dcb64(0x133),{'value':_0xbb2807,'enumerable':![]});throw _0x18406a;}const _0x56f00b=_0x5b5a3d&&inspectAppRuleContent(_0x5b5a3d[_0x4dcb64(0x14a)])[_0x4dcb64(0x14f)]===_0x244f1a[_0x4dcb64(0x14e)][_0x4dcb64(0x14f)],_0x4fb2d2=_0x5b5a3d&&(_0x244f1a[_0x4dcb64(0x140)]===null||_0x5b5a3d['version']>_0x244f1a[_0x4dcb64(0x140)][_0x4dcb64(0x15a)]);if(!_0x5b5a3d||!_0x56f00b||!_0x4fb2d2)throw appRuleError(_0x170348?_0x4dcb64(0x132):_0x4dcb64(0x12f),appRuleFileName(_0x244f1a['input'][_0x4dcb64(0x142)])+_0x4dcb64(0x14d),_0x4dcb64(0x141)+_0x244f1a['input'][_0x4dcb64(0x142)]+_0x4dcb64(0x15e));const _0x576850=warningsFor(_0x244f1a['input'][_0x4dcb64(0x13f)]);_0x170348&&_0x576850[_0x4dcb64(0x15c)](_0x4dcb64(0x138));const _0x5a0124=projectAppRule(_0x244f1a[_0x4dcb64(0x154)]['type'],_0x5b5a3d);return{'ok':!![],'data':{'operation':_0x4dcb64(0x160),'selector':{'appCode':_0x2c016c['appCode'],'scope':'rules','type':_0x244f1a['input'][_0x4dcb64(0x142)]},'before':_0x244f1a[_0x4dcb64(0x165)],'after':_0x5a0124,'dryRun':![],'backend':{'method':_0x4dcb64(0x13e),'path':SAVE_PATH},'warnings':_0x576850,'verification':{'status':'verified','recoveredAfterUnknownResponse':_0x170348,'expectedVersion':_0x244f1a['input'][_0x4dcb64(0x13f)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x4dcb64(0x159)+_0x244f1a[_0x4dcb64(0x154)][_0x4dcb64(0x142)]+_0x4dcb64(0x12c)}},'message':'Set\x20'+appRuleFileName(_0x244f1a[_0x4dcb64(0x154)][_0x4dcb64(0x142)])+'\x20for\x20'+_0x2c016c[_0x4dcb64(0x15b)]};}};
@@ -1 +1 @@
1
- const a228_0x42fe83=a228_0x5190;function a228_0x5190(_0x13cce8,_0x28919a){_0x13cce8=_0x13cce8-0x77;const _0x378c6d=a228_0x378c();let _0x5190c5=_0x378c6d[_0x13cce8];return _0x5190c5;}(function(_0x2251eb,_0x2bb3d2){const _0xe4327d=a228_0x5190,_0x1c2454=_0x2251eb();while(!![]){try{const _0x168f05=parseInt(_0xe4327d(0x7d))/0x1+-parseInt(_0xe4327d(0x99))/0x2+-parseInt(_0xe4327d(0x9b))/0x3*(-parseInt(_0xe4327d(0x84))/0x4)+parseInt(_0xe4327d(0x87))/0x5+-parseInt(_0xe4327d(0x8f))/0x6*(parseInt(_0xe4327d(0x80))/0x7)+parseInt(_0xe4327d(0xa2))/0x8+-parseInt(_0xe4327d(0x7a))/0x9*(parseInt(_0xe4327d(0x95))/0xa);if(_0x168f05===_0x2bb3d2)break;else _0x1c2454['push'](_0x1c2454['shift']());}catch(_0x6cce58){_0x1c2454['push'](_0x1c2454['shift']());}}}(a228_0x378c,0xa6e86));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';function a228_0x378c(){const _0x161622=['rules','version','467590TrLJya','updateTime','3DsmCuf','Cannot\x20access\x20app\x20rule\x20file:\x20','database','App\x20rule\x20file\x20is\x20blank:\x20','Pass\x20a\x20UTF-8\x20Markdown\x20file.','byteSize','app_rule_content_invalid','4365352FIqHIw','str','app_rule_file_invalid','from','9Cmwdvb','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','app_rule_content_too_large','951800ruGKZY','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','size','1241338cnnLsB','sha256:','trim','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','2903124fsLhhD','byteLength','app_rule_file_required','4735275eOmuAo','createTime','database-analysis','message','utf8','app_rule_file_unreadable','RULES.md','digest','12CwQIvm','decode','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','toLowerCase','sha256','content','18981880DaOlBT','DATABASE.md'];a228_0x378c=function(){return _0x161622;};return a228_0x378c();}import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a228_0x42fe83(0x97),a228_0x42fe83(0x9d)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a228_0x42fe83(0x8d),'database':a228_0x42fe83(0x96)},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':a228_0x42fe83(0x89)};export function appRuleError(_0x2ca0a6,_0x5bbaac,_0x3c9fdb){return new CliError(_0x2ca0a6,0x1,_0x5bbaac,_0x3c9fdb);}export function readAppRuleType(_0x31624f){const _0x250493=a228_0x42fe83,_0x4cc7fe=_0x31624f[_0x250493(0x77)]('type')[_0x250493(0x82)]()[_0x250493(0x92)]();if(_0x4cc7fe!==_0x250493(0x97)&&_0x4cc7fe!==_0x250493(0x9d))throw appRuleError('app_rule_type_invalid','--type\x20must\x20be\x20either\x20rules\x20or\x20database.');return _0x4cc7fe;}export function appRuleFileName(_0x56578f){return APP_RULE_FILES[_0x56578f];}export function appRuleContextScope(_0x25eb52){return APP_RULE_CONTEXT_SCOPES[_0x25eb52];}export function inspectAppRuleContent(_0x241e2f){const _0x555f27=a228_0x42fe83,_0x4e45da=Buffer[_0x555f27(0x79)](_0x241e2f,_0x555f27(0x8b));return{'content':_0x241e2f,'byteSize':_0x4e45da[_0x555f27(0x85)],'contentHash':_0x555f27(0x81)+createHash(_0x555f27(0x93))['update'](_0x4e45da)[_0x555f27(0x8e)]('hex')};}export async function readAppRuleFile(_0xa58923){const _0x3714dd=a228_0x42fe83,_0x4377a7=_0xa58923[_0x3714dd(0x82)]();if(!_0x4377a7)throw appRuleError(_0x3714dd(0x86),'--file\x20is\x20required.',_0x3714dd(0x9f));const _0xfbcc6f=resolve(_0x4377a7);let _0x5dd320;try{_0x5dd320=await stat(_0xfbcc6f);}catch(_0x29481e){throw appRuleError(_0x3714dd(0x8c),_0x3714dd(0x9c)+_0x4377a7,_0x29481e instanceof Error?_0x29481e[_0x3714dd(0x8a)]:String(_0x29481e));}if(!_0x5dd320['isFile']())throw appRuleError(_0x3714dd(0x78),_0x3714dd(0x83)+_0x4377a7);if(_0x5dd320[_0x3714dd(0x7f)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x3714dd(0x7c),_0x3714dd(0x91));let _0x40f042;try{_0x40f042=await readFile(_0xfbcc6f);}catch(_0x5283ee){throw appRuleError(_0x3714dd(0x8c),'Cannot\x20read\x20app\x20rule\x20file:\x20'+_0x4377a7,_0x5283ee instanceof Error?_0x5283ee[_0x3714dd(0x8a)]:String(_0x5283ee));}if(_0x40f042[_0x3714dd(0x85)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x3714dd(0x7c),_0x3714dd(0x91));let _0x4f60e5;try{_0x4f60e5=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})[_0x3714dd(0x90)](_0x40f042);}catch{throw appRuleError('app_rule_content_invalid',_0x3714dd(0x7b)+_0x4377a7);}if(!_0x4f60e5[_0x3714dd(0x82)]())throw appRuleError(_0x3714dd(0xa1),_0x3714dd(0x9e)+_0x4377a7);return inspectAppRuleContent(_0x4f60e5);}export function projectAppRule(_0xe45f2b,_0x12268e){const _0x210efd=a228_0x42fe83;if(!_0x12268e)return{'type':_0xe45f2b,'fileName':appRuleFileName(_0xe45f2b),'contextScope':appRuleContextScope(_0xe45f2b),'enabled':![]};const _0x562307=inspectAppRuleContent(_0x12268e[_0x210efd(0x94)]);return{'type':_0xe45f2b,'fileName':appRuleFileName(_0xe45f2b),'contextScope':appRuleContextScope(_0xe45f2b),'enabled':!![],'id':_0x12268e['id'],'scope':_0x12268e['scope'],'appCode':_0x12268e['appCode'],'version':_0x12268e[_0x210efd(0x98)],'contentByteSize':_0x562307[_0x210efd(0xa0)],'contentHash':_0x562307['contentHash'],..._0x12268e['createTime']!==undefined&&_0x12268e[_0x210efd(0x88)]!==null?{'createTime':_0x12268e[_0x210efd(0x88)]}:{},..._0x12268e[_0x210efd(0x9a)]!==undefined&&_0x12268e[_0x210efd(0x9a)]!==null?{'updateTime':_0x12268e[_0x210efd(0x9a)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':'type','type':'string','required':!![],'description':a228_0x42fe83(0x7e),'enum':[...APP_RULE_TYPES]};
1
+ const a233_0x3ff7ab=a233_0x315b;(function(_0x58bb6b,_0x1d1e3f){const _0x5081ad=a233_0x315b,_0x30594e=_0x58bb6b();while(!![]){try{const _0x426222=parseInt(_0x5081ad(0x86))/0x1+-parseInt(_0x5081ad(0x8b))/0x2*(parseInt(_0x5081ad(0x76))/0x3)+-parseInt(_0x5081ad(0x94))/0x4+-parseInt(_0x5081ad(0x81))/0x5+-parseInt(_0x5081ad(0x98))/0x6*(-parseInt(_0x5081ad(0x7f))/0x7)+-parseInt(_0x5081ad(0x7e))/0x8+parseInt(_0x5081ad(0x72))/0x9;if(_0x426222===_0x1d1e3f)break;else _0x30594e['push'](_0x30594e['shift']());}catch(_0x2efd35){_0x30594e['push'](_0x30594e['shift']());}}}(a233_0x1410,0x4ee9a));import{createHash}from'node:crypto';function a233_0x1410(){const _0x395038=['scope','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','utf8','app_rule_content_invalid','hex','App\x20rule\x20file\x20is\x20blank:\x20','12287871iXfpHE','byteSize','isFile','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','24yOhAsw','updateTime','database','contentHash','Cannot\x20access\x20app\x20rule\x20file:\x20','type','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','utf-8','2054872uedXyr','1706117bzTQon','Cannot\x20read\x20app\x20rule\x20file:\x20','810795GWONPQ','app_rule_file_required','update','page-api-development','app_rule_type_invalid','231216QrYlCM','decode','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','sha256:','RULES.md','131578ecGsen','content','size','byteLength','database-analysis','string','message','app_rule_content_too_large','app_rule_file_unreadable','2286840wNAgUT','from','Pass\x20a\x20UTF-8\x20Markdown\x20file.','app_rule_file_invalid','6SkoenW','trim'];a233_0x1410=function(){return _0x395038;};return a233_0x1410();}import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';function a233_0x315b(_0x44decb,_0x3d6e19){_0x44decb=_0x44decb-0x6e;const _0x141003=a233_0x1410();let _0x315bca=_0x141003[_0x44decb];return _0x315bca;}export const APP_RULE_TYPES=['rules',a233_0x3ff7ab(0x78)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a233_0x3ff7ab(0x8a),'database':'DATABASE.md'},APP_RULE_CONTEXT_SCOPES={'rules':a233_0x3ff7ab(0x84),'database':a233_0x3ff7ab(0x8f)};export function appRuleError(_0x425fb0,_0x1f2c72,_0x200ab4){return new CliError(_0x425fb0,0x1,_0x1f2c72,_0x200ab4);}export function readAppRuleType(_0x4815b1){const _0x5cad44=a233_0x3ff7ab,_0x7483f0=_0x4815b1['str'](_0x5cad44(0x7b))[_0x5cad44(0x99)]()['toLowerCase']();if(_0x7483f0!=='rules'&&_0x7483f0!==_0x5cad44(0x78))throw appRuleError(_0x5cad44(0x85),_0x5cad44(0x88));return _0x7483f0;}export function appRuleFileName(_0x2039da){return APP_RULE_FILES[_0x2039da];}export function appRuleContextScope(_0x37dae9){return APP_RULE_CONTEXT_SCOPES[_0x37dae9];}export function inspectAppRuleContent(_0xa08c32){const _0x31635a=a233_0x3ff7ab,_0x5d3255=Buffer[_0x31635a(0x95)](_0xa08c32,_0x31635a(0x6e));return{'content':_0xa08c32,'byteSize':_0x5d3255[_0x31635a(0x8e)],'contentHash':_0x31635a(0x89)+createHash('sha256')[_0x31635a(0x83)](_0x5d3255)['digest'](_0x31635a(0x70))};}export async function readAppRuleFile(_0x3bcfe8){const _0x28567d=a233_0x3ff7ab,_0x4eae3e=_0x3bcfe8['trim']();if(!_0x4eae3e)throw appRuleError(_0x28567d(0x82),'--file\x20is\x20required.',_0x28567d(0x96));const _0x31e717=resolve(_0x4eae3e);let _0x351292;try{_0x351292=await stat(_0x31e717);}catch(_0x14927c){throw appRuleError(_0x28567d(0x93),_0x28567d(0x7a)+_0x4eae3e,_0x14927c instanceof Error?_0x14927c[_0x28567d(0x91)]:String(_0x14927c));}if(!_0x351292[_0x28567d(0x74)]())throw appRuleError(_0x28567d(0x97),'App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20'+_0x4eae3e);if(_0x351292[_0x28567d(0x8d)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x28567d(0x92),_0x28567d(0x7c));let _0x510549;try{_0x510549=await readFile(_0x31e717);}catch(_0x3bfb48){throw appRuleError(_0x28567d(0x93),_0x28567d(0x80)+_0x4eae3e,_0x3bfb48 instanceof Error?_0x3bfb48['message']:String(_0x3bfb48));}if(_0x510549[_0x28567d(0x8e)]>MAX_APP_RULE_BYTES)throw appRuleError('app_rule_content_too_large',_0x28567d(0x7c));let _0xd7dba4;try{_0xd7dba4=new TextDecoder(_0x28567d(0x7d),{'fatal':!![],'ignoreBOM':!![]})[_0x28567d(0x87)](_0x510549);}catch{throw appRuleError('app_rule_content_invalid',_0x28567d(0x75)+_0x4eae3e);}if(!_0xd7dba4[_0x28567d(0x99)]())throw appRuleError(_0x28567d(0x6f),_0x28567d(0x71)+_0x4eae3e);return inspectAppRuleContent(_0xd7dba4);}export function projectAppRule(_0x40331c,_0x25b08b){const _0x57f2f1=a233_0x3ff7ab;if(!_0x25b08b)return{'type':_0x40331c,'fileName':appRuleFileName(_0x40331c),'contextScope':appRuleContextScope(_0x40331c),'enabled':![]};const _0x30f7e8=inspectAppRuleContent(_0x25b08b[_0x57f2f1(0x8c)]);return{'type':_0x40331c,'fileName':appRuleFileName(_0x40331c),'contextScope':appRuleContextScope(_0x40331c),'enabled':!![],'id':_0x25b08b['id'],'scope':_0x25b08b[_0x57f2f1(0x9a)],'appCode':_0x25b08b['appCode'],'version':_0x25b08b['version'],'contentByteSize':_0x30f7e8[_0x57f2f1(0x73)],'contentHash':_0x30f7e8[_0x57f2f1(0x79)],..._0x25b08b['createTime']!==undefined&&_0x25b08b['createTime']!==null?{'createTime':_0x25b08b['createTime']}:{},..._0x25b08b[_0x57f2f1(0x77)]!==undefined&&_0x25b08b[_0x57f2f1(0x77)]!==null?{'updateTime':_0x25b08b[_0x57f2f1(0x77)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':'type','type':a233_0x3ff7ab(0x90),'required':!![],'description':a233_0x3ff7ab(0x9b),'enum':[...APP_RULE_TYPES]};
@@ -1 +1 @@
1
- const a229_0x552c43=a229_0x34e3;(function(_0x1eb039,_0x103cb5){const _0x5acc90=a229_0x34e3,_0x4da8ca=_0x1eb039();while(!![]){try{const _0x2a8470=-parseInt(_0x5acc90(0x17d))/0x1+parseInt(_0x5acc90(0x163))/0x2*(-parseInt(_0x5acc90(0x164))/0x3)+-parseInt(_0x5acc90(0x183))/0x4+-parseInt(_0x5acc90(0x167))/0x5*(-parseInt(_0x5acc90(0x190))/0x6)+-parseInt(_0x5acc90(0x188))/0x7*(parseInt(_0x5acc90(0x17c))/0x8)+-parseInt(_0x5acc90(0x152))/0x9*(parseInt(_0x5acc90(0x15c))/0xa)+parseInt(_0x5acc90(0x16c))/0xb;if(_0x2a8470===_0x103cb5)break;else _0x4da8ca['push'](_0x4da8ca['shift']());}catch(_0x29419b){_0x4da8ca['push'](_0x4da8ca['shift']());}}}(a229_0x4b5e,0x4859a));import{readFileSync,existsSync}from'node:fs';function a229_0x4b5e(){const _0xfe2278=['utf-8','error','push','close','13996917foyapR','Script\x20\x22','bool','No\x20package.json\x20found\x20in\x20current\x20directory.','log','--watch','pnpm','Available:\x20','\x20run\x20','write','vite','inherit','.bin','length','slice','belowMinimum','125928xwGKtG','95352OvmqJl','\x20run\x20preview\x20--watch','preview','\x22\x20not\x20found\x20in\x20package.json.','validation','\x20run\x20start','2298832aeyyCe','bun.lock','Script\x20name\x20defined\x20in\x20package.json','watch','needsUpgrade','21FmPLbT','Enable\x20watch\x20mode\x20for\x20preview','args','cwd','all','\x20run\x20build','bun.lockb','join','178440LlpEPy','Domain\x20routing\x20synchronized:\x20','start','build','script','run','\x0a\x20\x20Usage:\x20','4194mMvomq','yarn.lock','vite\x20preview\x20exited\x20with\x20code\x20','node_modules','changed','has','Run\x20a\x20package.json\x20script','(none)','boolean','\x20\x20\x20\x20','12130eYSdcc','dev','npm','keys','No\x20scripts\x20defined\x20in\x20package.json.','\x20run\x20<script>\x0a','path','4220AiqujR','114NCgUKO','\x20run\x20preview','\x20\x20EXAMPLES','65MKGazS'];a229_0x4b5e=function(){return _0xfe2278;};return a229_0x4b5e();}import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a229_0x552c43(0x14d),a229_0x552c43(0x15d)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a229_0x552c43(0x14d),a229_0x552c43(0x15d),a229_0x552c43(0x14e),a229_0x552c43(0x17f)]);export function syncProjectDomainRoutingBeforeScript(_0x194121,_0x247046){const _0x5252cc=a229_0x552c43;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x5252cc(0x157)](_0x247046))return null;const _0x62178e=findProjectRootDirectory(_0x194121);if(!resolveConfigPath(_0x62178e))return null;const _0xb5111a=writeProjectDomainRoutingManifest(_0x62178e);return{'path':_0xb5111a[_0x5252cc(0x162)],'changed':_0xb5111a[_0x5252cc(0x156)]};}function readPackageScripts(_0x4e0e7b){const _0x5d574b=a229_0x552c43,_0x5ca81d=resolve(_0x4e0e7b,'package.json');if(!existsSync(_0x5ca81d))return null;try{const _0x4b6dda=JSON['parse'](readFileSync(_0x5ca81d,_0x5d574b(0x168)));return _0x4b6dda['scripts']??{};}catch{return null;}}function detectPackageManager(_0x188909){const _0x56a3fd=a229_0x552c43;if(existsSync(resolve(_0x188909,_0x56a3fd(0x18e)))||existsSync(resolve(_0x188909,_0x56a3fd(0x184))))return'bun';if(existsSync(resolve(_0x188909,'pnpm-lock.yaml')))return _0x56a3fd(0x172);if(existsSync(resolve(_0x188909,_0x56a3fd(0x153))))return'yarn';return _0x56a3fd(0x15e);}async function versionCheck(_0x31bd51){const _0x52eb5f=a229_0x552c43,_0x653ffb=await checkCliVersion();(_0x653ffb[_0x52eb5f(0x187)]||_0x653ffb[_0x52eb5f(0x17b)])&&(printCliUpgradeWarning(_0x653ffb),assertCliVersionSupported(_0x653ffb));const _0x4d6cd3=await checkSdkVersion(_0x31bd51);if(_0x4d6cd3[_0x52eb5f(0x187)])printSdkUpgradeWarning(_0x4d6cd3);}function spawnScript(_0x267295,_0x3fcbf4,_0x104a04,_0x489931){return new Promise((_0x126eec,_0x19a365)=>{const _0x4a8b5c=a229_0x34e3,_0x42cd37=[_0x4a8b5c(0x150),_0x3fcbf4,..._0x104a04],_0x3fb6e9=spawn(_0x267295,_0x42cd37,{'cwd':_0x489931,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x489931,_0x4a8b5c(0x155),_0x4a8b5c(0x178))+delimiter+process.env.PATH}});_0x3fb6e9['on'](_0x4a8b5c(0x16b),_0x250bb2=>{const _0xc51c42=_0x4a8b5c;if(_0x250bb2===0x0||_0x250bb2===null)_0x126eec();else _0x19a365(new Error(_0x267295+_0xc51c42(0x174)+_0x3fcbf4+'\x20exited\x20with\x20code\x20'+_0x250bb2));}),_0x3fb6e9['on'](_0x4a8b5c(0x169),_0x19a365);});}function spawnViteBuildWatch(_0x25aa64){return new Promise((_0xaa3482,_0x4cd7b9)=>{const _0x34a256=a229_0x34e3,_0x345e73=spawn('vite',['build',_0x34a256(0x171)],{'cwd':_0x25aa64,'stdio':_0x34a256(0x177),'shell':!![],'env':{...process.env,'PATH':''+join(_0x25aa64,_0x34a256(0x155),_0x34a256(0x178))+delimiter+process.env.PATH}});_0x345e73['on'](_0x34a256(0x16b),_0x173c9d=>{if(_0x173c9d===0x0||_0x173c9d===null)_0xaa3482();else _0x4cd7b9(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x173c9d));}),_0x345e73['on']('error',_0x4cd7b9);});}function spawnVitePreview(_0x376b0f){return new Promise((_0x5dcfae,_0x19441b)=>{const _0x359904=a229_0x34e3,_0x5cb990=spawn(_0x359904(0x176),[_0x359904(0x17f)],{'cwd':_0x376b0f,'stdio':_0x359904(0x177),'shell':!![],'env':{...process.env,'PATH':''+join(_0x376b0f,_0x359904(0x155),_0x359904(0x178))+delimiter+process.env.PATH}});_0x5cb990['on'](_0x359904(0x16b),_0x50b8c8=>{const _0x1684dc=_0x359904;if(_0x50b8c8===0x0||_0x50b8c8===null)_0x5dcfae();else _0x19441b(new Error(_0x1684dc(0x154)+_0x50b8c8));}),_0x5cb990['on'](_0x359904(0x169),_0x19441b);});}function a229_0x34e3(_0x593ff3,_0x3ae015){_0x593ff3=_0x593ff3-0x14c;const _0x4b5eb2=a229_0x4b5e();let _0x34e37b=_0x4b5eb2[_0x593ff3];return _0x34e37b;}const runFlags=[{'name':'watch','type':a229_0x552c43(0x15a),'description':a229_0x552c43(0x189),'default':![]}];export const runDefinition={'service':'run','command':a229_0x552c43(0x150),'description':a229_0x552c43(0x158),'risk':a229_0x552c43(0x175),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a229_0x552c43(0x14f),'description':a229_0x552c43(0x185),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x42637d=a229_0x552c43,_0x286028=[];return _0x286028[_0x42637d(0x16a)](_0x42637d(0x166)),_0x286028['push'](_0x42637d(0x15b)+CLI_BIN_NAME+_0x42637d(0x182)),_0x286028[_0x42637d(0x16a)](_0x42637d(0x15b)+CLI_BIN_NAME+_0x42637d(0x18d)),_0x286028[_0x42637d(0x16a)](_0x42637d(0x15b)+CLI_BIN_NAME+_0x42637d(0x165)),_0x286028[_0x42637d(0x16a)](_0x42637d(0x15b)+CLI_BIN_NAME+_0x42637d(0x17e)),_0x286028['join']('\x0a');},async 'execute'(_0xef8cda){const _0xbf3fd2=a229_0x552c43,_0x4b3374=process[_0xbf3fd2(0x18b)](),_0xaa2439=_0xef8cda['args'][0x0],_0x19eb59=_0xef8cda[_0xbf3fd2(0x18a)][_0xbf3fd2(0x17a)](0x1),_0x442f53=readPackageScripts(_0x4b3374);if(!_0x442f53)throw CliErrors[_0xbf3fd2(0x181)](_0xbf3fd2(0x16f));if(!_0xaa2439){const _0x314611=Object[_0xbf3fd2(0x15f)](_0x442f53);if(_0x314611[_0xbf3fd2(0x179)]===0x0)console[_0xbf3fd2(0x170)](_0xbf3fd2(0x160));else{console[_0xbf3fd2(0x170)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x54874a of _0x314611){console['log'](_0xbf3fd2(0x15b)+_0x54874a);}console[_0xbf3fd2(0x170)](_0xbf3fd2(0x151)+CLI_BIN_NAME+_0xbf3fd2(0x161));}return{'ok':!![]};}if(!_0x442f53[_0xaa2439])throw CliErrors[_0xbf3fd2(0x181)](_0xbf3fd2(0x16d)+_0xaa2439+_0xbf3fd2(0x180),_0xbf3fd2(0x173)+(Object['keys'](_0x442f53)[_0xbf3fd2(0x18f)](',\x20')||_0xbf3fd2(0x159)));const _0x14b7a4=detectPackageManager(_0x4b3374),_0x22c1f2=syncProjectDomainRoutingBeforeScript(_0x4b3374,_0xaa2439);_0x22c1f2?.['changed']&&console['error'](_0xbf3fd2(0x14c)+_0x22c1f2[_0xbf3fd2(0x162)]);VERSION_CHECK_SCRIPTS[_0xbf3fd2(0x157)](_0xaa2439)&&await versionCheck(_0x4b3374);if(_0xaa2439===_0xbf3fd2(0x17f)&&_0xef8cda[_0xbf3fd2(0x16e)](_0xbf3fd2(0x186)))return await Promise[_0xbf3fd2(0x18c)]([spawnViteBuildWatch(_0x4b3374),spawnVitePreview(_0x4b3374)]),{'ok':!![]};return await spawnScript(_0x14b7a4,_0xaa2439,_0x19eb59,_0x4b3374),{'ok':!![]};}};
1
+ const a234_0x2cf3a9=a234_0x3fe9;(function(_0x4b03a4,_0x43a606){const _0x1d9f3e=a234_0x3fe9,_0x2e8553=_0x4b03a4();while(!![]){try{const _0x1e85ec=parseInt(_0x1d9f3e(0x15d))/0x1*(-parseInt(_0x1d9f3e(0x19f))/0x2)+-parseInt(_0x1d9f3e(0x167))/0x3*(parseInt(_0x1d9f3e(0x187))/0x4)+parseInt(_0x1d9f3e(0x173))/0x5*(parseInt(_0x1d9f3e(0x164))/0x6)+parseInt(_0x1d9f3e(0x199))/0x7*(-parseInt(_0x1d9f3e(0x15b))/0x8)+parseInt(_0x1d9f3e(0x18e))/0x9*(-parseInt(_0x1d9f3e(0x166))/0xa)+parseInt(_0x1d9f3e(0x19e))/0xb*(-parseInt(_0x1d9f3e(0x193))/0xc)+-parseInt(_0x1d9f3e(0x18d))/0xd*(-parseInt(_0x1d9f3e(0x17c))/0xe);if(_0x1e85ec===_0x43a606)break;else _0x2e8553['push'](_0x2e8553['shift']());}catch(_0x5ecb47){_0x2e8553['push'](_0x2e8553['shift']());}}}(a234_0x27eb,0x2b461));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(['start',a234_0x2cf3a9(0x183)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a234_0x2cf3a9(0x195),a234_0x2cf3a9(0x183),'build',a234_0x2cf3a9(0x190)]);export function syncProjectDomainRoutingBeforeScript(_0x4d12ac,_0x1df649){const _0x5e3b01=a234_0x2cf3a9;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x5e3b01(0x160)](_0x1df649))return null;const _0x12481f=findProjectRootDirectory(_0x4d12ac);if(!resolveConfigPath(_0x12481f))return null;const _0x12ef7b=writeProjectDomainRoutingManifest(_0x12481f);return{'path':_0x12ef7b[_0x5e3b01(0x15e)],'changed':_0x12ef7b['changed']};}function readPackageScripts(_0x10b49e){const _0x3555d2=a234_0x2cf3a9,_0x1ce207=resolve(_0x10b49e,_0x3555d2(0x15c));if(!existsSync(_0x1ce207))return null;try{const _0x586cf0=JSON[_0x3555d2(0x163)](readFileSync(_0x1ce207,_0x3555d2(0x161)));return _0x586cf0[_0x3555d2(0x19c)]??{};}catch{return null;}}function a234_0x27eb(){const _0x529001=['cwd','Enable\x20watch\x20mode\x20for\x20preview','\x20run\x20','yarn.lock','length','yarn','script','Domain\x20routing\x20synchronized:\x20','228952VriHMi','package.json','3QSuYKy','path','\x20run\x20preview','has','utf-8','boolean','parse','54dauJBl','No\x20package.json\x20found\x20in\x20current\x20directory.','10gwZyIB','3KLPWtW','pnpm-lock.yaml','changed','log','vite\x20preview\x20exited\x20with\x20code\x20','bool','error','keys','Script\x20\x22','pnpm','validation','watch','152010YMLxZq','bun','\x0a\x20\x20Available\x20scripts:\x0a','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','\x20exited\x20with\x20code\x20','build','Run\x20a\x20package.json\x20script','close','push','1414bOGlLt','Available:\x20','join','\x20run\x20<script>\x0a','inherit','No\x20scripts\x20defined\x20in\x20package.json.','slice','dev','\x22\x20not\x20found\x20in\x20package.json.','node_modules','write','267528jghjKn','bun.lockb','\x20\x20\x20\x20','\x0a\x20\x20Usage:\x20','needsUpgrade','bun.lock','102401qtAXNW','241551krJkku','run','preview','Script\x20name\x20defined\x20in\x20package.json','\x20run\x20build','8220oUPxni','\x20run\x20preview\x20--watch','start','vite','--watch','.bin','35vMvjJq','npm','\x20run\x20start','scripts','args','5533WQUrsh','207050axGRqU'];a234_0x27eb=function(){return _0x529001;};return a234_0x27eb();}function a234_0x3fe9(_0x372f7e,_0x5debad){_0x372f7e=_0x372f7e-0x156;const _0x27ebb3=a234_0x27eb();let _0x3fe956=_0x27ebb3[_0x372f7e];return _0x3fe956;}function detectPackageManager(_0x23007a){const _0x17eee5=a234_0x2cf3a9;if(existsSync(resolve(_0x23007a,_0x17eee5(0x188)))||existsSync(resolve(_0x23007a,_0x17eee5(0x18c))))return _0x17eee5(0x174);if(existsSync(resolve(_0x23007a,_0x17eee5(0x168))))return _0x17eee5(0x170);if(existsSync(resolve(_0x23007a,_0x17eee5(0x156))))return _0x17eee5(0x158);return _0x17eee5(0x19a);}async function versionCheck(_0x43b585){const _0x2c0dc3=a234_0x2cf3a9,_0x361ab4=await checkCliVersion();(_0x361ab4[_0x2c0dc3(0x18b)]||_0x361ab4['belowMinimum'])&&(printCliUpgradeWarning(_0x361ab4),assertCliVersionSupported(_0x361ab4));const _0x49cf26=await checkSdkVersion(_0x43b585);if(_0x49cf26[_0x2c0dc3(0x18b)])printSdkUpgradeWarning(_0x49cf26);}function spawnScript(_0x54d90c,_0x432982,_0x3b8b26,_0x4a4e38){return new Promise((_0x168b12,_0x25a7d7)=>{const _0x5f2d3f=a234_0x3fe9,_0x5eaa34=[_0x5f2d3f(0x18f),_0x432982,..._0x3b8b26],_0x4be093=spawn(_0x54d90c,_0x5eaa34,{'cwd':_0x4a4e38,'stdio':_0x5f2d3f(0x180),'shell':!![],'env':{...process.env,'PATH':''+join(_0x4a4e38,_0x5f2d3f(0x185),_0x5f2d3f(0x198))+delimiter+process.env.PATH}});_0x4be093['on'](_0x5f2d3f(0x17a),_0x1ef416=>{const _0xac27e=_0x5f2d3f;if(_0x1ef416===0x0||_0x1ef416===null)_0x168b12();else _0x25a7d7(new Error(_0x54d90c+_0xac27e(0x1a2)+_0x432982+_0xac27e(0x177)+_0x1ef416));}),_0x4be093['on'](_0x5f2d3f(0x16d),_0x25a7d7);});}function spawnViteBuildWatch(_0x53db10){return new Promise((_0x11dabe,_0x3359dd)=>{const _0x110e02=a234_0x3fe9,_0x443688=spawn(_0x110e02(0x196),[_0x110e02(0x178),_0x110e02(0x197)],{'cwd':_0x53db10,'stdio':_0x110e02(0x180),'shell':!![],'env':{...process.env,'PATH':''+join(_0x53db10,_0x110e02(0x185),_0x110e02(0x198))+delimiter+process.env.PATH}});_0x443688['on']('close',_0x2b7639=>{const _0x4e19ba=_0x110e02;if(_0x2b7639===0x0||_0x2b7639===null)_0x11dabe();else _0x3359dd(new Error(_0x4e19ba(0x176)+_0x2b7639));}),_0x443688['on'](_0x110e02(0x16d),_0x3359dd);});}function spawnVitePreview(_0x2e1f6a){return new Promise((_0x3d4ccb,_0x254e6a)=>{const _0x1b9b06=a234_0x3fe9,_0x28c85e=spawn(_0x1b9b06(0x196),[_0x1b9b06(0x190)],{'cwd':_0x2e1f6a,'stdio':_0x1b9b06(0x180),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2e1f6a,'node_modules',_0x1b9b06(0x198))+delimiter+process.env.PATH}});_0x28c85e['on']('close',_0x2c1ab6=>{const _0x5abf1=_0x1b9b06;if(_0x2c1ab6===0x0||_0x2c1ab6===null)_0x3d4ccb();else _0x254e6a(new Error(_0x5abf1(0x16b)+_0x2c1ab6));}),_0x28c85e['on']('error',_0x254e6a);});}const runFlags=[{'name':a234_0x2cf3a9(0x172),'type':a234_0x2cf3a9(0x162),'description':a234_0x2cf3a9(0x1a1),'default':![]}];export const runDefinition={'service':a234_0x2cf3a9(0x18f),'command':'run','description':a234_0x2cf3a9(0x179),'risk':a234_0x2cf3a9(0x186),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a234_0x2cf3a9(0x159),'description':a234_0x2cf3a9(0x191),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0xecfaa2=a234_0x2cf3a9,_0x13a6f6=[];return _0x13a6f6[_0xecfaa2(0x17b)]('\x20\x20EXAMPLES'),_0x13a6f6[_0xecfaa2(0x17b)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0xecfaa2(0x19b)),_0x13a6f6[_0xecfaa2(0x17b)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0xecfaa2(0x192)),_0x13a6f6['push'](_0xecfaa2(0x189)+CLI_BIN_NAME+_0xecfaa2(0x15f)),_0x13a6f6['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0xecfaa2(0x194)),_0x13a6f6[_0xecfaa2(0x17e)]('\x0a');},async 'execute'(_0x43922a){const _0x25239e=a234_0x2cf3a9,_0x2ae530=process[_0x25239e(0x1a0)](),_0x696def=_0x43922a[_0x25239e(0x19d)][0x0],_0x450792=_0x43922a[_0x25239e(0x19d)][_0x25239e(0x182)](0x1),_0x62b9b4=readPackageScripts(_0x2ae530);if(!_0x62b9b4)throw CliErrors[_0x25239e(0x171)](_0x25239e(0x165));if(!_0x696def){const _0x401a99=Object[_0x25239e(0x16e)](_0x62b9b4);if(_0x401a99[_0x25239e(0x157)]===0x0)console[_0x25239e(0x16a)](_0x25239e(0x181));else{console[_0x25239e(0x16a)](_0x25239e(0x175));for(const _0x3b0b67 of _0x401a99){console[_0x25239e(0x16a)](_0x25239e(0x189)+_0x3b0b67);}console[_0x25239e(0x16a)](_0x25239e(0x18a)+CLI_BIN_NAME+_0x25239e(0x17f));}return{'ok':!![]};}if(!_0x62b9b4[_0x696def])throw CliErrors['validation'](_0x25239e(0x16f)+_0x696def+_0x25239e(0x184),_0x25239e(0x17d)+(Object[_0x25239e(0x16e)](_0x62b9b4)[_0x25239e(0x17e)](',\x20')||'(none)'));const _0x85c3df=detectPackageManager(_0x2ae530),_0x1b04bd=syncProjectDomainRoutingBeforeScript(_0x2ae530,_0x696def);_0x1b04bd?.[_0x25239e(0x169)]&&console['error'](_0x25239e(0x15a)+_0x1b04bd[_0x25239e(0x15e)]);VERSION_CHECK_SCRIPTS[_0x25239e(0x160)](_0x696def)&&await versionCheck(_0x2ae530);if(_0x696def===_0x25239e(0x190)&&_0x43922a[_0x25239e(0x16c)](_0x25239e(0x172)))return await Promise['all']([spawnViteBuildWatch(_0x2ae530),spawnVitePreview(_0x2ae530)]),{'ok':!![]};return await spawnScript(_0x85c3df,_0x696def,_0x450792,_0x2ae530),{'ok':!![]};}};
@@ -1 +1 @@
1
- const a230_0x1a213f=a230_0x53a5;(function(_0x2b383e,_0x27cf3f){const _0xe587db=a230_0x53a5,_0xd2747a=_0x2b383e();while(!![]){try{const _0x13e3bd=parseInt(_0xe587db(0xcb))/0x1+-parseInt(_0xe587db(0xce))/0x2+parseInt(_0xe587db(0xd7))/0x3+-parseInt(_0xe587db(0xd4))/0x4*(-parseInt(_0xe587db(0xd0))/0x5)+-parseInt(_0xe587db(0xcf))/0x6+parseInt(_0xe587db(0xd6))/0x7+-parseInt(_0xe587db(0xd5))/0x8*(-parseInt(_0xe587db(0xd1))/0x9);if(_0x13e3bd===_0x27cf3f)break;else _0xd2747a['push'](_0xd2747a['shift']());}catch(_0x1f26d6){_0xd2747a['push'](_0xd2747a['shift']());}}}(a230_0x2b99,0x6d737));function a230_0x53a5(_0x534815,_0x1d5d4e){_0x534815=_0x534815-0xcb;const _0x2b99b6=a230_0x2b99();let _0x53a5d0=_0x2b99b6[_0x534815];return _0x53a5d0;}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x208f9e){const _0x1fbc67=await buildSchemaPayload();return{'ok':!![],'data':_0x1fbc67};}function a230_0x2b99(){const _0xe75322=['15896AKZkrB','1181054miATdT','320415iMjMGO','json','71681bEaMxr','Export\x20machine-readable\x20command\x20schema\x20(JSON)','export','1746034jADveH','5374458FPDNOj','3890lPrFXg','6489FkYJph','schema','read','2248EmXyBv'];a230_0x2b99=function(){return _0xe75322;};return a230_0x2b99();}export const schemaDefinition={'service':a230_0x1a213f(0xd2),'command':a230_0x1a213f(0xcd),'description':a230_0x1a213f(0xcc),'risk':a230_0x1a213f(0xd3),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a230_0x1a213f(0xd8),'flags':[],'execute':execute};
1
+ const a235_0x1216c6=a235_0x5942;(function(_0x24b22e,_0x2e77ef){const _0x1661fc=a235_0x5942,_0x34a0c8=_0x24b22e();while(!![]){try{const _0x2f4ab2=parseInt(_0x1661fc(0x17a))/0x1*(parseInt(_0x1661fc(0x176))/0x2)+parseInt(_0x1661fc(0x17c))/0x3+parseInt(_0x1661fc(0x17d))/0x4+-parseInt(_0x1661fc(0x177))/0x5+-parseInt(_0x1661fc(0x173))/0x6+-parseInt(_0x1661fc(0x178))/0x7*(parseInt(_0x1661fc(0x17f))/0x8)+parseInt(_0x1661fc(0x17e))/0x9;if(_0x2f4ab2===_0x2e77ef)break;else _0x34a0c8['push'](_0x34a0c8['shift']());}catch(_0x263375){_0x34a0c8['push'](_0x34a0c8['shift']());}}}(a235_0x3a7e,0xa49f0));import{buildSchemaPayload}from'../framework/schema-export.js';function a235_0x5942(_0x25be8d,_0x2574c6){_0x25be8d=_0x25be8d-0x173;const _0x3a7e2e=a235_0x3a7e();let _0x594222=_0x3a7e2e[_0x25be8d];return _0x594222;}function a235_0x3a7e(){const _0x4de1da=['read','37NfCiGh','json','1406817hxNqka','601080eCuSsp','6491196zErIkS','8ClxMHS','export','1441932sqDCXV','Export\x20machine-readable\x20command\x20schema\x20(JSON)','schema','28586tYGgAx','744875erHPUX','5639963wJVFnE'];a235_0x3a7e=function(){return _0x4de1da;};return a235_0x3a7e();}async function execute(_0xc94089){const _0x12c0e2=await buildSchemaPayload();return{'ok':!![],'data':_0x12c0e2};}export const schemaDefinition={'service':a235_0x1216c6(0x175),'command':a235_0x1216c6(0x180),'description':a235_0x1216c6(0x174),'risk':a235_0x1216c6(0x179),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a235_0x1216c6(0x17b),'flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a231_0x566dd3=a231_0xd28a;(function(_0x35cc05,_0x550b9c){const _0x1fe057=a231_0xd28a,_0xfc56f=_0x35cc05();while(!![]){try{const _0x4e1958=parseInt(_0x1fe057(0x16e))/0x1*(parseInt(_0x1fe057(0x18e))/0x2)+parseInt(_0x1fe057(0x185))/0x3+parseInt(_0x1fe057(0x16b))/0x4*(parseInt(_0x1fe057(0x17f))/0x5)+parseInt(_0x1fe057(0x189))/0x6*(parseInt(_0x1fe057(0x168))/0x7)+parseInt(_0x1fe057(0x15d))/0x8*(parseInt(_0x1fe057(0x193))/0x9)+parseInt(_0x1fe057(0x19f))/0xa+-parseInt(_0x1fe057(0x176))/0xb*(parseInt(_0x1fe057(0x195))/0xc);if(_0x4e1958===_0x550b9c)break;else _0xfc56f['push'](_0xfc56f['shift']());}catch(_0x1c7b8f){_0xfc56f['push'](_0xfc56f['shift']());}}}(a231_0x3065,0x807ce));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(_0x4f1e67){const _0x336874=a231_0xd28a;if(_0x4f1e67===_0x336874(0x169))return[_0x336874(0x191),'\x20\x20SELECT\x201\x20AS\x20id',_0x336874(0x180),'']['join']('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x336874(0x198)]('\x0a');}function a231_0xd28a(_0x22bdcc,_0xe274f){_0x22bdcc=_0x22bdcc-0x15d;const _0x306530=a231_0x3065();let _0xd28a5f=_0x306530[_0x22bdcc];return _0xd28a5f;}export const sqlCreate={'service':a231_0x566dd3(0x179),'command':a231_0x566dd3(0x172),'description':a231_0x566dd3(0x164),'risk':a231_0x566dd3(0x16c),'flags':[{'name':a231_0x566dd3(0x194),'type':a231_0x566dd3(0x19b),'description':'SQL\x20query\x20display\x20name'},{'name':'db-id','type':a231_0x566dd3(0x175),'description':'Target\x20database\x20ID'},{'name':a231_0x566dd3(0x16a),'type':'string','enum':[a231_0x566dd3(0x179),a231_0x566dd3(0x169)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x826d60){const _0x280a66=a231_0x566dd3;if(!_0x826d60[_0x280a66(0x18a)])return;if(!_0x826d60['str'](_0x280a66(0x194))[_0x280a66(0x18c)]())throw CliErrors['flagMissing'](_0x280a66(0x194),_0x280a66(0x178));const _0x40c859=resolveProvidedDbId(_0x826d60);if(typeof _0x40c859!=='number'||!Number[_0x280a66(0x196)](_0x40c859)||_0x40c859<=0x0)throw CliErrors[_0x280a66(0x17d)](_0x280a66(0x183),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x826d60[_0x280a66(0x162)]('mode')[_0x280a66(0x18c)]())throw CliErrors['flagMissing']('mode',_0x280a66(0x15e));},async 'dryRun'(_0x371917){const _0x11b2a9=a231_0x566dd3,_0x84339f=loadSqlProjectConfig(_0x371917[_0x11b2a9(0x184)]),{sqlName:_0x1bf548,dbId:_0x37e4e8,dbName:_0x4fffaf,mode:_0x3874da}=await resolveSqlNewInputs(_0x371917),_0x5b95b9=buildSqlRelativePath('<server-generated-sqlCode>',_0x1bf548,_0x4fffaf,_0x3874da,_0x37e4e8),_0x484baf=_0x84339f['sqlRootDir']+'/'+_0x5b95b9;return{'method':'POST','url':_0x11b2a9(0x181),'body':{'appCode':_0x371917[_0x11b2a9(0x184)],'sqlName':_0x1bf548,'dbId':_0x37e4e8,'mode':_0x3874da,'localPath':_0x484baf},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x84339f[_0x11b2a9(0x16d)]};},async 'execute'(_0x548417){const _0x4fff21=a231_0x566dd3,_0xaf2e3c=loadSqlProjectConfig(_0x548417[_0x4fff21(0x184)]),{sqlName:_0x1a46dd,dbId:_0x85cd6e,dbName:_0x15600a,mode:_0x1f8572}=await resolveSqlNewInputs(_0x548417),_0x33de63=generateSqlTemplate(_0x1f8572),_0x478a16=await createSqlQuery({'appCode':_0x548417[_0x4fff21(0x184)],'sqlName':_0x1a46dd,'dbId':_0x85cd6e,'sqlContent':_0x33de63}),_0x23c86b=ensureRemoteSqlContent(_0x478a16),_0xd0f99a=_0x15600a||await getDbName(_0x548417[_0x4fff21(0x184)],_0x85cd6e)[_0x4fff21(0x17a)](()=>undefined),_0x496d40=buildSqlRelativePath(_0x478a16[_0x4fff21(0x1a0)],_0x478a16[_0x4fff21(0x19a)],_0xd0f99a,_0x1f8572,_0x85cd6e),_0x55149a=_0xaf2e3c[_0x4fff21(0x16d)]+'/'+_0x496d40,_0x2ad1bc=buildLocalSqlFileContent({'sqlCode':_0x478a16['sqlCode'],'sqlName':_0x478a16['sqlName'],'dbId':_0x478a16[_0x4fff21(0x166)]},_0x23c86b,{'dbName':_0xd0f99a,'mode':_0x1f8572,'syncedAt':new Date()[_0x4fff21(0x174)](),'description':_0x478a16[_0x4fff21(0x18f)]});if(await fileExists(_0x55149a))throw CliErrors['validation'](_0x4fff21(0x18b)+_0x55149a);await ensureParentDirectory(_0x55149a),await writeFile(_0x55149a,_0x2ad1bc,_0x4fff21(0x15f));const _0x481b1f=await readSqlLockFile(_0xaf2e3c['lockFilePath']),{lockData:_0x3b7a4d,appLock:_0x718922}=ensureSqlLockScope(_0x481b1f??createEmptySqlLock(),_0xaf2e3c[_0x4fff21(0x184)],_0xaf2e3c[_0x4fff21(0x17b)],_0x4fff21(0x182));return _0x718922[_0x4fff21(0x19e)][_0x478a16[_0x4fff21(0x1a0)]]={...buildSqlLockEntry(_0x478a16,_0x23c86b,computeSqlContentHash(_0x2ad1bc),{'dbName':_0xd0f99a}),'path':_0x496d40,'mode':_0x1f8572},_0x718922[_0x4fff21(0x197)]=new Date()['toISOString'](),await writeSqlLockFile(_0xaf2e3c['lockFilePath'],_0x3b7a4d),{'ok':!![],'data':{'id':_0x478a16['id'],'sqlCode':_0x478a16[_0x4fff21(0x1a0)],'sqlName':_0x478a16['sqlName'],'dbId':_0x478a16[_0x4fff21(0x166)],'path':_0x55149a,'mode':_0x1f8572},'message':_0x4fff21(0x17c)+_0x478a16['sqlCode']};}};async function resolveSqlNewInputs(_0x4fe1dd){const _0x592e44=await resolveSqlNameInput(_0x4fe1dd),{dbId:_0x23c821,dbName:_0x1994dd}=await resolveDbSelection(_0x4fe1dd),_0x4c89b4=await resolveSqlModeInput(_0x4fe1dd);return{'sqlName':_0x592e44,'dbId':_0x23c821,'dbName':_0x1994dd,'mode':_0x4c89b4};}async function resolveSqlNameInput(_0x394a85){const _0x558bc9=a231_0x566dd3,_0x42cce1=_0x394a85[_0x558bc9(0x162)](_0x558bc9(0x194))[_0x558bc9(0x18c)]();if(_0x42cce1)return _0x42cce1;if(_0x394a85[_0x558bc9(0x18a)])throw CliErrors['flagMissing']('name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x558bc9(0x173),'validate':_0x2d4ec7=>_0x2d4ec7['trim']()?!![]:_0x558bc9(0x177)}))['trim']();}async function resolveDbSelection(_0x105140){const _0x5532d6=a231_0x566dd3,_0x2f5332=resolveProvidedDbId(_0x105140);if(typeof _0x2f5332===_0x5532d6(0x175)&&Number['isFinite'](_0x2f5332)&&_0x2f5332>0x0)return{'dbId':_0x2f5332,'dbName':await getDbName(_0x105140[_0x5532d6(0x184)],_0x2f5332)[_0x5532d6(0x17a)](()=>undefined)};if(_0x105140[_0x5532d6(0x18a)])throw CliErrors[_0x5532d6(0x17d)](_0x5532d6(0x183),_0x5532d6(0x170));const _0x55410e=await listDatabases(_0x105140['appCode'])[_0x5532d6(0x17a)](()=>[]);if(_0x55410e[_0x5532d6(0x161)]===0x1)return{'dbId':_0x55410e[0x0]['dbId'],'dbName':_0x55410e[0x0]['dbName']};if(_0x55410e['length']>0x1){const _0x14c178=await select({'message':_0x5532d6(0x192),'choices':[..._0x55410e[_0x5532d6(0x199)](_0x315ad3=>({'name':_0x315ad3[_0x5532d6(0x171)]+'\x20('+_0x315ad3[_0x5532d6(0x166)]+')','value':serializeDbSelection(_0x315ad3)})),{'name':_0x5532d6(0x187),'value':_0x5532d6(0x163)}]});if(_0x14c178!==_0x5532d6(0x163))return deserializeDbSelection(_0x14c178);}const _0x56b3a3=await input({'message':_0x5532d6(0x19d),'validate':_0x46c324=>{const _0x493d70=_0x5532d6,_0x1cb7f3=_0x46c324[_0x493d70(0x18c)]();if(!_0x1cb7f3)return'dbId\x20cannot\x20be\x20empty';const _0xd41a6e=Number(_0x1cb7f3);if(!Number[_0x493d70(0x167)](_0xd41a6e)||_0xd41a6e<=0x0)return _0x493d70(0x19c);return!![];}});return{'dbId':Number(_0x56b3a3[_0x5532d6(0x18c)]())};}async function resolveSqlModeInput(_0x20dfac){const _0x99979f=a231_0x566dd3,_0x15bc98=_0x20dfac[_0x99979f(0x162)](_0x99979f(0x16a))[_0x99979f(0x18c)]();if(_0x15bc98===_0x99979f(0x179)||_0x15bc98==='mybatisXml')return _0x15bc98;if(_0x20dfac['nonInteractive'])throw CliErrors[_0x99979f(0x17d)](_0x99979f(0x16a),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x99979f(0x17e),'choices':[{'name':_0x99979f(0x18d),'value':'sql','description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x99979f(0x190),'value':_0x99979f(0x169),'description':_0x99979f(0x160)}]});}function serializeDbSelection(_0x1a7de9){const _0x5d9a22=a231_0x566dd3;return JSON[_0x5d9a22(0x165)]({'dbId':_0x1a7de9[_0x5d9a22(0x166)],'dbName':_0x1a7de9[_0x5d9a22(0x171)]});}function deserializeDbSelection(_0x5cd41f){const _0x22baf8=a231_0x566dd3;try{const _0x1de7e7=JSON[_0x22baf8(0x16f)](_0x5cd41f);if(typeof _0x1de7e7[_0x22baf8(0x166)]==='number'&&Number[_0x22baf8(0x196)](_0x1de7e7[_0x22baf8(0x166)]))return{'dbId':_0x1de7e7['dbId'],'dbName':_0x1de7e7[_0x22baf8(0x171)]};}catch{}throw CliErrors[_0x22baf8(0x186)](_0x22baf8(0x188)+_0x5cd41f);}function resolveProvidedDbId(_0x551b72){const _0x4bf646=a231_0x566dd3,_0x361dd4=_0x551b72['flag'](_0x4bf646(0x183));if(typeof _0x361dd4===_0x4bf646(0x175)&&Number[_0x4bf646(0x196)](_0x361dd4))return _0x361dd4;return undefined;}function a231_0x3065(){const _0x371cbe=['6DpvQWC','nonInteractive','File\x20already\x20exists:\x20','trim','Plain\x20SQL\x20(sql)','2vcaUtq','description','MyBatis\x20XML\x20(mybatisXml)','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','Select\x20the\x20target\x20database:','273096lDheIl','name','24tQKKNB','isFinite','lastSync','join','map','sqlName','string','dbId\x20must\x20be\x20a\x20positive\x20integer','Target\x20database\x20dbId:','sqls','8319330gyIJxr','sqlCode','32mcAdSJ','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','utf8','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','length','str','__manual__','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','stringify','dbId','isInteger','3121874vkNbKN','mybatisXml','mode','2341100ywXqTf','write','sqlRootDir','393522VMtxns','parse','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','dbName','create','SQL\x20name:','toISOString','number','12707717ibDrGu','SQL\x20name\x20cannot\x20be\x20empty','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','sql','catch','sqlRoot','Created\x20SQL\x20query\x20','flagMissing','Select\x20the\x20local\x20SQL\x20mode:','5sbfFuZ','</select>','/smartapi/custom/saveUserCustomSql','new','db-id','appCode','1376076gyvSGc','validation','✎\x20Enter\x20dbId\x20manually','Invalid\x20database\x20selection\x20payload:\x20'];a231_0x3065=function(){return _0x371cbe;};return a231_0x3065();}
1
+ const a236_0xfd8194=a236_0x5d03;(function(_0x578ca2,_0x2d982c){const _0xfaa205=a236_0x5d03,_0xa0b259=_0x578ca2();while(!![]){try{const _0x55d601=-parseInt(_0xfaa205(0x1ce))/0x1*(-parseInt(_0xfaa205(0x1e1))/0x2)+-parseInt(_0xfaa205(0x1d8))/0x3*(-parseInt(_0xfaa205(0x1da))/0x4)+parseInt(_0xfaa205(0x1d5))/0x5+parseInt(_0xfaa205(0x1b5))/0x6*(-parseInt(_0xfaa205(0x1b9))/0x7)+parseInt(_0xfaa205(0x1dc))/0x8+parseInt(_0xfaa205(0x1c6))/0x9+parseInt(_0xfaa205(0x1ad))/0xa*(-parseInt(_0xfaa205(0x1d2))/0xb);if(_0x55d601===_0x2d982c)break;else _0xa0b259['push'](_0xa0b259['shift']());}catch(_0x5089eb){_0xa0b259['push'](_0xa0b259['shift']());}}}(a236_0x5638,0xa91c8));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';function a236_0x5d03(_0x37d929,_0x1ff9b0){_0x37d929=_0x37d929-0x1ab;const _0x5638db=a236_0x5638();let _0x5d0394=_0x5638db[_0x37d929];return _0x5d0394;}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(_0x1bd0e2){const _0x9c9441=a236_0x5d03;if(_0x1bd0e2===_0x9c9441(0x1dd))return[_0x9c9441(0x1d0),_0x9c9441(0x1bb),_0x9c9441(0x1d7),'']['join']('\x0a');return['SELECT\x201\x20AS\x20id;','']['join']('\x0a');}function a236_0x5638(){const _0x166b2d=['db-id','10037259lbNPmR','Select\x20the\x20local\x20SQL\x20mode:','number','/smartapi/custom/saveUserCustomSql','write','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','Target\x20database\x20ID','dbId\x20cannot\x20be\x20empty','7zkrJwR','description','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','isFinite','55aWpPXa','__manual__','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','635790hOSKWI','sqlRoot','</select>','154221sCdkYR','toISOString','52EcBQtS','dbId','10116936sHzHKk','mybatisXml','Invalid\x20database\x20selection\x20payload:\x20','string','POST','132122qtNnqq','validation','str','catch','new','sqls','isInteger','utf8','nonInteractive','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','flagMissing','lastSync','SQL\x20name\x20cannot\x20be\x20empty','sql','5700830ALePNz','File\x20already\x20exists:\x20','flag','parse','Select\x20the\x20target\x20database:','appCode','dbName','create','6KqBrST','sqlCode','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','lockFilePath','662543bNxKTi','sqlRootDir','\x20\x20SELECT\x201\x20AS\x20id','Plain\x20SQL\x20(sql)','name','<server-generated-sqlCode>','trim','MyBatis\x20XML\x20(mybatisXml)','Created\x20SQL\x20query\x20','mode','length','✎\x20Enter\x20dbId\x20manually'];a236_0x5638=function(){return _0x166b2d;};return a236_0x5638();}export const sqlCreate={'service':a236_0xfd8194(0x1ac),'command':a236_0xfd8194(0x1b4),'description':a236_0xfd8194(0x1b7),'risk':a236_0xfd8194(0x1ca),'flags':[{'name':'name','type':a236_0xfd8194(0x1df),'description':'SQL\x20query\x20display\x20name'},{'name':a236_0xfd8194(0x1c5),'type':a236_0xfd8194(0x1c8),'description':a236_0xfd8194(0x1cc)},{'name':a236_0xfd8194(0x1c2),'type':a236_0xfd8194(0x1df),'enum':[a236_0xfd8194(0x1ac),'mybatisXml'],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0xd41de0){const _0x11e47e=a236_0xfd8194;if(!_0xd41de0[_0x11e47e(0x1e9)])return;if(!_0xd41de0[_0x11e47e(0x1e3)](_0x11e47e(0x1bd))[_0x11e47e(0x1bf)]())throw CliErrors[_0x11e47e(0x1eb)](_0x11e47e(0x1bd),_0x11e47e(0x1ea));const _0x5da697=resolveProvidedDbId(_0xd41de0);if(typeof _0x5da697!==_0x11e47e(0x1c8)||!Number[_0x11e47e(0x1d1)](_0x5da697)||_0x5da697<=0x0)throw CliErrors[_0x11e47e(0x1eb)](_0x11e47e(0x1c5),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0xd41de0['str'](_0x11e47e(0x1c2))['trim']())throw CliErrors[_0x11e47e(0x1eb)](_0x11e47e(0x1c2),_0x11e47e(0x1cb));},async 'dryRun'(_0x31d84a){const _0x36db1a=a236_0xfd8194,_0x23ee92=loadSqlProjectConfig(_0x31d84a['appCode']),{sqlName:_0x2a4ade,dbId:_0x514cfe,dbName:_0x37914e,mode:_0x26b0df}=await resolveSqlNewInputs(_0x31d84a),_0xa7310f=buildSqlRelativePath(_0x36db1a(0x1be),_0x2a4ade,_0x37914e,_0x26b0df,_0x514cfe),_0x37dc89=_0x23ee92['sqlRootDir']+'/'+_0xa7310f;return{'method':_0x36db1a(0x1e0),'url':_0x36db1a(0x1c9),'body':{'appCode':_0x31d84a[_0x36db1a(0x1b2)],'sqlName':_0x2a4ade,'dbId':_0x514cfe,'mode':_0x26b0df,'localPath':_0x37dc89},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x23ee92[_0x36db1a(0x1ba)]};},async 'execute'(_0xcda7c0){const _0x3b60ec=a236_0xfd8194,_0x67826d=loadSqlProjectConfig(_0xcda7c0[_0x3b60ec(0x1b2)]),{sqlName:_0x38d585,dbId:_0x271200,dbName:_0x59032b,mode:_0x48fdcf}=await resolveSqlNewInputs(_0xcda7c0),_0x30dcf9=generateSqlTemplate(_0x48fdcf),_0x8ec13e=await createSqlQuery({'appCode':_0xcda7c0[_0x3b60ec(0x1b2)],'sqlName':_0x38d585,'dbId':_0x271200,'sqlContent':_0x30dcf9}),_0x21c273=ensureRemoteSqlContent(_0x8ec13e),_0x2b677e=_0x59032b||await getDbName(_0xcda7c0[_0x3b60ec(0x1b2)],_0x271200)[_0x3b60ec(0x1e4)](()=>undefined),_0x7c4705=buildSqlRelativePath(_0x8ec13e[_0x3b60ec(0x1b6)],_0x8ec13e['sqlName'],_0x2b677e,_0x48fdcf,_0x271200),_0x1e52f9=_0x67826d[_0x3b60ec(0x1ba)]+'/'+_0x7c4705,_0x1365dd=buildLocalSqlFileContent({'sqlCode':_0x8ec13e[_0x3b60ec(0x1b6)],'sqlName':_0x8ec13e['sqlName'],'dbId':_0x8ec13e[_0x3b60ec(0x1db)]},_0x21c273,{'dbName':_0x2b677e,'mode':_0x48fdcf,'syncedAt':new Date()['toISOString'](),'description':_0x8ec13e[_0x3b60ec(0x1cf)]});if(await fileExists(_0x1e52f9))throw CliErrors[_0x3b60ec(0x1e2)](_0x3b60ec(0x1ae)+_0x1e52f9);await ensureParentDirectory(_0x1e52f9),await writeFile(_0x1e52f9,_0x1365dd,_0x3b60ec(0x1e8));const _0x2ded69=await readSqlLockFile(_0x67826d[_0x3b60ec(0x1b8)]),{lockData:_0x2c94ac,appLock:_0xe3406}=ensureSqlLockScope(_0x2ded69??createEmptySqlLock(),_0x67826d['appCode'],_0x67826d[_0x3b60ec(0x1d6)],_0x3b60ec(0x1e5));return _0xe3406[_0x3b60ec(0x1e6)][_0x8ec13e[_0x3b60ec(0x1b6)]]={...buildSqlLockEntry(_0x8ec13e,_0x21c273,computeSqlContentHash(_0x1365dd),{'dbName':_0x2b677e}),'path':_0x7c4705,'mode':_0x48fdcf},_0xe3406[_0x3b60ec(0x1ec)]=new Date()[_0x3b60ec(0x1d9)](),await writeSqlLockFile(_0x67826d[_0x3b60ec(0x1b8)],_0x2c94ac),{'ok':!![],'data':{'id':_0x8ec13e['id'],'sqlCode':_0x8ec13e[_0x3b60ec(0x1b6)],'sqlName':_0x8ec13e['sqlName'],'dbId':_0x8ec13e[_0x3b60ec(0x1db)],'path':_0x1e52f9,'mode':_0x48fdcf},'message':_0x3b60ec(0x1c1)+_0x8ec13e[_0x3b60ec(0x1b6)]};}};async function resolveSqlNewInputs(_0x2eebe3){const _0xdbedc9=await resolveSqlNameInput(_0x2eebe3),{dbId:_0x44870b,dbName:_0x238eac}=await resolveDbSelection(_0x2eebe3),_0x5566a8=await resolveSqlModeInput(_0x2eebe3);return{'sqlName':_0xdbedc9,'dbId':_0x44870b,'dbName':_0x238eac,'mode':_0x5566a8};}async function resolveSqlNameInput(_0x456119){const _0x5800a0=a236_0xfd8194,_0x1c975a=_0x456119['str']('name')[_0x5800a0(0x1bf)]();if(_0x1c975a)return _0x1c975a;if(_0x456119['nonInteractive'])throw CliErrors[_0x5800a0(0x1eb)](_0x5800a0(0x1bd),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':'SQL\x20name:','validate':_0x4e972e=>_0x4e972e[_0x5800a0(0x1bf)]()?!![]:_0x5800a0(0x1ab)}))[_0x5800a0(0x1bf)]();}async function resolveDbSelection(_0x4ea2b9){const _0x533288=a236_0xfd8194,_0x494238=resolveProvidedDbId(_0x4ea2b9);if(typeof _0x494238==='number'&&Number['isFinite'](_0x494238)&&_0x494238>0x0)return{'dbId':_0x494238,'dbName':await getDbName(_0x4ea2b9['appCode'],_0x494238)[_0x533288(0x1e4)](()=>undefined)};if(_0x4ea2b9[_0x533288(0x1e9)])throw CliErrors[_0x533288(0x1eb)]('db-id','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x134d38=await listDatabases(_0x4ea2b9['appCode'])[_0x533288(0x1e4)](()=>[]);if(_0x134d38['length']===0x1)return{'dbId':_0x134d38[0x0]['dbId'],'dbName':_0x134d38[0x0][_0x533288(0x1b3)]};if(_0x134d38[_0x533288(0x1c3)]>0x1){const _0x5a92ea=await select({'message':_0x533288(0x1b1),'choices':[..._0x134d38['map'](_0x2f89d3=>({'name':_0x2f89d3[_0x533288(0x1b3)]+'\x20('+_0x2f89d3[_0x533288(0x1db)]+')','value':serializeDbSelection(_0x2f89d3)})),{'name':_0x533288(0x1c4),'value':_0x533288(0x1d3)}]});if(_0x5a92ea!=='__manual__')return deserializeDbSelection(_0x5a92ea);}const _0x2bfb25=await input({'message':'Target\x20database\x20dbId:','validate':_0xc8345c=>{const _0x283d45=_0x533288,_0x50c845=_0xc8345c[_0x283d45(0x1bf)]();if(!_0x50c845)return _0x283d45(0x1cd);const _0x23568b=Number(_0x50c845);if(!Number[_0x283d45(0x1e7)](_0x23568b)||_0x23568b<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x2bfb25['trim']())};}async function resolveSqlModeInput(_0x24bd6b){const _0x57ee22=a236_0xfd8194,_0x49885a=_0x24bd6b['str']('mode')[_0x57ee22(0x1bf)]();if(_0x49885a===_0x57ee22(0x1ac)||_0x49885a==='mybatisXml')return _0x49885a;if(_0x24bd6b['nonInteractive'])throw CliErrors[_0x57ee22(0x1eb)](_0x57ee22(0x1c2),_0x57ee22(0x1cb));return await select({'message':_0x57ee22(0x1c7),'choices':[{'name':_0x57ee22(0x1bc),'value':_0x57ee22(0x1ac),'description':_0x57ee22(0x1d4)},{'name':_0x57ee22(0x1c0),'value':_0x57ee22(0x1dd),'description':'For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags'}]});}function serializeDbSelection(_0x326b29){const _0x2b1370=a236_0xfd8194;return JSON['stringify']({'dbId':_0x326b29[_0x2b1370(0x1db)],'dbName':_0x326b29['dbName']});}function deserializeDbSelection(_0x4011af){const _0x312a7c=a236_0xfd8194;try{const _0x51bbf2=JSON[_0x312a7c(0x1b0)](_0x4011af);if(typeof _0x51bbf2[_0x312a7c(0x1db)]==='number'&&Number[_0x312a7c(0x1d1)](_0x51bbf2[_0x312a7c(0x1db)]))return{'dbId':_0x51bbf2[_0x312a7c(0x1db)],'dbName':_0x51bbf2[_0x312a7c(0x1b3)]};}catch{}throw CliErrors['validation'](_0x312a7c(0x1de)+_0x4011af);}function resolveProvidedDbId(_0x5f457f){const _0x9f9c0e=a236_0xfd8194,_0x49e346=_0x5f457f[_0x9f9c0e(0x1af)](_0x9f9c0e(0x1c5));if(typeof _0x49e346===_0x9f9c0e(0x1c8)&&Number[_0x9f9c0e(0x1d1)](_0x49e346))return _0x49e346;return undefined;}
@@ -1 +1 @@
1
- const a232_0x296974=a232_0x1b73;(function(_0xf83938,_0x3a255a){const _0x4659aa=a232_0x1b73,_0x2d9af7=_0xf83938();while(!![]){try{const _0x1a2d69=parseInt(_0x4659aa(0x1c5))/0x1+parseInt(_0x4659aa(0x1b1))/0x2*(parseInt(_0x4659aa(0x1c3))/0x3)+-parseInt(_0x4659aa(0x1b7))/0x4*(-parseInt(_0x4659aa(0x1b3))/0x5)+parseInt(_0x4659aa(0x1c9))/0x6*(parseInt(_0x4659aa(0x1ab))/0x7)+-parseInt(_0x4659aa(0x1c8))/0x8+-parseInt(_0x4659aa(0x1ae))/0x9+parseInt(_0x4659aa(0x1b0))/0xa*(-parseInt(_0x4659aa(0x1bc))/0xb);if(_0x1a2d69===_0x3a255a)break;else _0x2d9af7['push'](_0x2d9af7['shift']());}catch(_0x3cb73f){_0x2d9af7['push'](_0x2d9af7['shift']());}}}(a232_0x3132,0x7aab9));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a232_0x1b73(_0x5f33fe,_0x525d34){_0x5f33fe=_0x5f33fe-0x1a6;const _0x31328f=a232_0x3132();let _0x1b731c=_0x31328f[_0x5f33fe];return _0x1b731c;}import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a232_0x296974(0x1a7),'command':a232_0x296974(0x1b9),'description':a232_0x296974(0x1bf),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x5d8ebc){const _0x41b13c=a232_0x296974,_0x51292e=loadSqlProjectConfig(_0x5d8ebc[_0x41b13c(0x1a9)]),_0x22589a=await readSqlLockFile(_0x51292e[_0x41b13c(0x1c4)]);if(!_0x22589a)throw CliErrors[_0x41b13c(0x1be)](_0x41b13c(0x1b2));},async 'dryRun'(_0x5be366){const _0x1ddd73=a232_0x296974,_0x146852=loadSqlProjectConfig(_0x5be366[_0x1ddd73(0x1a9)]),_0xb84ff3=await readSqlLockFile(_0x146852[_0x1ddd73(0x1c4)]);if(!_0xb84ff3)throw CliErrors[_0x1ddd73(0x1be)](_0x1ddd73(0x1b2));const {appLock:_0x10329f}=ensureSqlLockScope(_0xb84ff3,_0x5be366[_0x1ddd73(0x1a9)],_0x146852[_0x1ddd73(0x1aa)],_0x1ddd73(0x1b9)),_0x21b48f=_0x5be366['str'](_0x1ddd73(0x1bb)),_0x2056e3=_0x10329f[_0x1ddd73(0x1c2)][_0x21b48f];if(!_0x2056e3)throw CliErrors['validation'](_0x1ddd73(0x1c6)+_0x21b48f+'\x22.');return{'method':_0x1ddd73(0x1c1),'url':_0x1ddd73(0x1ad),'body':{'sqlCode':_0x21b48f,'id':_0x2056e3[_0x1ddd73(0x1c0)],'localPath':resolveLocalSqlFilePath(_0x146852,_0x21b48f,_0x2056e3)},'description':_0x1ddd73(0x1af)+_0x21b48f+_0x1ddd73(0x1b4)+_0x146852['trashDir']};},async 'execute'(_0x5ef9a6){const _0x13234f=a232_0x296974,_0x57cecd=loadSqlProjectConfig(_0x5ef9a6['appCode']),_0x51fdd7=await readSqlLockFile(_0x57cecd[_0x13234f(0x1c4)]);if(!_0x51fdd7)throw CliErrors[_0x13234f(0x1be)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x3f9645,appLock:_0x209b1a}=ensureSqlLockScope(_0x51fdd7,_0x5ef9a6[_0x13234f(0x1a9)],_0x57cecd['sqlRoot'],_0x13234f(0x1b9)),_0x2712a0=_0x5ef9a6[_0x13234f(0x1bd)]('sqlcode'),_0x3fd67c=_0x209b1a[_0x13234f(0x1c2)][_0x2712a0];if(!_0x3fd67c)throw CliErrors[_0x13234f(0x1be)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x2712a0+'\x22.');await deleteSqlQuery({'id':_0x3fd67c[_0x13234f(0x1c0)],'sqlCode':_0x2712a0}),_0x209b1a[_0x13234f(0x1c2)]=Object[_0x13234f(0x1ac)](Object[_0x13234f(0x1a8)](_0x209b1a[_0x13234f(0x1c2)])[_0x13234f(0x1b5)](([_0x324378])=>_0x324378!==_0x2712a0)),_0x209b1a['lastSync']=new Date()[_0x13234f(0x1ba)](),await writeSqlLockFile(_0x57cecd[_0x13234f(0x1c4)],_0x3f9645);const _0x5c80da=resolveLocalSqlFilePath(_0x57cecd,_0x2712a0,_0x3fd67c);let _0x855015;await fileExists(_0x5c80da)&&(_0x855015=await moveToTrash(_0x57cecd['projectRoot'],_0x57cecd[_0x13234f(0x1b6)],_0x5c80da),await cleanupEmptyDirectories(dirname(_0x5c80da),_0x57cecd[_0x13234f(0x1b8)]));const _0x544a16={'deleted':_0x2712a0,'remoteId':_0x3fd67c[_0x13234f(0x1c0)]};if(_0x855015)_0x544a16['trashedTo']=_0x855015;return{'ok':!![],'data':_0x544a16,'message':_0x13234f(0x1c7)+_0x2712a0+(_0x855015?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function a232_0x3132(){const _0x301079=['SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','5RhGFNF','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','filter','trashDir','628424MkGCEs','sqlRootDir','delete','toISOString','sqlcode','209mfXUTt','str','validation','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','remoteId','POST','sqls','21OjmmuF','lockFilePath','186361FmiNZN','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','Deleted\x20','1648048deerXo','366tEvZSU','length','sql','entries','appCode','sqlRoot','92484DuDsYP','fromEntries','/smartapi/custom/deleteUserCustomSql','6834717ATEoAS','Would\x20delete\x20SQL\x20','104920nsbOhn','147950iiivnS'];a232_0x3132=function(){return _0x301079;};return a232_0x3132();}async function moveToTrash(_0x39ed15,_0x184f1f,_0x100c97){const _0x356882=a232_0x296974,_0x41208e=new Date()[_0x356882(0x1ba)]()['replace'](/[:.]/g,'-'),_0x3a7d98=relative(_0x39ed15,_0x100c97),_0x2bd918=join(_0x184f1f,_0x41208e,_0x3a7d98);return await mkdir(dirname(_0x2bd918),{'recursive':!![]}),await rename(_0x100c97,_0x2bd918),_0x2bd918;}async function cleanupEmptyDirectories(_0x5989de,_0x48eb09){const _0x55162f=a232_0x296974;let _0x233618=resolve(_0x5989de);const _0x475c39=resolve(_0x48eb09);while(_0x233618['startsWith'](''+_0x475c39+sep)||_0x233618===_0x475c39){if(_0x233618===_0x475c39)return;try{const _0x11acdc=await readdir(_0x233618);if(_0x11acdc[_0x55162f(0x1a6)]>0x0)return;await rmdir(_0x233618);}catch{return;}_0x233618=dirname(_0x233618);}}
1
+ const a237_0x953149=a237_0x2333;(function(_0x150ee4,_0x5bdce8){const _0x44d3c5=a237_0x2333,_0x600ad9=_0x150ee4();while(!![]){try{const _0x590b94=parseInt(_0x44d3c5(0x127))/0x1+-parseInt(_0x44d3c5(0x12e))/0x2*(-parseInt(_0x44d3c5(0x129))/0x3)+parseInt(_0x44d3c5(0x142))/0x4*(parseInt(_0x44d3c5(0x131))/0x5)+parseInt(_0x44d3c5(0x128))/0x6+-parseInt(_0x44d3c5(0x148))/0x7*(parseInt(_0x44d3c5(0x141))/0x8)+parseInt(_0x44d3c5(0x12f))/0x9*(-parseInt(_0x44d3c5(0x13a))/0xa)+parseInt(_0x44d3c5(0x13f))/0xb*(-parseInt(_0x44d3c5(0x14b))/0xc);if(_0x590b94===_0x5bdce8)break;else _0x600ad9['push'](_0x600ad9['shift']());}catch(_0x3a4678){_0x600ad9['push'](_0x600ad9['shift']());}}}(a237_0x43bd,0x38614));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a237_0x43bd(){const _0x501b2b=['projectRoot','trashDir','20uYxDDW','fromEntries','appCode','length','startsWith','55YIyOcL','/smartapi/custom/deleteUserCustomSql','8ptzFfx','15804KfvaGB','delete','lastSync','str','remoteId','sqls','612647EqomCX','validation','POST','943524ghWFnc','Would\x20delete\x20SQL\x20','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','Deleted\x20','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','high-risk-write','135233HmYVsE','1638174kZBkcl','1129209unRcxT','sql','SQL\x20lock\x20file\x20not\x20found.','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','trashedTo','2xBLhok','808893znLRMn','sqlcode','135JUJrBB','filter','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','entries','sqlRoot','lockFilePath','toISOString'];a237_0x43bd=function(){return _0x501b2b;};return a237_0x43bd();}import{dirname,join,relative,resolve,sep}from'node:path';function a237_0x2333(_0x39bbae,_0xaabfa1){_0x39bbae=_0x39bbae-0x127;const _0x43bd22=a237_0x43bd();let _0x2333e2=_0x43bd22[_0x39bbae];return _0x2333e2;}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':a237_0x953149(0x12a),'command':a237_0x953149(0x143),'description':a237_0x953149(0x14d),'risk':a237_0x953149(0x150),'flags':[SQLCODE_FLAG],async 'validate'(_0x3453a7){const _0x2afca4=a237_0x953149,_0x49ee67=loadSqlProjectConfig(_0x3453a7[_0x2afca4(0x13c)]),_0x5672fd=await readSqlLockFile(_0x49ee67[_0x2afca4(0x136)]);if(!_0x5672fd)throw CliErrors[_0x2afca4(0x149)](_0x2afca4(0x133));},async 'dryRun'(_0x1b7c87){const _0x4d1272=a237_0x953149,_0x3ecbcd=loadSqlProjectConfig(_0x1b7c87['appCode']),_0x496037=await readSqlLockFile(_0x3ecbcd[_0x4d1272(0x136)]);if(!_0x496037)throw CliErrors['validation'](_0x4d1272(0x133));const {appLock:_0xff110d}=ensureSqlLockScope(_0x496037,_0x1b7c87[_0x4d1272(0x13c)],_0x3ecbcd['sqlRoot'],_0x4d1272(0x143)),_0x4e7485=_0x1b7c87['str'](_0x4d1272(0x130)),_0x45d742=_0xff110d[_0x4d1272(0x147)][_0x4e7485];if(!_0x45d742)throw CliErrors[_0x4d1272(0x149)](_0x4d1272(0x14f)+_0x4e7485+'\x22.');return{'method':_0x4d1272(0x14a),'url':_0x4d1272(0x140),'body':{'sqlCode':_0x4e7485,'id':_0x45d742[_0x4d1272(0x146)],'localPath':resolveLocalSqlFilePath(_0x3ecbcd,_0x4e7485,_0x45d742)},'description':_0x4d1272(0x14c)+_0x4e7485+_0x4d1272(0x12c)+_0x3ecbcd[_0x4d1272(0x139)]};},async 'execute'(_0x1db5f7){const _0x5065e3=a237_0x953149,_0x2029a9=loadSqlProjectConfig(_0x1db5f7[_0x5065e3(0x13c)]),_0x1d84c8=await readSqlLockFile(_0x2029a9[_0x5065e3(0x136)]);if(!_0x1d84c8)throw CliErrors[_0x5065e3(0x149)](_0x5065e3(0x12b));const {lockData:_0x3a9af4,appLock:_0x222d2a}=ensureSqlLockScope(_0x1d84c8,_0x1db5f7[_0x5065e3(0x13c)],_0x2029a9[_0x5065e3(0x135)],'delete'),_0x59ceaf=_0x1db5f7[_0x5065e3(0x145)](_0x5065e3(0x130)),_0x30aad1=_0x222d2a[_0x5065e3(0x147)][_0x59ceaf];if(!_0x30aad1)throw CliErrors['validation']('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x59ceaf+'\x22.');await deleteSqlQuery({'id':_0x30aad1[_0x5065e3(0x146)],'sqlCode':_0x59ceaf}),_0x222d2a[_0x5065e3(0x147)]=Object[_0x5065e3(0x13b)](Object[_0x5065e3(0x134)](_0x222d2a[_0x5065e3(0x147)])[_0x5065e3(0x132)](([_0x161446])=>_0x161446!==_0x59ceaf)),_0x222d2a[_0x5065e3(0x144)]=new Date()['toISOString'](),await writeSqlLockFile(_0x2029a9[_0x5065e3(0x136)],_0x3a9af4);const _0x28cadd=resolveLocalSqlFilePath(_0x2029a9,_0x59ceaf,_0x30aad1);let _0xe73812;await fileExists(_0x28cadd)&&(_0xe73812=await moveToTrash(_0x2029a9[_0x5065e3(0x138)],_0x2029a9[_0x5065e3(0x139)],_0x28cadd),await cleanupEmptyDirectories(dirname(_0x28cadd),_0x2029a9['sqlRootDir']));const _0xe3db97={'deleted':_0x59ceaf,'remoteId':_0x30aad1[_0x5065e3(0x146)]};if(_0xe73812)_0xe3db97[_0x5065e3(0x12d)]=_0xe73812;return{'ok':!![],'data':_0xe3db97,'message':_0x5065e3(0x14e)+_0x59ceaf+(_0xe73812?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x2dc897,_0x8f3197,_0x43b334){const _0x19679b=a237_0x953149,_0x2eef2e=new Date()[_0x19679b(0x137)]()['replace'](/[:.]/g,'-'),_0x3e31f0=relative(_0x2dc897,_0x43b334),_0x11a1fb=join(_0x8f3197,_0x2eef2e,_0x3e31f0);return await mkdir(dirname(_0x11a1fb),{'recursive':!![]}),await rename(_0x43b334,_0x11a1fb),_0x11a1fb;}async function cleanupEmptyDirectories(_0x7e96ed,_0x236c82){const _0x222d62=a237_0x953149;let _0x2c0bfc=resolve(_0x7e96ed);const _0x238535=resolve(_0x236c82);while(_0x2c0bfc[_0x222d62(0x13e)](''+_0x238535+sep)||_0x2c0bfc===_0x238535){if(_0x2c0bfc===_0x238535)return;try{const _0x1c9a75=await readdir(_0x2c0bfc);if(_0x1c9a75[_0x222d62(0x13d)]>0x0)return;await rmdir(_0x2c0bfc);}catch{return;}_0x2c0bfc=dirname(_0x2c0bfc);}}
@@ -1 +1 @@
1
- const a233_0x1c8b95=a233_0x1e1a;(function(_0x32678d,_0x445107){const _0x1c6fc7=a233_0x1e1a,_0x390524=_0x32678d();while(!![]){try{const _0x4a4406=parseInt(_0x1c6fc7(0x189))/0x1+parseInt(_0x1c6fc7(0x182))/0x2+-parseInt(_0x1c6fc7(0x18f))/0x3*(parseInt(_0x1c6fc7(0x194))/0x4)+-parseInt(_0x1c6fc7(0x185))/0x5+-parseInt(_0x1c6fc7(0x191))/0x6+parseInt(_0x1c6fc7(0x18e))/0x7+parseInt(_0x1c6fc7(0x186))/0x8;if(_0x4a4406===_0x445107)break;else _0x390524['push'](_0x390524['shift']());}catch(_0x2ce2b4){_0x390524['push'](_0x390524['shift']());}}}(a233_0x240d,0x44a93));function a233_0x240d(){const _0x2c2faa=['sqlCode','appCode','260lbYrmk','detail','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','375902YNthDL','sqlContent','dbId','487840tlxsjY','50536MBIxpx','bool','str','494776DaKuLn','sqlName','sql','read','verbose','1411928AMIhFF','21555BTRDEi','boolean','269520yQrTEg'];a233_0x240d=function(){return _0x2c2faa;};return a233_0x240d();}function a233_0x1e1a(_0x523c27,_0x1b51b2){_0x523c27=_0x523c27-0x180;const _0x240d5f=a233_0x240d();let _0x1e1ab3=_0x240d5f[_0x523c27];return _0x1e1ab3;}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':a233_0x1c8b95(0x18b),'command':a233_0x1c8b95(0x180),'description':a233_0x1c8b95(0x181),'risk':a233_0x1c8b95(0x18c),'flags':[SQLCODE_FLAG,{'name':a233_0x1c8b95(0x18d),'type':a233_0x1c8b95(0x190),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x52b531){const _0x48ff1a=a233_0x1c8b95,_0x2f347b=await getSqlQueryInfo(_0x52b531[_0x48ff1a(0x193)],_0x52b531[_0x48ff1a(0x188)]('sqlcode')),_0x1295b9=_0x52b531[_0x48ff1a(0x187)](_0x48ff1a(0x18d));if(_0x1295b9)return{'ok':!![],'data':_0x2f347b};const _0x2ece30=_0x2f347b[_0x48ff1a(0x184)]?await getDbName(_0x52b531[_0x48ff1a(0x193)],_0x2f347b['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x2f347b[_0x48ff1a(0x192)],'sqlName':_0x2f347b[_0x48ff1a(0x18a)],'db':_0x2ece30?_0x2ece30+'\x20('+_0x2f347b[_0x48ff1a(0x184)]+')':_0x2f347b[_0x48ff1a(0x184)]??'','description':_0x2f347b['description']??'','sqlContent':_0x2f347b[_0x48ff1a(0x183)]??''}};}};
1
+ const a238_0x132486=a238_0x9b1a;function a238_0x4929(){const _0x404c80=['16051200abmRnl','344202OwBmPq','sqlcode','3730RGhDci','9AHoyid','63DRXaFb','description','9229qGDukp','boolean','dbId','379664YdsQyD','verbose','detail','2UAtMjv','appCode','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','382904nOydEm','403315jgYKvV','Return\x20full\x20raw\x20SQL\x20query\x20object','1628991aHIjTN','sql','12JQRLDY','sqlContent'];a238_0x4929=function(){return _0x404c80;};return a238_0x4929();}(function(_0x3a696c,_0x21afd4){const _0x4b0ff2=a238_0x9b1a,_0x5d7595=_0x3a696c();while(!![]){try{const _0x34345d=-parseInt(_0x4b0ff2(0x93))/0x1*(parseInt(_0x4b0ff2(0x96))/0x2)+-parseInt(_0x4b0ff2(0x85))/0x3+parseInt(_0x4b0ff2(0x87))/0x4*(parseInt(_0x4b0ff2(0x83))/0x5)+parseInt(_0x4b0ff2(0x8a))/0x6*(parseInt(_0x4b0ff2(0x8e))/0x7)+-parseInt(_0x4b0ff2(0x82))/0x8*(-parseInt(_0x4b0ff2(0x8d))/0x9)+parseInt(_0x4b0ff2(0x8c))/0xa*(-parseInt(_0x4b0ff2(0x90))/0xb)+parseInt(_0x4b0ff2(0x89))/0xc;if(_0x34345d===_0x21afd4)break;else _0x5d7595['push'](_0x5d7595['shift']());}catch(_0x906002){_0x5d7595['push'](_0x5d7595['shift']());}}}(a238_0x4929,0xddb73));function a238_0x9b1a(_0x32f652,_0x3df726){_0x32f652=_0x32f652-0x82;const _0x492986=a238_0x4929();let _0x9b1ac0=_0x492986[_0x32f652];return _0x9b1ac0;}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':a238_0x132486(0x86),'command':a238_0x132486(0x95),'description':a238_0x132486(0x98),'risk':'read','flags':[SQLCODE_FLAG,{'name':a238_0x132486(0x94),'type':a238_0x132486(0x91),'description':a238_0x132486(0x84)}],async 'execute'(_0x2a7f14){const _0x19fb17=a238_0x132486,_0x361ac6=await getSqlQueryInfo(_0x2a7f14[_0x19fb17(0x97)],_0x2a7f14['str'](_0x19fb17(0x8b))),_0x30573c=_0x2a7f14['bool'](_0x19fb17(0x94));if(_0x30573c)return{'ok':!![],'data':_0x361ac6};const _0x378072=_0x361ac6[_0x19fb17(0x92)]?await getDbName(_0x2a7f14['appCode'],_0x361ac6['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x361ac6['sqlCode'],'sqlName':_0x361ac6['sqlName'],'db':_0x378072?_0x378072+'\x20('+_0x361ac6[_0x19fb17(0x92)]+')':_0x361ac6['dbId']??'','description':_0x361ac6[_0x19fb17(0x8f)]??'','sqlContent':_0x361ac6[_0x19fb17(0x88)]??''}};}};
@@ -1 +1 @@
1
- const a234_0x219acc=a234_0x56cb;(function(_0x5e2107,_0x29c991){const _0x3edd8d=a234_0x56cb,_0x2b745d=_0x5e2107();while(!![]){try{const _0x40ec8d=-parseInt(_0x3edd8d(0x1b7))/0x1+-parseInt(_0x3edd8d(0x1bb))/0x2+-parseInt(_0x3edd8d(0x1be))/0x3+parseInt(_0x3edd8d(0x1ba))/0x4*(-parseInt(_0x3edd8d(0x1c3))/0x5)+-parseInt(_0x3edd8d(0x1c1))/0x6+-parseInt(_0x3edd8d(0x1ce))/0x7*(parseInt(_0x3edd8d(0x1c0))/0x8)+-parseInt(_0x3edd8d(0x1cd))/0x9*(-parseInt(_0x3edd8d(0x1b9))/0xa);if(_0x40ec8d===_0x29c991)break;else _0x2b745d['push'](_0x2b745d['shift']());}catch(_0x1b399c){_0x2b745d['push'](_0x2b745d['shift']());}}}(a234_0x3a12,0x1caa3));function a234_0x56cb(_0x4e12f4,_0x23ef51){_0x4e12f4=_0x4e12f4-0x1b7;const _0x3a126c=a234_0x3a12();let _0x56cb8d=_0x3a126c[_0x4e12f4];return _0x56cb8d;}function a234_0x3a12(){const _0x434912=['9784qUtJPR','980640HxfPEf','sqlcode','355LXJtwV','appCode','now','execError','length','read','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','\x20row(s)\x20in\x20','execResult','Returned\x20','24615PCRkqr','854keeRbZ','SQL\x20execution\x20failed','152572kSpwhl','params','2210itJRss','372aLMiER','8326nFaUuW','str','execSuccess','33120skXKED','string'];a234_0x3a12=function(){return _0x434912;};return a234_0x3a12();}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':'exec','description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a234_0x219acc(0x1c8),'flags':[SQLCODE_FLAG,{'name':a234_0x219acc(0x1b8),'type':a234_0x219acc(0x1bf),'description':a234_0x219acc(0x1c9)}],async 'execute'(_0x44345d){const _0x11e4f5=a234_0x219acc,_0x407b34=parseJsonParams(_0x44345d[_0x11e4f5(0x1bc)](_0x11e4f5(0x1b8))),_0xf07d9d=Date['now'](),_0x40fbdb=await executeSql(_0x44345d[_0x11e4f5(0x1c4)],_0x44345d['str'](_0x11e4f5(0x1c2)),_0x407b34),_0x2196b0=Date[_0x11e4f5(0x1c5)]()-_0xf07d9d,_0x527c87=_0x40fbdb?.[_0x11e4f5(0x1cb)]??_0x40fbdb,_0x1d2382=_0x40fbdb?.[_0x11e4f5(0x1bd)]??!![];if(!_0x1d2382)return{'ok':![],'data':{'error':_0x40fbdb?.[_0x11e4f5(0x1c6)]||_0x11e4f5(0x1cf),'elapsed':_0x2196b0},'message':'SQL\x20execution\x20failed'};const _0x41d80b=Array['isArray'](_0x527c87)?_0x527c87:[];return{'ok':!![],'data':{'rows':_0x41d80b,'rowCount':_0x41d80b['length'],'elapsed':_0x2196b0},'message':_0x11e4f5(0x1cc)+_0x41d80b[_0x11e4f5(0x1c7)]+_0x11e4f5(0x1ca)+_0x2196b0+'ms'};}};
1
+ function a239_0x4a3e(_0x55b4b6,_0x7420b8){_0x55b4b6=_0x55b4b6-0xb2;const _0x24571e=a239_0x2457();let _0x4a3e6d=_0x24571e[_0x55b4b6];return _0x4a3e6d;}const a239_0x1be826=a239_0x4a3e;function a239_0x2457(){const _0x59d4f9=['length','248YLYidR','read','execError','272944WXQWZo','3027740XaYqbO','31988yBKizX','isArray','11195XkdmJf','execResult','9pVgANT','now','appCode','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','2dIlbhQ','1852jsWwuc','execSuccess','2993154QTRBeW','3122586oAEvka','sql','1061266VelUUn','8868cfXPve','SQL\x20execution\x20failed'];a239_0x2457=function(){return _0x59d4f9;};return a239_0x2457();}(function(_0x5a8df7,_0x514e75){const _0x48f5c2=a239_0x4a3e,_0x539445=_0x5a8df7();while(!![]){try{const _0x28a74c=-parseInt(_0x48f5c2(0xc6))/0x1*(parseInt(_0x48f5c2(0xb5))/0x2)+parseInt(_0x48f5c2(0xb3))/0x3+-parseInt(_0x48f5c2(0xc7))/0x4*(parseInt(_0x48f5c2(0xc0))/0x5)+parseInt(_0x48f5c2(0xb2))/0x6+parseInt(_0x48f5c2(0xbc))/0x7*(-parseInt(_0x48f5c2(0xb9))/0x8)+parseInt(_0x48f5c2(0xc2))/0x9*(parseInt(_0x48f5c2(0xbd))/0xa)+-parseInt(_0x48f5c2(0xbe))/0xb*(-parseInt(_0x48f5c2(0xb6))/0xc);if(_0x28a74c===_0x514e75)break;else _0x539445['push'](_0x539445['shift']());}catch(_0x44bda0){_0x539445['push'](_0x539445['shift']());}}}(a239_0x2457,0xa7320));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':a239_0x1be826(0xb4),'command':'exec','description':a239_0x1be826(0xc5),'risk':a239_0x1be826(0xba),'flags':[SQLCODE_FLAG,{'name':'params','type':'string','description':'SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'}],async 'execute'(_0x17bd3c){const _0x5278b3=a239_0x1be826,_0x513e3d=parseJsonParams(_0x17bd3c['str']('params')),_0x293f94=Date[_0x5278b3(0xc3)](),_0x17a6e9=await executeSql(_0x17bd3c[_0x5278b3(0xc4)],_0x17bd3c['str']('sqlcode'),_0x513e3d),_0x467589=Date[_0x5278b3(0xc3)]()-_0x293f94,_0x56228c=_0x17a6e9?.[_0x5278b3(0xc1)]??_0x17a6e9,_0x12a1b1=_0x17a6e9?.[_0x5278b3(0xc8)]??!![];if(!_0x12a1b1)return{'ok':![],'data':{'error':_0x17a6e9?.[_0x5278b3(0xbb)]||_0x5278b3(0xb7),'elapsed':_0x467589},'message':'SQL\x20execution\x20failed'};const _0x2ce618=Array[_0x5278b3(0xbf)](_0x56228c)?_0x56228c:[];return{'ok':!![],'data':{'rows':_0x2ce618,'rowCount':_0x2ce618[_0x5278b3(0xb8)],'elapsed':_0x467589},'message':'Returned\x20'+_0x2ce618[_0x5278b3(0xb8)]+'\x20row(s)\x20in\x20'+_0x467589+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x5bd7dd,_0x29b38d){const _0x2e31c6=a235_0x1ffb,_0x1ac268=_0x5bd7dd();while(!![]){try{const _0x30cdb3=parseInt(_0x2e31c6(0xc6))/0x1*(parseInt(_0x2e31c6(0xbf))/0x2)+-parseInt(_0x2e31c6(0xc2))/0x3+parseInt(_0x2e31c6(0xc7))/0x4+parseInt(_0x2e31c6(0xc0))/0x5+parseInt(_0x2e31c6(0xc3))/0x6*(-parseInt(_0x2e31c6(0xc4))/0x7)+parseInt(_0x2e31c6(0xc1))/0x8+-parseInt(_0x2e31c6(0xc5))/0x9;if(_0x30cdb3===_0x29b38d)break;else _0x1ac268['push'](_0x1ac268['shift']());}catch(_0x13e99a){_0x1ac268['push'](_0x1ac268['shift']());}}}(a235_0x4962,0x891d9));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';function a235_0x4962(){const _0x268b9d=['8931114QBAwtV','271103cPwisf','2518020kdwsJG','2sggbFj','4798765mAnGcR','3880168FLBuBv','1744950ybJgTs','26778EvNAPH','329uJDBvX'];a235_0x4962=function(){return _0x268b9d;};return a235_0x4962();}import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';function a235_0x1ffb(_0x417176,_0x3fe5d2){_0x417176=_0x417176-0xbf;const _0x49623e=a235_0x4962();let _0x1ffb27=_0x49623e[_0x417176];return _0x1ffb27;}import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
1
+ function a240_0x54cc(){const _0x295daf=['176MQrIHj','39970HZwpTK','1300578lTdHgC','1832yPhiEW','456mTSQWD','364010PEcKtX','36KSdwjh','9bhaapU','1140607AkILJK','230rKoIGq','5250808aULEfV','21FoIFuy','721364XPwTcR'];a240_0x54cc=function(){return _0x295daf;};return a240_0x54cc();}(function(_0x11fd95,_0x4667b6){const _0x1e8e91=a240_0x2c05,_0x220495=_0x11fd95();while(!![]){try{const _0x455d93=-parseInt(_0x1e8e91(0xe5))/0x1+-parseInt(_0x1e8e91(0xe7))/0x2*(parseInt(_0x1e8e91(0xdf))/0x3)+parseInt(_0x1e8e91(0xdc))/0x4*(-parseInt(_0x1e8e91(0xe2))/0x5)+parseInt(_0x1e8e91(0xe8))/0x6*(-parseInt(_0x1e8e91(0xe4))/0x7)+-parseInt(_0x1e8e91(0xe3))/0x8*(parseInt(_0x1e8e91(0xe0))/0x9)+-parseInt(_0x1e8e91(0xde))/0xa*(parseInt(_0x1e8e91(0xe6))/0xb)+-parseInt(_0x1e8e91(0xdd))/0xc*(-parseInt(_0x1e8e91(0xe1))/0xd);if(_0x455d93===_0x4667b6)break;else _0x220495['push'](_0x220495['shift']());}catch(_0x5408a8){_0x220495['push'](_0x220495['shift']());}}}(a240_0x54cc,0x70fb6));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a240_0x2c05(_0x6e19d0,_0x39c682){_0x6e19d0=_0x6e19d0-0xdc;const _0x54cc5e=a240_0x54cc();let _0x2c0551=_0x54cc5e[_0x6e19d0];return _0x2c0551;}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- function a236_0x5ae2(){const _0x540dc9=['totalCount','name','dbId','boolean','Page\x20number','map','read','423430TKuKMi','128eARYSk','409516JZkEwo','226648cmBuRr','tableData','paging','26420sQlqnq','length','str','list','sql','No\x20custom\x20SQL\x20queries\x20found.','description','1177836cJgyjz','string','Found\x20','appCode','\x20SQL\x20queries\x20(total:\x20','sqlcode','page','verbose','604305XikfYS','number','num','167948nUuXsc','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','45MJQHod'];a236_0x5ae2=function(){return _0x540dc9;};return a236_0x5ae2();}const a236_0x52c5d7=a236_0x5be9;(function(_0x332c58,_0xe66d9d){const _0x823c26=a236_0x5be9,_0x5949ea=_0x332c58();while(!![]){try{const _0x490f6b=parseInt(_0x823c26(0x1d6))/0x1+-parseInt(_0x823c26(0x1c0))/0x2+parseInt(_0x823c26(0x1d3))/0x3+-parseInt(_0x823c26(0x1bf))/0x4*(parseInt(_0x823c26(0x1c4))/0x5)+parseInt(_0x823c26(0x1cb))/0x6+parseInt(_0x823c26(0x1be))/0x7+parseInt(_0x823c26(0x1c1))/0x8*(-parseInt(_0x823c26(0x1d8))/0x9);if(_0x490f6b===_0xe66d9d)break;else _0x5949ea['push'](_0x5949ea['shift']());}catch(_0x2e76f1){_0x5949ea['push'](_0x5949ea['shift']());}}}(a236_0x5ae2,0x1b056));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a236_0x5be9(_0x9320b8,_0x334a70){_0x9320b8=_0x9320b8-0x1bb;const _0x5ae24f=a236_0x5ae2();let _0x5be965=_0x5ae24f[_0x9320b8];return _0x5be965;}export const sqlList={'service':a236_0x52c5d7(0x1c8),'command':a236_0x52c5d7(0x1c7),'description':'List\x20custom\x20SQL\x20queries','risk':a236_0x52c5d7(0x1bd),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a236_0x52c5d7(0x1da),'type':a236_0x52c5d7(0x1cc),'description':'Filter\x20by\x20SQL\x20name'},{'name':a236_0x52c5d7(0x1d1),'type':a236_0x52c5d7(0x1d4),'description':a236_0x52c5d7(0x1bb),'default':0x1},{'name':'pagesize','type':a236_0x52c5d7(0x1d4),'description':'Page\x20size'},{'name':'verbose','type':a236_0x52c5d7(0x1dc),'description':a236_0x52c5d7(0x1d7)}],async 'execute'(_0x16fcb6){const _0x24af78=a236_0x52c5d7,_0x27cde0=await listSqlQueries(_0x16fcb6[_0x24af78(0x1ce)],{'sqlCode':_0x16fcb6['str'](_0x24af78(0x1d0))||undefined,'sqlName':_0x16fcb6[_0x24af78(0x1c6)]('name')||undefined,'currentPage':_0x16fcb6[_0x24af78(0x1d5)](_0x24af78(0x1d1)),'pageSize':_0x16fcb6['num']('pagesize',0x32)}),_0x124703=_0x16fcb6['bool'](_0x24af78(0x1d2)),_0x267563=_0x27cde0[_0x24af78(0x1c2)]??[],_0x7391bd=_0x27cde0[_0x24af78(0x1c3)]?.[_0x24af78(0x1d9)]??_0x267563['length'];let _0x329e8c;return _0x124703?_0x329e8c=_0x267563:_0x329e8c=await Promise['all'](_0x267563[_0x24af78(0x1bc)](async _0x32321c=>{const _0x879381=_0x24af78;let _0x17ee22;try{_0x17ee22=_0x32321c[_0x879381(0x1db)]?await getDbName(_0x16fcb6[_0x879381(0x1ce)],_0x32321c[_0x879381(0x1db)]):undefined;}catch{}return{'sqlCode':_0x32321c['sqlCode'],'sqlName':_0x32321c['sqlName'],'description':_0x32321c[_0x879381(0x1ca)]??'','db':_0x17ee22?_0x17ee22+'\x20('+_0x32321c[_0x879381(0x1db)]+')':_0x32321c[_0x879381(0x1db)]??''};})),{'ok':!![],'data':_0x329e8c,'message':_0x267563[_0x24af78(0x1c5)]===0x0?_0x24af78(0x1c9):_0x24af78(0x1cd)+_0x267563[_0x24af78(0x1c5)]+_0x24af78(0x1cf)+_0x7391bd+').'};}};
1
+ const a241_0x28114=a241_0x3d18;function a241_0x3d18(_0x4f13c3,_0x378c7a){_0x4f13c3=_0x4f13c3-0xf6;const _0x8b9659=a241_0x8b96();let _0x3d185d=_0x8b9659[_0x4f13c3];return _0x3d185d;}(function(_0x125883,_0x15b361){const _0x1e31fb=a241_0x3d18,_0x3867cb=_0x125883();while(!![]){try{const _0x12b82a=parseInt(_0x1e31fb(0x101))/0x1+parseInt(_0x1e31fb(0xfb))/0x2*(-parseInt(_0x1e31fb(0x10d))/0x3)+parseInt(_0x1e31fb(0x10c))/0x4*(parseInt(_0x1e31fb(0x100))/0x5)+-parseInt(_0x1e31fb(0x113))/0x6+parseInt(_0x1e31fb(0x111))/0x7*(parseInt(_0x1e31fb(0xfa))/0x8)+parseInt(_0x1e31fb(0x118))/0x9*(-parseInt(_0x1e31fb(0x114))/0xa)+parseInt(_0x1e31fb(0x10f))/0xb;if(_0x12b82a===_0x15b361)break;else _0x3867cb['push'](_0x3867cb['shift']());}catch(_0x3b8fb6){_0x3867cb['push'](_0x3867cb['shift']());}}}(a241_0x8b96,0x4f63d));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a241_0x8b96(){const _0x226121=['page','description','sql','4vBdjNd','11622kVOfqL','sqlCode','4324672Iqszxt','read','11123IZIEAF','dbId','1090788MMUIqU','13800WBVkmt','List\x20custom\x20SQL\x20queries','string','Page\x20size','3501tJAUBf','paging','tableData','str','\x20SQL\x20queries\x20(total:\x20','appCode','pagesize','376kdtNVl','38SbTuVW','name','No\x20custom\x20SQL\x20queries\x20found.','totalCount','Found\x20','1605925IdTuth','328385sZkhpG','bool','boolean','verbose','map','Page\x20number','length','number'];a241_0x8b96=function(){return _0x226121;};return a241_0x8b96();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a241_0x28114(0x10b),'command':'list','description':a241_0x28114(0x115),'risk':a241_0x28114(0x110),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a241_0x28114(0x116),'description':'Filter\x20by\x20SQL\x20name'},{'name':a241_0x28114(0x109),'type':a241_0x28114(0x108),'description':a241_0x28114(0x106),'default':0x1},{'name':a241_0x28114(0xf9),'type':'number','description':a241_0x28114(0x117)},{'name':a241_0x28114(0x104),'type':a241_0x28114(0x103),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x1a7c64){const _0x5515a1=a241_0x28114,_0x55d618=await listSqlQueries(_0x1a7c64[_0x5515a1(0xf8)],{'sqlCode':_0x1a7c64[_0x5515a1(0xf6)]('sqlcode')||undefined,'sqlName':_0x1a7c64['str'](_0x5515a1(0xfc))||undefined,'currentPage':_0x1a7c64['num']('page'),'pageSize':_0x1a7c64['num'](_0x5515a1(0xf9),0x32)}),_0x53f782=_0x1a7c64[_0x5515a1(0x102)](_0x5515a1(0x104)),_0x351184=_0x55d618[_0x5515a1(0x11a)]??[],_0x1c9c1b=_0x55d618[_0x5515a1(0x119)]?.[_0x5515a1(0xfe)]??_0x351184[_0x5515a1(0x107)];let _0x287558;return _0x53f782?_0x287558=_0x351184:_0x287558=await Promise['all'](_0x351184[_0x5515a1(0x105)](async _0x373e76=>{const _0x5b527f=_0x5515a1;let _0x213529;try{_0x213529=_0x373e76[_0x5b527f(0x112)]?await getDbName(_0x1a7c64[_0x5b527f(0xf8)],_0x373e76['dbId']):undefined;}catch{}return{'sqlCode':_0x373e76[_0x5b527f(0x10e)],'sqlName':_0x373e76['sqlName'],'description':_0x373e76[_0x5b527f(0x10a)]??'','db':_0x213529?_0x213529+'\x20('+_0x373e76[_0x5b527f(0x112)]+')':_0x373e76[_0x5b527f(0x112)]??''};})),{'ok':!![],'data':_0x287558,'message':_0x351184['length']===0x0?_0x5515a1(0xfd):_0x5515a1(0xff)+_0x351184[_0x5515a1(0x107)]+_0x5515a1(0xf7)+_0x1c9c1b+').'};}};
@@ -1 +1 @@
1
- const a237_0x1d0ba9=a237_0x390a;(function(_0x82887d,_0x49d323){const _0x3573f1=a237_0x390a,_0xb1e81d=_0x82887d();while(!![]){try{const _0x518208=-parseInt(_0x3573f1(0x1d1))/0x1+parseInt(_0x3573f1(0x1ae))/0x2*(parseInt(_0x3573f1(0x1a6))/0x3)+-parseInt(_0x3573f1(0x1df))/0x4*(-parseInt(_0x3573f1(0x1d3))/0x5)+parseInt(_0x3573f1(0x1d0))/0x6+-parseInt(_0x3573f1(0x1de))/0x7+parseInt(_0x3573f1(0x1d4))/0x8+-parseInt(_0x3573f1(0x1d7))/0x9;if(_0x518208===_0x49d323)break;else _0xb1e81d['push'](_0xb1e81d['shift']());}catch(_0x16b74b){_0xb1e81d['push'](_0xb1e81d['shift']());}}}(a237_0x4ec1,0x8cd67));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';function a237_0x390a(_0x2ec6ee,_0x58e2f8){_0x2ec6ee=_0x2ec6ee-0x198;const _0x4ec1a0=a237_0x4ec1();let _0x390ae5=_0x4ec1a0[_0x2ec6ee];return _0x390ae5;}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(_0x3b8505,_0x3ab9a3){const _0x570c6d=a237_0x390a,_0x257b6f=[];let _0x280ff4=0x1;while(!![]){const _0x4aad0b=await listSqlQueries(_0x3b8505,{'currentPage':_0x280ff4,'pageSize':PAGE_SIZE,'sqlCode':_0x3ab9a3[_0x570c6d(0x1dd)],'sqlName':_0x3ab9a3[_0x570c6d(0x1a8)]}),_0x26f666=_0x4aad0b['tableData']??[];_0x257b6f[_0x570c6d(0x1c3)](..._0x26f666);if(_0x26f666[_0x570c6d(0x1cf)]===0x0)break;const _0x52f142=_0x4aad0b[_0x570c6d(0x1b7)]?.[_0x570c6d(0x1bf)];if(_0x52f142!=null?_0x257b6f[_0x570c6d(0x1cf)]>=_0x52f142:_0x26f666[_0x570c6d(0x1cf)]<PAGE_SIZE)break;_0x280ff4++;}return _0x257b6f;}async function ensureSqlContent(_0x4e1625){const _0xe5dab8=a237_0x390a;if(_0x4e1625['sqlContent']!=null&&String(_0x4e1625['sqlContent'])[_0xe5dab8(0x1cf)]>0x0)return _0x4e1625;return getSqlQueryDetail(_0x4e1625[_0xe5dab8(0x1dd)]);}export const sqlPull={'service':'sql','command':'pull','description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a237_0x1d0ba9(0x1c9),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a237_0x1d0ba9(0x1da),'description':a237_0x1d0ba9(0x1b2)},{'name':a237_0x1d0ba9(0x1d9),'type':a237_0x1d0ba9(0x1b9),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x26e2d6){const _0x57a001=a237_0x1d0ba9,_0x482d89=loadSqlProjectConfig(_0x26e2d6[_0x57a001(0x1d6)]),_0x5e833b=await readSqlLockFile(_0x482d89[_0x57a001(0x1bb)]),{appLock:_0x1d6a5c}=ensureSqlLockScope(_0x5e833b??createEmptySqlLock(),_0x482d89[_0x57a001(0x1d6)],_0x482d89[_0x57a001(0x19c)],_0x57a001(0x1b3)),_0x1c6bda=await fetchAllSqlQueries(_0x26e2d6[_0x57a001(0x1d6)],{'sqlCode':_0x26e2d6[_0x57a001(0x19f)](_0x57a001(0x1be))||undefined,'sqlName':_0x26e2d6[_0x57a001(0x19f)](_0x57a001(0x1aa))||undefined}),_0x5c56eb=[];for(const _0x1e2754 of _0x1c6bda){const _0x271063=await ensureSqlContent(_0x1e2754),_0x11c4d4=ensureRemoteSqlContent(_0x271063),_0x4b4bad=detectSqlMode(_0x11c4d4),_0x1433fd=_0x271063[_0x57a001(0x1a9)]?await getDbName(_0x26e2d6['appCode'],Number(_0x271063[_0x57a001(0x1a9)]))[_0x57a001(0x1ca)](()=>undefined):undefined,_0x269764=buildLocalSqlFileContent({'sqlCode':_0x271063['sqlCode'],'sqlName':_0x271063[_0x57a001(0x1a8)],'dbId':_0x271063[_0x57a001(0x1a9)]},_0x11c4d4,{'dbName':_0x1433fd,'mode':_0x4b4bad,'syncedAt':new Date()[_0x57a001(0x1b8)](),'description':_0x271063[_0x57a001(0x19d)]}),_0x5b3993=buildSqlLockEntry(_0x271063,_0x11c4d4,'',{'dbName':_0x1433fd}),_0xe809f2=resolveLocalSqlFilePath(_0x482d89,_0x271063[_0x57a001(0x1dd)],_0x5b3993);let _0x2faf02='would_pull',_0x43f1c0;const _0x5399f2=await findExistingSqlFiles(_0x482d89,_0xe809f2,_0x4b4bad,_0x1d6a5c[_0x57a001(0x1a0)][_0x271063[_0x57a001(0x1dd)]]);if(_0x5399f2[_0x57a001(0x1cf)]>0x0){const _0x27c105=await compareExistingSqlFiles(_0x5399f2,_0x269764,_0x4b4bad);if(_0x27c105[_0x57a001(0x1a7)](({equivalent:_0x1128ea})=>!_0x1128ea))_0x2faf02=_0x57a001(0x1b1),_0x43f1c0=_0x57a001(0x19a);else _0x27c105[_0x57a001(0x1cf)]===0x1&&_0x27c105[0x0]?.['file'][_0x57a001(0x1d2)]&&(_0x2faf02=_0x57a001(0x1c4),_0x43f1c0=_0x57a001(0x1c6));}_0x5c56eb[_0x57a001(0x1c3)]({'sqlCode':_0x271063[_0x57a001(0x1dd)],'sqlName':_0x271063[_0x57a001(0x1a8)],'filePath':_0xe809f2,'status':_0x2faf02,'reason':_0x43f1c0});}return{'method':'POST','url':_0x57a001(0x1c1),'body':{'appCode':_0x26e2d6[_0x57a001(0x1d6)],'sqlCode':_0x26e2d6[_0x57a001(0x19f)]('sqlcode')||null,'sqlName':_0x26e2d6[_0x57a001(0x19f)](_0x57a001(0x1aa))||null,'files':_0x5c56eb},'description':'Would\x20pull\x20'+_0x5c56eb[_0x57a001(0x1cf)]+_0x57a001(0x1bc)+_0x482d89[_0x57a001(0x1b5)]};},async 'execute'(_0x1993d6){const _0x3c8e16=a237_0x1d0ba9,_0x30797a=loadSqlProjectConfig(_0x1993d6[_0x3c8e16(0x1d6)]),_0x347672=await readSqlLockFile(_0x30797a[_0x3c8e16(0x1bb)]),{lockData:_0x281e04,appLock:_0x1a03d3}=ensureSqlLockScope(_0x347672??createEmptySqlLock(),_0x30797a['appCode'],_0x30797a[_0x3c8e16(0x19c)],'pull'),_0x295d97=_0x1993d6[_0x3c8e16(0x1cc)](_0x3c8e16(0x1d9)),_0x2e1596=await fetchAllSqlQueries(_0x1993d6[_0x3c8e16(0x1d6)],{'sqlCode':_0x1993d6[_0x3c8e16(0x19f)](_0x3c8e16(0x1be))||undefined,'sqlName':_0x1993d6['str'](_0x3c8e16(0x1aa))||undefined});if(_0x2e1596[_0x3c8e16(0x1cf)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x3c8e16(0x199)};const _0x51b6fe=[],_0x4906a8=[];for(const _0x16dc07 of _0x2e1596){try{_0x51b6fe[_0x3c8e16(0x1c3)](await ensureSqlContent(_0x16dc07));}catch(_0x2b52d4){_0x4906a8[_0x3c8e16(0x1c3)]({'sqlCode':_0x16dc07['sqlCode'],'error':_0x2b52d4 instanceof Error?_0x2b52d4['message']:String(_0x2b52d4)});}}if(_0x295d97&&!_0x1993d6[_0x3c8e16(0x1d8)]){let _0x14ce89=![];for(const _0x979f14 of _0x51b6fe){const _0x5a2047=detectSqlMode(ensureRemoteSqlContent(_0x979f14)),_0x54cd6a=_0x979f14[_0x3c8e16(0x1a9)]?await getDbName(_0x1993d6[_0x3c8e16(0x1d6)],Number(_0x979f14[_0x3c8e16(0x1a9)]))[_0x3c8e16(0x1ca)](()=>undefined):undefined,_0x5c7717=buildLocalSqlFileContent({'sqlCode':_0x979f14[_0x3c8e16(0x1dd)],'sqlName':_0x979f14['sqlName'],'dbId':_0x979f14[_0x3c8e16(0x1a9)]},ensureRemoteSqlContent(_0x979f14),{'dbName':_0x54cd6a,'mode':_0x5a2047,'syncedAt':new Date()[_0x3c8e16(0x1b8)](),'description':_0x979f14[_0x3c8e16(0x19d)]}),_0x928fb2=resolveLocalSqlFilePath(_0x30797a,_0x979f14[_0x3c8e16(0x1dd)],buildSqlLockEntry(_0x979f14,ensureRemoteSqlContent(_0x979f14),'',{'dbName':_0x54cd6a})),_0x18a777=await findExistingSqlFiles(_0x30797a,_0x928fb2,_0x5a2047,_0x1a03d3['sqls'][_0x979f14[_0x3c8e16(0x1dd)]]),_0x2e719a=await compareExistingSqlFiles(_0x18a777,_0x5c7717,_0x5a2047);if(_0x2e719a[_0x3c8e16(0x1a7)](({equivalent:_0x10e03b})=>!_0x10e03b)){_0x14ce89=!![];break;}}if(_0x14ce89){const _0x4305f4=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x4305f4)throw CliErrors[_0x3c8e16(0x1ad)](_0x3c8e16(0x1a5));}}const _0x411755=cloneSqlLockData(_0x281e04),_0x1e8c48=_0x411755[_0x3c8e16(0x1c5)][_0x30797a[_0x3c8e16(0x1d6)]],_0x26513d=[],_0x5b703d=[];for(const _0x1e2fda of _0x51b6fe){const _0x2fcb1e=_0x1e8c48[_0x3c8e16(0x1a0)][_0x1e2fda[_0x3c8e16(0x1dd)]],_0xed7047=ensureRemoteSqlContent(_0x1e2fda),_0x2a01c9=detectSqlMode(_0xed7047),_0x36e3e7=_0x1e2fda['dbId']?await getDbName(_0x1993d6[_0x3c8e16(0x1d6)],Number(_0x1e2fda[_0x3c8e16(0x1a9)]))[_0x3c8e16(0x1ca)](()=>undefined):undefined,_0x553aa8=buildLocalSqlFileContent({'sqlCode':_0x1e2fda[_0x3c8e16(0x1dd)],'sqlName':_0x1e2fda[_0x3c8e16(0x1a8)],'dbId':_0x1e2fda[_0x3c8e16(0x1a9)]},_0xed7047,{'dbName':_0x36e3e7,'mode':_0x2a01c9,'syncedAt':new Date()[_0x3c8e16(0x1b8)](),'description':_0x1e2fda[_0x3c8e16(0x19d)]}),_0x4792b2=buildSqlLockEntry(_0x1e2fda,_0xed7047,computeSqlContentHash(_0x553aa8),{'dbName':_0x36e3e7}),_0x1016f9=_0x4792b2[_0x3c8e16(0x1cb)],_0x420dc7=join(_0x30797a[_0x3c8e16(0x1b5)],_0x1016f9);try{const _0x50e7ae=await findExistingSqlFiles(_0x30797a,_0x420dc7,_0x2a01c9,_0x2fcb1e),_0x3f4e6f=await compareExistingSqlFiles(_0x50e7ae,_0x553aa8,_0x2a01c9);if(!_0x295d97&&_0x3f4e6f['some'](({equivalent:_0x255aa4})=>!_0x255aa4)){_0x5b703d[_0x3c8e16(0x1c3)]({'sqlCode':_0x1e2fda[_0x3c8e16(0x1dd)],'reason':_0x3c8e16(0x1c8)});continue;}const _0x2e4747=_0x3f4e6f[_0x3c8e16(0x1b4)](({file:_0x5a314f})=>_0x5a314f[_0x3c8e16(0x1d2)]),_0x43fbb3=_0x3f4e6f[_0x3c8e16(0x1b4)](({file:_0x5dde29})=>!_0x5dde29['isCanonical']);if(_0x2e4747?.['equivalent']&&!_0x43fbb3){_0x5b703d[_0x3c8e16(0x1c3)]({'sqlCode':_0x1e2fda[_0x3c8e16(0x1dd)],'reason':_0x3c8e16(0x1c6)}),_0x1e8c48[_0x3c8e16(0x1a0)][_0x1e2fda[_0x3c8e16(0x1dd)]]={..._0x4792b2,'hash':computeSqlContentHash(_0x2e4747[_0x3c8e16(0x1ab)]),'path':_0x1016f9};continue;}!_0x2e4747?.['equivalent']&&(await ensureParentDirectory(_0x420dc7),await writeFile(_0x420dc7,_0x553aa8,_0x3c8e16(0x1a2))),_0x43fbb3&&await rm(_0x43fbb3[_0x3c8e16(0x1dc)][_0x3c8e16(0x1af)],{'force':!![]}),_0x1e8c48[_0x3c8e16(0x1a0)][_0x1e2fda[_0x3c8e16(0x1dd)]]={..._0x4792b2,'hash':_0x2e4747?.[_0x3c8e16(0x1ac)]?computeSqlContentHash(_0x2e4747[_0x3c8e16(0x1ab)]):_0x4792b2[_0x3c8e16(0x1b6)],'path':_0x1016f9},_0x26513d[_0x3c8e16(0x1c3)]({'sqlCode':_0x1e2fda[_0x3c8e16(0x1dd)],'filePath':_0x420dc7});}catch(_0x47ac9d){_0x4906a8[_0x3c8e16(0x1c3)]({'sqlCode':_0x1e2fda[_0x3c8e16(0x1dd)],'error':_0x47ac9d instanceof Error?_0x47ac9d[_0x3c8e16(0x1d5)]:String(_0x47ac9d)});}}return _0x1e8c48[_0x3c8e16(0x1cd)]=new Date()[_0x3c8e16(0x1b8)](),await writeSqlLockFile(_0x30797a[_0x3c8e16(0x1bb)],_0x411755),{'ok':_0x4906a8[_0x3c8e16(0x1cf)]===0x0,'data':{'pulled':_0x26513d,'skipped':_0x5b703d,'failed':_0x4906a8},'message':_0x3c8e16(0x1ba)+_0x26513d[_0x3c8e16(0x1cf)]+_0x3c8e16(0x1ce)+_0x5b703d[_0x3c8e16(0x1cf)]+'\x20skipped,\x20'+_0x4906a8['length']+_0x3c8e16(0x1c7)};}};function isEquivalentPulledSqlFile(_0x353ff4,_0xb38d0c,_0x3ca1af,_0x66ad5d){if(_0x3ca1af!==_0x66ad5d)return normalizePulledSqlBody(_0x353ff4,_0x3ca1af)===normalizePulledSqlBody(_0xb38d0c,_0x66ad5d);return normalizePullComparableContent(_0x353ff4,_0x3ca1af)===normalizePullComparableContent(_0xb38d0c,_0x66ad5d);}function a237_0x4ec1(){const _0x174f74=['equivalent','cancelled','8zPBopI','filePath','map','conflict','Filter\x20by\x20SQL\x20display\x20name','pull','find','sqlRootDir','hash','paging','toISOString','boolean','Pull\x20complete:\x20','lockFilePath','\x20SQL\x20file(s)\x20into\x20','test','sqlcode','totalCount','mybatisXml','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','mode','push','skipped','apps','unchanged','\x20failed','local\x20differs\x20from\x20remote','read','catch','path','bool','lastSync','\x20written,\x20','length','3061668HQvcwZ','56640cymOZi','isCanonical','525xvvcfZ','8733160OwESpf','message','appCode','22400334FEMvLl','nonInteractive','force','string','split','file','sqlCode','2562875zdnJJC','32908KrVjJQ','endsWith','No\x20remote\x20SQL\x20queries\x20matched.','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','.xml','sqlRoot','description','filter','str','sqls','replace','utf8','trim','toLowerCase','Force\x20pull\x20cancelled.','767103oNWHBh','some','sqlName','dbId','name','content'];a237_0x4ec1=function(){return _0x174f74;};return a237_0x4ec1();}async function findExistingSqlFiles(_0x392402,_0x5bf1ad,_0x41ff36,_0x4a83ae){const _0x1cea9e=a237_0x1d0ba9,_0x226dae=[];await fileExists(_0x5bf1ad)&&_0x226dae[_0x1cea9e(0x1c3)]({'filePath':_0x5bf1ad,'mode':_0x41ff36,'isCanonical':!![]});if(!_0x4a83ae?.['path'])return _0x226dae;const _0x2d466d=join(_0x392402['sqlRootDir'],_0x4a83ae[_0x1cea9e(0x1cb)]);if(_0x2d466d===_0x5bf1ad)return _0x226dae;return await fileExists(_0x2d466d)&&_0x226dae['push']({'filePath':_0x2d466d,'mode':_0x4a83ae[_0x1cea9e(0x1c2)]??modeFromFilePath(_0x2d466d),'isCanonical':![]}),_0x226dae;}async function compareExistingSqlFiles(_0x40efde,_0x530664,_0x2b6c02){const _0x544f75=a237_0x1d0ba9;return Promise['all'](_0x40efde[_0x544f75(0x1b0)](async _0x37b4d9=>{const _0x1e356d=_0x544f75,_0x301eae=await readFile(_0x37b4d9[_0x1e356d(0x1af)],_0x1e356d(0x1a2));return{'file':_0x37b4d9,'content':_0x301eae,'equivalent':isEquivalentPulledSqlFile(_0x301eae,_0x530664,_0x37b4d9['mode'],_0x2b6c02)};}));}function modeFromFilePath(_0xc56807){const _0x5263f6=a237_0x1d0ba9;return _0xc56807[_0x5263f6(0x1a4)]()[_0x5263f6(0x198)](_0x5263f6(0x19b))?'mybatisXml':'sql';}function normalizePulledSqlBody(_0xacf3f6,_0x22bf9f){const _0x345c6c=a237_0x1d0ba9;return stripLocalSqlMetadata(_0xacf3f6,_0x22bf9f)[_0x345c6c(0x1a1)](/\r\n/g,'\x0a')[_0x345c6c(0x1a3)]();}function normalizePullComparableContent(_0x54f80,_0x1f9dd3){const _0x511af2=a237_0x1d0ba9,_0x4d1817=_0x54f80['replace'](/\r\n/g,'\x0a')[_0x511af2(0x1db)]('\x0a'),_0x21d349=_0x4d1817[_0x511af2(0x19e)](_0x30fbbe=>!isSyncedAtMetadataLine(_0x30fbbe,_0x1f9dd3));return _0x21d349['join']('\x0a');}function isSyncedAtMetadataLine(_0x2cf4ba,_0x2bd1fa){const _0x381d91=a237_0x1d0ba9;if(_0x2bd1fa===_0x381d91(0x1c0))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x2cf4ba);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x381d91(0x1bd)](_0x2cf4ba);}
1
+ const a242_0x78035e=a242_0x3989;(function(_0x1ce0bf,_0x1a54d9){const _0x2f1838=a242_0x3989,_0x5712cb=_0x1ce0bf();while(!![]){try{const _0x3f5dc5=-parseInt(_0x2f1838(0x106))/0x1+-parseInt(_0x2f1838(0x149))/0x2+-parseInt(_0x2f1838(0x117))/0x3*(parseInt(_0x2f1838(0x108))/0x4)+parseInt(_0x2f1838(0x104))/0x5+-parseInt(_0x2f1838(0x136))/0x6+parseInt(_0x2f1838(0x107))/0x7*(parseInt(_0x2f1838(0x122))/0x8)+parseInt(_0x2f1838(0x10f))/0x9;if(_0x3f5dc5===_0x1a54d9)break;else _0x5712cb['push'](_0x5712cb['shift']());}catch(_0x4b70d0){_0x5712cb['push'](_0x5712cb['shift']());}}}(a242_0x4808,0x69f68));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a242_0x3989(_0x6c24c,_0x111de7){_0x6c24c=_0x6c24c-0xfe;const _0x480865=a242_0x4808();let _0x3989ad=_0x480865[_0x6c24c];return _0x3989ad;}import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';function a242_0x4808(){const _0x3082a5=['sql','578930utAmMy','sqlcode','pull','description','join','force','\x20written,\x20','369635ghyoeb','all','468083flnsfw','1456623yoifej','52jwWfHT','catch','filePath','\x20SQL\x20file(s)\x20into\x20','local\x20differs\x20from\x20remote','path','lastSync','12621465wzVmOs','file','name','sqls','Force\x20pull\x20cancelled.','No\x20remote\x20SQL\x20queries\x20matched.','endsWith','\x20skipped,\x20','64041UhZfzL','test','unchanged','isCanonical','appCode','mode','sqlContent','boolean','push','find','toLowerCase','8gnlqVi','length','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','str','nonInteractive','sqlCode','split','sqlName','mybatisXml','some','cancelled','Would\x20pull\x20','string','replace','tableData','sqlRoot','lockFilePath','conflict','hash','dbId','1291908jqUdwc','toISOString','equivalent','.xml','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','skipped','Pull\x20complete:\x20','paging','message','map','Force\x20overwrite\x20local\x20unsynced\x20changes','apps','filter','bool','Filter\x20by\x20SQL\x20display\x20name','\x20failed','would_pull','sqlRootDir'];a242_0x4808=function(){return _0x3082a5;};return a242_0x4808();}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(_0x674418,_0x87be45){const _0x3889e9=a242_0x3989,_0x5a1c2f=[];let _0x5e240b=0x1;while(!![]){const _0x2c92bc=await listSqlQueries(_0x674418,{'currentPage':_0x5e240b,'pageSize':PAGE_SIZE,'sqlCode':_0x87be45[_0x3889e9(0x127)],'sqlName':_0x87be45['sqlName']}),_0x2f5295=_0x2c92bc[_0x3889e9(0x130)]??[];_0x5a1c2f[_0x3889e9(0x11f)](..._0x2f5295);if(_0x2f5295[_0x3889e9(0x123)]===0x0)break;const _0x3905cb=_0x2c92bc[_0x3889e9(0x13d)]?.['totalCount'];if(_0x3905cb!=null?_0x5a1c2f['length']>=_0x3905cb:_0x2f5295['length']<PAGE_SIZE)break;_0x5e240b++;}return _0x5a1c2f;}async function ensureSqlContent(_0x27bf62){const _0x3cab7e=a242_0x3989;if(_0x27bf62['sqlContent']!=null&&String(_0x27bf62[_0x3cab7e(0x11d)])['length']>0x0)return _0x27bf62;return getSqlQueryDetail(_0x27bf62['sqlCode']);}export const sqlPull={'service':a242_0x78035e(0x148),'command':a242_0x78035e(0xff),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a242_0x78035e(0x12e),'description':a242_0x78035e(0x144)},{'name':a242_0x78035e(0x102),'type':a242_0x78035e(0x11e),'description':a242_0x78035e(0x140)}],async 'dryRun'(_0x1bf746){const _0x39df32=a242_0x78035e,_0x2b05fd=loadSqlProjectConfig(_0x1bf746[_0x39df32(0x11b)]),_0x5e135b=await readSqlLockFile(_0x2b05fd[_0x39df32(0x132)]),{appLock:_0x2e0740}=ensureSqlLockScope(_0x5e135b??createEmptySqlLock(),_0x2b05fd[_0x39df32(0x11b)],_0x2b05fd[_0x39df32(0x131)],'pull'),_0x48df14=await fetchAllSqlQueries(_0x1bf746[_0x39df32(0x11b)],{'sqlCode':_0x1bf746['str'](_0x39df32(0xfe))||undefined,'sqlName':_0x1bf746[_0x39df32(0x125)](_0x39df32(0x111))||undefined}),_0x1e93a2=[];for(const _0x4012d3 of _0x48df14){const _0x161ea3=await ensureSqlContent(_0x4012d3),_0x12c60b=ensureRemoteSqlContent(_0x161ea3),_0x57553f=detectSqlMode(_0x12c60b),_0x250677=_0x161ea3[_0x39df32(0x135)]?await getDbName(_0x1bf746[_0x39df32(0x11b)],Number(_0x161ea3['dbId']))[_0x39df32(0x109)](()=>undefined):undefined,_0x376357=buildLocalSqlFileContent({'sqlCode':_0x161ea3[_0x39df32(0x127)],'sqlName':_0x161ea3[_0x39df32(0x129)],'dbId':_0x161ea3[_0x39df32(0x135)]},_0x12c60b,{'dbName':_0x250677,'mode':_0x57553f,'syncedAt':new Date()[_0x39df32(0x137)](),'description':_0x161ea3[_0x39df32(0x100)]}),_0x54108f=buildSqlLockEntry(_0x161ea3,_0x12c60b,'',{'dbName':_0x250677}),_0x31c02b=resolveLocalSqlFilePath(_0x2b05fd,_0x161ea3[_0x39df32(0x127)],_0x54108f);let _0x5ddbb5=_0x39df32(0x146),_0x33a803;const _0x3d462c=await findExistingSqlFiles(_0x2b05fd,_0x31c02b,_0x57553f,_0x2e0740[_0x39df32(0x112)][_0x161ea3[_0x39df32(0x127)]]);if(_0x3d462c[_0x39df32(0x123)]>0x0){const _0x1f1c09=await compareExistingSqlFiles(_0x3d462c,_0x376357,_0x57553f);if(_0x1f1c09['some'](({equivalent:_0x354b5d})=>!_0x354b5d))_0x5ddbb5=_0x39df32(0x133),_0x33a803='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)';else _0x1f1c09['length']===0x1&&_0x1f1c09[0x0]?.[_0x39df32(0x110)][_0x39df32(0x11a)]&&(_0x5ddbb5=_0x39df32(0x13b),_0x33a803=_0x39df32(0x119));}_0x1e93a2[_0x39df32(0x11f)]({'sqlCode':_0x161ea3['sqlCode'],'sqlName':_0x161ea3[_0x39df32(0x129)],'filePath':_0x31c02b,'status':_0x5ddbb5,'reason':_0x33a803});}return{'method':'POST','url':_0x39df32(0x124),'body':{'appCode':_0x1bf746[_0x39df32(0x11b)],'sqlCode':_0x1bf746[_0x39df32(0x125)](_0x39df32(0xfe))||null,'sqlName':_0x1bf746[_0x39df32(0x125)]('name')||null,'files':_0x1e93a2},'description':_0x39df32(0x12d)+_0x1e93a2[_0x39df32(0x123)]+_0x39df32(0x10b)+_0x2b05fd[_0x39df32(0x147)]};},async 'execute'(_0x57c76f){const _0xd49005=a242_0x78035e,_0xed97bb=loadSqlProjectConfig(_0x57c76f[_0xd49005(0x11b)]),_0x4e2523=await readSqlLockFile(_0xed97bb['lockFilePath']),{lockData:_0x5343a6,appLock:_0x49b4e8}=ensureSqlLockScope(_0x4e2523??createEmptySqlLock(),_0xed97bb['appCode'],_0xed97bb['sqlRoot'],'pull'),_0x446644=_0x57c76f[_0xd49005(0x143)](_0xd49005(0x102)),_0x313456=await fetchAllSqlQueries(_0x57c76f[_0xd49005(0x11b)],{'sqlCode':_0x57c76f[_0xd49005(0x125)]('sqlcode')||undefined,'sqlName':_0x57c76f[_0xd49005(0x125)](_0xd49005(0x111))||undefined});if(_0x313456[_0xd49005(0x123)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0xd49005(0x114)};const _0x59568b=[],_0x39bfe6=[];for(const _0x2b87af of _0x313456){try{_0x59568b[_0xd49005(0x11f)](await ensureSqlContent(_0x2b87af));}catch(_0x350edd){_0x39bfe6[_0xd49005(0x11f)]({'sqlCode':_0x2b87af['sqlCode'],'error':_0x350edd instanceof Error?_0x350edd[_0xd49005(0x13e)]:String(_0x350edd)});}}if(_0x446644&&!_0x57c76f[_0xd49005(0x126)]){let _0x4e019f=![];for(const _0x370be4 of _0x59568b){const _0x558a7f=detectSqlMode(ensureRemoteSqlContent(_0x370be4)),_0x544fa8=_0x370be4[_0xd49005(0x135)]?await getDbName(_0x57c76f[_0xd49005(0x11b)],Number(_0x370be4['dbId']))[_0xd49005(0x109)](()=>undefined):undefined,_0x4a5e62=buildLocalSqlFileContent({'sqlCode':_0x370be4[_0xd49005(0x127)],'sqlName':_0x370be4[_0xd49005(0x129)],'dbId':_0x370be4['dbId']},ensureRemoteSqlContent(_0x370be4),{'dbName':_0x544fa8,'mode':_0x558a7f,'syncedAt':new Date()[_0xd49005(0x137)](),'description':_0x370be4[_0xd49005(0x100)]}),_0x128782=resolveLocalSqlFilePath(_0xed97bb,_0x370be4[_0xd49005(0x127)],buildSqlLockEntry(_0x370be4,ensureRemoteSqlContent(_0x370be4),'',{'dbName':_0x544fa8})),_0x1348f4=await findExistingSqlFiles(_0xed97bb,_0x128782,_0x558a7f,_0x49b4e8[_0xd49005(0x112)][_0x370be4[_0xd49005(0x127)]]),_0x125683=await compareExistingSqlFiles(_0x1348f4,_0x4a5e62,_0x558a7f);if(_0x125683[_0xd49005(0x12b)](({equivalent:_0x3ab866})=>!_0x3ab866)){_0x4e019f=!![];break;}}if(_0x4e019f){const _0x54b712=await confirmForceOverwrite(_0xd49005(0x13a));if(!_0x54b712)throw CliErrors[_0xd49005(0x12c)](_0xd49005(0x113));}}const _0xdc1a0e=cloneSqlLockData(_0x5343a6),_0xa3dac8=_0xdc1a0e[_0xd49005(0x141)][_0xed97bb[_0xd49005(0x11b)]],_0x245756=[],_0x531bc6=[];for(const _0xa7b8e2 of _0x59568b){const _0x230cb1=_0xa3dac8[_0xd49005(0x112)][_0xa7b8e2['sqlCode']],_0x1d3b6c=ensureRemoteSqlContent(_0xa7b8e2),_0x37b9a5=detectSqlMode(_0x1d3b6c),_0x373cc9=_0xa7b8e2[_0xd49005(0x135)]?await getDbName(_0x57c76f[_0xd49005(0x11b)],Number(_0xa7b8e2['dbId']))[_0xd49005(0x109)](()=>undefined):undefined,_0x3f9e5c=buildLocalSqlFileContent({'sqlCode':_0xa7b8e2[_0xd49005(0x127)],'sqlName':_0xa7b8e2[_0xd49005(0x129)],'dbId':_0xa7b8e2[_0xd49005(0x135)]},_0x1d3b6c,{'dbName':_0x373cc9,'mode':_0x37b9a5,'syncedAt':new Date()[_0xd49005(0x137)](),'description':_0xa7b8e2[_0xd49005(0x100)]}),_0x5ba94f=buildSqlLockEntry(_0xa7b8e2,_0x1d3b6c,computeSqlContentHash(_0x3f9e5c),{'dbName':_0x373cc9}),_0x34bbc4=_0x5ba94f[_0xd49005(0x10d)],_0x4e8de2=join(_0xed97bb[_0xd49005(0x147)],_0x34bbc4);try{const _0x1fe373=await findExistingSqlFiles(_0xed97bb,_0x4e8de2,_0x37b9a5,_0x230cb1),_0x5f31d2=await compareExistingSqlFiles(_0x1fe373,_0x3f9e5c,_0x37b9a5);if(!_0x446644&&_0x5f31d2[_0xd49005(0x12b)](({equivalent:_0x35619c})=>!_0x35619c)){_0x531bc6[_0xd49005(0x11f)]({'sqlCode':_0xa7b8e2[_0xd49005(0x127)],'reason':_0xd49005(0x10c)});continue;}const _0x30df16=_0x5f31d2['find'](({file:_0x2e610a})=>_0x2e610a[_0xd49005(0x11a)]),_0x5605cd=_0x5f31d2[_0xd49005(0x120)](({file:_0xbe6ca0})=>!_0xbe6ca0[_0xd49005(0x11a)]);if(_0x30df16?.[_0xd49005(0x138)]&&!_0x5605cd){_0x531bc6[_0xd49005(0x11f)]({'sqlCode':_0xa7b8e2[_0xd49005(0x127)],'reason':_0xd49005(0x119)}),_0xa3dac8[_0xd49005(0x112)][_0xa7b8e2[_0xd49005(0x127)]]={..._0x5ba94f,'hash':computeSqlContentHash(_0x30df16['content']),'path':_0x34bbc4};continue;}!_0x30df16?.[_0xd49005(0x138)]&&(await ensureParentDirectory(_0x4e8de2),await writeFile(_0x4e8de2,_0x3f9e5c,'utf8')),_0x5605cd&&await rm(_0x5605cd[_0xd49005(0x110)][_0xd49005(0x10a)],{'force':!![]}),_0xa3dac8[_0xd49005(0x112)][_0xa7b8e2[_0xd49005(0x127)]]={..._0x5ba94f,'hash':_0x30df16?.[_0xd49005(0x138)]?computeSqlContentHash(_0x30df16['content']):_0x5ba94f[_0xd49005(0x134)],'path':_0x34bbc4},_0x245756[_0xd49005(0x11f)]({'sqlCode':_0xa7b8e2[_0xd49005(0x127)],'filePath':_0x4e8de2});}catch(_0x25a236){_0x39bfe6[_0xd49005(0x11f)]({'sqlCode':_0xa7b8e2[_0xd49005(0x127)],'error':_0x25a236 instanceof Error?_0x25a236['message']:String(_0x25a236)});}}return _0xa3dac8[_0xd49005(0x10e)]=new Date()[_0xd49005(0x137)](),await writeSqlLockFile(_0xed97bb[_0xd49005(0x132)],_0xdc1a0e),{'ok':_0x39bfe6[_0xd49005(0x123)]===0x0,'data':{'pulled':_0x245756,'skipped':_0x531bc6,'failed':_0x39bfe6},'message':_0xd49005(0x13c)+_0x245756['length']+_0xd49005(0x103)+_0x531bc6[_0xd49005(0x123)]+_0xd49005(0x116)+_0x39bfe6['length']+_0xd49005(0x145)};}};function isEquivalentPulledSqlFile(_0xda995c,_0xed7044,_0x2f4fe3,_0xe2314){if(_0x2f4fe3!==_0xe2314)return normalizePulledSqlBody(_0xda995c,_0x2f4fe3)===normalizePulledSqlBody(_0xed7044,_0xe2314);return normalizePullComparableContent(_0xda995c,_0x2f4fe3)===normalizePullComparableContent(_0xed7044,_0xe2314);}async function findExistingSqlFiles(_0x446c3e,_0x3557b7,_0x1e4afe,_0x3cb681){const _0x39dac6=a242_0x78035e,_0x3f917e=[];await fileExists(_0x3557b7)&&_0x3f917e[_0x39dac6(0x11f)]({'filePath':_0x3557b7,'mode':_0x1e4afe,'isCanonical':!![]});if(!_0x3cb681?.[_0x39dac6(0x10d)])return _0x3f917e;const _0x163e67=join(_0x446c3e[_0x39dac6(0x147)],_0x3cb681[_0x39dac6(0x10d)]);if(_0x163e67===_0x3557b7)return _0x3f917e;return await fileExists(_0x163e67)&&_0x3f917e[_0x39dac6(0x11f)]({'filePath':_0x163e67,'mode':_0x3cb681['mode']??modeFromFilePath(_0x163e67),'isCanonical':![]}),_0x3f917e;}async function compareExistingSqlFiles(_0x293b54,_0xe59c24,_0x5ec318){const _0x5bcf4d=a242_0x78035e;return Promise[_0x5bcf4d(0x105)](_0x293b54[_0x5bcf4d(0x13f)](async _0x23fe67=>{const _0x28883a=_0x5bcf4d,_0x31232b=await readFile(_0x23fe67[_0x28883a(0x10a)],'utf8');return{'file':_0x23fe67,'content':_0x31232b,'equivalent':isEquivalentPulledSqlFile(_0x31232b,_0xe59c24,_0x23fe67[_0x28883a(0x11c)],_0x5ec318)};}));}function modeFromFilePath(_0x40dec5){const _0xc17569=a242_0x78035e;return _0x40dec5[_0xc17569(0x121)]()[_0xc17569(0x115)](_0xc17569(0x139))?_0xc17569(0x12a):'sql';}function normalizePulledSqlBody(_0xf1638e,_0x14f782){return stripLocalSqlMetadata(_0xf1638e,_0x14f782)['replace'](/\r\n/g,'\x0a')['trim']();}function normalizePullComparableContent(_0x4d8372,_0x2c7f7e){const _0x3a9d60=a242_0x78035e,_0x3dec44=_0x4d8372[_0x3a9d60(0x12f)](/\r\n/g,'\x0a')[_0x3a9d60(0x128)]('\x0a'),_0x34fdea=_0x3dec44[_0x3a9d60(0x142)](_0x19ad94=>!isSyncedAtMetadataLine(_0x19ad94,_0x2c7f7e));return _0x34fdea[_0x3a9d60(0x101)]('\x0a');}function isSyncedAtMetadataLine(_0x26d12c,_0x139940){const _0x1feb58=a242_0x78035e;if(_0x139940===_0x1feb58(0x12a))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x1feb58(0x118)](_0x26d12c);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x1feb58(0x118)](_0x26d12c);}
@@ -1 +1 @@
1
- const a238_0x4d4323=a238_0x54d3;(function(_0x159241,_0x20315b){const _0x2b7fbe=a238_0x54d3,_0x4135ad=_0x159241();while(!![]){try{const _0x202bc3=-parseInt(_0x2b7fbe(0x1dd))/0x1+parseInt(_0x2b7fbe(0x1b0))/0x2+parseInt(_0x2b7fbe(0x1d8))/0x3*(-parseInt(_0x2b7fbe(0x1c9))/0x4)+-parseInt(_0x2b7fbe(0x1b5))/0x5*(-parseInt(_0x2b7fbe(0x1b7))/0x6)+-parseInt(_0x2b7fbe(0x1c8))/0x7+parseInt(_0x2b7fbe(0x1be))/0x8*(-parseInt(_0x2b7fbe(0x1d2))/0x9)+parseInt(_0x2b7fbe(0x1cb))/0xa*(parseInt(_0x2b7fbe(0x1bd))/0xb);if(_0x202bc3===_0x20315b)break;else _0x4135ad['push'](_0x4135ad['shift']());}catch(_0x5a5a51){_0x4135ad['push'](_0x4135ad['shift']());}}}(a238_0x2043,0x1ab67));function a238_0x54d3(_0x386e30,_0x51723e){_0x386e30=_0x386e30-0x1ad;const _0x2043ce=a238_0x2043();let _0x54d3b6=_0x2043ce[_0x386e30];return _0x54d3b6;}import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';function a238_0x2043(){const _0x28ca2a=['73910qmIgjc','has','mode','dbId','\x20failed','29385ZGcAdU','unchanged','12DUEtYc','set','hash','map','dbName','No\x20local\x20SQL\x20files\x20found.','4168637FLVBHV','1002440lDKAzn','validation','remoteId','path','catch','sqlRootDir','sqlCode','No\x20database\x20matches\x20local\x20directory\x20\x22','\x20skipped,\x20','isFinite','51779ZFxiVX','20NkhUkc','force','10CBURgB','sqlName','write','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','lastSync','9cwSdsH','join','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','sqlcode','replace','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','3459WTftbD','sql',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','length','version','179794HEFquZ','sqls','trim',':\x20SQL\x20content\x20is\x20empty.','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','relativePath','filePath','boolean','push','utf8','filter','lockFilePath','dbDirectory','Push\x20local\x20SQL\x20files\x20to\x20remote','appCode','Local\x20SQL\x20not\x20found:\x20','sqlRoot','get','\x20SQL\x20file(s)','\x20pushed,\x20','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','toISOString','projectRoot','bool','trashDir','startsWith'];a238_0x2043=function(){return _0x28ca2a;};return a238_0x2043();}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(_0x5486ac){const _0x420147=a238_0x54d3,_0x2f2dfd=stripLocalSqlMetadata(await readFile(_0x5486ac[_0x420147(0x1e3)],_0x420147(0x1e6)),_0x5486ac[_0x420147(0x1b2)]);if(!_0x2f2dfd[_0x420147(0x1df)]())throw CliErrors[_0x420147(0x1bf)](_0x5486ac[_0x420147(0x1c4)]+_0x420147(0x1e0));return _0x2f2dfd;}async function getTargetSqlQueries(_0x97f7a4,_0x2ef73f,_0x1610f1){const _0x9fbb39=a238_0x54d3,_0xfad63b=await scanLocalSqlQueries(_0x97f7a4),_0x50278c=new Map();for(const _0x566ac5 of _0xfad63b){if(_0x1610f1&&_0x566ac5['sqlCode']!==_0x1610f1)continue;const _0xbcb22c=_0x50278c[_0x9fbb39(0x1ee)](_0x566ac5['sqlCode'])??[];_0xbcb22c['push'](_0x566ac5),_0x50278c[_0x9fbb39(0x1b8)](_0x566ac5[_0x9fbb39(0x1c4)],_0xbcb22c);}if(_0x1610f1&&!_0x50278c[_0x9fbb39(0x1b1)](_0x1610f1))throw CliErrors[_0x9fbb39(0x1bf)](_0x9fbb39(0x1ec)+_0x1610f1);const _0x474b32=[];for(const [_0x4923f3,_0x4ab647]of _0x50278c['entries']()){if(_0x4ab647[_0x9fbb39(0x1db)]===0x1){_0x474b32['push'](_0x4ab647[0x0]);continue;}const _0x65bbf9=_0x2ef73f['sqls'][_0x4923f3],_0x136dd7=_0x65bbf9?.[_0x9fbb39(0x1c1)],_0x4a7285=_0x136dd7?_0x4ab647[_0x9fbb39(0x1e7)](_0x20092c=>_0x20092c[_0x9fbb39(0x1e2)]!==_0x136dd7):_0x4ab647;if(_0x65bbf9&&_0x4a7285[_0x9fbb39(0x1db)]===0x1){_0x474b32[_0x9fbb39(0x1e5)](_0x4a7285[0x0]);continue;}throw CliErrors['validation'](_0x9fbb39(0x1ce)+_0x4923f3+_0x9fbb39(0x1d4));}return _0x474b32;}export const sqlPush={'service':a238_0x4d4323(0x1d9),'command':a238_0x4d4323(0x1e5),'description':a238_0x4d4323(0x1ea),'risk':a238_0x4d4323(0x1cd),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a238_0x4d4323(0x1ca),'type':a238_0x4d4323(0x1e4),'description':a238_0x4d4323(0x1f1)}],async 'dryRun'(_0x28b737){const _0x4e308a=a238_0x4d4323,_0x48b48a=loadSqlProjectConfig(_0x28b737[_0x4e308a(0x1eb)]),_0xe333ca=await readSqlLockFile(_0x48b48a['lockFilePath']),{appLock:_0x2e72bc}=ensureSqlLockScope(_0xe333ca??createEmptySqlLock(),_0x28b737[_0x4e308a(0x1eb)],_0x48b48a['sqlRoot'],_0x4e308a(0x1e5)),_0x5b8599=await getTargetSqlQueries(_0x48b48a,_0x2e72bc,_0x28b737['str']('sqlcode')||undefined),_0x124b01=[];for(const _0x380d33 of _0x5b8599){const _0x21f99a=await computeSqlFileHash(_0x380d33[_0x4e308a(0x1e3)]),_0xd8af9d=_0x2e72bc[_0x4e308a(0x1de)][_0x380d33[_0x4e308a(0x1c4)]],_0x555366=!!_0xd8af9d&&(_0xd8af9d[_0x4e308a(0x1c1)]!==_0x380d33[_0x4e308a(0x1e2)]||!!_0x380d33[_0x4e308a(0x1cc)]&&_0xd8af9d[_0x4e308a(0x1cc)]!==_0x380d33[_0x4e308a(0x1cc)]||_0xd8af9d[_0x4e308a(0x1b2)]!==_0x380d33['mode']);if(!_0x28b737[_0x4e308a(0x1ad)](_0x4e308a(0x1ca))&&_0xd8af9d&&_0xd8af9d[_0x4e308a(0x1b9)]===_0x21f99a&&!_0x555366)continue;if(!_0xd8af9d)throw CliErrors[_0x4e308a(0x1bf)](_0x380d33['sqlCode']+_0x4e308a(0x1da));if(_0xd8af9d[_0x4e308a(0x1dc)]==null)throw CliErrors[_0x4e308a(0x1bf)](_0x380d33[_0x4e308a(0x1c4)]+_0x4e308a(0x1cf));await resolveTargetDbBinding(_0x28b737[_0x4e308a(0x1eb)],_0x380d33,_0xd8af9d),await readSqlUploadContent(_0x380d33),_0x124b01[_0x4e308a(0x1e5)](_0x380d33[_0x4e308a(0x1c4)]);}return{'method':'POST','url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x124b01,'appCode':_0x28b737[_0x4e308a(0x1eb)]},'description':'Would\x20push\x20'+_0x124b01[_0x4e308a(0x1db)]+_0x4e308a(0x1ef)};},async 'execute'(_0x29c376){const _0x354b58=a238_0x4d4323,_0x4ec760=loadSqlProjectConfig(_0x29c376[_0x354b58(0x1eb)]),_0x51610a=await readSqlLockFile(_0x4ec760['lockFilePath']),{lockData:_0x1b9259,appLock:_0x32a159}=ensureSqlLockScope(_0x51610a??createEmptySqlLock(),_0x29c376[_0x354b58(0x1eb)],_0x4ec760[_0x354b58(0x1ed)],_0x354b58(0x1e5)),_0x23ed83=await getTargetSqlQueries(_0x4ec760,_0x32a159,_0x29c376['str'](_0x354b58(0x1d5))||undefined);if(_0x23ed83['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x354b58(0x1bc)};const _0xd8ae61=[],_0x540edc=[],_0x55384e=[];let _0x4a9be1=![];for(const _0x593fd7 of _0x23ed83){const _0x39ef91=_0x32a159[_0x354b58(0x1de)][_0x593fd7[_0x354b58(0x1c4)]];if(!_0x39ef91){_0x55384e[_0x354b58(0x1e5)]({'sqlCode':_0x593fd7[_0x354b58(0x1c4)],'error':_0x354b58(0x1d0)});continue;}try{const _0x3c4e19=await computeSqlFileHash(_0x593fd7[_0x354b58(0x1e3)]),_0x365bb1=_0x39ef91[_0x354b58(0x1c1)]!==_0x593fd7[_0x354b58(0x1e2)]||!!_0x593fd7[_0x354b58(0x1cc)]&&_0x39ef91[_0x354b58(0x1cc)]!==_0x593fd7[_0x354b58(0x1cc)]||_0x39ef91[_0x354b58(0x1b2)]!==_0x593fd7['mode'];if(!_0x29c376['bool'](_0x354b58(0x1ca))&&_0x39ef91[_0x354b58(0x1b9)]===_0x3c4e19&&!_0x365bb1){_0x540edc[_0x354b58(0x1e5)]({'sqlCode':_0x593fd7[_0x354b58(0x1c4)],'reason':_0x354b58(0x1b6)});continue;}if(_0x39ef91['version']==null){_0x55384e[_0x354b58(0x1e5)]({'sqlCode':_0x593fd7[_0x354b58(0x1c4)],'error':_0x354b58(0x1d7)});continue;}const _0x55cfa1=_0x593fd7[_0x354b58(0x1cc)]||_0x39ef91[_0x354b58(0x1cc)],_0x414b34=await resolveTargetDbBinding(_0x29c376['appCode'],_0x593fd7,_0x39ef91),_0x48e96d=await readSqlUploadContent(_0x593fd7),_0x86da4a=await updateSqlQuery({'id':_0x39ef91[_0x354b58(0x1c0)],'appCode':_0x29c376[_0x354b58(0x1eb)],'sqlCode':_0x593fd7[_0x354b58(0x1c4)],'sqlName':_0x55cfa1,'dbId':_0x414b34['dbId'],'version':_0x39ef91['version'],'sqlContent':_0x48e96d,'sqlConfig':_0x39ef91['sqlConfig']??undefined}),_0x1296fa=_0x86da4a[_0x354b58(0x1b3)]?await getDbName(_0x29c376[_0x354b58(0x1eb)],Number(_0x86da4a[_0x354b58(0x1b3)]))[_0x354b58(0x1c2)](()=>_0x414b34[_0x354b58(0x1bb)]):_0x414b34[_0x354b58(0x1bb)];_0x32a159['sqls'][_0x593fd7[_0x354b58(0x1c4)]]={...buildSqlLockEntry(_0x86da4a,_0x48e96d,_0x3c4e19,{'dbName':_0x1296fa}),'path':_0x593fd7[_0x354b58(0x1e2)],'mode':_0x593fd7['mode']},_0x4a9be1=!![],await archivePreviousSqlFileIfNeeded(_0x4ec760,_0x39ef91[_0x354b58(0x1c1)],_0x593fd7[_0x354b58(0x1e2)]),_0xd8ae61[_0x354b58(0x1e5)]({'sqlCode':_0x593fd7[_0x354b58(0x1c4)],'remoteId':_0x39ef91['remoteId']});}catch(_0x50dab5){_0x55384e[_0x354b58(0x1e5)]({'sqlCode':_0x593fd7[_0x354b58(0x1c4)],'error':_0x50dab5 instanceof Error?_0x50dab5['message']:String(_0x50dab5)});}}(_0x4a9be1||_0x55384e[_0x354b58(0x1db)]===0x0)&&(_0x32a159[_0x354b58(0x1d1)]=new Date()[_0x354b58(0x1f2)](),await writeSqlLockFile(_0x4ec760[_0x354b58(0x1e8)],_0x1b9259));const _0x2f72c5=_0x55384e[_0x354b58(0x1db)]===0x0;return{'ok':_0x2f72c5,'data':{'pushed':_0xd8ae61,'skipped':_0x540edc,'failed':_0x55384e},'message':'Push\x20complete:\x20'+_0xd8ae61[_0x354b58(0x1db)]+_0x354b58(0x1f0)+_0x540edc['length']+_0x354b58(0x1c6)+_0x55384e['length']+_0x354b58(0x1b4)};}};async function archivePreviousSqlFileIfNeeded(_0x2d8b7d,_0x51d270,_0x553a85){const _0x158240=a238_0x4d4323;if(!_0x51d270||_0x51d270===_0x553a85)return;const _0x49e252=join(_0x2d8b7d[_0x158240(0x1c3)],_0x51d270);if(!await fileExists(_0x49e252))return;const _0x43cab5=await moveToTrash(_0x2d8b7d[_0x158240(0x1f3)],_0x2d8b7d[_0x158240(0x1ae)],_0x49e252);await cleanupEmptyDirectories(dirname(_0x49e252),_0x2d8b7d[_0x158240(0x1c3)]),void _0x43cab5;}async function moveToTrash(_0x8bb851,_0x243592,_0x314d99){const _0x189861=a238_0x4d4323,_0x39cfeb=new Date()[_0x189861(0x1f2)]()[_0x189861(0x1d6)](/[:.]/g,'-'),_0x2fa2bb=relative(_0x8bb851,_0x314d99),_0x4ee9f5=join(_0x243592,_0x39cfeb,_0x2fa2bb);return await mkdir(dirname(_0x4ee9f5),{'recursive':!![]}),await rename(_0x314d99,_0x4ee9f5),_0x4ee9f5;}async function cleanupEmptyDirectories(_0x4ca392,_0x53e664){const _0x45e794=a238_0x4d4323;let _0x12fa8c=resolve(_0x4ca392);const _0x131691=resolve(_0x53e664);while(_0x12fa8c[_0x45e794(0x1af)](''+_0x131691+sep)||_0x12fa8c===_0x131691){if(_0x12fa8c===_0x131691)return;try{const _0x46ad49=await readdir(_0x12fa8c);if(_0x46ad49[_0x45e794(0x1db)]>0x0)return;await rmdir(_0x12fa8c);}catch{return;}_0x12fa8c=dirname(_0x12fa8c);}}async function resolveTargetDbBinding(_0x1facd5,_0x14f6ad,_0x359f06){const _0x1dfdec=a238_0x4d4323,_0x4905f4=_0x14f6ad[_0x1dfdec(0x1e9)];if(!_0x4905f4)return{'dbId':_0x359f06['dbId'],'dbName':_0x359f06[_0x1dfdec(0x1bb)]};const _0x3347ae=buildDbDirectoryName(_0x359f06[_0x1dfdec(0x1bb)],_0x359f06[_0x1dfdec(0x1b3)]);if(_0x4905f4===_0x3347ae)return{'dbId':_0x359f06['dbId'],'dbName':_0x359f06['dbName']};const _0x23a94e=parseExplicitDbDirectory(_0x4905f4);if(_0x23a94e!=null)return{'dbId':_0x23a94e,'dbName':await getDbName(_0x1facd5,_0x23a94e)[_0x1dfdec(0x1c2)](()=>undefined)};const _0x4ccb6b=await listDatabases(_0x1facd5),_0x32c8d8=_0x4ccb6b[_0x1dfdec(0x1e7)](_0x170a53=>buildDbDirectoryName(_0x170a53['dbName'],_0x170a53[_0x1dfdec(0x1b3)])===_0x4905f4);if(_0x32c8d8[_0x1dfdec(0x1db)]===0x1)return{'dbId':_0x32c8d8[0x0]['dbId'],'dbName':_0x32c8d8[0x0][_0x1dfdec(0x1bb)]};if(_0x32c8d8[_0x1dfdec(0x1db)]===0x0)throw CliErrors['validation'](_0x1dfdec(0x1c5)+_0x4905f4+'\x22\x20for\x20sqlCode\x20'+_0x14f6ad[_0x1dfdec(0x1c4)]+'.');const _0x3f542f=_0x32c8d8[_0x1dfdec(0x1ba)](_0x3cbda2=>_0x3cbda2[_0x1dfdec(0x1bb)]+'\x20('+_0x3cbda2['dbId']+')')[_0x1dfdec(0x1d3)](',\x20');throw CliErrors[_0x1dfdec(0x1bf)]('Local\x20directory\x20\x22'+_0x4905f4+_0x1dfdec(0x1e1)+_0x14f6ad[_0x1dfdec(0x1c4)]+':\x20'+_0x3f542f);}function parseExplicitDbDirectory(_0x2ad7df){const _0x2ff917=a238_0x4d4323,_0x31c1ba=/^db-(\d+)$/['exec'](_0x2ad7df);if(!_0x31c1ba)return null;const _0x3d082a=Number(_0x31c1ba[0x1]);return Number[_0x2ff917(0x1c7)](_0x3d082a)&&_0x3d082a>0x0?_0x3d082a:null;}
1
+ const a243_0x53a130=a243_0x492e;(function(_0x101bd0,_0x17d71e){const _0x3239e2=a243_0x492e,_0x4c4a36=_0x101bd0();while(!![]){try{const _0x1c708d=-parseInt(_0x3239e2(0x1ff))/0x1*(-parseInt(_0x3239e2(0x1fa))/0x2)+parseInt(_0x3239e2(0x1f0))/0x3*(parseInt(_0x3239e2(0x1c1))/0x4)+-parseInt(_0x3239e2(0x1c5))/0x5*(parseInt(_0x3239e2(0x1eb))/0x6)+-parseInt(_0x3239e2(0x1c7))/0x7+-parseInt(_0x3239e2(0x1fe))/0x8+-parseInt(_0x3239e2(0x1c3))/0x9*(-parseInt(_0x3239e2(0x1e7))/0xa)+parseInt(_0x3239e2(0x1f9))/0xb*(parseInt(_0x3239e2(0x1f5))/0xc);if(_0x1c708d===_0x17d71e)break;else _0x4c4a36['push'](_0x4c4a36['shift']());}catch(_0x19fd90){_0x4c4a36['push'](_0x4c4a36['shift']());}}}(a243_0xf7de,0x32907));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a243_0x492e(_0x1b904b,_0xe74cc1){_0x1b904b=_0x1b904b-0x1be;const _0xf7dee=a243_0xf7de();let _0x492e49=_0xf7dee[_0x1b904b];return _0x492e49;}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(_0x454f87){const _0x2d4192=a243_0x492e,_0x353773=stripLocalSqlMetadata(await readFile(_0x454f87['filePath'],_0x2d4192(0x1e0)),_0x454f87['mode']);if(!_0x353773[_0x2d4192(0x202)]())throw CliErrors[_0x2d4192(0x201)](_0x454f87[_0x2d4192(0x1d8)]+':\x20SQL\x20content\x20is\x20empty.');return _0x353773;}async function getTargetSqlQueries(_0x327529,_0x12699,_0x3bbf79){const _0x2c91ab=a243_0x492e,_0x3508c9=await scanLocalSqlQueries(_0x327529),_0x1dcca1=new Map();for(const _0x317ded of _0x3508c9){if(_0x3bbf79&&_0x317ded[_0x2c91ab(0x1d8)]!==_0x3bbf79)continue;const _0x186eaf=_0x1dcca1[_0x2c91ab(0x1d5)](_0x317ded[_0x2c91ab(0x1d8)])??[];_0x186eaf['push'](_0x317ded),_0x1dcca1['set'](_0x317ded['sqlCode'],_0x186eaf);}if(_0x3bbf79&&!_0x1dcca1[_0x2c91ab(0x1d7)](_0x3bbf79))throw CliErrors[_0x2c91ab(0x201)](_0x2c91ab(0x1dc)+_0x3bbf79);const _0x4e605f=[];for(const [_0x3d79ce,_0x1afc76]of _0x1dcca1[_0x2c91ab(0x1e8)]()){if(_0x1afc76['length']===0x1){_0x4e605f[_0x2c91ab(0x1c8)](_0x1afc76[0x0]);continue;}const _0x53b426=_0x12699[_0x2c91ab(0x1ec)][_0x3d79ce],_0x1f01bd=_0x53b426?.[_0x2c91ab(0x1c2)],_0x532338=_0x1f01bd?_0x1afc76[_0x2c91ab(0x1ee)](_0x55a1b6=>_0x55a1b6[_0x2c91ab(0x1f4)]!==_0x1f01bd):_0x1afc76;if(_0x53b426&&_0x532338[_0x2c91ab(0x1d3)]===0x1){_0x4e605f[_0x2c91ab(0x1c8)](_0x532338[0x0]);continue;}throw CliErrors[_0x2c91ab(0x201)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x3d79ce+_0x2c91ab(0x1f2));}return _0x4e605f;}export const sqlPush={'service':a243_0x53a130(0x1fb),'command':a243_0x53a130(0x1c8),'description':a243_0x53a130(0x1f1),'risk':a243_0x53a130(0x203),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a243_0x53a130(0x1d2),'type':a243_0x53a130(0x1bf),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x317d1d){const _0x258696=a243_0x53a130,_0x39c748=loadSqlProjectConfig(_0x317d1d[_0x258696(0x1ea)]),_0x3ec1d0=await readSqlLockFile(_0x39c748['lockFilePath']),{appLock:_0x19e4b1}=ensureSqlLockScope(_0x3ec1d0??createEmptySqlLock(),_0x317d1d[_0x258696(0x1ea)],_0x39c748['sqlRoot'],'push'),_0x1be163=await getTargetSqlQueries(_0x39c748,_0x19e4b1,_0x317d1d['str']('sqlcode')||undefined),_0x1e9d5c=[];for(const _0x335d23 of _0x1be163){const _0x3af0be=await computeSqlFileHash(_0x335d23[_0x258696(0x1f3)]),_0x184263=_0x19e4b1[_0x258696(0x1ec)][_0x335d23[_0x258696(0x1d8)]],_0x8c11a3=!!_0x184263&&(_0x184263[_0x258696(0x1c2)]!==_0x335d23[_0x258696(0x1f4)]||!!_0x335d23['sqlName']&&_0x184263[_0x258696(0x1d9)]!==_0x335d23[_0x258696(0x1d9)]||_0x184263[_0x258696(0x1e1)]!==_0x335d23[_0x258696(0x1e1)]);if(!_0x317d1d[_0x258696(0x1cc)](_0x258696(0x1d2))&&_0x184263&&_0x184263[_0x258696(0x1df)]===_0x3af0be&&!_0x8c11a3)continue;if(!_0x184263)throw CliErrors[_0x258696(0x201)](_0x335d23[_0x258696(0x1d8)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0x184263[_0x258696(0x1c0)]==null)throw CliErrors[_0x258696(0x201)](_0x335d23[_0x258696(0x1d8)]+_0x258696(0x1de));await resolveTargetDbBinding(_0x317d1d[_0x258696(0x1ea)],_0x335d23,_0x184263),await readSqlUploadContent(_0x335d23),_0x1e9d5c['push'](_0x335d23['sqlCode']);}return{'method':'POST','url':_0x258696(0x1c4),'body':{'sqlCodes':_0x1e9d5c,'appCode':_0x317d1d[_0x258696(0x1ea)]},'description':'Would\x20push\x20'+_0x1e9d5c['length']+'\x20SQL\x20file(s)'};},async 'execute'(_0x4c3976){const _0x5d126a=a243_0x53a130,_0x352304=loadSqlProjectConfig(_0x4c3976['appCode']),_0x11deb9=await readSqlLockFile(_0x352304[_0x5d126a(0x1da)]),{lockData:_0x4beaed,appLock:_0x43d76f}=ensureSqlLockScope(_0x11deb9??createEmptySqlLock(),_0x4c3976[_0x5d126a(0x1ea)],_0x352304['sqlRoot'],_0x5d126a(0x1c8)),_0x279fbe=await getTargetSqlQueries(_0x352304,_0x43d76f,_0x4c3976[_0x5d126a(0x1f6)](_0x5d126a(0x1ef))||undefined);if(_0x279fbe[_0x5d126a(0x1d3)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x5d126a(0x1e4)};const _0x752736=[],_0x31678d=[],_0x1a1e91=[];let _0x4e4d71=![];for(const _0xbe8c10 of _0x279fbe){const _0x366a49=_0x43d76f[_0x5d126a(0x1ec)][_0xbe8c10[_0x5d126a(0x1d8)]];if(!_0x366a49){_0x1a1e91[_0x5d126a(0x1c8)]({'sqlCode':_0xbe8c10[_0x5d126a(0x1d8)],'error':_0x5d126a(0x1cd)});continue;}try{const _0x3fadaa=await computeSqlFileHash(_0xbe8c10['filePath']),_0x156418=_0x366a49[_0x5d126a(0x1c2)]!==_0xbe8c10[_0x5d126a(0x1f4)]||!!_0xbe8c10[_0x5d126a(0x1d9)]&&_0x366a49[_0x5d126a(0x1d9)]!==_0xbe8c10[_0x5d126a(0x1d9)]||_0x366a49[_0x5d126a(0x1e1)]!==_0xbe8c10[_0x5d126a(0x1e1)];if(!_0x4c3976[_0x5d126a(0x1cc)](_0x5d126a(0x1d2))&&_0x366a49['hash']===_0x3fadaa&&!_0x156418){_0x31678d['push']({'sqlCode':_0xbe8c10[_0x5d126a(0x1d8)],'reason':_0x5d126a(0x1c6)});continue;}if(_0x366a49[_0x5d126a(0x1c0)]==null){_0x1a1e91[_0x5d126a(0x1c8)]({'sqlCode':_0xbe8c10[_0x5d126a(0x1d8)],'error':_0x5d126a(0x1cf)});continue;}const _0xbd0eb7=_0xbe8c10[_0x5d126a(0x1d9)]||_0x366a49[_0x5d126a(0x1d9)],_0x148ba9=await resolveTargetDbBinding(_0x4c3976[_0x5d126a(0x1ea)],_0xbe8c10,_0x366a49),_0x5563ad=await readSqlUploadContent(_0xbe8c10),_0x37d89d=await updateSqlQuery({'id':_0x366a49[_0x5d126a(0x1fc)],'appCode':_0x4c3976[_0x5d126a(0x1ea)],'sqlCode':_0xbe8c10['sqlCode'],'sqlName':_0xbd0eb7,'dbId':_0x148ba9['dbId'],'version':_0x366a49[_0x5d126a(0x1c0)],'sqlContent':_0x5563ad,'sqlConfig':_0x366a49[_0x5d126a(0x1ca)]??undefined}),_0x5d6341=_0x37d89d['dbId']?await getDbName(_0x4c3976[_0x5d126a(0x1ea)],Number(_0x37d89d[_0x5d126a(0x1f7)]))[_0x5d126a(0x1ce)](()=>_0x148ba9[_0x5d126a(0x1e9)]):_0x148ba9['dbName'];_0x43d76f[_0x5d126a(0x1ec)][_0xbe8c10[_0x5d126a(0x1d8)]]={...buildSqlLockEntry(_0x37d89d,_0x5563ad,_0x3fadaa,{'dbName':_0x5d6341}),'path':_0xbe8c10[_0x5d126a(0x1f4)],'mode':_0xbe8c10['mode']},_0x4e4d71=!![],await archivePreviousSqlFileIfNeeded(_0x352304,_0x366a49['path'],_0xbe8c10[_0x5d126a(0x1f4)]),_0x752736[_0x5d126a(0x1c8)]({'sqlCode':_0xbe8c10[_0x5d126a(0x1d8)],'remoteId':_0x366a49[_0x5d126a(0x1fc)]});}catch(_0x46657b){_0x1a1e91['push']({'sqlCode':_0xbe8c10[_0x5d126a(0x1d8)],'error':_0x46657b instanceof Error?_0x46657b[_0x5d126a(0x1d1)]:String(_0x46657b)});}}(_0x4e4d71||_0x1a1e91[_0x5d126a(0x1d3)]===0x0)&&(_0x43d76f[_0x5d126a(0x1f8)]=new Date()[_0x5d126a(0x1e3)](),await writeSqlLockFile(_0x352304[_0x5d126a(0x1da)],_0x4beaed));const _0x11218c=_0x1a1e91['length']===0x0;return{'ok':_0x11218c,'data':{'pushed':_0x752736,'skipped':_0x31678d,'failed':_0x1a1e91},'message':_0x5d126a(0x200)+_0x752736[_0x5d126a(0x1d3)]+_0x5d126a(0x1fd)+_0x31678d[_0x5d126a(0x1d3)]+_0x5d126a(0x1be)+_0x1a1e91['length']+_0x5d126a(0x1e5)};}};async function archivePreviousSqlFileIfNeeded(_0x251065,_0x2e8dae,_0x3fad05){const _0x1e55d3=a243_0x53a130;if(!_0x2e8dae||_0x2e8dae===_0x3fad05)return;const _0x519464=join(_0x251065['sqlRootDir'],_0x2e8dae);if(!await fileExists(_0x519464))return;const _0x2dc602=await moveToTrash(_0x251065['projectRoot'],_0x251065[_0x1e55d3(0x1cb)],_0x519464);await cleanupEmptyDirectories(dirname(_0x519464),_0x251065[_0x1e55d3(0x1dd)]),void _0x2dc602;}async function moveToTrash(_0x3a89ed,_0x35560d,_0x14127f){const _0x4ef70e=new Date()['toISOString']()['replace'](/[:.]/g,'-'),_0x1117d2=relative(_0x3a89ed,_0x14127f),_0x13c055=join(_0x35560d,_0x4ef70e,_0x1117d2);return await mkdir(dirname(_0x13c055),{'recursive':!![]}),await rename(_0x14127f,_0x13c055),_0x13c055;}function a243_0xf7de(){const _0x5c0068=['dbId','lastSync','3311330RzduCO','47176QBrlyG','sql','remoteId','\x20pushed,\x20','674928rZniAs','8WiwHbn','Push\x20complete:\x20','validation','trim','write','\x20skipped,\x20','boolean','version','11296AQOKGI','path','2138706viTCLh','/smartapi/custom/updateUserCustomSql','109615zFtetk','unchanged','1164450gPRbNd','push','exec','sqlConfig','trashDir','bool','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','catch','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','startsWith','message','force','length','map','get','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','has','sqlCode','sqlName','lockFilePath','Local\x20directory\x20\x22','Local\x20SQL\x20not\x20found:\x20','sqlRootDir',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','hash','utf8','mode','No\x20database\x20matches\x20local\x20directory\x20\x22','toISOString','No\x20local\x20SQL\x20files\x20found.','\x20failed','\x22\x20for\x20sqlCode\x20','10bmQumO','entries','dbName','appCode','90aIroNJ','sqls','dbDirectory','filter','sqlcode','63bbgVAm','Push\x20local\x20SQL\x20files\x20to\x20remote','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','filePath','relativePath','12ubpOJM','str'];a243_0xf7de=function(){return _0x5c0068;};return a243_0xf7de();}async function cleanupEmptyDirectories(_0x2ce55c,_0x4e199a){const _0x482624=a243_0x53a130;let _0xe10757=resolve(_0x2ce55c);const _0x409b0d=resolve(_0x4e199a);while(_0xe10757[_0x482624(0x1d0)](''+_0x409b0d+sep)||_0xe10757===_0x409b0d){if(_0xe10757===_0x409b0d)return;try{const _0x1ab8b3=await readdir(_0xe10757);if(_0x1ab8b3[_0x482624(0x1d3)]>0x0)return;await rmdir(_0xe10757);}catch{return;}_0xe10757=dirname(_0xe10757);}}async function resolveTargetDbBinding(_0x58e5e1,_0x1cc9b8,_0x5b0ecf){const _0x54ac74=a243_0x53a130,_0x3862e5=_0x1cc9b8[_0x54ac74(0x1ed)];if(!_0x3862e5)return{'dbId':_0x5b0ecf[_0x54ac74(0x1f7)],'dbName':_0x5b0ecf[_0x54ac74(0x1e9)]};const _0x583058=buildDbDirectoryName(_0x5b0ecf[_0x54ac74(0x1e9)],_0x5b0ecf[_0x54ac74(0x1f7)]);if(_0x3862e5===_0x583058)return{'dbId':_0x5b0ecf['dbId'],'dbName':_0x5b0ecf['dbName']};const _0x196c2b=parseExplicitDbDirectory(_0x3862e5);if(_0x196c2b!=null)return{'dbId':_0x196c2b,'dbName':await getDbName(_0x58e5e1,_0x196c2b)[_0x54ac74(0x1ce)](()=>undefined)};const _0x19da71=await listDatabases(_0x58e5e1),_0x4b4235=_0x19da71[_0x54ac74(0x1ee)](_0x5e9076=>buildDbDirectoryName(_0x5e9076['dbName'],_0x5e9076[_0x54ac74(0x1f7)])===_0x3862e5);if(_0x4b4235[_0x54ac74(0x1d3)]===0x1)return{'dbId':_0x4b4235[0x0][_0x54ac74(0x1f7)],'dbName':_0x4b4235[0x0]['dbName']};if(_0x4b4235[_0x54ac74(0x1d3)]===0x0)throw CliErrors[_0x54ac74(0x201)](_0x54ac74(0x1e2)+_0x3862e5+_0x54ac74(0x1e6)+_0x1cc9b8[_0x54ac74(0x1d8)]+'.');const _0x1fffcf=_0x4b4235[_0x54ac74(0x1d4)](_0x2a4bd4=>_0x2a4bd4[_0x54ac74(0x1e9)]+'\x20('+_0x2a4bd4[_0x54ac74(0x1f7)]+')')['join'](',\x20');throw CliErrors['validation'](_0x54ac74(0x1db)+_0x3862e5+_0x54ac74(0x1d6)+_0x1cc9b8['sqlCode']+':\x20'+_0x1fffcf);}function parseExplicitDbDirectory(_0x1b4db3){const _0x237ec1=a243_0x53a130,_0x275075=/^db-(\d+)$/[_0x237ec1(0x1c9)](_0x1b4db3);if(!_0x275075)return null;const _0x5a769f=Number(_0x275075[0x1]);return Number['isFinite'](_0x5a769f)&&_0x5a769f>0x0?_0x5a769f:null;}