@lovrabet/rabetbase-cli 2.5.5-beta.1 → 2.5.5-beta.3

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 (367) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/api-group.js +1 -1
  3. package/lib/api/fetch-model-list.js +1 -1
  4. package/lib/api/generate-api-file.js +1 -1
  5. package/lib/api/generate-sdk-config-file.js +1 -1
  6. package/lib/api/legacy-api-file.js +1 -1
  7. package/lib/api/model-registry-file.js +1 -1
  8. package/lib/api/model-registry-scaffold.js +1 -1
  9. package/lib/api/model-source.js +1 -1
  10. package/lib/auth/auth-server-ui.js +1 -1
  11. package/lib/auth/auth-server.js +1 -1
  12. package/lib/auth/constant.js +1 -1
  13. package/lib/auth/get-cookie.js +1 -1
  14. package/lib/auth/get-session-user.js +1 -1
  15. package/lib/auth/is-session-valid.js +1 -1
  16. package/lib/auth/login-success-html.js +1 -1
  17. package/lib/auth/logout.js +1 -1
  18. package/lib/cli-flags.js +1 -1
  19. package/lib/cli.js +1 -1
  20. package/lib/commands/api/generate.js +1 -1
  21. package/lib/commands/api/index.js +1 -1
  22. package/lib/commands/api/list.js +1 -1
  23. package/lib/commands/api/pull.js +1 -1
  24. package/lib/commands/api/shared.js +1 -1
  25. package/lib/commands/app/detail.js +1 -1
  26. package/lib/commands/app/index.js +1 -1
  27. package/lib/commands/app/list.js +1 -1
  28. package/lib/commands/app/members-list.js +1 -1
  29. package/lib/commands/app/remote-directory.js +1 -1
  30. package/lib/commands/app/shared.js +1 -1
  31. package/lib/commands/app-config/delete.js +1 -1
  32. package/lib/commands/app-config/get.js +1 -1
  33. package/lib/commands/app-config/index.js +1 -1
  34. package/lib/commands/app-config/list.js +1 -1
  35. package/lib/commands/app-config/set.js +1 -1
  36. package/lib/commands/app-config/shared.js +1 -1
  37. package/lib/commands/auth/index.js +1 -1
  38. package/lib/commands/bff/create.js +1 -1
  39. package/lib/commands/bff/delete.js +1 -1
  40. package/lib/commands/bff/detail.js +1 -1
  41. package/lib/commands/bff/index.js +1 -1
  42. package/lib/commands/bff/list.js +1 -1
  43. package/lib/commands/bff/logs.js +1 -1
  44. package/lib/commands/bff/pull.js +1 -1
  45. package/lib/commands/bff/push.js +1 -1
  46. package/lib/commands/bff/status.js +1 -1
  47. package/lib/commands/cli-skill/index.js +1 -1
  48. package/lib/commands/cli-update.js +1 -1
  49. package/lib/commands/codegen/index.js +1 -1
  50. package/lib/commands/codegen/sdk.js +1 -1
  51. package/lib/commands/codegen/sql.js +1 -1
  52. package/lib/commands/common/app-registry.js +1 -1
  53. package/lib/commands/common/app-selector.js +1 -1
  54. package/lib/commands/common/async-task.js +1 -1
  55. package/lib/commands/common/dry-run.js +1 -1
  56. package/lib/commands/common/flags.js +1 -1
  57. package/lib/commands/common/local-file.js +1 -1
  58. package/lib/commands/common/validate.js +1 -1
  59. package/lib/commands/config/delete.js +1 -1
  60. package/lib/commands/config/get.js +1 -1
  61. package/lib/commands/config/index.js +1 -1
  62. package/lib/commands/config/init.js +1 -1
  63. package/lib/commands/config/list.js +1 -1
  64. package/lib/commands/config/set.js +1 -1
  65. package/lib/commands/config/shared.js +1 -1
  66. package/lib/commands/dataset/batch-design.js +1 -1
  67. package/lib/commands/dataset/business-group-update.js +1 -1
  68. package/lib/commands/dataset/business-groups.js +1 -1
  69. package/lib/commands/dataset/capability.js +1 -1
  70. package/lib/commands/dataset/cross-relation-create.js +1 -1
  71. package/lib/commands/dataset/cross-relation-delete.js +1 -1
  72. package/lib/commands/dataset/cross-relation-list.js +1 -1
  73. package/lib/commands/dataset/cross-relation-shared.js +1 -1
  74. package/lib/commands/dataset/cross-relation-update.js +1 -1
  75. package/lib/commands/dataset/delete.js +1 -1
  76. package/lib/commands/dataset/detail.js +1 -1
  77. package/lib/commands/dataset/extend-update.js +1 -1
  78. package/lib/commands/dataset/field-restore.js +1 -1
  79. package/lib/commands/dataset/field-update.js +1 -1
  80. package/lib/commands/dataset/generate.js +1 -1
  81. package/lib/commands/dataset/index.js +1 -1
  82. package/lib/commands/dataset/list.js +1 -1
  83. package/lib/commands/dataset/operations.js +1 -1
  84. package/lib/commands/dataset/relation-audit.js +1 -1
  85. package/lib/commands/dataset/relation-create.js +1 -1
  86. package/lib/commands/dataset/relation-delete.js +1 -1
  87. package/lib/commands/dataset/relation-shared.js +1 -1
  88. package/lib/commands/dataset/relation-update.js +1 -1
  89. package/lib/commands/dataset/relations.js +1 -1
  90. package/lib/commands/dataset/rename.js +1 -1
  91. package/lib/commands/dataset/restore.js +1 -1
  92. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  93. package/lib/commands/db/analysis-batching.js +1 -1
  94. package/lib/commands/db/analyze-batch-plan.js +1 -1
  95. package/lib/commands/db/analyze-cancel.js +1 -1
  96. package/lib/commands/db/analyze-start.js +1 -1
  97. package/lib/commands/db/analyze-status.js +1 -1
  98. package/lib/commands/db/create.js +1 -1
  99. package/lib/commands/db/delete.js +1 -1
  100. package/lib/commands/db/detail.js +1 -1
  101. package/lib/commands/db/diff-refresh-start.js +1 -1
  102. package/lib/commands/db/diff-refresh-status.js +1 -1
  103. package/lib/commands/db/diff.js +1 -1
  104. package/lib/commands/db/index.js +1 -1
  105. package/lib/commands/db/list.js +1 -1
  106. package/lib/commands/db/shared.js +1 -1
  107. package/lib/commands/db/table-diff-shared.js +1 -1
  108. package/lib/commands/db/tables.js +1 -1
  109. package/lib/commands/db/test.js +1 -1
  110. package/lib/commands/db/update.js +1 -1
  111. package/lib/commands/deployment/index.js +1 -1
  112. package/lib/commands/deployment/sync-all.js +1 -1
  113. package/lib/commands/deployment/sync-jobs.js +1 -1
  114. package/lib/commands/deployment/sync-status.js +1 -1
  115. package/lib/commands/doctor.js +1 -1
  116. package/lib/commands/file/index.js +1 -1
  117. package/lib/commands/flow/create.js +1 -1
  118. package/lib/commands/flow/detail.js +1 -1
  119. package/lib/commands/flow/index.js +1 -1
  120. package/lib/commands/flow/list.js +1 -1
  121. package/lib/commands/flow/publish.js +1 -1
  122. package/lib/commands/flow/runtime-resources-shared.js +1 -1
  123. package/lib/commands/flow/runtime-role-list.js +1 -1
  124. package/lib/commands/flow/runtime-role-user-list.js +1 -1
  125. package/lib/commands/flow/runtime-user-search.js +1 -1
  126. package/lib/commands/flow/shared.js +1 -1
  127. package/lib/commands/flow/update.js +1 -1
  128. package/lib/commands/flow/validate.js +1 -1
  129. package/lib/commands/instant-api-policy/current.js +1 -1
  130. package/lib/commands/instant-api-policy/index.js +1 -1
  131. package/lib/commands/instant-api-policy/init.js +1 -1
  132. package/lib/commands/instant-api-policy/publish.js +1 -1
  133. package/lib/commands/instant-api-policy/pull.js +1 -1
  134. package/lib/commands/instant-api-policy/revision.js +1 -1
  135. package/lib/commands/instant-api-policy/revisions.js +1 -1
  136. package/lib/commands/instant-api-policy/rollback.js +1 -1
  137. package/lib/commands/instant-api-policy/shared.js +1 -1
  138. package/lib/commands/instant-api-policy/validate.js +1 -1
  139. package/lib/commands/issue/index.js +1 -1
  140. package/lib/commands/issue/nudge.js +1 -1
  141. package/lib/commands/issue/report.js +1 -1
  142. package/lib/commands/issue/shared.js +1 -1
  143. package/lib/commands/kb/create.js +1 -1
  144. package/lib/commands/kb/delete.js +1 -1
  145. package/lib/commands/kb/detail.js +1 -1
  146. package/lib/commands/kb/index.js +1 -1
  147. package/lib/commands/kb/list.js +1 -1
  148. package/lib/commands/kb/search.js +1 -1
  149. package/lib/commands/kb/shared.js +1 -1
  150. package/lib/commands/kb/update.js +1 -1
  151. package/lib/commands/logs/index.js +1 -1
  152. package/lib/commands/menu/asset-update.js +1 -1
  153. package/lib/commands/menu/delete.js +1 -1
  154. package/lib/commands/menu/external-link-create.js +1 -1
  155. package/lib/commands/menu/external-link-update.js +1 -1
  156. package/lib/commands/menu/group-create.js +1 -1
  157. package/lib/commands/menu/group-update.js +1 -1
  158. package/lib/commands/menu/index.js +1 -1
  159. package/lib/commands/menu/list.js +1 -1
  160. package/lib/commands/menu/move.js +1 -1
  161. package/lib/commands/menu/regroup-start.js +1 -1
  162. package/lib/commands/menu/rename.js +1 -1
  163. package/lib/commands/menu/shared/compare-table.js +1 -1
  164. package/lib/commands/menu/shared/delete-plan.js +1 -1
  165. package/lib/commands/menu/shared/facts.js +1 -1
  166. package/lib/commands/menu/shared/index.js +1 -1
  167. package/lib/commands/menu/shared/inquirer.js +1 -1
  168. package/lib/commands/menu/shared/local-pages.js +1 -1
  169. package/lib/commands/menu/shared/logic.js +1 -1
  170. package/lib/commands/menu/shared/mutations.js +1 -1
  171. package/lib/commands/menu/shared/path.js +1 -1
  172. package/lib/commands/menu/shared/service.js +1 -1
  173. package/lib/commands/menu/shared/subapp-assets.js +1 -1
  174. package/lib/commands/menu/shared/sync-core.js +1 -1
  175. package/lib/commands/menu/shared/update-core.js +1 -1
  176. package/lib/commands/menu/shared/valid-url.js +1 -1
  177. package/lib/commands/menu/subapp-assets-status.js +1 -1
  178. package/lib/commands/menu/subapp-assets-update.js +1 -1
  179. package/lib/commands/menu/sync.js +1 -1
  180. package/lib/commands/menu/visibility-update.js +1 -1
  181. package/lib/commands/notification/config-create.js +1 -1
  182. package/lib/commands/notification/config-delete.js +1 -1
  183. package/lib/commands/notification/config-list.js +1 -1
  184. package/lib/commands/notification/config-update.js +1 -1
  185. package/lib/commands/notification/index.js +1 -1
  186. package/lib/commands/notification/shared.js +1 -1
  187. package/lib/commands/ocr/index.js +1 -1
  188. package/lib/commands/page/create.js +1 -1
  189. package/lib/commands/page/custom/detail.js +1 -1
  190. package/lib/commands/page/custom/list.js +1 -1
  191. package/lib/commands/page/custom/publish.js +1 -1
  192. package/lib/commands/page/custom/shared.js +1 -1
  193. package/lib/commands/page/custom/syntax.js +1 -1
  194. package/lib/commands/page/custom/update.js +1 -1
  195. package/lib/commands/page/data-list-status.js +1 -1
  196. package/lib/commands/page/generate-start.js +1 -1
  197. package/lib/commands/page/generate-status.js +1 -1
  198. package/lib/commands/page/index.js +1 -1
  199. package/lib/commands/page/pull.js +1 -1
  200. package/lib/commands/page/push.js +1 -1
  201. package/lib/commands/page/relation-audit.js +1 -1
  202. package/lib/commands/page/restore.js +1 -1
  203. package/lib/commands/page/shared.js +1 -1
  204. package/lib/commands/page/sync.js +1 -1
  205. package/lib/commands/project/api-architecture-upgrade.js +1 -1
  206. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  207. package/lib/commands/project/create/format-elapsed.js +1 -1
  208. package/lib/commands/project/create/main.js +1 -1
  209. package/lib/commands/project/create/materialize-project-template.js +1 -1
  210. package/lib/commands/project/create/project-name.js +1 -1
  211. package/lib/commands/project/create/project-template-archive.js +1 -1
  212. package/lib/commands/project/create/project-template-path.js +1 -1
  213. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  214. package/lib/commands/project/create/use-format-code.js +1 -1
  215. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  216. package/lib/commands/project/domain-routing-sync.js +1 -1
  217. package/lib/commands/project/index.js +1 -1
  218. package/lib/commands/project/upgrade.js +1 -1
  219. package/lib/commands/registry.js +1 -1
  220. package/lib/commands/role/delete.js +1 -1
  221. package/lib/commands/role/detail.js +1 -1
  222. package/lib/commands/role/index.js +1 -1
  223. package/lib/commands/role/list.js +1 -1
  224. package/lib/commands/role/shared.js +1 -1
  225. package/lib/commands/role/update.js +1 -1
  226. package/lib/commands/role/user-add.js +1 -1
  227. package/lib/commands/role/user-remove.js +1 -1
  228. package/lib/commands/role/user-resolve.js +1 -1
  229. package/lib/commands/rule/get.js +1 -1
  230. package/lib/commands/rule/index.js +1 -1
  231. package/lib/commands/rule/list.js +1 -1
  232. package/lib/commands/rule/set.js +1 -1
  233. package/lib/commands/rule/shared.js +1 -1
  234. package/lib/commands/run/index.js +1 -1
  235. package/lib/commands/schema.js +1 -1
  236. package/lib/commands/sql/create.js +1 -1
  237. package/lib/commands/sql/delete.js +1 -1
  238. package/lib/commands/sql/detail.js +1 -1
  239. package/lib/commands/sql/exec.js +1 -1
  240. package/lib/commands/sql/index.js +1 -1
  241. package/lib/commands/sql/list.js +1 -1
  242. package/lib/commands/sql/pull.js +1 -1
  243. package/lib/commands/sql/push.js +1 -1
  244. package/lib/commands/sql/shared.js +1 -1
  245. package/lib/commands/sql/status.js +1 -1
  246. package/lib/commands/sql/validate.js +1 -1
  247. package/lib/commands/task/index.js +1 -1
  248. package/lib/commands/task/status.js +1 -1
  249. package/lib/commands/tenant/index.js +1 -1
  250. package/lib/commands/tenant/members-list.js +1 -1
  251. package/lib/commands/tenant/shared.js +1 -1
  252. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  253. package/lib/commands/user-account/feishu-bind.js +1 -1
  254. package/lib/commands/user-account/index.js +1 -1
  255. package/lib/commands/workspace/add.js +1 -1
  256. package/lib/commands/workspace/index.js +1 -1
  257. package/lib/commands/workspace/remove.js +1 -1
  258. package/lib/config/domain-config.js +1 -1
  259. package/lib/config/project-domain-routing.js +1 -1
  260. package/lib/config/region-config.js +1 -1
  261. package/lib/config/schema.js +1 -1
  262. package/lib/constant/cdn.js +1 -1
  263. package/lib/constant/cli.js +1 -1
  264. package/lib/constant/defaults.js +1 -1
  265. package/lib/constant/domain.js +1 -1
  266. package/lib/constant/env.js +1 -1
  267. package/lib/constant/output.js +1 -1
  268. package/lib/constant/paths.js +1 -1
  269. package/lib/constant/region.js +1 -1
  270. package/lib/constant/risk.js +1 -1
  271. package/lib/constant/routing-profile.js +1 -1
  272. package/lib/context/app-resolver.js +1 -1
  273. package/lib/context/auth-resolver.js +1 -1
  274. package/lib/context/config-loader.js +1 -1
  275. package/lib/context.js +1 -1
  276. package/lib/core/alias-resolver.js +1 -1
  277. package/lib/core/api-client.js +1 -1
  278. package/lib/core/bff/config.js +1 -1
  279. package/lib/core/bff/file-system.js +1 -1
  280. package/lib/core/bff/hash.js +1 -1
  281. package/lib/core/bff/hook-directory.js +1 -1
  282. package/lib/core/bff/lock.js +1 -1
  283. package/lib/core/bff/utils.js +1 -1
  284. package/lib/core/cross-db-relation.js +1 -1
  285. package/lib/core/db-resolver.js +1 -1
  286. package/lib/core/flow-config.js +1 -1
  287. package/lib/core/instant-api-policy/config.js +1 -1
  288. package/lib/core/kb-search-client.js +1 -1
  289. package/lib/core/page/file-system.js +1 -1
  290. package/lib/core/page/hash.js +1 -1
  291. package/lib/core/page/lock.js +1 -1
  292. package/lib/core/page/lr-smart-jsx.js +1 -1
  293. package/lib/core/sql-index-auditor.js +1 -1
  294. package/lib/core/sql-sync/config.js +1 -1
  295. package/lib/core/sql-sync/file-system.js +1 -1
  296. package/lib/core/sql-sync/hash.js +1 -1
  297. package/lib/core/sql-sync/lock.js +1 -1
  298. package/lib/core/sql-sync/utils.js +1 -1
  299. package/lib/core/sql-validator.js +1 -1
  300. package/lib/errors.js +1 -1
  301. package/lib/framework/build-all-flags.js +1 -1
  302. package/lib/framework/error-output.js +1 -1
  303. package/lib/framework/explicit-yes.js +1 -1
  304. package/lib/framework/flags.js +1 -1
  305. package/lib/framework/help.js +1 -1
  306. package/lib/framework/index.js +1 -1
  307. package/lib/framework/output.js +1 -1
  308. package/lib/framework/response.js +1 -1
  309. package/lib/framework/runner-alias.js +1 -1
  310. package/lib/framework/runner.js +1 -1
  311. package/lib/framework/schema-export.js +1 -1
  312. package/lib/framework/supported-flags.js +1 -1
  313. package/lib/framework/types.js +1 -1
  314. package/lib/generated/build-info.d.ts +4 -4
  315. package/lib/generated/build-info.js +1 -1
  316. package/lib/generated/official-routing.js +1 -1
  317. package/lib/generated/routing-contract.js +1 -1
  318. package/lib/help.js +1 -1
  319. package/lib/postinstall.js +1 -1
  320. package/lib/runtime/confirmation.js +1 -1
  321. package/lib/runtime/event.js +1 -1
  322. package/lib/runtime/index.js +1 -1
  323. package/lib/runtime/queue.js +1 -1
  324. package/lib/runtime/resolve.js +1 -1
  325. package/lib/skills/builtin-skill.js +1 -1
  326. package/lib/skills/main.js +1 -1
  327. package/lib/skills/npx-skills-add.js +1 -1
  328. package/lib/skills/skill-presence.js +1 -1
  329. package/lib/telemetry/cli-command-trace.js +1 -1
  330. package/lib/telemetry/cli-help-trace.js +1 -1
  331. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  332. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  333. package/lib/telemetry/send-cli-trace-log.js +1 -1
  334. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  335. package/lib/utils/ai_config.js +1 -1
  336. package/lib/utils/apply-jq-filter.js +1 -1
  337. package/lib/utils/cdn-config.js +1 -1
  338. package/lib/utils/check-sdk-version.js +1 -1
  339. package/lib/utils/cli-version-check.js +1 -1
  340. package/lib/utils/cli-version-policy.js +1 -1
  341. package/lib/utils/config.js +1 -1
  342. package/lib/utils/entity-with-id.js +1 -1
  343. package/lib/utils/file-utils.js +1 -1
  344. package/lib/utils/guides-cdn.js +1 -1
  345. package/lib/utils/http-client.js +1 -1
  346. package/lib/utils/is-non-interactive.js +1 -1
  347. package/lib/utils/logger.js +1 -1
  348. package/lib/utils/params.js +1 -1
  349. package/lib/utils/platform.js +1 -1
  350. package/lib/utils/sleep.js +1 -1
  351. package/lib/utils/template-replacer.js +1 -1
  352. package/lib/utils/update-notice.js +1 -1
  353. package/lib/utils/version.js +1 -1
  354. package/lib/utils/with-active-cookie.js +1 -1
  355. package/lib/utils/write-cli-side-channel.js +1 -1
  356. package/package.json +1 -1
  357. package/skills/rabetbase/SKILL.md +3 -3
  358. package/skills/rabetbase/guides/independent-deployment.md +11 -1
  359. package/skills/rabetbase/references/rabetbase-config.md +16 -19
  360. package/skills/rabetbase/references/rabetbase-menu-visibility-update.md +5 -4
  361. package/skills/rabetbase/references/rabetbase-workspace.md +3 -1
  362. package/skills/rabetbase-page-generation/SKILL.md +13 -9
  363. package/skills/rabetbase-page-generation/references/component-baseline.md +2 -2
  364. package/skills/rabetbase-page-generation/references/generation.md +64 -15
  365. package/skills/rabetbase-page-generation/templates/onepage/build.mjs +39 -54
  366. package/skills/rabetbase-page-generation/templates/onepage/list/index.jsx +6 -2
  367. package/skills/rabetbase.manifest.json +3 -3
