@lovrabet/rabetbase-cli 2.5.11 → 2.5.12-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/api-group.js +1 -1
  3. package/lib/api/fetch-model-list.js +1 -1
  4. package/lib/api/generate-api-file.js +1 -1
  5. package/lib/api/generate-sdk-config-file.js +1 -1
  6. package/lib/api/legacy-api-file.js +1 -1
  7. package/lib/api/model-registry-file.js +1 -1
  8. package/lib/api/model-registry-scaffold.js +1 -1
  9. package/lib/api/model-source.js +1 -1
  10. package/lib/auth/auth-server-ui.js +1 -1
  11. package/lib/auth/auth-server.js +1 -1
  12. package/lib/auth/constant.js +1 -1
  13. package/lib/auth/get-cookie.js +1 -1
  14. package/lib/auth/get-session-user.js +1 -1
  15. package/lib/auth/is-session-valid.js +1 -1
  16. package/lib/auth/login-success-html.js +1 -1
  17. package/lib/auth/logout.js +1 -1
  18. package/lib/cli-flags.js +1 -1
  19. package/lib/cli.js +1 -1
  20. package/lib/commands/api/generate.js +1 -1
  21. package/lib/commands/api/index.js +1 -1
  22. package/lib/commands/api/list.js +1 -1
  23. package/lib/commands/api/pull.js +1 -1
  24. package/lib/commands/api/shared.js +1 -1
  25. package/lib/commands/app/detail.js +1 -1
  26. package/lib/commands/app/index.js +1 -1
  27. package/lib/commands/app/list.js +1 -1
  28. package/lib/commands/app/members-list.js +1 -1
  29. package/lib/commands/app/remote-directory.js +1 -1
  30. package/lib/commands/app/shared.js +1 -1
  31. package/lib/commands/app-config/delete.js +1 -1
  32. package/lib/commands/app-config/get.js +1 -1
  33. package/lib/commands/app-config/index.js +1 -1
  34. package/lib/commands/app-config/list.js +1 -1
  35. package/lib/commands/app-config/set.js +1 -1
  36. package/lib/commands/app-config/shared.js +1 -1
  37. package/lib/commands/auth/index.js +1 -1
  38. package/lib/commands/bff/create.js +1 -1
  39. package/lib/commands/bff/delete.js +1 -1
  40. package/lib/commands/bff/detail.js +1 -1
  41. package/lib/commands/bff/index.js +1 -1
  42. package/lib/commands/bff/list.js +1 -1
  43. package/lib/commands/bff/logs.js +1 -1
  44. package/lib/commands/bff/pull.js +1 -1
  45. package/lib/commands/bff/push.js +1 -1
  46. package/lib/commands/bff/status.js +1 -1
  47. package/lib/commands/cli-skill/index.js +1 -1
  48. package/lib/commands/cli-update.js +1 -1
  49. package/lib/commands/codegen/index.js +1 -1
  50. package/lib/commands/codegen/sdk.js +1 -1
  51. package/lib/commands/codegen/sql.js +1 -1
  52. package/lib/commands/common/app-registry.js +1 -1
  53. package/lib/commands/common/app-selector.js +1 -1
  54. package/lib/commands/common/async-task.js +1 -1
  55. package/lib/commands/common/dry-run.js +1 -1
  56. package/lib/commands/common/flags.js +1 -1
  57. package/lib/commands/common/local-file.js +1 -1
  58. package/lib/commands/common/validate.js +1 -1
  59. package/lib/commands/config/delete.js +1 -1
  60. package/lib/commands/config/get.js +1 -1
  61. package/lib/commands/config/index.js +1 -1
  62. package/lib/commands/config/init.js +1 -1
  63. package/lib/commands/config/list.js +1 -1
  64. package/lib/commands/config/set.js +1 -1
  65. package/lib/commands/config/shared.js +1 -1
  66. package/lib/commands/dataset/batch-design.js +1 -1
  67. package/lib/commands/dataset/business-group-update.js +1 -1
  68. package/lib/commands/dataset/business-groups.js +1 -1
  69. package/lib/commands/dataset/capability.js +1 -1
  70. package/lib/commands/dataset/cross-relation-create.js +1 -1
  71. package/lib/commands/dataset/cross-relation-delete.js +1 -1
  72. package/lib/commands/dataset/cross-relation-list.js +1 -1
  73. package/lib/commands/dataset/cross-relation-shared.js +1 -1
  74. package/lib/commands/dataset/cross-relation-update.js +1 -1
  75. package/lib/commands/dataset/delete.js +1 -1
  76. package/lib/commands/dataset/design-context.js +1 -1
  77. package/lib/commands/dataset/design-start.js +1 -1
  78. package/lib/commands/dataset/design-status.js +1 -1
  79. package/lib/commands/dataset/design-sync-retry.js +1 -1
  80. package/lib/commands/dataset/design-sync-status.js +1 -1
  81. package/lib/commands/dataset/design-validate.js +1 -1
  82. package/lib/commands/dataset/detail.js +1 -1
  83. package/lib/commands/dataset/extend-update.js +1 -1
  84. package/lib/commands/dataset/field-restore.js +1 -1
  85. package/lib/commands/dataset/field-update.js +1 -1
  86. package/lib/commands/dataset/generate.js +1 -1
  87. package/lib/commands/dataset/index.js +1 -1
  88. package/lib/commands/dataset/list.js +1 -1
  89. package/lib/commands/dataset/operations.js +1 -1
  90. package/lib/commands/dataset/relation-audit.js +1 -1
  91. package/lib/commands/dataset/relation-create.js +1 -1
  92. package/lib/commands/dataset/relation-delete.js +1 -1
  93. package/lib/commands/dataset/relation-shared.js +1 -1
  94. package/lib/commands/dataset/relation-update.js +1 -1
  95. package/lib/commands/dataset/relations.js +1 -1
  96. package/lib/commands/dataset/rename.js +1 -1
  97. package/lib/commands/dataset/restore.js +1 -1
  98. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  99. package/lib/commands/db/analysis-batching.js +1 -1
  100. package/lib/commands/db/analyze-batch-plan.js +1 -1
  101. package/lib/commands/db/analyze-cancel.js +1 -1
  102. package/lib/commands/db/analyze-start.js +1 -1
  103. package/lib/commands/db/analyze-status.js +1 -1
  104. package/lib/commands/db/create.js +1 -1
  105. package/lib/commands/db/cross-db-analysis-shared.js +1 -1
  106. package/lib/commands/db/cross-db-analyze-latest.js +1 -1
  107. package/lib/commands/db/cross-db-analyze-start.js +1 -1
  108. package/lib/commands/db/cross-db-analyze-status.js +1 -1
  109. package/lib/commands/db/delete.js +1 -1
  110. package/lib/commands/db/detail.js +1 -1
  111. package/lib/commands/db/diff-refresh-start.js +1 -1
  112. package/lib/commands/db/diff-refresh-status.js +1 -1
  113. package/lib/commands/db/diff.js +1 -1
  114. package/lib/commands/db/index.js +1 -1
  115. package/lib/commands/db/list.js +1 -1
  116. package/lib/commands/db/shared.js +1 -1
  117. package/lib/commands/db/table-diff-shared.js +1 -1
  118. package/lib/commands/db/tables.js +1 -1
  119. package/lib/commands/db/test.js +1 -1
  120. package/lib/commands/db/update.js +1 -1
  121. package/lib/commands/deployment/index.js +1 -1
  122. package/lib/commands/deployment/sync-all.js +1 -1
  123. package/lib/commands/deployment/sync-jobs.js +1 -1
  124. package/lib/commands/deployment/sync-status.js +1 -1
  125. package/lib/commands/doctor.js +1 -1
  126. package/lib/commands/file/index.js +1 -1
  127. package/lib/commands/flow/create.js +1 -1
  128. package/lib/commands/flow/detail.js +1 -1
  129. package/lib/commands/flow/index.js +1 -1
  130. package/lib/commands/flow/list.js +1 -1
  131. package/lib/commands/flow/page-list.js +1 -1
  132. package/lib/commands/flow/publish.js +1 -1
  133. package/lib/commands/flow/runtime-resources-shared.js +1 -1
  134. package/lib/commands/flow/runtime-role-list.js +1 -1
  135. package/lib/commands/flow/runtime-role-user-list.js +1 -1
  136. package/lib/commands/flow/runtime-user-search.js +1 -1
  137. package/lib/commands/flow/shared.js +1 -1
  138. package/lib/commands/flow/update.js +1 -1
  139. package/lib/commands/flow/validate.js +1 -1
  140. package/lib/commands/instant-api-policy/current.js +1 -1
  141. package/lib/commands/instant-api-policy/index.js +1 -1
  142. package/lib/commands/instant-api-policy/init.js +1 -1
  143. package/lib/commands/instant-api-policy/publish.js +1 -1
  144. package/lib/commands/instant-api-policy/pull.js +1 -1
  145. package/lib/commands/instant-api-policy/revision.js +1 -1
  146. package/lib/commands/instant-api-policy/revisions.js +1 -1
  147. package/lib/commands/instant-api-policy/rollback.js +1 -1
  148. package/lib/commands/instant-api-policy/shared.js +1 -1
  149. package/lib/commands/instant-api-policy/validate.js +1 -1
  150. package/lib/commands/issue/context.js +1 -1
  151. package/lib/commands/issue/index.js +1 -1
  152. package/lib/commands/issue/nudge.js +1 -1
  153. package/lib/commands/issue/report.js +1 -1
  154. package/lib/commands/kb/create.js +1 -1
  155. package/lib/commands/kb/delete.js +1 -1
  156. package/lib/commands/kb/detail.js +1 -1
  157. package/lib/commands/kb/index.js +1 -1
  158. package/lib/commands/kb/list.js +1 -1
  159. package/lib/commands/kb/search.js +1 -1
  160. package/lib/commands/kb/shared.js +1 -1
  161. package/lib/commands/kb/update.js +1 -1
  162. package/lib/commands/logs/index.js +1 -1
  163. package/lib/commands/menu/asset-update.js +1 -1
  164. package/lib/commands/menu/delete.js +1 -1
  165. package/lib/commands/menu/external-link-create.js +1 -1
  166. package/lib/commands/menu/external-link-update.js +1 -1
  167. package/lib/commands/menu/group-create.js +1 -1
  168. package/lib/commands/menu/group-update.js +1 -1
  169. package/lib/commands/menu/index.js +1 -1
  170. package/lib/commands/menu/list.js +1 -1
  171. package/lib/commands/menu/move.js +1 -1
  172. package/lib/commands/menu/regroup-start.js +1 -1
  173. package/lib/commands/menu/rename.js +1 -1
  174. package/lib/commands/menu/shared/compare-table.js +1 -1
  175. package/lib/commands/menu/shared/delete-plan.js +1 -1
  176. package/lib/commands/menu/shared/facts.js +1 -1
  177. package/lib/commands/menu/shared/index.js +1 -1
  178. package/lib/commands/menu/shared/inquirer.js +1 -1
  179. package/lib/commands/menu/shared/local-pages.js +1 -1
  180. package/lib/commands/menu/shared/logic.js +1 -1
  181. package/lib/commands/menu/shared/mutations.js +1 -1
  182. package/lib/commands/menu/shared/path.js +1 -1
  183. package/lib/commands/menu/shared/service.js +1 -1
  184. package/lib/commands/menu/shared/subapp-assets.js +1 -1
  185. package/lib/commands/menu/shared/sync-core.js +1 -1
  186. package/lib/commands/menu/shared/update-core.js +1 -1
  187. package/lib/commands/menu/shared/valid-url.js +1 -1
  188. package/lib/commands/menu/subapp-assets-status.js +1 -1
  189. package/lib/commands/menu/subapp-assets-update.js +1 -1
  190. package/lib/commands/menu/sync.js +1 -1
  191. package/lib/commands/menu/visibility-update.js +1 -1
  192. package/lib/commands/notification/config-create.js +1 -1
  193. package/lib/commands/notification/config-delete.js +1 -1
  194. package/lib/commands/notification/config-list.js +1 -1
  195. package/lib/commands/notification/config-update.js +1 -1
  196. package/lib/commands/notification/index.js +1 -1
  197. package/lib/commands/notification/shared.js +1 -1
  198. package/lib/commands/ocr/index.js +1 -1
  199. package/lib/commands/page/create.js +1 -1
  200. package/lib/commands/page/custom/detail.js +1 -1
  201. package/lib/commands/page/custom/list.js +1 -1
  202. package/lib/commands/page/custom/publish.js +1 -1
  203. package/lib/commands/page/custom/shared.js +1 -1
  204. package/lib/commands/page/custom/syntax.js +1 -1
  205. package/lib/commands/page/custom/update.js +1 -1
  206. package/lib/commands/page/data-list-status.js +1 -1
  207. package/lib/commands/page/generate-start.js +1 -1
  208. package/lib/commands/page/generate-status.js +1 -1
  209. package/lib/commands/page/index.js +1 -1
  210. package/lib/commands/page/pull.js +1 -1
  211. package/lib/commands/page/push.js +1 -1
  212. package/lib/commands/page/relation-audit.js +1 -1
  213. package/lib/commands/page/restore.js +1 -1
  214. package/lib/commands/page/shared.js +1 -1
  215. package/lib/commands/page/sync.js +1 -1
  216. package/lib/commands/project/api-architecture-upgrade.js +1 -1
  217. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  218. package/lib/commands/project/create/format-elapsed.js +1 -1
  219. package/lib/commands/project/create/main.js +1 -1
  220. package/lib/commands/project/create/materialize-project-template.js +1 -1
  221. package/lib/commands/project/create/project-name.js +1 -1
  222. package/lib/commands/project/create/project-template-archive.js +1 -1
  223. package/lib/commands/project/create/project-template-path.js +1 -1
  224. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  225. package/lib/commands/project/create/use-format-code.js +1 -1
  226. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  227. package/lib/commands/project/domain-routing-sync.js +1 -1
  228. package/lib/commands/project/index.js +1 -1
  229. package/lib/commands/project/upgrade.js +1 -1
  230. package/lib/commands/registry.js +1 -1
  231. package/lib/commands/role/delete.js +1 -1
  232. package/lib/commands/role/detail.js +1 -1
  233. package/lib/commands/role/index.js +1 -1
  234. package/lib/commands/role/list.js +1 -1
  235. package/lib/commands/role/shared.js +1 -1
  236. package/lib/commands/role/update.js +1 -1
  237. package/lib/commands/role/user-add.js +1 -1
  238. package/lib/commands/role/user-remove.js +1 -1
  239. package/lib/commands/role/user-resolve.js +1 -1
  240. package/lib/commands/rule/get.js +1 -1
  241. package/lib/commands/rule/index.js +1 -1
  242. package/lib/commands/rule/list.js +1 -1
  243. package/lib/commands/rule/set.js +1 -1
  244. package/lib/commands/rule/shared.js +1 -1
  245. package/lib/commands/run/index.js +1 -1
  246. package/lib/commands/schema.js +1 -1
  247. package/lib/commands/sql/create.js +1 -1
  248. package/lib/commands/sql/delete.js +1 -1
  249. package/lib/commands/sql/detail.js +1 -1
  250. package/lib/commands/sql/exec.js +1 -1
  251. package/lib/commands/sql/index.js +1 -1
  252. package/lib/commands/sql/list.js +1 -1
  253. package/lib/commands/sql/pull.js +1 -1
  254. package/lib/commands/sql/push.js +1 -1
  255. package/lib/commands/sql/shared.js +1 -1
  256. package/lib/commands/sql/status.js +1 -1
  257. package/lib/commands/sql/validate.js +1 -1
  258. package/lib/commands/task/index.js +1 -1
  259. package/lib/commands/task/status.js +1 -1
  260. package/lib/commands/tenant/index.js +1 -1
  261. package/lib/commands/tenant/members-list.js +1 -1
  262. package/lib/commands/tenant/shared.js +1 -1
  263. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  264. package/lib/commands/user-account/feishu-bind.js +1 -1
  265. package/lib/commands/user-account/index.js +1 -1
  266. package/lib/commands/workspace/add.js +1 -1
  267. package/lib/commands/workspace/index.js +1 -1
  268. package/lib/commands/workspace/remove.js +1 -1
  269. package/lib/config/domain-config.js +1 -1
  270. package/lib/config/project-domain-routing.js +1 -1
  271. package/lib/config/region-config.js +1 -1
  272. package/lib/config/schema.js +1 -1
  273. package/lib/constant/cdn.js +1 -1
  274. package/lib/constant/cli.js +1 -1
  275. package/lib/constant/defaults.js +1 -1
  276. package/lib/constant/domain.js +1 -1
  277. package/lib/constant/env.js +1 -1
  278. package/lib/constant/output.js +1 -1
  279. package/lib/constant/paths.js +1 -1
  280. package/lib/constant/region.js +1 -1
  281. package/lib/constant/risk.js +1 -1
  282. package/lib/constant/routing-profile.d.ts +1 -0
  283. package/lib/constant/routing-profile.js +1 -1
  284. package/lib/context/app-resolver.js +1 -1
  285. package/lib/context/auth-resolver.js +1 -1
  286. package/lib/context/config-loader.js +1 -1
  287. package/lib/context.js +1 -1
  288. package/lib/core/alias-resolver.js +1 -1
  289. package/lib/core/api-client.js +1 -1
  290. package/lib/core/bff/config.js +1 -1
  291. package/lib/core/bff/file-system.js +1 -1
  292. package/lib/core/bff/hash.js +1 -1
  293. package/lib/core/bff/hook-directory.js +1 -1
  294. package/lib/core/bff/lock.js +1 -1
  295. package/lib/core/bff/utils.js +1 -1
  296. package/lib/core/cross-db-analysis.js +1 -1
  297. package/lib/core/cross-db-relation.js +1 -1
  298. package/lib/core/db-resolver.js +1 -1
  299. package/lib/core/flow-config.js +1 -1
  300. package/lib/core/instant-api-policy/config.js +1 -1
  301. package/lib/core/instant-api-policy/endpoints.js +1 -1
  302. package/lib/core/kb-management-client.js +1 -1
  303. package/lib/core/kb-search-client.js +1 -1
  304. package/lib/core/page/file-system.js +1 -1
  305. package/lib/core/page/hash.js +1 -1
  306. package/lib/core/page/lock.js +1 -1
  307. package/lib/core/page/lr-smart-jsx.js +1 -1
  308. package/lib/core/sql-index-auditor.js +1 -1
  309. package/lib/core/sql-sync/config.js +1 -1
  310. package/lib/core/sql-sync/file-system.js +1 -1
  311. package/lib/core/sql-sync/hash.js +1 -1
  312. package/lib/core/sql-sync/lock.js +1 -1
  313. package/lib/core/sql-sync/utils.js +1 -1
  314. package/lib/core/sql-validator.js +1 -1
  315. package/lib/errors.js +1 -1
  316. package/lib/framework/build-all-flags.js +1 -1
  317. package/lib/framework/error-output.js +1 -1
  318. package/lib/framework/explicit-yes.js +1 -1
  319. package/lib/framework/flags.js +1 -1
  320. package/lib/framework/help.js +1 -1
  321. package/lib/framework/index.js +1 -1
  322. package/lib/framework/output.js +1 -1
  323. package/lib/framework/response.js +1 -1
  324. package/lib/framework/runner-alias.js +1 -1
  325. package/lib/framework/runner.js +1 -1
  326. package/lib/framework/schema-export.js +1 -1
  327. package/lib/framework/supported-flags.js +1 -1
  328. package/lib/framework/types.js +1 -1
  329. package/lib/generated/build-info.d.ts +4 -4
  330. package/lib/generated/build-info.js +1 -1
  331. package/lib/generated/official-routing.d.ts +2 -1
  332. package/lib/generated/official-routing.js +1 -1
  333. package/lib/generated/routing-contract.js +1 -1
  334. package/lib/help.js +1 -1
  335. package/lib/postinstall.js +1 -1
  336. package/lib/runtime/confirmation.js +1 -1
  337. package/lib/runtime/event.js +1 -1
  338. package/lib/runtime/index.js +1 -1
  339. package/lib/runtime/queue.js +1 -1
  340. package/lib/runtime/resolve.js +1 -1
  341. package/lib/services/dataset-design/checkpoint.js +1 -1
  342. package/lib/services/dataset-design/commands.js +1 -1
  343. package/lib/services/dataset-design/contract.js +1 -1
  344. package/lib/skills/builtin-skill.js +1 -1
  345. package/lib/skills/main.js +1 -1
  346. package/lib/skills/npx-skills-add.js +1 -1
  347. package/lib/skills/skill-presence.js +1 -1
  348. package/lib/telemetry/cli-command-trace.js +1 -1
  349. package/lib/telemetry/cli-help-trace.js +1 -1
  350. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  351. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  352. package/lib/telemetry/send-cli-trace-log.js +1 -1
  353. package/lib/utils/ai_config.js +1 -1
  354. package/lib/utils/apply-jq-filter.js +1 -1
  355. package/lib/utils/cdn-config.js +1 -1
  356. package/lib/utils/check-sdk-version.js +1 -1
  357. package/lib/utils/cli-version-check.js +1 -1
  358. package/lib/utils/cli-version-policy.js +1 -1
  359. package/lib/utils/config.js +1 -1
  360. package/lib/utils/entity-with-id.js +1 -1
  361. package/lib/utils/file-utils.js +1 -1
  362. package/lib/utils/guides-cdn.js +1 -1
  363. package/lib/utils/http-client.js +1 -1
  364. package/lib/utils/is-non-interactive.js +1 -1
  365. package/lib/utils/logger.js +1 -1
  366. package/lib/utils/params.js +1 -1
  367. package/lib/utils/platform.js +1 -1
  368. package/lib/utils/sleep.js +1 -1
  369. package/lib/utils/template-replacer.js +1 -1
  370. package/lib/utils/update-notice.js +1 -1
  371. package/lib/utils/version.js +1 -1
  372. package/lib/utils/with-active-cookie.js +1 -1
  373. package/lib/utils/write-cli-side-channel.js +1 -1
  374. package/package.json +1 -1
  375. package/skills/rabetbase/SKILL.md +1 -1
  376. package/skills/rabetbase/references/rabetbase-kb.md +1 -1
  377. package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
  378. package/skills/rabetbase-page-generation/SKILL.md +1 -1
  379. package/skills/rabetbase.manifest.json +3 -3
@@ -1 +1 @@
1
- const a242_0x182ba7=a242_0x49f0;(function(_0x81daf6,_0x4afa16){const _0x12767f=a242_0x49f0,_0x4d80ca=_0x81daf6();while(!![]){try{const _0x447d69=parseInt(_0x12767f(0x116))/0x1+-parseInt(_0x12767f(0x120))/0x2+-parseInt(_0x12767f(0x114))/0x3+-parseInt(_0x12767f(0x117))/0x4+parseInt(_0x12767f(0x11d))/0x5+parseInt(_0x12767f(0x11b))/0x6+-parseInt(_0x12767f(0x123))/0x7;if(_0x447d69===_0x4afa16)break;else _0x4d80ca['push'](_0x4d80ca['shift']());}catch(_0x1229ec){_0x4d80ca['push'](_0x4d80ca['shift']());}}}(a242_0x4f13,0x75b04));function a242_0x49f0(_0x5bdc4e,_0x5a50b6){_0x5bdc4e=_0x5bdc4e-0x114;const _0x4f13ca=a242_0x4f13();let _0x49f0fc=_0x4f13ca[_0x5bdc4e];return _0x49f0fc;}import{getAppRule}from'../../core/api-client.js';function a242_0x4f13(){const _0x1bd802=['length','Loaded\x20app\x20rule\x20configuration\x20for\x20','121198irIvpn','410562FKptIp','map','48107smfCLG','824364pEhAat','all','read','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','3120144GFKoqO','rule','3404885iFRMjX','cookie','appCode','813594IIyvvs'];a242_0x4f13=function(){return _0x1bd802;};return a242_0x4f13();}import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':a242_0x182ba7(0x11c),'command':'list','description':a242_0x182ba7(0x11a),'risk':a242_0x182ba7(0x119),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x5b037a){const _0x1d4447=a242_0x182ba7,_0xc5f0bf=await Promise[_0x1d4447(0x118)](APP_RULE_TYPES[_0x1d4447(0x115)](_0x4e7a77=>getAppRule(_0x5b037a[_0x1d4447(0x11e)],{'appCode':_0x5b037a['appCode'],'type':_0x4e7a77}))),_0x4bd3c5=APP_RULE_TYPES[_0x1d4447(0x115)]((_0x1cf4bf,_0x390b4b)=>projectAppRule(_0x1cf4bf,_0xc5f0bf[_0x390b4b]??null));return{'ok':!![],'data':{'total':_0x4bd3c5[_0x1d4447(0x121)],'rules':_0x4bd3c5},'message':_0x1d4447(0x122)+_0x5b037a[_0x1d4447(0x11f)]};}};
1
+ const a242_0x4220a9=a242_0x17d5;(function(_0x44b181,_0x154ce5){const _0x2e6ae5=a242_0x17d5,_0x96f237=_0x44b181();while(!![]){try{const _0x45327f=-parseInt(_0x2e6ae5(0xcd))/0x1+-parseInt(_0x2e6ae5(0xc2))/0x2*(parseInt(_0x2e6ae5(0xd4))/0x3)+parseInt(_0x2e6ae5(0xd2))/0x4*(parseInt(_0x2e6ae5(0xcb))/0x5)+-parseInt(_0x2e6ae5(0xca))/0x6+parseInt(_0x2e6ae5(0xc3))/0x7*(-parseInt(_0x2e6ae5(0xc6))/0x8)+parseInt(_0x2e6ae5(0xcc))/0x9*(-parseInt(_0x2e6ae5(0xd3))/0xa)+-parseInt(_0x2e6ae5(0xc4))/0xb*(-parseInt(_0x2e6ae5(0xd1))/0xc);if(_0x45327f===_0x154ce5)break;else _0x96f237['push'](_0x96f237['shift']());}catch(_0x14d39e){_0x96f237['push'](_0x96f237['shift']());}}}(a242_0x50ea,0xba426));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';function a242_0x50ea(){const _0x58bcc1=['5LjEOvY','153abAGNN','331307LcReVW','rule','map','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','40545888sXpPaf','1419344UikhyM','171830cdRrOI','246RKVbxg','appCode','24322Borzvu','7pOVmuv','11kbjwpp','length','9099400TanDYh','cookie','read','Loaded\x20app\x20rule\x20configuration\x20for\x20','1276182dzGukB'];a242_0x50ea=function(){return _0x58bcc1;};return a242_0x50ea();}function a242_0x17d5(_0x54b18e,_0x370b38){_0x54b18e=_0x54b18e-0xc1;const _0x50ea39=a242_0x50ea();let _0x17d54c=_0x50ea39[_0x54b18e];return _0x17d54c;}export const ruleList={'service':a242_0x4220a9(0xce),'command':'list','description':a242_0x4220a9(0xd0),'risk':a242_0x4220a9(0xc8),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x1b59e0){const _0x38bfcb=a242_0x4220a9,_0x2014ef=await Promise['all'](APP_RULE_TYPES['map'](_0x4d8608=>getAppRule(_0x1b59e0[_0x38bfcb(0xc7)],{'appCode':_0x1b59e0[_0x38bfcb(0xc1)],'type':_0x4d8608}))),_0x3077c1=APP_RULE_TYPES[_0x38bfcb(0xcf)]((_0x35f236,_0x3c3400)=>projectAppRule(_0x35f236,_0x2014ef[_0x3c3400]??null));return{'ok':!![],'data':{'total':_0x3077c1[_0x38bfcb(0xc5)],'rules':_0x3077c1},'message':_0x38bfcb(0xc9)+_0x1b59e0[_0x38bfcb(0xc1)]};}};
@@ -1 +1 @@
1
- const a243_0x4a3ca9=a243_0x3886;(function(_0x176ae7,_0x1616e4){const _0x523c9a=a243_0x3886,_0x170245=_0x176ae7();while(!![]){try{const _0x107b2f=parseInt(_0x523c9a(0x1aa))/0x1+-parseInt(_0x523c9a(0x1b3))/0x2*(-parseInt(_0x523c9a(0x197))/0x3)+-parseInt(_0x523c9a(0x19a))/0x4*(-parseInt(_0x523c9a(0x1b8))/0x5)+parseInt(_0x523c9a(0x1ba))/0x6*(-parseInt(_0x523c9a(0x1ae))/0x7)+-parseInt(_0x523c9a(0x18f))/0x8*(parseInt(_0x523c9a(0x18b))/0x9)+-parseInt(_0x523c9a(0x1ab))/0xa*(parseInt(_0x523c9a(0x1bf))/0xb)+-parseInt(_0x523c9a(0x1c6))/0xc;if(_0x107b2f===_0x1616e4)break;else _0x170245['push'](_0x170245['shift']());}catch(_0x5960df){_0x170245['push'](_0x170245['shift']());}}}(a243_0x168e,0xcc601));function a243_0x3886(_0x2748d1,_0x3a6ca7){_0x2748d1=_0x2748d1-0x18b;const _0x168ea9=a243_0x168e();let _0x3886ee=_0x168ea9[_0x2748d1];return _0x3886ee;}import{knowledgeDocumentsPath}from'../../core/api-client.js';import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a243_0x168e(){const _0x5bc196=['Require\x20the\x20current\x20version\x20before\x20atomic\x20compare-and-set','POST','replacement','cookie','create','Use\x20read-only\x20rule\x20reconciliation;\x20do\x20not\x20resubmit\x20automatically.','input','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','rule','expectedVersion','rules','verified','1314624feIGrB','10zVHVVz','push','The\x20received\x20rule\x20state\x20contradicts\x20the\x20requested\x20changes.','2128chGPod','appCode','cause','unconfigured','--file\x20is\x20required.','276vwRaqf','byteSize','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','content','15TMOaAZ','RULES\x20content\x20exceeds\x202000\x20UTF-16\x20units.','7194CUmFYU','set','app_rule_file_required','app_rule_version_mismatch','type','11932393QuCfaf','app_rule_set_outcome_unknown','RULES','app_rule_verification_failed','isSafeInteger','Set\x20','rabetbase\x20rule\x20get\x20--type\x20','8785272kypgoJ','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','DATABASE','The\x20set\x20request\x20was\x20sent,\x20but\x20','Pass\x20a\x20UTF-8\x20Markdown\x20file.','711351fEyUKg','beforeRecord','expected-version','before','24akCqwg','\x20--format\x20compress','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','string','app_rule_verification_unavailable','defineProperty','app_rule_content_too_large','31737BKlAfT','update','planned','641436RuOqgj','contentHash','version','file'];a243_0x168e=function(){return _0x5bc196;};return a243_0x168e();}import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';function readSetInput(_0x51e5cc){const _0x18843b=a243_0x3886,_0x41a3df=readAppRuleType(_0x51e5cc),_0x4b870f=_0x51e5cc['str']('file')['trim']();if(!_0x4b870f)throw appRuleError(_0x18843b(0x1bc),_0x18843b(0x1b2),_0x18843b(0x1ca));const _0x3a9e45=_0x51e5cc['flag'](_0x18843b(0x18d));let _0x2d6669;if(_0x3a9e45!==undefined){_0x2d6669=Number(_0x3a9e45);if(!Number[_0x18843b(0x1c3)](_0x2d6669)||_0x2d6669<0x0)throw appRuleError('app_rule_expected_version_invalid','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.');}return{'type':_0x41a3df,'file':_0x4b870f,'expectedVersion':_0x2d6669};}async function prepareSet(_0x4eccd1){const _0x2bca56=a243_0x3886,_0x27dcab=readSetInput(_0x4eccd1),_0x17b1dc=await readAppRuleFile(_0x27dcab[_0x2bca56(0x19d)]);if(_0x27dcab[_0x2bca56(0x1be)]===_0x2bca56(0x1a8)&&_0x17b1dc[_0x2bca56(0x1b7)]['length']>0x7d0)throw appRuleError(_0x2bca56(0x196),_0x2bca56(0x1b9));const _0x5257fc=await getAppRule(_0x4eccd1[_0x2bca56(0x1a1)],{'appCode':_0x4eccd1[_0x2bca56(0x1af)],'type':_0x27dcab['type']});if(_0x27dcab[_0x2bca56(0x1a7)]!==undefined&&(_0x5257fc?.[_0x2bca56(0x19c)]??0x0)!==_0x27dcab[_0x2bca56(0x1a7)])throw appRuleError(_0x2bca56(0x1bd),appRuleFileName(_0x27dcab[_0x2bca56(0x1be)])+'\x20version\x20changed\x20before\x20write.','Expected\x20'+_0x27dcab[_0x2bca56(0x1a7)]+';\x20current\x20version\x20is\x20'+(_0x5257fc?.[_0x2bca56(0x19c)]??_0x2bca56(0x1b1))+_0x2bca56(0x1c7));return{'input':_0x27dcab,'replacement':_0x17b1dc,'beforeRecord':_0x5257fc,'before':projectAppRule(_0x27dcab['type'],_0x5257fc),'planned':{'type':_0x27dcab[_0x2bca56(0x1be)],'fileName':appRuleFileName(_0x27dcab[_0x2bca56(0x1be)]),'contextScope':appRuleContextScope(_0x27dcab[_0x2bca56(0x1be)]),'enabled':!![],'appCode':_0x4eccd1[_0x2bca56(0x1af)],'scope':_0x2bca56(0x1a8),'contentByteSize':_0x17b1dc[_0x2bca56(0x1b4)],'contentHash':_0x17b1dc['contentHash']}};}function warningsFor(_0x4c17ad){return[];}export const ruleSet={'service':a243_0x4a3ca9(0x1a6),'command':a243_0x4a3ca9(0x1bb),'description':'Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','risk':'write','requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a243_0x4a3ca9(0x19d),'type':a243_0x4a3ca9(0x193),'required':!![],'description':'UTF-8\x20Markdown\x20file\x20(RULES:\x202000\x20UTF-16\x20units;\x20DATABASE:\x205242880\x20units)'},{'name':'expected-version','type':'number','required':![],'description':a243_0x4a3ca9(0x19e)}],async 'validate'(_0x1ae992){readSetInput(_0x1ae992);},async 'dryRun'(_0x42f445){const _0x5f5a6d=a243_0x4a3ca9,_0x331048=await prepareSet(_0x42f445);return asDryRunResult({'operation':_0x5f5a6d(0x1bb),'selector':{'appCode':_0x42f445[_0x5f5a6d(0x1af)],'scope':'rules','type':_0x331048['input'][_0x5f5a6d(0x1be)]},'before':_0x331048[_0x5f5a6d(0x18e)],'after':_0x331048[_0x5f5a6d(0x199)],'dryRun':!![],'backend':{'method':_0x5f5a6d(0x19f),'path':knowledgeDocumentsPath(_0x5f5a6d(0x1a8),_0x331048[_0x5f5a6d(0x18c)]?'update':_0x5f5a6d(0x1a2)),'body':{'appCode':_0x42f445['appCode'],..._0x331048['beforeRecord']?{'id':_0x331048['beforeRecord']['id']}:{},'title':_0x331048[_0x5f5a6d(0x1a4)]['type']===_0x5f5a6d(0x1a8)?_0x5f5a6d(0x1c1):_0x5f5a6d(0x1c8),'contentHash':_0x331048[_0x5f5a6d(0x1a0)][_0x5f5a6d(0x19b)],'contentByteSize':_0x331048[_0x5f5a6d(0x1a0)][_0x5f5a6d(0x1b4)],..._0x331048[_0x5f5a6d(0x18c)]?{'expectedVersion':_0x331048[_0x5f5a6d(0x18c)][_0x5f5a6d(0x19c)]}:{}}},'warnings':warningsFor(_0x331048[_0x5f5a6d(0x1a4)][_0x5f5a6d(0x1a7)]),'verification':{'expectedVersion':_0x331048[_0x5f5a6d(0x18c)]?.[_0x5f5a6d(0x19c)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x5f5a6d(0x1c5)+_0x331048[_0x5f5a6d(0x1a4)]['type']+_0x5f5a6d(0x190)}},{'method':_0x5f5a6d(0x19f),'url':knowledgeDocumentsPath(_0x5f5a6d(0x1a8),_0x331048[_0x5f5a6d(0x18c)]?_0x5f5a6d(0x198):_0x5f5a6d(0x1a2))});},async 'execute'(_0x38f476){const _0x5bcb5d=a243_0x4a3ca9,_0xeb77fe=await prepareSet(_0x38f476),_0x41eb6d=_0xeb77fe[_0x5bcb5d(0x18c)]===null?0x1:_0xeb77fe[_0x5bcb5d(0x18c)][_0x5bcb5d(0x19c)]+(_0xeb77fe['beforeRecord']['content']===_0xeb77fe[_0x5bcb5d(0x1a0)][_0x5bcb5d(0x1b7)]?0x0:0x1);let _0x539417,_0x47ec25=![];try{_0x539417=await saveAppRule(_0x38f476['cookie'],{'appCode':_0x38f476[_0x5bcb5d(0x1af)],'type':_0xeb77fe[_0x5bcb5d(0x1a4)][_0x5bcb5d(0x1be)],'content':_0xeb77fe[_0x5bcb5d(0x1a0)][_0x5bcb5d(0x1b7)],'expectedVersion':_0xeb77fe[_0x5bcb5d(0x18c)]?.[_0x5bcb5d(0x19c)]??0x0,..._0xeb77fe['beforeRecord']?{'id':_0xeb77fe['beforeRecord']['id']}:{}});if(_0x539417[_0x5bcb5d(0x19c)]!==_0x41eb6d||_0x539417[_0x5bcb5d(0x1b7)]!==_0xeb77fe['replacement'][_0x5bcb5d(0x1b7)]||_0xeb77fe[_0x5bcb5d(0x18c)]!==null&&_0x539417['id']!==_0xeb77fe['beforeRecord']['id'])throw appRuleError('app_rule_verification_failed',_0x5bcb5d(0x1ad),_0x5bcb5d(0x1a3));}catch(_0x21862d){if(!isPlatformTransportFailure(_0x21862d))throw _0x21862d;_0x47ec25=!![];}let _0x37730e;try{_0x37730e=await getAppRule(_0x38f476[_0x5bcb5d(0x1a1)],{'appCode':_0x38f476['appCode'],'type':_0xeb77fe['input']['type']});}catch(_0x43cf7e){const _0x5e3039=appRuleError(_0x47ec25?'app_rule_set_outcome_unknown':_0x5bcb5d(0x194),_0x5bcb5d(0x1c9)+appRuleFileName(_0xeb77fe[_0x5bcb5d(0x1a4)]['type'])+'\x20could\x20not\x20be\x20verified.',_0x5bcb5d(0x191));Object[_0x5bcb5d(0x195)](_0x5e3039,_0x5bcb5d(0x1b0),{'value':_0x43cf7e,'enumerable':![]});throw _0x5e3039;}const _0x5f41b2=_0x37730e&&inspectAppRuleContent(_0x37730e[_0x5bcb5d(0x1b7)])['contentHash']===_0xeb77fe['replacement'][_0x5bcb5d(0x19b)],_0xe77f37=_0x37730e&&_0x37730e[_0x5bcb5d(0x19c)]===_0x41eb6d&&(!_0x539417||_0x37730e['id']===_0x539417['id']&&_0x37730e['version']===_0x539417[_0x5bcb5d(0x19c)]);if(!_0x37730e||!_0x5f41b2||!_0xe77f37||_0xeb77fe[_0x5bcb5d(0x18c)]!==null&&_0x37730e['id']!==_0xeb77fe[_0x5bcb5d(0x18c)]['id'])throw appRuleError(_0x47ec25?_0x5bcb5d(0x1c0):_0x5bcb5d(0x1c2),appRuleFileName(_0xeb77fe[_0x5bcb5d(0x1a4)]['type'])+_0x5bcb5d(0x1b5),_0x5bcb5d(0x1b6)+_0xeb77fe[_0x5bcb5d(0x1a4)][_0x5bcb5d(0x1be)]+_0x5bcb5d(0x1a5));const _0x9c8522=warningsFor(_0xeb77fe[_0x5bcb5d(0x1a4)][_0x5bcb5d(0x1a7)]);_0x47ec25&&_0x9c8522[_0x5bcb5d(0x1ac)](_0x5bcb5d(0x192));const _0x1f0e89=projectAppRule(_0xeb77fe[_0x5bcb5d(0x1a4)][_0x5bcb5d(0x1be)],_0x37730e);return{'ok':!![],'data':{'operation':_0x5bcb5d(0x1bb),'selector':{'appCode':_0x38f476[_0x5bcb5d(0x1af)],'scope':_0x5bcb5d(0x1a8),'type':_0xeb77fe[_0x5bcb5d(0x1a4)][_0x5bcb5d(0x1be)]},'before':_0xeb77fe[_0x5bcb5d(0x18e)],'after':_0x1f0e89,'dryRun':![],'backend':{'method':_0x5bcb5d(0x19f),'path':knowledgeDocumentsPath(_0x5bcb5d(0x1a8),_0xeb77fe[_0x5bcb5d(0x18c)]?_0x5bcb5d(0x198):_0x5bcb5d(0x1a2))},'warnings':_0x9c8522,'verification':{'status':_0x5bcb5d(0x1a9),'recoveredAfterUnknownResponse':_0x47ec25,'expectedVersion':_0xeb77fe[_0x5bcb5d(0x18c)]?.[_0x5bcb5d(0x19c)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':'rabetbase\x20rule\x20get\x20--type\x20'+_0xeb77fe[_0x5bcb5d(0x1a4)]['type']+_0x5bcb5d(0x190)}},'message':_0x5bcb5d(0x1c4)+appRuleFileName(_0xeb77fe[_0x5bcb5d(0x1a4)]['type'])+'\x20for\x20'+_0x38f476[_0x5bcb5d(0x1af)]};}};
1
+ const a243_0x43699c=a243_0x31d7;function a243_0x6c73(){const _0x2ab8ab=['UTF-8\x20Markdown\x20file\x20(RULES:\x202000\x20UTF-16\x20units;\x20DATABASE:\x205242880\x20units)','7814121oXulBG','--file\x20is\x20required.','rules','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','set','replacement','create','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','trim','write',';\x20current\x20version\x20is\x20','app_rule_version_mismatch','rabetbase\x20rule\x20get\x20--type\x20','cookie','input','file','number','DATABASE','appCode','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','isSafeInteger','app_rule_verification_unavailable','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','byteSize','app_rule_verification_failed','Pass\x20a\x20UTF-8\x20Markdown\x20file.','8403616RSFcgX','POST','type','app_rule_content_too_large','\x20--format\x20compress','flag','beforeRecord','expectedVersion','17152MaSirQ','planned','string','contentHash','Use\x20read-only\x20rule\x20reconciliation;\x20do\x20not\x20resubmit\x20automatically.','app_rule_expected_version_invalid','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','9sAjvvn','13922460CVJUsN','version','cause','str','201910TCPxFT','content','The\x20received\x20rule\x20state\x20contradicts\x20the\x20requested\x20changes.','update','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','Expected\x20','1dZfkhd','before','\x20could\x20not\x20be\x20verified.','\x20version\x20changed\x20before\x20write.','rule','\x20for\x20','Set\x20','761950lBmdtu','30lAUgwF','expected-version','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','RULES','11202768smJswi','Require\x20the\x20current\x20version\x20before\x20atomic\x20compare-and-set'];a243_0x6c73=function(){return _0x2ab8ab;};return a243_0x6c73();}(function(_0x5a0856,_0x3624e9){const _0x548c6f=a243_0x31d7,_0x4259f2=_0x5a0856();while(!![]){try{const _0x1716aa=-parseInt(_0x548c6f(0xd1))/0x1*(-parseInt(_0x548c6f(0xd8))/0x2)+-parseInt(_0x548c6f(0xc6))/0x3*(-parseInt(_0x548c6f(0xbf))/0x4)+parseInt(_0x548c6f(0xcb))/0x5*(-parseInt(_0x548c6f(0xd9))/0x6)+-parseInt(_0x548c6f(0xe0))/0x7+-parseInt(_0x548c6f(0xb7))/0x8+parseInt(_0x548c6f(0xdd))/0x9+parseInt(_0x548c6f(0xc7))/0xa;if(_0x1716aa===_0x3624e9)break;else _0x4259f2['push'](_0x4259f2['shift']());}catch(_0x4ce68d){_0x4259f2['push'](_0x4259f2['shift']());}}}(a243_0x6c73,0xa1a9c));import{knowledgeDocumentsPath}from'../../core/api-client.js';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 readSetInput(_0x451ea3){const _0x5c0450=a243_0x31d7,_0x1c0a38=readAppRuleType(_0x451ea3),_0xf3a79a=_0x451ea3[_0x5c0450(0xca)](_0x5c0450(0xac))[_0x5c0450(0xe8)]();if(!_0xf3a79a)throw appRuleError('app_rule_file_required',_0x5c0450(0xe1),_0x5c0450(0xb6));const _0x13bda0=_0x451ea3[_0x5c0450(0xbc)]('expected-version');let _0x2a48e1;if(_0x13bda0!==undefined){_0x2a48e1=Number(_0x13bda0);if(!Number[_0x5c0450(0xb1)](_0x2a48e1)||_0x2a48e1<0x0)throw appRuleError(_0x5c0450(0xc4),_0x5c0450(0xc5));}return{'type':_0x1c0a38,'file':_0xf3a79a,'expectedVersion':_0x2a48e1};}async function prepareSet(_0x13e443){const _0x2b3e5b=a243_0x31d7,_0x3ce70f=readSetInput(_0x13e443),_0x291a47=await readAppRuleFile(_0x3ce70f['file']);if(_0x3ce70f['type']===_0x2b3e5b(0xe2)&&_0x291a47[_0x2b3e5b(0xcc)]['length']>0x7d0)throw appRuleError(_0x2b3e5b(0xba),'RULES\x20content\x20exceeds\x202000\x20UTF-16\x20units.');const _0x4f5582=await getAppRule(_0x13e443[_0x2b3e5b(0xed)],{'appCode':_0x13e443[_0x2b3e5b(0xaf)],'type':_0x3ce70f[_0x2b3e5b(0xb9)]});if(_0x3ce70f[_0x2b3e5b(0xbe)]!==undefined&&(_0x4f5582?.['version']??0x0)!==_0x3ce70f[_0x2b3e5b(0xbe)])throw appRuleError(_0x2b3e5b(0xeb),appRuleFileName(_0x3ce70f[_0x2b3e5b(0xb9)])+_0x2b3e5b(0xd4),_0x2b3e5b(0xd0)+_0x3ce70f[_0x2b3e5b(0xbe)]+_0x2b3e5b(0xea)+(_0x4f5582?.[_0x2b3e5b(0xc8)]??'unconfigured')+_0x2b3e5b(0xdb));return{'input':_0x3ce70f,'replacement':_0x291a47,'beforeRecord':_0x4f5582,'before':projectAppRule(_0x3ce70f['type'],_0x4f5582),'planned':{'type':_0x3ce70f[_0x2b3e5b(0xb9)],'fileName':appRuleFileName(_0x3ce70f[_0x2b3e5b(0xb9)]),'contextScope':appRuleContextScope(_0x3ce70f[_0x2b3e5b(0xb9)]),'enabled':!![],'appCode':_0x13e443[_0x2b3e5b(0xaf)],'scope':_0x2b3e5b(0xe2),'contentByteSize':_0x291a47[_0x2b3e5b(0xb4)],'contentHash':_0x291a47[_0x2b3e5b(0xc2)]}};}function a243_0x31d7(_0x78a9e6,_0x54a6d0){_0x78a9e6=_0x78a9e6-0xab;const _0x6c734a=a243_0x6c73();let _0x31d7c9=_0x6c734a[_0x78a9e6];return _0x31d7c9;}function warningsFor(_0x3f2ecc){return[];}export const ruleSet={'service':a243_0x43699c(0xd5),'command':'set','description':a243_0x43699c(0xcf),'risk':a243_0x43699c(0xe9),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a243_0x43699c(0xac),'type':a243_0x43699c(0xc1),'required':!![],'description':a243_0x43699c(0xdf)},{'name':a243_0x43699c(0xda),'type':a243_0x43699c(0xad),'required':![],'description':a243_0x43699c(0xde)}],async 'validate'(_0x5dd5e7){readSetInput(_0x5dd5e7);},async 'dryRun'(_0x2b795c){const _0x49fee3=a243_0x43699c,_0x13899b=await prepareSet(_0x2b795c);return asDryRunResult({'operation':_0x49fee3(0xe4),'selector':{'appCode':_0x2b795c[_0x49fee3(0xaf)],'scope':'rules','type':_0x13899b[_0x49fee3(0xab)][_0x49fee3(0xb9)]},'before':_0x13899b[_0x49fee3(0xd2)],'after':_0x13899b[_0x49fee3(0xc0)],'dryRun':!![],'backend':{'method':_0x49fee3(0xb8),'path':knowledgeDocumentsPath(_0x49fee3(0xe2),_0x13899b[_0x49fee3(0xbd)]?'update':'create'),'body':{'appCode':_0x2b795c['appCode'],..._0x13899b[_0x49fee3(0xbd)]?{'id':_0x13899b[_0x49fee3(0xbd)]['id']}:{},'title':_0x13899b['input'][_0x49fee3(0xb9)]==='rules'?_0x49fee3(0xdc):_0x49fee3(0xae),'contentHash':_0x13899b['replacement'][_0x49fee3(0xc2)],'contentByteSize':_0x13899b[_0x49fee3(0xe5)][_0x49fee3(0xb4)],..._0x13899b['beforeRecord']?{'expectedVersion':_0x13899b[_0x49fee3(0xbd)][_0x49fee3(0xc8)]}:{}}},'warnings':warningsFor(_0x13899b['input'][_0x49fee3(0xbe)]),'verification':{'expectedVersion':_0x13899b[_0x49fee3(0xbd)]?.[_0x49fee3(0xc8)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x49fee3(0xec)+_0x13899b[_0x49fee3(0xab)][_0x49fee3(0xb9)]+_0x49fee3(0xbb)}},{'method':_0x49fee3(0xb8),'url':knowledgeDocumentsPath(_0x49fee3(0xe2),_0x13899b[_0x49fee3(0xbd)]?'update':_0x49fee3(0xe6))});},async 'execute'(_0x3c6283){const _0x483d03=a243_0x43699c,_0x189e00=await prepareSet(_0x3c6283),_0x57acc2=_0x189e00['beforeRecord']===null?0x1:_0x189e00[_0x483d03(0xbd)][_0x483d03(0xc8)]+(_0x189e00[_0x483d03(0xbd)][_0x483d03(0xcc)]===_0x189e00['replacement'][_0x483d03(0xcc)]?0x0:0x1);let _0x5c8dcb,_0x32ec7e=![];try{_0x5c8dcb=await saveAppRule(_0x3c6283[_0x483d03(0xed)],{'appCode':_0x3c6283[_0x483d03(0xaf)],'type':_0x189e00['input'][_0x483d03(0xb9)],'content':_0x189e00[_0x483d03(0xe5)][_0x483d03(0xcc)],'expectedVersion':_0x189e00['beforeRecord']?.[_0x483d03(0xc8)]??0x0,..._0x189e00[_0x483d03(0xbd)]?{'id':_0x189e00[_0x483d03(0xbd)]['id']}:{}});if(_0x5c8dcb['version']!==_0x57acc2||_0x5c8dcb[_0x483d03(0xcc)]!==_0x189e00['replacement'][_0x483d03(0xcc)]||_0x189e00[_0x483d03(0xbd)]!==null&&_0x5c8dcb['id']!==_0x189e00['beforeRecord']['id'])throw appRuleError(_0x483d03(0xb5),_0x483d03(0xcd),_0x483d03(0xc3));}catch(_0x307cf7){if(!isPlatformTransportFailure(_0x307cf7))throw _0x307cf7;_0x32ec7e=!![];}let _0x375204;try{_0x375204=await getAppRule(_0x3c6283[_0x483d03(0xed)],{'appCode':_0x3c6283[_0x483d03(0xaf)],'type':_0x189e00[_0x483d03(0xab)][_0x483d03(0xb9)]});}catch(_0xc54f8e){const _0x2e78d4=appRuleError(_0x32ec7e?'app_rule_set_outcome_unknown':_0x483d03(0xb2),'The\x20set\x20request\x20was\x20sent,\x20but\x20'+appRuleFileName(_0x189e00[_0x483d03(0xab)]['type'])+_0x483d03(0xd3),_0x483d03(0xe3));Object['defineProperty'](_0x2e78d4,_0x483d03(0xc9),{'value':_0xc54f8e,'enumerable':![]});throw _0x2e78d4;}const _0x577f63=_0x375204&&inspectAppRuleContent(_0x375204[_0x483d03(0xcc)])[_0x483d03(0xc2)]===_0x189e00[_0x483d03(0xe5)]['contentHash'],_0x8b7012=_0x375204&&_0x375204[_0x483d03(0xc8)]===_0x57acc2&&(!_0x5c8dcb||_0x375204['id']===_0x5c8dcb['id']&&_0x375204['version']===_0x5c8dcb[_0x483d03(0xc8)]);if(!_0x375204||!_0x577f63||!_0x8b7012||_0x189e00[_0x483d03(0xbd)]!==null&&_0x375204['id']!==_0x189e00[_0x483d03(0xbd)]['id'])throw appRuleError(_0x32ec7e?'app_rule_set_outcome_unknown':_0x483d03(0xb5),appRuleFileName(_0x189e00[_0x483d03(0xab)][_0x483d03(0xb9)])+'\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.',_0x483d03(0xe7)+_0x189e00[_0x483d03(0xab)][_0x483d03(0xb9)]+_0x483d03(0xb3));const _0x1010a6=warningsFor(_0x189e00[_0x483d03(0xab)][_0x483d03(0xbe)]);_0x32ec7e&&_0x1010a6['push'](_0x483d03(0xb0));const _0x2a3473=projectAppRule(_0x189e00[_0x483d03(0xab)][_0x483d03(0xb9)],_0x375204);return{'ok':!![],'data':{'operation':_0x483d03(0xe4),'selector':{'appCode':_0x3c6283[_0x483d03(0xaf)],'scope':'rules','type':_0x189e00[_0x483d03(0xab)][_0x483d03(0xb9)]},'before':_0x189e00[_0x483d03(0xd2)],'after':_0x2a3473,'dryRun':![],'backend':{'method':_0x483d03(0xb8),'path':knowledgeDocumentsPath('rules',_0x189e00['beforeRecord']?_0x483d03(0xce):_0x483d03(0xe6))},'warnings':_0x1010a6,'verification':{'status':'verified','recoveredAfterUnknownResponse':_0x32ec7e,'expectedVersion':_0x189e00[_0x483d03(0xbd)]?.[_0x483d03(0xc8)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x483d03(0xec)+_0x189e00[_0x483d03(0xab)][_0x483d03(0xb9)]+_0x483d03(0xbb)}},'message':_0x483d03(0xd7)+appRuleFileName(_0x189e00[_0x483d03(0xab)][_0x483d03(0xb9)])+_0x483d03(0xd6)+_0x3c6283[_0x483d03(0xaf)]};}};
@@ -1 +1 @@
1
- const a244_0x56ab79=a244_0x3ffa;(function(_0x5c9dfd,_0x19ad01){const _0x54df8a=a244_0x3ffa,_0x48f154=_0x5c9dfd();while(!![]){try{const _0xa86d9a=-parseInt(_0x54df8a(0x1cc))/0x1*(-parseInt(_0x54df8a(0x1da))/0x2)+-parseInt(_0x54df8a(0x1d0))/0x3+parseInt(_0x54df8a(0x1c5))/0x4*(parseInt(_0x54df8a(0x1bc))/0x5)+parseInt(_0x54df8a(0x1c4))/0x6*(-parseInt(_0x54df8a(0x1ba))/0x7)+-parseInt(_0x54df8a(0x1ae))/0x8*(parseInt(_0x54df8a(0x1c1))/0x9)+-parseInt(_0x54df8a(0x1b6))/0xa+-parseInt(_0x54df8a(0x1bb))/0xb*(-parseInt(_0x54df8a(0x1ce))/0xc);if(_0xa86d9a===_0x19ad01)break;else _0x48f154['push'](_0x48f154['shift']());}catch(_0xd59254){_0x48f154['push'](_0x48f154['shift']());}}}(a244_0x508f,0x80c38));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';function a244_0x508f(){const _0x150c80=['scope','byteSize','digest','app_rule_content_too_large','type','database','464KpgCbO','app_rule_file_required','App\x20rule\x20content\x20exceeds\x20the\x20bounded\x20UTF-8\x20file\x20limit.','indexStatus','decode','app_rule_type_invalid','appCode','message','9172030ksJooQ','utf-8','updateTime','page-api-development','539651TPaYNa','11FQvvbC','170TySZEN','Pass\x20a\x20UTF-8\x20Markdown\x20file.','length','update','toLowerCase','129204zWYVnG','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','app_rule_content_invalid','36ZgUruQ','120016wfFDHg','sha256:','hex','utf8','content','DATABASE.md','from','410745yIfncI','Cannot\x20read\x20app\x20rule\x20file:\x20','15516852yPkSaB','sha256','1184616FgAzbO','Cannot\x20access\x20app\x20rule\x20file:\x20','app_rule_file_invalid','RULES.md','byteLength','App\x20rule\x20file\x20is\x20blank:\x20','rules','createTime','version','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','4AoYnpx','trim','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','app_rule_file_unreadable','contentHash','--type\x20must\x20be\x20either\x20rules\x20or\x20database.'];a244_0x508f=function(){return _0x150c80;};return a244_0x508f();}export const APP_RULE_TYPES=[a244_0x56ab79(0x1d6),a244_0x56ab79(0x1ad)];export const MAX_APP_RULE_UNITS=0x5*0x400*0x400;export const MAX_APP_RULE_BYTES=MAX_APP_RULE_UNITS*0x4;const APP_RULE_FILES={'rules':a244_0x56ab79(0x1d3),'database':a244_0x56ab79(0x1ca)},APP_RULE_CONTEXT_SCOPES={'rules':a244_0x56ab79(0x1b9),'database':'database-analysis'};export function appRuleError(_0x26cf63,_0x4e8bdb,_0x491302){return new CliError(_0x26cf63,0x1,_0x4e8bdb,_0x491302);}export function readAppRuleType(_0x425888){const _0x4968c9=a244_0x56ab79,_0x1d8b85=_0x425888['str']('type')[_0x4968c9(0x1db)]()[_0x4968c9(0x1c0)]();if(_0x1d8b85!=='rules'&&_0x1d8b85!==_0x4968c9(0x1ad))throw appRuleError(_0x4968c9(0x1b3),_0x4968c9(0x1a7));return _0x1d8b85;}export function appRuleFileName(_0x20b215){return APP_RULE_FILES[_0x20b215];}function a244_0x3ffa(_0x1a5851,_0xa0c518){_0x1a5851=_0x1a5851-0x1a5;const _0x508f35=a244_0x508f();let _0x3ffafd=_0x508f35[_0x1a5851];return _0x3ffafd;}export function appRuleContextScope(_0x49ed1e){return APP_RULE_CONTEXT_SCOPES[_0x49ed1e];}export function inspectAppRuleContent(_0xabf31b){const _0x55cf3b=a244_0x56ab79,_0x41a4aa=Buffer[_0x55cf3b(0x1cb)](_0xabf31b,_0x55cf3b(0x1c8));return{'content':_0xabf31b,'byteSize':_0x41a4aa['byteLength'],'contentHash':_0x55cf3b(0x1c6)+createHash(_0x55cf3b(0x1cf))[_0x55cf3b(0x1bf)](_0x41a4aa)[_0x55cf3b(0x1aa)](_0x55cf3b(0x1c7))};}export async function readAppRuleFile(_0x179290){const _0x5408a6=a244_0x56ab79,_0x717b8=_0x179290[_0x5408a6(0x1db)]();if(!_0x717b8)throw appRuleError(_0x5408a6(0x1af),'--file\x20is\x20required.',_0x5408a6(0x1bd));const _0x546a3c=resolve(_0x717b8);let _0x4d98cb;try{_0x4d98cb=await stat(_0x546a3c);}catch(_0x29bcfc){throw appRuleError(_0x5408a6(0x1a5),_0x5408a6(0x1d1)+_0x717b8,_0x29bcfc instanceof Error?_0x29bcfc[_0x5408a6(0x1b5)]:String(_0x29bcfc));}if(!_0x4d98cb['isFile']())throw appRuleError(_0x5408a6(0x1d2),_0x5408a6(0x1c2)+_0x717b8);if(_0x4d98cb['size']>MAX_APP_RULE_BYTES)throw appRuleError(_0x5408a6(0x1ab),_0x5408a6(0x1b0));let _0x393112;try{_0x393112=await readFile(_0x546a3c);}catch(_0x2ee87b){throw appRuleError('app_rule_file_unreadable',_0x5408a6(0x1cd)+_0x717b8,_0x2ee87b instanceof Error?_0x2ee87b[_0x5408a6(0x1b5)]:String(_0x2ee87b));}if(_0x393112[_0x5408a6(0x1d4)]>MAX_APP_RULE_BYTES)throw appRuleError('app_rule_content_too_large',_0x5408a6(0x1b0));let _0x5322a2;try{_0x5322a2=new TextDecoder(_0x5408a6(0x1b7),{'fatal':!![],'ignoreBOM':!![]})[_0x5408a6(0x1b2)](_0x393112);}catch{throw appRuleError('app_rule_content_invalid',_0x5408a6(0x1d9)+_0x717b8);}if(_0x5322a2[_0x5408a6(0x1be)]>MAX_APP_RULE_UNITS)throw appRuleError(_0x5408a6(0x1ab),'App\x20rule\x20content\x20exceeds\x205242880\x20UTF-16\x20units.');if(!_0x5322a2[_0x5408a6(0x1db)]())throw appRuleError(_0x5408a6(0x1c3),_0x5408a6(0x1d5)+_0x717b8);return inspectAppRuleContent(_0x5322a2);}export function projectAppRule(_0x141dd3,_0x4664d3){const _0x2a3dd2=a244_0x56ab79;if(!_0x4664d3)return{'type':_0x141dd3,'fileName':appRuleFileName(_0x141dd3),'contextScope':appRuleContextScope(_0x141dd3),'enabled':![]};const _0x279985=inspectAppRuleContent(_0x4664d3[_0x2a3dd2(0x1c9)]);return{'type':_0x141dd3,'fileName':appRuleFileName(_0x141dd3),'contextScope':appRuleContextScope(_0x141dd3),'enabled':!![],'id':_0x4664d3['id'],'scope':_0x4664d3[_0x2a3dd2(0x1a8)],'appCode':_0x4664d3[_0x2a3dd2(0x1b4)],'version':_0x4664d3[_0x2a3dd2(0x1d8)],..._0x4664d3['indexStatus']!==undefined?{'indexStatus':_0x4664d3[_0x2a3dd2(0x1b1)]}:{},'contentByteSize':_0x279985[_0x2a3dd2(0x1a9)],'contentHash':_0x279985[_0x2a3dd2(0x1a6)],..._0x4664d3['createTime']!==undefined&&_0x4664d3[_0x2a3dd2(0x1d7)]!==null?{'createTime':_0x4664d3[_0x2a3dd2(0x1d7)]}:{},..._0x4664d3[_0x2a3dd2(0x1b8)]!==undefined&&_0x4664d3[_0x2a3dd2(0x1b8)]!==null?{'updateTime':_0x4664d3[_0x2a3dd2(0x1b8)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x56ab79(0x1ac),'type':'string','required':!![],'description':a244_0x56ab79(0x1dc),'enum':[...APP_RULE_TYPES]};
1
+ const a244_0x1b33da=a244_0x4269;(function(_0x49d7c9,_0x545e81){const _0x4fdebe=a244_0x4269,_0x4955ed=_0x49d7c9();while(!![]){try{const _0x374809=-parseInt(_0x4fdebe(0xa1))/0x1+-parseInt(_0x4fdebe(0xb2))/0x2+-parseInt(_0x4fdebe(0xbf))/0x3*(parseInt(_0x4fdebe(0xad))/0x4)+parseInt(_0x4fdebe(0x92))/0x5*(parseInt(_0x4fdebe(0x8f))/0x6)+parseInt(_0x4fdebe(0xa4))/0x7+parseInt(_0x4fdebe(0xbe))/0x8+parseInt(_0x4fdebe(0xb4))/0x9*(-parseInt(_0x4fdebe(0xac))/0xa);if(_0x374809===_0x545e81)break;else _0x4955ed['push'](_0x4955ed['shift']());}catch(_0xb3ef45){_0x4955ed['push'](_0x4955ed['shift']());}}}(a244_0x27db,0xd4f67));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a244_0x1b33da(0x94),a244_0x1b33da(0x99)];export const MAX_APP_RULE_UNITS=0x5*0x400*0x400;export const MAX_APP_RULE_BYTES=MAX_APP_RULE_UNITS*0x4;const APP_RULE_FILES={'rules':'RULES.md','database':a244_0x1b33da(0xa8)},APP_RULE_CONTEXT_SCOPES={'rules':a244_0x1b33da(0xb8),'database':a244_0x1b33da(0x98)};export function appRuleError(_0x13fd39,_0x421c21,_0x193bcc){return new CliError(_0x13fd39,0x1,_0x421c21,_0x193bcc);}export function readAppRuleType(_0x46ab44){const _0x3caabf=a244_0x1b33da,_0x1b0e6d=_0x46ab44[_0x3caabf(0xaa)](_0x3caabf(0x91))[_0x3caabf(0x90)]()[_0x3caabf(0xb7)]();if(_0x1b0e6d!=='rules'&&_0x1b0e6d!==_0x3caabf(0x99))throw appRuleError(_0x3caabf(0x96),_0x3caabf(0xb5));return _0x1b0e6d;}export function appRuleFileName(_0x520c1c){return APP_RULE_FILES[_0x520c1c];}export function appRuleContextScope(_0x95e0c8){return APP_RULE_CONTEXT_SCOPES[_0x95e0c8];}export function inspectAppRuleContent(_0x121295){const _0x427623=a244_0x1b33da,_0x1957d3=Buffer['from'](_0x121295,_0x427623(0xa3));return{'content':_0x121295,'byteSize':_0x1957d3['byteLength'],'contentHash':_0x427623(0x9c)+createHash(_0x427623(0x97))['update'](_0x1957d3)['digest'](_0x427623(0xa6))};}export async function readAppRuleFile(_0x4f6967){const _0x44110e=a244_0x1b33da,_0x598d6c=_0x4f6967[_0x44110e(0x90)]();if(!_0x598d6c)throw appRuleError(_0x44110e(0x9d),_0x44110e(0x9e),_0x44110e(0xaf));const _0x34a0c1=resolve(_0x598d6c);let _0x2457d3;try{_0x2457d3=await stat(_0x34a0c1);}catch(_0x1bea0b){throw appRuleError(_0x44110e(0xa2),'Cannot\x20access\x20app\x20rule\x20file:\x20'+_0x598d6c,_0x1bea0b instanceof Error?_0x1bea0b[_0x44110e(0x93)]:String(_0x1bea0b));}if(!_0x2457d3[_0x44110e(0xa5)]())throw appRuleError(_0x44110e(0xae),_0x44110e(0xc0)+_0x598d6c);if(_0x2457d3['size']>MAX_APP_RULE_BYTES)throw appRuleError(_0x44110e(0xb1),'App\x20rule\x20content\x20exceeds\x20the\x20bounded\x20UTF-8\x20file\x20limit.');let _0x1779c9;try{_0x1779c9=await readFile(_0x34a0c1);}catch(_0x84bb38){throw appRuleError(_0x44110e(0xa2),_0x44110e(0xba)+_0x598d6c,_0x84bb38 instanceof Error?_0x84bb38[_0x44110e(0x93)]:String(_0x84bb38));}if(_0x1779c9[_0x44110e(0x9b)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x44110e(0xb1),_0x44110e(0xa7));let _0x1a9182;try{_0x1a9182=new TextDecoder(_0x44110e(0xb9),{'fatal':!![],'ignoreBOM':!![]})['decode'](_0x1779c9);}catch{throw appRuleError(_0x44110e(0x9a),_0x44110e(0xb0)+_0x598d6c);}if(_0x1a9182[_0x44110e(0xb6)]>MAX_APP_RULE_UNITS)throw appRuleError(_0x44110e(0xb1),_0x44110e(0x9f));if(!_0x1a9182[_0x44110e(0x90)]())throw appRuleError(_0x44110e(0x9a),'App\x20rule\x20file\x20is\x20blank:\x20'+_0x598d6c);return inspectAppRuleContent(_0x1a9182);}function a244_0x27db(){const _0x508d09=['isFile','hex','App\x20rule\x20content\x20exceeds\x20the\x20bounded\x20UTF-8\x20file\x20limit.','DATABASE.md','updateTime','str','version','10otRZUR','224288yYkASU','app_rule_file_invalid','Pass\x20a\x20UTF-8\x20Markdown\x20file.','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','app_rule_content_too_large','795932SwyKNl','contentHash','5713911aEkqji','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','length','toLowerCase','page-api-development','utf-8','Cannot\x20read\x20app\x20rule\x20file:\x20','content','createTime','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','4478760VdvboC','21yZCyaS','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','2759112ghTQTl','trim','type','10fchNxL','message','rules','scope','app_rule_type_invalid','sha256','database-analysis','database','app_rule_content_invalid','byteLength','sha256:','app_rule_file_required','--file\x20is\x20required.','App\x20rule\x20content\x20exceeds\x205242880\x20UTF-16\x20units.','indexStatus','759783denSAC','app_rule_file_unreadable','utf8','11045146NDrNTR'];a244_0x27db=function(){return _0x508d09;};return a244_0x27db();}function a244_0x4269(_0x7d494d,_0x2b24e){_0x7d494d=_0x7d494d-0x8f;const _0x27db67=a244_0x27db();let _0x42692e=_0x27db67[_0x7d494d];return _0x42692e;}export function projectAppRule(_0x598931,_0x440ff4){const _0x15c2ee=a244_0x1b33da;if(!_0x440ff4)return{'type':_0x598931,'fileName':appRuleFileName(_0x598931),'contextScope':appRuleContextScope(_0x598931),'enabled':![]};const _0x317562=inspectAppRuleContent(_0x440ff4[_0x15c2ee(0xbb)]);return{'type':_0x598931,'fileName':appRuleFileName(_0x598931),'contextScope':appRuleContextScope(_0x598931),'enabled':!![],'id':_0x440ff4['id'],'scope':_0x440ff4[_0x15c2ee(0x95)],'appCode':_0x440ff4['appCode'],'version':_0x440ff4[_0x15c2ee(0xab)],..._0x440ff4[_0x15c2ee(0xa0)]!==undefined?{'indexStatus':_0x440ff4['indexStatus']}:{},'contentByteSize':_0x317562['byteSize'],'contentHash':_0x317562[_0x15c2ee(0xb3)],..._0x440ff4[_0x15c2ee(0xbc)]!==undefined&&_0x440ff4['createTime']!==null?{'createTime':_0x440ff4['createTime']}:{},..._0x440ff4[_0x15c2ee(0xa9)]!==undefined&&_0x440ff4[_0x15c2ee(0xa9)]!==null?{'updateTime':_0x440ff4[_0x15c2ee(0xa9)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x1b33da(0x91),'type':'string','required':!![],'description':a244_0x1b33da(0xbd),'enum':[...APP_RULE_TYPES]};
@@ -1 +1 @@
1
- const a245_0x292b46=a245_0xc3d2;(function(_0xe0ed03,_0x138b6f){const _0x4bccea=a245_0xc3d2,_0x4df90e=_0xe0ed03();while(!![]){try{const _0x2ea666=parseInt(_0x4bccea(0x164))/0x1*(parseInt(_0x4bccea(0x156))/0x2)+parseInt(_0x4bccea(0x15a))/0x3+parseInt(_0x4bccea(0x17b))/0x4*(parseInt(_0x4bccea(0x188))/0x5)+-parseInt(_0x4bccea(0x15c))/0x6+parseInt(_0x4bccea(0x192))/0x7+-parseInt(_0x4bccea(0x154))/0x8*(parseInt(_0x4bccea(0x161))/0x9)+-parseInt(_0x4bccea(0x187))/0xa;if(_0x2ea666===_0x138b6f)break;else _0x4df90e['push'](_0x4df90e['shift']());}catch(_0x624ffa){_0x4df90e['push'](_0x4df90e['shift']());}}}(a245_0xc62d,0x6b4eb));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a245_0x292b46(0x18a),a245_0x292b46(0x151)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a245_0x292b46(0x18a),'dev',a245_0x292b46(0x178),a245_0x292b46(0x17a)]);export function syncProjectDomainRoutingBeforeScript(_0x3ac302,_0xfa62b3){const _0x237b46=a245_0x292b46;if(!DOMAIN_ROUTING_SYNC_SCRIPTS['has'](_0xfa62b3))return null;const _0x3bd0f5=findProjectRootDirectory(_0x3ac302);if(!resolveConfigPath(_0x3bd0f5))return null;const _0x413b06=writeProjectDomainRoutingManifest(_0x3bd0f5);return{'path':_0x413b06['path'],'changed':_0x413b06[_0x237b46(0x14f)]};}function readPackageScripts(_0x258761){const _0x3adddd=a245_0x292b46,_0x1ccb51=resolve(_0x258761,_0x3adddd(0x15d));if(!existsSync(_0x1ccb51))return null;try{const _0x179149=JSON[_0x3adddd(0x17f)](readFileSync(_0x1ccb51,_0x3adddd(0x18e)));return _0x179149['scripts']??{};}catch{return null;}}function detectPackageManager(_0x1d77a5){const _0x241fcb=a245_0x292b46;if(existsSync(resolve(_0x1d77a5,_0x241fcb(0x155)))||existsSync(resolve(_0x1d77a5,_0x241fcb(0x167))))return'bun';if(existsSync(resolve(_0x1d77a5,_0x241fcb(0x18f))))return _0x241fcb(0x158);if(existsSync(resolve(_0x1d77a5,_0x241fcb(0x182))))return _0x241fcb(0x16a);return _0x241fcb(0x157);}async function versionCheck(_0x5f2fb6){const _0x35854e=a245_0x292b46,_0x43410b=await checkCliVersion();(_0x43410b['needsUpgrade']||_0x43410b[_0x35854e(0x163)])&&(printCliUpgradeWarning(_0x43410b),assertCliVersionSupported(_0x43410b));const _0x52d589=await checkSdkVersion(_0x5f2fb6);if(_0x52d589[_0x35854e(0x172)])printSdkUpgradeWarning(_0x52d589);}function spawnScript(_0xd88b2a,_0x355c8e,_0x5142d2,_0x307c21){return new Promise((_0x5f13aa,_0x2f17e1)=>{const _0x4bff6b=a245_0xc3d2,_0x4920bd=[_0x4bff6b(0x17d),_0x355c8e,..._0x5142d2],_0x4e0bd4=spawn(_0xd88b2a,_0x4920bd,{'cwd':_0x307c21,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x307c21,_0x4bff6b(0x16e),_0x4bff6b(0x15f))+delimiter+process.env.PATH}});_0x4e0bd4['on'](_0x4bff6b(0x16b),_0x5579a9=>{const _0x2b3f92=_0x4bff6b;if(_0x5579a9===0x0||_0x5579a9===null)_0x5f13aa();else _0x2f17e1(new Error(_0xd88b2a+'\x20run\x20'+_0x355c8e+_0x2b3f92(0x168)+_0x5579a9));}),_0x4e0bd4['on']('error',_0x2f17e1);});}function spawnViteBuildWatch(_0x2d6e36){return new Promise((_0x1c28e1,_0x27dd0a)=>{const _0x1f3f62=a245_0xc3d2,_0x4b2226=spawn(_0x1f3f62(0x16d),[_0x1f3f62(0x178),_0x1f3f62(0x170)],{'cwd':_0x2d6e36,'stdio':_0x1f3f62(0x169),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2d6e36,_0x1f3f62(0x16e),_0x1f3f62(0x15f))+delimiter+process.env.PATH}});_0x4b2226['on'](_0x1f3f62(0x16b),_0x60c34d=>{const _0x479fdf=_0x1f3f62;if(_0x60c34d===0x0||_0x60c34d===null)_0x1c28e1();else _0x27dd0a(new Error(_0x479fdf(0x152)+_0x60c34d));}),_0x4b2226['on']('error',_0x27dd0a);});}function a245_0xc3d2(_0x2f4c60,_0x578de1){_0x2f4c60=_0x2f4c60-0x14f;const _0xc62da7=a245_0xc62d();let _0xc3d283=_0xc62da7[_0x2f4c60];return _0xc3d283;}function spawnVitePreview(_0x3337de){return new Promise((_0x71474d,_0x11417a)=>{const _0x11d62e=a245_0xc3d2,_0x4adb00=spawn('vite',[_0x11d62e(0x17a)],{'cwd':_0x3337de,'stdio':_0x11d62e(0x169),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3337de,'node_modules','.bin')+delimiter+process.env.PATH}});_0x4adb00['on'](_0x11d62e(0x16b),_0x14c5a8=>{const _0x21ea11=_0x11d62e;if(_0x14c5a8===0x0||_0x14c5a8===null)_0x71474d();else _0x11417a(new Error(_0x21ea11(0x18d)+_0x14c5a8));}),_0x4adb00['on'](_0x11d62e(0x18c),_0x11417a);});}function a245_0xc62d(){const _0x2f93f3=['\x20run\x20build','bool','slice','watch','10169650YSGrws','4885jWrTMH','write','start','cwd','error','vite\x20preview\x20exited\x20with\x20code\x20','utf-8','pnpm-lock.yaml','push','\x0a\x20\x20Available\x20scripts:\x0a','4366376TSerLW','changed','\x20\x20EXAMPLES','dev','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','path','88YZsNWD','bun.lockb','6OcqvGX','npm','pnpm','log','1005207EGzqaS','keys','3631962fsKuup','package.json','\x20\x20\x20\x20','.bin','\x22\x20not\x20found\x20in\x20package.json.','204003OiKPMf','(none)','belowMinimum','246907GMrmgD','Run\x20a\x20package.json\x20script','Available:\x20','bun.lock','\x20exited\x20with\x20code\x20','inherit','yarn','close','join','vite','node_modules','has','--watch','Enable\x20watch\x20mode\x20for\x20preview','needsUpgrade','\x20run\x20<script>\x0a','\x20run\x20preview\x20--watch','Domain\x20routing\x20synchronized:\x20','script','boolean','build','args','preview','2504WrKacG','all','run','length','parse','No\x20scripts\x20defined\x20in\x20package.json.','validation','yarn.lock'];a245_0xc62d=function(){return _0x2f93f3;};return a245_0xc62d();}const runFlags=[{'name':a245_0x292b46(0x186),'type':a245_0x292b46(0x177),'description':a245_0x292b46(0x171),'default':![]}];export const runDefinition={'service':a245_0x292b46(0x17d),'command':'run','description':a245_0x292b46(0x165),'risk':a245_0x292b46(0x189),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a245_0x292b46(0x176),'description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x3d3719=a245_0x292b46,_0x1be3e0=[];return _0x1be3e0[_0x3d3719(0x190)](_0x3d3719(0x150)),_0x1be3e0[_0x3d3719(0x190)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20start'),_0x1be3e0['push'](_0x3d3719(0x15e)+CLI_BIN_NAME+_0x3d3719(0x183)),_0x1be3e0[_0x3d3719(0x190)](_0x3d3719(0x15e)+CLI_BIN_NAME+'\x20run\x20preview'),_0x1be3e0['push'](_0x3d3719(0x15e)+CLI_BIN_NAME+_0x3d3719(0x174)),_0x1be3e0[_0x3d3719(0x16c)]('\x0a');},async 'execute'(_0x310ce2){const _0x2b6b06=a245_0x292b46,_0x14b4a2=process[_0x2b6b06(0x18b)](),_0x2e9e78=_0x310ce2[_0x2b6b06(0x179)][0x0],_0x43ca43=_0x310ce2[_0x2b6b06(0x179)][_0x2b6b06(0x185)](0x1),_0x2365c6=readPackageScripts(_0x14b4a2);if(!_0x2365c6)throw CliErrors[_0x2b6b06(0x181)]('No\x20package.json\x20found\x20in\x20current\x20directory.');if(!_0x2e9e78){const _0x34c6ec=Object[_0x2b6b06(0x15b)](_0x2365c6);if(_0x34c6ec[_0x2b6b06(0x17e)]===0x0)console[_0x2b6b06(0x159)](_0x2b6b06(0x180));else{console['log'](_0x2b6b06(0x191));for(const _0x229d4b of _0x34c6ec){console[_0x2b6b06(0x159)](_0x2b6b06(0x15e)+_0x229d4b);}console[_0x2b6b06(0x159)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+_0x2b6b06(0x173));}return{'ok':!![]};}if(!_0x2365c6[_0x2e9e78])throw CliErrors[_0x2b6b06(0x181)]('Script\x20\x22'+_0x2e9e78+_0x2b6b06(0x160),_0x2b6b06(0x166)+(Object['keys'](_0x2365c6)[_0x2b6b06(0x16c)](',\x20')||_0x2b6b06(0x162)));const _0x33fa3d=detectPackageManager(_0x14b4a2),_0x345072=syncProjectDomainRoutingBeforeScript(_0x14b4a2,_0x2e9e78);_0x345072?.['changed']&&console['error'](_0x2b6b06(0x175)+_0x345072[_0x2b6b06(0x153)]);VERSION_CHECK_SCRIPTS[_0x2b6b06(0x16f)](_0x2e9e78)&&await versionCheck(_0x14b4a2);if(_0x2e9e78===_0x2b6b06(0x17a)&&_0x310ce2[_0x2b6b06(0x184)](_0x2b6b06(0x186)))return await Promise[_0x2b6b06(0x17c)]([spawnViteBuildWatch(_0x14b4a2),spawnVitePreview(_0x14b4a2)]),{'ok':!![]};return await spawnScript(_0x33fa3d,_0x2e9e78,_0x43ca43,_0x14b4a2),{'ok':!![]};}};
1
+ const a245_0x3fcd4a=a245_0x11d8;(function(_0x8f8731,_0x5ebcab){const _0x5753d7=a245_0x11d8,_0x519252=_0x8f8731();while(!![]){try{const _0x29891e=parseInt(_0x5753d7(0x114))/0x1+parseInt(_0x5753d7(0x10a))/0x2+-parseInt(_0x5753d7(0x107))/0x3*(-parseInt(_0x5753d7(0x102))/0x4)+-parseInt(_0x5753d7(0x124))/0x5*(-parseInt(_0x5753d7(0x11d))/0x6)+parseInt(_0x5753d7(0x11b))/0x7+-parseInt(_0x5753d7(0xf9))/0x8*(-parseInt(_0x5753d7(0x11a))/0x9)+-parseInt(_0x5753d7(0x109))/0xa*(parseInt(_0x5753d7(0x119))/0xb);if(_0x29891e===_0x5ebcab)break;else _0x519252['push'](_0x519252['shift']());}catch(_0x17f95c){_0x519252['push'](_0x519252['shift']());}}}(a245_0x3055,0x4b856));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';function a245_0x11d8(_0x5d1fbb,_0x30dd48){_0x5d1fbb=_0x5d1fbb-0xec;const _0x30553c=a245_0x3055();let _0x11d818=_0x30553c[_0x5d1fbb];return _0x11d818;}import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';function a245_0x3055(){const _0x1a875f=['utf-8','all','yarn.lock','\x22\x20not\x20found\x20in\x20package.json.','Run\x20a\x20package.json\x20script','package.json','pnpm-lock.yaml','No\x20package.json\x20found\x20in\x20current\x20directory.','73983rFxfgb','log','preview','keys','\x20run\x20','2277ShhuyS','3465828VOMdqr','1089291PvSNAF','No\x20scripts\x20defined\x20in\x20package.json.','3589506vKQVrw','.bin','\x20run\x20preview','needsUpgrade','Domain\x20routing\x20synchronized:\x20','parse','\x0a\x20\x20Available\x20scripts:\x0a','5SBAOFK','vite','yarn','\x20\x20\x20\x20','push','bun.lockb','--watch','run','error','script','bun.lock','watch','bun','start','node_modules','Enable\x20watch\x20mode\x20for\x20preview','slice','dev','npm','write','changed','inherit','join','8EDROtx','\x20run\x20build','length','bool','Script\x20\x22','cwd','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','\x20run\x20start','(none)','52NuCmrM','pnpm','path','build','validation','34746VjzSFF','close','65270fXDgYb','593836ioFsGe','belowMinimum'];a245_0x3055=function(){return _0x1a875f;};return a245_0x3055();}const VERSION_CHECK_SCRIPTS=new Set([a245_0x3fcd4a(0xef),a245_0x3fcd4a(0xf3)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set(['start',a245_0x3fcd4a(0xf3),'build','preview']);export function syncProjectDomainRoutingBeforeScript(_0x2647b0,_0x9af01d){const _0x464ff0=a245_0x3fcd4a;if(!DOMAIN_ROUTING_SYNC_SCRIPTS['has'](_0x9af01d))return null;const _0x42cc1f=findProjectRootDirectory(_0x2647b0);if(!resolveConfigPath(_0x42cc1f))return null;const _0x41504b=writeProjectDomainRoutingManifest(_0x42cc1f);return{'path':_0x41504b[_0x464ff0(0x104)],'changed':_0x41504b[_0x464ff0(0xf6)]};}function readPackageScripts(_0x26374d){const _0x5b9d13=a245_0x3fcd4a,_0x3e7fd3=resolve(_0x26374d,_0x5b9d13(0x111));if(!existsSync(_0x3e7fd3))return null;try{const _0x5aafb1=JSON[_0x5b9d13(0x122)](readFileSync(_0x3e7fd3,_0x5b9d13(0x10c)));return _0x5aafb1['scripts']??{};}catch{return null;}}function detectPackageManager(_0x5ceedb){const _0x404efe=a245_0x3fcd4a;if(existsSync(resolve(_0x5ceedb,_0x404efe(0x129)))||existsSync(resolve(_0x5ceedb,_0x404efe(0xec))))return _0x404efe(0xee);if(existsSync(resolve(_0x5ceedb,_0x404efe(0x112))))return _0x404efe(0x103);if(existsSync(resolve(_0x5ceedb,_0x404efe(0x10e))))return _0x404efe(0x126);return _0x404efe(0xf4);}async function versionCheck(_0x2438d3){const _0x31e4c9=a245_0x3fcd4a,_0x1d4582=await checkCliVersion();(_0x1d4582[_0x31e4c9(0x120)]||_0x1d4582[_0x31e4c9(0x10b)])&&(printCliUpgradeWarning(_0x1d4582),assertCliVersionSupported(_0x1d4582));const _0x2044ab=await checkSdkVersion(_0x2438d3);if(_0x2044ab[_0x31e4c9(0x120)])printSdkUpgradeWarning(_0x2044ab);}function spawnScript(_0x306d39,_0x199976,_0x37402c,_0x356da9){return new Promise((_0x417ff2,_0x173fab)=>{const _0x252ba9=a245_0x11d8,_0x4a7ba9=[_0x252ba9(0x12b),_0x199976,..._0x37402c],_0x114a54=spawn(_0x306d39,_0x4a7ba9,{'cwd':_0x356da9,'stdio':_0x252ba9(0xf7),'shell':!![],'env':{...process.env,'PATH':''+join(_0x356da9,_0x252ba9(0xf0),_0x252ba9(0x11e))+delimiter+process.env.PATH}});_0x114a54['on']('close',_0x101c60=>{const _0x4e4452=_0x252ba9;if(_0x101c60===0x0||_0x101c60===null)_0x417ff2();else _0x173fab(new Error(_0x306d39+_0x4e4452(0x118)+_0x199976+'\x20exited\x20with\x20code\x20'+_0x101c60));}),_0x114a54['on'](_0x252ba9(0x12c),_0x173fab);});}function spawnViteBuildWatch(_0x5504fb){return new Promise((_0x59cd34,_0x2571cd)=>{const _0x42d4d1=a245_0x11d8,_0x4878ad=spawn('vite',[_0x42d4d1(0x105),_0x42d4d1(0x12a)],{'cwd':_0x5504fb,'stdio':_0x42d4d1(0xf7),'shell':!![],'env':{...process.env,'PATH':''+join(_0x5504fb,'node_modules',_0x42d4d1(0x11e))+delimiter+process.env.PATH}});_0x4878ad['on'](_0x42d4d1(0x108),_0x4a29f1=>{const _0x2cdbc2=_0x42d4d1;if(_0x4a29f1===0x0||_0x4a29f1===null)_0x59cd34();else _0x2571cd(new Error(_0x2cdbc2(0xff)+_0x4a29f1));}),_0x4878ad['on']('error',_0x2571cd);});}function spawnVitePreview(_0x27f01c){return new Promise((_0x11f1cd,_0x78de3b)=>{const _0x70debf=a245_0x11d8,_0xcecda=spawn(_0x70debf(0x125),[_0x70debf(0x116)],{'cwd':_0x27f01c,'stdio':_0x70debf(0xf7),'shell':!![],'env':{...process.env,'PATH':''+join(_0x27f01c,_0x70debf(0xf0),_0x70debf(0x11e))+delimiter+process.env.PATH}});_0xcecda['on'](_0x70debf(0x108),_0x895855=>{if(_0x895855===0x0||_0x895855===null)_0x11f1cd();else _0x78de3b(new Error('vite\x20preview\x20exited\x20with\x20code\x20'+_0x895855));}),_0xcecda['on']('error',_0x78de3b);});}const runFlags=[{'name':a245_0x3fcd4a(0xed),'type':'boolean','description':a245_0x3fcd4a(0xf1),'default':![]}];export const runDefinition={'service':'run','command':'run','description':a245_0x3fcd4a(0x110),'risk':a245_0x3fcd4a(0xf5),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a245_0x3fcd4a(0x12d),'description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x1919ac=a245_0x3fcd4a,_0x54de1d=[];return _0x54de1d[_0x1919ac(0x128)]('\x20\x20EXAMPLES'),_0x54de1d['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x1919ac(0x100)),_0x54de1d[_0x1919ac(0x128)](_0x1919ac(0x127)+CLI_BIN_NAME+_0x1919ac(0xfa)),_0x54de1d[_0x1919ac(0x128)](_0x1919ac(0x127)+CLI_BIN_NAME+_0x1919ac(0x11f)),_0x54de1d[_0x1919ac(0x128)](_0x1919ac(0x127)+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x54de1d[_0x1919ac(0xf8)]('\x0a');},async 'execute'(_0x10ae5c){const _0x361bba=a245_0x3fcd4a,_0x96d4f9=process[_0x361bba(0xfe)](),_0x20ffdb=_0x10ae5c['args'][0x0],_0x22c94a=_0x10ae5c['args'][_0x361bba(0xf2)](0x1),_0x4674bf=readPackageScripts(_0x96d4f9);if(!_0x4674bf)throw CliErrors[_0x361bba(0x106)](_0x361bba(0x113));if(!_0x20ffdb){const _0x1082c4=Object['keys'](_0x4674bf);if(_0x1082c4[_0x361bba(0xfb)]===0x0)console[_0x361bba(0x115)](_0x361bba(0x11c));else{console[_0x361bba(0x115)](_0x361bba(0x123));for(const _0x4eba98 of _0x1082c4){console['log'](_0x361bba(0x127)+_0x4eba98);}console[_0x361bba(0x115)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x4674bf[_0x20ffdb])throw CliErrors[_0x361bba(0x106)](_0x361bba(0xfd)+_0x20ffdb+_0x361bba(0x10f),'Available:\x20'+(Object[_0x361bba(0x117)](_0x4674bf)['join'](',\x20')||_0x361bba(0x101)));const _0x5115e4=detectPackageManager(_0x96d4f9),_0x28a2a8=syncProjectDomainRoutingBeforeScript(_0x96d4f9,_0x20ffdb);_0x28a2a8?.[_0x361bba(0xf6)]&&console['error'](_0x361bba(0x121)+_0x28a2a8[_0x361bba(0x104)]);VERSION_CHECK_SCRIPTS['has'](_0x20ffdb)&&await versionCheck(_0x96d4f9);if(_0x20ffdb===_0x361bba(0x116)&&_0x10ae5c[_0x361bba(0xfc)]('watch'))return await Promise[_0x361bba(0x10d)]([spawnViteBuildWatch(_0x96d4f9),spawnVitePreview(_0x96d4f9)]),{'ok':!![]};return await spawnScript(_0x5115e4,_0x20ffdb,_0x22c94a,_0x96d4f9),{'ok':!![]};}};
@@ -1 +1 @@
1
- function a246_0x3add(_0x565b80,_0x39a4b4){_0x565b80=_0x565b80-0x6e;const _0x58f633=a246_0x58f6();let _0x3addb7=_0x58f633[_0x565b80];return _0x3addb7;}const a246_0x30f462=a246_0x3add;(function(_0x267ee2,_0x5629ff){const _0x38174d=a246_0x3add,_0x13d24e=_0x267ee2();while(!![]){try{const _0x38f168=parseInt(_0x38174d(0x6f))/0x1+parseInt(_0x38174d(0x74))/0x2*(-parseInt(_0x38174d(0x70))/0x3)+-parseInt(_0x38174d(0x77))/0x4*(parseInt(_0x38174d(0x75))/0x5)+-parseInt(_0x38174d(0x73))/0x6*(parseInt(_0x38174d(0x72))/0x7)+parseInt(_0x38174d(0x71))/0x8+parseInt(_0x38174d(0x7a))/0x9+-parseInt(_0x38174d(0x7c))/0xa*(parseInt(_0x38174d(0x79))/0xb);if(_0x38f168===_0x5629ff)break;else _0x13d24e['push'](_0x13d24e['shift']());}catch(_0x3efea8){_0x13d24e['push'](_0x13d24e['shift']());}}}(a246_0x58f6,0x5140c));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x297ccb){const _0x47e393=await buildSchemaPayload();return{'ok':!![],'data':_0x47e393};}export const schemaDefinition={'service':a246_0x30f462(0x7b),'command':a246_0x30f462(0x76),'description':a246_0x30f462(0x6e),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a246_0x30f462(0x78),'flags':[],'execute':execute};function a246_0x58f6(){const _0x3ebf5f=['20CqjdOD','Export\x20machine-readable\x20command\x20schema\x20(JSON)','631469BWGJnS','2469PihtZn','3819096criBGb','67137ZkNozB','198TfxtRF','122dhglWq','5ucCfxN','export','334052pjdUAR','json','2977711KgDYIv','1940193QAjTTD','schema'];a246_0x58f6=function(){return _0x3ebf5f;};return a246_0x58f6();}
1
+ const a246_0x4dce19=a246_0x26e1;function a246_0x3182(){const _0x4c16c3=['2629578unnExr','schema','6988612CysNki','1213401NHFClf','12iiqnHp','214792wVKsGz','10952736swgCrF','19871352KqJEsV','2564990uKKJwh','18MuanXl'];a246_0x3182=function(){return _0x4c16c3;};return a246_0x3182();}(function(_0x59a61d,_0x33daea){const _0x445734=a246_0x26e1,_0x426c14=_0x59a61d();while(!![]){try{const _0xd9872e=-parseInt(_0x445734(0x124))/0x1*(-parseInt(_0x445734(0x123))/0x2)+parseInt(_0x445734(0x129))/0x3+-parseInt(_0x445734(0x121))/0x4+-parseInt(_0x445734(0x127))/0x5*(-parseInt(_0x445734(0x128))/0x6)+-parseInt(_0x445734(0x122))/0x7+parseInt(_0x445734(0x125))/0x8+-parseInt(_0x445734(0x126))/0x9;if(_0xd9872e===_0x33daea)break;else _0x426c14['push'](_0x426c14['shift']());}catch(_0x36261b){_0x426c14['push'](_0x426c14['shift']());}}}(a246_0x3182,0xe6b2c));function a246_0x26e1(_0xdb872f,_0x32fc8d){_0xdb872f=_0xdb872f-0x121;const _0x318218=a246_0x3182();let _0x26e102=_0x318218[_0xdb872f];return _0x26e102;}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x46afff){const _0x4b61fe=await buildSchemaPayload();return{'ok':!![],'data':_0x4b61fe};}export const schemaDefinition={'service':a246_0x4dce19(0x12a),'command':'export','description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a247_0x49cbfa=a247_0x38bb;(function(_0x5beb94,_0x408b4a){const _0x2ed220=a247_0x38bb,_0xef2281=_0x5beb94();while(!![]){try{const _0x269ac6=-parseInt(_0x2ed220(0x13c))/0x1+-parseInt(_0x2ed220(0x124))/0x2+parseInt(_0x2ed220(0x130))/0x3*(parseInt(_0x2ed220(0x135))/0x4)+parseInt(_0x2ed220(0x125))/0x5+-parseInt(_0x2ed220(0x143))/0x6+parseInt(_0x2ed220(0x12b))/0x7*(-parseInt(_0x2ed220(0x134))/0x8)+parseInt(_0x2ed220(0x118))/0x9;if(_0x269ac6===_0x408b4a)break;else _0xef2281['push'](_0xef2281['shift']());}catch(_0x32ec54){_0xef2281['push'](_0xef2281['shift']());}}}(a247_0x518c,0x6314d));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(_0x1e045a){const _0x1909f0=a247_0x38bb;if(_0x1e045a==='mybatisXml')return[_0x1909f0(0x132),'\x20\x20SELECT\x201\x20AS\x20id',_0x1909f0(0x11e),''][_0x1909f0(0x136)]('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x1909f0(0x136)]('\x0a');}function a247_0x518c(){const _0x418244=['write','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','lastSync','138bxAwjB','POST','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','sqlCode','2238584kAqXtt','41960DQqwCL','join','validation','catch','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','db-id','dbId','307163OLZZXT','new','dbId\x20cannot\x20be\x20empty','lockFilePath','Local\x20SQL\x20file\x20mode','mode','SQL\x20name\x20cannot\x20be\x20empty','2970072LWregp','dbName','trim','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','__manual__','MyBatis\x20XML\x20(mybatisXml)','isInteger','sqlRootDir','name','toISOString','isFinite','create','SQL\x20name:','utf8','mybatisXml','flagMissing','Target\x20database\x20dbId:','Plain\x20SQL\x20(sql)','sql','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','length','number','/smartapi/custom/saveUserCustomSql','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','10625652YBDWGM','nonInteractive','stringify','sqlRoot','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','str','</select>','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','Created\x20SQL\x20query\x20','Select\x20the\x20target\x20database:','string','dbId\x20must\x20be\x20a\x20positive\x20integer','1578304mlkQQr','3069095fitGaT','SQL\x20query\x20display\x20name','✎\x20Enter\x20dbId\x20manually','File\x20already\x20exists:\x20','appCode','sqls','7VDtQjI','sqlName'];a247_0x518c=function(){return _0x418244;};return a247_0x518c();}export const sqlCreate={'service':a247_0x49cbfa(0x155),'command':a247_0x49cbfa(0x14e),'description':a247_0x49cbfa(0x113),'risk':a247_0x49cbfa(0x12d),'flags':[{'name':a247_0x49cbfa(0x14b),'type':a247_0x49cbfa(0x122),'description':a247_0x49cbfa(0x126)},{'name':a247_0x49cbfa(0x13a),'type':a247_0x49cbfa(0x115),'description':'Target\x20database\x20ID'},{'name':'mode','type':a247_0x49cbfa(0x122),'enum':[a247_0x49cbfa(0x155),a247_0x49cbfa(0x151)],'description':a247_0x49cbfa(0x140)}],async 'validate'(_0x1b7ab7){const _0x33b73a=a247_0x49cbfa;if(!_0x1b7ab7[_0x33b73a(0x119)])return;if(!_0x1b7ab7['str'](_0x33b73a(0x14b))[_0x33b73a(0x145)]())throw CliErrors['flagMissing'](_0x33b73a(0x14b),_0x33b73a(0x11c));const _0x202d25=resolveProvidedDbId(_0x1b7ab7);if(typeof _0x202d25!==_0x33b73a(0x115)||!Number['isFinite'](_0x202d25)||_0x202d25<=0x0)throw CliErrors[_0x33b73a(0x152)](_0x33b73a(0x13a),_0x33b73a(0x11f));if(!_0x1b7ab7[_0x33b73a(0x11d)](_0x33b73a(0x141))[_0x33b73a(0x145)]())throw CliErrors[_0x33b73a(0x152)](_0x33b73a(0x141),_0x33b73a(0x139));},async 'dryRun'(_0x1e0c5f){const _0x306d2a=a247_0x49cbfa,_0x586d77=loadSqlProjectConfig(_0x1e0c5f[_0x306d2a(0x129)]),{sqlName:_0x2e836f,dbId:_0x119e14,dbName:_0x3e67f7,mode:_0x338f6a}=await resolveSqlNewInputs(_0x1e0c5f),_0x3be948=buildSqlRelativePath('<server-generated-sqlCode>',_0x2e836f,_0x3e67f7,_0x338f6a,_0x119e14),_0x3a3740=_0x586d77[_0x306d2a(0x14a)]+'/'+_0x3be948;return{'method':_0x306d2a(0x131),'url':_0x306d2a(0x116),'body':{'appCode':_0x1e0c5f[_0x306d2a(0x129)],'sqlName':_0x2e836f,'dbId':_0x119e14,'mode':_0x338f6a,'localPath':_0x3a3740},'description':_0x306d2a(0x146)+_0x586d77[_0x306d2a(0x14a)]};},async 'execute'(_0x3c18fd){const _0x53bd6e=a247_0x49cbfa,_0x43777a=loadSqlProjectConfig(_0x3c18fd[_0x53bd6e(0x129)]),{sqlName:_0x19278c,dbId:_0x3037c4,dbName:_0x51b023,mode:_0x34e31f}=await resolveSqlNewInputs(_0x3c18fd),_0x569e3c=generateSqlTemplate(_0x34e31f),_0x5eeeac=await createSqlQuery({'appCode':_0x3c18fd[_0x53bd6e(0x129)],'sqlName':_0x19278c,'dbId':_0x3037c4,'sqlContent':_0x569e3c}),_0x1a4fbd=ensureRemoteSqlContent(_0x5eeeac),_0x1c2f03=_0x51b023||await getDbName(_0x3c18fd[_0x53bd6e(0x129)],_0x3037c4)[_0x53bd6e(0x138)](()=>undefined),_0x5f2bf8=buildSqlRelativePath(_0x5eeeac[_0x53bd6e(0x133)],_0x5eeeac[_0x53bd6e(0x12c)],_0x1c2f03,_0x34e31f,_0x3037c4),_0x4d7640=_0x43777a[_0x53bd6e(0x14a)]+'/'+_0x5f2bf8,_0xea5b0a=buildLocalSqlFileContent({'sqlCode':_0x5eeeac[_0x53bd6e(0x133)],'sqlName':_0x5eeeac[_0x53bd6e(0x12c)],'dbId':_0x5eeeac[_0x53bd6e(0x13b)]},_0x1a4fbd,{'dbName':_0x1c2f03,'mode':_0x34e31f,'syncedAt':new Date()[_0x53bd6e(0x14c)](),'description':_0x5eeeac['description']});if(await fileExists(_0x4d7640))throw CliErrors[_0x53bd6e(0x137)](_0x53bd6e(0x128)+_0x4d7640);await ensureParentDirectory(_0x4d7640),await writeFile(_0x4d7640,_0xea5b0a,_0x53bd6e(0x150));const _0x197176=await readSqlLockFile(_0x43777a[_0x53bd6e(0x13f)]),{lockData:_0x539266,appLock:_0x1efd4}=ensureSqlLockScope(_0x197176??createEmptySqlLock(),_0x43777a[_0x53bd6e(0x129)],_0x43777a[_0x53bd6e(0x11b)],_0x53bd6e(0x13d));return _0x1efd4[_0x53bd6e(0x12a)][_0x5eeeac[_0x53bd6e(0x133)]]={...buildSqlLockEntry(_0x5eeeac,_0x1a4fbd,computeSqlContentHash(_0xea5b0a),{'dbName':_0x1c2f03}),'path':_0x5f2bf8,'mode':_0x34e31f},_0x1efd4[_0x53bd6e(0x12f)]=new Date()['toISOString'](),await writeSqlLockFile(_0x43777a[_0x53bd6e(0x13f)],_0x539266),{'ok':!![],'data':{'id':_0x5eeeac['id'],'sqlCode':_0x5eeeac[_0x53bd6e(0x133)],'sqlName':_0x5eeeac['sqlName'],'dbId':_0x5eeeac[_0x53bd6e(0x13b)],'path':_0x4d7640,'mode':_0x34e31f},'message':_0x53bd6e(0x120)+_0x5eeeac[_0x53bd6e(0x133)]};}};function a247_0x38bb(_0x1d9c50,_0x2c27fc){_0x1d9c50=_0x1d9c50-0x113;const _0x518c19=a247_0x518c();let _0x38bb89=_0x518c19[_0x1d9c50];return _0x38bb89;}async function resolveSqlNewInputs(_0x3221af){const _0x12ef57=await resolveSqlNameInput(_0x3221af),{dbId:_0x2dd68a,dbName:_0x375b94}=await resolveDbSelection(_0x3221af),_0x2ee0ec=await resolveSqlModeInput(_0x3221af);return{'sqlName':_0x12ef57,'dbId':_0x2dd68a,'dbName':_0x375b94,'mode':_0x2ee0ec};}async function resolveSqlNameInput(_0x36e8f6){const _0x2c5203=a247_0x49cbfa,_0x46a0db=_0x36e8f6[_0x2c5203(0x11d)](_0x2c5203(0x14b))[_0x2c5203(0x145)]();if(_0x46a0db)return _0x46a0db;if(_0x36e8f6[_0x2c5203(0x119)])throw CliErrors[_0x2c5203(0x152)](_0x2c5203(0x14b),_0x2c5203(0x11c));return(await input({'message':_0x2c5203(0x14f),'validate':_0x3f3bbf=>_0x3f3bbf[_0x2c5203(0x145)]()?!![]:_0x2c5203(0x142)}))[_0x2c5203(0x145)]();}async function resolveDbSelection(_0x4ada0f){const _0x1097d2=a247_0x49cbfa,_0x500666=resolveProvidedDbId(_0x4ada0f);if(typeof _0x500666==='number'&&Number['isFinite'](_0x500666)&&_0x500666>0x0)return{'dbId':_0x500666,'dbName':await getDbName(_0x4ada0f[_0x1097d2(0x129)],_0x500666)['catch'](()=>undefined)};if(_0x4ada0f['nonInteractive'])throw CliErrors[_0x1097d2(0x152)]('db-id',_0x1097d2(0x11f));const _0x2702e6=await listDatabases(_0x4ada0f[_0x1097d2(0x129)])[_0x1097d2(0x138)](()=>[]);if(_0x2702e6[_0x1097d2(0x114)]===0x1)return{'dbId':_0x2702e6[0x0][_0x1097d2(0x13b)],'dbName':_0x2702e6[0x0]['dbName']};if(_0x2702e6[_0x1097d2(0x114)]>0x1){const _0x5ef435=await select({'message':_0x1097d2(0x121),'choices':[..._0x2702e6['map'](_0x2dbf96=>({'name':_0x2dbf96[_0x1097d2(0x144)]+'\x20('+_0x2dbf96[_0x1097d2(0x13b)]+')','value':serializeDbSelection(_0x2dbf96)})),{'name':_0x1097d2(0x127),'value':'__manual__'}]});if(_0x5ef435!==_0x1097d2(0x147))return deserializeDbSelection(_0x5ef435);}const _0x43ad2e=await input({'message':_0x1097d2(0x153),'validate':_0x45df7e=>{const _0x43254e=_0x1097d2,_0x28eabb=_0x45df7e['trim']();if(!_0x28eabb)return _0x43254e(0x13e);const _0x232ab6=Number(_0x28eabb);if(!Number[_0x43254e(0x149)](_0x232ab6)||_0x232ab6<=0x0)return _0x43254e(0x123);return!![];}});return{'dbId':Number(_0x43ad2e[_0x1097d2(0x145)]())};}async function resolveSqlModeInput(_0x2ef2be){const _0x1b2fe9=a247_0x49cbfa,_0x247d7c=_0x2ef2be[_0x1b2fe9(0x11d)](_0x1b2fe9(0x141))['trim']();if(_0x247d7c==='sql'||_0x247d7c===_0x1b2fe9(0x151))return _0x247d7c;if(_0x2ef2be[_0x1b2fe9(0x119)])throw CliErrors[_0x1b2fe9(0x152)](_0x1b2fe9(0x141),_0x1b2fe9(0x139));return await select({'message':'Select\x20the\x20local\x20SQL\x20mode:','choices':[{'name':_0x1b2fe9(0x154),'value':_0x1b2fe9(0x155),'description':_0x1b2fe9(0x117)},{'name':_0x1b2fe9(0x148),'value':_0x1b2fe9(0x151),'description':_0x1b2fe9(0x12e)}]});}function serializeDbSelection(_0x4f4850){const _0x3b1137=a247_0x49cbfa;return JSON[_0x3b1137(0x11a)]({'dbId':_0x4f4850['dbId'],'dbName':_0x4f4850[_0x3b1137(0x144)]});}function deserializeDbSelection(_0x364398){const _0x37f7d7=a247_0x49cbfa;try{const _0x46913d=JSON['parse'](_0x364398);if(typeof _0x46913d[_0x37f7d7(0x13b)]===_0x37f7d7(0x115)&&Number[_0x37f7d7(0x14d)](_0x46913d[_0x37f7d7(0x13b)]))return{'dbId':_0x46913d[_0x37f7d7(0x13b)],'dbName':_0x46913d[_0x37f7d7(0x144)]};}catch{}throw CliErrors[_0x37f7d7(0x137)]('Invalid\x20database\x20selection\x20payload:\x20'+_0x364398);}function resolveProvidedDbId(_0x2cc19c){const _0x3f5b38=a247_0x49cbfa,_0x4de5c5=_0x2cc19c['flag'](_0x3f5b38(0x13a));if(typeof _0x4de5c5===_0x3f5b38(0x115)&&Number['isFinite'](_0x4de5c5))return _0x4de5c5;return undefined;}
1
+ function a247_0xb3c8(){const _0x1696a3=['sqlRootDir','toISOString','name','new','join','length','Invalid\x20database\x20selection\x20payload:\x20','number','2169RPInJG','create','/smartapi/custom/saveUserCustomSql','flagMissing','2205SIwcpr','sqlName','stringify','validation','string','SELECT\x201\x20AS\x20id;','dbName','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','write','Select\x20the\x20local\x20SQL\x20mode:','map','trim','parse','7720AaQRrE','78168YxIRKO','185aoKnnl','sql','File\x20already\x20exists:\x20','✎\x20Enter\x20dbId\x20manually','mybatisXml','\x20\x20SELECT\x201\x20AS\x20id','9339pRZmGz','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','appCode','Target\x20database\x20ID','str','Target\x20database\x20dbId:','SQL\x20name:','23784mAUQhY','Select\x20the\x20target\x20database:','sqls','sqlCode','db-id','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','sqlRoot','dbId\x20cannot\x20be\x20empty','44786HhLKPk','description','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','3277512oKDXPm','mode','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','lockFilePath','lastSync','Local\x20SQL\x20file\x20mode','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','56gUklrK','SQL\x20query\x20display\x20name','catch','4780fchtkS','nonInteractive','isFinite','MyBatis\x20XML\x20(mybatisXml)','dbId','dbId\x20must\x20be\x20a\x20positive\x20integer','33169212ZvjmDF','isInteger','Plain\x20SQL\x20(sql)'];a247_0xb3c8=function(){return _0x1696a3;};return a247_0xb3c8();}const a247_0x299107=a247_0x4ab2;(function(_0x431cd6,_0x429dc4){const _0x5b9947=a247_0x4ab2,_0x457901=_0x431cd6();while(!![]){try{const _0x2706a1=-parseInt(_0x5b9947(0x133))/0x1*(-parseInt(_0x5b9947(0x129))/0x2)+parseInt(_0x5b9947(0x147))/0x3*(parseInt(_0x5b9947(0x136))/0x4)+-parseInt(_0x5b9947(0x15a))/0x5*(parseInt(_0x5b9947(0x159))/0x6)+parseInt(_0x5b9947(0x12c))/0x7+-parseInt(_0x5b9947(0x121))/0x8*(-parseInt(_0x5b9947(0x14b))/0x9)+-parseInt(_0x5b9947(0x158))/0xa*(-parseInt(_0x5b9947(0x160))/0xb)+-parseInt(_0x5b9947(0x13c))/0xc;if(_0x2706a1===_0x429dc4)break;else _0x457901['push'](_0x457901['shift']());}catch(_0x154c5a){_0x457901['push'](_0x457901['shift']());}}}(a247_0xb3c8,0xb0bad));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';function a247_0x4ab2(_0x13c755,_0xa90677){_0x13c755=_0x13c755-0x11f;const _0xb3c8ca=a247_0xb3c8();let _0x4ab22d=_0xb3c8ca[_0x13c755];return _0x4ab22d;}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(_0x3f22f4){const _0x5c95bf=a247_0x4ab2;if(_0x3f22f4===_0x5c95bf(0x15e))return[_0x5c95bf(0x132),_0x5c95bf(0x15f),'</select>',''][_0x5c95bf(0x143)]('\x0a');return[_0x5c95bf(0x150),''][_0x5c95bf(0x143)]('\x0a');}export const sqlCreate={'service':a247_0x299107(0x15b),'command':a247_0x299107(0x148),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a247_0x299107(0x153),'flags':[{'name':a247_0x299107(0x141),'type':a247_0x299107(0x14f),'description':a247_0x299107(0x134)},{'name':a247_0x299107(0x125),'type':a247_0x299107(0x146),'description':a247_0x299107(0x163)},{'name':a247_0x299107(0x12d),'type':a247_0x299107(0x14f),'enum':['sql',a247_0x299107(0x15e)],'description':a247_0x299107(0x131)}],async 'validate'(_0x3298cc){const _0x110bad=a247_0x299107;if(!_0x3298cc['nonInteractive'])return;if(!_0x3298cc['str']('name')[_0x110bad(0x156)]())throw CliErrors[_0x110bad(0x14a)]('name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x3fc6f1=resolveProvidedDbId(_0x3298cc);if(typeof _0x3fc6f1!==_0x110bad(0x146)||!Number[_0x110bad(0x138)](_0x3fc6f1)||_0x3fc6f1<=0x0)throw CliErrors[_0x110bad(0x14a)](_0x110bad(0x125),_0x110bad(0x12b));if(!_0x3298cc[_0x110bad(0x164)](_0x110bad(0x12d))[_0x110bad(0x156)]())throw CliErrors[_0x110bad(0x14a)](_0x110bad(0x12d),_0x110bad(0x152));},async 'dryRun'(_0xcd0db0){const _0x223f48=a247_0x299107,_0x2fd42c=loadSqlProjectConfig(_0xcd0db0[_0x223f48(0x162)]),{sqlName:_0x478b81,dbId:_0x37bd90,dbName:_0x246128,mode:_0x50024f}=await resolveSqlNewInputs(_0xcd0db0),_0x47617d=buildSqlRelativePath('<server-generated-sqlCode>',_0x478b81,_0x246128,_0x50024f,_0x37bd90),_0x4394ab=_0x2fd42c[_0x223f48(0x13f)]+'/'+_0x47617d;return{'method':'POST','url':_0x223f48(0x149),'body':{'appCode':_0xcd0db0['appCode'],'sqlName':_0x478b81,'dbId':_0x37bd90,'mode':_0x50024f,'localPath':_0x4394ab},'description':_0x223f48(0x126)+_0x2fd42c[_0x223f48(0x13f)]};},async 'execute'(_0x3ac898){const _0x5d655e=a247_0x299107,_0x5ebf09=loadSqlProjectConfig(_0x3ac898[_0x5d655e(0x162)]),{sqlName:_0x367db8,dbId:_0x3376cb,dbName:_0x1bbc56,mode:_0x582b36}=await resolveSqlNewInputs(_0x3ac898),_0x1724e9=generateSqlTemplate(_0x582b36),_0x288873=await createSqlQuery({'appCode':_0x3ac898[_0x5d655e(0x162)],'sqlName':_0x367db8,'dbId':_0x3376cb,'sqlContent':_0x1724e9}),_0x1f8431=ensureRemoteSqlContent(_0x288873),_0x37318e=_0x1bbc56||await getDbName(_0x3ac898[_0x5d655e(0x162)],_0x3376cb)[_0x5d655e(0x135)](()=>undefined),_0x1e528a=buildSqlRelativePath(_0x288873[_0x5d655e(0x124)],_0x288873['sqlName'],_0x37318e,_0x582b36,_0x3376cb),_0x39730c=_0x5ebf09['sqlRootDir']+'/'+_0x1e528a,_0x52078c=buildLocalSqlFileContent({'sqlCode':_0x288873[_0x5d655e(0x124)],'sqlName':_0x288873[_0x5d655e(0x14c)],'dbId':_0x288873[_0x5d655e(0x13a)]},_0x1f8431,{'dbName':_0x37318e,'mode':_0x582b36,'syncedAt':new Date()[_0x5d655e(0x140)](),'description':_0x288873[_0x5d655e(0x12a)]});if(await fileExists(_0x39730c))throw CliErrors['validation'](_0x5d655e(0x15c)+_0x39730c);await ensureParentDirectory(_0x39730c),await writeFile(_0x39730c,_0x52078c,'utf8');const _0x2584cd=await readSqlLockFile(_0x5ebf09[_0x5d655e(0x12f)]),{lockData:_0x574272,appLock:_0x2e99b8}=ensureSqlLockScope(_0x2584cd??createEmptySqlLock(),_0x5ebf09[_0x5d655e(0x162)],_0x5ebf09[_0x5d655e(0x127)],_0x5d655e(0x142));return _0x2e99b8[_0x5d655e(0x123)][_0x288873['sqlCode']]={...buildSqlLockEntry(_0x288873,_0x1f8431,computeSqlContentHash(_0x52078c),{'dbName':_0x37318e}),'path':_0x1e528a,'mode':_0x582b36},_0x2e99b8[_0x5d655e(0x130)]=new Date()[_0x5d655e(0x140)](),await writeSqlLockFile(_0x5ebf09[_0x5d655e(0x12f)],_0x574272),{'ok':!![],'data':{'id':_0x288873['id'],'sqlCode':_0x288873[_0x5d655e(0x124)],'sqlName':_0x288873[_0x5d655e(0x14c)],'dbId':_0x288873[_0x5d655e(0x13a)],'path':_0x39730c,'mode':_0x582b36},'message':'Created\x20SQL\x20query\x20'+_0x288873[_0x5d655e(0x124)]};}};async function resolveSqlNewInputs(_0x395d85){const _0x5d8946=await resolveSqlNameInput(_0x395d85),{dbId:_0x1f9832,dbName:_0x4f45c6}=await resolveDbSelection(_0x395d85),_0x306549=await resolveSqlModeInput(_0x395d85);return{'sqlName':_0x5d8946,'dbId':_0x1f9832,'dbName':_0x4f45c6,'mode':_0x306549};}async function resolveSqlNameInput(_0x122198){const _0x208fce=a247_0x299107,_0x2340b4=_0x122198[_0x208fce(0x164)]('name')[_0x208fce(0x156)]();if(_0x2340b4)return _0x2340b4;if(_0x122198[_0x208fce(0x137)])throw CliErrors['flagMissing'](_0x208fce(0x141),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x208fce(0x120),'validate':_0xe4198f=>_0xe4198f[_0x208fce(0x156)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))[_0x208fce(0x156)]();}async function resolveDbSelection(_0x370113){const _0x22e417=a247_0x299107,_0x17b49a=resolveProvidedDbId(_0x370113);if(typeof _0x17b49a===_0x22e417(0x146)&&Number['isFinite'](_0x17b49a)&&_0x17b49a>0x0)return{'dbId':_0x17b49a,'dbName':await getDbName(_0x370113[_0x22e417(0x162)],_0x17b49a)[_0x22e417(0x135)](()=>undefined)};if(_0x370113[_0x22e417(0x137)])throw CliErrors[_0x22e417(0x14a)](_0x22e417(0x125),_0x22e417(0x12b));const _0x50fe5d=await listDatabases(_0x370113['appCode'])[_0x22e417(0x135)](()=>[]);if(_0x50fe5d['length']===0x1)return{'dbId':_0x50fe5d[0x0]['dbId'],'dbName':_0x50fe5d[0x0][_0x22e417(0x151)]};if(_0x50fe5d[_0x22e417(0x144)]>0x1){const _0x2a84a3=await select({'message':_0x22e417(0x122),'choices':[..._0x50fe5d[_0x22e417(0x155)](_0x294ddb=>({'name':_0x294ddb[_0x22e417(0x151)]+'\x20('+_0x294ddb['dbId']+')','value':serializeDbSelection(_0x294ddb)})),{'name':_0x22e417(0x15d),'value':'__manual__'}]});if(_0x2a84a3!=='__manual__')return deserializeDbSelection(_0x2a84a3);}const _0x1249d2=await input({'message':_0x22e417(0x11f),'validate':_0x4969c9=>{const _0x4278ed=_0x22e417,_0x12dac8=_0x4969c9[_0x4278ed(0x156)]();if(!_0x12dac8)return _0x4278ed(0x128);const _0x3a280b=Number(_0x12dac8);if(!Number[_0x4278ed(0x13d)](_0x3a280b)||_0x3a280b<=0x0)return _0x4278ed(0x13b);return!![];}});return{'dbId':Number(_0x1249d2[_0x22e417(0x156)]())};}async function resolveSqlModeInput(_0x1f4d1b){const _0x554525=a247_0x299107,_0x2e3d2a=_0x1f4d1b['str'](_0x554525(0x12d))['trim']();if(_0x2e3d2a===_0x554525(0x15b)||_0x2e3d2a==='mybatisXml')return _0x2e3d2a;if(_0x1f4d1b[_0x554525(0x137)])throw CliErrors['flagMissing']('mode',_0x554525(0x152));return await select({'message':_0x554525(0x154),'choices':[{'name':_0x554525(0x13e),'value':_0x554525(0x15b),'description':_0x554525(0x12e)},{'name':_0x554525(0x139),'value':'mybatisXml','description':_0x554525(0x161)}]});}function serializeDbSelection(_0x560e8f){const _0x1d0175=a247_0x299107;return JSON[_0x1d0175(0x14d)]({'dbId':_0x560e8f['dbId'],'dbName':_0x560e8f['dbName']});}function deserializeDbSelection(_0x143d8c){const _0x56bb69=a247_0x299107;try{const _0x3f5549=JSON[_0x56bb69(0x157)](_0x143d8c);if(typeof _0x3f5549[_0x56bb69(0x13a)]==='number'&&Number[_0x56bb69(0x138)](_0x3f5549['dbId']))return{'dbId':_0x3f5549[_0x56bb69(0x13a)],'dbName':_0x3f5549[_0x56bb69(0x151)]};}catch{}throw CliErrors[_0x56bb69(0x14e)](_0x56bb69(0x145)+_0x143d8c);}function resolveProvidedDbId(_0x3fa3c9){const _0x284a13=a247_0x299107,_0x48ce34=_0x3fa3c9['flag'](_0x284a13(0x125));if(typeof _0x48ce34==='number'&&Number[_0x284a13(0x138)](_0x48ce34))return _0x48ce34;return undefined;}
@@ -1 +1 @@
1
- const a248_0x4cdb09=a248_0x244b;(function(_0x2e7d66,_0x2055e1){const _0xf8748b=a248_0x244b,_0x5052be=_0x2e7d66();while(!![]){try{const _0x48cd2b=-parseInt(_0xf8748b(0xd2))/0x1*(parseInt(_0xf8748b(0xca))/0x2)+parseInt(_0xf8748b(0xbe))/0x3*(-parseInt(_0xf8748b(0xc3))/0x4)+parseInt(_0xf8748b(0xde))/0x5*(parseInt(_0xf8748b(0xd7))/0x6)+-parseInt(_0xf8748b(0xe5))/0x7*(parseInt(_0xf8748b(0xe3))/0x8)+-parseInt(_0xf8748b(0xd1))/0x9+-parseInt(_0xf8748b(0xe4))/0xa+parseInt(_0xf8748b(0xc8))/0xb;if(_0x48cd2b===_0x2055e1)break;else _0x5052be['push'](_0x5052be['shift']());}catch(_0x1ea723){_0x5052be['push'](_0x5052be['shift']());}}}(a248_0x145f,0x36f56));function a248_0x244b(_0x2fa155,_0xc7e6be){_0x2fa155=_0x2fa155-0xbe;const _0x145ff5=a248_0x145f();let _0x244bb6=_0x145ff5[_0x2fa155];return _0x244bb6;}import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a248_0x145f(){const _0x1c3574=['904WWchag','3750490LJweeS','16205RiTdei','5637BuRCMO','high-risk-write','entries','remoteId','lastSync','252HDHvgA','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','replace','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','appCode','14228225GjuZiV','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','91752NhyXfv','filter','projectRoot','Would\x20delete\x20SQL\x20','trashDir','str','delete','3628701ZglAOK','1AEHTsg','sqls','SQL\x20lock\x20file\x20not\x20found.','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','startsWith','6DMMAXA','sqlcode','length','validation','sqlRoot','POST','lockFilePath','678605CYNyxF','toISOString','Deleted\x20','fromEntries','/smartapi/custom/deleteUserCustomSql'];a248_0x145f=function(){return _0x1c3574;};return a248_0x145f();}export const sqlDelete={'service':'sql','command':a248_0x4cdb09(0xd0),'description':a248_0x4cdb09(0xc6),'risk':a248_0x4cdb09(0xbf),'flags':[SQLCODE_FLAG],async 'validate'(_0x536aff){const _0x2994c7=a248_0x4cdb09,_0x31ffe2=loadSqlProjectConfig(_0x536aff['appCode']),_0x36804b=await readSqlLockFile(_0x31ffe2[_0x2994c7(0xdd)]);if(!_0x36804b)throw CliErrors['validation'](_0x2994c7(0xc9));},async 'dryRun'(_0x3f8648){const _0x1420e2=a248_0x4cdb09,_0x3e2f81=loadSqlProjectConfig(_0x3f8648['appCode']),_0x5a6d8f=await readSqlLockFile(_0x3e2f81[_0x1420e2(0xdd)]);if(!_0x5a6d8f)throw CliErrors['validation'](_0x1420e2(0xc9));const {appLock:_0x4ae23c}=ensureSqlLockScope(_0x5a6d8f,_0x3f8648[_0x1420e2(0xc7)],_0x3e2f81[_0x1420e2(0xdb)],_0x1420e2(0xd0)),_0xe50acf=_0x3f8648[_0x1420e2(0xcf)](_0x1420e2(0xd8)),_0x309ad6=_0x4ae23c[_0x1420e2(0xd3)][_0xe50acf];if(!_0x309ad6)throw CliErrors[_0x1420e2(0xda)](_0x1420e2(0xc4)+_0xe50acf+'\x22.');return{'method':_0x1420e2(0xdc),'url':_0x1420e2(0xe2),'body':{'sqlCode':_0xe50acf,'id':_0x309ad6[_0x1420e2(0xc1)],'localPath':resolveLocalSqlFilePath(_0x3e2f81,_0xe50acf,_0x309ad6)},'description':_0x1420e2(0xcd)+_0xe50acf+_0x1420e2(0xd5)+_0x3e2f81[_0x1420e2(0xce)]};},async 'execute'(_0x2b5d77){const _0x58bad1=a248_0x4cdb09,_0x2dedee=loadSqlProjectConfig(_0x2b5d77[_0x58bad1(0xc7)]),_0x1103aa=await readSqlLockFile(_0x2dedee[_0x58bad1(0xdd)]);if(!_0x1103aa)throw CliErrors[_0x58bad1(0xda)](_0x58bad1(0xd4));const {lockData:_0x23ea15,appLock:_0x2b2dfe}=ensureSqlLockScope(_0x1103aa,_0x2b5d77[_0x58bad1(0xc7)],_0x2dedee['sqlRoot'],_0x58bad1(0xd0)),_0x19b401=_0x2b5d77['str'](_0x58bad1(0xd8)),_0x2d227e=_0x2b2dfe['sqls'][_0x19b401];if(!_0x2d227e)throw CliErrors['validation'](_0x58bad1(0xc4)+_0x19b401+'\x22.');await deleteSqlQuery({'id':_0x2d227e[_0x58bad1(0xc1)],'sqlCode':_0x19b401}),_0x2b2dfe[_0x58bad1(0xd3)]=Object[_0x58bad1(0xe1)](Object[_0x58bad1(0xc0)](_0x2b2dfe[_0x58bad1(0xd3)])[_0x58bad1(0xcb)](([_0x4c50fe])=>_0x4c50fe!==_0x19b401)),_0x2b2dfe[_0x58bad1(0xc2)]=new Date()[_0x58bad1(0xdf)](),await writeSqlLockFile(_0x2dedee[_0x58bad1(0xdd)],_0x23ea15);const _0x47a827=resolveLocalSqlFilePath(_0x2dedee,_0x19b401,_0x2d227e);let _0x5249ca;await fileExists(_0x47a827)&&(_0x5249ca=await moveToTrash(_0x2dedee[_0x58bad1(0xcc)],_0x2dedee[_0x58bad1(0xce)],_0x47a827),await cleanupEmptyDirectories(dirname(_0x47a827),_0x2dedee['sqlRootDir']));const _0x11754b={'deleted':_0x19b401,'remoteId':_0x2d227e[_0x58bad1(0xc1)]};if(_0x5249ca)_0x11754b['trashedTo']=_0x5249ca;return{'ok':!![],'data':_0x11754b,'message':_0x58bad1(0xe0)+_0x19b401+(_0x5249ca?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x5b844c,_0x4d9ba3,_0x5ea2a6){const _0x50105c=a248_0x4cdb09,_0x3bbad0=new Date()[_0x50105c(0xdf)]()[_0x50105c(0xc5)](/[:.]/g,'-'),_0x17e269=relative(_0x5b844c,_0x5ea2a6),_0x51e2ba=join(_0x4d9ba3,_0x3bbad0,_0x17e269);return await mkdir(dirname(_0x51e2ba),{'recursive':!![]}),await rename(_0x5ea2a6,_0x51e2ba),_0x51e2ba;}async function cleanupEmptyDirectories(_0x536a42,_0x17be2e){const _0x2c71cf=a248_0x4cdb09;let _0x2144c7=resolve(_0x536a42);const _0x373407=resolve(_0x17be2e);while(_0x2144c7[_0x2c71cf(0xd6)](''+_0x373407+sep)||_0x2144c7===_0x373407){if(_0x2144c7===_0x373407)return;try{const _0x1e5421=await readdir(_0x2144c7);if(_0x1e5421[_0x2c71cf(0xd9)]>0x0)return;await rmdir(_0x2144c7);}catch{return;}_0x2144c7=dirname(_0x2144c7);}}
1
+ const a248_0x3df418=a248_0x3fce;(function(_0x523eaf,_0x550495){const _0x4b2d74=a248_0x3fce,_0x3e9769=_0x523eaf();while(!![]){try{const _0x4fa439=-parseInt(_0x4b2d74(0x7a))/0x1*(parseInt(_0x4b2d74(0x81))/0x2)+-parseInt(_0x4b2d74(0x8d))/0x3*(parseInt(_0x4b2d74(0x84))/0x4)+-parseInt(_0x4b2d74(0x86))/0x5+-parseInt(_0x4b2d74(0x99))/0x6*(-parseInt(_0x4b2d74(0x9c))/0x7)+parseInt(_0x4b2d74(0x98))/0x8*(-parseInt(_0x4b2d74(0x83))/0x9)+parseInt(_0x4b2d74(0x92))/0xa+parseInt(_0x4b2d74(0x8a))/0xb;if(_0x4fa439===_0x550495)break;else _0x3e9769['push'](_0x3e9769['shift']());}catch(_0x45bb27){_0x3e9769['push'](_0x3e9769['shift']());}}}(a248_0x49fd,0x7bc30));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a248_0x3fce(_0x24c694,_0xd3e26b){_0x24c694=_0x24c694-0x78;const _0x49fdea=a248_0x49fd();let _0x3fcef9=_0x49fdea[_0x24c694];return _0x3fcef9;}export const sqlDelete={'service':'sql','command':a248_0x3df418(0x8b),'description':a248_0x3df418(0x91),'risk':a248_0x3df418(0x79),'flags':[SQLCODE_FLAG],async 'validate'(_0x1c9cdc){const _0x1ad229=a248_0x3df418,_0x2fc260=loadSqlProjectConfig(_0x1c9cdc['appCode']),_0x20de76=await readSqlLockFile(_0x2fc260['lockFilePath']);if(!_0x20de76)throw CliErrors[_0x1ad229(0x7d)](_0x1ad229(0x8f));},async 'dryRun'(_0x4a477b){const _0xa3e3e6=a248_0x3df418,_0xac896f=loadSqlProjectConfig(_0x4a477b[_0xa3e3e6(0x9d)]),_0x3410d4=await readSqlLockFile(_0xac896f[_0xa3e3e6(0x93)]);if(!_0x3410d4)throw CliErrors[_0xa3e3e6(0x7d)](_0xa3e3e6(0x8f));const {appLock:_0x4a1ae5}=ensureSqlLockScope(_0x3410d4,_0x4a477b[_0xa3e3e6(0x9d)],_0xac896f[_0xa3e3e6(0x87)],_0xa3e3e6(0x8b)),_0x1b24fb=_0x4a477b[_0xa3e3e6(0x85)](_0xa3e3e6(0x97)),_0x2c560b=_0x4a1ae5[_0xa3e3e6(0x7e)][_0x1b24fb];if(!_0x2c560b)throw CliErrors[_0xa3e3e6(0x7d)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x1b24fb+'\x22.');return{'method':_0xa3e3e6(0x94),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x1b24fb,'id':_0x2c560b[_0xa3e3e6(0x7c)],'localPath':resolveLocalSqlFilePath(_0xac896f,_0x1b24fb,_0x2c560b)},'description':_0xa3e3e6(0x8e)+_0x1b24fb+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0xac896f[_0xa3e3e6(0x95)]};},async 'execute'(_0x567f73){const _0x34cd94=a248_0x3df418,_0x22fe7c=loadSqlProjectConfig(_0x567f73['appCode']),_0xc9c94c=await readSqlLockFile(_0x22fe7c[_0x34cd94(0x93)]);if(!_0xc9c94c)throw CliErrors[_0x34cd94(0x7d)](_0x34cd94(0x8c));const {lockData:_0x544793,appLock:_0x123ca9}=ensureSqlLockScope(_0xc9c94c,_0x567f73[_0x34cd94(0x9d)],_0x22fe7c['sqlRoot'],'delete'),_0x3cc191=_0x567f73['str'](_0x34cd94(0x97)),_0xfc5a23=_0x123ca9['sqls'][_0x3cc191];if(!_0xfc5a23)throw CliErrors[_0x34cd94(0x7d)](_0x34cd94(0x96)+_0x3cc191+'\x22.');await deleteSqlQuery({'id':_0xfc5a23['remoteId'],'sqlCode':_0x3cc191}),_0x123ca9[_0x34cd94(0x7e)]=Object[_0x34cd94(0x7f)](Object['entries'](_0x123ca9['sqls'])[_0x34cd94(0x80)](([_0x1effc4])=>_0x1effc4!==_0x3cc191)),_0x123ca9[_0x34cd94(0x7b)]=new Date()['toISOString'](),await writeSqlLockFile(_0x22fe7c[_0x34cd94(0x93)],_0x544793);const _0x138b99=resolveLocalSqlFilePath(_0x22fe7c,_0x3cc191,_0xfc5a23);let _0x5416c3;await fileExists(_0x138b99)&&(_0x5416c3=await moveToTrash(_0x22fe7c[_0x34cd94(0x9b)],_0x22fe7c[_0x34cd94(0x95)],_0x138b99),await cleanupEmptyDirectories(dirname(_0x138b99),_0x22fe7c['sqlRootDir']));const _0x2391e1={'deleted':_0x3cc191,'remoteId':_0xfc5a23[_0x34cd94(0x7c)]};if(_0x5416c3)_0x2391e1[_0x34cd94(0x82)]=_0x5416c3;return{'ok':!![],'data':_0x2391e1,'message':_0x34cd94(0x90)+_0x3cc191+(_0x5416c3?_0x34cd94(0x78):'')};}};async function moveToTrash(_0x231faa,_0x578969,_0x237cfb){const _0x39ebe3=a248_0x3df418,_0x1bb164=new Date()[_0x39ebe3(0x9a)]()['replace'](/[:.]/g,'-'),_0x45c492=relative(_0x231faa,_0x237cfb),_0x591359=join(_0x578969,_0x1bb164,_0x45c492);return await mkdir(dirname(_0x591359),{'recursive':!![]}),await rename(_0x237cfb,_0x591359),_0x591359;}function a248_0x49fd(){const _0x1c447e=['lastSync','remoteId','validation','sqls','fromEntries','filter','1910752DOvVjC','trashedTo','9cpaEIO','4QDrCdw','str','3101915nGImLf','sqlRoot','startsWith','length','22605506dzoczx','delete','SQL\x20lock\x20file\x20not\x20found.','88401cZNOpA','Would\x20delete\x20SQL\x20','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','Deleted\x20','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','5363810XxlKLS','lockFilePath','POST','trashDir','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','sqlcode','4379448eVvSrv','636yoyYKF','toISOString','projectRoot','4501yJNVqS','appCode','\x20(local\x20file\x20moved\x20to\x20trash)','high-risk-write','1fyzWsA'];a248_0x49fd=function(){return _0x1c447e;};return a248_0x49fd();}async function cleanupEmptyDirectories(_0x16312e,_0x1078c5){const _0x17ee28=a248_0x3df418;let _0x479165=resolve(_0x16312e);const _0x3b2c19=resolve(_0x1078c5);while(_0x479165[_0x17ee28(0x88)](''+_0x3b2c19+sep)||_0x479165===_0x3b2c19){if(_0x479165===_0x3b2c19)return;try{const _0x2371fb=await readdir(_0x479165);if(_0x2371fb[_0x17ee28(0x89)]>0x0)return;await rmdir(_0x479165);}catch{return;}_0x479165=dirname(_0x479165);}}
@@ -1 +1 @@
1
- const a249_0xf39ec7=a249_0x297c;(function(_0x39f3ad,_0x335ecf){const _0x405c8=a249_0x297c,_0x187099=_0x39f3ad();while(!![]){try{const _0x2e262f=parseInt(_0x405c8(0x1a6))/0x1*(parseInt(_0x405c8(0x1b9))/0x2)+parseInt(_0x405c8(0x1b5))/0x3*(parseInt(_0x405c8(0x1a5))/0x4)+-parseInt(_0x405c8(0x1b3))/0x5+parseInt(_0x405c8(0x1a2))/0x6*(parseInt(_0x405c8(0x1b8))/0x7)+-parseInt(_0x405c8(0x1ac))/0x8*(parseInt(_0x405c8(0x1a4))/0x9)+parseInt(_0x405c8(0x1b1))/0xa*(parseInt(_0x405c8(0x1ad))/0xb)+parseInt(_0x405c8(0x1ae))/0xc*(-parseInt(_0x405c8(0x1a8))/0xd);if(_0x2e262f===_0x335ecf)break;else _0x187099['push'](_0x187099['shift']());}catch(_0x1cf79a){_0x187099['push'](_0x187099['shift']());}}}(a249_0x3107,0xe8daa));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a249_0x297c(_0x53afe6,_0x309aee){_0x53afe6=_0x53afe6-0x1a1;const _0x31073a=a249_0x3107();let _0x297c69=_0x31073a[_0x53afe6];return _0x297c69;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a249_0xf39ec7(0x1b4),'command':a249_0xf39ec7(0x1b2),'description':a249_0xf39ec7(0x1b6),'risk':a249_0xf39ec7(0x1b7),'flags':[SQLCODE_FLAG,{'name':a249_0xf39ec7(0x1a9),'type':a249_0xf39ec7(0x1ba),'description':a249_0xf39ec7(0x1a3)}],async 'execute'(_0x4ebf8f){const _0x553d53=a249_0xf39ec7,_0x5bea84=await getSqlQueryInfo(_0x4ebf8f['appCode'],_0x4ebf8f['str'](_0x553d53(0x1b0))),_0x14b151=_0x4ebf8f['bool'](_0x553d53(0x1a9));if(_0x14b151)return{'ok':!![],'data':_0x5bea84};const _0x5bd6db=_0x5bea84[_0x553d53(0x1aa)]?await getDbName(_0x4ebf8f['appCode'],_0x5bea84[_0x553d53(0x1aa)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x5bea84[_0x553d53(0x1ab)],'sqlName':_0x5bea84[_0x553d53(0x1af)],'db':_0x5bd6db?_0x5bd6db+'\x20('+_0x5bea84['dbId']+')':_0x5bea84[_0x553d53(0x1aa)]??'','description':_0x5bea84[_0x553d53(0x1a7)]??'','sqlContent':_0x5bea84[_0x553d53(0x1a1)]??''}};}};function a249_0x3107(){const _0x590d76=['detail','6817960IdmALo','sql','1402890TcaZQS','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','read','1831683MsMxGU','2hvwaGi','boolean','sqlContent','42zHEeiF','Return\x20full\x20raw\x20SQL\x20query\x20object','954xNoLFt','8bBeLdt','309503iQAlvL','description','26zwFgLp','verbose','dbId','sqlCode','54968XnFdCZ','3241634EkerRl','1952712xLIZnF','sqlName','sqlcode','10YEdwTf'];a249_0x3107=function(){return _0x590d76;};return a249_0x3107();}
1
+ const a249_0x2358b1=a249_0x6be0;(function(_0x51785c,_0x113762){const _0x35f285=a249_0x6be0,_0x5ec8c0=_0x51785c();while(!![]){try{const _0x1cff1e=-parseInt(_0x35f285(0x1a7))/0x1*(-parseInt(_0x35f285(0x1b2))/0x2)+-parseInt(_0x35f285(0x1b7))/0x3+parseInt(_0x35f285(0x1a4))/0x4+parseInt(_0x35f285(0x1bb))/0x5*(parseInt(_0x35f285(0x1b5))/0x6)+-parseInt(_0x35f285(0x1aa))/0x7+parseInt(_0x35f285(0x1b9))/0x8+-parseInt(_0x35f285(0x1b0))/0x9;if(_0x1cff1e===_0x113762)break;else _0x5ec8c0['push'](_0x5ec8c0['shift']());}catch(_0x49a412){_0x5ec8c0['push'](_0x5ec8c0['shift']());}}}(a249_0x290e,0x831e2));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a249_0x290e(){const _0xa1d56c=['3712856qvxcEP','appCode','bool','sqlContent','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','verbose','7623108teWkPM','str','62XcbLFs','Return\x20full\x20raw\x20SQL\x20query\x20object','sql','250266WEmAmt','read','1614150CaXCmR','detail','7191672dPmaew','description','85YNtTsy','3291748QyJufS','boolean','sqlName','695xrwcpz','dbId','sqlcode'];a249_0x290e=function(){return _0xa1d56c;};return a249_0x290e();}function a249_0x6be0(_0x370a57,_0x15da48){_0x370a57=_0x370a57-0x1a4;const _0x290ee0=a249_0x290e();let _0x6be0ea=_0x290ee0[_0x370a57];return _0x6be0ea;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a249_0x2358b1(0x1b4),'command':a249_0x2358b1(0x1b8),'description':a249_0x2358b1(0x1ae),'risk':a249_0x2358b1(0x1b6),'flags':[SQLCODE_FLAG,{'name':a249_0x2358b1(0x1af),'type':a249_0x2358b1(0x1a5),'description':a249_0x2358b1(0x1b3)}],async 'execute'(_0x1c410e){const _0x11934f=a249_0x2358b1,_0x283b2c=await getSqlQueryInfo(_0x1c410e[_0x11934f(0x1ab)],_0x1c410e[_0x11934f(0x1b1)](_0x11934f(0x1a9))),_0x79ede5=_0x1c410e[_0x11934f(0x1ac)]('verbose');if(_0x79ede5)return{'ok':!![],'data':_0x283b2c};const _0xa0b80d=_0x283b2c[_0x11934f(0x1a8)]?await getDbName(_0x1c410e[_0x11934f(0x1ab)],_0x283b2c[_0x11934f(0x1a8)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x283b2c['sqlCode'],'sqlName':_0x283b2c[_0x11934f(0x1a6)],'db':_0xa0b80d?_0xa0b80d+'\x20('+_0x283b2c[_0x11934f(0x1a8)]+')':_0x283b2c[_0x11934f(0x1a8)]??'','description':_0x283b2c[_0x11934f(0x1ba)]??'','sqlContent':_0x283b2c[_0x11934f(0x1ad)]??''}};}};
@@ -1 +1 @@
1
- const a250_0x5c118a=a250_0x1680;(function(_0x3a138d,_0x3f8fb7){const _0x16f2f3=a250_0x1680,_0x9f673f=_0x3a138d();while(!![]){try{const _0x357910=parseInt(_0x16f2f3(0x121))/0x1+-parseInt(_0x16f2f3(0x119))/0x2*(parseInt(_0x16f2f3(0x10e))/0x3)+parseInt(_0x16f2f3(0x11a))/0x4*(-parseInt(_0x16f2f3(0x11f))/0x5)+parseInt(_0x16f2f3(0x10d))/0x6+-parseInt(_0x16f2f3(0x10b))/0x7+parseInt(_0x16f2f3(0x120))/0x8*(-parseInt(_0x16f2f3(0x114))/0x9)+parseInt(_0x16f2f3(0x11e))/0xa*(parseInt(_0x16f2f3(0x116))/0xb);if(_0x357910===_0x3f8fb7)break;else _0x9f673f['push'](_0x9f673f['shift']());}catch(_0x52598a){_0x9f673f['push'](_0x9f673f['shift']());}}}(a250_0x26ca,0x6c073));function a250_0x26ca(){const _0x1e69da=['207iZaAZe','string','154VruSUh','execSuccess','execResult','6VrvtKE','758644DIFCOb','SQL\x20execution\x20failed','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','sql','1256610saMcYW','15PcLqmr','183256UjYgAc','629486nJNzrU','length','Returned\x20','execError','5337584DDycTk','params','3098082KkYBzq','604248mLuqQG','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','str','isArray','now','appCode'];a250_0x26ca=function(){return _0x1e69da;};return a250_0x26ca();}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a250_0x1680(_0x5d1ce0,_0x5b6e3d){_0x5d1ce0=_0x5d1ce0-0x10a;const _0x26ca4a=a250_0x26ca();let _0x16809d=_0x26ca4a[_0x5d1ce0];return _0x16809d;}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a250_0x5c118a(0x11d),'command':'exec','description':a250_0x5c118a(0x11c),'risk':'read','flags':[SQLCODE_FLAG,{'name':a250_0x5c118a(0x10c),'type':a250_0x5c118a(0x115),'description':a250_0x5c118a(0x10f)}],async 'execute'(_0x12c850){const _0x4d9971=a250_0x5c118a,_0xa5f3f=parseJsonParams(_0x12c850[_0x4d9971(0x110)](_0x4d9971(0x10c))),_0x4c9641=Date[_0x4d9971(0x112)](),_0x44c90d=await executeSql(_0x12c850[_0x4d9971(0x113)],_0x12c850[_0x4d9971(0x110)]('sqlcode'),_0xa5f3f),_0x146bc9=Date[_0x4d9971(0x112)]()-_0x4c9641,_0x40947c=_0x44c90d?.[_0x4d9971(0x118)]??_0x44c90d,_0x9e1b43=_0x44c90d?.[_0x4d9971(0x117)]??!![];if(!_0x9e1b43)return{'ok':![],'data':{'error':_0x44c90d?.[_0x4d9971(0x10a)]||_0x4d9971(0x11b),'elapsed':_0x146bc9},'message':'SQL\x20execution\x20failed'};const _0x44fa43=Array[_0x4d9971(0x111)](_0x40947c)?_0x40947c:[];return{'ok':!![],'data':{'rows':_0x44fa43,'rowCount':_0x44fa43['length'],'elapsed':_0x146bc9},'message':_0x4d9971(0x123)+_0x44fa43[_0x4d9971(0x122)]+'\x20row(s)\x20in\x20'+_0x146bc9+'ms'};}};
1
+ const a250_0x491de2=a250_0x24b5;(function(_0x219687,_0xca23c3){const _0x498692=a250_0x24b5,_0x3a4fc3=_0x219687();while(!![]){try{const _0x4080dd=-parseInt(_0x498692(0x17c))/0x1+parseInt(_0x498692(0x176))/0x2*(parseInt(_0x498692(0x17a))/0x3)+-parseInt(_0x498692(0x16c))/0x4+-parseInt(_0x498692(0x16b))/0x5*(-parseInt(_0x498692(0x183))/0x6)+parseInt(_0x498692(0x179))/0x7+-parseInt(_0x498692(0x174))/0x8*(-parseInt(_0x498692(0x172))/0x9)+parseInt(_0x498692(0x17d))/0xa*(parseInt(_0x498692(0x175))/0xb);if(_0x4080dd===_0xca23c3)break;else _0x3a4fc3['push'](_0x3a4fc3['shift']());}catch(_0x261e9a){_0x3a4fc3['push'](_0x3a4fc3['shift']());}}}(a250_0xb7c3,0xa1b66));function a250_0x24b5(_0x16deb1,_0x5b4175){_0x16deb1=_0x16deb1-0x16b;const _0xb7c388=a250_0xb7c3();let _0x24b53e=_0xb7c388[_0x16deb1];return _0x24b53e;}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a250_0xb7c3(){const _0x3ea492=['execResult','958746syXXQW','isArray','5oLSigy','3229884jJYBEw','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','Returned\x20','read','params','exec','505854kSVhHi','execSuccess','32HbIJTl','77BwvzlJ','2yfOBGG','SQL\x20execution\x20failed','\x20row(s)\x20in\x20','272251CIjrCc','1002477haxavO','string','602849csqYAa','1878610sDgNsx','now','str','execError','sqlcode'];a250_0xb7c3=function(){return _0x3ea492;};return a250_0xb7c3();}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':'sql','command':a250_0x491de2(0x171),'description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a250_0x491de2(0x16f),'flags':[SQLCODE_FLAG,{'name':a250_0x491de2(0x170),'type':a250_0x491de2(0x17b),'description':a250_0x491de2(0x16d)}],async 'execute'(_0x15bd1d){const _0x33e01f=a250_0x491de2,_0xf429c2=parseJsonParams(_0x15bd1d[_0x33e01f(0x17f)]('params')),_0x15eedb=Date[_0x33e01f(0x17e)](),_0x37d199=await executeSql(_0x15bd1d['appCode'],_0x15bd1d[_0x33e01f(0x17f)](_0x33e01f(0x181)),_0xf429c2),_0x4ca653=Date[_0x33e01f(0x17e)]()-_0x15eedb,_0x116e77=_0x37d199?.[_0x33e01f(0x182)]??_0x37d199,_0x268da5=_0x37d199?.[_0x33e01f(0x173)]??!![];if(!_0x268da5)return{'ok':![],'data':{'error':_0x37d199?.[_0x33e01f(0x180)]||_0x33e01f(0x177),'elapsed':_0x4ca653},'message':'SQL\x20execution\x20failed'};const _0xe8efcf=Array[_0x33e01f(0x184)](_0x116e77)?_0x116e77:[];return{'ok':!![],'data':{'rows':_0xe8efcf,'rowCount':_0xe8efcf['length'],'elapsed':_0x4ca653},'message':_0x33e01f(0x16e)+_0xe8efcf['length']+_0x33e01f(0x178)+_0x4ca653+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x21b148,_0x116aeb){const _0xe255e6=a251_0x4cea,_0x5747e4=_0x21b148();while(!![]){try{const _0x30ebf5=-parseInt(_0xe255e6(0xc7))/0x1+parseInt(_0xe255e6(0xc4))/0x2+-parseInt(_0xe255e6(0xc2))/0x3*(-parseInt(_0xe255e6(0xc9))/0x4)+-parseInt(_0xe255e6(0xc3))/0x5+parseInt(_0xe255e6(0xc6))/0x6+parseInt(_0xe255e6(0xc5))/0x7+-parseInt(_0xe255e6(0xc8))/0x8;if(_0x30ebf5===_0x116aeb)break;else _0x5747e4['push'](_0x5747e4['shift']());}catch(_0x2b1024){_0x5747e4['push'](_0x5747e4['shift']());}}}(a251_0x1495,0x34b84));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';function a251_0x4cea(_0x328adc,_0x1f48f8){_0x328adc=_0x328adc-0xc2;const _0x149529=a251_0x1495();let _0x4cea8e=_0x149529[_0x328adc];return _0x4cea8e;}function a251_0x1495(){const _0x51a9f7=['1168360DNSLVL','806398NHeqTM','2436798RvhQFd','1821342vxsJra','414792RhOLzK','2576672rOOlUv','526472XJAsDw','3OWhnEj'];a251_0x1495=function(){return _0x51a9f7;};return a251_0x1495();}import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x37110f,_0x321789){const _0x588fdf=a251_0x2b96,_0x5c78c2=_0x37110f();while(!![]){try{const _0x7f5898=parseInt(_0x588fdf(0xdc))/0x1+parseInt(_0x588fdf(0xdd))/0x2+parseInt(_0x588fdf(0xd9))/0x3*(parseInt(_0x588fdf(0xd8))/0x4)+-parseInt(_0x588fdf(0xd7))/0x5+-parseInt(_0x588fdf(0xda))/0x6+-parseInt(_0x588fdf(0xde))/0x7+parseInt(_0x588fdf(0xdb))/0x8;if(_0x7f5898===_0x321789)break;else _0x5c78c2['push'](_0x5c78c2['shift']());}catch(_0x3d4840){_0x5c78c2['push'](_0x5c78c2['shift']());}}}(a251_0xcd6a,0x43f2d));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';function a251_0xcd6a(){const _0x598ef6=['889539CtWtpu','602115vTDpUU','8uNqnYb','58965twMZTL','1081650Wpewcp','2052648cOUqFq','334818DcrlUg','150766JuvSjy'];a251_0xcd6a=function(){return _0x598ef6;};return a251_0xcd6a();}function a251_0x2b96(_0x3fc200,_0x23ff95){_0x3fc200=_0x3fc200-0xd7;const _0xcd6a7e=a251_0xcd6a();let _0x2b96e4=_0xcd6a7e[_0x3fc200];return _0x2b96e4;}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 a252_0x6f6e9b=a252_0x57d5;(function(_0x56b91e,_0x1d2517){const _0x1e9da3=a252_0x57d5,_0x5c9904=_0x56b91e();while(!![]){try{const _0x1a672a=-parseInt(_0x1e9da3(0x19d))/0x1*(parseInt(_0x1e9da3(0x19b))/0x2)+parseInt(_0x1e9da3(0x187))/0x3*(-parseInt(_0x1e9da3(0x181))/0x4)+-parseInt(_0x1e9da3(0x190))/0x5+parseInt(_0x1e9da3(0x194))/0x6+-parseInt(_0x1e9da3(0x19a))/0x7+parseInt(_0x1e9da3(0x196))/0x8*(-parseInt(_0x1e9da3(0x182))/0x9)+parseInt(_0x1e9da3(0x184))/0xa;if(_0x1a672a===_0x1d2517)break;else _0x5c9904['push'](_0x5c9904['shift']());}catch(_0x580ff4){_0x5c9904['push'](_0x5c9904['shift']());}}}(a252_0x1199,0x56bf5));import{listSqlQueries}from'../../core/api-client.js';function a252_0x57d5(_0x5033d5,_0x1e4265){_0x5033d5=_0x5033d5-0x17e;const _0x119910=a252_0x1199();let _0x57d52f=_0x119910[_0x5033d5];return _0x57d52f;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a252_0x6f6e9b(0x17e),'command':a252_0x6f6e9b(0x188),'description':a252_0x6f6e9b(0x183),'risk':a252_0x6f6e9b(0x192),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0x6f6e9b(0x18f),'type':a252_0x6f6e9b(0x18b),'description':a252_0x6f6e9b(0x18c)},{'name':a252_0x6f6e9b(0x1a0),'type':a252_0x6f6e9b(0x191),'description':a252_0x6f6e9b(0x19f),'default':0x1},{'name':a252_0x6f6e9b(0x186),'type':a252_0x6f6e9b(0x191),'description':a252_0x6f6e9b(0x17f)},{'name':a252_0x6f6e9b(0x180),'type':'boolean','description':a252_0x6f6e9b(0x195)}],async 'execute'(_0x64899f){const _0x45bb92=a252_0x6f6e9b,_0xe905d1=await listSqlQueries(_0x64899f[_0x45bb92(0x197)],{'sqlCode':_0x64899f[_0x45bb92(0x18d)]('sqlcode')||undefined,'sqlName':_0x64899f[_0x45bb92(0x18d)](_0x45bb92(0x18f))||undefined,'currentPage':_0x64899f[_0x45bb92(0x193)](_0x45bb92(0x1a0)),'pageSize':_0x64899f['num'](_0x45bb92(0x186),0x32)}),_0x416be4=_0x64899f['bool'](_0x45bb92(0x180)),_0x37dd33=_0xe905d1['tableData']??[],_0x2eda27=_0xe905d1[_0x45bb92(0x198)]?.[_0x45bb92(0x189)]??_0x37dd33[_0x45bb92(0x18a)];let _0x148344;return _0x416be4?_0x148344=_0x37dd33:_0x148344=await Promise[_0x45bb92(0x199)](_0x37dd33[_0x45bb92(0x185)](async _0x3499a8=>{const _0x3993b2=_0x45bb92;let _0x1e40c7;try{_0x1e40c7=_0x3499a8[_0x3993b2(0x19c)]?await getDbName(_0x64899f[_0x3993b2(0x197)],_0x3499a8[_0x3993b2(0x19c)]):undefined;}catch{}return{'sqlCode':_0x3499a8['sqlCode'],'sqlName':_0x3499a8[_0x3993b2(0x18e)],'description':_0x3499a8[_0x3993b2(0x19e)]??'','db':_0x1e40c7?_0x1e40c7+'\x20('+_0x3499a8['dbId']+')':_0x3499a8[_0x3993b2(0x19c)]??''};})),{'ok':!![],'data':_0x148344,'message':_0x37dd33[_0x45bb92(0x18a)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':'Found\x20'+_0x37dd33[_0x45bb92(0x18a)]+'\x20SQL\x20queries\x20(total:\x20'+_0x2eda27+').'};}};function a252_0x1199(){const _0x8162ad=['name','2013200bXbdWV','number','read','num','2048790tkWSZA','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','606304vXgGao','appCode','paging','all','2561776QgYAQC','12eCkfpB','dbId','58907dLOzaN','description','Page\x20number','page','sql','Page\x20size','verbose','204zvsUCL','45xnAGgm','List\x20custom\x20SQL\x20queries','19632340piEeVc','map','pagesize','26376eXsLzJ','list','totalCount','length','string','Filter\x20by\x20SQL\x20name','str','sqlName'];a252_0x1199=function(){return _0x8162ad;};return a252_0x1199();}
1
+ function a252_0x268d(_0x17a24,_0x91486f){_0x17a24=_0x17a24-0x1c4;const _0xc924f7=a252_0xc924();let _0x268dc1=_0xc924f7[_0x17a24];return _0x268dc1;}const a252_0xf44a16=a252_0x268d;function a252_0xc924(){const _0x43e0f1=['verbose','all','num','List\x20custom\x20SQL\x20queries','66849CAbfVD','487990dRGVcJ','str','map','sql','\x20SQL\x20queries\x20(total:\x20','read','bool','appCode','dbId','string','1702028eLYZqG','Page\x20number','tableData','203jtmWqX','9kGUULa','sqlCode','totalCount','length','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','7880895lesmmw','196408XYEEUc','No\x20custom\x20SQL\x20queries\x20found.','Page\x20size','number','sqlName','boolean','paging','page','sqlcode','6ppMLRp','Found\x20','2684545pxlkMc','pagesize','1CtYiyR','description','name','4xwjKfQ','26760540YIXDSG'];a252_0xc924=function(){return _0x43e0f1;};return a252_0xc924();}(function(_0x272e47,_0x2e0413){const _0x5f4ec2=a252_0x268d,_0x2e4eda=_0x272e47();while(!![]){try{const _0x2482da=-parseInt(_0x5f4ec2(0x1cb))/0x1*(-parseInt(_0x5f4ec2(0x1df))/0x2)+-parseInt(_0x5f4ec2(0x1d4))/0x3*(parseInt(_0x5f4ec2(0x1ce))/0x4)+-parseInt(_0x5f4ec2(0x1c9))/0x5*(-parseInt(_0x5f4ec2(0x1c7))/0x6)+parseInt(_0x5f4ec2(0x1e2))/0x7*(parseInt(_0x5f4ec2(0x1e9))/0x8)+parseInt(_0x5f4ec2(0x1e3))/0x9*(-parseInt(_0x5f4ec2(0x1d5))/0xa)+parseInt(_0x5f4ec2(0x1e8))/0xb+-parseInt(_0x5f4ec2(0x1cf))/0xc;if(_0x2482da===_0x2e0413)break;else _0x2e4eda['push'](_0x2e4eda['shift']());}catch(_0x39990a){_0x2e4eda['push'](_0x2e4eda['shift']());}}}(a252_0xc924,0x7dc94));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a252_0xf44a16(0x1d8),'command':'list','description':a252_0xf44a16(0x1d3),'risk':a252_0xf44a16(0x1da),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a252_0xf44a16(0x1cd),'type':a252_0xf44a16(0x1de),'description':'Filter\x20by\x20SQL\x20name'},{'name':a252_0xf44a16(0x1c5),'type':a252_0xf44a16(0x1ec),'description':a252_0xf44a16(0x1e0),'default':0x1},{'name':a252_0xf44a16(0x1ca),'type':a252_0xf44a16(0x1ec),'description':a252_0xf44a16(0x1eb)},{'name':'verbose','type':a252_0xf44a16(0x1ee),'description':a252_0xf44a16(0x1e7)}],async 'execute'(_0x15f414){const _0xb51bc=a252_0xf44a16,_0x58f266=await listSqlQueries(_0x15f414[_0xb51bc(0x1dc)],{'sqlCode':_0x15f414[_0xb51bc(0x1d6)](_0xb51bc(0x1c6))||undefined,'sqlName':_0x15f414[_0xb51bc(0x1d6)](_0xb51bc(0x1cd))||undefined,'currentPage':_0x15f414[_0xb51bc(0x1d2)](_0xb51bc(0x1c5)),'pageSize':_0x15f414['num'](_0xb51bc(0x1ca),0x32)}),_0x5cbe85=_0x15f414[_0xb51bc(0x1db)](_0xb51bc(0x1d0)),_0x3c727e=_0x58f266[_0xb51bc(0x1e1)]??[],_0x12f141=_0x58f266[_0xb51bc(0x1c4)]?.[_0xb51bc(0x1e5)]??_0x3c727e[_0xb51bc(0x1e6)];let _0x2b3b6c;return _0x5cbe85?_0x2b3b6c=_0x3c727e:_0x2b3b6c=await Promise[_0xb51bc(0x1d1)](_0x3c727e[_0xb51bc(0x1d7)](async _0x4150ba=>{const _0x560a79=_0xb51bc;let _0x3fffbf;try{_0x3fffbf=_0x4150ba['dbId']?await getDbName(_0x15f414[_0x560a79(0x1dc)],_0x4150ba[_0x560a79(0x1dd)]):undefined;}catch{}return{'sqlCode':_0x4150ba[_0x560a79(0x1e4)],'sqlName':_0x4150ba[_0x560a79(0x1ed)],'description':_0x4150ba[_0x560a79(0x1cc)]??'','db':_0x3fffbf?_0x3fffbf+'\x20('+_0x4150ba[_0x560a79(0x1dd)]+')':_0x4150ba[_0x560a79(0x1dd)]??''};})),{'ok':!![],'data':_0x2b3b6c,'message':_0x3c727e['length']===0x0?_0xb51bc(0x1ea):_0xb51bc(0x1c8)+_0x3c727e[_0xb51bc(0x1e6)]+_0xb51bc(0x1d9)+_0x12f141+').'};}};
@@ -1 +1 @@
1
- function a253_0x11db(_0x47a6ed,_0x34a802){_0x47a6ed=_0x47a6ed-0x1f4;const _0x496811=a253_0x4968();let _0x11db4a=_0x496811[_0x47a6ed];return _0x11db4a;}const a253_0x183e2c=a253_0x11db;(function(_0x2364ef,_0x4fc83e){const _0x56b57b=a253_0x11db,_0x1f54ec=_0x2364ef();while(!![]){try{const _0x245956=parseInt(_0x56b57b(0x22c))/0x1+-parseInt(_0x56b57b(0x213))/0x2+-parseInt(_0x56b57b(0x230))/0x3*(parseInt(_0x56b57b(0x1fc))/0x4)+parseInt(_0x56b57b(0x20d))/0x5*(parseInt(_0x56b57b(0x200))/0x6)+-parseInt(_0x56b57b(0x203))/0x7*(-parseInt(_0x56b57b(0x214))/0x8)+-parseInt(_0x56b57b(0x21d))/0x9+parseInt(_0x56b57b(0x22b))/0xa;if(_0x245956===_0x4fc83e)break;else _0x1f54ec['push'](_0x1f54ec['shift']());}catch(_0x33eb9b){_0x1f54ec['push'](_0x1f54ec['shift']());}}}(a253_0x4968,0xbac45));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';function a253_0x4968(){const _0x7661ee=['tableData','lockFilePath','nonInteractive','13041iPIdZB','description','Filter\x20by\x20SQL\x20display\x20name','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sql','catch','some','appCode','split','\x20SQL\x20file(s)\x20into\x20','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','dbId','toLowerCase','.xml','mybatisXml','read','mode','equivalent','1340sCgCLP','sqlRootDir','apps','string','1529166zRiNjq','test','toISOString','32501bzFsZi','sqls','POST','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','Pull\x20complete:\x20','Would\x20pull\x20','sqlcode','path','push','unchanged','5bmbpwk','join','name','paging','No\x20remote\x20SQL\x20queries\x20matched.','file','1326406uLOymI','1480gkCnBn','bool','sqlName','sqlRoot','Force\x20pull\x20cancelled.','\x20skipped,\x20','conflict','isCanonical','boolean','533457rAcOHM','utf8','force','pull','message','str','local\x20differs\x20from\x20remote','length','sqlContent','trim','lastSync','map','sqlCode','find','6131720xDDWDP','1216730yJAiPZ'];a253_0x4968=function(){return _0x7661ee;};return a253_0x4968();}import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x49146e,_0x4c0174){const _0x493793=a253_0x11db,_0x81eb44=[];let _0x3f3764=0x1;while(!![]){const _0x57a3cd=await listSqlQueries(_0x49146e,{'currentPage':_0x3f3764,'pageSize':PAGE_SIZE,'sqlCode':_0x4c0174[_0x493793(0x229)],'sqlName':_0x4c0174[_0x493793(0x216)]}),_0x345957=_0x57a3cd[_0x493793(0x22d)]??[];_0x81eb44['push'](..._0x345957);if(_0x345957[_0x493793(0x224)]===0x0)break;const _0x5e8404=_0x57a3cd[_0x493793(0x210)]?.['totalCount'];if(_0x5e8404!=null?_0x81eb44[_0x493793(0x224)]>=_0x5e8404:_0x345957[_0x493793(0x224)]<PAGE_SIZE)break;_0x3f3764++;}return _0x81eb44;}async function ensureSqlContent(_0x3d5359){const _0x11cb80=a253_0x11db;if(_0x3d5359[_0x11cb80(0x225)]!=null&&String(_0x3d5359[_0x11cb80(0x225)])[_0x11cb80(0x224)]>0x0)return _0x3d5359;return getSqlQueryDetail(_0x3d5359[_0x11cb80(0x229)]);}export const sqlPull={'service':a253_0x183e2c(0x234),'command':'pull','description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a253_0x183e2c(0x1f9),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x183e2c(0x20f),'type':a253_0x183e2c(0x1ff),'description':a253_0x183e2c(0x232)},{'name':a253_0x183e2c(0x21f),'type':a253_0x183e2c(0x21c),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x492d74){const _0x2ecb35=a253_0x183e2c,_0x115215=loadSqlProjectConfig(_0x492d74[_0x2ecb35(0x237)]),_0x5889d0=await readSqlLockFile(_0x115215['lockFilePath']),{appLock:_0x191c45}=ensureSqlLockScope(_0x5889d0??createEmptySqlLock(),_0x115215[_0x2ecb35(0x237)],_0x115215[_0x2ecb35(0x217)],_0x2ecb35(0x220)),_0x400b3e=await fetchAllSqlQueries(_0x492d74[_0x2ecb35(0x237)],{'sqlCode':_0x492d74[_0x2ecb35(0x222)]('sqlcode')||undefined,'sqlName':_0x492d74['str']('name')||undefined}),_0x58fe1f=[];for(const _0x4be44a of _0x400b3e){const _0x578a23=await ensureSqlContent(_0x4be44a),_0x5cde99=ensureRemoteSqlContent(_0x578a23),_0x1ef923=detectSqlMode(_0x5cde99),_0xf1c8c9=_0x578a23['dbId']?await getDbName(_0x492d74[_0x2ecb35(0x237)],Number(_0x578a23['dbId']))[_0x2ecb35(0x235)](()=>undefined):undefined,_0x473b7b=buildLocalSqlFileContent({'sqlCode':_0x578a23[_0x2ecb35(0x229)],'sqlName':_0x578a23[_0x2ecb35(0x216)],'dbId':_0x578a23[_0x2ecb35(0x1f5)]},_0x5cde99,{'dbName':_0xf1c8c9,'mode':_0x1ef923,'syncedAt':new Date()[_0x2ecb35(0x202)](),'description':_0x578a23[_0x2ecb35(0x231)]}),_0x2bede5=buildSqlLockEntry(_0x578a23,_0x5cde99,'',{'dbName':_0xf1c8c9}),_0x4715c9=resolveLocalSqlFilePath(_0x115215,_0x578a23[_0x2ecb35(0x229)],_0x2bede5);let _0x38fd7b='would_pull',_0x53e514;const _0x4e0218=await findExistingSqlFiles(_0x115215,_0x4715c9,_0x1ef923,_0x191c45[_0x2ecb35(0x204)][_0x578a23[_0x2ecb35(0x229)]]);if(_0x4e0218[_0x2ecb35(0x224)]>0x0){const _0x1c1115=await compareExistingSqlFiles(_0x4e0218,_0x473b7b,_0x1ef923);if(_0x1c1115[_0x2ecb35(0x236)](({equivalent:_0x1e8fe6})=>!_0x1e8fe6))_0x38fd7b=_0x2ecb35(0x21a),_0x53e514=_0x2ecb35(0x233);else _0x1c1115[_0x2ecb35(0x224)]===0x1&&_0x1c1115[0x0]?.['file'][_0x2ecb35(0x21b)]&&(_0x38fd7b='skipped',_0x53e514=_0x2ecb35(0x20c));}_0x58fe1f[_0x2ecb35(0x20b)]({'sqlCode':_0x578a23[_0x2ecb35(0x229)],'sqlName':_0x578a23['sqlName'],'filePath':_0x4715c9,'status':_0x38fd7b,'reason':_0x53e514});}return{'method':_0x2ecb35(0x205),'url':_0x2ecb35(0x206),'body':{'appCode':_0x492d74[_0x2ecb35(0x237)],'sqlCode':_0x492d74[_0x2ecb35(0x222)]('sqlcode')||null,'sqlName':_0x492d74['str']('name')||null,'files':_0x58fe1f},'description':_0x2ecb35(0x208)+_0x58fe1f[_0x2ecb35(0x224)]+_0x2ecb35(0x239)+_0x115215[_0x2ecb35(0x1fd)]};},async 'execute'(_0x51d328){const _0x4f1a88=a253_0x183e2c,_0x260985=loadSqlProjectConfig(_0x51d328['appCode']),_0x21b23d=await readSqlLockFile(_0x260985['lockFilePath']),{lockData:_0x3ae984,appLock:_0x214b68}=ensureSqlLockScope(_0x21b23d??createEmptySqlLock(),_0x260985['appCode'],_0x260985[_0x4f1a88(0x217)],_0x4f1a88(0x220)),_0x409e41=_0x51d328[_0x4f1a88(0x215)](_0x4f1a88(0x21f)),_0x297f7d=await fetchAllSqlQueries(_0x51d328[_0x4f1a88(0x237)],{'sqlCode':_0x51d328[_0x4f1a88(0x222)](_0x4f1a88(0x209))||undefined,'sqlName':_0x51d328[_0x4f1a88(0x222)](_0x4f1a88(0x20f))||undefined});if(_0x297f7d[_0x4f1a88(0x224)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4f1a88(0x211)};const _0x5e8f8c=[],_0x5005e2=[];for(const _0x7bcfd8 of _0x297f7d){try{_0x5e8f8c[_0x4f1a88(0x20b)](await ensureSqlContent(_0x7bcfd8));}catch(_0x142838){_0x5005e2['push']({'sqlCode':_0x7bcfd8[_0x4f1a88(0x229)],'error':_0x142838 instanceof Error?_0x142838[_0x4f1a88(0x221)]:String(_0x142838)});}}if(_0x409e41&&!_0x51d328[_0x4f1a88(0x22f)]){let _0x18d560=![];for(const _0xfeafef of _0x5e8f8c){const _0x40c32f=detectSqlMode(ensureRemoteSqlContent(_0xfeafef)),_0xe3cb64=_0xfeafef[_0x4f1a88(0x1f5)]?await getDbName(_0x51d328[_0x4f1a88(0x237)],Number(_0xfeafef[_0x4f1a88(0x1f5)]))[_0x4f1a88(0x235)](()=>undefined):undefined,_0x409149=buildLocalSqlFileContent({'sqlCode':_0xfeafef[_0x4f1a88(0x229)],'sqlName':_0xfeafef[_0x4f1a88(0x216)],'dbId':_0xfeafef[_0x4f1a88(0x1f5)]},ensureRemoteSqlContent(_0xfeafef),{'dbName':_0xe3cb64,'mode':_0x40c32f,'syncedAt':new Date()['toISOString'](),'description':_0xfeafef['description']}),_0x1b8e38=resolveLocalSqlFilePath(_0x260985,_0xfeafef['sqlCode'],buildSqlLockEntry(_0xfeafef,ensureRemoteSqlContent(_0xfeafef),'',{'dbName':_0xe3cb64})),_0x176275=await findExistingSqlFiles(_0x260985,_0x1b8e38,_0x40c32f,_0x214b68['sqls'][_0xfeafef[_0x4f1a88(0x229)]]),_0x261a51=await compareExistingSqlFiles(_0x176275,_0x409149,_0x40c32f);if(_0x261a51[_0x4f1a88(0x236)](({equivalent:_0x31f931})=>!_0x31f931)){_0x18d560=!![];break;}}if(_0x18d560){const _0x3f2684=await confirmForceOverwrite(_0x4f1a88(0x1f4));if(!_0x3f2684)throw CliErrors['cancelled'](_0x4f1a88(0x218));}}const _0x44cb85=cloneSqlLockData(_0x3ae984),_0x16decf=_0x44cb85[_0x4f1a88(0x1fe)][_0x260985[_0x4f1a88(0x237)]],_0x14191d=[],_0x4e408d=[];for(const _0x5ee85f of _0x5e8f8c){const _0x305332=_0x16decf[_0x4f1a88(0x204)][_0x5ee85f[_0x4f1a88(0x229)]],_0x56675a=ensureRemoteSqlContent(_0x5ee85f),_0x4ae890=detectSqlMode(_0x56675a),_0x58e64a=_0x5ee85f[_0x4f1a88(0x1f5)]?await getDbName(_0x51d328['appCode'],Number(_0x5ee85f[_0x4f1a88(0x1f5)]))[_0x4f1a88(0x235)](()=>undefined):undefined,_0x591418=buildLocalSqlFileContent({'sqlCode':_0x5ee85f[_0x4f1a88(0x229)],'sqlName':_0x5ee85f[_0x4f1a88(0x216)],'dbId':_0x5ee85f['dbId']},_0x56675a,{'dbName':_0x58e64a,'mode':_0x4ae890,'syncedAt':new Date()[_0x4f1a88(0x202)](),'description':_0x5ee85f[_0x4f1a88(0x231)]}),_0x2ab11e=buildSqlLockEntry(_0x5ee85f,_0x56675a,computeSqlContentHash(_0x591418),{'dbName':_0x58e64a}),_0x4efe74=_0x2ab11e[_0x4f1a88(0x20a)],_0x183f02=join(_0x260985['sqlRootDir'],_0x4efe74);try{const _0xc57284=await findExistingSqlFiles(_0x260985,_0x183f02,_0x4ae890,_0x305332),_0x2495cc=await compareExistingSqlFiles(_0xc57284,_0x591418,_0x4ae890);if(!_0x409e41&&_0x2495cc[_0x4f1a88(0x236)](({equivalent:_0xe9eb95})=>!_0xe9eb95)){_0x4e408d[_0x4f1a88(0x20b)]({'sqlCode':_0x5ee85f[_0x4f1a88(0x229)],'reason':_0x4f1a88(0x223)});continue;}const _0x55aba0=_0x2495cc[_0x4f1a88(0x22a)](({file:_0x3365c9})=>_0x3365c9['isCanonical']),_0x521649=_0x2495cc[_0x4f1a88(0x22a)](({file:_0xb364b4})=>!_0xb364b4[_0x4f1a88(0x21b)]);if(_0x55aba0?.[_0x4f1a88(0x1fb)]&&!_0x521649){_0x4e408d[_0x4f1a88(0x20b)]({'sqlCode':_0x5ee85f[_0x4f1a88(0x229)],'reason':'unchanged'}),_0x16decf[_0x4f1a88(0x204)][_0x5ee85f[_0x4f1a88(0x229)]]={..._0x2ab11e,'hash':computeSqlContentHash(_0x55aba0['content']),'path':_0x4efe74};continue;}!_0x55aba0?.[_0x4f1a88(0x1fb)]&&(await ensureParentDirectory(_0x183f02),await writeFile(_0x183f02,_0x591418,_0x4f1a88(0x21e))),_0x521649&&await rm(_0x521649[_0x4f1a88(0x212)]['filePath'],{'force':!![]}),_0x16decf['sqls'][_0x5ee85f[_0x4f1a88(0x229)]]={..._0x2ab11e,'hash':_0x55aba0?.['equivalent']?computeSqlContentHash(_0x55aba0['content']):_0x2ab11e['hash'],'path':_0x4efe74},_0x14191d[_0x4f1a88(0x20b)]({'sqlCode':_0x5ee85f['sqlCode'],'filePath':_0x183f02});}catch(_0x54c0a4){_0x5005e2['push']({'sqlCode':_0x5ee85f[_0x4f1a88(0x229)],'error':_0x54c0a4 instanceof Error?_0x54c0a4[_0x4f1a88(0x221)]:String(_0x54c0a4)});}}return _0x16decf[_0x4f1a88(0x227)]=new Date()[_0x4f1a88(0x202)](),await writeSqlLockFile(_0x260985[_0x4f1a88(0x22e)],_0x44cb85),{'ok':_0x5005e2[_0x4f1a88(0x224)]===0x0,'data':{'pulled':_0x14191d,'skipped':_0x4e408d,'failed':_0x5005e2},'message':_0x4f1a88(0x207)+_0x14191d[_0x4f1a88(0x224)]+'\x20written,\x20'+_0x4e408d[_0x4f1a88(0x224)]+_0x4f1a88(0x219)+_0x5005e2[_0x4f1a88(0x224)]+'\x20failed'};}};function isEquivalentPulledSqlFile(_0x15763d,_0x1f8ab6,_0x1321c5,_0x331f78){if(_0x1321c5!==_0x331f78)return normalizePulledSqlBody(_0x15763d,_0x1321c5)===normalizePulledSqlBody(_0x1f8ab6,_0x331f78);return normalizePullComparableContent(_0x15763d,_0x1321c5)===normalizePullComparableContent(_0x1f8ab6,_0x331f78);}async function findExistingSqlFiles(_0x215bfd,_0x2acff0,_0x496e85,_0x62feaf){const _0x459664=a253_0x183e2c,_0x1b3270=[];await fileExists(_0x2acff0)&&_0x1b3270['push']({'filePath':_0x2acff0,'mode':_0x496e85,'isCanonical':!![]});if(!_0x62feaf?.[_0x459664(0x20a)])return _0x1b3270;const _0x76debc=join(_0x215bfd['sqlRootDir'],_0x62feaf[_0x459664(0x20a)]);if(_0x76debc===_0x2acff0)return _0x1b3270;return await fileExists(_0x76debc)&&_0x1b3270[_0x459664(0x20b)]({'filePath':_0x76debc,'mode':_0x62feaf[_0x459664(0x1fa)]??modeFromFilePath(_0x76debc),'isCanonical':![]}),_0x1b3270;}async function compareExistingSqlFiles(_0x307eb7,_0x4c7355,_0x4dca27){const _0x5212a1=a253_0x183e2c;return Promise['all'](_0x307eb7[_0x5212a1(0x228)](async _0x327d57=>{const _0x24cb0e=_0x5212a1,_0x23d115=await readFile(_0x327d57['filePath'],_0x24cb0e(0x21e));return{'file':_0x327d57,'content':_0x23d115,'equivalent':isEquivalentPulledSqlFile(_0x23d115,_0x4c7355,_0x327d57['mode'],_0x4dca27)};}));}function modeFromFilePath(_0x58ea12){const _0x15558e=a253_0x183e2c;return _0x58ea12[_0x15558e(0x1f6)]()['endsWith'](_0x15558e(0x1f7))?'mybatisXml':_0x15558e(0x234);}function normalizePulledSqlBody(_0x3e6ef5,_0x1c29b8){const _0xb07a1d=a253_0x183e2c;return stripLocalSqlMetadata(_0x3e6ef5,_0x1c29b8)['replace'](/\r\n/g,'\x0a')[_0xb07a1d(0x226)]();}function normalizePullComparableContent(_0x58aa9d,_0x370b77){const _0x42dd74=a253_0x183e2c,_0x3ab5ef=_0x58aa9d['replace'](/\r\n/g,'\x0a')[_0x42dd74(0x238)]('\x0a'),_0x12daac=_0x3ab5ef['filter'](_0x45d8a5=>!isSyncedAtMetadataLine(_0x45d8a5,_0x370b77));return _0x12daac[_0x42dd74(0x20e)]('\x0a');}function isSyncedAtMetadataLine(_0x31a2b8,_0x57316c){const _0x4b80e7=a253_0x183e2c;if(_0x57316c===_0x4b80e7(0x1f8))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x31a2b8);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x4b80e7(0x201)](_0x31a2b8);}
1
+ const a253_0x113200=a253_0x287d;(function(_0x5e5a45,_0xc02bf2){const _0x491977=a253_0x287d,_0x4446de=_0x5e5a45();while(!![]){try{const _0x342dc3=-parseInt(_0x491977(0x182))/0x1+parseInt(_0x491977(0x157))/0x2*(parseInt(_0x491977(0x16b))/0x3)+parseInt(_0x491977(0x153))/0x4+-parseInt(_0x491977(0x184))/0x5+-parseInt(_0x491977(0x155))/0x6*(parseInt(_0x491977(0x154))/0x7)+parseInt(_0x491977(0x169))/0x8*(-parseInt(_0x491977(0x14e))/0x9)+parseInt(_0x491977(0x170))/0xa*(parseInt(_0x491977(0x17f))/0xb);if(_0x342dc3===_0xc02bf2)break;else _0x4446de['push'](_0x4446de['shift']());}catch(_0x343967){_0x4446de['push'](_0x4446de['shift']());}}}(a253_0x48fa,0xdb3ef));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{detectSqlMode}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x426bbb,_0x35c980){const _0x2928f3=a253_0x287d,_0x2eb322=[];let _0x193cee=0x1;while(!![]){const _0x32eab0=await listSqlQueries(_0x426bbb,{'currentPage':_0x193cee,'pageSize':PAGE_SIZE,'sqlCode':_0x35c980[_0x2928f3(0x18e)],'sqlName':_0x35c980[_0x2928f3(0x162)]}),_0xe92d65=_0x32eab0['tableData']??[];_0x2eb322[_0x2928f3(0x185)](..._0xe92d65);if(_0xe92d65[_0x2928f3(0x172)]===0x0)break;const _0x1c5d2d=_0x32eab0['paging']?.[_0x2928f3(0x152)];if(_0x1c5d2d!=null?_0x2eb322[_0x2928f3(0x172)]>=_0x1c5d2d:_0xe92d65['length']<PAGE_SIZE)break;_0x193cee++;}return _0x2eb322;}async function ensureSqlContent(_0x55edc2){const _0x2f92ef=a253_0x287d;if(_0x55edc2['sqlContent']!=null&&String(_0x55edc2[_0x2f92ef(0x18a)])['length']>0x0)return _0x55edc2;return getSqlQueryDetail(_0x55edc2[_0x2f92ef(0x18e)]);}function a253_0x48fa(){const _0x21d344=['lockFilePath','string','POST','unchanged','replace','filePath','Filter\x20by\x20SQL\x20display\x20name','trim','appCode','boolean','sqlName','apps','dbId','some','sqlcode','\x20failed','isCanonical','120IHioQH','pull','2608437ujlMVZ','lastSync','path','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','content','13517260bHljEd','sqls','length','test','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','Force\x20pull\x20cancelled.','equivalent','description','catch','Force\x20overwrite\x20local\x20unsynced\x20changes','toISOString','No\x20remote\x20SQL\x20queries\x20matched.','skipped','str','mode','22OHSYMC','would_pull','cancelled','710817gemynB','Pull\x20complete:\x20','7792945eMBZtS','push','map','.xml','sqlRootDir','sql','sqlContent','mybatisXml','force','Would\x20pull\x20','sqlCode','nonInteractive','hash','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sqlRoot','utf8','bool','conflict','\x20SQL\x20file(s)\x20into\x20','name','601362TLXpMs','join','message','file','totalCount','3495348oMOsAd','3227KkMWWG','3606AAysPi','find','2dioIVX'];a253_0x48fa=function(){return _0x21d344;};return a253_0x48fa();}export const sqlPull={'service':a253_0x113200(0x189),'command':a253_0x113200(0x16a),'description':a253_0x113200(0x174),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a253_0x113200(0x14d),'type':a253_0x113200(0x159),'description':a253_0x113200(0x15e)},{'name':a253_0x113200(0x18c),'type':a253_0x113200(0x161),'description':a253_0x113200(0x179)}],async 'dryRun'(_0x235b96){const _0x3e2f24=a253_0x113200,_0x8be9d1=loadSqlProjectConfig(_0x235b96['appCode']),_0x2d8b5e=await readSqlLockFile(_0x8be9d1[_0x3e2f24(0x158)]),{appLock:_0x28d7e7}=ensureSqlLockScope(_0x2d8b5e??createEmptySqlLock(),_0x8be9d1[_0x3e2f24(0x160)],_0x8be9d1[_0x3e2f24(0x148)],_0x3e2f24(0x16a)),_0x293cd0=await fetchAllSqlQueries(_0x235b96[_0x3e2f24(0x160)],{'sqlCode':_0x235b96[_0x3e2f24(0x17d)](_0x3e2f24(0x166))||undefined,'sqlName':_0x235b96[_0x3e2f24(0x17d)]('name')||undefined}),_0x113e80=[];for(const _0x5f2ec0 of _0x293cd0){const _0x266ebd=await ensureSqlContent(_0x5f2ec0),_0x8dc059=ensureRemoteSqlContent(_0x266ebd),_0x53a6c8=detectSqlMode(_0x8dc059),_0x44404e=_0x266ebd[_0x3e2f24(0x164)]?await getDbName(_0x235b96[_0x3e2f24(0x160)],Number(_0x266ebd[_0x3e2f24(0x164)]))['catch'](()=>undefined):undefined,_0xb145b3=buildLocalSqlFileContent({'sqlCode':_0x266ebd[_0x3e2f24(0x18e)],'sqlName':_0x266ebd['sqlName'],'dbId':_0x266ebd[_0x3e2f24(0x164)]},_0x8dc059,{'dbName':_0x44404e,'mode':_0x53a6c8,'syncedAt':new Date()[_0x3e2f24(0x17a)](),'description':_0x266ebd['description']}),_0x1fd4d9=buildSqlLockEntry(_0x266ebd,_0x8dc059,'',{'dbName':_0x44404e}),_0x3da1e2=resolveLocalSqlFilePath(_0x8be9d1,_0x266ebd[_0x3e2f24(0x18e)],_0x1fd4d9);let _0x45dbf7=_0x3e2f24(0x180),_0x3ccc38;const _0x144a2b=await findExistingSqlFiles(_0x8be9d1,_0x3da1e2,_0x53a6c8,_0x28d7e7['sqls'][_0x266ebd['sqlCode']]);if(_0x144a2b[_0x3e2f24(0x172)]>0x0){const _0x1e63b1=await compareExistingSqlFiles(_0x144a2b,_0xb145b3,_0x53a6c8);if(_0x1e63b1['some'](({equivalent:_0x22eee3})=>!_0x22eee3))_0x45dbf7=_0x3e2f24(0x14b),_0x3ccc38=_0x3e2f24(0x147);else _0x1e63b1[_0x3e2f24(0x172)]===0x1&&_0x1e63b1[0x0]?.[_0x3e2f24(0x151)]['isCanonical']&&(_0x45dbf7=_0x3e2f24(0x17c),_0x3ccc38=_0x3e2f24(0x15b));}_0x113e80[_0x3e2f24(0x185)]({'sqlCode':_0x266ebd[_0x3e2f24(0x18e)],'sqlName':_0x266ebd[_0x3e2f24(0x162)],'filePath':_0x3da1e2,'status':_0x45dbf7,'reason':_0x3ccc38});}return{'method':_0x3e2f24(0x15a),'url':_0x3e2f24(0x16e),'body':{'appCode':_0x235b96[_0x3e2f24(0x160)],'sqlCode':_0x235b96['str'](_0x3e2f24(0x166))||null,'sqlName':_0x235b96['str'](_0x3e2f24(0x14d))||null,'files':_0x113e80},'description':_0x3e2f24(0x18d)+_0x113e80[_0x3e2f24(0x172)]+_0x3e2f24(0x14c)+_0x8be9d1[_0x3e2f24(0x188)]};},async 'execute'(_0x2dd4f5){const _0x34a2f3=a253_0x113200,_0x438a1d=loadSqlProjectConfig(_0x2dd4f5[_0x34a2f3(0x160)]),_0x49a88e=await readSqlLockFile(_0x438a1d['lockFilePath']),{lockData:_0x1200ed,appLock:_0x126bcf}=ensureSqlLockScope(_0x49a88e??createEmptySqlLock(),_0x438a1d[_0x34a2f3(0x160)],_0x438a1d[_0x34a2f3(0x148)],_0x34a2f3(0x16a)),_0x4bb678=_0x2dd4f5[_0x34a2f3(0x14a)](_0x34a2f3(0x18c)),_0x55f346=await fetchAllSqlQueries(_0x2dd4f5[_0x34a2f3(0x160)],{'sqlCode':_0x2dd4f5[_0x34a2f3(0x17d)](_0x34a2f3(0x166))||undefined,'sqlName':_0x2dd4f5['str'](_0x34a2f3(0x14d))||undefined});if(_0x55f346[_0x34a2f3(0x172)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x34a2f3(0x17b)};const _0x3abec8=[],_0x4aadd7=[];for(const _0x1b7f8f of _0x55f346){try{_0x3abec8[_0x34a2f3(0x185)](await ensureSqlContent(_0x1b7f8f));}catch(_0x59ff32){_0x4aadd7['push']({'sqlCode':_0x1b7f8f[_0x34a2f3(0x18e)],'error':_0x59ff32 instanceof Error?_0x59ff32[_0x34a2f3(0x150)]:String(_0x59ff32)});}}if(_0x4bb678&&!_0x2dd4f5[_0x34a2f3(0x145)]){let _0x233d51=![];for(const _0x1dfde5 of _0x3abec8){const _0x43a323=detectSqlMode(ensureRemoteSqlContent(_0x1dfde5)),_0x48c93e=_0x1dfde5['dbId']?await getDbName(_0x2dd4f5[_0x34a2f3(0x160)],Number(_0x1dfde5['dbId']))['catch'](()=>undefined):undefined,_0x5979ae=buildLocalSqlFileContent({'sqlCode':_0x1dfde5['sqlCode'],'sqlName':_0x1dfde5[_0x34a2f3(0x162)],'dbId':_0x1dfde5[_0x34a2f3(0x164)]},ensureRemoteSqlContent(_0x1dfde5),{'dbName':_0x48c93e,'mode':_0x43a323,'syncedAt':new Date()[_0x34a2f3(0x17a)](),'description':_0x1dfde5['description']}),_0xb6abce=resolveLocalSqlFilePath(_0x438a1d,_0x1dfde5[_0x34a2f3(0x18e)],buildSqlLockEntry(_0x1dfde5,ensureRemoteSqlContent(_0x1dfde5),'',{'dbName':_0x48c93e})),_0x1804fd=await findExistingSqlFiles(_0x438a1d,_0xb6abce,_0x43a323,_0x126bcf[_0x34a2f3(0x171)][_0x1dfde5[_0x34a2f3(0x18e)]]),_0x3e3ef9=await compareExistingSqlFiles(_0x1804fd,_0x5979ae,_0x43a323);if(_0x3e3ef9[_0x34a2f3(0x165)](({equivalent:_0x2543b7})=>!_0x2543b7)){_0x233d51=!![];break;}}if(_0x233d51){const _0x3465b0=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x3465b0)throw CliErrors[_0x34a2f3(0x181)](_0x34a2f3(0x175));}}const _0x520d3e=cloneSqlLockData(_0x1200ed),_0x457c0e=_0x520d3e[_0x34a2f3(0x163)][_0x438a1d[_0x34a2f3(0x160)]],_0x53df61=[],_0x3daeec=[];for(const _0x2b92c1 of _0x3abec8){const _0x14b4b7=_0x457c0e[_0x34a2f3(0x171)][_0x2b92c1['sqlCode']],_0x3a7a2f=ensureRemoteSqlContent(_0x2b92c1),_0x2b1940=detectSqlMode(_0x3a7a2f),_0x5a9eed=_0x2b92c1[_0x34a2f3(0x164)]?await getDbName(_0x2dd4f5[_0x34a2f3(0x160)],Number(_0x2b92c1['dbId']))[_0x34a2f3(0x178)](()=>undefined):undefined,_0x2b5108=buildLocalSqlFileContent({'sqlCode':_0x2b92c1['sqlCode'],'sqlName':_0x2b92c1[_0x34a2f3(0x162)],'dbId':_0x2b92c1[_0x34a2f3(0x164)]},_0x3a7a2f,{'dbName':_0x5a9eed,'mode':_0x2b1940,'syncedAt':new Date()['toISOString'](),'description':_0x2b92c1[_0x34a2f3(0x177)]}),_0x477606=buildSqlLockEntry(_0x2b92c1,_0x3a7a2f,computeSqlContentHash(_0x2b5108),{'dbName':_0x5a9eed}),_0x20d09e=_0x477606[_0x34a2f3(0x16d)],_0x2449e4=join(_0x438a1d[_0x34a2f3(0x188)],_0x20d09e);try{const _0x7f3797=await findExistingSqlFiles(_0x438a1d,_0x2449e4,_0x2b1940,_0x14b4b7),_0x425d8c=await compareExistingSqlFiles(_0x7f3797,_0x2b5108,_0x2b1940);if(!_0x4bb678&&_0x425d8c[_0x34a2f3(0x165)](({equivalent:_0x54c168})=>!_0x54c168)){_0x3daeec[_0x34a2f3(0x185)]({'sqlCode':_0x2b92c1[_0x34a2f3(0x18e)],'reason':'local\x20differs\x20from\x20remote'});continue;}const _0x188b3c=_0x425d8c[_0x34a2f3(0x156)](({file:_0x157ee})=>_0x157ee[_0x34a2f3(0x168)]),_0x494397=_0x425d8c[_0x34a2f3(0x156)](({file:_0x5b348e})=>!_0x5b348e[_0x34a2f3(0x168)]);if(_0x188b3c?.[_0x34a2f3(0x176)]&&!_0x494397){_0x3daeec[_0x34a2f3(0x185)]({'sqlCode':_0x2b92c1[_0x34a2f3(0x18e)],'reason':_0x34a2f3(0x15b)}),_0x457c0e[_0x34a2f3(0x171)][_0x2b92c1[_0x34a2f3(0x18e)]]={..._0x477606,'hash':computeSqlContentHash(_0x188b3c['content']),'path':_0x20d09e};continue;}!_0x188b3c?.[_0x34a2f3(0x176)]&&(await ensureParentDirectory(_0x2449e4),await writeFile(_0x2449e4,_0x2b5108,_0x34a2f3(0x149))),_0x494397&&await rm(_0x494397[_0x34a2f3(0x151)][_0x34a2f3(0x15d)],{'force':!![]}),_0x457c0e[_0x34a2f3(0x171)][_0x2b92c1[_0x34a2f3(0x18e)]]={..._0x477606,'hash':_0x188b3c?.['equivalent']?computeSqlContentHash(_0x188b3c[_0x34a2f3(0x16f)]):_0x477606[_0x34a2f3(0x146)],'path':_0x20d09e},_0x53df61['push']({'sqlCode':_0x2b92c1['sqlCode'],'filePath':_0x2449e4});}catch(_0x28338c){_0x4aadd7[_0x34a2f3(0x185)]({'sqlCode':_0x2b92c1['sqlCode'],'error':_0x28338c instanceof Error?_0x28338c[_0x34a2f3(0x150)]:String(_0x28338c)});}}return _0x457c0e[_0x34a2f3(0x16c)]=new Date()[_0x34a2f3(0x17a)](),await writeSqlLockFile(_0x438a1d[_0x34a2f3(0x158)],_0x520d3e),{'ok':_0x4aadd7[_0x34a2f3(0x172)]===0x0,'data':{'pulled':_0x53df61,'skipped':_0x3daeec,'failed':_0x4aadd7},'message':_0x34a2f3(0x183)+_0x53df61[_0x34a2f3(0x172)]+'\x20written,\x20'+_0x3daeec['length']+'\x20skipped,\x20'+_0x4aadd7[_0x34a2f3(0x172)]+_0x34a2f3(0x167)};}};function isEquivalentPulledSqlFile(_0x2718ae,_0x1daa75,_0xb0e41d,_0x10e147){if(_0xb0e41d!==_0x10e147)return normalizePulledSqlBody(_0x2718ae,_0xb0e41d)===normalizePulledSqlBody(_0x1daa75,_0x10e147);return normalizePullComparableContent(_0x2718ae,_0xb0e41d)===normalizePullComparableContent(_0x1daa75,_0x10e147);}async function findExistingSqlFiles(_0x3a0089,_0x3f8d90,_0x217f34,_0x3e8fa6){const _0xf909fe=a253_0x113200,_0x252595=[];await fileExists(_0x3f8d90)&&_0x252595[_0xf909fe(0x185)]({'filePath':_0x3f8d90,'mode':_0x217f34,'isCanonical':!![]});if(!_0x3e8fa6?.[_0xf909fe(0x16d)])return _0x252595;const _0x472ec2=join(_0x3a0089[_0xf909fe(0x188)],_0x3e8fa6[_0xf909fe(0x16d)]);if(_0x472ec2===_0x3f8d90)return _0x252595;return await fileExists(_0x472ec2)&&_0x252595[_0xf909fe(0x185)]({'filePath':_0x472ec2,'mode':_0x3e8fa6[_0xf909fe(0x17e)]??modeFromFilePath(_0x472ec2),'isCanonical':![]}),_0x252595;}async function compareExistingSqlFiles(_0x56057d,_0x45efe6,_0x258de8){const _0x13fba8=a253_0x113200;return Promise['all'](_0x56057d[_0x13fba8(0x186)](async _0x108caf=>{const _0x434f48=_0x13fba8,_0x489184=await readFile(_0x108caf[_0x434f48(0x15d)],_0x434f48(0x149));return{'file':_0x108caf,'content':_0x489184,'equivalent':isEquivalentPulledSqlFile(_0x489184,_0x45efe6,_0x108caf['mode'],_0x258de8)};}));}function modeFromFilePath(_0xbc1667){const _0x196c92=a253_0x113200;return _0xbc1667['toLowerCase']()['endsWith'](_0x196c92(0x187))?_0x196c92(0x18b):_0x196c92(0x189);}function a253_0x287d(_0x3bbbb8,_0x40b8b9){_0x3bbbb8=_0x3bbbb8-0x145;const _0x48fa6f=a253_0x48fa();let _0x287d6e=_0x48fa6f[_0x3bbbb8];return _0x287d6e;}function normalizePulledSqlBody(_0x3fb90a,_0x241bf5){const _0x4ff69c=a253_0x113200;return stripLocalSqlMetadata(_0x3fb90a,_0x241bf5)[_0x4ff69c(0x15c)](/\r\n/g,'\x0a')[_0x4ff69c(0x15f)]();}function normalizePullComparableContent(_0x38d341,_0x3a76b7){const _0x230759=a253_0x113200,_0x2d3866=_0x38d341['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x254f24=_0x2d3866['filter'](_0x31a5ed=>!isSyncedAtMetadataLine(_0x31a5ed,_0x3a76b7));return _0x254f24[_0x230759(0x14f)]('\x0a');}function isSyncedAtMetadataLine(_0x457226,_0x103344){const _0x4c0ab4=a253_0x113200;if(_0x103344===_0x4c0ab4(0x18b))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x457226);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x4c0ab4(0x173)](_0x457226);}
@@ -1 +1 @@
1
- const a254_0x1aa36f=a254_0xfafa;(function(_0x9b0b27,_0x38a43c){const _0x4ecfa7=a254_0xfafa,_0x117df7=_0x9b0b27();while(!![]){try{const _0xfc1c1f=parseInt(_0x4ecfa7(0x144))/0x1*(parseInt(_0x4ecfa7(0x135))/0x2)+parseInt(_0x4ecfa7(0x110))/0x3*(parseInt(_0x4ecfa7(0x11e))/0x4)+-parseInt(_0x4ecfa7(0x120))/0x5+parseInt(_0x4ecfa7(0x14f))/0x6+parseInt(_0x4ecfa7(0x155))/0x7*(-parseInt(_0x4ecfa7(0x118))/0x8)+parseInt(_0x4ecfa7(0x12c))/0x9+-parseInt(_0x4ecfa7(0x132))/0xa*(parseInt(_0x4ecfa7(0x10a))/0xb);if(_0xfc1c1f===_0x38a43c)break;else _0x117df7['push'](_0x117df7['shift']());}catch(_0xcb54d7){_0x117df7['push'](_0x117df7['shift']());}}}(a254_0x43b5,0x81f7c));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(_0x438af9){const _0x1c06f8=a254_0xfafa,_0x574a6c=stripLocalSqlMetadata(await readFile(_0x438af9[_0x1c06f8(0x14d)],_0x1c06f8(0x147)),_0x438af9[_0x1c06f8(0x123)]);if(!_0x574a6c[_0x1c06f8(0x13b)]())throw CliErrors['validation'](_0x438af9[_0x1c06f8(0x13c)]+':\x20SQL\x20content\x20is\x20empty.');return _0x574a6c;}async function getTargetSqlQueries(_0xff9703,_0xb401aa,_0x52640c){const _0x1928fa=a254_0xfafa,_0x511455=await scanLocalSqlQueries(_0xff9703),_0xbd522c=new Map();for(const _0x555f93 of _0x511455){if(_0x52640c&&_0x555f93[_0x1928fa(0x13c)]!==_0x52640c)continue;const _0x371cfc=_0xbd522c[_0x1928fa(0x14c)](_0x555f93[_0x1928fa(0x13c)])??[];_0x371cfc[_0x1928fa(0x10e)](_0x555f93),_0xbd522c[_0x1928fa(0x116)](_0x555f93[_0x1928fa(0x13c)],_0x371cfc);}if(_0x52640c&&!_0xbd522c['has'](_0x52640c))throw CliErrors[_0x1928fa(0x121)](_0x1928fa(0x151)+_0x52640c);const _0x4bc4c7=[];for(const [_0x5c9581,_0x2ad156]of _0xbd522c[_0x1928fa(0x119)]()){if(_0x2ad156['length']===0x1){_0x4bc4c7[_0x1928fa(0x10e)](_0x2ad156[0x0]);continue;}const _0x42ece3=_0xb401aa[_0x1928fa(0x13f)][_0x5c9581],_0x1a7c32=_0x42ece3?.[_0x1928fa(0x115)],_0x5f07ae=_0x1a7c32?_0x2ad156[_0x1928fa(0x113)](_0x26793c=>_0x26793c[_0x1928fa(0x125)]!==_0x1a7c32):_0x2ad156;if(_0x42ece3&&_0x5f07ae[_0x1928fa(0x152)]===0x1){_0x4bc4c7['push'](_0x5f07ae[0x0]);continue;}throw CliErrors[_0x1928fa(0x121)](_0x1928fa(0x112)+_0x5c9581+_0x1928fa(0x11d));}return _0x4bc4c7;}function a254_0x43b5(){const _0x109a90=['13GqtSHr','sqlName','dbDirectory','utf8','appCode','/smartapi/custom/updateUserCustomSql','force','replace','get','filePath','toISOString','3237630fDWjnc','bool','Local\x20SQL\x20not\x20found:\x20','length','\x20skipped,\x20','write','2359oAyrno','hash','121451FoDmDE','sqlcode','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','push','unchanged','27hSkblX','map','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','filter','remoteId','path','set','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','2296BCJkRJ','entries','version','sqlRoot','boolean','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','411732obFQVX','catch','2036265CfPLsn','validation',':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','mode','sqlRootDir','relativePath','sqlConfig','dbName','\x22\x20for\x20sqlCode\x20','POST','startsWith','\x20pushed,\x20','6149142asyGtS','No\x20local\x20SQL\x20files\x20found.','exec','projectRoot','join','Would\x20push\x20','1470HrkQov','lastSync','Local\x20directory\x20\x22','78478UDUcvl','dbId','Push\x20complete:\x20','str','sql',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','trim','sqlCode','Push\x20local\x20SQL\x20files\x20to\x20remote','\x20SQL\x20file(s)','sqls','lockFilePath','No\x20database\x20matches\x20local\x20directory\x20\x22','message','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'];a254_0x43b5=function(){return _0x109a90;};return a254_0x43b5();}export const sqlPush={'service':a254_0x1aa36f(0x139),'command':a254_0x1aa36f(0x10e),'description':a254_0x1aa36f(0x13d),'risk':a254_0x1aa36f(0x154),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a254_0x1aa36f(0x14a),'type':a254_0x1aa36f(0x11c),'description':a254_0x1aa36f(0x10d)}],async 'dryRun'(_0x49afb5){const _0x5be9d6=a254_0x1aa36f,_0x56563e=loadSqlProjectConfig(_0x49afb5[_0x5be9d6(0x148)]),_0x47c8e2=await readSqlLockFile(_0x56563e[_0x5be9d6(0x140)]),{appLock:_0x4db4ee}=ensureSqlLockScope(_0x47c8e2??createEmptySqlLock(),_0x49afb5['appCode'],_0x56563e[_0x5be9d6(0x11b)],_0x5be9d6(0x10e)),_0x3a85c5=await getTargetSqlQueries(_0x56563e,_0x4db4ee,_0x49afb5[_0x5be9d6(0x138)](_0x5be9d6(0x10b))||undefined),_0x285801=[];for(const _0x163d6c of _0x3a85c5){const _0x35e71e=await computeSqlFileHash(_0x163d6c[_0x5be9d6(0x14d)]),_0x3bef3d=_0x4db4ee[_0x5be9d6(0x13f)][_0x163d6c[_0x5be9d6(0x13c)]],_0x5a7ad4=!!_0x3bef3d&&(_0x3bef3d[_0x5be9d6(0x115)]!==_0x163d6c[_0x5be9d6(0x125)]||!!_0x163d6c[_0x5be9d6(0x145)]&&_0x3bef3d[_0x5be9d6(0x145)]!==_0x163d6c[_0x5be9d6(0x145)]||_0x3bef3d[_0x5be9d6(0x123)]!==_0x163d6c[_0x5be9d6(0x123)]);if(!_0x49afb5[_0x5be9d6(0x150)]('force')&&_0x3bef3d&&_0x3bef3d['hash']===_0x35e71e&&!_0x5a7ad4)continue;if(!_0x3bef3d)throw CliErrors['validation'](_0x163d6c[_0x5be9d6(0x13c)]+_0x5be9d6(0x122));if(_0x3bef3d[_0x5be9d6(0x11a)]==null)throw CliErrors[_0x5be9d6(0x121)](_0x163d6c[_0x5be9d6(0x13c)]+_0x5be9d6(0x13a));await resolveTargetDbBinding(_0x49afb5[_0x5be9d6(0x148)],_0x163d6c,_0x3bef3d),await readSqlUploadContent(_0x163d6c),_0x285801[_0x5be9d6(0x10e)](_0x163d6c['sqlCode']);}return{'method':_0x5be9d6(0x129),'url':_0x5be9d6(0x149),'body':{'sqlCodes':_0x285801,'appCode':_0x49afb5[_0x5be9d6(0x148)]},'description':_0x5be9d6(0x131)+_0x285801['length']+_0x5be9d6(0x13e)};},async 'execute'(_0x49468d){const _0x372a36=a254_0x1aa36f,_0x33bf67=loadSqlProjectConfig(_0x49468d[_0x372a36(0x148)]),_0x4f3735=await readSqlLockFile(_0x33bf67[_0x372a36(0x140)]),{lockData:_0x3ac26a,appLock:_0x2ecfa6}=ensureSqlLockScope(_0x4f3735??createEmptySqlLock(),_0x49468d[_0x372a36(0x148)],_0x33bf67[_0x372a36(0x11b)],_0x372a36(0x10e)),_0x233157=await getTargetSqlQueries(_0x33bf67,_0x2ecfa6,_0x49468d[_0x372a36(0x138)](_0x372a36(0x10b))||undefined);if(_0x233157[_0x372a36(0x152)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x372a36(0x12d)};const _0x7f999a=[],_0x30d8cf=[],_0x535b9e=[];let _0x1e4f72=![];for(const _0x6f916d of _0x233157){const _0x7c7805=_0x2ecfa6['sqls'][_0x6f916d[_0x372a36(0x13c)]];if(!_0x7c7805){_0x535b9e[_0x372a36(0x10e)]({'sqlCode':_0x6f916d[_0x372a36(0x13c)],'error':_0x372a36(0x143)});continue;}try{const _0x6bc96=await computeSqlFileHash(_0x6f916d[_0x372a36(0x14d)]),_0x6f723e=_0x7c7805[_0x372a36(0x115)]!==_0x6f916d[_0x372a36(0x125)]||!!_0x6f916d['sqlName']&&_0x7c7805[_0x372a36(0x145)]!==_0x6f916d[_0x372a36(0x145)]||_0x7c7805[_0x372a36(0x123)]!==_0x6f916d[_0x372a36(0x123)];if(!_0x49468d[_0x372a36(0x150)](_0x372a36(0x14a))&&_0x7c7805[_0x372a36(0x156)]===_0x6bc96&&!_0x6f723e){_0x30d8cf[_0x372a36(0x10e)]({'sqlCode':_0x6f916d[_0x372a36(0x13c)],'reason':_0x372a36(0x10f)});continue;}if(_0x7c7805['version']==null){_0x535b9e[_0x372a36(0x10e)]({'sqlCode':_0x6f916d[_0x372a36(0x13c)],'error':_0x372a36(0x10c)});continue;}const _0x85afe9=_0x6f916d[_0x372a36(0x145)]||_0x7c7805[_0x372a36(0x145)],_0x5204dd=await resolveTargetDbBinding(_0x49468d[_0x372a36(0x148)],_0x6f916d,_0x7c7805),_0x18e460=await readSqlUploadContent(_0x6f916d),_0x3de87f=await updateSqlQuery({'id':_0x7c7805[_0x372a36(0x114)],'appCode':_0x49468d[_0x372a36(0x148)],'sqlCode':_0x6f916d[_0x372a36(0x13c)],'sqlName':_0x85afe9,'dbId':_0x5204dd[_0x372a36(0x136)],'version':_0x7c7805[_0x372a36(0x11a)],'sqlContent':_0x18e460,'sqlConfig':_0x7c7805[_0x372a36(0x126)]??undefined}),_0xe4c9a5=_0x3de87f[_0x372a36(0x136)]?await getDbName(_0x49468d[_0x372a36(0x148)],Number(_0x3de87f[_0x372a36(0x136)]))['catch'](()=>_0x5204dd['dbName']):_0x5204dd[_0x372a36(0x127)];_0x2ecfa6[_0x372a36(0x13f)][_0x6f916d[_0x372a36(0x13c)]]={...buildSqlLockEntry(_0x3de87f,_0x18e460,_0x6bc96,{'dbName':_0xe4c9a5}),'path':_0x6f916d[_0x372a36(0x125)],'mode':_0x6f916d[_0x372a36(0x123)]},_0x1e4f72=!![],await archivePreviousSqlFileIfNeeded(_0x33bf67,_0x7c7805[_0x372a36(0x115)],_0x6f916d[_0x372a36(0x125)]),_0x7f999a[_0x372a36(0x10e)]({'sqlCode':_0x6f916d[_0x372a36(0x13c)],'remoteId':_0x7c7805['remoteId']});}catch(_0x2863a2){_0x535b9e['push']({'sqlCode':_0x6f916d[_0x372a36(0x13c)],'error':_0x2863a2 instanceof Error?_0x2863a2[_0x372a36(0x142)]:String(_0x2863a2)});}}(_0x1e4f72||_0x535b9e[_0x372a36(0x152)]===0x0)&&(_0x2ecfa6[_0x372a36(0x133)]=new Date()['toISOString'](),await writeSqlLockFile(_0x33bf67[_0x372a36(0x140)],_0x3ac26a));const _0x387acd=_0x535b9e[_0x372a36(0x152)]===0x0;return{'ok':_0x387acd,'data':{'pushed':_0x7f999a,'skipped':_0x30d8cf,'failed':_0x535b9e},'message':_0x372a36(0x137)+_0x7f999a[_0x372a36(0x152)]+_0x372a36(0x12b)+_0x30d8cf['length']+_0x372a36(0x153)+_0x535b9e[_0x372a36(0x152)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x4362a8,_0x404891,_0x426cec){const _0x51a630=a254_0x1aa36f;if(!_0x404891||_0x404891===_0x426cec)return;const _0x1bdff0=join(_0x4362a8['sqlRootDir'],_0x404891);if(!await fileExists(_0x1bdff0))return;const _0x4409e5=await moveToTrash(_0x4362a8[_0x51a630(0x12f)],_0x4362a8['trashDir'],_0x1bdff0);await cleanupEmptyDirectories(dirname(_0x1bdff0),_0x4362a8[_0x51a630(0x124)]),void _0x4409e5;}async function moveToTrash(_0x397d42,_0x4b6a22,_0xaa1d7b){const _0x4f42ca=a254_0x1aa36f,_0x32a41f=new Date()[_0x4f42ca(0x14e)]()[_0x4f42ca(0x14b)](/[:.]/g,'-'),_0x2653b8=relative(_0x397d42,_0xaa1d7b),_0x37c48a=join(_0x4b6a22,_0x32a41f,_0x2653b8);return await mkdir(dirname(_0x37c48a),{'recursive':!![]}),await rename(_0xaa1d7b,_0x37c48a),_0x37c48a;}function a254_0xfafa(_0x12ff10,_0x1fcfff){_0x12ff10=_0x12ff10-0x10a;const _0x43b52b=a254_0x43b5();let _0xfafadb=_0x43b52b[_0x12ff10];return _0xfafadb;}async function cleanupEmptyDirectories(_0x1a8e15,_0xbd57a9){const _0x639610=a254_0x1aa36f;let _0xf5d5b6=resolve(_0x1a8e15);const _0x396146=resolve(_0xbd57a9);while(_0xf5d5b6[_0x639610(0x12a)](''+_0x396146+sep)||_0xf5d5b6===_0x396146){if(_0xf5d5b6===_0x396146)return;try{const _0x41d9c5=await readdir(_0xf5d5b6);if(_0x41d9c5[_0x639610(0x152)]>0x0)return;await rmdir(_0xf5d5b6);}catch{return;}_0xf5d5b6=dirname(_0xf5d5b6);}}async function resolveTargetDbBinding(_0x2ba0ca,_0x22660c,_0x2a16e0){const _0x41c763=a254_0x1aa36f,_0x4d1b71=_0x22660c[_0x41c763(0x146)];if(!_0x4d1b71)return{'dbId':_0x2a16e0['dbId'],'dbName':_0x2a16e0[_0x41c763(0x127)]};const _0x529391=buildDbDirectoryName(_0x2a16e0['dbName'],_0x2a16e0['dbId']);if(_0x4d1b71===_0x529391)return{'dbId':_0x2a16e0[_0x41c763(0x136)],'dbName':_0x2a16e0['dbName']};const _0x47b970=parseExplicitDbDirectory(_0x4d1b71);if(_0x47b970!=null)return{'dbId':_0x47b970,'dbName':await getDbName(_0x2ba0ca,_0x47b970)[_0x41c763(0x11f)](()=>undefined)};const _0x1905d7=await listDatabases(_0x2ba0ca),_0xd85b03=_0x1905d7[_0x41c763(0x113)](_0xe61bfe=>buildDbDirectoryName(_0xe61bfe[_0x41c763(0x127)],_0xe61bfe[_0x41c763(0x136)])===_0x4d1b71);if(_0xd85b03['length']===0x1)return{'dbId':_0xd85b03[0x0][_0x41c763(0x136)],'dbName':_0xd85b03[0x0][_0x41c763(0x127)]};if(_0xd85b03[_0x41c763(0x152)]===0x0)throw CliErrors[_0x41c763(0x121)](_0x41c763(0x141)+_0x4d1b71+_0x41c763(0x128)+_0x22660c[_0x41c763(0x13c)]+'.');const _0x45a335=_0xd85b03[_0x41c763(0x111)](_0x129cf6=>_0x129cf6[_0x41c763(0x127)]+'\x20('+_0x129cf6[_0x41c763(0x136)]+')')[_0x41c763(0x130)](',\x20');throw CliErrors[_0x41c763(0x121)](_0x41c763(0x134)+_0x4d1b71+_0x41c763(0x117)+_0x22660c['sqlCode']+':\x20'+_0x45a335);}function parseExplicitDbDirectory(_0x2a93a9){const _0x19e305=a254_0x1aa36f,_0xc3606e=/^db-(\d+)$/[_0x19e305(0x12e)](_0x2a93a9);if(!_0xc3606e)return null;const _0x172b20=Number(_0xc3606e[0x1]);return Number['isFinite'](_0x172b20)&&_0x172b20>0x0?_0x172b20:null;}
1
+ const a254_0x397be5=a254_0x324e;(function(_0x256453,_0x55b6ab){const _0x41529f=a254_0x324e,_0x1666d2=_0x256453();while(!![]){try{const _0x5d6dd2=parseInt(_0x41529f(0xf5))/0x1+parseInt(_0x41529f(0xe1))/0x2*(-parseInt(_0x41529f(0xcc))/0x3)+parseInt(_0x41529f(0xe4))/0x4*(-parseInt(_0x41529f(0xd5))/0x5)+-parseInt(_0x41529f(0xf6))/0x6*(-parseInt(_0x41529f(0xd9))/0x7)+parseInt(_0x41529f(0xd7))/0x8*(-parseInt(_0x41529f(0xdd))/0x9)+parseInt(_0x41529f(0xeb))/0xa*(-parseInt(_0x41529f(0xc3))/0xb)+parseInt(_0x41529f(0xc7))/0xc;if(_0x5d6dd2===_0x55b6ab)break;else _0x1666d2['push'](_0x1666d2['shift']());}catch(_0x5059e2){_0x1666d2['push'](_0x1666d2['shift']());}}}(a254_0x5257,0xe20d0));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';function a254_0x324e(_0x208192,_0x2c362e){_0x208192=_0x208192-0xc2;const _0x52571e=a254_0x5257();let _0x324eac=_0x52571e[_0x208192];return _0x324eac;}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(_0x38df17){const _0x418a82=a254_0x324e,_0x405a83=stripLocalSqlMetadata(await readFile(_0x38df17['filePath'],'utf8'),_0x38df17[_0x418a82(0xe5)]);if(!_0x405a83['trim']())throw CliErrors[_0x418a82(0xf9)](_0x38df17[_0x418a82(0xf7)]+':\x20SQL\x20content\x20is\x20empty.');return _0x405a83;}async function getTargetSqlQueries(_0x2415db,_0x16d2a9,_0x1dd92c){const _0x12dae1=a254_0x324e,_0xeaf20e=await scanLocalSqlQueries(_0x2415db),_0x11242e=new Map();for(const _0x39e70c of _0xeaf20e){if(_0x1dd92c&&_0x39e70c[_0x12dae1(0xf7)]!==_0x1dd92c)continue;const _0x311dae=_0x11242e[_0x12dae1(0xdc)](_0x39e70c[_0x12dae1(0xf7)])??[];_0x311dae[_0x12dae1(0xde)](_0x39e70c),_0x11242e[_0x12dae1(0xf2)](_0x39e70c[_0x12dae1(0xf7)],_0x311dae);}if(_0x1dd92c&&!_0x11242e[_0x12dae1(0xf4)](_0x1dd92c))throw CliErrors[_0x12dae1(0xf9)](_0x12dae1(0x107)+_0x1dd92c);const _0x5c98d2=[];for(const [_0x3037d4,_0x196298]of _0x11242e[_0x12dae1(0xee)]()){if(_0x196298['length']===0x1){_0x5c98d2[_0x12dae1(0xde)](_0x196298[0x0]);continue;}const _0x1fd89d=_0x16d2a9['sqls'][_0x3037d4],_0x13d015=_0x1fd89d?.['path'],_0x15e226=_0x13d015?_0x196298[_0x12dae1(0xdf)](_0x5abcbe=>_0x5abcbe[_0x12dae1(0xc4)]!==_0x13d015):_0x196298;if(_0x1fd89d&&_0x15e226['length']===0x1){_0x5c98d2[_0x12dae1(0xde)](_0x15e226[0x0]);continue;}throw CliErrors[_0x12dae1(0xf9)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x3037d4+_0x12dae1(0xcf));}return _0x5c98d2;}export const sqlPush={'service':'sql','command':a254_0x397be5(0xde),'description':a254_0x397be5(0xc8),'risk':a254_0x397be5(0xe2),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a254_0x397be5(0xdb),'type':a254_0x397be5(0xec),'description':a254_0x397be5(0xda)}],async 'dryRun'(_0x500d82){const _0x222608=a254_0x397be5,_0x1a3e5e=loadSqlProjectConfig(_0x500d82['appCode']),_0x266835=await readSqlLockFile(_0x1a3e5e['lockFilePath']),{appLock:_0x12c1a7}=ensureSqlLockScope(_0x266835??createEmptySqlLock(),_0x500d82['appCode'],_0x1a3e5e[_0x222608(0xe7)],'push'),_0x42ab67=await getTargetSqlQueries(_0x1a3e5e,_0x12c1a7,_0x500d82[_0x222608(0xe3)](_0x222608(0xc5))||undefined),_0x1a228e=[];for(const _0x199812 of _0x42ab67){const _0x5e850c=await computeSqlFileHash(_0x199812[_0x222608(0xc2)]),_0x39a7db=_0x12c1a7[_0x222608(0xc9)][_0x199812[_0x222608(0xf7)]],_0x506eba=!!_0x39a7db&&(_0x39a7db[_0x222608(0x102)]!==_0x199812['relativePath']||!!_0x199812[_0x222608(0xff)]&&_0x39a7db[_0x222608(0xff)]!==_0x199812['sqlName']||_0x39a7db[_0x222608(0xe5)]!==_0x199812[_0x222608(0xe5)]);if(!_0x500d82[_0x222608(0xd2)](_0x222608(0xdb))&&_0x39a7db&&_0x39a7db['hash']===_0x5e850c&&!_0x506eba)continue;if(!_0x39a7db)throw CliErrors[_0x222608(0xf9)](_0x199812[_0x222608(0xf7)]+_0x222608(0xd4));if(_0x39a7db[_0x222608(0xef)]==null)throw CliErrors[_0x222608(0xf9)](_0x199812[_0x222608(0xf7)]+_0x222608(0xca));await resolveTargetDbBinding(_0x500d82[_0x222608(0xf0)],_0x199812,_0x39a7db),await readSqlUploadContent(_0x199812),_0x1a228e[_0x222608(0xde)](_0x199812[_0x222608(0xf7)]);}return{'method':_0x222608(0xea),'url':_0x222608(0xfd),'body':{'sqlCodes':_0x1a228e,'appCode':_0x500d82[_0x222608(0xf0)]},'description':'Would\x20push\x20'+_0x1a228e[_0x222608(0xd6)]+_0x222608(0xfa)};},async 'execute'(_0xd06323){const _0x558d5c=a254_0x397be5,_0x5de37f=loadSqlProjectConfig(_0xd06323[_0x558d5c(0xf0)]),_0x3a3b01=await readSqlLockFile(_0x5de37f[_0x558d5c(0xed)]),{lockData:_0x176e71,appLock:_0x1a4b06}=ensureSqlLockScope(_0x3a3b01??createEmptySqlLock(),_0xd06323[_0x558d5c(0xf0)],_0x5de37f[_0x558d5c(0xe7)],_0x558d5c(0xde)),_0x194bc6=await getTargetSqlQueries(_0x5de37f,_0x1a4b06,_0xd06323[_0x558d5c(0xe3)](_0x558d5c(0xc5))||undefined);if(_0x194bc6['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x558d5c(0xd0)};const _0x221e84=[],_0x224846=[],_0x23b2e1=[];let _0x55e97d=![];for(const _0x4bef79 of _0x194bc6){const _0x166992=_0x1a4b06[_0x558d5c(0xc9)][_0x4bef79[_0x558d5c(0xf7)]];if(!_0x166992){_0x23b2e1[_0x558d5c(0xde)]({'sqlCode':_0x4bef79['sqlCode'],'error':_0x558d5c(0xe6)});continue;}try{const _0x109f43=await computeSqlFileHash(_0x4bef79['filePath']),_0x4d1a9d=_0x166992['path']!==_0x4bef79[_0x558d5c(0xc4)]||!!_0x4bef79['sqlName']&&_0x166992[_0x558d5c(0xff)]!==_0x4bef79[_0x558d5c(0xff)]||_0x166992[_0x558d5c(0xe5)]!==_0x4bef79[_0x558d5c(0xe5)];if(!_0xd06323[_0x558d5c(0xd2)](_0x558d5c(0xdb))&&_0x166992['hash']===_0x109f43&&!_0x4d1a9d){_0x224846['push']({'sqlCode':_0x4bef79[_0x558d5c(0xf7)],'reason':_0x558d5c(0xc6)});continue;}if(_0x166992['version']==null){_0x23b2e1[_0x558d5c(0xde)]({'sqlCode':_0x4bef79[_0x558d5c(0xf7)],'error':_0x558d5c(0xe8)});continue;}const _0x59c3ac=_0x4bef79[_0x558d5c(0xff)]||_0x166992['sqlName'],_0x43fba4=await resolveTargetDbBinding(_0xd06323[_0x558d5c(0xf0)],_0x4bef79,_0x166992),_0x2895d9=await readSqlUploadContent(_0x4bef79),_0x2e1a79=await updateSqlQuery({'id':_0x166992[_0x558d5c(0x101)],'appCode':_0xd06323[_0x558d5c(0xf0)],'sqlCode':_0x4bef79['sqlCode'],'sqlName':_0x59c3ac,'dbId':_0x43fba4[_0x558d5c(0xce)],'version':_0x166992[_0x558d5c(0xef)],'sqlContent':_0x2895d9,'sqlConfig':_0x166992[_0x558d5c(0xd3)]??undefined}),_0x20fda0=_0x2e1a79['dbId']?await getDbName(_0xd06323[_0x558d5c(0xf0)],Number(_0x2e1a79['dbId']))[_0x558d5c(0x106)](()=>_0x43fba4[_0x558d5c(0xf3)]):_0x43fba4['dbName'];_0x1a4b06[_0x558d5c(0xc9)][_0x4bef79[_0x558d5c(0xf7)]]={...buildSqlLockEntry(_0x2e1a79,_0x2895d9,_0x109f43,{'dbName':_0x20fda0}),'path':_0x4bef79['relativePath'],'mode':_0x4bef79[_0x558d5c(0xe5)]},_0x55e97d=!![],await archivePreviousSqlFileIfNeeded(_0x5de37f,_0x166992['path'],_0x4bef79['relativePath']),_0x221e84['push']({'sqlCode':_0x4bef79['sqlCode'],'remoteId':_0x166992[_0x558d5c(0x101)]});}catch(_0x1c6f57){_0x23b2e1[_0x558d5c(0xde)]({'sqlCode':_0x4bef79[_0x558d5c(0xf7)],'error':_0x1c6f57 instanceof Error?_0x1c6f57[_0x558d5c(0xd8)]:String(_0x1c6f57)});}}(_0x55e97d||_0x23b2e1[_0x558d5c(0xd6)]===0x0)&&(_0x1a4b06[_0x558d5c(0xf1)]=new Date()[_0x558d5c(0xcd)](),await writeSqlLockFile(_0x5de37f[_0x558d5c(0xed)],_0x176e71));const _0x46b1a1=_0x23b2e1['length']===0x0;return{'ok':_0x46b1a1,'data':{'pushed':_0x221e84,'skipped':_0x224846,'failed':_0x23b2e1},'message':_0x558d5c(0x100)+_0x221e84[_0x558d5c(0xd6)]+_0x558d5c(0x105)+_0x224846[_0x558d5c(0xd6)]+_0x558d5c(0xd1)+_0x23b2e1['length']+_0x558d5c(0xfe)};}};async function archivePreviousSqlFileIfNeeded(_0xe99575,_0x37d2b4,_0x366e09){const _0x31dabc=a254_0x397be5;if(!_0x37d2b4||_0x37d2b4===_0x366e09)return;const _0x4d59f9=join(_0xe99575[_0x31dabc(0x103)],_0x37d2b4);if(!await fileExists(_0x4d59f9))return;const _0x32ec60=await moveToTrash(_0xe99575[_0x31dabc(0xe0)],_0xe99575['trashDir'],_0x4d59f9);await cleanupEmptyDirectories(dirname(_0x4d59f9),_0xe99575[_0x31dabc(0x103)]),void _0x32ec60;}async function moveToTrash(_0x423a0e,_0x154abd,_0xe05996){const _0x4b8083=a254_0x397be5,_0x2f51fd=new Date()['toISOString']()[_0x4b8083(0xe9)](/[:.]/g,'-'),_0x1e0217=relative(_0x423a0e,_0xe05996),_0x33105c=join(_0x154abd,_0x2f51fd,_0x1e0217);return await mkdir(dirname(_0x33105c),{'recursive':!![]}),await rename(_0xe05996,_0x33105c),_0x33105c;}function a254_0x5257(){const _0x26a1f3=[':\x20local\x20SQL\x20is\x20not\x20tracked;\x20run\x20sql\x20create\x20or\x20sql\x20pull\x20first.','1190990GrntzU','length','4422520rgaViF','message','6223ClcqRh','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','force','get','18BCLRIL','push','filter','projectRoot','58QeaubT','write','str','8NvYxzD','mode','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','sqlRoot','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','replace','POST','340HiZjze','boolean','lockFilePath','entries','version','appCode','lastSync','set','dbName','has','828681XultFw','4014CFwKZm','sqlCode','isFinite','validation','\x20SQL\x20file(s)','startsWith','dbDirectory','/smartapi/custom/updateUserCustomSql','\x20failed','sqlName','Push\x20complete:\x20','remoteId','path','sqlRootDir','Local\x20directory\x20\x22','\x20pushed,\x20','catch','Local\x20SQL\x20not\x20found:\x20','filePath','54307gOqaaM','relativePath','sqlcode','unchanged','18873096BHORLq','Push\x20local\x20SQL\x20files\x20to\x20remote','sqls',':\x20missing\x20remote\x20version;\x20run\x20sql\x20pull\x20first.','exec','33144KnFqgs','toISOString','dbId','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','No\x20local\x20SQL\x20files\x20found.','\x20skipped,\x20','bool','sqlConfig'];a254_0x5257=function(){return _0x26a1f3;};return a254_0x5257();}async function cleanupEmptyDirectories(_0x176373,_0x17c29b){const _0x30f039=a254_0x397be5;let _0x544580=resolve(_0x176373);const _0x15c020=resolve(_0x17c29b);while(_0x544580[_0x30f039(0xfb)](''+_0x15c020+sep)||_0x544580===_0x15c020){if(_0x544580===_0x15c020)return;try{const _0x2611c9=await readdir(_0x544580);if(_0x2611c9['length']>0x0)return;await rmdir(_0x544580);}catch{return;}_0x544580=dirname(_0x544580);}}async function resolveTargetDbBinding(_0x417592,_0x3315d7,_0x272295){const _0x159b54=a254_0x397be5,_0x497f75=_0x3315d7[_0x159b54(0xfc)];if(!_0x497f75)return{'dbId':_0x272295[_0x159b54(0xce)],'dbName':_0x272295[_0x159b54(0xf3)]};const _0x24d3e1=buildDbDirectoryName(_0x272295['dbName'],_0x272295[_0x159b54(0xce)]);if(_0x497f75===_0x24d3e1)return{'dbId':_0x272295['dbId'],'dbName':_0x272295[_0x159b54(0xf3)]};const _0x401833=parseExplicitDbDirectory(_0x497f75);if(_0x401833!=null)return{'dbId':_0x401833,'dbName':await getDbName(_0x417592,_0x401833)[_0x159b54(0x106)](()=>undefined)};const _0x543d3e=await listDatabases(_0x417592),_0x302c3e=_0x543d3e['filter'](_0x5432a1=>buildDbDirectoryName(_0x5432a1['dbName'],_0x5432a1[_0x159b54(0xce)])===_0x497f75);if(_0x302c3e['length']===0x1)return{'dbId':_0x302c3e[0x0][_0x159b54(0xce)],'dbName':_0x302c3e[0x0]['dbName']};if(_0x302c3e[_0x159b54(0xd6)]===0x0)throw CliErrors[_0x159b54(0xf9)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x497f75+'\x22\x20for\x20sqlCode\x20'+_0x3315d7[_0x159b54(0xf7)]+'.');const _0x17f060=_0x302c3e['map'](_0x1cb22b=>_0x1cb22b[_0x159b54(0xf3)]+'\x20('+_0x1cb22b['dbId']+')')['join'](',\x20');throw CliErrors[_0x159b54(0xf9)](_0x159b54(0x104)+_0x497f75+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x3315d7['sqlCode']+':\x20'+_0x17f060);}function parseExplicitDbDirectory(_0x15caa4){const _0xfece3a=a254_0x397be5,_0x292137=/^db-(\d+)$/[_0xfece3a(0xcb)](_0x15caa4);if(!_0x292137)return null;const _0x247f78=Number(_0x292137[0x1]);return Number[_0xfece3a(0xf8)](_0x247f78)&&_0x247f78>0x0?_0x247f78:null;}