@@ -1 +1 @@
1
- const a231_0x28b172=a231_0x1ce5;function a231_0x1ce5(_0x2aaddf,_0x5e5649){_0x2aaddf=_0x2aaddf-0x1da;const _0x381cc1=a231_0x381c();let _0x1ce50e=_0x381cc1[_0x2aaddf];return _0x1ce50e;}(function(_0x7e8733,_0x5678f6){const _0x26da73=a231_0x1ce5,_0x5d0e6e=_0x7e8733();while(!![]){try{const _0x52ed37=parseInt(_0x26da73(0x1ec))/0x1+parseInt(_0x26da73(0x1e3))/0x2+-parseInt(_0x26da73(0x1de))/0x3*(-parseInt(_0x26da73(0x1e0))/0x4)+parseInt(_0x26da73(0x1e2))/0x5*(parseInt(_0x26da73(0x1db))/0x6)+parseInt(_0x26da73(0x1dd))/0x7+-parseInt(_0x26da73(0x1e4))/0x8*(-parseInt(_0x26da73(0x1e7))/0x9)+-parseInt(_0x26da73(0x1df))/0xa*(parseInt(_0x26da73(0x1dc))/0xb);if(_0x52ed37===_0x5678f6)break;else _0x5d0e6e['push'](_0x5d0e6e['shift']());}catch(_0x541caf){_0x5d0e6e['push'](_0x5d0e6e['shift']());}}}(a231_0x381c,0x317c5));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';function a231_0x381c(){const _0x51f7b2=['Loaded\x20app\x20rule\x20configuration\x20for\x20','340233mvyuIy','appCode','67362koboTM','415437qxpLbQ','2323909ZIjbZO','15Bkatdk','250tEpqLK','32572AscYPz','rule','105qtlKJY','100764WlFgpP','591136zxrqnr','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','all','18pYtToL','list','read','map'];a231_0x381c=function(){return _0x51f7b2;};return a231_0x381c();}export const ruleList={'service':a231_0x28b172(0x1e1),'command':a231_0x28b172(0x1e8),'description':a231_0x28b172(0x1e5),'risk':a231_0x28b172(0x1e9),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x30c80b){const _0x3ddc1d=a231_0x28b172,_0x4d0d44=await Promise[_0x3ddc1d(0x1e6)](APP_RULE_TYPES[_0x3ddc1d(0x1ea)](_0x175c38=>getAppRule(_0x30c80b['cookie'],{'appCode':_0x30c80b[_0x3ddc1d(0x1da)],'type':_0x175c38}))),_0x1fa598=APP_RULE_TYPES[_0x3ddc1d(0x1ea)]((_0x59f00e,_0x43915d)=>projectAppRule(_0x59f00e,_0x4d0d44[_0x43915d]??null));return{'ok':!![],'data':{'total':_0x1fa598['length'],'rules':_0x1fa598},'message':_0x3ddc1d(0x1eb)+_0x30c80b[_0x3ddc1d(0x1da)]};}};
1
+ const a231_0x3e02a2=a231_0x551c;(function(_0x558dd5,_0x570c62){const _0x8aa3b5=a231_0x551c,_0x5d2879=_0x558dd5();while(!![]){try{const _0x5895fd=-parseInt(_0x8aa3b5(0x86))/0x1+-parseInt(_0x8aa3b5(0x92))/0x2+-parseInt(_0x8aa3b5(0x91))/0x3+parseInt(_0x8aa3b5(0x88))/0x4*(-parseInt(_0x8aa3b5(0x94))/0x5)+parseInt(_0x8aa3b5(0x90))/0x6*(-parseInt(_0x8aa3b5(0x8d))/0x7)+-parseInt(_0x8aa3b5(0x8f))/0x8+parseInt(_0x8aa3b5(0x8c))/0x9;if(_0x5895fd===_0x570c62)break;else _0x5d2879['push'](_0x5d2879['shift']());}catch(_0x3b513b){_0x5d2879['push'](_0x5d2879['shift']());}}}(a231_0x515c,0x44820));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';function a231_0x551c(_0x5c640d,_0x4c9f12){_0x5c640d=_0x5c640d-0x83;const _0x515c64=a231_0x515c();let _0x551cee=_0x515c64[_0x5c640d];return _0x551cee;}export const ruleList={'service':a231_0x3e02a2(0x8b),'command':a231_0x3e02a2(0x93),'description':a231_0x3e02a2(0x8a),'risk':a231_0x3e02a2(0x85),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x268dea){const _0x1baa1d=a231_0x3e02a2,_0x2d7b26=await Promise[_0x1baa1d(0x84)](APP_RULE_TYPES['map'](_0x270920=>getAppRule(_0x268dea[_0x1baa1d(0x89)],{'appCode':_0x268dea[_0x1baa1d(0x8e)],'type':_0x270920}))),_0x5d7afe=APP_RULE_TYPES[_0x1baa1d(0x83)]((_0x287b24,_0x2d21d0)=>projectAppRule(_0x287b24,_0x2d7b26[_0x2d21d0]??null));return{'ok':!![],'data':{'total':_0x5d7afe[_0x1baa1d(0x87)],'rules':_0x5d7afe},'message':'Loaded\x20app\x20rule\x20configuration\x20for\x20'+_0x268dea[_0x1baa1d(0x8e)]};}};function a231_0x515c(){const _0x3fb8e7=['rule','17946486cnUKvF','25459TijsIV','appCode','3161744IvPNoT','78SSREeB','534105kjOqSh','689436icVEFx','list','1377615GpIDTV','map','all','read','197148xISYEx','length','8deoejb','cookie','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app'];a231_0x515c=function(){return _0x3fb8e7;};return a231_0x515c();}
@@ -1 +1 @@
1
- const a232_0x4ce663=a232_0x1d22;(function(_0x2e1a93,_0x112a70){const _0x2cf3d2=a232_0x1d22,_0x21f212=_0x2e1a93();while(!![]){try{const _0x5d59a4=-parseInt(_0x2cf3d2(0x1fd))/0x1+-parseInt(_0x2cf3d2(0x209))/0x2+-parseInt(_0x2cf3d2(0x201))/0x3+-parseInt(_0x2cf3d2(0x20d))/0x4+-parseInt(_0x2cf3d2(0x1f9))/0x5*(parseInt(_0x2cf3d2(0x205))/0x6)+parseInt(_0x2cf3d2(0x220))/0x7+parseInt(_0x2cf3d2(0x1e9))/0x8;if(_0x5d59a4===_0x112a70)break;else _0x21f212['push'](_0x21f212['shift']());}catch(_0xe08223){_0x21f212['push'](_0x21f212['shift']());}}}(a232_0x14cc,0x95a10));import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';function a232_0x1d22(_0x1a4b8e,_0xedfa01){_0x1a4b8e=_0x1a4b8e-0x1e8;const _0x14cc9a=a232_0x14cc();let _0x1d22e3=_0x14cc9a[_0x1a4b8e];return _0x1d22e3;}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='/smartapi/knowledge-base/save',NON_ATOMIC_WARNING=a232_0x4ce663(0x20b);function a232_0x14cc(){const _0x57fa40=['The\x20set\x20request\x20was\x20sent,\x20but\x20','app_rule_file_required','8221500cDHrvk','app_rule_verification_failed','before','cause','17559920kxmCmL','input','trim','rule','\x20version\x20changed\x20before\x20write.','expectedVersion','version','POST','set','write','string','flag','expected-version','defineProperty','cookie','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','225enLfBk','byteSize','contentHash','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','1182771WQeHRY','file','Set\x20','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','1113459RrTZTj',';\x20current\x20version\x20is\x20','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','1926SgKdTt','content','--file\x20is\x20required.','type','1097148HUWaoo','planned','--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.','Expected\x20','2558668wnVyNv','\x20could\x20not\x20be\x20verified.','\x20--format\x20compress','\x20for\x20','UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)','Pass\x20a\x20UTF-8\x20Markdown\x20file.','appCode','beforeRecord','replacement','isSafeInteger','rules','app_rule_set_outcome_unknown','rabetbase\x20rule\x20get\x20--type\x20','Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version','str','push','verified'];a232_0x14cc=function(){return _0x57fa40;};return a232_0x14cc();}function readSetInput(_0x5d1fd0){const _0x2f210=a232_0x4ce663,_0x164f44=readAppRuleType(_0x5d1fd0),_0x4581af=_0x5d1fd0[_0x2f210(0x21b)]('file')[_0x2f210(0x1eb)]();if(!_0x4581af)throw appRuleError(_0x2f210(0x21f),_0x2f210(0x207),_0x2f210(0x212));const _0x132dba=_0x5d1fd0[_0x2f210(0x1f4)](_0x2f210(0x1f5));let _0x4e6d94;if(_0x132dba!==undefined){_0x4e6d94=Number(_0x132dba);if(!Number[_0x2f210(0x216)](_0x4e6d94)||_0x4e6d94<0x0)throw appRuleError('app_rule_expected_version_invalid',_0x2f210(0x204));}return{'type':_0x164f44,'file':_0x4581af,'expectedVersion':_0x4e6d94};}async function prepareSet(_0x461490){const _0x2c1bc3=a232_0x4ce663,_0x35cc7f=readSetInput(_0x461490),_0x595a60=await readAppRuleFile(_0x35cc7f[_0x2c1bc3(0x1fe)]),_0x18d54d=await getAppRule(_0x461490['cookie'],{'appCode':_0x461490['appCode'],'type':_0x35cc7f[_0x2c1bc3(0x208)]});if(_0x35cc7f['expectedVersion']!==undefined&&_0x18d54d?.[_0x2c1bc3(0x1ef)]!==_0x35cc7f['expectedVersion'])throw appRuleError('app_rule_version_mismatch',appRuleFileName(_0x35cc7f['type'])+_0x2c1bc3(0x1ed),_0x2c1bc3(0x20c)+_0x35cc7f['expectedVersion']+_0x2c1bc3(0x202)+(_0x18d54d?.[_0x2c1bc3(0x1ef)]??'unconfigured')+'.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.');return{'input':_0x35cc7f,'replacement':_0x595a60,'beforeRecord':_0x18d54d,'before':projectAppRule(_0x35cc7f[_0x2c1bc3(0x208)],_0x18d54d),'planned':{'type':_0x35cc7f['type'],'fileName':appRuleFileName(_0x35cc7f[_0x2c1bc3(0x208)]),'contextScope':appRuleContextScope(_0x35cc7f['type']),'enabled':!![],'appCode':_0x461490[_0x2c1bc3(0x213)],'scope':_0x2c1bc3(0x217),'contentByteSize':_0x595a60[_0x2c1bc3(0x1fa)],'contentHash':_0x595a60[_0x2c1bc3(0x1fb)]}};}function warningsFor(_0x2edbe8){return _0x2edbe8===undefined?[]:[NON_ATOMIC_WARNING];}export const ruleSet={'service':a232_0x4ce663(0x1ec),'command':'set','description':a232_0x4ce663(0x1fc),'risk':a232_0x4ce663(0x1f2),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a232_0x4ce663(0x1fe),'type':a232_0x4ce663(0x1f3),'required':!![],'description':a232_0x4ce663(0x211)},{'name':a232_0x4ce663(0x1f5),'type':'number','required':![],'description':a232_0x4ce663(0x21a)}],async 'validate'(_0x538526){readSetInput(_0x538526);},async 'dryRun'(_0x4a7357){const _0x5c9522=a232_0x4ce663,_0x158e68=await prepareSet(_0x4a7357);return asDryRunResult({'operation':_0x5c9522(0x1f1),'selector':{'appCode':_0x4a7357['appCode'],'scope':_0x5c9522(0x217),'type':_0x158e68[_0x5c9522(0x1ea)][_0x5c9522(0x208)]},'before':_0x158e68[_0x5c9522(0x222)],'after':_0x158e68[_0x5c9522(0x20a)],'dryRun':!![],'backend':{'method':'POST','path':SAVE_PATH},'warnings':warningsFor(_0x158e68['input']['expectedVersion']),'verification':{'expectedVersion':_0x158e68['input'][_0x5c9522(0x1ee)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x5c9522(0x219)+_0x158e68['input'][_0x5c9522(0x208)]+_0x5c9522(0x20f)}},{'method':_0x5c9522(0x1f0),'url':SAVE_PATH});},async 'execute'(_0x91830f){const _0x25ca39=a232_0x4ce663,_0x5d3d9d=await prepareSet(_0x91830f);let _0x1449ce=![];try{await saveAppRule(_0x91830f[_0x25ca39(0x1f7)],{'appCode':_0x91830f[_0x25ca39(0x213)],'type':_0x5d3d9d[_0x25ca39(0x1ea)][_0x25ca39(0x208)],'content':_0x5d3d9d[_0x25ca39(0x215)][_0x25ca39(0x206)]});}catch(_0x53cf0b){if(!isPlatformTransportFailure(_0x53cf0b))throw _0x53cf0b;_0x1449ce=!![];}let _0x3771ab;try{_0x3771ab=await getAppRule(_0x91830f[_0x25ca39(0x1f7)],{'appCode':_0x91830f[_0x25ca39(0x213)],'type':_0x5d3d9d[_0x25ca39(0x1ea)][_0x25ca39(0x208)]});}catch(_0x47255a){const _0x5ef42f=appRuleError(_0x1449ce?'app_rule_set_outcome_unknown':'app_rule_verification_unavailable',_0x25ca39(0x21e)+appRuleFileName(_0x5d3d9d[_0x25ca39(0x1ea)][_0x25ca39(0x208)])+_0x25ca39(0x20e),_0x25ca39(0x200));Object[_0x25ca39(0x1f6)](_0x5ef42f,_0x25ca39(0x1e8),{'value':_0x47255a,'enumerable':![]});throw _0x5ef42f;}const _0x2e7648=_0x3771ab&&inspectAppRuleContent(_0x3771ab[_0x25ca39(0x206)])[_0x25ca39(0x1fb)]===_0x5d3d9d[_0x25ca39(0x215)][_0x25ca39(0x1fb)],_0x360dfd=_0x3771ab&&(_0x5d3d9d['beforeRecord']===null||_0x3771ab[_0x25ca39(0x1ef)]>_0x5d3d9d[_0x25ca39(0x214)][_0x25ca39(0x1ef)]);if(!_0x3771ab||!_0x2e7648||!_0x360dfd)throw appRuleError(_0x1449ce?_0x25ca39(0x218):_0x25ca39(0x221),appRuleFileName(_0x5d3d9d[_0x25ca39(0x1ea)][_0x25ca39(0x208)])+_0x25ca39(0x203),_0x25ca39(0x1f8)+_0x5d3d9d[_0x25ca39(0x1ea)][_0x25ca39(0x208)]+'\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.');const _0x3f6197=warningsFor(_0x5d3d9d[_0x25ca39(0x1ea)][_0x25ca39(0x1ee)]);_0x1449ce&&_0x3f6197[_0x25ca39(0x21c)]('Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.');const _0x27cf90=projectAppRule(_0x5d3d9d[_0x25ca39(0x1ea)]['type'],_0x3771ab);return{'ok':!![],'data':{'operation':_0x25ca39(0x1f1),'selector':{'appCode':_0x91830f[_0x25ca39(0x213)],'scope':_0x25ca39(0x217),'type':_0x5d3d9d['input'][_0x25ca39(0x208)]},'before':_0x5d3d9d['before'],'after':_0x27cf90,'dryRun':![],'backend':{'method':'POST','path':SAVE_PATH},'warnings':_0x3f6197,'verification':{'status':_0x25ca39(0x21d),'recoveredAfterUnknownResponse':_0x1449ce,'expectedVersion':_0x5d3d9d[_0x25ca39(0x1ea)][_0x25ca39(0x1ee)]??null,'atomicCompareAndSet':![],'lookupCommand':'rabetbase\x20rule\x20get\x20--type\x20'+_0x5d3d9d[_0x25ca39(0x1ea)][_0x25ca39(0x208)]+_0x25ca39(0x20f)}},'message':_0x25ca39(0x1ff)+appRuleFileName(_0x5d3d9d[_0x25ca39(0x1ea)][_0x25ca39(0x208)])+_0x25ca39(0x210)+_0x91830f[_0x25ca39(0x213)]};}};
1
+ const a232_0x3965e1=a232_0x4628;(function(_0x5dd247,_0x4ceeb0){const _0x230cbd=a232_0x4628,_0x497554=_0x5dd247();while(!![]){try{const _0x28b116=parseInt(_0x230cbd(0xfb))/0x1+parseInt(_0x230cbd(0xf3))/0x2+-parseInt(_0x230cbd(0x10a))/0x3+-parseInt(_0x230cbd(0xe3))/0x4*(parseInt(_0x230cbd(0xef))/0x5)+-parseInt(_0x230cbd(0xdc))/0x6+-parseInt(_0x230cbd(0xe7))/0x7+-parseInt(_0x230cbd(0xed))/0x8*(-parseInt(_0x230cbd(0x102))/0x9);if(_0x28b116===_0x4ceeb0)break;else _0x497554['push'](_0x497554['shift']());}catch(_0x2ad795){_0x497554['push'](_0x497554['shift']());}}}(a232_0x359d,0x394df));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_0x4628(_0x27ea7,_0x2c45fe){_0x27ea7=_0x27ea7-0xd9;const _0x359de8=a232_0x359d();let _0x46284a=_0x359de8[_0x27ea7];return _0x46284a;}const SAVE_PATH=a232_0x3965e1(0xe4),NON_ATOMIC_WARNING=a232_0x3965e1(0x106);function a232_0x359d(){const _0x5b26ed=['Set\x20','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','Expected\x20','planned','cookie','rabetbase\x20rule\x20get\x20--type\x20','879108psgssG','string','rule','content','expectedVersion','app_rule_verification_unavailable','flag','129708lYMzjp','/smartapi/knowledge-base/save','\x20--format\x20compress','\x20could\x20not\x20be\x20verified.','1361591aJoMkm','str','Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version','POST','app_rule_file_required','contentHash','9624392cznqVf','set','45iXZIGA','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','Pass\x20a\x20UTF-8\x20Markdown\x20file.','replacement','33446NGeCXE','app_rule_verification_failed','version','\x20for\x20','before','unconfigured','type','beforeRecord','25018GRUhsc','expected-version','input','trim','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','appCode','app_rule_expected_version_invalid','9bDgrTL','push','app_rule_set_outcome_unknown','The\x20set\x20request\x20was\x20sent,\x20but\x20','--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.','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','file','1131591iFiHht','rules','UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)'];a232_0x359d=function(){return _0x5b26ed;};return a232_0x359d();}function readSetInput(_0x44f98b){const _0x26b442=a232_0x3965e1,_0x4c92df=readAppRuleType(_0x44f98b),_0x553932=_0x44f98b[_0x26b442(0xe8)](_0x26b442(0x109))[_0x26b442(0xfe)]();if(!_0x553932)throw appRuleError(_0x26b442(0xeb),'--file\x20is\x20required.',_0x26b442(0xf1));const _0x446b05=_0x44f98b[_0x26b442(0xe2)](_0x26b442(0xfc));let _0x239189;if(_0x446b05!==undefined){_0x239189=Number(_0x446b05);if(!Number['isSafeInteger'](_0x239189)||_0x239189<0x0)throw appRuleError(_0x26b442(0x101),_0x26b442(0xf0));}return{'type':_0x4c92df,'file':_0x553932,'expectedVersion':_0x239189};}async function prepareSet(_0x42edbd){const _0x34e536=a232_0x3965e1,_0x78c6fc=readSetInput(_0x42edbd),_0x42caa6=await readAppRuleFile(_0x78c6fc[_0x34e536(0x109)]),_0x2a3c09=await getAppRule(_0x42edbd[_0x34e536(0xda)],{'appCode':_0x42edbd['appCode'],'type':_0x78c6fc['type']});if(_0x78c6fc[_0x34e536(0xe0)]!==undefined&&_0x2a3c09?.['version']!==_0x78c6fc[_0x34e536(0xe0)])throw appRuleError('app_rule_version_mismatch',appRuleFileName(_0x78c6fc[_0x34e536(0xf9)])+'\x20version\x20changed\x20before\x20write.',_0x34e536(0x10f)+_0x78c6fc[_0x34e536(0xe0)]+';\x20current\x20version\x20is\x20'+(_0x2a3c09?.['version']??_0x34e536(0xf8))+'.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.');return{'input':_0x78c6fc,'replacement':_0x42caa6,'beforeRecord':_0x2a3c09,'before':projectAppRule(_0x78c6fc[_0x34e536(0xf9)],_0x2a3c09),'planned':{'type':_0x78c6fc[_0x34e536(0xf9)],'fileName':appRuleFileName(_0x78c6fc[_0x34e536(0xf9)]),'contextScope':appRuleContextScope(_0x78c6fc[_0x34e536(0xf9)]),'enabled':!![],'appCode':_0x42edbd[_0x34e536(0x100)],'scope':'rules','contentByteSize':_0x42caa6['byteSize'],'contentHash':_0x42caa6[_0x34e536(0xec)]}};}function warningsFor(_0x4bb48c){return _0x4bb48c===undefined?[]:[NON_ATOMIC_WARNING];}export const ruleSet={'service':a232_0x3965e1(0xde),'command':'set','description':'Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','risk':'write','requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a232_0x3965e1(0x109),'type':a232_0x3965e1(0xdd),'required':!![],'description':a232_0x3965e1(0x10c)},{'name':'expected-version','type':'number','required':![],'description':a232_0x3965e1(0xe9)}],async 'validate'(_0x4f4655){readSetInput(_0x4f4655);},async 'dryRun'(_0x5dd951){const _0x343480=a232_0x3965e1,_0x317140=await prepareSet(_0x5dd951);return asDryRunResult({'operation':_0x343480(0xee),'selector':{'appCode':_0x5dd951[_0x343480(0x100)],'scope':'rules','type':_0x317140[_0x343480(0xfd)]['type']},'before':_0x317140[_0x343480(0xf7)],'after':_0x317140[_0x343480(0xd9)],'dryRun':!![],'backend':{'method':_0x343480(0xea),'path':SAVE_PATH},'warnings':warningsFor(_0x317140['input'][_0x343480(0xe0)]),'verification':{'expectedVersion':_0x317140['input'][_0x343480(0xe0)]??null,'atomicCompareAndSet':![],'lookupCommand':'rabetbase\x20rule\x20get\x20--type\x20'+_0x317140[_0x343480(0xfd)][_0x343480(0xf9)]+_0x343480(0xe5)}},{'method':_0x343480(0xea),'url':SAVE_PATH});},async 'execute'(_0x8f9241){const _0x58cb28=a232_0x3965e1,_0x5907f5=await prepareSet(_0x8f9241);let _0xfb960=![];try{await saveAppRule(_0x8f9241[_0x58cb28(0xda)],{'appCode':_0x8f9241[_0x58cb28(0x100)],'type':_0x5907f5[_0x58cb28(0xfd)]['type'],'content':_0x5907f5[_0x58cb28(0xf2)][_0x58cb28(0xdf)]});}catch(_0x542964){if(!isPlatformTransportFailure(_0x542964))throw _0x542964;_0xfb960=!![];}let _0xfc8667;try{_0xfc8667=await getAppRule(_0x8f9241['cookie'],{'appCode':_0x8f9241[_0x58cb28(0x100)],'type':_0x5907f5[_0x58cb28(0xfd)][_0x58cb28(0xf9)]});}catch(_0x3bd68a){const _0x3716a2=appRuleError(_0xfb960?'app_rule_set_outcome_unknown':_0x58cb28(0xe1),_0x58cb28(0x105)+appRuleFileName(_0x5907f5['input']['type'])+_0x58cb28(0xe6),'Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.');Object['defineProperty'](_0x3716a2,'cause',{'value':_0x3bd68a,'enumerable':![]});throw _0x3716a2;}const _0x14c169=_0xfc8667&&inspectAppRuleContent(_0xfc8667[_0x58cb28(0xdf)])['contentHash']===_0x5907f5[_0x58cb28(0xf2)]['contentHash'],_0x532369=_0xfc8667&&(_0x5907f5[_0x58cb28(0xfa)]===null||_0xfc8667[_0x58cb28(0xf5)]>_0x5907f5[_0x58cb28(0xfa)]['version']);if(!_0xfc8667||!_0x14c169||!_0x532369)throw appRuleError(_0xfb960?_0x58cb28(0x104):_0x58cb28(0xf4),appRuleFileName(_0x5907f5['input'][_0x58cb28(0xf9)])+_0x58cb28(0x107),_0x58cb28(0x10e)+_0x5907f5['input'][_0x58cb28(0xf9)]+_0x58cb28(0xff));const _0xe8f6cb=warningsFor(_0x5907f5[_0x58cb28(0xfd)][_0x58cb28(0xe0)]);_0xfb960&&_0xe8f6cb[_0x58cb28(0x103)](_0x58cb28(0x108));const _0x5f335f=projectAppRule(_0x5907f5[_0x58cb28(0xfd)][_0x58cb28(0xf9)],_0xfc8667);return{'ok':!![],'data':{'operation':'set','selector':{'appCode':_0x8f9241[_0x58cb28(0x100)],'scope':_0x58cb28(0x10b),'type':_0x5907f5[_0x58cb28(0xfd)][_0x58cb28(0xf9)]},'before':_0x5907f5[_0x58cb28(0xf7)],'after':_0x5f335f,'dryRun':![],'backend':{'method':'POST','path':SAVE_PATH},'warnings':_0xe8f6cb,'verification':{'status':'verified','recoveredAfterUnknownResponse':_0xfb960,'expectedVersion':_0x5907f5[_0x58cb28(0xfd)][_0x58cb28(0xe0)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x58cb28(0xdb)+_0x5907f5[_0x58cb28(0xfd)][_0x58cb28(0xf9)]+_0x58cb28(0xe5)}},'message':_0x58cb28(0x10d)+appRuleFileName(_0x5907f5[_0x58cb28(0xfd)][_0x58cb28(0xf9)])+_0x58cb28(0xf6)+_0x8f9241[_0x58cb28(0x100)]};}};
@@ -1 +1 @@
1
- const a233_0x49873a=a233_0x3ce8;(function(_0x4d2ccf,_0x40d475){const _0x2e84fd=a233_0x3ce8,_0x27fc41=_0x4d2ccf();while(!![]){try{const _0x44ecb7=-parseInt(_0x2e84fd(0x13d))/0x1*(parseInt(_0x2e84fd(0x131))/0x2)+-parseInt(_0x2e84fd(0x122))/0x3*(parseInt(_0x2e84fd(0x12c))/0x4)+parseInt(_0x2e84fd(0x11a))/0x5+parseInt(_0x2e84fd(0x12d))/0x6*(parseInt(_0x2e84fd(0x144))/0x7)+parseInt(_0x2e84fd(0x149))/0x8*(parseInt(_0x2e84fd(0x12f))/0x9)+-parseInt(_0x2e84fd(0x124))/0xa*(-parseInt(_0x2e84fd(0x11d))/0xb)+-parseInt(_0x2e84fd(0x130))/0xc;if(_0x44ecb7===_0x40d475)break;else _0x27fc41['push'](_0x27fc41['shift']());}catch(_0x19be3a){_0x27fc41['push'](_0x27fc41['shift']());}}}(a233_0x236e,0xb9d4e));import{createHash}from'node:crypto';function a233_0x236e(){const _0x517fe3=['version','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','sha256','app_rule_content_invalid','decode','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','1268zwgVFM','7913832yAwqad','app_rule_type_invalid','12628323SaSeYg','20790516jfeins','2129036WpTpVu','size','app_rule_file_unreadable','hex','update','digest','message','page-api-development','type','utf-8','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','app_rule_file_invalid','1BRGlXq','app_rule_content_too_large','createTime','DATABASE.md','Cannot\x20access\x20app\x20rule\x20file:\x20','updateTime','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','7baKAqz','isFile','App\x20rule\x20file\x20is\x20blank:\x20','sha256:','toLowerCase','8PBYTcI','RULES.md','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','database','appCode','content','scope','5554100LHptYI','byteSize','Pass\x20a\x20UTF-8\x20Markdown\x20file.','2522498XNXkWc','rules','trim','database-analysis','str','4770yaWixD','--file\x20is\x20required.','10hsmgKI','utf8'];a233_0x236e=function(){return _0x517fe3;};return a233_0x236e();}import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a233_0x49873a(0x11e),a233_0x49873a(0x14c)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a233_0x49873a(0x14a),'database':a233_0x49873a(0x140)},APP_RULE_CONTEXT_SCOPES={'rules':a233_0x49873a(0x138),'database':a233_0x49873a(0x120)};export function appRuleError(_0x267fff,_0x58543c,_0x401095){return new CliError(_0x267fff,0x1,_0x58543c,_0x401095);}export function readAppRuleType(_0x3afc81){const _0x705d46=a233_0x49873a,_0x539bd5=_0x3afc81[_0x705d46(0x121)](_0x705d46(0x139))[_0x705d46(0x11f)]()[_0x705d46(0x148)]();if(_0x539bd5!==_0x705d46(0x11e)&&_0x539bd5!==_0x705d46(0x14c))throw appRuleError(_0x705d46(0x12e),_0x705d46(0x127));return _0x539bd5;}export function appRuleFileName(_0x59d070){return APP_RULE_FILES[_0x59d070];}export function appRuleContextScope(_0x29a76a){return APP_RULE_CONTEXT_SCOPES[_0x29a76a];}export function inspectAppRuleContent(_0x4eca0c){const _0x2fd97a=a233_0x49873a,_0x4f52a7=Buffer['from'](_0x4eca0c,_0x2fd97a(0x125));return{'content':_0x4eca0c,'byteSize':_0x4f52a7['byteLength'],'contentHash':_0x2fd97a(0x147)+createHash(_0x2fd97a(0x128))[_0x2fd97a(0x135)](_0x4f52a7)[_0x2fd97a(0x136)](_0x2fd97a(0x134))};}export async function readAppRuleFile(_0x302e6f){const _0x2537e7=a233_0x49873a,_0x3e0bab=_0x302e6f[_0x2537e7(0x11f)]();if(!_0x3e0bab)throw appRuleError('app_rule_file_required',_0x2537e7(0x123),_0x2537e7(0x11c));const _0x3c5b5a=resolve(_0x3e0bab);let _0x1c84b5;try{_0x1c84b5=await stat(_0x3c5b5a);}catch(_0x47d438){throw appRuleError(_0x2537e7(0x133),_0x2537e7(0x141)+_0x3e0bab,_0x47d438 instanceof Error?_0x47d438[_0x2537e7(0x137)]:String(_0x47d438));}if(!_0x1c84b5[_0x2537e7(0x145)]())throw appRuleError(_0x2537e7(0x13c),_0x2537e7(0x13b)+_0x3e0bab);if(_0x1c84b5[_0x2537e7(0x132)]>MAX_APP_RULE_BYTES)throw appRuleError('app_rule_content_too_large',_0x2537e7(0x14b));let _0x1eb023;try{_0x1eb023=await readFile(_0x3c5b5a);}catch(_0xca61ba){throw appRuleError('app_rule_file_unreadable','Cannot\x20read\x20app\x20rule\x20file:\x20'+_0x3e0bab,_0xca61ba instanceof Error?_0xca61ba[_0x2537e7(0x137)]:String(_0xca61ba));}if(_0x1eb023['byteLength']>MAX_APP_RULE_BYTES)throw appRuleError(_0x2537e7(0x13e),_0x2537e7(0x14b));let _0xa9ea0;try{_0xa9ea0=new TextDecoder(_0x2537e7(0x13a),{'fatal':!![],'ignoreBOM':!![]})[_0x2537e7(0x12a)](_0x1eb023);}catch{throw appRuleError('app_rule_content_invalid',_0x2537e7(0x143)+_0x3e0bab);}if(!_0xa9ea0[_0x2537e7(0x11f)]())throw appRuleError(_0x2537e7(0x129),_0x2537e7(0x146)+_0x3e0bab);return inspectAppRuleContent(_0xa9ea0);}function a233_0x3ce8(_0x1f7f0f,_0x149a34){_0x1f7f0f=_0x1f7f0f-0x11a;const _0x236e25=a233_0x236e();let _0x3ce824=_0x236e25[_0x1f7f0f];return _0x3ce824;}export function projectAppRule(_0x5cdcbb,_0x1a78ba){const _0xafe061=a233_0x49873a;if(!_0x1a78ba)return{'type':_0x5cdcbb,'fileName':appRuleFileName(_0x5cdcbb),'contextScope':appRuleContextScope(_0x5cdcbb),'enabled':![]};const _0x252f43=inspectAppRuleContent(_0x1a78ba[_0xafe061(0x14e)]);return{'type':_0x5cdcbb,'fileName':appRuleFileName(_0x5cdcbb),'contextScope':appRuleContextScope(_0x5cdcbb),'enabled':!![],'id':_0x1a78ba['id'],'scope':_0x1a78ba[_0xafe061(0x14f)],'appCode':_0x1a78ba[_0xafe061(0x14d)],'version':_0x1a78ba[_0xafe061(0x126)],'contentByteSize':_0x252f43[_0xafe061(0x11b)],'contentHash':_0x252f43['contentHash'],..._0x1a78ba[_0xafe061(0x13f)]!==undefined&&_0x1a78ba['createTime']!==null?{'createTime':_0x1a78ba['createTime']}:{},..._0x1a78ba[_0xafe061(0x142)]!==undefined&&_0x1a78ba[_0xafe061(0x142)]!==null?{'updateTime':_0x1a78ba[_0xafe061(0x142)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':'type','type':'string','required':!![],'description':a233_0x49873a(0x12b),'enum':[...APP_RULE_TYPES]};
1
+ const a233_0x13cc01=a233_0x3006;(function(_0x2faf7e,_0x10b84a){const _0x313219=a233_0x3006,_0x1cb70e=_0x2faf7e();while(!![]){try{const _0x127995=parseInt(_0x313219(0x1aa))/0x1*(-parseInt(_0x313219(0x196))/0x2)+parseInt(_0x313219(0x1af))/0x3*(-parseInt(_0x313219(0x1c0))/0x4)+parseInt(_0x313219(0x1a3))/0x5*(parseInt(_0x313219(0x1b1))/0x6)+-parseInt(_0x313219(0x1b0))/0x7*(parseInt(_0x313219(0x1a0))/0x8)+parseInt(_0x313219(0x1b2))/0x9*(parseInt(_0x313219(0x1a7))/0xa)+-parseInt(_0x313219(0x1ab))/0xb*(parseInt(_0x313219(0x19d))/0xc)+parseInt(_0x313219(0x1bf))/0xd;if(_0x127995===_0x10b84a)break;else _0x1cb70e['push'](_0x1cb70e['shift']());}catch(_0x53fabd){_0x1cb70e['push'](_0x1cb70e['shift']());}}}(a233_0x1a39,0x9b168));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a233_0x13cc01(0x1a8),'database'];function a233_0x1a39(){const _0x56c222=['Pass\x20a\x20UTF-8\x20Markdown\x20file.','RULES.md','isFile','sha256','decode','page-api-development','10968EZguhc','version','app_rule_file_unreadable','24dEXQpQ','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','utf8','10JGXkIy','database','byteLength','content','10WkwYxk','rules','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','1KhJleN','5093INepHy','appCode','str','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','423kZgOzO','190407RxkaKK','1243722gWDtno','6594813PZfURF','app_rule_content_too_large','--file\x20is\x20required.','trim','createTime','Cannot\x20access\x20app\x20rule\x20file:\x20','update','contentHash','database-analysis','message','utf-8','app_rule_file_invalid','digest','4487158hcSxEV','6644eUOdsv','updateTime','string','app_rule_content_invalid','sha256:','toLowerCase','236542iebZKT'];a233_0x1a39=function(){return _0x56c222;};return a233_0x1a39();}function a233_0x3006(_0x3f0c81,_0x3602a2){_0x3f0c81=_0x3f0c81-0x194;const _0x1a39c5=a233_0x1a39();let _0x3006a9=_0x1a39c5[_0x3f0c81];return _0x3006a9;}export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a233_0x13cc01(0x198),'database':'DATABASE.md'},APP_RULE_CONTEXT_SCOPES={'rules':a233_0x13cc01(0x19c),'database':a233_0x13cc01(0x1ba)};export function appRuleError(_0x274301,_0x2e4055,_0x2eeef3){return new CliError(_0x274301,0x1,_0x2e4055,_0x2eeef3);}export function readAppRuleType(_0x2d6adb){const _0x30cb9e=a233_0x13cc01,_0x304a3a=_0x2d6adb[_0x30cb9e(0x1ad)]('type')[_0x30cb9e(0x1b5)]()[_0x30cb9e(0x195)]();if(_0x304a3a!==_0x30cb9e(0x1a8)&&_0x304a3a!==_0x30cb9e(0x1a4))throw appRuleError('app_rule_type_invalid','--type\x20must\x20be\x20either\x20rules\x20or\x20database.');return _0x304a3a;}export function appRuleFileName(_0x14a1c3){return APP_RULE_FILES[_0x14a1c3];}export function appRuleContextScope(_0x44f242){return APP_RULE_CONTEXT_SCOPES[_0x44f242];}export function inspectAppRuleContent(_0x2a8820){const _0xd4d806=a233_0x13cc01,_0xe3bf1b=Buffer['from'](_0x2a8820,_0xd4d806(0x1a2));return{'content':_0x2a8820,'byteSize':_0xe3bf1b[_0xd4d806(0x1a5)],'contentHash':_0xd4d806(0x194)+createHash(_0xd4d806(0x19a))[_0xd4d806(0x1b8)](_0xe3bf1b)[_0xd4d806(0x1be)]('hex')};}export async function readAppRuleFile(_0x436900){const _0x5f2f1d=a233_0x13cc01,_0x2ad766=_0x436900[_0x5f2f1d(0x1b5)]();if(!_0x2ad766)throw appRuleError('app_rule_file_required',_0x5f2f1d(0x1b4),_0x5f2f1d(0x197));const _0x1771c5=resolve(_0x2ad766);let _0x3931b3;try{_0x3931b3=await stat(_0x1771c5);}catch(_0x262184){throw appRuleError(_0x5f2f1d(0x19f),_0x5f2f1d(0x1b7)+_0x2ad766,_0x262184 instanceof Error?_0x262184[_0x5f2f1d(0x1bb)]:String(_0x262184));}if(!_0x3931b3[_0x5f2f1d(0x199)]())throw appRuleError(_0x5f2f1d(0x1bd),_0x5f2f1d(0x1a1)+_0x2ad766);if(_0x3931b3['size']>MAX_APP_RULE_BYTES)throw appRuleError(_0x5f2f1d(0x1b3),_0x5f2f1d(0x1ae));let _0x223fcc;try{_0x223fcc=await readFile(_0x1771c5);}catch(_0x57baa9){throw appRuleError(_0x5f2f1d(0x19f),'Cannot\x20read\x20app\x20rule\x20file:\x20'+_0x2ad766,_0x57baa9 instanceof Error?_0x57baa9[_0x5f2f1d(0x1bb)]:String(_0x57baa9));}if(_0x223fcc['byteLength']>MAX_APP_RULE_BYTES)throw appRuleError(_0x5f2f1d(0x1b3),'App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.');let _0x216143;try{_0x216143=new TextDecoder(_0x5f2f1d(0x1bc),{'fatal':!![],'ignoreBOM':!![]})[_0x5f2f1d(0x19b)](_0x223fcc);}catch{throw appRuleError(_0x5f2f1d(0x1c3),'App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20'+_0x2ad766);}if(!_0x216143['trim']())throw appRuleError(_0x5f2f1d(0x1c3),'App\x20rule\x20file\x20is\x20blank:\x20'+_0x2ad766);return inspectAppRuleContent(_0x216143);}export function projectAppRule(_0xb7805b,_0x30f4d7){const _0x1317ea=a233_0x13cc01;if(!_0x30f4d7)return{'type':_0xb7805b,'fileName':appRuleFileName(_0xb7805b),'contextScope':appRuleContextScope(_0xb7805b),'enabled':![]};const _0x59f450=inspectAppRuleContent(_0x30f4d7[_0x1317ea(0x1a6)]);return{'type':_0xb7805b,'fileName':appRuleFileName(_0xb7805b),'contextScope':appRuleContextScope(_0xb7805b),'enabled':!![],'id':_0x30f4d7['id'],'scope':_0x30f4d7['scope'],'appCode':_0x30f4d7[_0x1317ea(0x1ac)],'version':_0x30f4d7[_0x1317ea(0x19e)],'contentByteSize':_0x59f450['byteSize'],'contentHash':_0x59f450[_0x1317ea(0x1b9)],..._0x30f4d7[_0x1317ea(0x1b6)]!==undefined&&_0x30f4d7[_0x1317ea(0x1b6)]!==null?{'createTime':_0x30f4d7[_0x1317ea(0x1b6)]}:{},..._0x30f4d7['updateTime']!==undefined&&_0x30f4d7[_0x1317ea(0x1c1)]!==null?{'updateTime':_0x30f4d7['updateTime']}:{}};}export const APP_RULE_TYPE_FLAG={'name':'type','type':a233_0x13cc01(0x1c2),'required':!![],'description':a233_0x13cc01(0x1a9),'enum':[...APP_RULE_TYPES]};
@@ -1 +1 @@
1
- const a234_0xe707ed=a234_0xa91e;(function(_0x91b94,_0x5ad450){const _0x5e7e5d=a234_0xa91e,_0x5ca4fc=_0x91b94();while(!![]){try{const _0x4bba92=-parseInt(_0x5e7e5d(0x1d4))/0x1+-parseInt(_0x5e7e5d(0x1f8))/0x2+-parseInt(_0x5e7e5d(0x1cf))/0x3+parseInt(_0x5e7e5d(0x1f7))/0x4+-parseInt(_0x5e7e5d(0x1f6))/0x5+parseInt(_0x5e7e5d(0x1c4))/0x6*(-parseInt(_0x5e7e5d(0x1f5))/0x7)+-parseInt(_0x5e7e5d(0x1ef))/0x8*(-parseInt(_0x5e7e5d(0x1de))/0x9);if(_0x4bba92===_0x5ad450)break;else _0x5ca4fc['push'](_0x5ca4fc['shift']());}catch(_0x189247){_0x5ca4fc['push'](_0x5ca4fc['shift']());}}}(a234_0x5709,0x72a11));import{readFileSync,existsSync}from'node:fs';function a234_0x5709(){const _0x2f77bc=['\x20run\x20start','watch','Run\x20a\x20package.json\x20script','bun.lockb','has','length','inherit','2326920VjTFxy','run','package.json','.bin','dev','546945swVfNP','boolean','log','keys','cwd','\x20\x20\x20\x20','Domain\x20routing\x20synchronized:\x20','join','utf-8','preview','9kUAyBV','path','changed','\x20run\x20','error','validation','parse','\x20run\x20<script>\x0a','\x20run\x20preview','bun.lock','\x20exited\x20with\x20code\x20','No\x20scripts\x20defined\x20in\x20package.json.','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','node_modules','belowMinimum','build','(none)','20883608GEFMEV','Available:\x20','\x0a\x20\x20Usage:\x20','npm','needsUpgrade','scripts','19733IWsFIx','2522040gCElpS','2042956JZooNf','1249054ADszCE','\x20\x20EXAMPLES','args','vite','close','Script\x20\x22','push','pnpm','yarn.lock','Enable\x20watch\x20mode\x20for\x20preview','426irlsHE','start','yarn','bool'];a234_0x5709=function(){return _0x2f77bc;};return a234_0x5709();}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([a234_0xe707ed(0x1c5),a234_0xe707ed(0x1d3)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a234_0xe707ed(0x1c5),a234_0xe707ed(0x1d3),a234_0xe707ed(0x1ed),a234_0xe707ed(0x1dd)]);export function syncProjectDomainRoutingBeforeScript(_0x27daff,_0x6dc0bf){const _0x2df99a=a234_0xe707ed;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x2df99a(0x1cc)](_0x6dc0bf))return null;const _0x1d83b3=findProjectRootDirectory(_0x27daff);if(!resolveConfigPath(_0x1d83b3))return null;const _0x2e1865=writeProjectDomainRoutingManifest(_0x1d83b3);return{'path':_0x2e1865[_0x2df99a(0x1df)],'changed':_0x2e1865[_0x2df99a(0x1e0)]};}function a234_0xa91e(_0x2f71b5,_0x1ec80e){_0x2f71b5=_0x2f71b5-0x1bb;const _0x570986=a234_0x5709();let _0xa91e18=_0x570986[_0x2f71b5];return _0xa91e18;}function readPackageScripts(_0x2fd26d){const _0x5559cc=a234_0xe707ed,_0x2c1abf=resolve(_0x2fd26d,_0x5559cc(0x1d1));if(!existsSync(_0x2c1abf))return null;try{const _0x18efed=JSON[_0x5559cc(0x1e4)](readFileSync(_0x2c1abf,_0x5559cc(0x1dc)));return _0x18efed[_0x5559cc(0x1f4)]??{};}catch{return null;}}function detectPackageManager(_0x4b01a5){const _0x2426d1=a234_0xe707ed;if(existsSync(resolve(_0x4b01a5,_0x2426d1(0x1cb)))||existsSync(resolve(_0x4b01a5,_0x2426d1(0x1e7))))return'bun';if(existsSync(resolve(_0x4b01a5,'pnpm-lock.yaml')))return _0x2426d1(0x1c1);if(existsSync(resolve(_0x4b01a5,_0x2426d1(0x1c2))))return _0x2426d1(0x1c6);return _0x2426d1(0x1f2);}async function versionCheck(_0x3f56d0){const _0x587991=a234_0xe707ed,_0x4f18a9=await checkCliVersion();(_0x4f18a9[_0x587991(0x1f3)]||_0x4f18a9[_0x587991(0x1ec)])&&(printCliUpgradeWarning(_0x4f18a9),assertCliVersionSupported(_0x4f18a9));const _0x355a97=await checkSdkVersion(_0x3f56d0);if(_0x355a97['needsUpgrade'])printSdkUpgradeWarning(_0x355a97);}function spawnScript(_0x5e6007,_0x52a794,_0x1a161f,_0x33b945){return new Promise((_0x5df588,_0x4a4b29)=>{const _0x446c0e=a234_0xa91e,_0x2ff5d5=['run',_0x52a794,..._0x1a161f],_0x4b8977=spawn(_0x5e6007,_0x2ff5d5,{'cwd':_0x33b945,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x33b945,'node_modules',_0x446c0e(0x1d2))+delimiter+process.env.PATH}});_0x4b8977['on'](_0x446c0e(0x1be),_0x5426f9=>{const _0x4bbbc4=_0x446c0e;if(_0x5426f9===0x0||_0x5426f9===null)_0x5df588();else _0x4a4b29(new Error(_0x5e6007+_0x4bbbc4(0x1e1)+_0x52a794+_0x4bbbc4(0x1e8)+_0x5426f9));}),_0x4b8977['on'](_0x446c0e(0x1e2),_0x4a4b29);});}function spawnViteBuildWatch(_0x319a99){return new Promise((_0x43a3f5,_0x21d441)=>{const _0x320a95=a234_0xa91e,_0xe0a189=spawn(_0x320a95(0x1bd),[_0x320a95(0x1ed),'--watch'],{'cwd':_0x319a99,'stdio':_0x320a95(0x1ce),'shell':!![],'env':{...process.env,'PATH':''+join(_0x319a99,_0x320a95(0x1eb),'.bin')+delimiter+process.env.PATH}});_0xe0a189['on'](_0x320a95(0x1be),_0x464800=>{const _0x5f5bb6=_0x320a95;if(_0x464800===0x0||_0x464800===null)_0x43a3f5();else _0x21d441(new Error(_0x5f5bb6(0x1ea)+_0x464800));}),_0xe0a189['on'](_0x320a95(0x1e2),_0x21d441);});}function spawnVitePreview(_0x5d0090){return new Promise((_0x181bc0,_0x4978e6)=>{const _0x4a6a00=a234_0xa91e,_0x33bc49=spawn(_0x4a6a00(0x1bd),[_0x4a6a00(0x1dd)],{'cwd':_0x5d0090,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x5d0090,'node_modules',_0x4a6a00(0x1d2))+delimiter+process.env.PATH}});_0x33bc49['on'](_0x4a6a00(0x1be),_0x46340c=>{if(_0x46340c===0x0||_0x46340c===null)_0x181bc0();else _0x4978e6(new Error('vite\x20preview\x20exited\x20with\x20code\x20'+_0x46340c));}),_0x33bc49['on'](_0x4a6a00(0x1e2),_0x4978e6);});}const runFlags=[{'name':'watch','type':a234_0xe707ed(0x1d5),'description':a234_0xe707ed(0x1c3),'default':![]}];export const runDefinition={'service':'run','command':a234_0xe707ed(0x1d0),'description':a234_0xe707ed(0x1ca),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x4d1204=a234_0xe707ed,_0x5ac213=[];return _0x5ac213['push'](_0x4d1204(0x1bb)),_0x5ac213['push'](_0x4d1204(0x1d9)+CLI_BIN_NAME+_0x4d1204(0x1c8)),_0x5ac213[_0x4d1204(0x1c0)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20build'),_0x5ac213[_0x4d1204(0x1c0)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x4d1204(0x1e6)),_0x5ac213[_0x4d1204(0x1c0)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x5ac213[_0x4d1204(0x1db)]('\x0a');},async 'execute'(_0x3f5330){const _0x338e33=a234_0xe707ed,_0x1e8132=process[_0x338e33(0x1d8)](),_0x530d4e=_0x3f5330['args'][0x0],_0x149433=_0x3f5330[_0x338e33(0x1bc)]['slice'](0x1),_0x13811c=readPackageScripts(_0x1e8132);if(!_0x13811c)throw CliErrors[_0x338e33(0x1e3)]('No\x20package.json\x20found\x20in\x20current\x20directory.');if(!_0x530d4e){const _0x3f0d8a=Object[_0x338e33(0x1d7)](_0x13811c);if(_0x3f0d8a[_0x338e33(0x1cd)]===0x0)console[_0x338e33(0x1d6)](_0x338e33(0x1e9));else{console[_0x338e33(0x1d6)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x2d58c6 of _0x3f0d8a){console[_0x338e33(0x1d6)](_0x338e33(0x1d9)+_0x2d58c6);}console[_0x338e33(0x1d6)](_0x338e33(0x1f1)+CLI_BIN_NAME+_0x338e33(0x1e5));}return{'ok':!![]};}if(!_0x13811c[_0x530d4e])throw CliErrors['validation'](_0x338e33(0x1bf)+_0x530d4e+'\x22\x20not\x20found\x20in\x20package.json.',_0x338e33(0x1f0)+(Object[_0x338e33(0x1d7)](_0x13811c)['join'](',\x20')||_0x338e33(0x1ee)));const _0x86ab5a=detectPackageManager(_0x1e8132),_0x3d9761=syncProjectDomainRoutingBeforeScript(_0x1e8132,_0x530d4e);_0x3d9761?.[_0x338e33(0x1e0)]&&console[_0x338e33(0x1e2)](_0x338e33(0x1da)+_0x3d9761[_0x338e33(0x1df)]);VERSION_CHECK_SCRIPTS[_0x338e33(0x1cc)](_0x530d4e)&&await versionCheck(_0x1e8132);if(_0x530d4e===_0x338e33(0x1dd)&&_0x3f5330[_0x338e33(0x1c7)](_0x338e33(0x1c9)))return await Promise['all']([spawnViteBuildWatch(_0x1e8132),spawnVitePreview(_0x1e8132)]),{'ok':!![]};return await spawnScript(_0x86ab5a,_0x530d4e,_0x149433,_0x1e8132),{'ok':!![]};}};
1
+ const a234_0x12af2a=a234_0x197d;(function(_0x150780,_0x22aae1){const _0x4fc15e=a234_0x197d,_0x2fe1ff=_0x150780();while(!![]){try{const _0x1ee6c8=-parseInt(_0x4fc15e(0xf1))/0x1*(-parseInt(_0x4fc15e(0x10b))/0x2)+parseInt(_0x4fc15e(0x105))/0x3*(-parseInt(_0x4fc15e(0xdf))/0x4)+-parseInt(_0x4fc15e(0xea))/0x5+parseInt(_0x4fc15e(0x109))/0x6+-parseInt(_0x4fc15e(0x100))/0x7*(-parseInt(_0x4fc15e(0xcf))/0x8)+-parseInt(_0x4fc15e(0xd5))/0x9*(parseInt(_0x4fc15e(0xe8))/0xa)+parseInt(_0x4fc15e(0x107))/0xb;if(_0x1ee6c8===_0x22aae1)break;else _0x2fe1ff['push'](_0x2fe1ff['shift']());}catch(_0x3d37c8){_0x2fe1ff['push'](_0x2fe1ff['shift']());}}}(a234_0x1458,0xe67a0));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_0x12af2a(0xe1)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a234_0x12af2a(0xd2),a234_0x12af2a(0xe1),a234_0x12af2a(0xfa),'preview']);export function syncProjectDomainRoutingBeforeScript(_0x3b3d13,_0x5bdad4){const _0x489e7c=a234_0x12af2a;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x489e7c(0xd8)](_0x5bdad4))return null;const _0x430c3b=findProjectRootDirectory(_0x3b3d13);if(!resolveConfigPath(_0x430c3b))return null;const _0x944011=writeProjectDomainRoutingManifest(_0x430c3b);return{'path':_0x944011['path'],'changed':_0x944011[_0x489e7c(0xe6)]};}function readPackageScripts(_0x426dd8){const _0x3d3cd7=a234_0x12af2a,_0x59bc9d=resolve(_0x426dd8,_0x3d3cd7(0xda));if(!existsSync(_0x59bc9d))return null;try{const _0x35d960=JSON['parse'](readFileSync(_0x59bc9d,_0x3d3cd7(0xf9)));return _0x35d960['scripts']??{};}catch{return null;}}function detectPackageManager(_0x472d44){const _0x96a2a9=a234_0x12af2a;if(existsSync(resolve(_0x472d44,'bun.lockb'))||existsSync(resolve(_0x472d44,_0x96a2a9(0x106))))return _0x96a2a9(0xdd);if(existsSync(resolve(_0x472d44,'pnpm-lock.yaml')))return _0x96a2a9(0x104);if(existsSync(resolve(_0x472d44,'yarn.lock')))return _0x96a2a9(0xd1);return _0x96a2a9(0xfc);}async function versionCheck(_0xa008ee){const _0x583473=a234_0x12af2a,_0x1eeadf=await checkCliVersion();(_0x1eeadf[_0x583473(0xe2)]||_0x1eeadf[_0x583473(0xe9)])&&(printCliUpgradeWarning(_0x1eeadf),assertCliVersionSupported(_0x1eeadf));const _0x2032a5=await checkSdkVersion(_0xa008ee);if(_0x2032a5[_0x583473(0xe2)])printSdkUpgradeWarning(_0x2032a5);}function spawnScript(_0x238b75,_0x15a68b,_0x11fcd6,_0x13b066){return new Promise((_0x23be30,_0x505f89)=>{const _0x545084=a234_0x197d,_0x13fde7=[_0x545084(0xfe),_0x15a68b,..._0x11fcd6],_0x1eb0e5=spawn(_0x238b75,_0x13fde7,{'cwd':_0x13b066,'stdio':_0x545084(0xf4),'shell':!![],'env':{...process.env,'PATH':''+join(_0x13b066,_0x545084(0xdc),'.bin')+delimiter+process.env.PATH}});_0x1eb0e5['on'](_0x545084(0xf8),_0x4caa33=>{const _0x4c12dc=_0x545084;if(_0x4caa33===0x0||_0x4caa33===null)_0x23be30();else _0x505f89(new Error(_0x238b75+_0x4c12dc(0x103)+_0x15a68b+_0x4c12dc(0xed)+_0x4caa33));}),_0x1eb0e5['on'](_0x545084(0xd6),_0x505f89);});}function spawnViteBuildWatch(_0x1d30ac){return new Promise((_0x1e86cf,_0x1a01b5)=>{const _0x47637b=a234_0x197d,_0x117436=spawn(_0x47637b(0xfd),[_0x47637b(0xfa),_0x47637b(0xd7)],{'cwd':_0x1d30ac,'stdio':_0x47637b(0xf4),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1d30ac,_0x47637b(0xdc),'.bin')+delimiter+process.env.PATH}});_0x117436['on'](_0x47637b(0xf8),_0x50ca71=>{const _0x20f685=_0x47637b;if(_0x50ca71===0x0||_0x50ca71===null)_0x1e86cf();else _0x1a01b5(new Error(_0x20f685(0x10c)+_0x50ca71));}),_0x117436['on']('error',_0x1a01b5);});}function spawnVitePreview(_0x1f472e){return new Promise((_0x46e34d,_0xdd28d2)=>{const _0x45da50=a234_0x197d,_0x101736=spawn(_0x45da50(0xfd),[_0x45da50(0x10a)],{'cwd':_0x1f472e,'stdio':_0x45da50(0xf4),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1f472e,_0x45da50(0xdc),_0x45da50(0xd0))+delimiter+process.env.PATH}});_0x101736['on'](_0x45da50(0xf8),_0x467b37=>{const _0x15d2f1=_0x45da50;if(_0x467b37===0x0||_0x467b37===null)_0x46e34d();else _0xdd28d2(new Error(_0x15d2f1(0xd9)+_0x467b37));}),_0x101736['on'](_0x45da50(0xd6),_0xdd28d2);});}function a234_0x197d(_0x2dba8e,_0x531407){_0x2dba8e=_0x2dba8e-0xcf;const _0x1458e3=a234_0x1458();let _0x197dae=_0x1458e3[_0x2dba8e];return _0x197dae;}const runFlags=[{'name':'watch','type':'boolean','description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];function a234_0x1458(){const _0x5c746c=['vite','run','\x22\x20not\x20found\x20in\x20package.json.','178507LhdXsV','cwd','validation','\x20run\x20','pnpm','71943GToVUl','bun.lock','24797190esTKzK','Script\x20\x22','742014dxyIjN','preview','142226DHbJhx','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','No\x20scripts\x20defined\x20in\x20package.json.','Domain\x20routing\x20synchronized:\x20','408VwJNgR','.bin','yarn','start','\x20\x20EXAMPLES','No\x20package.json\x20found\x20in\x20current\x20directory.','12237921cqlkAM','error','--watch','has','vite\x20preview\x20exited\x20with\x20code\x20','package.json','Script\x20name\x20defined\x20in\x20package.json','node_modules','bun','push','172SPvYRm','length','dev','needsUpgrade','log','keys','(none)','changed','\x0a\x20\x20Usage:\x20','10HfOpOa','belowMinimum','9184495FVCNMo','\x20run\x20start','path','\x20exited\x20with\x20code\x20','\x20\x20\x20\x20','write','script','21JuMsrw','join','all','inherit','args','\x20run\x20<script>\x0a','\x20run\x20preview','close','utf-8','build','Available:\x20','npm'];a234_0x1458=function(){return _0x5c746c;};return a234_0x1458();}export const runDefinition={'service':'run','command':'run','description':'Run\x20a\x20package.json\x20script','risk':a234_0x12af2a(0xef),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a234_0x12af2a(0xf0),'description':a234_0x12af2a(0xdb),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x4f8ddf=a234_0x12af2a,_0x4d35de=[];return _0x4d35de[_0x4f8ddf(0xde)](_0x4f8ddf(0xd3)),_0x4d35de[_0x4f8ddf(0xde)](_0x4f8ddf(0xee)+CLI_BIN_NAME+_0x4f8ddf(0xeb)),_0x4d35de['push'](_0x4f8ddf(0xee)+CLI_BIN_NAME+'\x20run\x20build'),_0x4d35de[_0x4f8ddf(0xde)](_0x4f8ddf(0xee)+CLI_BIN_NAME+_0x4f8ddf(0xf7)),_0x4d35de[_0x4f8ddf(0xde)](_0x4f8ddf(0xee)+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x4d35de['join']('\x0a');},async 'execute'(_0x3d17e6){const _0x35c881=a234_0x12af2a,_0x42d6be=process[_0x35c881(0x101)](),_0x4017d7=_0x3d17e6[_0x35c881(0xf5)][0x0],_0xe1251e=_0x3d17e6[_0x35c881(0xf5)]['slice'](0x1),_0x4e598d=readPackageScripts(_0x42d6be);if(!_0x4e598d)throw CliErrors[_0x35c881(0x102)](_0x35c881(0xd4));if(!_0x4017d7){const _0x5a58f7=Object[_0x35c881(0xe4)](_0x4e598d);if(_0x5a58f7[_0x35c881(0xe0)]===0x0)console[_0x35c881(0xe3)](_0x35c881(0x10d));else{console[_0x35c881(0xe3)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x4bbd4d of _0x5a58f7){console[_0x35c881(0xe3)]('\x20\x20\x20\x20'+_0x4bbd4d);}console[_0x35c881(0xe3)](_0x35c881(0xe7)+CLI_BIN_NAME+_0x35c881(0xf6));}return{'ok':!![]};}if(!_0x4e598d[_0x4017d7])throw CliErrors[_0x35c881(0x102)](_0x35c881(0x108)+_0x4017d7+_0x35c881(0xff),_0x35c881(0xfb)+(Object[_0x35c881(0xe4)](_0x4e598d)[_0x35c881(0xf2)](',\x20')||_0x35c881(0xe5)));const _0x257104=detectPackageManager(_0x42d6be),_0x17b3c8=syncProjectDomainRoutingBeforeScript(_0x42d6be,_0x4017d7);_0x17b3c8?.[_0x35c881(0xe6)]&&console[_0x35c881(0xd6)](_0x35c881(0x10e)+_0x17b3c8[_0x35c881(0xec)]);VERSION_CHECK_SCRIPTS[_0x35c881(0xd8)](_0x4017d7)&&await versionCheck(_0x42d6be);if(_0x4017d7===_0x35c881(0x10a)&&_0x3d17e6['bool']('watch'))return await Promise[_0x35c881(0xf3)]([spawnViteBuildWatch(_0x42d6be),spawnVitePreview(_0x42d6be)]),{'ok':!![]};return await spawnScript(_0x257104,_0x4017d7,_0xe1251e,_0x42d6be),{'ok':!![]};}};
@@ -1 +1 @@
1
- function a235_0x1378(_0x78e9d5,_0x2faaaa){_0x78e9d5=_0x78e9d5-0x93;const _0x455f9e=a235_0x455f();let _0x13787c=_0x455f9e[_0x78e9d5];return _0x13787c;}const a235_0x30f963=a235_0x1378;(function(_0x1da63c,_0xd2c8f2){const _0x1e2194=a235_0x1378,_0x3435fe=_0x1da63c();while(!![]){try{const _0x672e58=parseInt(_0x1e2194(0x97))/0x1+parseInt(_0x1e2194(0x9b))/0x2*(-parseInt(_0x1e2194(0x9e))/0x3)+-parseInt(_0x1e2194(0x99))/0x4+-parseInt(_0x1e2194(0x9f))/0x5+-parseInt(_0x1e2194(0x9c))/0x6*(-parseInt(_0x1e2194(0x98))/0x7)+parseInt(_0x1e2194(0x9d))/0x8*(-parseInt(_0x1e2194(0x95))/0x9)+parseInt(_0x1e2194(0x94))/0xa*(parseInt(_0x1e2194(0xa0))/0xb);if(_0x672e58===_0xd2c8f2)break;else _0x3435fe['push'](_0x3435fe['shift']());}catch(_0x5ae38c){_0x3435fe['push'](_0x3435fe['shift']());}}}(a235_0x455f,0x7b7f3));function a235_0x455f(){const _0x384dac=['read','546711zysaaR','1894655rzKJCD','946388CuFtrR','json','6DczjWN','6DQxtwm','417400ddYOHF','967728YDhVdK','1340580UzxLKk','49027YorWWD','schema','3190kICXXo','45ZnPAfM'];a235_0x455f=function(){return _0x384dac;};return a235_0x455f();}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x22df2e){const _0x2597f6=await buildSchemaPayload();return{'ok':!![],'data':_0x2597f6};}export const schemaDefinition={'service':a235_0x30f963(0x93),'command':'export','description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a235_0x30f963(0x96),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a235_0x30f963(0x9a),'flags':[],'execute':execute};
1
+ const a235_0x14fc67=a235_0x4608;(function(_0x5f0a3e,_0x4ffdba){const _0x3e89cf=a235_0x4608,_0x2910f9=_0x5f0a3e();while(!![]){try{const _0xb02c9d=-parseInt(_0x3e89cf(0xc4))/0x1+parseInt(_0x3e89cf(0xc7))/0x2+-parseInt(_0x3e89cf(0xc5))/0x3+parseInt(_0x3e89cf(0xc2))/0x4*(-parseInt(_0x3e89cf(0xbf))/0x5)+-parseInt(_0x3e89cf(0xc8))/0x6+-parseInt(_0x3e89cf(0xc3))/0x7+-parseInt(_0x3e89cf(0xc9))/0x8*(-parseInt(_0x3e89cf(0xc0))/0x9);if(_0xb02c9d===_0x4ffdba)break;else _0x2910f9['push'](_0x2910f9['shift']());}catch(_0x17ffba){_0x2910f9['push'](_0x2910f9['shift']());}}}(a235_0x271a,0xd2de7));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x3f62af){const _0x520b07=await buildSchemaPayload();return{'ok':!![],'data':_0x520b07};}function a235_0x4608(_0x2824c8,_0x24ba72){_0x2824c8=_0x2824c8-0xbf;const _0x271a78=a235_0x271a();let _0x4608c0=_0x271a78[_0x2824c8];return _0x4608c0;}function a235_0x271a(){const _0x1d9020=['json','2943320oONycv','1494720aRwfpg','224ybgBtA','1866190qHpeYz','257571piCpvU','export','4CGspEi','3412465JlOFoa','162148ihlcVm','411816EcKRKX'];a235_0x271a=function(){return _0x1d9020;};return a235_0x271a();}export const schemaDefinition={'service':'schema','command':a235_0x14fc67(0xc1),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a235_0x14fc67(0xc6),'flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a236_0x1c20ff=a236_0x5cfa;function a236_0x5cfa(_0x2e12a8,_0x45522b){_0x2e12a8=_0x2e12a8-0x11b;const _0xb2aae2=a236_0xb2aa();let _0x5cfab2=_0xb2aae2[_0x2e12a8];return _0x5cfab2;}(function(_0x2ae1af,_0x121762){const _0x39175a=a236_0x5cfa,_0x36a738=_0x2ae1af();while(!![]){try{const _0x54ed99=-parseInt(_0x39175a(0x134))/0x1*(-parseInt(_0x39175a(0x11d))/0x2)+parseInt(_0x39175a(0x129))/0x3+parseInt(_0x39175a(0x140))/0x4+-parseInt(_0x39175a(0x15a))/0x5+-parseInt(_0x39175a(0x125))/0x6*(-parseInt(_0x39175a(0x12c))/0x7)+parseInt(_0x39175a(0x13f))/0x8*(-parseInt(_0x39175a(0x124))/0x9)+-parseInt(_0x39175a(0x157))/0xa*(-parseInt(_0x39175a(0x15d))/0xb);if(_0x54ed99===_0x121762)break;else _0x36a738['push'](_0x36a738['shift']());}catch(_0x3ffea3){_0x36a738['push'](_0x36a738['shift']());}}}(a236_0xb2aa,0x83537));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';function a236_0xb2aa(){const _0x4cf32d=['dbId\x20must\x20be\x20a\x20positive\x20integer','str','sqlCode','join','MyBatis\x20XML\x20(mybatisXml)','lastSync','number','flag','Plain\x20SQL\x20(sql)','Target\x20database\x20dbId:','name','✎\x20Enter\x20dbId\x20manually','flagMissing','trim','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','db-id','3340tlNKyZ','nonInteractive','File\x20already\x20exists:\x20','1413095Azhtbb','description','sql','1254IJkKlp','length','isFinite','SELECT\x201\x20AS\x20id;','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','mybatisXml','stringify','9248ZWqUWf','toISOString','</select>','lockFilePath','dbName','Invalid\x20database\x20selection\x20payload:\x20','Select\x20the\x20target\x20database:','414eTerbV','18CdqtaX','dbId\x20cannot\x20be\x20empty','validation','Local\x20SQL\x20file\x20mode','1741254SwBpDT','__manual__','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','108143qdoTME','Created\x20SQL\x20query\x20','parse','sqlName','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','<server-generated-sqlCode>','new','SQL\x20name\x20cannot\x20be\x20empty','63leUehy','POST','\x20\x20SELECT\x201\x20AS\x20id','catch','/smartapi/custom/saveUserCustomSql','Select\x20the\x20local\x20SQL\x20mode:','string','sqls','mode','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','dbId','134200HBrrBT','2544108aBKPyy','sqlRootDir','map','appCode','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','isInteger'];a236_0xb2aa=function(){return _0x4cf32d;};return a236_0xb2aa();}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(_0x400352){const _0x1b3a4b=a236_0x5cfa;if(_0x400352===_0x1b3a4b(0x11b))return[_0x1b3a4b(0x145),_0x1b3a4b(0x136),_0x1b3a4b(0x11f),'']['join']('\x0a');return[_0x1b3a4b(0x160),''][_0x1b3a4b(0x14a)]('\x0a');}export const sqlCreate={'service':'sql','command':'create','description':a236_0x1c20ff(0x12b),'risk':'write','flags':[{'name':a236_0x1c20ff(0x151),'type':a236_0x1c20ff(0x13a),'description':'SQL\x20query\x20display\x20name'},{'name':a236_0x1c20ff(0x156),'type':a236_0x1c20ff(0x14d),'description':'Target\x20database\x20ID'},{'name':a236_0x1c20ff(0x13c),'type':'string','enum':[a236_0x1c20ff(0x15c),a236_0x1c20ff(0x11b)],'description':a236_0x1c20ff(0x128)}],async 'validate'(_0x1c9420){const _0x623109=a236_0x1c20ff;if(!_0x1c9420[_0x623109(0x158)])return;if(!_0x1c9420[_0x623109(0x148)]('name')['trim']())throw CliErrors[_0x623109(0x153)](_0x623109(0x151),_0x623109(0x13d));const _0x3ce426=resolveProvidedDbId(_0x1c9420);if(typeof _0x3ce426!=='number'||!Number[_0x623109(0x15f)](_0x3ce426)||_0x3ce426<=0x0)throw CliErrors['flagMissing'](_0x623109(0x156),_0x623109(0x144));if(!_0x1c9420[_0x623109(0x148)](_0x623109(0x13c))[_0x623109(0x154)]())throw CliErrors[_0x623109(0x153)](_0x623109(0x13c),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x2238fa){const _0x37eaf3=a236_0x1c20ff,_0x5aac33=loadSqlProjectConfig(_0x2238fa[_0x37eaf3(0x143)]),{sqlName:_0xa19b18,dbId:_0x4da386,dbName:_0x273cbd,mode:_0x1d7689}=await resolveSqlNewInputs(_0x2238fa),_0x3d2046=buildSqlRelativePath(_0x37eaf3(0x131),_0xa19b18,_0x273cbd,_0x1d7689,_0x4da386),_0x17f7a2=_0x5aac33[_0x37eaf3(0x141)]+'/'+_0x3d2046;return{'method':_0x37eaf3(0x135),'url':_0x37eaf3(0x138),'body':{'appCode':_0x2238fa['appCode'],'sqlName':_0xa19b18,'dbId':_0x4da386,'mode':_0x1d7689,'localPath':_0x17f7a2},'description':_0x37eaf3(0x155)+_0x5aac33['sqlRootDir']};},async 'execute'(_0x3a0a4b){const _0x2a882a=a236_0x1c20ff,_0x3501da=loadSqlProjectConfig(_0x3a0a4b['appCode']),{sqlName:_0x33c481,dbId:_0x1bb2e8,dbName:_0x5f2b25,mode:_0x5bb08c}=await resolveSqlNewInputs(_0x3a0a4b),_0x5b064d=generateSqlTemplate(_0x5bb08c),_0xbd04dd=await createSqlQuery({'appCode':_0x3a0a4b['appCode'],'sqlName':_0x33c481,'dbId':_0x1bb2e8,'sqlContent':_0x5b064d}),_0x18b9f4=ensureRemoteSqlContent(_0xbd04dd),_0x2a6551=_0x5f2b25||await getDbName(_0x3a0a4b['appCode'],_0x1bb2e8)[_0x2a882a(0x137)](()=>undefined),_0x2a00f9=buildSqlRelativePath(_0xbd04dd['sqlCode'],_0xbd04dd[_0x2a882a(0x12f)],_0x2a6551,_0x5bb08c,_0x1bb2e8),_0x93daf9=_0x3501da[_0x2a882a(0x141)]+'/'+_0x2a00f9,_0x146866=buildLocalSqlFileContent({'sqlCode':_0xbd04dd[_0x2a882a(0x149)],'sqlName':_0xbd04dd[_0x2a882a(0x12f)],'dbId':_0xbd04dd['dbId']},_0x18b9f4,{'dbName':_0x2a6551,'mode':_0x5bb08c,'syncedAt':new Date()['toISOString'](),'description':_0xbd04dd[_0x2a882a(0x15b)]});if(await fileExists(_0x93daf9))throw CliErrors[_0x2a882a(0x127)](_0x2a882a(0x159)+_0x93daf9);await ensureParentDirectory(_0x93daf9),await writeFile(_0x93daf9,_0x146866,'utf8');const _0x520f22=await readSqlLockFile(_0x3501da[_0x2a882a(0x120)]),{lockData:_0x1297e2,appLock:_0x47a3a0}=ensureSqlLockScope(_0x520f22??createEmptySqlLock(),_0x3501da[_0x2a882a(0x143)],_0x3501da['sqlRoot'],_0x2a882a(0x132));return _0x47a3a0[_0x2a882a(0x13b)][_0xbd04dd[_0x2a882a(0x149)]]={...buildSqlLockEntry(_0xbd04dd,_0x18b9f4,computeSqlContentHash(_0x146866),{'dbName':_0x2a6551}),'path':_0x2a00f9,'mode':_0x5bb08c},_0x47a3a0[_0x2a882a(0x14c)]=new Date()[_0x2a882a(0x11e)](),await writeSqlLockFile(_0x3501da[_0x2a882a(0x120)],_0x1297e2),{'ok':!![],'data':{'id':_0xbd04dd['id'],'sqlCode':_0xbd04dd['sqlCode'],'sqlName':_0xbd04dd['sqlName'],'dbId':_0xbd04dd['dbId'],'path':_0x93daf9,'mode':_0x5bb08c},'message':_0x2a882a(0x12d)+_0xbd04dd['sqlCode']};}};async function resolveSqlNewInputs(_0x2c6616){const _0x2d1de0=await resolveSqlNameInput(_0x2c6616),{dbId:_0x9829be,dbName:_0x43941a}=await resolveDbSelection(_0x2c6616),_0x23939a=await resolveSqlModeInput(_0x2c6616);return{'sqlName':_0x2d1de0,'dbId':_0x9829be,'dbName':_0x43941a,'mode':_0x23939a};}async function resolveSqlNameInput(_0x4366fd){const _0x3a0e76=a236_0x1c20ff,_0x3a8ee3=_0x4366fd[_0x3a0e76(0x148)](_0x3a0e76(0x151))[_0x3a0e76(0x154)]();if(_0x3a8ee3)return _0x3a8ee3;if(_0x4366fd[_0x3a0e76(0x158)])throw CliErrors['flagMissing'](_0x3a0e76(0x151),_0x3a0e76(0x13d));return(await input({'message':'SQL\x20name:','validate':_0x5c9510=>_0x5c9510[_0x3a0e76(0x154)]()?!![]:_0x3a0e76(0x133)}))[_0x3a0e76(0x154)]();}async function resolveDbSelection(_0x312a16){const _0x4811b5=a236_0x1c20ff,_0x24ec91=resolveProvidedDbId(_0x312a16);if(typeof _0x24ec91===_0x4811b5(0x14d)&&Number[_0x4811b5(0x15f)](_0x24ec91)&&_0x24ec91>0x0)return{'dbId':_0x24ec91,'dbName':await getDbName(_0x312a16[_0x4811b5(0x143)],_0x24ec91)[_0x4811b5(0x137)](()=>undefined)};if(_0x312a16[_0x4811b5(0x158)])throw CliErrors['flagMissing']('db-id','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x1213e1=await listDatabases(_0x312a16[_0x4811b5(0x143)])['catch'](()=>[]);if(_0x1213e1[_0x4811b5(0x15e)]===0x1)return{'dbId':_0x1213e1[0x0][_0x4811b5(0x13e)],'dbName':_0x1213e1[0x0]['dbName']};if(_0x1213e1[_0x4811b5(0x15e)]>0x1){const _0x452db4=await select({'message':_0x4811b5(0x123),'choices':[..._0x1213e1[_0x4811b5(0x142)](_0x2db259=>({'name':_0x2db259[_0x4811b5(0x121)]+'\x20('+_0x2db259[_0x4811b5(0x13e)]+')','value':serializeDbSelection(_0x2db259)})),{'name':_0x4811b5(0x152),'value':_0x4811b5(0x12a)}]});if(_0x452db4!==_0x4811b5(0x12a))return deserializeDbSelection(_0x452db4);}const _0x290741=await input({'message':_0x4811b5(0x150),'validate':_0x6ead5f=>{const _0x507d1f=_0x4811b5,_0x3e51a8=_0x6ead5f[_0x507d1f(0x154)]();if(!_0x3e51a8)return _0x507d1f(0x126);const _0x39be29=Number(_0x3e51a8);if(!Number[_0x507d1f(0x146)](_0x39be29)||_0x39be29<=0x0)return _0x507d1f(0x147);return!![];}});return{'dbId':Number(_0x290741[_0x4811b5(0x154)]())};}async function resolveSqlModeInput(_0xaaedb3){const _0x4950ce=a236_0x1c20ff,_0x4147b4=_0xaaedb3[_0x4950ce(0x148)](_0x4950ce(0x13c))[_0x4950ce(0x154)]();if(_0x4147b4===_0x4950ce(0x15c)||_0x4147b4===_0x4950ce(0x11b))return _0x4147b4;if(_0xaaedb3[_0x4950ce(0x158)])throw CliErrors[_0x4950ce(0x153)](_0x4950ce(0x13c),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x4950ce(0x139),'choices':[{'name':_0x4950ce(0x14f),'value':_0x4950ce(0x15c),'description':_0x4950ce(0x161)},{'name':_0x4950ce(0x14b),'value':'mybatisXml','description':_0x4950ce(0x130)}]});}function serializeDbSelection(_0x4e3b62){const _0x19a9b7=a236_0x1c20ff;return JSON[_0x19a9b7(0x11c)]({'dbId':_0x4e3b62['dbId'],'dbName':_0x4e3b62[_0x19a9b7(0x121)]});}function deserializeDbSelection(_0x359a6e){const _0x95a24b=a236_0x1c20ff;try{const _0x200a14=JSON[_0x95a24b(0x12e)](_0x359a6e);if(typeof _0x200a14[_0x95a24b(0x13e)]===_0x95a24b(0x14d)&&Number[_0x95a24b(0x15f)](_0x200a14[_0x95a24b(0x13e)]))return{'dbId':_0x200a14['dbId'],'dbName':_0x200a14[_0x95a24b(0x121)]};}catch{}throw CliErrors[_0x95a24b(0x127)](_0x95a24b(0x122)+_0x359a6e);}function resolveProvidedDbId(_0x1b838c){const _0x5cb3a4=a236_0x1c20ff,_0x3de2b0=_0x1b838c[_0x5cb3a4(0x14e)](_0x5cb3a4(0x156));if(typeof _0x3de2b0==='number'&&Number['isFinite'](_0x3de2b0))return _0x3de2b0;return undefined;}
1
+ const a236_0xbe0304=a236_0x4904;(function(_0x3ca1db,_0x22e400){const _0x22869b=a236_0x4904,_0x3e7286=_0x3ca1db();while(!![]){try{const _0x4da797=-parseInt(_0x22869b(0xf7))/0x1*(-parseInt(_0x22869b(0xe7))/0x2)+parseInt(_0x22869b(0xea))/0x3+-parseInt(_0x22869b(0xf8))/0x4*(-parseInt(_0x22869b(0x113))/0x5)+-parseInt(_0x22869b(0x104))/0x6*(parseInt(_0x22869b(0x112))/0x7)+-parseInt(_0x22869b(0x102))/0x8+-parseInt(_0x22869b(0xd4))/0x9+parseInt(_0x22869b(0xdc))/0xa*(parseInt(_0x22869b(0x111))/0xb);if(_0x4da797===_0x22e400)break;else _0x3e7286['push'](_0x3e7286['shift']());}catch(_0x2c8652){_0x3e7286['push'](_0x3e7286['shift']());}}}(a236_0x546f,0xe2f98));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(_0x5ae01c){const _0x399c2b=a236_0x4904;if(_0x5ae01c===_0x399c2b(0xd7))return[_0x399c2b(0xf6),'\x20\x20SELECT\x201\x20AS\x20id','</select>',''][_0x399c2b(0x103)]('\x0a');return['SELECT\x201\x20AS\x20id;','']['join']('\x0a');}export const sqlCreate={'service':'sql','command':a236_0xbe0304(0xd9),'description':a236_0xbe0304(0xe2),'risk':a236_0xbe0304(0x10c),'flags':[{'name':a236_0xbe0304(0xf1),'type':a236_0xbe0304(0xdd),'description':'SQL\x20query\x20display\x20name'},{'name':'db-id','type':a236_0xbe0304(0xe1),'description':a236_0xbe0304(0xfd)},{'name':a236_0xbe0304(0xdf),'type':a236_0xbe0304(0xdd),'enum':[a236_0xbe0304(0x101),a236_0xbe0304(0xd7)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x53de0a){const _0x2c92a7=a236_0xbe0304;if(!_0x53de0a[_0x2c92a7(0xe4)])return;if(!_0x53de0a[_0x2c92a7(0x10d)](_0x2c92a7(0xf1))[_0x2c92a7(0x105)]())throw CliErrors[_0x2c92a7(0xf9)]('name',_0x2c92a7(0xeb));const _0x5657f5=resolveProvidedDbId(_0x53de0a);if(typeof _0x5657f5!=='number'||!Number[_0x2c92a7(0xed)](_0x5657f5)||_0x5657f5<=0x0)throw CliErrors[_0x2c92a7(0xf9)]('db-id',_0x2c92a7(0xdb));if(!_0x53de0a[_0x2c92a7(0x10d)](_0x2c92a7(0xdf))[_0x2c92a7(0x105)]())throw CliErrors[_0x2c92a7(0xf9)](_0x2c92a7(0xdf),_0x2c92a7(0xf3));},async 'dryRun'(_0x2cb8d6){const _0x3d9cdc=a236_0xbe0304,_0x114b3f=loadSqlProjectConfig(_0x2cb8d6[_0x3d9cdc(0xe3)]),{sqlName:_0x3bb0c4,dbId:_0x9c06b0,dbName:_0x11b783,mode:_0x28320d}=await resolveSqlNewInputs(_0x2cb8d6),_0x3331a3=buildSqlRelativePath('<server-generated-sqlCode>',_0x3bb0c4,_0x11b783,_0x28320d,_0x9c06b0),_0x56b340=_0x114b3f['sqlRootDir']+'/'+_0x3331a3;return{'method':_0x3d9cdc(0xfe),'url':_0x3d9cdc(0xef),'body':{'appCode':_0x2cb8d6[_0x3d9cdc(0xe3)],'sqlName':_0x3bb0c4,'dbId':_0x9c06b0,'mode':_0x28320d,'localPath':_0x56b340},'description':_0x3d9cdc(0xf0)+_0x114b3f[_0x3d9cdc(0xd8)]};},async 'execute'(_0x3eef7b){const _0x537c42=a236_0xbe0304,_0x377be8=loadSqlProjectConfig(_0x3eef7b[_0x537c42(0xe3)]),{sqlName:_0x303896,dbId:_0x9ff366,dbName:_0x1a878e,mode:_0x2d355a}=await resolveSqlNewInputs(_0x3eef7b),_0x4abcd1=generateSqlTemplate(_0x2d355a),_0x3a904a=await createSqlQuery({'appCode':_0x3eef7b[_0x537c42(0xe3)],'sqlName':_0x303896,'dbId':_0x9ff366,'sqlContent':_0x4abcd1}),_0x218a61=ensureRemoteSqlContent(_0x3a904a),_0x30364a=_0x1a878e||await getDbName(_0x3eef7b[_0x537c42(0xe3)],_0x9ff366)[_0x537c42(0xe6)](()=>undefined),_0x5854db=buildSqlRelativePath(_0x3a904a[_0x537c42(0xde)],_0x3a904a['sqlName'],_0x30364a,_0x2d355a,_0x9ff366),_0x28c1f4=_0x377be8[_0x537c42(0xd8)]+'/'+_0x5854db,_0x11abe8=buildLocalSqlFileContent({'sqlCode':_0x3a904a[_0x537c42(0xde)],'sqlName':_0x3a904a[_0x537c42(0xec)],'dbId':_0x3a904a[_0x537c42(0x10b)]},_0x218a61,{'dbName':_0x30364a,'mode':_0x2d355a,'syncedAt':new Date()[_0x537c42(0xd3)](),'description':_0x3a904a[_0x537c42(0xf2)]});if(await fileExists(_0x28c1f4))throw CliErrors[_0x537c42(0x10e)](_0x537c42(0x108)+_0x28c1f4);await ensureParentDirectory(_0x28c1f4),await writeFile(_0x28c1f4,_0x11abe8,'utf8');const _0x2df069=await readSqlLockFile(_0x377be8['lockFilePath']),{lockData:_0x57c49a,appLock:_0x27d1db}=ensureSqlLockScope(_0x2df069??createEmptySqlLock(),_0x377be8[_0x537c42(0xe3)],_0x377be8['sqlRoot'],_0x537c42(0xe0));return _0x27d1db['sqls'][_0x3a904a[_0x537c42(0xde)]]={...buildSqlLockEntry(_0x3a904a,_0x218a61,computeSqlContentHash(_0x11abe8),{'dbName':_0x30364a}),'path':_0x5854db,'mode':_0x2d355a},_0x27d1db[_0x537c42(0xff)]=new Date()[_0x537c42(0xd3)](),await writeSqlLockFile(_0x377be8[_0x537c42(0xfa)],_0x57c49a),{'ok':!![],'data':{'id':_0x3a904a['id'],'sqlCode':_0x3a904a[_0x537c42(0xde)],'sqlName':_0x3a904a[_0x537c42(0xec)],'dbId':_0x3a904a[_0x537c42(0x10b)],'path':_0x28c1f4,'mode':_0x2d355a},'message':_0x537c42(0xd5)+_0x3a904a[_0x537c42(0xde)]};}};async function resolveSqlNewInputs(_0x5964b8){const _0x20b7bb=await resolveSqlNameInput(_0x5964b8),{dbId:_0xce089d,dbName:_0x3c639f}=await resolveDbSelection(_0x5964b8),_0x439482=await resolveSqlModeInput(_0x5964b8);return{'sqlName':_0x20b7bb,'dbId':_0xce089d,'dbName':_0x3c639f,'mode':_0x439482};}async function resolveSqlNameInput(_0x56a2de){const _0x5354fb=a236_0xbe0304,_0x2d4172=_0x56a2de['str'](_0x5354fb(0xf1))['trim']();if(_0x2d4172)return _0x2d4172;if(_0x56a2de[_0x5354fb(0xe4)])throw CliErrors[_0x5354fb(0xf9)](_0x5354fb(0xf1),_0x5354fb(0xeb));return(await input({'message':_0x5354fb(0xd2),'validate':_0x270b8b=>_0x270b8b[_0x5354fb(0x105)]()?!![]:_0x5354fb(0xd6)}))[_0x5354fb(0x105)]();}async function resolveDbSelection(_0x36b4f9){const _0x2764cc=a236_0xbe0304,_0x37d355=resolveProvidedDbId(_0x36b4f9);if(typeof _0x37d355===_0x2764cc(0xe1)&&Number['isFinite'](_0x37d355)&&_0x37d355>0x0)return{'dbId':_0x37d355,'dbName':await getDbName(_0x36b4f9[_0x2764cc(0xe3)],_0x37d355)[_0x2764cc(0xe6)](()=>undefined)};if(_0x36b4f9[_0x2764cc(0xe4)])throw CliErrors[_0x2764cc(0xf9)]('db-id',_0x2764cc(0xdb));const _0xfb53=await listDatabases(_0x36b4f9[_0x2764cc(0xe3)])[_0x2764cc(0xe6)](()=>[]);if(_0xfb53[_0x2764cc(0xee)]===0x1)return{'dbId':_0xfb53[0x0]['dbId'],'dbName':_0xfb53[0x0][_0x2764cc(0xf4)]};if(_0xfb53[_0x2764cc(0xee)]>0x1){const _0x5b8059=await select({'message':_0x2764cc(0xe8),'choices':[..._0xfb53[_0x2764cc(0xfc)](_0x1f165a=>({'name':_0x1f165a[_0x2764cc(0xf4)]+'\x20('+_0x1f165a[_0x2764cc(0x10b)]+')','value':serializeDbSelection(_0x1f165a)})),{'name':_0x2764cc(0xe5),'value':_0x2764cc(0xda)}]});if(_0x5b8059!==_0x2764cc(0xda))return deserializeDbSelection(_0x5b8059);}const _0x1c4cbb=await input({'message':'Target\x20database\x20dbId:','validate':_0x756a7=>{const _0x5f2a17=_0x2764cc,_0x2ac5a5=_0x756a7['trim']();if(!_0x2ac5a5)return _0x5f2a17(0xf5);const _0x4c6728=Number(_0x2ac5a5);if(!Number[_0x5f2a17(0x110)](_0x4c6728)||_0x4c6728<=0x0)return _0x5f2a17(0x10a);return!![];}});return{'dbId':Number(_0x1c4cbb[_0x2764cc(0x105)]())};}async function resolveSqlModeInput(_0x49301e){const _0x5c70a4=a236_0xbe0304,_0x10c6e5=_0x49301e['str'](_0x5c70a4(0xdf))[_0x5c70a4(0x105)]();if(_0x10c6e5===_0x5c70a4(0x101)||_0x10c6e5===_0x5c70a4(0xd7))return _0x10c6e5;if(_0x49301e[_0x5c70a4(0xe4)])throw CliErrors[_0x5c70a4(0xf9)](_0x5c70a4(0xdf),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x5c70a4(0xe9),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':_0x5c70a4(0x101),'description':_0x5c70a4(0x10f)},{'name':'MyBatis\x20XML\x20(mybatisXml)','value':'mybatisXml','description':_0x5c70a4(0x106)}]});}function serializeDbSelection(_0x20998e){const _0x24d986=a236_0xbe0304;return JSON[_0x24d986(0x107)]({'dbId':_0x20998e[_0x24d986(0x10b)],'dbName':_0x20998e[_0x24d986(0xf4)]});}function deserializeDbSelection(_0x5d032f){const _0xefc3e7=a236_0xbe0304;try{const _0x1cce2c=JSON[_0xefc3e7(0x109)](_0x5d032f);if(typeof _0x1cce2c[_0xefc3e7(0x10b)]===_0xefc3e7(0xe1)&&Number['isFinite'](_0x1cce2c['dbId']))return{'dbId':_0x1cce2c['dbId'],'dbName':_0x1cce2c[_0xefc3e7(0xf4)]};}catch{}throw CliErrors['validation'](_0xefc3e7(0xfb)+_0x5d032f);}function a236_0x4904(_0x4c6955,_0x251214){_0x4c6955=_0x4c6955-0xd2;const _0x546f2c=a236_0x546f();let _0x490472=_0x546f2c[_0x4c6955];return _0x490472;}function a236_0x546f(){const _0x692054=['dbId\x20must\x20be\x20a\x20positive\x20integer','dbId','write','str','validation','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','isInteger','1494966ozVAgx','536032OSIROi','5TqTdVe','SQL\x20name:','toISOString','7030755SUdese','Created\x20SQL\x20query\x20','SQL\x20name\x20cannot\x20be\x20empty','mybatisXml','sqlRootDir','create','__manual__','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','40kLQWDd','string','sqlCode','mode','new','number','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','appCode','nonInteractive','✎\x20Enter\x20dbId\x20manually','catch','3663634sMpNXK','Select\x20the\x20target\x20database:','Select\x20the\x20local\x20SQL\x20mode:','3618984flPyph','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlName','isFinite','length','/smartapi/custom/saveUserCustomSql','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','name','description','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','dbName','dbId\x20cannot\x20be\x20empty','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','1XrUqnn','3760492aWoSlK','flagMissing','lockFilePath','Invalid\x20database\x20selection\x20payload:\x20','map','Target\x20database\x20ID','POST','lastSync','flag','sql','10235912CeMwxd','join','120JVMglA','trim','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','stringify','File\x20already\x20exists:\x20','parse'];a236_0x546f=function(){return _0x692054;};return a236_0x546f();}function resolveProvidedDbId(_0x485fee){const _0x12c451=a236_0xbe0304,_0x1ce3f1=_0x485fee[_0x12c451(0x100)]('db-id');if(typeof _0x1ce3f1===_0x12c451(0xe1)&&Number[_0x12c451(0xed)](_0x1ce3f1))return _0x1ce3f1;return undefined;}
@@ -1 +1 @@
1
- const a237_0x2ae4a7=a237_0x5160;function a237_0x3eaf(){const _0x4b26d7=['projectRoot','Deleted\x20','166265gnYeRE','4931694WaiQJT','\x20(local\x20file\x20moved\x20to\x20trash)','105464qGYsUC','trashedTo','Would\x20delete\x20SQL\x20','479525TVYxUT','15HEmFXz','fromEntries','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','408106wWkAsx','sqlRoot','str','remoteId','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','appCode','POST','sqlcode','delete','lockFilePath','replace','toISOString','sqls','66IHTOVp','validation','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','length','3969160kbCouy','entries','startsWith','trashDir','sql','2008524mJJrKg','lastSync','SQL\x20lock\x20file\x20not\x20found.'];a237_0x3eaf=function(){return _0x4b26d7;};return a237_0x3eaf();}(function(_0x170554,_0x41132e){const _0x5716d2=a237_0x5160,_0x37b901=_0x170554();while(!![]){try{const _0x3c2a5c=-parseInt(_0x5716d2(0xfc))/0x1+parseInt(_0x5716d2(0x100))/0x2+parseInt(_0x5716d2(0xfd))/0x3*(-parseInt(_0x5716d2(0xf9))/0x4)+parseInt(_0x5716d2(0xf6))/0x5*(parseInt(_0x5716d2(0xe8))/0x6)+parseInt(_0x5716d2(0xf1))/0x7+-parseInt(_0x5716d2(0xec))/0x8+parseInt(_0x5716d2(0xf7))/0x9;if(_0x3c2a5c===_0x41132e)break;else _0x37b901['push'](_0x37b901['shift']());}catch(_0x3fb6d8){_0x37b901['push'](_0x37b901['shift']());}}}(a237_0x3eaf,0x48912));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a237_0x5160(_0x2c372f,_0x328277){_0x2c372f=_0x2c372f-0xdc;const _0x3eaf7f=a237_0x3eaf();let _0x5160e5=_0x3eaf7f[_0x2c372f];return _0x5160e5;}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a237_0x2ae4a7(0xf0),'command':a237_0x2ae4a7(0xe3),'description':a237_0x2ae4a7(0xff),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x416892){const _0x1f1959=a237_0x2ae4a7,_0x7a513e=loadSqlProjectConfig(_0x416892[_0x1f1959(0xe0)]),_0x103c74=await readSqlLockFile(_0x7a513e[_0x1f1959(0xe4)]);if(!_0x103c74)throw CliErrors[_0x1f1959(0xe9)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x4cc618){const _0x3c2255=a237_0x2ae4a7,_0x93fc2b=loadSqlProjectConfig(_0x4cc618['appCode']),_0x248ec8=await readSqlLockFile(_0x93fc2b[_0x3c2255(0xe4)]);if(!_0x248ec8)throw CliErrors[_0x3c2255(0xe9)](_0x3c2255(0xea));const {appLock:_0xb64430}=ensureSqlLockScope(_0x248ec8,_0x4cc618['appCode'],_0x93fc2b[_0x3c2255(0xdc)],_0x3c2255(0xe3)),_0x15f09e=_0x4cc618[_0x3c2255(0xdd)](_0x3c2255(0xe2)),_0x54dc2b=_0xb64430[_0x3c2255(0xe7)][_0x15f09e];if(!_0x54dc2b)throw CliErrors[_0x3c2255(0xe9)](_0x3c2255(0xdf)+_0x15f09e+'\x22.');return{'method':_0x3c2255(0xe1),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x15f09e,'id':_0x54dc2b[_0x3c2255(0xde)],'localPath':resolveLocalSqlFilePath(_0x93fc2b,_0x15f09e,_0x54dc2b)},'description':_0x3c2255(0xfb)+_0x15f09e+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x93fc2b['trashDir']};},async 'execute'(_0x47175b){const _0x20b813=a237_0x2ae4a7,_0x30a6d6=loadSqlProjectConfig(_0x47175b['appCode']),_0x168789=await readSqlLockFile(_0x30a6d6[_0x20b813(0xe4)]);if(!_0x168789)throw CliErrors[_0x20b813(0xe9)](_0x20b813(0xf3));const {lockData:_0x4acc3e,appLock:_0x595548}=ensureSqlLockScope(_0x168789,_0x47175b[_0x20b813(0xe0)],_0x30a6d6[_0x20b813(0xdc)],'delete'),_0xca7945=_0x47175b[_0x20b813(0xdd)]('sqlcode'),_0x2e762c=_0x595548[_0x20b813(0xe7)][_0xca7945];if(!_0x2e762c)throw CliErrors['validation'](_0x20b813(0xdf)+_0xca7945+'\x22.');await deleteSqlQuery({'id':_0x2e762c[_0x20b813(0xde)],'sqlCode':_0xca7945}),_0x595548['sqls']=Object[_0x20b813(0xfe)](Object[_0x20b813(0xed)](_0x595548[_0x20b813(0xe7)])['filter'](([_0x29785c])=>_0x29785c!==_0xca7945)),_0x595548[_0x20b813(0xf2)]=new Date()['toISOString'](),await writeSqlLockFile(_0x30a6d6[_0x20b813(0xe4)],_0x4acc3e);const _0xfb9659=resolveLocalSqlFilePath(_0x30a6d6,_0xca7945,_0x2e762c);let _0x2be04e;await fileExists(_0xfb9659)&&(_0x2be04e=await moveToTrash(_0x30a6d6[_0x20b813(0xf4)],_0x30a6d6[_0x20b813(0xef)],_0xfb9659),await cleanupEmptyDirectories(dirname(_0xfb9659),_0x30a6d6['sqlRootDir']));const _0x4c04cb={'deleted':_0xca7945,'remoteId':_0x2e762c[_0x20b813(0xde)]};if(_0x2be04e)_0x4c04cb[_0x20b813(0xfa)]=_0x2be04e;return{'ok':!![],'data':_0x4c04cb,'message':_0x20b813(0xf5)+_0xca7945+(_0x2be04e?_0x20b813(0xf8):'')};}};async function moveToTrash(_0x1f5a2b,_0x3aa2b2,_0x4f999b){const _0x21282c=a237_0x2ae4a7,_0x161bac=new Date()[_0x21282c(0xe6)]()[_0x21282c(0xe5)](/[:.]/g,'-'),_0x111bbd=relative(_0x1f5a2b,_0x4f999b),_0x2c6b56=join(_0x3aa2b2,_0x161bac,_0x111bbd);return await mkdir(dirname(_0x2c6b56),{'recursive':!![]}),await rename(_0x4f999b,_0x2c6b56),_0x2c6b56;}async function cleanupEmptyDirectories(_0x1abcc8,_0x31afdc){const _0x2e8d0f=a237_0x2ae4a7;let _0x45ed52=resolve(_0x1abcc8);const _0x2777e9=resolve(_0x31afdc);while(_0x45ed52[_0x2e8d0f(0xee)](''+_0x2777e9+sep)||_0x45ed52===_0x2777e9){if(_0x45ed52===_0x2777e9)return;try{const _0x2ca40d=await readdir(_0x45ed52);if(_0x2ca40d[_0x2e8d0f(0xeb)]>0x0)return;await rmdir(_0x45ed52);}catch{return;}_0x45ed52=dirname(_0x45ed52);}}
1
+ const a237_0x176acf=a237_0x3aaa;(function(_0x15d7c9,_0x2e4352){const _0x148938=a237_0x3aaa,_0x5b362c=_0x15d7c9();while(!![]){try{const _0x5d5bc1=-parseInt(_0x148938(0x1f1))/0x1*(parseInt(_0x148938(0x1f2))/0x2)+parseInt(_0x148938(0x205))/0x3+-parseInt(_0x148938(0x1fe))/0x4+parseInt(_0x148938(0x1e6))/0x5+-parseInt(_0x148938(0x1e5))/0x6+-parseInt(_0x148938(0x1f7))/0x7*(-parseInt(_0x148938(0x202))/0x8)+-parseInt(_0x148938(0x1e3))/0x9*(-parseInt(_0x148938(0x1e1))/0xa);if(_0x5d5bc1===_0x2e4352)break;else _0x5b362c['push'](_0x5b362c['shift']());}catch(_0x1ad63d){_0x5b362c['push'](_0x5b362c['shift']());}}}(a237_0x5687,0xe34bf));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a237_0x3aaa(_0xa70f83,_0x41217b){_0xa70f83=_0xa70f83-0x1e0;const _0x5687eb=a237_0x5687();let _0x3aaa82=_0x5687eb[_0xa70f83];return _0x3aaa82;}import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a237_0x176acf(0x1f8),'command':a237_0x176acf(0x1ee),'description':a237_0x176acf(0x1eb),'risk':a237_0x176acf(0x1f4),'flags':[SQLCODE_FLAG],async 'validate'(_0x5bdec9){const _0x1cb36e=a237_0x176acf,_0x7efe61=loadSqlProjectConfig(_0x5bdec9[_0x1cb36e(0x207)]),_0x55cdd4=await readSqlLockFile(_0x7efe61[_0x1cb36e(0x1ef)]);if(!_0x55cdd4)throw CliErrors[_0x1cb36e(0x1f3)](_0x1cb36e(0x206));},async 'dryRun'(_0x4033eb){const _0x531cc3=a237_0x176acf,_0x534852=loadSqlProjectConfig(_0x4033eb[_0x531cc3(0x207)]),_0x292048=await readSqlLockFile(_0x534852[_0x531cc3(0x1ef)]);if(!_0x292048)throw CliErrors[_0x531cc3(0x1f3)](_0x531cc3(0x206));const {appLock:_0x385ffc}=ensureSqlLockScope(_0x292048,_0x4033eb[_0x531cc3(0x207)],_0x534852[_0x531cc3(0x1ea)],_0x531cc3(0x1ee)),_0x47d511=_0x4033eb[_0x531cc3(0x1e2)](_0x531cc3(0x1f6)),_0x299291=_0x385ffc['sqls'][_0x47d511];if(!_0x299291)throw CliErrors[_0x531cc3(0x1f3)](_0x531cc3(0x200)+_0x47d511+'\x22.');return{'method':_0x531cc3(0x1ff),'url':_0x531cc3(0x1e7),'body':{'sqlCode':_0x47d511,'id':_0x299291[_0x531cc3(0x1e4)],'localPath':resolveLocalSqlFilePath(_0x534852,_0x47d511,_0x299291)},'description':_0x531cc3(0x1fc)+_0x47d511+_0x531cc3(0x1ed)+_0x534852['trashDir']};},async 'execute'(_0x228293){const _0x529ec1=a237_0x176acf,_0x9d8ab6=loadSqlProjectConfig(_0x228293['appCode']),_0x2a7e34=await readSqlLockFile(_0x9d8ab6[_0x529ec1(0x1ef)]);if(!_0x2a7e34)throw CliErrors['validation'](_0x529ec1(0x203));const {lockData:_0x42f5d3,appLock:_0x178ad4}=ensureSqlLockScope(_0x2a7e34,_0x228293['appCode'],_0x9d8ab6[_0x529ec1(0x1ea)],'delete'),_0x1b6973=_0x228293[_0x529ec1(0x1e2)]('sqlcode'),_0x5c892a=_0x178ad4['sqls'][_0x1b6973];if(!_0x5c892a)throw CliErrors[_0x529ec1(0x1f3)](_0x529ec1(0x200)+_0x1b6973+'\x22.');await deleteSqlQuery({'id':_0x5c892a[_0x529ec1(0x1e4)],'sqlCode':_0x1b6973}),_0x178ad4[_0x529ec1(0x1fb)]=Object[_0x529ec1(0x1e9)](Object['entries'](_0x178ad4[_0x529ec1(0x1fb)])[_0x529ec1(0x1fd)](([_0x88995a])=>_0x88995a!==_0x1b6973)),_0x178ad4[_0x529ec1(0x1e8)]=new Date()['toISOString'](),await writeSqlLockFile(_0x9d8ab6[_0x529ec1(0x1ef)],_0x42f5d3);const _0xe4b894=resolveLocalSqlFilePath(_0x9d8ab6,_0x1b6973,_0x5c892a);let _0x15ecfe;await fileExists(_0xe4b894)&&(_0x15ecfe=await moveToTrash(_0x9d8ab6[_0x529ec1(0x1ec)],_0x9d8ab6[_0x529ec1(0x208)],_0xe4b894),await cleanupEmptyDirectories(dirname(_0xe4b894),_0x9d8ab6[_0x529ec1(0x201)]));const _0x2bae36={'deleted':_0x1b6973,'remoteId':_0x5c892a['remoteId']};if(_0x15ecfe)_0x2bae36[_0x529ec1(0x1f0)]=_0x15ecfe;return{'ok':!![],'data':_0x2bae36,'message':_0x529ec1(0x204)+_0x1b6973+(_0x15ecfe?_0x529ec1(0x1e0):'')};}};function a237_0x5687(){const _0x29b6e5=['toISOString','sqls','Would\x20delete\x20SQL\x20','filter','402260vWggfq','POST','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','sqlRootDir','13684808AdNbiz','SQL\x20lock\x20file\x20not\x20found.','Deleted\x20','2524104Hnytgx','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','appCode','trashDir','\x20(local\x20file\x20moved\x20to\x20trash)','1590IJGpOU','str','34722BpHKjJ','remoteId','10945890UJMvHT','7610325CLGbpy','/smartapi/custom/deleteUserCustomSql','lastSync','fromEntries','sqlRoot','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','projectRoot','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','delete','lockFilePath','trashedTo','1OODzHM','3663138kqBtrH','validation','high-risk-write','replace','sqlcode','7lEJXWM','sql','length'];a237_0x5687=function(){return _0x29b6e5;};return a237_0x5687();}async function moveToTrash(_0x186a43,_0x561c93,_0xe84677){const _0x4ed2a1=a237_0x176acf,_0x2d2f6c=new Date()[_0x4ed2a1(0x1fa)]()[_0x4ed2a1(0x1f5)](/[:.]/g,'-'),_0x7e9903=relative(_0x186a43,_0xe84677),_0x3661f4=join(_0x561c93,_0x2d2f6c,_0x7e9903);return await mkdir(dirname(_0x3661f4),{'recursive':!![]}),await rename(_0xe84677,_0x3661f4),_0x3661f4;}async function cleanupEmptyDirectories(_0x1a5374,_0xa437d6){const _0x20e30d=a237_0x176acf;let _0x2e3911=resolve(_0x1a5374);const _0x21eff0=resolve(_0xa437d6);while(_0x2e3911['startsWith'](''+_0x21eff0+sep)||_0x2e3911===_0x21eff0){if(_0x2e3911===_0x21eff0)return;try{const _0x49aa7e=await readdir(_0x2e3911);if(_0x49aa7e[_0x20e30d(0x1f9)]>0x0)return;await rmdir(_0x2e3911);}catch{return;}_0x2e3911=dirname(_0x2e3911);}}
@@ -1 +1 @@
1
- const a238_0xffcc97=a238_0x46d9;function a238_0x46d9(_0x547741,_0x15ae4a){_0x547741=_0x547741-0x184;const _0x32b09e=a238_0x32b0();let _0x46d9db=_0x32b09e[_0x547741];return _0x46d9db;}(function(_0x4ac6c4,_0x2d6bf9){const _0x24c40c=a238_0x46d9,_0x38f35e=_0x4ac6c4();while(!![]){try{const _0x1382ad=parseInt(_0x24c40c(0x195))/0x1+parseInt(_0x24c40c(0x197))/0x2*(-parseInt(_0x24c40c(0x190))/0x3)+-parseInt(_0x24c40c(0x192))/0x4*(-parseInt(_0x24c40c(0x185))/0x5)+-parseInt(_0x24c40c(0x187))/0x6+parseInt(_0x24c40c(0x19a))/0x7*(-parseInt(_0x24c40c(0x186))/0x8)+-parseInt(_0x24c40c(0x19d))/0x9*(parseInt(_0x24c40c(0x18c))/0xa)+-parseInt(_0x24c40c(0x194))/0xb*(-parseInt(_0x24c40c(0x18d))/0xc);if(_0x1382ad===_0x2d6bf9)break;else _0x38f35e['push'](_0x38f35e['shift']());}catch(_0x3d172b){_0x38f35e['push'](_0x38f35e['shift']());}}}(a238_0x32b0,0xd8438));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a238_0x32b0(){const _0x25efb8=['7430166xBYbGZ','sql','sqlName','sqlCode','Return\x20full\x20raw\x20SQL\x20query\x20object','10190goqOvb','12Psjgnj','dbId','sqlcode','177nNStWF','read','36PNnWXz','detail','42189785PzUXOY','810726WbtViS','description','43046FjHUaG','boolean','appCode','1808240sOzUvq','sqlContent','verbose','15606kklwXK','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','860055XHfIaX','32fQtaZI'];a238_0x32b0=function(){return _0x25efb8;};return a238_0x32b0();}export const sqlDetail={'service':a238_0xffcc97(0x188),'command':a238_0xffcc97(0x193),'description':a238_0xffcc97(0x184),'risk':a238_0xffcc97(0x191),'flags':[SQLCODE_FLAG,{'name':a238_0xffcc97(0x19c),'type':a238_0xffcc97(0x198),'description':a238_0xffcc97(0x18b)}],async 'execute'(_0x587edc){const _0x3e902b=a238_0xffcc97,_0x551fd7=await getSqlQueryInfo(_0x587edc[_0x3e902b(0x199)],_0x587edc['str'](_0x3e902b(0x18f))),_0x33d136=_0x587edc['bool']('verbose');if(_0x33d136)return{'ok':!![],'data':_0x551fd7};const _0x52ae6a=_0x551fd7[_0x3e902b(0x18e)]?await getDbName(_0x587edc[_0x3e902b(0x199)],_0x551fd7[_0x3e902b(0x18e)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x551fd7[_0x3e902b(0x18a)],'sqlName':_0x551fd7[_0x3e902b(0x189)],'db':_0x52ae6a?_0x52ae6a+'\x20('+_0x551fd7[_0x3e902b(0x18e)]+')':_0x551fd7[_0x3e902b(0x18e)]??'','description':_0x551fd7[_0x3e902b(0x196)]??'','sqlContent':_0x551fd7[_0x3e902b(0x19b)]??''}};}};
1
+ const a238_0x1bcdcd=a238_0x15c8;(function(_0xd6a944,_0x410c4f){const _0x25d1d2=a238_0x15c8,_0x369386=_0xd6a944();while(!![]){try{const _0xad8467=parseInt(_0x25d1d2(0xa9))/0x1+-parseInt(_0x25d1d2(0xb5))/0x2+-parseInt(_0x25d1d2(0xb7))/0x3*(-parseInt(_0x25d1d2(0xaa))/0x4)+-parseInt(_0x25d1d2(0xac))/0x5+-parseInt(_0x25d1d2(0xab))/0x6+parseInt(_0x25d1d2(0xb2))/0x7+parseInt(_0x25d1d2(0xb9))/0x8*(parseInt(_0x25d1d2(0xba))/0x9);if(_0xad8467===_0x410c4f)break;else _0x369386['push'](_0x369386['shift']());}catch(_0x5123a6){_0x369386['push'](_0x369386['shift']());}}}(a238_0x287e,0x53e6f));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a238_0x15c8(_0x519523,_0x55a469){_0x519523=_0x519523-0xa9;const _0x287e3c=a238_0x287e();let _0x15c82b=_0x287e3c[_0x519523];return _0x15c82b;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a238_0x287e(){const _0x1309c0=['verbose','269947KMOGcs','1451332PXcpsE','1588680Mhtrvo','1132875uKPvdw','sqlContent','sql','description','detail','appCode','2922514XRMYBf','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','dbId','543060xrerrD','sqlCode','3dbkiRE','read','32152okOYij','126XjSOTb','boolean'];a238_0x287e=function(){return _0x1309c0;};return a238_0x287e();}export const sqlDetail={'service':a238_0x1bcdcd(0xae),'command':a238_0x1bcdcd(0xb0),'description':a238_0x1bcdcd(0xb3),'risk':a238_0x1bcdcd(0xb8),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a238_0x1bcdcd(0xbb),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x45ca98){const _0x55929d=a238_0x1bcdcd,_0x41315a=await getSqlQueryInfo(_0x45ca98[_0x55929d(0xb1)],_0x45ca98['str']('sqlcode')),_0x2e4abf=_0x45ca98['bool'](_0x55929d(0xbc));if(_0x2e4abf)return{'ok':!![],'data':_0x41315a};const _0x29cdca=_0x41315a[_0x55929d(0xb4)]?await getDbName(_0x45ca98['appCode'],_0x41315a[_0x55929d(0xb4)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x41315a[_0x55929d(0xb6)],'sqlName':_0x41315a['sqlName'],'db':_0x29cdca?_0x29cdca+'\x20('+_0x41315a[_0x55929d(0xb4)]+')':_0x41315a[_0x55929d(0xb4)]??'','description':_0x41315a[_0x55929d(0xaf)]??'','sqlContent':_0x41315a[_0x55929d(0xad)]??''}};}};
@@ -1 +1 @@
1
- const a239_0xd22ec7=a239_0x151d;function a239_0x151d(_0x340d26,_0x270375){_0x340d26=_0x340d26-0x164;const _0x2013e0=a239_0x2013();let _0x151dfa=_0x2013e0[_0x340d26];return _0x151dfa;}function a239_0x2013(){const _0x339679=['3895ixVAqp','136961SBeWfX','32VovqWo','read','6030300rMrqUt','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','isArray','execError','appCode','execSuccess','3266775tuXTku','4cohhBl','now','params','2149215zxcUhk','string','10506OXhHDQ','sqlcode','3797584SddqNR','length','SQL\x20execution\x20failed','str','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','execResult','2373048QqpEqi'];a239_0x2013=function(){return _0x339679;};return a239_0x2013();}(function(_0x373242,_0x35cc65){const _0x6bcdf4=a239_0x151d,_0x2f7f48=_0x373242();while(!![]){try{const _0x9cdc73=parseInt(_0x6bcdf4(0x16c))/0x1+parseInt(_0x6bcdf4(0x176))/0x2*(parseInt(_0x6bcdf4(0x179))/0x3)+-parseInt(_0x6bcdf4(0x16a))/0x4+parseInt(_0x6bcdf4(0x16b))/0x5*(parseInt(_0x6bcdf4(0x17b))/0x6)+parseInt(_0x6bcdf4(0x164))/0x7+-parseInt(_0x6bcdf4(0x16d))/0x8*(parseInt(_0x6bcdf4(0x175))/0x9)+-parseInt(_0x6bcdf4(0x16f))/0xa;if(_0x9cdc73===_0x35cc65)break;else _0x2f7f48['push'](_0x2f7f48['shift']());}catch(_0x32c5cd){_0x2f7f48['push'](_0x2f7f48['shift']());}}}(a239_0x2013,0xca2d8));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':a239_0xd22ec7(0x168),'risk':a239_0xd22ec7(0x16e),'flags':[SQLCODE_FLAG,{'name':a239_0xd22ec7(0x178),'type':a239_0xd22ec7(0x17a),'description':a239_0xd22ec7(0x170)}],async 'execute'(_0x265179){const _0x22d587=a239_0xd22ec7,_0xd71f65=parseJsonParams(_0x265179[_0x22d587(0x167)](_0x22d587(0x178))),_0xdb63b1=Date[_0x22d587(0x177)](),_0x266046=await executeSql(_0x265179[_0x22d587(0x173)],_0x265179[_0x22d587(0x167)](_0x22d587(0x17c)),_0xd71f65),_0x1044df=Date[_0x22d587(0x177)]()-_0xdb63b1,_0x47c9d2=_0x266046?.[_0x22d587(0x169)]??_0x266046,_0x463bf7=_0x266046?.[_0x22d587(0x174)]??!![];if(!_0x463bf7)return{'ok':![],'data':{'error':_0x266046?.[_0x22d587(0x172)]||_0x22d587(0x166),'elapsed':_0x1044df},'message':_0x22d587(0x166)};const _0x5e3e7b=Array[_0x22d587(0x171)](_0x47c9d2)?_0x47c9d2:[];return{'ok':!![],'data':{'rows':_0x5e3e7b,'rowCount':_0x5e3e7b[_0x22d587(0x165)],'elapsed':_0x1044df},'message':'Returned\x20'+_0x5e3e7b[_0x22d587(0x165)]+'\x20row(s)\x20in\x20'+_0x1044df+'ms'};}};
1
+ function a239_0x5d61(){const _0x37420f=['sqlcode','now','execError','Returned\x20','execResult','appCode','SQL\x20execution\x20failed','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','\x20row(s)\x20in\x20','317114zGHoVx','494584RHcFRU','564181QextHM','61972rAcfIh','2540826IciZGq','2916870HMzJdQ','57490AqBxvt','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','exec','str','isArray','string','123vfVeVl','36GOrBvm','params','length','2ipLTGQ','sql','read'];a239_0x5d61=function(){return _0x37420f;};return a239_0x5d61();}const a239_0x5078ff=a239_0x53ab;function a239_0x53ab(_0x41422e,_0x23f745){_0x41422e=_0x41422e-0x1d0;const _0x5d61bf=a239_0x5d61();let _0x53ab96=_0x5d61bf[_0x41422e];return _0x53ab96;}(function(_0x47b7f8,_0x1d93c9){const _0x3f8bcc=a239_0x53ab,_0x2d09dc=_0x47b7f8();while(!![]){try{const _0x47b0b0=-parseInt(_0x3f8bcc(0x1e7))/0x1*(-parseInt(_0x3f8bcc(0x1d9))/0x2)+-parseInt(_0x3f8bcc(0x1d5))/0x3*(-parseInt(_0x3f8bcc(0x1e8))/0x4)+-parseInt(_0x3f8bcc(0x1ea))/0x5+-parseInt(_0x3f8bcc(0x1e9))/0x6+parseInt(_0x3f8bcc(0x1e5))/0x7+parseInt(_0x3f8bcc(0x1e6))/0x8+-parseInt(_0x3f8bcc(0x1d6))/0x9*(-parseInt(_0x3f8bcc(0x1eb))/0xa);if(_0x47b0b0===_0x1d93c9)break;else _0x2d09dc['push'](_0x2d09dc['shift']());}catch(_0x18130f){_0x2d09dc['push'](_0x2d09dc['shift']());}}}(a239_0x5d61,0x4ec6e));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_0x5078ff(0x1da),'command':a239_0x5078ff(0x1d1),'description':a239_0x5078ff(0x1e3),'risk':a239_0x5078ff(0x1db),'flags':[SQLCODE_FLAG,{'name':a239_0x5078ff(0x1d7),'type':a239_0x5078ff(0x1d4),'description':a239_0x5078ff(0x1d0)}],async 'execute'(_0xffef19){const _0x42127b=a239_0x5078ff,_0x469e91=parseJsonParams(_0xffef19[_0x42127b(0x1d2)]('params')),_0x5d33e3=Date[_0x42127b(0x1dd)](),_0x2c4dac=await executeSql(_0xffef19[_0x42127b(0x1e1)],_0xffef19[_0x42127b(0x1d2)](_0x42127b(0x1dc)),_0x469e91),_0x2195f8=Date[_0x42127b(0x1dd)]()-_0x5d33e3,_0x371d96=_0x2c4dac?.[_0x42127b(0x1e0)]??_0x2c4dac,_0x2bfc1d=_0x2c4dac?.['execSuccess']??!![];if(!_0x2bfc1d)return{'ok':![],'data':{'error':_0x2c4dac?.[_0x42127b(0x1de)]||_0x42127b(0x1e2),'elapsed':_0x2195f8},'message':_0x42127b(0x1e2)};const _0x394fd0=Array[_0x42127b(0x1d3)](_0x371d96)?_0x371d96:[];return{'ok':!![],'data':{'rows':_0x394fd0,'rowCount':_0x394fd0[_0x42127b(0x1d8)],'elapsed':_0x2195f8},'message':_0x42127b(0x1df)+_0x394fd0[_0x42127b(0x1d8)]+_0x42127b(0x1e4)+_0x2195f8+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x128361,_0x39ed1e){const _0x157cc3=a240_0x3d2d,_0x5649cb=_0x128361();while(!![]){try{const _0x11b70b=-parseInt(_0x157cc3(0x17f))/0x1+-parseInt(_0x157cc3(0x17d))/0x2+-parseInt(_0x157cc3(0x185))/0x3*(-parseInt(_0x157cc3(0x17c))/0x4)+-parseInt(_0x157cc3(0x182))/0x5+parseInt(_0x157cc3(0x180))/0x6*(parseInt(_0x157cc3(0x183))/0x7)+-parseInt(_0x157cc3(0x184))/0x8*(-parseInt(_0x157cc3(0x17e))/0x9)+parseInt(_0x157cc3(0x181))/0xa;if(_0x11b70b===_0x39ed1e)break;else _0x5649cb['push'](_0x5649cb['shift']());}catch(_0x1bda21){_0x5649cb['push'](_0x5649cb['shift']());}}}(a240_0x569e,0xa57b9));function a240_0x3d2d(_0x22249a,_0x512b68){_0x22249a=_0x22249a-0x17c;const _0x569e6c=a240_0x569e();let _0x3d2d9e=_0x569e6c[_0x22249a];return _0x3d2d9e;}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';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';function a240_0x569e(){const _0x4979b0=['492496eApySk','2688812fbVJuA','357759OWDIWM','924955NpisTI','35832LSxkgZ','25044340SHmyJC','5030775mjLPyt','371tcMdoU','104EnaYvu','15cCubte'];a240_0x569e=function(){return _0x4979b0;};return a240_0x569e();}export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x3d6d51,_0x4fd53f){const _0x1c7300=a240_0x463c,_0x530c5a=_0x3d6d51();while(!![]){try{const _0x249e00=-parseInt(_0x1c7300(0x131))/0x1+-parseInt(_0x1c7300(0x130))/0x2+parseInt(_0x1c7300(0x12b))/0x3+parseInt(_0x1c7300(0x12c))/0x4*(-parseInt(_0x1c7300(0x133))/0x5)+-parseInt(_0x1c7300(0x12d))/0x6*(-parseInt(_0x1c7300(0x132))/0x7)+parseInt(_0x1c7300(0x12f))/0x8+parseInt(_0x1c7300(0x12e))/0x9;if(_0x249e00===_0x4fd53f)break;else _0x530c5a['push'](_0x530c5a['shift']());}catch(_0x37fe06){_0x530c5a['push'](_0x530c5a['shift']());}}}(a240_0x2e26,0xdd482));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a240_0x463c(_0x4c8d7c,_0x523f04){_0x4c8d7c=_0x4c8d7c-0x12b;const _0x2e2623=a240_0x2e26();let _0x463c9a=_0x2e2623[_0x4c8d7c];return _0x463c9a;}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';function a240_0x2e26(){const _0x3c8acb=['4752204qCCuzP','25588MLDfEu','174HJqfJY','7637643ayqNwK','105320QhoAUI','1010244PJvzLK','869393NMlriV','72898sXmDIO','365wnOrdB'];a240_0x2e26=function(){return _0x3c8acb;};return a240_0x2e26();}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
- const a241_0x44cf6e=a241_0x2f6a;(function(_0x459886,_0x4e0666){const _0x116e33=a241_0x2f6a,_0x79b699=_0x459886();while(!![]){try{const _0x5f095a=parseInt(_0x116e33(0xb5))/0x1+-parseInt(_0x116e33(0x95))/0x2*(-parseInt(_0x116e33(0xa1))/0x3)+parseInt(_0x116e33(0xaa))/0x4+parseInt(_0x116e33(0xb3))/0x5+-parseInt(_0x116e33(0x9a))/0x6+-parseInt(_0x116e33(0xb0))/0x7+-parseInt(_0x116e33(0x9f))/0x8;if(_0x5f095a===_0x4e0666)break;else _0x79b699['push'](_0x79b699['shift']());}catch(_0x414368){_0x79b699['push'](_0x79b699['shift']());}}}(a241_0x5d2c,0x213f9));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a241_0x2f6a(_0x7d4667,_0x41c87){_0x7d4667=_0x7d4667-0x93;const _0x5d2ccd=a241_0x5d2c();let _0x2f6af3=_0x5d2ccd[_0x7d4667];return _0x2f6af3;}function a241_0x5d2c(){const _0x1cc698=['pagesize','verbose','List\x20custom\x20SQL\x20queries','sqlcode','list','770994aHDfEK','num','dbId','910705BdiDaG','Filter\x20by\x20SQL\x20name','180271dzIOZG','\x20SQL\x20queries\x20(total:\x20','sqlCode','map','447958hgHPLe','Page\x20size','read','sqlName','bool','954564brPVqR','length','sql','string','No\x20custom\x20SQL\x20queries\x20found.','2806416AJcmpv','totalCount','3kRvUTo','paging','page','name','appCode','boolean','number','str','Found\x20','679328hUPPFc'];a241_0x5d2c=function(){return _0x1cc698;};return a241_0x5d2c();}export const sqlList={'service':a241_0x44cf6e(0x9c),'command':a241_0x44cf6e(0xaf),'description':a241_0x44cf6e(0xad),'risk':a241_0x44cf6e(0x97),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a241_0x44cf6e(0xa4),'type':a241_0x44cf6e(0x9d),'description':a241_0x44cf6e(0xb4)},{'name':a241_0x44cf6e(0xa3),'type':a241_0x44cf6e(0xa7),'description':'Page\x20number','default':0x1},{'name':a241_0x44cf6e(0xab),'type':'number','description':a241_0x44cf6e(0x96)},{'name':a241_0x44cf6e(0xac),'type':a241_0x44cf6e(0xa6),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x576811){const _0x1d2b34=a241_0x44cf6e,_0x2ae84b=await listSqlQueries(_0x576811[_0x1d2b34(0xa5)],{'sqlCode':_0x576811[_0x1d2b34(0xa8)](_0x1d2b34(0xae))||undefined,'sqlName':_0x576811[_0x1d2b34(0xa8)](_0x1d2b34(0xa4))||undefined,'currentPage':_0x576811[_0x1d2b34(0xb1)](_0x1d2b34(0xa3)),'pageSize':_0x576811[_0x1d2b34(0xb1)](_0x1d2b34(0xab),0x32)}),_0x22b978=_0x576811[_0x1d2b34(0x99)](_0x1d2b34(0xac)),_0x5dd9b5=_0x2ae84b['tableData']??[],_0x3a1fa3=_0x2ae84b[_0x1d2b34(0xa2)]?.[_0x1d2b34(0xa0)]??_0x5dd9b5[_0x1d2b34(0x9b)];let _0x29cd7b;return _0x22b978?_0x29cd7b=_0x5dd9b5:_0x29cd7b=await Promise['all'](_0x5dd9b5[_0x1d2b34(0x94)](async _0x569bed=>{const _0x436ed5=_0x1d2b34;let _0x5cab17;try{_0x5cab17=_0x569bed[_0x436ed5(0xb2)]?await getDbName(_0x576811[_0x436ed5(0xa5)],_0x569bed['dbId']):undefined;}catch{}return{'sqlCode':_0x569bed[_0x436ed5(0x93)],'sqlName':_0x569bed[_0x436ed5(0x98)],'description':_0x569bed['description']??'','db':_0x5cab17?_0x5cab17+'\x20('+_0x569bed[_0x436ed5(0xb2)]+')':_0x569bed[_0x436ed5(0xb2)]??''};})),{'ok':!![],'data':_0x29cd7b,'message':_0x5dd9b5[_0x1d2b34(0x9b)]===0x0?_0x1d2b34(0x9e):_0x1d2b34(0xa9)+_0x5dd9b5[_0x1d2b34(0x9b)]+_0x1d2b34(0xb6)+_0x3a1fa3+').'};}};
1
+ const a241_0x143786=a241_0x1969;function a241_0x32ed(){const _0xd8b471=['4213844cEmhxo','List\x20custom\x20SQL\x20queries','str','dbId','sqlCode','string','44xnFbUr','3snqjny','bool','\x20SQL\x20queries\x20(total:\x20','4933ydiKSi','boolean','page','sqlName','list','number','1044730ivThIC','112878xOfiND','474qzzhHN','9WhCPvP','verbose','totalCount','225QpxLMe','name','tableData','description','length','num','Filter\x20by\x20SQL\x20name','2949608syKgbP','Page\x20size','pagesize','622716fvBMOP','appCode','731213tWFZHO','read'];a241_0x32ed=function(){return _0xd8b471;};return a241_0x32ed();}function a241_0x1969(_0xd330c6,_0x33900e){_0xd330c6=_0xd330c6-0x149;const _0x32eda8=a241_0x32ed();let _0x1969fa=_0x32eda8[_0xd330c6];return _0x1969fa;}(function(_0x35a520,_0x24f6b3){const _0x3f7202=a241_0x1969,_0xffdf4=_0x35a520();while(!![]){try{const _0x443c12=parseInt(_0x3f7202(0x164))/0x1*(parseInt(_0x3f7202(0x16c))/0x2)+parseInt(_0x3f7202(0x161))/0x3*(-parseInt(_0x3f7202(0x15a))/0x4)+parseInt(_0x3f7202(0x14c))/0x5*(parseInt(_0x3f7202(0x16b))/0x6)+parseInt(_0x3f7202(0x158))/0x7+-parseInt(_0x3f7202(0x153))/0x8+parseInt(_0x3f7202(0x149))/0x9*(parseInt(_0x3f7202(0x16a))/0xa)+parseInt(_0x3f7202(0x160))/0xb*(-parseInt(_0x3f7202(0x156))/0xc);if(_0x443c12===_0x24f6b3)break;else _0xffdf4['push'](_0xffdf4['shift']());}catch(_0x35ea46){_0xffdf4['push'](_0xffdf4['shift']());}}}(a241_0x32ed,0x913d8));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a241_0x143786(0x168),'description':a241_0x143786(0x15b),'risk':a241_0x143786(0x159),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a241_0x143786(0x14d),'type':a241_0x143786(0x15f),'description':a241_0x143786(0x152)},{'name':a241_0x143786(0x166),'type':a241_0x143786(0x169),'description':'Page\x20number','default':0x1},{'name':a241_0x143786(0x155),'type':'number','description':a241_0x143786(0x154)},{'name':a241_0x143786(0x14a),'type':a241_0x143786(0x165),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x4982ad){const _0x384ccc=a241_0x143786,_0x23e572=await listSqlQueries(_0x4982ad[_0x384ccc(0x157)],{'sqlCode':_0x4982ad[_0x384ccc(0x15c)]('sqlcode')||undefined,'sqlName':_0x4982ad[_0x384ccc(0x15c)]('name')||undefined,'currentPage':_0x4982ad[_0x384ccc(0x151)](_0x384ccc(0x166)),'pageSize':_0x4982ad[_0x384ccc(0x151)](_0x384ccc(0x155),0x32)}),_0x5222ca=_0x4982ad[_0x384ccc(0x162)](_0x384ccc(0x14a)),_0x2b070f=_0x23e572[_0x384ccc(0x14e)]??[],_0x400764=_0x23e572['paging']?.[_0x384ccc(0x14b)]??_0x2b070f[_0x384ccc(0x150)];let _0x5a2283;return _0x5222ca?_0x5a2283=_0x2b070f:_0x5a2283=await Promise['all'](_0x2b070f['map'](async _0x484398=>{const _0x4160b9=_0x384ccc;let _0x5bc28a;try{_0x5bc28a=_0x484398[_0x4160b9(0x15d)]?await getDbName(_0x4982ad[_0x4160b9(0x157)],_0x484398['dbId']):undefined;}catch{}return{'sqlCode':_0x484398[_0x4160b9(0x15e)],'sqlName':_0x484398[_0x4160b9(0x167)],'description':_0x484398[_0x4160b9(0x14f)]??'','db':_0x5bc28a?_0x5bc28a+'\x20('+_0x484398[_0x4160b9(0x15d)]+')':_0x484398[_0x4160b9(0x15d)]??''};})),{'ok':!![],'data':_0x5a2283,'message':_0x2b070f[_0x384ccc(0x150)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':'Found\x20'+_0x2b070f[_0x384ccc(0x150)]+_0x384ccc(0x163)+_0x400764+').'};}};
@@ -1 +1 @@
1
- const a242_0x1a79b6=a242_0x4e2f;function a242_0x5ba8(){const _0x91fafc=['equivalent','sqlContent','POST','7GrDNdJ','sqlcode','trim','.xml','No\x20remote\x20SQL\x20queries\x20matched.','\x20SQL\x20file(s)\x20into\x20','totalCount','lockFilePath','push','mode','test','toLowerCase','Pull\x20complete:\x20','12RJVNEC','map','read','str','catch','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqls','569022trfgdP','force','content','\x20skipped,\x20','569560zmxpRh','233637pgHfYk','path','description','replace','name','Filter\x20by\x20SQL\x20display\x20name','message','length','dbId','sqlName','\x20failed','\x20written,\x20','some','isCanonical','sqlRootDir','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','hash','filter','boolean','tableData','mybatisXml','split','lastSync','55058bnscKe','2651930UrTrgl','file','sqlRoot','3279108AEUkTv','all','sqlCode','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','cancelled','pull','string','4Joomtw','9GPTVYV','5WqpBtY','Would\x20pull\x20','toISOString','appCode','join','skipped','utf8','Force\x20pull\x20cancelled.','1423455RWcmuD','sql','8IHdRzi','local\x20differs\x20from\x20remote','nonInteractive','39yfIuRd','filePath'];a242_0x5ba8=function(){return _0x91fafc;};return a242_0x5ba8();}(function(_0x42f00e,_0x4d5b2f){const _0xe48ca8=a242_0x4e2f,_0x1eb8c4=_0x42f00e();while(!![]){try{const _0x19d924=-parseInt(_0xe48ca8(0x1a1))/0x1*(parseInt(_0xe48ca8(0x18a))/0x2)+-parseInt(_0xe48ca8(0x1c2))/0x3*(-parseInt(_0xe48ca8(0x195))/0x4)+parseInt(_0xe48ca8(0x197))/0x5*(-parseInt(_0xe48ca8(0x1bd))/0x6)+-parseInt(_0xe48ca8(0x1a9))/0x7*(-parseInt(_0xe48ca8(0x1c1))/0x8)+parseInt(_0xe48ca8(0x196))/0x9*(-parseInt(_0xe48ca8(0x18b))/0xa)+parseInt(_0xe48ca8(0x19f))/0xb*(-parseInt(_0xe48ca8(0x1b6))/0xc)+parseInt(_0xe48ca8(0x1a4))/0xd*(parseInt(_0xe48ca8(0x18e))/0xe);if(_0x19d924===_0x4d5b2f)break;else _0x1eb8c4['push'](_0x1eb8c4['shift']());}catch(_0x5e52e4){_0x1eb8c4['push'](_0x1eb8c4['shift']());}}}(a242_0x5ba8,0x22af9));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;function a242_0x4e2f(_0x13f456,_0x20899f){_0x13f456=_0x13f456-0x179;const _0x5ba83c=a242_0x5ba8();let _0x4e2f62=_0x5ba83c[_0x13f456];return _0x4e2f62;}async function fetchAllSqlQueries(_0x430491,_0x15fab4){const _0x5b30fa=a242_0x4e2f,_0x53f3ab=[];let _0x278621=0x1;while(!![]){const _0x102f9b=await listSqlQueries(_0x430491,{'currentPage':_0x278621,'pageSize':PAGE_SIZE,'sqlCode':_0x15fab4[_0x5b30fa(0x190)],'sqlName':_0x15fab4[_0x5b30fa(0x17c)]}),_0x580a12=_0x102f9b[_0x5b30fa(0x186)]??[];_0x53f3ab[_0x5b30fa(0x1b1)](..._0x580a12);if(_0x580a12[_0x5b30fa(0x17a)]===0x0)break;const _0x2ba950=_0x102f9b['paging']?.[_0x5b30fa(0x1af)];if(_0x2ba950!=null?_0x53f3ab['length']>=_0x2ba950:_0x580a12[_0x5b30fa(0x17a)]<PAGE_SIZE)break;_0x278621++;}return _0x53f3ab;}async function ensureSqlContent(_0x1a3476){const _0x240d7d=a242_0x4e2f;if(_0x1a3476['sqlContent']!=null&&String(_0x1a3476[_0x240d7d(0x1a7)])['length']>0x0)return _0x1a3476;return getSqlQueryDetail(_0x1a3476[_0x240d7d(0x190)]);}export const sqlPull={'service':a242_0x1a79b6(0x1a0),'command':a242_0x1a79b6(0x193),'description':a242_0x1a79b6(0x1bb),'risk':a242_0x1a79b6(0x1b8),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a242_0x1a79b6(0x1c6),'type':a242_0x1a79b6(0x194),'description':a242_0x1a79b6(0x1c7)},{'name':a242_0x1a79b6(0x1be),'type':a242_0x1a79b6(0x185),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x3ca7a3){const _0x350986=a242_0x1a79b6,_0x2b89fe=loadSqlProjectConfig(_0x3ca7a3[_0x350986(0x19a)]),_0x2fe5b1=await readSqlLockFile(_0x2b89fe['lockFilePath']),{appLock:_0x424bc7}=ensureSqlLockScope(_0x2fe5b1??createEmptySqlLock(),_0x2b89fe['appCode'],_0x2b89fe[_0x350986(0x18d)],_0x350986(0x193)),_0x3d9534=await fetchAllSqlQueries(_0x3ca7a3['appCode'],{'sqlCode':_0x3ca7a3[_0x350986(0x1b9)](_0x350986(0x1aa))||undefined,'sqlName':_0x3ca7a3['str']('name')||undefined}),_0x32310d=[];for(const _0xff2a18 of _0x3d9534){const _0x3d8b85=await ensureSqlContent(_0xff2a18),_0x2725b2=ensureRemoteSqlContent(_0x3d8b85),_0x224d53=detectSqlMode(_0x2725b2),_0x21c1a2=_0x3d8b85[_0x350986(0x17b)]?await getDbName(_0x3ca7a3[_0x350986(0x19a)],Number(_0x3d8b85[_0x350986(0x17b)]))[_0x350986(0x1ba)](()=>undefined):undefined,_0x10aabf=buildLocalSqlFileContent({'sqlCode':_0x3d8b85[_0x350986(0x190)],'sqlName':_0x3d8b85[_0x350986(0x17c)],'dbId':_0x3d8b85['dbId']},_0x2725b2,{'dbName':_0x21c1a2,'mode':_0x224d53,'syncedAt':new Date()['toISOString'](),'description':_0x3d8b85[_0x350986(0x1c4)]}),_0x316ff5=buildSqlLockEntry(_0x3d8b85,_0x2725b2,'',{'dbName':_0x21c1a2}),_0x177c3f=resolveLocalSqlFilePath(_0x2b89fe,_0x3d8b85[_0x350986(0x190)],_0x316ff5);let _0x16d0d4='would_pull',_0xdd6414;const _0x41cbdc=await findExistingSqlFiles(_0x2b89fe,_0x177c3f,_0x224d53,_0x424bc7[_0x350986(0x1bc)][_0x3d8b85['sqlCode']]);if(_0x41cbdc[_0x350986(0x17a)]>0x0){const _0xb89f3b=await compareExistingSqlFiles(_0x41cbdc,_0x10aabf,_0x224d53);if(_0xb89f3b[_0x350986(0x17f)](({equivalent:_0x4432aa})=>!_0x4432aa))_0x16d0d4='conflict',_0xdd6414=_0x350986(0x191);else _0xb89f3b[_0x350986(0x17a)]===0x1&&_0xb89f3b[0x0]?.[_0x350986(0x18c)][_0x350986(0x180)]&&(_0x16d0d4=_0x350986(0x19c),_0xdd6414='unchanged');}_0x32310d[_0x350986(0x1b1)]({'sqlCode':_0x3d8b85[_0x350986(0x190)],'sqlName':_0x3d8b85['sqlName'],'filePath':_0x177c3f,'status':_0x16d0d4,'reason':_0xdd6414});}return{'method':_0x350986(0x1a8),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x3ca7a3[_0x350986(0x19a)],'sqlCode':_0x3ca7a3[_0x350986(0x1b9)]('sqlcode')||null,'sqlName':_0x3ca7a3[_0x350986(0x1b9)]('name')||null,'files':_0x32310d},'description':_0x350986(0x198)+_0x32310d['length']+_0x350986(0x1ae)+_0x2b89fe[_0x350986(0x181)]};},async 'execute'(_0xc8a5b0){const _0x4049c2=a242_0x1a79b6,_0x21716a=loadSqlProjectConfig(_0xc8a5b0['appCode']),_0x5e5fd9=await readSqlLockFile(_0x21716a[_0x4049c2(0x1b0)]),{lockData:_0x2da450,appLock:_0x3972fc}=ensureSqlLockScope(_0x5e5fd9??createEmptySqlLock(),_0x21716a[_0x4049c2(0x19a)],_0x21716a[_0x4049c2(0x18d)],'pull'),_0x138fac=_0xc8a5b0['bool'](_0x4049c2(0x1be)),_0x535535=await fetchAllSqlQueries(_0xc8a5b0[_0x4049c2(0x19a)],{'sqlCode':_0xc8a5b0[_0x4049c2(0x1b9)](_0x4049c2(0x1aa))||undefined,'sqlName':_0xc8a5b0[_0x4049c2(0x1b9)](_0x4049c2(0x1c6))||undefined});if(_0x535535[_0x4049c2(0x17a)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4049c2(0x1ad)};const _0x58d809=[],_0x31b666=[];for(const _0x1aaf21 of _0x535535){try{_0x58d809['push'](await ensureSqlContent(_0x1aaf21));}catch(_0x6778ec){_0x31b666['push']({'sqlCode':_0x1aaf21['sqlCode'],'error':_0x6778ec instanceof Error?_0x6778ec[_0x4049c2(0x179)]:String(_0x6778ec)});}}if(_0x138fac&&!_0xc8a5b0[_0x4049c2(0x1a3)]){let _0x244d66=![];for(const _0x172b79 of _0x58d809){const _0x3a348c=detectSqlMode(ensureRemoteSqlContent(_0x172b79)),_0x375394=_0x172b79[_0x4049c2(0x17b)]?await getDbName(_0xc8a5b0[_0x4049c2(0x19a)],Number(_0x172b79['dbId']))[_0x4049c2(0x1ba)](()=>undefined):undefined,_0x2e7141=buildLocalSqlFileContent({'sqlCode':_0x172b79[_0x4049c2(0x190)],'sqlName':_0x172b79[_0x4049c2(0x17c)],'dbId':_0x172b79[_0x4049c2(0x17b)]},ensureRemoteSqlContent(_0x172b79),{'dbName':_0x375394,'mode':_0x3a348c,'syncedAt':new Date()[_0x4049c2(0x199)](),'description':_0x172b79['description']}),_0x4ee573=resolveLocalSqlFilePath(_0x21716a,_0x172b79[_0x4049c2(0x190)],buildSqlLockEntry(_0x172b79,ensureRemoteSqlContent(_0x172b79),'',{'dbName':_0x375394})),_0x1dae7d=await findExistingSqlFiles(_0x21716a,_0x4ee573,_0x3a348c,_0x3972fc[_0x4049c2(0x1bc)][_0x172b79[_0x4049c2(0x190)]]),_0x319e99=await compareExistingSqlFiles(_0x1dae7d,_0x2e7141,_0x3a348c);if(_0x319e99[_0x4049c2(0x17f)](({equivalent:_0x449a86})=>!_0x449a86)){_0x244d66=!![];break;}}if(_0x244d66){const _0x2610a4=await confirmForceOverwrite(_0x4049c2(0x182));if(!_0x2610a4)throw CliErrors[_0x4049c2(0x192)](_0x4049c2(0x19e));}}const _0x1faed8=cloneSqlLockData(_0x2da450),_0x1b7462=_0x1faed8['apps'][_0x21716a[_0x4049c2(0x19a)]],_0x26bb1d=[],_0x2f6ed2=[];for(const _0x5421fe of _0x58d809){const _0x3bc206=_0x1b7462[_0x4049c2(0x1bc)][_0x5421fe[_0x4049c2(0x190)]],_0x3e08f5=ensureRemoteSqlContent(_0x5421fe),_0x54bf70=detectSqlMode(_0x3e08f5),_0x31cc1b=_0x5421fe[_0x4049c2(0x17b)]?await getDbName(_0xc8a5b0['appCode'],Number(_0x5421fe[_0x4049c2(0x17b)]))['catch'](()=>undefined):undefined,_0x350747=buildLocalSqlFileContent({'sqlCode':_0x5421fe[_0x4049c2(0x190)],'sqlName':_0x5421fe[_0x4049c2(0x17c)],'dbId':_0x5421fe[_0x4049c2(0x17b)]},_0x3e08f5,{'dbName':_0x31cc1b,'mode':_0x54bf70,'syncedAt':new Date()['toISOString'](),'description':_0x5421fe[_0x4049c2(0x1c4)]}),_0x231af4=buildSqlLockEntry(_0x5421fe,_0x3e08f5,computeSqlContentHash(_0x350747),{'dbName':_0x31cc1b}),_0x572339=_0x231af4[_0x4049c2(0x1c3)],_0x476da7=join(_0x21716a[_0x4049c2(0x181)],_0x572339);try{const _0x535c49=await findExistingSqlFiles(_0x21716a,_0x476da7,_0x54bf70,_0x3bc206),_0x560786=await compareExistingSqlFiles(_0x535c49,_0x350747,_0x54bf70);if(!_0x138fac&&_0x560786[_0x4049c2(0x17f)](({equivalent:_0x2e18cb})=>!_0x2e18cb)){_0x2f6ed2[_0x4049c2(0x1b1)]({'sqlCode':_0x5421fe[_0x4049c2(0x190)],'reason':_0x4049c2(0x1a2)});continue;}const _0x5e6229=_0x560786['find'](({file:_0x4a9f38})=>_0x4a9f38[_0x4049c2(0x180)]),_0x514b55=_0x560786['find'](({file:_0x197b7f})=>!_0x197b7f['isCanonical']);if(_0x5e6229?.[_0x4049c2(0x1a6)]&&!_0x514b55){_0x2f6ed2['push']({'sqlCode':_0x5421fe[_0x4049c2(0x190)],'reason':'unchanged'}),_0x1b7462[_0x4049c2(0x1bc)][_0x5421fe['sqlCode']]={..._0x231af4,'hash':computeSqlContentHash(_0x5e6229[_0x4049c2(0x1bf)]),'path':_0x572339};continue;}!_0x5e6229?.[_0x4049c2(0x1a6)]&&(await ensureParentDirectory(_0x476da7),await writeFile(_0x476da7,_0x350747,'utf8')),_0x514b55&&await rm(_0x514b55[_0x4049c2(0x18c)][_0x4049c2(0x1a5)],{'force':!![]}),_0x1b7462[_0x4049c2(0x1bc)][_0x5421fe[_0x4049c2(0x190)]]={..._0x231af4,'hash':_0x5e6229?.[_0x4049c2(0x1a6)]?computeSqlContentHash(_0x5e6229[_0x4049c2(0x1bf)]):_0x231af4[_0x4049c2(0x183)],'path':_0x572339},_0x26bb1d[_0x4049c2(0x1b1)]({'sqlCode':_0x5421fe[_0x4049c2(0x190)],'filePath':_0x476da7});}catch(_0x1922c2){_0x31b666[_0x4049c2(0x1b1)]({'sqlCode':_0x5421fe[_0x4049c2(0x190)],'error':_0x1922c2 instanceof Error?_0x1922c2[_0x4049c2(0x179)]:String(_0x1922c2)});}}return _0x1b7462[_0x4049c2(0x189)]=new Date()[_0x4049c2(0x199)](),await writeSqlLockFile(_0x21716a['lockFilePath'],_0x1faed8),{'ok':_0x31b666[_0x4049c2(0x17a)]===0x0,'data':{'pulled':_0x26bb1d,'skipped':_0x2f6ed2,'failed':_0x31b666},'message':_0x4049c2(0x1b5)+_0x26bb1d[_0x4049c2(0x17a)]+_0x4049c2(0x17e)+_0x2f6ed2[_0x4049c2(0x17a)]+_0x4049c2(0x1c0)+_0x31b666[_0x4049c2(0x17a)]+_0x4049c2(0x17d)};}};function isEquivalentPulledSqlFile(_0x4edb39,_0x27cd99,_0x1abf3b,_0x15a4e4){if(_0x1abf3b!==_0x15a4e4)return normalizePulledSqlBody(_0x4edb39,_0x1abf3b)===normalizePulledSqlBody(_0x27cd99,_0x15a4e4);return normalizePullComparableContent(_0x4edb39,_0x1abf3b)===normalizePullComparableContent(_0x27cd99,_0x15a4e4);}async function findExistingSqlFiles(_0xa3397a,_0x279a4a,_0x525dce,_0x2ee989){const _0x42424c=a242_0x1a79b6,_0x276df9=[];await fileExists(_0x279a4a)&&_0x276df9['push']({'filePath':_0x279a4a,'mode':_0x525dce,'isCanonical':!![]});if(!_0x2ee989?.[_0x42424c(0x1c3)])return _0x276df9;const _0x305131=join(_0xa3397a[_0x42424c(0x181)],_0x2ee989[_0x42424c(0x1c3)]);if(_0x305131===_0x279a4a)return _0x276df9;return await fileExists(_0x305131)&&_0x276df9[_0x42424c(0x1b1)]({'filePath':_0x305131,'mode':_0x2ee989[_0x42424c(0x1b2)]??modeFromFilePath(_0x305131),'isCanonical':![]}),_0x276df9;}async function compareExistingSqlFiles(_0x464681,_0x319bc8,_0x2b5d89){const _0x2f1311=a242_0x1a79b6;return Promise[_0x2f1311(0x18f)](_0x464681[_0x2f1311(0x1b7)](async _0x4325e7=>{const _0x4ed08c=_0x2f1311,_0x4db559=await readFile(_0x4325e7[_0x4ed08c(0x1a5)],_0x4ed08c(0x19d));return{'file':_0x4325e7,'content':_0x4db559,'equivalent':isEquivalentPulledSqlFile(_0x4db559,_0x319bc8,_0x4325e7[_0x4ed08c(0x1b2)],_0x2b5d89)};}));}function modeFromFilePath(_0x186058){const _0x1a5d45=a242_0x1a79b6;return _0x186058[_0x1a5d45(0x1b4)]()['endsWith'](_0x1a5d45(0x1ac))?_0x1a5d45(0x187):_0x1a5d45(0x1a0);}function normalizePulledSqlBody(_0x5a02a5,_0x1509c4){const _0x3a363c=a242_0x1a79b6;return stripLocalSqlMetadata(_0x5a02a5,_0x1509c4)[_0x3a363c(0x1c5)](/\r\n/g,'\x0a')[_0x3a363c(0x1ab)]();}function normalizePullComparableContent(_0x5ac4fb,_0x4e1161){const _0x175c40=a242_0x1a79b6,_0x400f24=_0x5ac4fb[_0x175c40(0x1c5)](/\r\n/g,'\x0a')[_0x175c40(0x188)]('\x0a'),_0x4f8ed6=_0x400f24[_0x175c40(0x184)](_0x599afc=>!isSyncedAtMetadataLine(_0x599afc,_0x4e1161));return _0x4f8ed6[_0x175c40(0x19b)]('\x0a');}function isSyncedAtMetadataLine(_0x1c9871,_0xd3fac5){const _0x227b95=a242_0x1a79b6;if(_0xd3fac5===_0x227b95(0x187))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x1c9871);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x227b95(0x1b3)](_0x1c9871);}
1
+ const a242_0x5521f9=a242_0x2f02;(function(_0x18e9ae,_0x4f9cac){const _0x2f498c=a242_0x2f02,_0x1bab5b=_0x18e9ae();while(!![]){try{const _0x103ffb=-parseInt(_0x2f498c(0x1bd))/0x1+-parseInt(_0x2f498c(0x1b5))/0x2+parseInt(_0x2f498c(0x1c3))/0x3+-parseInt(_0x2f498c(0x185))/0x4+-parseInt(_0x2f498c(0x1b0))/0x5+-parseInt(_0x2f498c(0x188))/0x6*(-parseInt(_0x2f498c(0x1a3))/0x7)+parseInt(_0x2f498c(0x18c))/0x8;if(_0x103ffb===_0x4f9cac)break;else _0x1bab5b['push'](_0x1bab5b['shift']());}catch(_0x48f1aa){_0x1bab5b['push'](_0x1bab5b['shift']());}}}(a242_0x23b2,0x964a3));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;function a242_0x23b2(){const _0x15403b=['paging','Filter\x20by\x20SQL\x20display\x20name','apps','endsWith','toLowerCase','path','sqlName','\x20skipped,\x20','1954224VTxdxf','some','POST','910668WApRUW','sqlRoot','trim','sqlCode','7288304UnHexn','sqlContent','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','Force\x20overwrite\x20local\x20unsynced\x20changes','replace','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','tableData','read','test','totalCount','content','isCanonical','would_pull','filter','boolean','lastSync','push','appCode','sql','force','description','sqlRootDir','35XRnjyG','Pull\x20complete:\x20','unchanged','map','mybatisXml','pull','\x20written,\x20','filePath','cancelled','length','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','skipped','dbId','839705XuVymG','message','file','lockFilePath','nonInteractive','1471414MXraxW','hash','equivalent','all','name','find','sqls','toISOString','826537eEKzwC','utf8','join','\x20failed','sqlcode','conflict','3493200SMXYCD','mode','str'];a242_0x23b2=function(){return _0x15403b;};return a242_0x23b2();}async function fetchAllSqlQueries(_0x23bcc9,_0x43ced8){const _0x2fb091=a242_0x2f02,_0x30c4c9=[];let _0x3f200d=0x1;while(!![]){const _0x36bb8b=await listSqlQueries(_0x23bcc9,{'currentPage':_0x3f200d,'pageSize':PAGE_SIZE,'sqlCode':_0x43ced8[_0x2fb091(0x18b)],'sqlName':_0x43ced8[_0x2fb091(0x183)]}),_0x5aa797=_0x36bb8b[_0x2fb091(0x193)]??[];_0x30c4c9['push'](..._0x5aa797);if(_0x5aa797[_0x2fb091(0x1ac)]===0x0)break;const _0x5ec7c8=_0x36bb8b[_0x2fb091(0x1c6)]?.[_0x2fb091(0x196)];if(_0x5ec7c8!=null?_0x30c4c9[_0x2fb091(0x1ac)]>=_0x5ec7c8:_0x5aa797['length']<PAGE_SIZE)break;_0x3f200d++;}return _0x30c4c9;}async function ensureSqlContent(_0x12a33f){const _0x95a131=a242_0x2f02;if(_0x12a33f[_0x95a131(0x18d)]!=null&&String(_0x12a33f[_0x95a131(0x18d)])[_0x95a131(0x1ac)]>0x0)return _0x12a33f;return getSqlQueryDetail(_0x12a33f[_0x95a131(0x18b)]);}export const sqlPull={'service':a242_0x5521f9(0x19f),'command':a242_0x5521f9(0x1a8),'description':a242_0x5521f9(0x1ad),'risk':a242_0x5521f9(0x194),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a242_0x5521f9(0x1b9),'type':'string','description':a242_0x5521f9(0x1c7)},{'name':a242_0x5521f9(0x1a0),'type':a242_0x5521f9(0x19b),'description':a242_0x5521f9(0x190)}],async 'dryRun'(_0x4a55b0){const _0x13da3f=a242_0x5521f9,_0x110655=loadSqlProjectConfig(_0x4a55b0[_0x13da3f(0x19e)]),_0x2091ce=await readSqlLockFile(_0x110655[_0x13da3f(0x1b3)]),{appLock:_0x5ceed8}=ensureSqlLockScope(_0x2091ce??createEmptySqlLock(),_0x110655[_0x13da3f(0x19e)],_0x110655['sqlRoot'],_0x13da3f(0x1a8)),_0x551cee=await fetchAllSqlQueries(_0x4a55b0[_0x13da3f(0x19e)],{'sqlCode':_0x4a55b0[_0x13da3f(0x1c5)](_0x13da3f(0x1c1))||undefined,'sqlName':_0x4a55b0[_0x13da3f(0x1c5)]('name')||undefined}),_0x5697f4=[];for(const _0x7b1a1a of _0x551cee){const _0x2377b6=await ensureSqlContent(_0x7b1a1a),_0x4dcee7=ensureRemoteSqlContent(_0x2377b6),_0x38ee9a=detectSqlMode(_0x4dcee7),_0x12965e=_0x2377b6[_0x13da3f(0x1af)]?await getDbName(_0x4a55b0['appCode'],Number(_0x2377b6[_0x13da3f(0x1af)]))['catch'](()=>undefined):undefined,_0x11d38f=buildLocalSqlFileContent({'sqlCode':_0x2377b6[_0x13da3f(0x18b)],'sqlName':_0x2377b6[_0x13da3f(0x183)],'dbId':_0x2377b6[_0x13da3f(0x1af)]},_0x4dcee7,{'dbName':_0x12965e,'mode':_0x38ee9a,'syncedAt':new Date()[_0x13da3f(0x1bc)](),'description':_0x2377b6[_0x13da3f(0x1a1)]}),_0x31e012=buildSqlLockEntry(_0x2377b6,_0x4dcee7,'',{'dbName':_0x12965e}),_0x2fd890=resolveLocalSqlFilePath(_0x110655,_0x2377b6[_0x13da3f(0x18b)],_0x31e012);let _0xf01603=_0x13da3f(0x199),_0x3013b8;const _0x30851a=await findExistingSqlFiles(_0x110655,_0x2fd890,_0x38ee9a,_0x5ceed8[_0x13da3f(0x1bb)][_0x2377b6['sqlCode']]);if(_0x30851a[_0x13da3f(0x1ac)]>0x0){const _0x13f387=await compareExistingSqlFiles(_0x30851a,_0x11d38f,_0x38ee9a);if(_0x13f387[_0x13da3f(0x186)](({equivalent:_0x3cfffd})=>!_0x3cfffd))_0xf01603=_0x13da3f(0x1c2),_0x3013b8=_0x13da3f(0x18e);else _0x13f387[_0x13da3f(0x1ac)]===0x1&&_0x13f387[0x0]?.[_0x13da3f(0x1b2)][_0x13da3f(0x198)]&&(_0xf01603=_0x13da3f(0x1ae),_0x3013b8=_0x13da3f(0x1a5));}_0x5697f4[_0x13da3f(0x19d)]({'sqlCode':_0x2377b6[_0x13da3f(0x18b)],'sqlName':_0x2377b6[_0x13da3f(0x183)],'filePath':_0x2fd890,'status':_0xf01603,'reason':_0x3013b8});}return{'method':_0x13da3f(0x187),'url':_0x13da3f(0x18f),'body':{'appCode':_0x4a55b0[_0x13da3f(0x19e)],'sqlCode':_0x4a55b0[_0x13da3f(0x1c5)](_0x13da3f(0x1c1))||null,'sqlName':_0x4a55b0['str'](_0x13da3f(0x1b9))||null,'files':_0x5697f4},'description':'Would\x20pull\x20'+_0x5697f4['length']+'\x20SQL\x20file(s)\x20into\x20'+_0x110655['sqlRootDir']};},async 'execute'(_0x21dcac){const _0x204973=a242_0x5521f9,_0x44878a=loadSqlProjectConfig(_0x21dcac['appCode']),_0xb8cfb=await readSqlLockFile(_0x44878a['lockFilePath']),{lockData:_0x4949ff,appLock:_0x547801}=ensureSqlLockScope(_0xb8cfb??createEmptySqlLock(),_0x44878a['appCode'],_0x44878a[_0x204973(0x189)],_0x204973(0x1a8)),_0x2b5609=_0x21dcac['bool'](_0x204973(0x1a0)),_0x4564e7=await fetchAllSqlQueries(_0x21dcac['appCode'],{'sqlCode':_0x21dcac[_0x204973(0x1c5)](_0x204973(0x1c1))||undefined,'sqlName':_0x21dcac[_0x204973(0x1c5)](_0x204973(0x1b9))||undefined});if(_0x4564e7[_0x204973(0x1ac)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x2b9e26=[],_0x396b44=[];for(const _0x1a5338 of _0x4564e7){try{_0x2b9e26[_0x204973(0x19d)](await ensureSqlContent(_0x1a5338));}catch(_0x57d734){_0x396b44['push']({'sqlCode':_0x1a5338[_0x204973(0x18b)],'error':_0x57d734 instanceof Error?_0x57d734['message']:String(_0x57d734)});}}if(_0x2b5609&&!_0x21dcac[_0x204973(0x1b4)]){let _0x20b904=![];for(const _0x11fbb4 of _0x2b9e26){const _0x319bae=detectSqlMode(ensureRemoteSqlContent(_0x11fbb4)),_0x420532=_0x11fbb4[_0x204973(0x1af)]?await getDbName(_0x21dcac['appCode'],Number(_0x11fbb4['dbId']))['catch'](()=>undefined):undefined,_0x57330f=buildLocalSqlFileContent({'sqlCode':_0x11fbb4['sqlCode'],'sqlName':_0x11fbb4[_0x204973(0x183)],'dbId':_0x11fbb4[_0x204973(0x1af)]},ensureRemoteSqlContent(_0x11fbb4),{'dbName':_0x420532,'mode':_0x319bae,'syncedAt':new Date()['toISOString'](),'description':_0x11fbb4[_0x204973(0x1a1)]}),_0x3e9697=resolveLocalSqlFilePath(_0x44878a,_0x11fbb4[_0x204973(0x18b)],buildSqlLockEntry(_0x11fbb4,ensureRemoteSqlContent(_0x11fbb4),'',{'dbName':_0x420532})),_0x285a4b=await findExistingSqlFiles(_0x44878a,_0x3e9697,_0x319bae,_0x547801[_0x204973(0x1bb)][_0x11fbb4[_0x204973(0x18b)]]),_0x8386e3=await compareExistingSqlFiles(_0x285a4b,_0x57330f,_0x319bae);if(_0x8386e3[_0x204973(0x186)](({equivalent:_0x42f1c8})=>!_0x42f1c8)){_0x20b904=!![];break;}}if(_0x20b904){const _0x1f43ce=await confirmForceOverwrite(_0x204973(0x192));if(!_0x1f43ce)throw CliErrors[_0x204973(0x1ab)]('Force\x20pull\x20cancelled.');}}const _0x1c6ec8=cloneSqlLockData(_0x4949ff),_0xd15ef8=_0x1c6ec8[_0x204973(0x1c8)][_0x44878a[_0x204973(0x19e)]],_0x501e92=[],_0x2aa60d=[];for(const _0x4331c0 of _0x2b9e26){const _0xcd9185=_0xd15ef8[_0x204973(0x1bb)][_0x4331c0[_0x204973(0x18b)]],_0x34484c=ensureRemoteSqlContent(_0x4331c0),_0x7469b8=detectSqlMode(_0x34484c),_0x3e9234=_0x4331c0[_0x204973(0x1af)]?await getDbName(_0x21dcac['appCode'],Number(_0x4331c0[_0x204973(0x1af)]))['catch'](()=>undefined):undefined,_0x56161b=buildLocalSqlFileContent({'sqlCode':_0x4331c0['sqlCode'],'sqlName':_0x4331c0[_0x204973(0x183)],'dbId':_0x4331c0['dbId']},_0x34484c,{'dbName':_0x3e9234,'mode':_0x7469b8,'syncedAt':new Date()[_0x204973(0x1bc)](),'description':_0x4331c0[_0x204973(0x1a1)]}),_0x4c0df2=buildSqlLockEntry(_0x4331c0,_0x34484c,computeSqlContentHash(_0x56161b),{'dbName':_0x3e9234}),_0x36f4cb=_0x4c0df2[_0x204973(0x182)],_0x381b34=join(_0x44878a[_0x204973(0x1a2)],_0x36f4cb);try{const _0x113529=await findExistingSqlFiles(_0x44878a,_0x381b34,_0x7469b8,_0xcd9185),_0x587d0f=await compareExistingSqlFiles(_0x113529,_0x56161b,_0x7469b8);if(!_0x2b5609&&_0x587d0f['some'](({equivalent:_0x9d5da1})=>!_0x9d5da1)){_0x2aa60d[_0x204973(0x19d)]({'sqlCode':_0x4331c0[_0x204973(0x18b)],'reason':'local\x20differs\x20from\x20remote'});continue;}const _0x206d37=_0x587d0f[_0x204973(0x1ba)](({file:_0x324997})=>_0x324997[_0x204973(0x198)]),_0x279c69=_0x587d0f['find'](({file:_0x12ecef})=>!_0x12ecef[_0x204973(0x198)]);if(_0x206d37?.[_0x204973(0x1b7)]&&!_0x279c69){_0x2aa60d[_0x204973(0x19d)]({'sqlCode':_0x4331c0['sqlCode'],'reason':_0x204973(0x1a5)}),_0xd15ef8[_0x204973(0x1bb)][_0x4331c0[_0x204973(0x18b)]]={..._0x4c0df2,'hash':computeSqlContentHash(_0x206d37[_0x204973(0x197)]),'path':_0x36f4cb};continue;}!_0x206d37?.[_0x204973(0x1b7)]&&(await ensureParentDirectory(_0x381b34),await writeFile(_0x381b34,_0x56161b,_0x204973(0x1be))),_0x279c69&&await rm(_0x279c69[_0x204973(0x1b2)][_0x204973(0x1aa)],{'force':!![]}),_0xd15ef8['sqls'][_0x4331c0[_0x204973(0x18b)]]={..._0x4c0df2,'hash':_0x206d37?.[_0x204973(0x1b7)]?computeSqlContentHash(_0x206d37['content']):_0x4c0df2[_0x204973(0x1b6)],'path':_0x36f4cb},_0x501e92['push']({'sqlCode':_0x4331c0[_0x204973(0x18b)],'filePath':_0x381b34});}catch(_0x35872d){_0x396b44[_0x204973(0x19d)]({'sqlCode':_0x4331c0[_0x204973(0x18b)],'error':_0x35872d instanceof Error?_0x35872d[_0x204973(0x1b1)]:String(_0x35872d)});}}return _0xd15ef8[_0x204973(0x19c)]=new Date()[_0x204973(0x1bc)](),await writeSqlLockFile(_0x44878a[_0x204973(0x1b3)],_0x1c6ec8),{'ok':_0x396b44[_0x204973(0x1ac)]===0x0,'data':{'pulled':_0x501e92,'skipped':_0x2aa60d,'failed':_0x396b44},'message':_0x204973(0x1a4)+_0x501e92[_0x204973(0x1ac)]+_0x204973(0x1a9)+_0x2aa60d[_0x204973(0x1ac)]+_0x204973(0x184)+_0x396b44[_0x204973(0x1ac)]+_0x204973(0x1c0)};}};function isEquivalentPulledSqlFile(_0x171c85,_0x2a89d7,_0x20fe08,_0x5e3006){if(_0x20fe08!==_0x5e3006)return normalizePulledSqlBody(_0x171c85,_0x20fe08)===normalizePulledSqlBody(_0x2a89d7,_0x5e3006);return normalizePullComparableContent(_0x171c85,_0x20fe08)===normalizePullComparableContent(_0x2a89d7,_0x5e3006);}async function findExistingSqlFiles(_0x419370,_0x1704e1,_0x44e5bc,_0x4b4022){const _0x20ff7e=a242_0x5521f9,_0x34f91d=[];await fileExists(_0x1704e1)&&_0x34f91d[_0x20ff7e(0x19d)]({'filePath':_0x1704e1,'mode':_0x44e5bc,'isCanonical':!![]});if(!_0x4b4022?.['path'])return _0x34f91d;const _0x786326=join(_0x419370[_0x20ff7e(0x1a2)],_0x4b4022[_0x20ff7e(0x182)]);if(_0x786326===_0x1704e1)return _0x34f91d;return await fileExists(_0x786326)&&_0x34f91d[_0x20ff7e(0x19d)]({'filePath':_0x786326,'mode':_0x4b4022[_0x20ff7e(0x1c4)]??modeFromFilePath(_0x786326),'isCanonical':![]}),_0x34f91d;}async function compareExistingSqlFiles(_0x3ae75d,_0x5ed55e,_0x20cdcc){const _0x40f0ab=a242_0x5521f9;return Promise[_0x40f0ab(0x1b8)](_0x3ae75d[_0x40f0ab(0x1a6)](async _0xdadf80=>{const _0x30957e=_0x40f0ab,_0x35a8a8=await readFile(_0xdadf80['filePath'],_0x30957e(0x1be));return{'file':_0xdadf80,'content':_0x35a8a8,'equivalent':isEquivalentPulledSqlFile(_0x35a8a8,_0x5ed55e,_0xdadf80[_0x30957e(0x1c4)],_0x20cdcc)};}));}function modeFromFilePath(_0x488340){const _0x3a6cf3=a242_0x5521f9;return _0x488340[_0x3a6cf3(0x1ca)]()[_0x3a6cf3(0x1c9)]('.xml')?_0x3a6cf3(0x1a7):_0x3a6cf3(0x19f);}function normalizePulledSqlBody(_0x5e0962,_0x4128f0){const _0x5ce773=a242_0x5521f9;return stripLocalSqlMetadata(_0x5e0962,_0x4128f0)[_0x5ce773(0x191)](/\r\n/g,'\x0a')[_0x5ce773(0x18a)]();}function normalizePullComparableContent(_0x5a22bc,_0x3cae2a){const _0x24f4a3=a242_0x5521f9,_0x1b7076=_0x5a22bc['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x3cb9d6=_0x1b7076[_0x24f4a3(0x19a)](_0xd8ceb4=>!isSyncedAtMetadataLine(_0xd8ceb4,_0x3cae2a));return _0x3cb9d6[_0x24f4a3(0x1bf)]('\x0a');}function a242_0x2f02(_0x1b8229,_0x33e1cb){_0x1b8229=_0x1b8229-0x182;const _0x23b233=a242_0x23b2();let _0x2f02c9=_0x23b233[_0x1b8229];return _0x2f02c9;}function isSyncedAtMetadataLine(_0x172111,_0x210085){const _0x16da6a=a242_0x5521f9;if(_0x210085==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x16da6a(0x195)](_0x172111);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x172111);}
@@ -1 +1 @@
1
- const a243_0x4ed571=a243_0x1ecd;(function(_0x56caea,_0x365f46){const _0x2549fc=a243_0x1ecd,_0x1c9229=_0x56caea();while(!![]){try{const _0x2a7f5f=-parseInt(_0x2549fc(0x1dd))/0x1*(-parseInt(_0x2549fc(0x1b1))/0x2)+parseInt(_0x2549fc(0x1de))/0x3+-parseInt(_0x2549fc(0x1bf))/0x4*(parseInt(_0x2549fc(0x1b6))/0x5)+-parseInt(_0x2549fc(0x1eb))/0x6+parseInt(_0x2549fc(0x1d2))/0x7*(parseInt(_0x2549fc(0x1c3))/0x8)+parseInt(_0x2549fc(0x1ca))/0x9+-parseInt(_0x2549fc(0x1f5))/0xa*(parseInt(_0x2549fc(0x1c6))/0xb);if(_0x2a7f5f===_0x365f46)break;else _0x1c9229['push'](_0x1c9229['shift']());}catch(_0x24029e){_0x1c9229['push'](_0x1c9229['shift']());}}}(a243_0x2e8b,0x7de3a));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a243_0x1ecd(_0x5cd800,_0x214e3f){_0x5cd800=_0x5cd800-0x1ae;const _0x2e8bc2=a243_0x2e8b();let _0x1ecd98=_0x2e8bc2[_0x5cd800];return _0x1ecd98;}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(_0x6ac5bc){const _0x1e34f6=a243_0x1ecd,_0x4bbf71=stripLocalSqlMetadata(await readFile(_0x6ac5bc[_0x1e34f6(0x1b5)],_0x1e34f6(0x1d5)),_0x6ac5bc['mode']);if(!_0x4bbf71[_0x1e34f6(0x1b9)]())throw CliErrors[_0x1e34f6(0x1ef)](_0x6ac5bc[_0x1e34f6(0x1d8)]+_0x1e34f6(0x1c7));return _0x4bbf71;}async function getTargetSqlQueries(_0x2ad85d,_0x578bc2,_0x2db995){const _0x3c1e10=a243_0x1ecd,_0x2c35b3=await scanLocalSqlQueries(_0x2ad85d),_0x31833c=new Map();for(const _0x58c353 of _0x2c35b3){if(_0x2db995&&_0x58c353['sqlCode']!==_0x2db995)continue;const _0x289d21=_0x31833c[_0x3c1e10(0x1d7)](_0x58c353[_0x3c1e10(0x1d8)])??[];_0x289d21[_0x3c1e10(0x1df)](_0x58c353),_0x31833c['set'](_0x58c353[_0x3c1e10(0x1d8)],_0x289d21);}if(_0x2db995&&!_0x31833c[_0x3c1e10(0x1f3)](_0x2db995))throw CliErrors['validation'](_0x3c1e10(0x1bd)+_0x2db995);const _0x27efd1=[];for(const [_0x14fa8e,_0x2fb0ce]of _0x31833c[_0x3c1e10(0x1f4)]()){if(_0x2fb0ce[_0x3c1e10(0x1e9)]===0x1){_0x27efd1[_0x3c1e10(0x1df)](_0x2fb0ce[0x0]);continue;}const _0x20b346=_0x578bc2[_0x3c1e10(0x1d6)][_0x14fa8e],_0x19f0e3=_0x20b346?.[_0x3c1e10(0x1d4)],_0x1a3a65=_0x19f0e3?_0x2fb0ce[_0x3c1e10(0x1e3)](_0x53b7de=>_0x53b7de[_0x3c1e10(0x1c2)]!==_0x19f0e3):_0x2fb0ce;if(_0x20b346&&_0x1a3a65['length']===0x1){_0x27efd1[_0x3c1e10(0x1df)](_0x1a3a65[0x0]);continue;}throw CliErrors['validation'](_0x3c1e10(0x1cd)+_0x14fa8e+_0x3c1e10(0x1c4));}return _0x27efd1;}export const sqlPush={'service':a243_0x4ed571(0x1b0),'command':a243_0x4ed571(0x1df),'description':a243_0x4ed571(0x1cf),'risk':a243_0x4ed571(0x1ba),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a243_0x4ed571(0x1e7),'type':'boolean','description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x4bae18){const _0x153f23=a243_0x4ed571,_0x2ca4e8=loadSqlProjectConfig(_0x4bae18[_0x153f23(0x1cc)]),_0x184997=await readSqlLockFile(_0x2ca4e8['lockFilePath']),{appLock:_0x40b77c}=ensureSqlLockScope(_0x184997??createEmptySqlLock(),_0x4bae18[_0x153f23(0x1cc)],_0x2ca4e8['sqlRoot'],_0x153f23(0x1df)),_0x174ad1=await getTargetSqlQueries(_0x2ca4e8,_0x40b77c,_0x4bae18[_0x153f23(0x1b4)](_0x153f23(0x1b7))||undefined),_0x228805=[];for(const _0x2d6e05 of _0x174ad1){const _0x5dbae7=await computeSqlFileHash(_0x2d6e05[_0x153f23(0x1b5)]),_0x54e2e1=_0x40b77c[_0x153f23(0x1d6)][_0x2d6e05[_0x153f23(0x1d8)]],_0x27cd3c=!!_0x54e2e1&&(_0x54e2e1[_0x153f23(0x1d4)]!==_0x2d6e05['relativePath']||!!_0x2d6e05[_0x153f23(0x1be)]&&_0x54e2e1[_0x153f23(0x1be)]!==_0x2d6e05['sqlName']||_0x54e2e1[_0x153f23(0x1e8)]!==_0x2d6e05[_0x153f23(0x1e8)]);if(!_0x4bae18[_0x153f23(0x1d1)](_0x153f23(0x1e7))&&_0x54e2e1&&_0x54e2e1[_0x153f23(0x1ce)]===_0x5dbae7&&!_0x27cd3c)continue;if(!_0x54e2e1)throw CliErrors[_0x153f23(0x1ef)](_0x2d6e05[_0x153f23(0x1d8)]+':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.');if(_0x54e2e1[_0x153f23(0x1e2)]==null)throw CliErrors['validation'](_0x2d6e05['sqlCode']+_0x153f23(0x1d0));await resolveTargetDbBinding(_0x4bae18[_0x153f23(0x1cc)],_0x2d6e05,_0x54e2e1),await readSqlUploadContent(_0x2d6e05),_0x228805[_0x153f23(0x1df)](_0x2d6e05[_0x153f23(0x1d8)]);}return{'method':_0x153f23(0x1bc),'url':_0x153f23(0x1e6),'body':{'sqlCodes':_0x228805,'appCode':_0x4bae18[_0x153f23(0x1cc)]},'description':_0x153f23(0x1d9)+_0x228805[_0x153f23(0x1e9)]+_0x153f23(0x1ee)};},async 'execute'(_0xd007e6){const _0x176b2a=a243_0x4ed571,_0xd570b8=loadSqlProjectConfig(_0xd007e6[_0x176b2a(0x1cc)]),_0x33c599=await readSqlLockFile(_0xd570b8[_0x176b2a(0x1e4)]),{lockData:_0x42ce63,appLock:_0x3cdcff}=ensureSqlLockScope(_0x33c599??createEmptySqlLock(),_0xd007e6[_0x176b2a(0x1cc)],_0xd570b8[_0x176b2a(0x1c0)],_0x176b2a(0x1df)),_0x31ea87=await getTargetSqlQueries(_0xd570b8,_0x3cdcff,_0xd007e6[_0x176b2a(0x1b4)](_0x176b2a(0x1b7))||undefined);if(_0x31ea87[_0x176b2a(0x1e9)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x176b2a(0x1f0)};const _0xcf14a4=[],_0x32852b=[],_0x13ea07=[];let _0x45df9f=![];for(const _0x5a307c of _0x31ea87){const _0x51eb94=_0x3cdcff['sqls'][_0x5a307c['sqlCode']];if(!_0x51eb94){_0x13ea07[_0x176b2a(0x1df)]({'sqlCode':_0x5a307c[_0x176b2a(0x1d8)],'error':_0x176b2a(0x1ed)});continue;}try{const _0x10f435=await computeSqlFileHash(_0x5a307c[_0x176b2a(0x1b5)]),_0x583bcd=_0x51eb94[_0x176b2a(0x1d4)]!==_0x5a307c[_0x176b2a(0x1c2)]||!!_0x5a307c['sqlName']&&_0x51eb94[_0x176b2a(0x1be)]!==_0x5a307c[_0x176b2a(0x1be)]||_0x51eb94[_0x176b2a(0x1e8)]!==_0x5a307c['mode'];if(!_0xd007e6[_0x176b2a(0x1d1)](_0x176b2a(0x1e7))&&_0x51eb94[_0x176b2a(0x1ce)]===_0x10f435&&!_0x583bcd){_0x32852b['push']({'sqlCode':_0x5a307c[_0x176b2a(0x1d8)],'reason':_0x176b2a(0x1f1)});continue;}if(_0x51eb94[_0x176b2a(0x1e2)]==null){_0x13ea07['push']({'sqlCode':_0x5a307c[_0x176b2a(0x1d8)],'error':_0x176b2a(0x1b8)});continue;}const _0x369bef=_0x5a307c[_0x176b2a(0x1be)]||_0x51eb94[_0x176b2a(0x1be)],_0x51f257=await resolveTargetDbBinding(_0xd007e6[_0x176b2a(0x1cc)],_0x5a307c,_0x51eb94),_0x142370=await readSqlUploadContent(_0x5a307c),_0x27da56=await updateSqlQuery({'id':_0x51eb94[_0x176b2a(0x1da)],'appCode':_0xd007e6[_0x176b2a(0x1cc)],'sqlCode':_0x5a307c[_0x176b2a(0x1d8)],'sqlName':_0x369bef,'dbId':_0x51f257[_0x176b2a(0x1c9)],'version':_0x51eb94[_0x176b2a(0x1e2)],'sqlContent':_0x142370,'sqlConfig':_0x51eb94['sqlConfig']??undefined}),_0x37f7cf=_0x27da56[_0x176b2a(0x1c9)]?await getDbName(_0xd007e6['appCode'],Number(_0x27da56[_0x176b2a(0x1c9)]))[_0x176b2a(0x1cb)](()=>_0x51f257[_0x176b2a(0x1dc)]):_0x51f257[_0x176b2a(0x1dc)];_0x3cdcff[_0x176b2a(0x1d6)][_0x5a307c[_0x176b2a(0x1d8)]]={...buildSqlLockEntry(_0x27da56,_0x142370,_0x10f435,{'dbName':_0x37f7cf}),'path':_0x5a307c[_0x176b2a(0x1c2)],'mode':_0x5a307c[_0x176b2a(0x1e8)]},_0x45df9f=!![],await archivePreviousSqlFileIfNeeded(_0xd570b8,_0x51eb94[_0x176b2a(0x1d4)],_0x5a307c['relativePath']),_0xcf14a4[_0x176b2a(0x1df)]({'sqlCode':_0x5a307c[_0x176b2a(0x1d8)],'remoteId':_0x51eb94[_0x176b2a(0x1da)]});}catch(_0x4f6203){_0x13ea07[_0x176b2a(0x1df)]({'sqlCode':_0x5a307c[_0x176b2a(0x1d8)],'error':_0x4f6203 instanceof Error?_0x4f6203[_0x176b2a(0x1c8)]:String(_0x4f6203)});}}(_0x45df9f||_0x13ea07[_0x176b2a(0x1e9)]===0x0)&&(_0x3cdcff[_0x176b2a(0x1ec)]=new Date()[_0x176b2a(0x1e1)](),await writeSqlLockFile(_0xd570b8[_0x176b2a(0x1e4)],_0x42ce63));const _0x2ae82d=_0x13ea07[_0x176b2a(0x1e9)]===0x0;return{'ok':_0x2ae82d,'data':{'pushed':_0xcf14a4,'skipped':_0x32852b,'failed':_0x13ea07},'message':'Push\x20complete:\x20'+_0xcf14a4[_0x176b2a(0x1e9)]+_0x176b2a(0x1ae)+_0x32852b[_0x176b2a(0x1e9)]+_0x176b2a(0x1b2)+_0x13ea07['length']+_0x176b2a(0x1b3)};}};async function archivePreviousSqlFileIfNeeded(_0x1b6624,_0x5b4494,_0x4782b2){const _0x20f406=a243_0x4ed571;if(!_0x5b4494||_0x5b4494===_0x4782b2)return;const _0x37f8a5=join(_0x1b6624[_0x20f406(0x1db)],_0x5b4494);if(!await fileExists(_0x37f8a5))return;const _0x242ee6=await moveToTrash(_0x1b6624[_0x20f406(0x1ea)],_0x1b6624['trashDir'],_0x37f8a5);await cleanupEmptyDirectories(dirname(_0x37f8a5),_0x1b6624[_0x20f406(0x1db)]),void _0x242ee6;}async function moveToTrash(_0x3d2da4,_0x27498f,_0x32e7ca){const _0x2c0051=a243_0x4ed571,_0x332940=new Date()[_0x2c0051(0x1e1)]()[_0x2c0051(0x1f2)](/[:.]/g,'-'),_0x4918f9=relative(_0x3d2da4,_0x32e7ca),_0x332741=join(_0x27498f,_0x332940,_0x4918f9);return await mkdir(dirname(_0x332741),{'recursive':!![]}),await rename(_0x32e7ca,_0x332741),_0x332741;}async function cleanupEmptyDirectories(_0x14c627,_0x1d7dba){const _0x1a9d32=a243_0x4ed571;let _0x10db40=resolve(_0x14c627);const _0x1643df=resolve(_0x1d7dba);while(_0x10db40[_0x1a9d32(0x1bb)](''+_0x1643df+sep)||_0x10db40===_0x1643df){if(_0x10db40===_0x1643df)return;try{const _0x346f03=await readdir(_0x10db40);if(_0x346f03[_0x1a9d32(0x1e9)]>0x0)return;await rmdir(_0x10db40);}catch{return;}_0x10db40=dirname(_0x10db40);}}function a243_0x2e8b(){const _0x29d654=['push','map','toISOString','version','filter','lockFilePath','Local\x20directory\x20\x22','/smartapi/custom/updateUserCustomSql','force','mode','length','projectRoot','4983114lmmHZo','lastSync','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','\x20SQL\x20file(s)','validation','No\x20local\x20SQL\x20files\x20found.','unchanged','replace','has','entries','22150zsjpTu','\x20pushed,\x20','exec','sql','2YrnncK','\x20skipped,\x20','\x20failed','str','filePath','356795mFYFrb','sqlcode','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','trim','write','startsWith','POST','Local\x20SQL\x20not\x20found:\x20','sqlName','52zctxHd','sqlRoot','No\x20database\x20matches\x20local\x20directory\x20\x22','relativePath','184rrXdmh','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','198uZIHwU',':\x20SQL\x20content\x20is\x20empty.','message','dbId','5359599SVBDMD','catch','appCode','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','hash','Push\x20local\x20SQL\x20files\x20to\x20remote',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','bool','29477jXIXYe','join','path','utf8','sqls','get','sqlCode','Would\x20push\x20','remoteId','sqlRootDir','dbName','607741kBaGYD','3040779ynrZaJ'];a243_0x2e8b=function(){return _0x29d654;};return a243_0x2e8b();}async function resolveTargetDbBinding(_0x4636f7,_0x202a91,_0x1bf78e){const _0x22f24d=a243_0x4ed571,_0x47b2c7=_0x202a91['dbDirectory'];if(!_0x47b2c7)return{'dbId':_0x1bf78e[_0x22f24d(0x1c9)],'dbName':_0x1bf78e[_0x22f24d(0x1dc)]};const _0x7a2302=buildDbDirectoryName(_0x1bf78e[_0x22f24d(0x1dc)],_0x1bf78e[_0x22f24d(0x1c9)]);if(_0x47b2c7===_0x7a2302)return{'dbId':_0x1bf78e[_0x22f24d(0x1c9)],'dbName':_0x1bf78e[_0x22f24d(0x1dc)]};const _0x282dcc=parseExplicitDbDirectory(_0x47b2c7);if(_0x282dcc!=null)return{'dbId':_0x282dcc,'dbName':await getDbName(_0x4636f7,_0x282dcc)['catch'](()=>undefined)};const _0x432e0f=await listDatabases(_0x4636f7),_0x5d1910=_0x432e0f[_0x22f24d(0x1e3)](_0x8d4e77=>buildDbDirectoryName(_0x8d4e77[_0x22f24d(0x1dc)],_0x8d4e77[_0x22f24d(0x1c9)])===_0x47b2c7);if(_0x5d1910[_0x22f24d(0x1e9)]===0x1)return{'dbId':_0x5d1910[0x0]['dbId'],'dbName':_0x5d1910[0x0][_0x22f24d(0x1dc)]};if(_0x5d1910[_0x22f24d(0x1e9)]===0x0)throw CliErrors[_0x22f24d(0x1ef)](_0x22f24d(0x1c1)+_0x47b2c7+'\x22\x20for\x20sqlCode\x20'+_0x202a91['sqlCode']+'.');const _0x4449bf=_0x5d1910[_0x22f24d(0x1e0)](_0x380bc4=>_0x380bc4[_0x22f24d(0x1dc)]+'\x20('+_0x380bc4[_0x22f24d(0x1c9)]+')')[_0x22f24d(0x1d3)](',\x20');throw CliErrors['validation'](_0x22f24d(0x1e5)+_0x47b2c7+_0x22f24d(0x1c5)+_0x202a91['sqlCode']+':\x20'+_0x4449bf);}function parseExplicitDbDirectory(_0x4db1f6){const _0x1137d2=a243_0x4ed571,_0x1b1060=/^db-(\d+)$/[_0x1137d2(0x1af)](_0x4db1f6);if(!_0x1b1060)return null;const _0xe90e49=Number(_0x1b1060[0x1]);return Number['isFinite'](_0xe90e49)&&_0xe90e49>0x0?_0xe90e49:null;}
1
+ const a243_0x11a8fa=a243_0x1f13;(function(_0x4f3c31,_0x2598fa){const _0x2187e4=a243_0x1f13,_0x30440e=_0x4f3c31();while(!![]){try{const _0x47606f=parseInt(_0x2187e4(0x167))/0x1+-parseInt(_0x2187e4(0x16a))/0x2*(-parseInt(_0x2187e4(0x149))/0x3)+parseInt(_0x2187e4(0x163))/0x4*(-parseInt(_0x2187e4(0x151))/0x5)+-parseInt(_0x2187e4(0x146))/0x6*(parseInt(_0x2187e4(0x137))/0x7)+parseInt(_0x2187e4(0x15d))/0x8+-parseInt(_0x2187e4(0x14c))/0x9*(-parseInt(_0x2187e4(0x160))/0xa)+parseInt(_0x2187e4(0x162))/0xb*(-parseInt(_0x2187e4(0x16d))/0xc);if(_0x47606f===_0x2598fa)break;else _0x30440e['push'](_0x30440e['shift']());}catch(_0x394961){_0x30440e['push'](_0x30440e['shift']());}}}(a243_0x555f,0x8f5fd));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function readSqlUploadContent(_0x208ca8){const _0xab583c=a243_0x1f13,_0x47d576=stripLocalSqlMetadata(await readFile(_0x208ca8[_0xab583c(0x141)],_0xab583c(0x139)),_0x208ca8[_0xab583c(0x156)]);if(!_0x47d576[_0xab583c(0x142)]())throw CliErrors[_0xab583c(0x170)](_0x208ca8[_0xab583c(0x159)]+_0xab583c(0x147));return _0x47d576;}async function getTargetSqlQueries(_0x1df4b1,_0x28dceb,_0x45da15){const _0x4aa277=a243_0x1f13,_0x3166b0=await scanLocalSqlQueries(_0x1df4b1),_0x5b296f=new Map();for(const _0x2b3e63 of _0x3166b0){if(_0x45da15&&_0x2b3e63['sqlCode']!==_0x45da15)continue;const _0xec91f0=_0x5b296f[_0x4aa277(0x12f)](_0x2b3e63[_0x4aa277(0x159)])??[];_0xec91f0[_0x4aa277(0x134)](_0x2b3e63),_0x5b296f[_0x4aa277(0x15b)](_0x2b3e63['sqlCode'],_0xec91f0);}if(_0x45da15&&!_0x5b296f[_0x4aa277(0x148)](_0x45da15))throw CliErrors[_0x4aa277(0x170)](_0x4aa277(0x133)+_0x45da15);const _0x32cbe0=[];for(const [_0x20490e,_0x135fc5]of _0x5b296f[_0x4aa277(0x12c)]()){if(_0x135fc5[_0x4aa277(0x175)]===0x1){_0x32cbe0['push'](_0x135fc5[0x0]);continue;}const _0xb0ea57=_0x28dceb['sqls'][_0x20490e],_0x228e4e=_0xb0ea57?.[_0x4aa277(0x152)],_0xd8071=_0x228e4e?_0x135fc5[_0x4aa277(0x143)](_0x5956e7=>_0x5956e7[_0x4aa277(0x13c)]!==_0x228e4e):_0x135fc5;if(_0xb0ea57&&_0xd8071[_0x4aa277(0x175)]===0x1){_0x32cbe0[_0x4aa277(0x134)](_0xd8071[0x0]);continue;}throw CliErrors[_0x4aa277(0x170)](_0x4aa277(0x12e)+_0x20490e+_0x4aa277(0x171));}return _0x32cbe0;}export const sqlPush={'service':a243_0x11a8fa(0x13f),'command':a243_0x11a8fa(0x134),'description':a243_0x11a8fa(0x14a),'risk':a243_0x11a8fa(0x13b),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a243_0x11a8fa(0x164),'description':a243_0x11a8fa(0x16c)}],async 'dryRun'(_0x4957a7){const _0x5b7836=a243_0x11a8fa,_0x5bac7b=loadSqlProjectConfig(_0x4957a7[_0x5b7836(0x169)]),_0xc3934c=await readSqlLockFile(_0x5bac7b['lockFilePath']),{appLock:_0x13265f}=ensureSqlLockScope(_0xc3934c??createEmptySqlLock(),_0x4957a7['appCode'],_0x5bac7b[_0x5b7836(0x166)],_0x5b7836(0x134)),_0x598474=await getTargetSqlQueries(_0x5bac7b,_0x13265f,_0x4957a7[_0x5b7836(0x153)](_0x5b7836(0x15c))||undefined),_0x1aef33=[];for(const _0x3a8b31 of _0x598474){const _0x54c1e6=await computeSqlFileHash(_0x3a8b31[_0x5b7836(0x141)]),_0x17a20a=_0x13265f[_0x5b7836(0x154)][_0x3a8b31[_0x5b7836(0x159)]],_0x289632=!!_0x17a20a&&(_0x17a20a[_0x5b7836(0x152)]!==_0x3a8b31[_0x5b7836(0x13c)]||!!_0x3a8b31['sqlName']&&_0x17a20a['sqlName']!==_0x3a8b31[_0x5b7836(0x168)]||_0x17a20a[_0x5b7836(0x156)]!==_0x3a8b31['mode']);if(!_0x4957a7['bool']('force')&&_0x17a20a&&_0x17a20a['hash']===_0x54c1e6&&!_0x289632)continue;if(!_0x17a20a)throw CliErrors[_0x5b7836(0x170)](_0x3a8b31[_0x5b7836(0x159)]+_0x5b7836(0x12a));if(_0x17a20a[_0x5b7836(0x135)]==null)throw CliErrors[_0x5b7836(0x170)](_0x3a8b31['sqlCode']+_0x5b7836(0x136));await resolveTargetDbBinding(_0x4957a7[_0x5b7836(0x169)],_0x3a8b31,_0x17a20a),await readSqlUploadContent(_0x3a8b31),_0x1aef33[_0x5b7836(0x134)](_0x3a8b31['sqlCode']);}return{'method':_0x5b7836(0x128),'url':_0x5b7836(0x158),'body':{'sqlCodes':_0x1aef33,'appCode':_0x4957a7[_0x5b7836(0x169)]},'description':_0x5b7836(0x14d)+_0x1aef33['length']+_0x5b7836(0x145)};},async 'execute'(_0x356a6b){const _0x301aa5=a243_0x11a8fa,_0x3e1f4b=loadSqlProjectConfig(_0x356a6b['appCode']),_0x1e187e=await readSqlLockFile(_0x3e1f4b[_0x301aa5(0x130)]),{lockData:_0x224c81,appLock:_0x1ed351}=ensureSqlLockScope(_0x1e187e??createEmptySqlLock(),_0x356a6b[_0x301aa5(0x169)],_0x3e1f4b[_0x301aa5(0x166)],_0x301aa5(0x134)),_0x39ba72=await getTargetSqlQueries(_0x3e1f4b,_0x1ed351,_0x356a6b[_0x301aa5(0x153)](_0x301aa5(0x15c))||undefined);if(_0x39ba72[_0x301aa5(0x175)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x2da981=[],_0x3716f3=[],_0x3fa0e8=[];let _0x52866e=![];for(const _0xe4b8b0 of _0x39ba72){const _0xd6c492=_0x1ed351['sqls'][_0xe4b8b0[_0x301aa5(0x159)]];if(!_0xd6c492){_0x3fa0e8[_0x301aa5(0x134)]({'sqlCode':_0xe4b8b0[_0x301aa5(0x159)],'error':_0x301aa5(0x12b)});continue;}try{const _0xd89caa=await computeSqlFileHash(_0xe4b8b0['filePath']),_0x5b40a4=_0xd6c492['path']!==_0xe4b8b0[_0x301aa5(0x13c)]||!!_0xe4b8b0[_0x301aa5(0x168)]&&_0xd6c492[_0x301aa5(0x168)]!==_0xe4b8b0[_0x301aa5(0x168)]||_0xd6c492[_0x301aa5(0x156)]!==_0xe4b8b0['mode'];if(!_0x356a6b[_0x301aa5(0x140)](_0x301aa5(0x16f))&&_0xd6c492['hash']===_0xd89caa&&!_0x5b40a4){_0x3716f3[_0x301aa5(0x134)]({'sqlCode':_0xe4b8b0[_0x301aa5(0x159)],'reason':_0x301aa5(0x13a)});continue;}if(_0xd6c492[_0x301aa5(0x135)]==null){_0x3fa0e8['push']({'sqlCode':_0xe4b8b0[_0x301aa5(0x159)],'error':_0x301aa5(0x138)});continue;}const _0x16da3f=_0xe4b8b0[_0x301aa5(0x168)]||_0xd6c492[_0x301aa5(0x168)],_0x327903=await resolveTargetDbBinding(_0x356a6b['appCode'],_0xe4b8b0,_0xd6c492),_0x2ced9f=await readSqlUploadContent(_0xe4b8b0),_0x1d4877=await updateSqlQuery({'id':_0xd6c492[_0x301aa5(0x16b)],'appCode':_0x356a6b['appCode'],'sqlCode':_0xe4b8b0[_0x301aa5(0x159)],'sqlName':_0x16da3f,'dbId':_0x327903['dbId'],'version':_0xd6c492[_0x301aa5(0x135)],'sqlContent':_0x2ced9f,'sqlConfig':_0xd6c492[_0x301aa5(0x16e)]??undefined}),_0x5ecc7f=_0x1d4877[_0x301aa5(0x172)]?await getDbName(_0x356a6b[_0x301aa5(0x169)],Number(_0x1d4877[_0x301aa5(0x172)]))[_0x301aa5(0x174)](()=>_0x327903[_0x301aa5(0x131)]):_0x327903[_0x301aa5(0x131)];_0x1ed351['sqls'][_0xe4b8b0[_0x301aa5(0x159)]]={...buildSqlLockEntry(_0x1d4877,_0x2ced9f,_0xd89caa,{'dbName':_0x5ecc7f}),'path':_0xe4b8b0['relativePath'],'mode':_0xe4b8b0['mode']},_0x52866e=!![],await archivePreviousSqlFileIfNeeded(_0x3e1f4b,_0xd6c492[_0x301aa5(0x152)],_0xe4b8b0[_0x301aa5(0x13c)]),_0x2da981[_0x301aa5(0x134)]({'sqlCode':_0xe4b8b0[_0x301aa5(0x159)],'remoteId':_0xd6c492[_0x301aa5(0x16b)]});}catch(_0x32a0a1){_0x3fa0e8[_0x301aa5(0x134)]({'sqlCode':_0xe4b8b0[_0x301aa5(0x159)],'error':_0x32a0a1 instanceof Error?_0x32a0a1[_0x301aa5(0x12d)]:String(_0x32a0a1)});}}(_0x52866e||_0x3fa0e8[_0x301aa5(0x175)]===0x0)&&(_0x1ed351[_0x301aa5(0x14e)]=new Date()[_0x301aa5(0x15f)](),await writeSqlLockFile(_0x3e1f4b[_0x301aa5(0x130)],_0x224c81));const _0x324546=_0x3fa0e8['length']===0x0;return{'ok':_0x324546,'data':{'pushed':_0x2da981,'skipped':_0x3716f3,'failed':_0x3fa0e8},'message':_0x301aa5(0x13e)+_0x2da981[_0x301aa5(0x175)]+'\x20pushed,\x20'+_0x3716f3['length']+_0x301aa5(0x150)+_0x3fa0e8[_0x301aa5(0x175)]+_0x301aa5(0x144)};}};async function archivePreviousSqlFileIfNeeded(_0x146c17,_0x384121,_0x392b7a){const _0x4c4be6=a243_0x11a8fa;if(!_0x384121||_0x384121===_0x392b7a)return;const _0x480be7=join(_0x146c17[_0x4c4be6(0x14b)],_0x384121);if(!await fileExists(_0x480be7))return;const _0x2b851e=await moveToTrash(_0x146c17['projectRoot'],_0x146c17[_0x4c4be6(0x173)],_0x480be7);await cleanupEmptyDirectories(dirname(_0x480be7),_0x146c17['sqlRootDir']),void _0x2b851e;}function a243_0x555f(){const _0x42eacc=['has','3GRNLdi','Push\x20local\x20SQL\x20files\x20to\x20remote','sqlRootDir','9OdgWqO','Would\x20push\x20','lastSync','No\x20database\x20matches\x20local\x20directory\x20\x22','\x20skipped,\x20','2879285OJPdUs','path','str','sqls','startsWith','mode','replace','/smartapi/custom/updateUserCustomSql','sqlCode','Local\x20directory\x20\x22','set','sqlcode','5732232PFLXye','\x22\x20for\x20sqlCode\x20','toISOString','4068580TJSQRj','dbDirectory','7415089eNyTWC','8lRLGfu','boolean','isFinite','sqlRoot','938138cMDiao','sqlName','appCode','1890046GTQZHF','remoteId','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','12IyAuht','sqlConfig','force','validation','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','dbId','trashDir','catch','length','POST','join',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','entries','message','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','get','lockFilePath','dbName','exec','Local\x20SQL\x20not\x20found:\x20','push','version',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','296737HbGcOI','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','utf8','unchanged','write','relativePath','map','Push\x20complete:\x20','sql','bool','filePath','trim','filter','\x20failed','\x20SQL\x20file(s)','84codYhH',':\x20SQL\x20content\x20is\x20empty.'];a243_0x555f=function(){return _0x42eacc;};return a243_0x555f();}async function moveToTrash(_0x56c723,_0x590123,_0x12f475){const _0x348305=a243_0x11a8fa,_0x57fee1=new Date()['toISOString']()[_0x348305(0x157)](/[:.]/g,'-'),_0x43067b=relative(_0x56c723,_0x12f475),_0x4a685d=join(_0x590123,_0x57fee1,_0x43067b);return await mkdir(dirname(_0x4a685d),{'recursive':!![]}),await rename(_0x12f475,_0x4a685d),_0x4a685d;}async function cleanupEmptyDirectories(_0x45b0ec,_0x3527dc){const _0x5f318c=a243_0x11a8fa;let _0x56f701=resolve(_0x45b0ec);const _0x48e01a=resolve(_0x3527dc);while(_0x56f701[_0x5f318c(0x155)](''+_0x48e01a+sep)||_0x56f701===_0x48e01a){if(_0x56f701===_0x48e01a)return;try{const _0x950732=await readdir(_0x56f701);if(_0x950732[_0x5f318c(0x175)]>0x0)return;await rmdir(_0x56f701);}catch{return;}_0x56f701=dirname(_0x56f701);}}async function resolveTargetDbBinding(_0x5ae419,_0xa24a86,_0x3791fd){const _0x569dd3=a243_0x11a8fa,_0x492a56=_0xa24a86[_0x569dd3(0x161)];if(!_0x492a56)return{'dbId':_0x3791fd[_0x569dd3(0x172)],'dbName':_0x3791fd[_0x569dd3(0x131)]};const _0x30012f=buildDbDirectoryName(_0x3791fd[_0x569dd3(0x131)],_0x3791fd[_0x569dd3(0x172)]);if(_0x492a56===_0x30012f)return{'dbId':_0x3791fd[_0x569dd3(0x172)],'dbName':_0x3791fd[_0x569dd3(0x131)]};const _0x403a61=parseExplicitDbDirectory(_0x492a56);if(_0x403a61!=null)return{'dbId':_0x403a61,'dbName':await getDbName(_0x5ae419,_0x403a61)['catch'](()=>undefined)};const _0xcce656=await listDatabases(_0x5ae419),_0xc6cc20=_0xcce656['filter'](_0x1b3e13=>buildDbDirectoryName(_0x1b3e13[_0x569dd3(0x131)],_0x1b3e13['dbId'])===_0x492a56);if(_0xc6cc20['length']===0x1)return{'dbId':_0xc6cc20[0x0][_0x569dd3(0x172)],'dbName':_0xc6cc20[0x0][_0x569dd3(0x131)]};if(_0xc6cc20[_0x569dd3(0x175)]===0x0)throw CliErrors[_0x569dd3(0x170)](_0x569dd3(0x14f)+_0x492a56+_0x569dd3(0x15e)+_0xa24a86['sqlCode']+'.');const _0x4514c0=_0xc6cc20[_0x569dd3(0x13d)](_0x1656b6=>_0x1656b6[_0x569dd3(0x131)]+'\x20('+_0x1656b6[_0x569dd3(0x172)]+')')[_0x569dd3(0x129)](',\x20');throw CliErrors[_0x569dd3(0x170)](_0x569dd3(0x15a)+_0x492a56+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0xa24a86[_0x569dd3(0x159)]+':\x20'+_0x4514c0);}function a243_0x1f13(_0x45223e,_0x1902d1){_0x45223e=_0x45223e-0x128;const _0x555f2b=a243_0x555f();let _0x1f1366=_0x555f2b[_0x45223e];return _0x1f1366;}function parseExplicitDbDirectory(_0x3a3c64){const _0x59b4d5=a243_0x11a8fa,_0x4d1915=/^db-(\d+)$/[_0x59b4d5(0x132)](_0x3a3c64);if(!_0x4d1915)return null;const _0x52f3e8=Number(_0x4d1915[0x1]);return Number[_0x59b4d5(0x165)](_0x52f3e8)&&_0x52f3e8>0x0?_0x52f3e8:null;}