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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) hide show
  1. package/README.md +75 -1
  2. package/lib/api/api-doc.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.d.ts +0 -1
  6. package/lib/api/generate-sdk-config-file.js +1 -1
  7. package/lib/auth/auth-server-ui.js +1 -1
  8. package/lib/auth/auth-server.js +1 -1
  9. package/lib/auth/constant.js +1 -1
  10. package/lib/auth/get-cookie.js +1 -1
  11. package/lib/auth/get-session-user.js +1 -1
  12. package/lib/auth/is-session-valid.js +1 -1
  13. package/lib/auth/login-success-html.js +1 -1
  14. package/lib/auth/logout.js +1 -1
  15. package/lib/cli-flags.js +1 -1
  16. package/lib/cli.js +1 -1
  17. package/lib/commands/api/generate.js +1 -1
  18. package/lib/commands/api/index.js +1 -1
  19. package/lib/commands/api/list.js +1 -1
  20. package/lib/commands/api/pull.js +1 -1
  21. package/lib/commands/api/shared.js +1 -1
  22. package/lib/commands/app/index.js +1 -1
  23. package/lib/commands/app/list.js +1 -1
  24. package/lib/commands/app/members-list.js +1 -1
  25. package/lib/commands/app/remote-directory.js +1 -1
  26. package/lib/commands/app/shared.js +1 -1
  27. package/lib/commands/app-config/delete.js +1 -1
  28. package/lib/commands/app-config/get.js +1 -1
  29. package/lib/commands/app-config/index.js +1 -1
  30. package/lib/commands/app-config/list.js +1 -1
  31. package/lib/commands/app-config/set.js +1 -1
  32. package/lib/commands/app-config/shared.js +1 -1
  33. package/lib/commands/auth/index.js +1 -1
  34. package/lib/commands/bff/create.js +1 -1
  35. package/lib/commands/bff/delete.js +1 -1
  36. package/lib/commands/bff/detail.js +1 -1
  37. package/lib/commands/bff/index.js +1 -1
  38. package/lib/commands/bff/list.js +1 -1
  39. package/lib/commands/bff/pull.js +1 -1
  40. package/lib/commands/bff/push.js +1 -1
  41. package/lib/commands/bff/status.js +1 -1
  42. package/lib/commands/cli-skill/index.js +1 -1
  43. package/lib/commands/cli-update.js +1 -1
  44. package/lib/commands/codegen/index.js +1 -1
  45. package/lib/commands/codegen/sdk.js +1 -1
  46. package/lib/commands/codegen/sql.js +1 -1
  47. package/lib/commands/common/app-registry.js +1 -1
  48. package/lib/commands/common/app-selector.js +1 -1
  49. package/lib/commands/common/async-task.js +1 -1
  50. package/lib/commands/common/dry-run.js +1 -1
  51. package/lib/commands/common/flags.d.ts +2 -0
  52. package/lib/commands/common/flags.js +1 -1
  53. package/lib/commands/common/local-file.js +1 -1
  54. package/lib/commands/common/validate.js +1 -1
  55. package/lib/commands/config/delete.js +1 -1
  56. package/lib/commands/config/get.js +1 -1
  57. package/lib/commands/config/index.js +1 -1
  58. package/lib/commands/config/init.d.ts +2 -0
  59. package/lib/commands/config/init.js +1 -1
  60. package/lib/commands/config/list.js +1 -1
  61. package/lib/commands/config/set.js +1 -1
  62. package/lib/commands/config/shared.js +1 -1
  63. package/lib/commands/dataset/business-group-update.js +1 -1
  64. package/lib/commands/dataset/business-groups.js +1 -1
  65. package/lib/commands/dataset/capability.js +1 -1
  66. package/lib/commands/dataset/delete.js +1 -1
  67. package/lib/commands/dataset/detail.js +1 -1
  68. package/lib/commands/dataset/extend-update.js +1 -1
  69. package/lib/commands/dataset/field-restore.js +1 -1
  70. package/lib/commands/dataset/field-update.js +1 -1
  71. package/lib/commands/dataset/generate.js +1 -1
  72. package/lib/commands/dataset/index.js +1 -1
  73. package/lib/commands/dataset/list.js +1 -1
  74. package/lib/commands/dataset/operations.js +1 -1
  75. package/lib/commands/dataset/relation-audit.js +1 -1
  76. package/lib/commands/dataset/relation-create.js +1 -1
  77. package/lib/commands/dataset/relation-delete.js +1 -1
  78. package/lib/commands/dataset/relation-shared.js +1 -1
  79. package/lib/commands/dataset/relation-update.js +1 -1
  80. package/lib/commands/dataset/relations.js +1 -1
  81. package/lib/commands/dataset/rename.js +1 -1
  82. package/lib/commands/dataset/restore.js +1 -1
  83. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  84. package/lib/commands/db/analysis-batching.js +1 -1
  85. package/lib/commands/db/analyze-batch-plan.js +1 -1
  86. package/lib/commands/db/analyze-cancel.js +1 -1
  87. package/lib/commands/db/analyze-start.js +1 -1
  88. package/lib/commands/db/analyze-status.js +1 -1
  89. package/lib/commands/db/create.js +1 -1
  90. package/lib/commands/db/delete.js +1 -1
  91. package/lib/commands/db/detail.js +1 -1
  92. package/lib/commands/db/diff-refresh-start.js +1 -1
  93. package/lib/commands/db/diff-refresh-status.js +1 -1
  94. package/lib/commands/db/diff.js +1 -1
  95. package/lib/commands/db/index.js +1 -1
  96. package/lib/commands/db/list.js +1 -1
  97. package/lib/commands/db/shared.js +1 -1
  98. package/lib/commands/db/table-diff-shared.js +1 -1
  99. package/lib/commands/db/tables.js +1 -1
  100. package/lib/commands/db/test.js +1 -1
  101. package/lib/commands/db/update.js +1 -1
  102. package/lib/commands/deployment/auto-sync.js +1 -1
  103. package/lib/commands/deployment/index.js +1 -1
  104. package/lib/commands/deployment/sync.js +1 -1
  105. package/lib/commands/doctor.js +1 -1
  106. package/lib/commands/file/index.js +1 -1
  107. package/lib/commands/issue/index.js +1 -1
  108. package/lib/commands/issue/nudge.js +1 -1
  109. package/lib/commands/issue/report.js +1 -1
  110. package/lib/commands/issue/shared.js +1 -1
  111. package/lib/commands/kb/create.js +1 -1
  112. package/lib/commands/kb/delete.js +1 -1
  113. package/lib/commands/kb/detail.js +1 -1
  114. package/lib/commands/kb/index.js +1 -1
  115. package/lib/commands/kb/list.js +1 -1
  116. package/lib/commands/kb/search.js +1 -1
  117. package/lib/commands/kb/shared.js +1 -1
  118. package/lib/commands/kb/update.js +1 -1
  119. package/lib/commands/logs/index.js +1 -1
  120. package/lib/commands/menu/asset-update.js +1 -1
  121. package/lib/commands/menu/delete.js +1 -1
  122. package/lib/commands/menu/external-link-create.js +1 -1
  123. package/lib/commands/menu/external-link-update.js +1 -1
  124. package/lib/commands/menu/group-create.js +1 -1
  125. package/lib/commands/menu/group-update.js +1 -1
  126. package/lib/commands/menu/index.js +1 -1
  127. package/lib/commands/menu/list.js +1 -1
  128. package/lib/commands/menu/move.js +1 -1
  129. package/lib/commands/menu/regroup-start.js +1 -1
  130. package/lib/commands/menu/rename.js +1 -1
  131. package/lib/commands/menu/shared/compare-table.js +1 -1
  132. package/lib/commands/menu/shared/delete-plan.js +1 -1
  133. package/lib/commands/menu/shared/facts.js +1 -1
  134. package/lib/commands/menu/shared/index.js +1 -1
  135. package/lib/commands/menu/shared/inquirer.js +1 -1
  136. package/lib/commands/menu/shared/local-pages.js +1 -1
  137. package/lib/commands/menu/shared/logic.js +1 -1
  138. package/lib/commands/menu/shared/mutations.js +1 -1
  139. package/lib/commands/menu/shared/service.js +1 -1
  140. package/lib/commands/menu/shared/sync-core.js +1 -1
  141. package/lib/commands/menu/shared/update-core.js +1 -1
  142. package/lib/commands/menu/shared/valid-url.js +1 -1
  143. package/lib/commands/menu/sync.js +1 -1
  144. package/lib/commands/menu/visibility-update.js +1 -1
  145. package/lib/commands/notification/config-create.js +1 -1
  146. package/lib/commands/notification/config-delete.js +1 -1
  147. package/lib/commands/notification/config-list.js +1 -1
  148. package/lib/commands/notification/config-update.js +1 -1
  149. package/lib/commands/notification/index.js +1 -1
  150. package/lib/commands/notification/shared.js +1 -1
  151. package/lib/commands/ocr/index.js +1 -1
  152. package/lib/commands/page/create.js +1 -1
  153. package/lib/commands/page/custom/detail.js +1 -1
  154. package/lib/commands/page/custom/list.js +1 -1
  155. package/lib/commands/page/custom/publish.js +1 -1
  156. package/lib/commands/page/custom/shared.js +1 -1
  157. package/lib/commands/page/custom/syntax.js +1 -1
  158. package/lib/commands/page/custom/template.js +1 -1
  159. package/lib/commands/page/custom/update.js +1 -1
  160. package/lib/commands/page/data-list-status.js +1 -1
  161. package/lib/commands/page/generate-start.js +1 -1
  162. package/lib/commands/page/generate-status.js +1 -1
  163. package/lib/commands/page/index.js +1 -1
  164. package/lib/commands/page/pull.js +1 -1
  165. package/lib/commands/page/push.js +1 -1
  166. package/lib/commands/page/relation-audit.js +1 -1
  167. package/lib/commands/page/restore.js +1 -1
  168. package/lib/commands/page/shared.js +1 -1
  169. package/lib/commands/page/sync.js +1 -1
  170. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  171. package/lib/commands/project/create/format-elapsed.js +1 -1
  172. package/lib/commands/project/create/main.d.ts +1 -0
  173. package/lib/commands/project/create/main.js +1 -1
  174. package/lib/commands/project/create/materialize-project-template.js +1 -1
  175. package/lib/commands/project/create/project-name.js +1 -1
  176. package/lib/commands/project/create/project-template-archive.js +1 -1
  177. package/lib/commands/project/create/project-template-path.js +1 -1
  178. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  179. package/lib/commands/project/create/use-format-code.js +1 -1
  180. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  181. package/lib/commands/project/domain-routing-sync.d.ts +2 -0
  182. package/lib/commands/project/domain-routing-sync.js +1 -0
  183. package/lib/commands/project/index.js +1 -1
  184. package/lib/commands/project/upgrade.js +1 -1
  185. package/lib/commands/registry.js +1 -1
  186. package/lib/commands/role/delete.js +1 -1
  187. package/lib/commands/role/detail.js +1 -1
  188. package/lib/commands/role/index.js +1 -1
  189. package/lib/commands/role/list.js +1 -1
  190. package/lib/commands/role/shared.js +1 -1
  191. package/lib/commands/role/update.js +1 -1
  192. package/lib/commands/role/user-add.js +1 -1
  193. package/lib/commands/role/user-remove.js +1 -1
  194. package/lib/commands/role/user-resolve.js +1 -1
  195. package/lib/commands/rule/get.d.ts +2 -0
  196. package/lib/commands/rule/get.js +1 -0
  197. package/lib/commands/rule/index.d.ts +2 -0
  198. package/lib/commands/rule/index.js +1 -0
  199. package/lib/commands/rule/list.d.ts +2 -0
  200. package/lib/commands/rule/list.js +1 -0
  201. package/lib/commands/rule/set.d.ts +2 -0
  202. package/lib/commands/rule/set.js +1 -0
  203. package/lib/commands/rule/shared.d.ts +43 -0
  204. package/lib/commands/rule/shared.js +1 -0
  205. package/lib/commands/run/index.js +1 -1
  206. package/lib/commands/schema.js +1 -1
  207. package/lib/commands/sql/create.js +1 -1
  208. package/lib/commands/sql/delete.js +1 -1
  209. package/lib/commands/sql/detail.js +1 -1
  210. package/lib/commands/sql/exec.js +1 -1
  211. package/lib/commands/sql/index.js +1 -1
  212. package/lib/commands/sql/list.js +1 -1
  213. package/lib/commands/sql/pull.js +1 -1
  214. package/lib/commands/sql/push.js +1 -1
  215. package/lib/commands/sql/shared.js +1 -1
  216. package/lib/commands/sql/status.js +1 -1
  217. package/lib/commands/sql/validate.js +1 -1
  218. package/lib/commands/task/index.js +1 -1
  219. package/lib/commands/task/status.js +1 -1
  220. package/lib/commands/tenant/index.js +1 -1
  221. package/lib/commands/tenant/members-list.js +1 -1
  222. package/lib/commands/tenant/shared.js +1 -1
  223. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  224. package/lib/commands/user-account/index.js +1 -1
  225. package/lib/commands/workspace/add.js +1 -1
  226. package/lib/commands/workspace/index.js +1 -1
  227. package/lib/commands/workspace/remove.js +1 -1
  228. package/lib/config/deployment-sync.js +1 -1
  229. package/lib/config/domain-config.d.ts +37 -1
  230. package/lib/config/domain-config.js +1 -1
  231. package/lib/config/project-domain-routing.d.ts +27 -0
  232. package/lib/config/project-domain-routing.js +1 -0
  233. package/lib/config/schema.d.ts +1 -1
  234. package/lib/config/schema.js +1 -1
  235. package/lib/constant/cdn.js +1 -1
  236. package/lib/constant/cli.js +1 -1
  237. package/lib/constant/defaults.js +1 -1
  238. package/lib/constant/domain.d.ts +10 -4
  239. package/lib/constant/domain.js +1 -1
  240. package/lib/constant/env.js +1 -1
  241. package/lib/constant/output.js +1 -1
  242. package/lib/constant/paths.js +1 -1
  243. package/lib/constant/region.d.ts +4 -1
  244. package/lib/constant/region.js +1 -1
  245. package/lib/constant/risk.js +1 -1
  246. package/lib/constant/routing-profile.d.ts +43 -49
  247. package/lib/constant/routing-profile.js +1 -1
  248. package/lib/context/app-resolver.js +1 -1
  249. package/lib/context/auth-resolver.js +1 -1
  250. package/lib/context/config-loader.js +1 -1
  251. package/lib/context.d.ts +2 -0
  252. package/lib/context.js +1 -1
  253. package/lib/core/alias-resolver.js +1 -1
  254. package/lib/core/api-client.d.ts +37 -0
  255. package/lib/core/api-client.js +1 -1
  256. package/lib/core/bff/config.js +1 -1
  257. package/lib/core/bff/file-system.js +1 -1
  258. package/lib/core/bff/hash.js +1 -1
  259. package/lib/core/bff/lock.js +1 -1
  260. package/lib/core/bff/utils.js +1 -1
  261. package/lib/core/db-resolver.js +1 -1
  262. package/lib/core/page/file-system.js +1 -1
  263. package/lib/core/page/hash.js +1 -1
  264. package/lib/core/page/lock.js +1 -1
  265. package/lib/core/sql-index-auditor.js +1 -1
  266. package/lib/core/sql-sync/config.js +1 -1
  267. package/lib/core/sql-sync/file-system.js +1 -1
  268. package/lib/core/sql-sync/hash.js +1 -1
  269. package/lib/core/sql-sync/lock.js +1 -1
  270. package/lib/core/sql-sync/utils.js +1 -1
  271. package/lib/core/sql-validator.js +1 -1
  272. package/lib/errors.js +1 -1
  273. package/lib/framework/build-all-flags.js +1 -1
  274. package/lib/framework/error-output.js +1 -1
  275. package/lib/framework/explicit-yes.js +1 -1
  276. package/lib/framework/flags.js +1 -1
  277. package/lib/framework/help.js +1 -1
  278. package/lib/framework/index.js +1 -1
  279. package/lib/framework/output.js +1 -1
  280. package/lib/framework/response.js +1 -1
  281. package/lib/framework/runner-alias.js +1 -1
  282. package/lib/framework/runner.js +1 -1
  283. package/lib/framework/schema-export.js +1 -1
  284. package/lib/framework/types.d.ts +0 -1
  285. package/lib/framework/types.js +1 -1
  286. package/lib/generated/build-info.d.ts +4 -4
  287. package/lib/generated/build-info.js +1 -1
  288. package/lib/generated/official-routing.d.ts +83 -0
  289. package/lib/generated/official-routing.js +1 -0
  290. package/lib/generated/routing-contract.d.ts +9 -0
  291. package/lib/generated/routing-contract.js +1 -0
  292. package/lib/help.js +1 -1
  293. package/lib/postinstall.js +1 -1
  294. package/lib/runtime/confirmation.js +1 -1
  295. package/lib/runtime/event.js +1 -1
  296. package/lib/runtime/index.js +1 -1
  297. package/lib/runtime/queue.js +1 -1
  298. package/lib/runtime/resolve.js +1 -1
  299. package/lib/skills/builtin-skill.js +1 -1
  300. package/lib/skills/main.js +1 -1
  301. package/lib/skills/npx-skills-add.js +1 -1
  302. package/lib/skills/skill-presence.js +1 -1
  303. package/lib/telemetry/cli-command-trace.js +1 -1
  304. package/lib/telemetry/cli-help-trace.js +1 -1
  305. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  306. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  307. package/lib/telemetry/send-cli-trace-log.js +1 -1
  308. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  309. package/lib/types/index.d.ts +0 -1
  310. package/lib/utils/ai_config.js +1 -1
  311. package/lib/utils/apply-jq-filter.js +1 -1
  312. package/lib/utils/cdn-config.js +1 -1
  313. package/lib/utils/check-sdk-version.js +1 -1
  314. package/lib/utils/cli-version-check.js +1 -1
  315. package/lib/utils/cli-version-policy.js +1 -1
  316. package/lib/utils/config.js +1 -1
  317. package/lib/utils/entity-with-id.js +1 -1
  318. package/lib/utils/file-utils.js +1 -1
  319. package/lib/utils/guides-cdn.js +1 -1
  320. package/lib/utils/http-client.js +1 -1
  321. package/lib/utils/is-non-interactive.js +1 -1
  322. package/lib/utils/logger.js +1 -1
  323. package/lib/utils/params.js +1 -1
  324. package/lib/utils/platform.js +1 -1
  325. package/lib/utils/sleep.js +1 -1
  326. package/lib/utils/template-replacer.js +1 -1
  327. package/lib/utils/update-notice.js +1 -1
  328. package/lib/utils/version.js +1 -1
  329. package/lib/utils/with-active-cookie.js +1 -1
  330. package/lib/utils/write-cli-side-channel.js +1 -1
  331. package/package.json +2 -1
  332. package/skills/rabetbase/SKILL.md +16 -13
  333. package/skills/rabetbase/guides/sdk-client-generation.md +10 -8
  334. package/skills/rabetbase/references/rabetbase-api-pull.md +16 -11
  335. package/skills/rabetbase/references/rabetbase-config.md +4 -4
  336. package/skills/rabetbase/references/rabetbase-doctor.md +2 -1
  337. package/skills/rabetbase/references/rabetbase-init.md +32 -8
  338. package/skills/rabetbase/references/rabetbase-kb.md +7 -8
  339. package/skills/rabetbase/references/rabetbase-project-create.md +33 -8
  340. package/skills/rabetbase/references/rabetbase-project-domain-routing-sync.md +28 -0
  341. package/skills/rabetbase/references/rabetbase-rule.md +49 -0
  342. package/skills/rabetbase.manifest.json +5 -3
  343. package/lib/config/project-routing.d.ts +0 -30
  344. package/lib/config/project-routing.js +0 -1
  345. package/lib/core/kb-search-client.d.ts +0 -30
  346. package/lib/core/kb-search-client.js +0 -1
@@ -1 +1 @@
1
- function a185_0x37b3(){const _0x4df8fc=['\x20to\x20role\x20','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','1271080ggASXC','3750155lKuQuW','roleName','324667KEHkiU','10223300CZJtvV','Added\x20user\x20','user-add','roleId','\x20already\x20in\x20role\x20','145352SHNQCO','3yKbvtS','9085365DoqzfK','role','roleType','userId','selector','6XBuySy','48tbzwEe','1922778DmObjR','No\x20change:\x20user\x20','appCode','high-risk-write'];a185_0x37b3=function(){return _0x4df8fc;};return a185_0x37b3();}const a185_0x58ccb0=a185_0x3974;function a185_0x3974(_0x37dec9,_0xcef722){_0x37dec9=_0x37dec9-0x14e;const _0x37b36f=a185_0x37b3();let _0x397458=_0x37b36f[_0x37dec9];return _0x397458;}(function(_0x14bba1,_0x37e0f4){const _0x55508a=a185_0x3974,_0x3c06a4=_0x14bba1();while(!![]){try{const _0x3826eb=-parseInt(_0x55508a(0x164))/0x1+-parseInt(_0x55508a(0x15e))/0x2+-parseInt(_0x55508a(0x156))/0x3*(parseInt(_0x55508a(0x155))/0x4)+-parseInt(_0x55508a(0x165))/0x5*(-parseInt(_0x55508a(0x15c))/0x6)+parseInt(_0x55508a(0x14f))/0x7*(parseInt(_0x55508a(0x15d))/0x8)+parseInt(_0x55508a(0x157))/0x9+parseInt(_0x55508a(0x150))/0xa;if(_0x3826eb===_0x37e0f4)break;else _0x3c06a4['push'](_0x3c06a4['shift']());}catch(_0x35b776){_0x3c06a4['push'](_0x3c06a4['shift']());}}}(a185_0x37b3,0xc131d));import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a185_0x58ccb0(0x158),'command':a185_0x58ccb0(0x152),'description':a185_0x58ccb0(0x163),'risk':a185_0x58ccb0(0x161),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x4135bc){const {mutation:_0x454059}=await prepareUserMutation(_0x4135bc,'user-add',!![]);return asDryRunResult(_0x454059,{'method':'POST','url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x5a8dac){const _0x1e7d3b=a185_0x58ccb0,{mutation:_0x1858b5,changed:_0x710efa,role:_0x3c5644,user:_0x3aef2e}=await prepareUserMutation(_0x5a8dac,_0x1e7d3b(0x152),![]);return _0x710efa&&await createDevUserRole({'appCode':_0x5a8dac[_0x1e7d3b(0x160)],'userId':_0x3aef2e[_0x1e7d3b(0x15a)],'username':_0x3aef2e['username'],'roleType':_0x3c5644[_0x1e7d3b(0x159)],'roleId':_0x1858b5['selector'][_0x1e7d3b(0x153)]}),{'ok':!![],'data':_0x1858b5,'message':_0x710efa?_0x1e7d3b(0x151)+_0x1858b5[_0x1e7d3b(0x15b)][_0x1e7d3b(0x15a)]+_0x1e7d3b(0x162)+_0x1858b5[_0x1e7d3b(0x15b)][_0x1e7d3b(0x14e)]:_0x1e7d3b(0x15f)+_0x1858b5[_0x1e7d3b(0x15b)][_0x1e7d3b(0x15a)]+_0x1e7d3b(0x154)+_0x1858b5[_0x1e7d3b(0x15b)][_0x1e7d3b(0x14e)]};}};
1
+ const a186_0x59dfd3=a186_0x3efc;(function(_0x51ced7,_0x44d86d){const _0x16b7b7=a186_0x3efc,_0x16567c=_0x51ced7();while(!![]){try{const _0x43c7f8=parseInt(_0x16b7b7(0x148))/0x1*(parseInt(_0x16b7b7(0x13c))/0x2)+-parseInt(_0x16b7b7(0x137))/0x3+-parseInt(_0x16b7b7(0x143))/0x4*(-parseInt(_0x16b7b7(0x141))/0x5)+-parseInt(_0x16b7b7(0x14c))/0x6*(parseInt(_0x16b7b7(0x138))/0x7)+parseInt(_0x16b7b7(0x13f))/0x8*(parseInt(_0x16b7b7(0x14e))/0x9)+-parseInt(_0x16b7b7(0x14d))/0xa+-parseInt(_0x16b7b7(0x139))/0xb*(parseInt(_0x16b7b7(0x13b))/0xc);if(_0x43c7f8===_0x44d86d)break;else _0x16567c['push'](_0x16567c['shift']());}catch(_0xd8aabc){_0x16567c['push'](_0x16567c['shift']());}}}(a186_0x9a90,0xe13ce));import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a186_0x59dfd3(0x136),'command':a186_0x59dfd3(0x140),'description':'Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x45d631){const _0xa2a0b5=a186_0x59dfd3,{mutation:_0x25d4d6}=await prepareUserMutation(_0x45d631,_0xa2a0b5(0x140),!![]);return asDryRunResult(_0x25d4d6,{'method':_0xa2a0b5(0x142),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0xde3d9a){const _0x500eb6=a186_0x59dfd3,{mutation:_0xb84446,changed:_0x5cd211,role:_0x270277,user:_0x5518f7}=await prepareUserMutation(_0xde3d9a,'user-add',![]);return _0x5cd211&&await createDevUserRole({'appCode':_0xde3d9a[_0x500eb6(0x13a)],'userId':_0x5518f7['userId'],'username':_0x5518f7[_0x500eb6(0x144)],'roleType':_0x270277[_0x500eb6(0x145)],'roleId':_0xb84446[_0x500eb6(0x13e)][_0x500eb6(0x14a)]}),{'ok':!![],'data':_0xb84446,'message':_0x5cd211?'Added\x20user\x20'+_0xb84446['selector'][_0x500eb6(0x14b)]+_0x500eb6(0x147)+_0xb84446[_0x500eb6(0x13e)][_0x500eb6(0x146)]:_0x500eb6(0x13d)+_0xb84446[_0x500eb6(0x13e)]['userId']+_0x500eb6(0x149)+_0xb84446[_0x500eb6(0x13e)][_0x500eb6(0x146)]};}};function a186_0x3efc(_0x526e15,_0x2f9416){_0x526e15=_0x526e15-0x136;const _0x9a9022=a186_0x9a90();let _0x3efc22=_0x9a9022[_0x526e15];return _0x3efc22;}function a186_0x9a90(){const _0x344983=['username','roleType','roleName','\x20to\x20role\x20','1awPpvy','\x20already\x20in\x20role\x20','roleId','userId','1236xBPAjx','139560pOwpAR','3735qpWKQe','role','686601CrCCDj','3143KEjsxh','583xqtPlz','appCode','622056knMKMl','2357774DRMxDe','No\x20change:\x20user\x20','selector','29112KKxAyu','user-add','6581165mtIyxi','POST','4DJbjwd'];a186_0x9a90=function(){return _0x344983;};return a186_0x9a90();}
@@ -1 +1 @@
1
- const a186_0x421e6b=a186_0x369b;(function(_0x41c113,_0x2ee907){const _0x1704aa=a186_0x369b,_0x51af5c=_0x41c113();while(!![]){try{const _0x39b0d4=parseInt(_0x1704aa(0x181))/0x1+-parseInt(_0x1704aa(0x189))/0x2*(parseInt(_0x1704aa(0x18b))/0x3)+-parseInt(_0x1704aa(0x188))/0x4+-parseInt(_0x1704aa(0x18c))/0x5*(-parseInt(_0x1704aa(0x182))/0x6)+-parseInt(_0x1704aa(0x183))/0x7+-parseInt(_0x1704aa(0x187))/0x8*(parseInt(_0x1704aa(0x185))/0x9)+-parseInt(_0x1704aa(0x17b))/0xa*(-parseInt(_0x1704aa(0x17d))/0xb);if(_0x39b0d4===_0x2ee907)break;else _0x51af5c['push'](_0x51af5c['shift']());}catch(_0x46bd92){_0x51af5c['push'](_0x51af5c['shift']());}}}(a186_0x5a8f,0xf2502));import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';function a186_0x369b(_0x8562e7,_0x5509ca){_0x8562e7=_0x8562e7-0x17b;const _0x5a8f62=a186_0x5a8f();let _0x369be0=_0x5a8f62[_0x8562e7];return _0x369be0;}export const roleUserRemove={'service':'role','command':a186_0x421e6b(0x186),'description':a186_0x421e6b(0x17c),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x2ea43b){const _0x4890c8=a186_0x421e6b,{mutation:_0x212a12}=await prepareUserMutation(_0x2ea43b,_0x4890c8(0x186),!![]);return asDryRunResult(_0x212a12,{'method':'POST','url':DELETE_USER_ROLE_PATH});},async 'execute'(_0xb50491){const _0x5d2c8d=a186_0x421e6b,{matchingRelationIds:_0x20cb5a,mutation:_0x1f4834,changed:_0x2b9a9c}=await prepareUserMutation(_0xb50491,_0x5d2c8d(0x186),![]);if(_0x2b9a9c)for(const _0x5415b0 of _0x20cb5a){await deleteDevUserRole(_0x5415b0);}return{'ok':!![],'data':_0x1f4834,'message':_0x2b9a9c?_0x5d2c8d(0x180)+_0x1f4834['selector']['userId']+'\x20from\x20role\x20'+_0x1f4834['selector'][_0x5d2c8d(0x17e)]:_0x5d2c8d(0x18a)+_0x1f4834['selector']['userId']+_0x5d2c8d(0x184)+_0x1f4834[_0x5d2c8d(0x17f)][_0x5d2c8d(0x17e)]};}};function a186_0x5a8f(){const _0x1a676f=['208zfhpUF','7915160zQhHIk','517514gMKRHx','No\x20change:\x20user\x20','9fzCDqX','1855195vFJauw','3120mzZWRu','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','144012SWFidX','roleName','selector','Removed\x20user\x20','645637fUaZUi','12iRAXzd','2016770ANkDwp','\x20not\x20in\x20role\x20','497331PaJSem','user-remove'];a186_0x5a8f=function(){return _0x1a676f;};return a186_0x5a8f();}
1
+ function a187_0x1c96(){const _0x588481=['253756bXPeTG','user-remove','149961TOaBnC','high-risk-write','6tTXgzD','\x20from\x20role\x20','4888785kABwXM','userId','24GuGVIt','No\x20change:\x20user\x20','959855doAhHR','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','27qjkawl','Removed\x20user\x20','POST','roleName','\x20not\x20in\x20role\x20','231BrVJZK','28828KTZUpZ','1274016VbHHXC','4117450MNyAUy','2BLXndP','selector'];a187_0x1c96=function(){return _0x588481;};return a187_0x1c96();}function a187_0x450b(_0x3640e9,_0x4e8086){_0x3640e9=_0x3640e9-0x10d;const _0x1c96f9=a187_0x1c96();let _0x450b5c=_0x1c96f9[_0x3640e9];return _0x450b5c;}const a187_0x10802c=a187_0x450b;(function(_0x2d4ba2,_0x4bc1cb){const _0x139edc=a187_0x450b,_0x47cf2a=_0x2d4ba2();while(!![]){try{const _0x5e21e4=-parseInt(_0x139edc(0x11c))/0x1*(parseInt(_0x139edc(0x11a))/0x2)+parseInt(_0x139edc(0x116))/0x3*(-parseInt(_0x139edc(0x117))/0x4)+parseInt(_0x139edc(0x10f))/0x5*(parseInt(_0x139edc(0x120))/0x6)+parseInt(_0x139edc(0x11e))/0x7+parseInt(_0x139edc(0x118))/0x8*(parseInt(_0x139edc(0x111))/0x9)+-parseInt(_0x139edc(0x119))/0xa+parseInt(_0x139edc(0x122))/0xb*(parseInt(_0x139edc(0x10d))/0xc);if(_0x5e21e4===_0x4bc1cb)break;else _0x47cf2a['push'](_0x47cf2a['shift']());}catch(_0x3e3e99){_0x47cf2a['push'](_0x47cf2a['shift']());}}}(a187_0x1c96,0x57c9c));import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':'role','command':'user-remove','description':a187_0x10802c(0x110),'risk':a187_0x10802c(0x11f),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x38cefb){const _0x95aff9=a187_0x10802c,{mutation:_0x4baa0e}=await prepareUserMutation(_0x38cefb,_0x95aff9(0x11d),!![]);return asDryRunResult(_0x4baa0e,{'method':_0x95aff9(0x113),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x1e95d5){const _0x40b1bd=a187_0x10802c,{matchingRelationIds:_0x5b4312,mutation:_0x12b7b8,changed:_0x77b06c}=await prepareUserMutation(_0x1e95d5,_0x40b1bd(0x11d),![]);if(_0x77b06c)for(const _0x362737 of _0x5b4312){await deleteDevUserRole(_0x362737);}return{'ok':!![],'data':_0x12b7b8,'message':_0x77b06c?_0x40b1bd(0x112)+_0x12b7b8[_0x40b1bd(0x11b)][_0x40b1bd(0x123)]+_0x40b1bd(0x121)+_0x12b7b8[_0x40b1bd(0x11b)][_0x40b1bd(0x114)]:_0x40b1bd(0x10e)+_0x12b7b8['selector'][_0x40b1bd(0x123)]+_0x40b1bd(0x115)+_0x12b7b8['selector'][_0x40b1bd(0x114)]};}};
@@ -1 +1 @@
1
- const a187_0x14d417=a187_0x350f;(function(_0x11bb2d,_0x1122f4){const _0x5ba20f=a187_0x350f,_0x5cf627=_0x11bb2d();while(!![]){try{const _0x58bfb0=parseInt(_0x5ba20f(0x1d9))/0x1+-parseInt(_0x5ba20f(0x1e8))/0x2*(parseInt(_0x5ba20f(0x1eb))/0x3)+-parseInt(_0x5ba20f(0x1e2))/0x4*(parseInt(_0x5ba20f(0x1da))/0x5)+-parseInt(_0x5ba20f(0x1ec))/0x6*(-parseInt(_0x5ba20f(0x1e5))/0x7)+-parseInt(_0x5ba20f(0x1db))/0x8*(parseInt(_0x5ba20f(0x1e9))/0x9)+-parseInt(_0x5ba20f(0x1e4))/0xa+-parseInt(_0x5ba20f(0x1e0))/0xb*(-parseInt(_0x5ba20f(0x1e1))/0xc);if(_0x58bfb0===_0x1122f4)break;else _0x5cf627['push'](_0x5cf627['shift']());}catch(_0x4a9dd6){_0x5cf627['push'](_0x5cf627['shift']());}}}(a187_0x58f9,0x26225));import{CliErrors}from'../../errors.js';function a187_0x350f(_0x195f06,_0x422ea4){_0x195f06=_0x195f06-0x1d4;const _0x58f946=a187_0x58f9();let _0x350f74=_0x58f946[_0x195f06];return _0x350f74;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';function a187_0x58f9(){const _0x1d3aca=['564456yAOghx','4WAxZTW','Resolved\x20\x22','227840nJLhlR','14WitWii','userId','\x22\x20→\x20userId\x20','2RUGwIF','9JjBfyO','name','223773hfnfjV','404214Ezmdxo','str','trim','read','username','nickname','97609mnhNZJ','745070VQDfRr','2401128OCCylM','Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.','matchedBy','Pass\x20--name\x20<nickname|username>.','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','110AZBeuh'];a187_0x58f9=function(){return _0x1d3aca;};return a187_0x58f9();}export const roleUserResolve={'service':'role','command':'user-resolve','description':a187_0x14d417(0x1df),'risk':a187_0x14d417(0x1d6),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2bbd90){const _0x3fa25d=a187_0x14d417;if(!_0x2bbd90[_0x3fa25d(0x1d4)](_0x3fa25d(0x1ea))[_0x3fa25d(0x1d5)]())throw CliErrors['flagMissing'](_0x3fa25d(0x1ea),_0x3fa25d(0x1de));},async 'execute'(_0xf3df5){const _0x15e896=a187_0x14d417,_0x1e93a6=_0xf3df5[_0x15e896(0x1d4)](_0x15e896(0x1ea))[_0x15e896(0x1d5)](),_0x443b99=await resolveUserRef(_0x1e93a6,_0x15e896(0x1dc));return{'ok':!![],'data':{'user':{'userId':_0x443b99[_0x15e896(0x1e6)],'username':_0x443b99[_0x15e896(0x1d7)],'nickname':_0x443b99[_0x15e896(0x1d8)],'matchedBy':_0x443b99[_0x15e896(0x1dd)]}},'message':_0x15e896(0x1e3)+_0x1e93a6+_0x15e896(0x1e7)+_0x443b99[_0x15e896(0x1e6)]};}};
1
+ function a188_0x382d(){const _0x3bbe1d=['50CyWTEc','read','1710TUbFGZ','\x22\x20→\x20userId\x20','8rGyqJH','4vRjVHY','str','role','name','31133443qvcxVA','nickname','trim','1420191gWmpbC','6348167vdaJbT','user-resolve','2133387FTBKWX','2189234yAcsCd','Pass\x20--name\x20<nickname|username>.','3875883PSGPDp','15035wMAEoP','userId','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)'];a188_0x382d=function(){return _0x3bbe1d;};return a188_0x382d();}const a188_0x241eec=a188_0x57f9;(function(_0x2a5353,_0x1ea68f){const _0x1d89fa=a188_0x57f9,_0x4794f1=_0x2a5353();while(!![]){try{const _0x4498b9=-parseInt(_0x1d89fa(0x7b))/0x1+parseInt(_0x1d89fa(0x7f))/0x2+parseInt(_0x1d89fa(0x6b))/0x3*(parseInt(_0x1d89fa(0x74))/0x4)+parseInt(_0x1d89fa(0x6c))/0x5*(-parseInt(_0x1d89fa(0x71))/0x6)+-parseInt(_0x1d89fa(0x7c))/0x7*(parseInt(_0x1d89fa(0x73))/0x8)+parseInt(_0x1d89fa(0x7e))/0x9*(-parseInt(_0x1d89fa(0x6f))/0xa)+parseInt(_0x1d89fa(0x78))/0xb;if(_0x4498b9===_0x1ea68f)break;else _0x4794f1['push'](_0x4794f1['shift']());}catch(_0x466613){_0x4794f1['push'](_0x4794f1['shift']());}}}(a188_0x382d,0xceef9));function a188_0x57f9(_0x2d437d,_0x5f2b59){_0x2d437d=_0x2d437d-0x6a;const _0x382d11=a188_0x382d();let _0x57f942=_0x382d11[_0x2d437d];return _0x57f942;}import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a188_0x241eec(0x76),'command':a188_0x241eec(0x7d),'description':a188_0x241eec(0x6e),'risk':a188_0x241eec(0x70),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x31adbd){const _0x27db9b=a188_0x241eec;if(!_0x31adbd[_0x27db9b(0x75)](_0x27db9b(0x77))[_0x27db9b(0x7a)]())throw CliErrors['flagMissing'](_0x27db9b(0x77),_0x27db9b(0x6a));},async 'execute'(_0x26270d){const _0x438f24=a188_0x241eec,_0x5ce415=_0x26270d[_0x438f24(0x75)](_0x438f24(0x77))[_0x438f24(0x7a)](),_0x19239a=await resolveUserRef(_0x5ce415,'Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.');return{'ok':!![],'data':{'user':{'userId':_0x19239a[_0x438f24(0x6d)],'username':_0x19239a['username'],'nickname':_0x19239a[_0x438f24(0x79)],'matchedBy':_0x19239a['matchedBy']}},'message':'Resolved\x20\x22'+_0x5ce415+_0x438f24(0x72)+_0x19239a[_0x438f24(0x6d)]};}};
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from "../../framework/types.js";
2
+ export declare const ruleGet: CommandDefinition;
@@ -0,0 +1 @@
1
+ const a189_0x580624=a189_0x2817;(function(_0x3b0869,_0x4da535){const _0x13f513=a189_0x2817,_0x1bf863=_0x3b0869();while(!![]){try{const _0x240169=-parseInt(_0x13f513(0x80))/0x1*(-parseInt(_0x13f513(0x8a))/0x2)+parseInt(_0x13f513(0x7d))/0x3+parseInt(_0x13f513(0x89))/0x4*(parseInt(_0x13f513(0x79))/0x5)+parseInt(_0x13f513(0x86))/0x6+-parseInt(_0x13f513(0x84))/0x7+parseInt(_0x13f513(0x81))/0x8*(-parseInt(_0x13f513(0x7a))/0x9)+-parseInt(_0x13f513(0x7c))/0xa*(-parseInt(_0x13f513(0x7b))/0xb);if(_0x240169===_0x4da535)break;else _0x1bf863['push'](_0x1bf863['shift']());}catch(_0x5a0259){_0x1bf863['push'](_0x1bf863['shift']());}}}(a189_0x502d,0xecc7d));function a189_0x502d(){const _0x551bbc=['Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','326cOvYia','7511576xmPqfD','\x20--file\x20<path>\x20--dry-run`.','content','10734017sPwJPK','\x20for\x20','1216104wJnZPd','cookie','rule','9060orVHcp','2948nmvnFJ','Loaded\x20','appCode','1745XNLwvw','9iOyisd','20594618fHHtUr','10EhxZlV','288900cCjcjR','read'];a189_0x502d=function(){return _0x551bbc;};return a189_0x502d();}function a189_0x2817(_0x563cad,_0x465c97){_0x563cad=_0x563cad-0x78;const _0x502daa=a189_0x502d();let _0x2817c3=_0x502daa[_0x563cad];return _0x2817c3;}import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPE_FLAG,appRuleError,appRuleFileName,projectAppRule,readAppRuleType}from'../../commands/rule/shared.js';export const ruleGet={'service':a189_0x580624(0x88),'command':'get','description':a189_0x580624(0x7f),'risk':a189_0x580624(0x7e),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x44b946){readAppRuleType(_0x44b946);},async 'execute'(_0x3f69cc){const _0x55df68=a189_0x580624,_0x4f05e4=readAppRuleType(_0x3f69cc),_0x2ae95c=await getAppRule(_0x3f69cc[_0x55df68(0x87)],{'appCode':_0x3f69cc['appCode'],'type':_0x4f05e4});if(!_0x2ae95c)throw appRuleError('app_rule_not_found',appRuleFileName(_0x4f05e4)+'\x20is\x20not\x20configured\x20for\x20app\x20'+_0x3f69cc['appCode']+'.','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20'+_0x4f05e4+_0x55df68(0x82));return{'ok':!![],'data':{'rule':{...projectAppRule(_0x4f05e4,_0x2ae95c),'content':_0x2ae95c[_0x55df68(0x83)]}},'message':_0x55df68(0x8b)+appRuleFileName(_0x4f05e4)+_0x55df68(0x85)+_0x3f69cc[_0x55df68(0x78)]};}};
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from "../../framework/types.js";
2
+ export declare const ruleDefinitions: CommandDefinition[];
@@ -0,0 +1 @@
1
+ (function(_0x594da5,_0x46fe1b){const _0x45880d=a190_0x2554,_0x1d7111=_0x594da5();while(!![]){try{const _0x138a56=parseInt(_0x45880d(0x155))/0x1+-parseInt(_0x45880d(0x15b))/0x2*(-parseInt(_0x45880d(0x159))/0x3)+parseInt(_0x45880d(0x156))/0x4*(-parseInt(_0x45880d(0x158))/0x5)+parseInt(_0x45880d(0x15c))/0x6+parseInt(_0x45880d(0x15a))/0x7+-parseInt(_0x45880d(0x154))/0x8*(-parseInt(_0x45880d(0x157))/0x9)+-parseInt(_0x45880d(0x153))/0xa;if(_0x138a56===_0x46fe1b)break;else _0x1d7111['push'](_0x1d7111['shift']());}catch(_0x161210){_0x1d7111['push'](_0x1d7111['shift']());}}}(a190_0x468f,0x6d963));import{ruleGet}from'../../commands/rule/get.js';import{ruleList}from'../../commands/rule/list.js';function a190_0x2554(_0x1afbc5,_0x153930){_0x1afbc5=_0x1afbc5-0x153;const _0x468f84=a190_0x468f();let _0x25547c=_0x468f84[_0x1afbc5];return _0x25547c;}import{ruleSet}from'../../commands/rule/set.js';export const ruleDefinitions=[ruleList,ruleGet,ruleSet];function a190_0x468f(){const _0x1151ab=['454204fqlmMS','9nRMpqd','5pnoTAg','84837DecXQj','3560130tkFfgh','20DeXQgD','659046TSYHST','16360450RWPYny','4647896nFcGgJ','716255FIYbjs'];a190_0x468f=function(){return _0x1151ab;};return a190_0x468f();}
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from "../../framework/types.js";
2
+ export declare const ruleList: CommandDefinition;
@@ -0,0 +1 @@
1
+ const a191_0x230e70=a191_0x1f24;(function(_0x45a60f,_0x3cc796){const _0x4dc402=a191_0x1f24,_0x4c1f3f=_0x45a60f();while(!![]){try{const _0xdb86e6=parseInt(_0x4dc402(0x12f))/0x1+-parseInt(_0x4dc402(0x136))/0x2*(-parseInt(_0x4dc402(0x131))/0x3)+-parseInt(_0x4dc402(0x135))/0x4+parseInt(_0x4dc402(0x12b))/0x5*(parseInt(_0x4dc402(0x13b))/0x6)+-parseInt(_0x4dc402(0x12d))/0x7*(parseInt(_0x4dc402(0x130))/0x8)+-parseInt(_0x4dc402(0x129))/0x9*(-parseInt(_0x4dc402(0x13c))/0xa)+-parseInt(_0x4dc402(0x12e))/0xb;if(_0xdb86e6===_0x3cc796)break;else _0x4c1f3f['push'](_0x4c1f3f['shift']());}catch(_0x4d645c){_0x4c1f3f['push'](_0x4c1f3f['shift']());}}}(a191_0x1ee3,0x4d0f3));import{getAppRule}from'../../core/api-client.js';function a191_0x1ee3(){const _0x5c93c4=['read','length','30LyBybK','6510yNRhJF','list','2457PWGzWr','rule','97465gxOuwi','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','14ouLwNi','1976315GANFcm','543908LtKNOI','1862904efioPq','267XbaqdM','appCode','cookie','map','971980ZgEJZE','8650TNNZcd','Loaded\x20app\x20rule\x20configuration\x20for\x20','all'];a191_0x1ee3=function(){return _0x5c93c4;};return a191_0x1ee3();}function a191_0x1f24(_0x4aa4a7,_0x483fcb){_0x4aa4a7=_0x4aa4a7-0x129;const _0x1ee3e6=a191_0x1ee3();let _0x1f2455=_0x1ee3e6[_0x4aa4a7];return _0x1f2455;}import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':a191_0x230e70(0x12a),'command':a191_0x230e70(0x13d),'description':a191_0x230e70(0x12c),'risk':a191_0x230e70(0x139),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0xa4a0e3){const _0x25cafc=a191_0x230e70,_0x4f91fd=await Promise[_0x25cafc(0x138)](APP_RULE_TYPES[_0x25cafc(0x134)](_0x2caa1f=>getAppRule(_0xa4a0e3[_0x25cafc(0x133)],{'appCode':_0xa4a0e3[_0x25cafc(0x132)],'type':_0x2caa1f}))),_0x21b3f9=APP_RULE_TYPES[_0x25cafc(0x134)]((_0x2c95b9,_0x4e9f3f)=>projectAppRule(_0x2c95b9,_0x4f91fd[_0x4e9f3f]??null));return{'ok':!![],'data':{'total':_0x21b3f9[_0x25cafc(0x13a)],'rules':_0x21b3f9},'message':_0x25cafc(0x137)+_0xa4a0e3[_0x25cafc(0x132)]};}};
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from "../../framework/types.js";
2
+ export declare const ruleSet: CommandDefinition;
@@ -0,0 +1 @@
1
+ const a192_0x2573c5=a192_0xeb35;(function(_0x45935f,_0x1cbfb8){const _0x1c96af=a192_0xeb35,_0x545953=_0x45935f();while(!![]){try{const _0x3e4e03=parseInt(_0x1c96af(0x119))/0x1*(parseInt(_0x1c96af(0x11e))/0x2)+-parseInt(_0x1c96af(0x11d))/0x3*(-parseInt(_0x1c96af(0x115))/0x4)+-parseInt(_0x1c96af(0x108))/0x5+parseInt(_0x1c96af(0xfb))/0x6+-parseInt(_0x1c96af(0x112))/0x7+-parseInt(_0x1c96af(0x12d))/0x8*(parseInt(_0x1c96af(0xfd))/0x9)+parseInt(_0x1c96af(0x117))/0xa*(parseInt(_0x1c96af(0x130))/0xb);if(_0x3e4e03===_0x1cbfb8)break;else _0x545953['push'](_0x545953['shift']());}catch(_0x2e6c07){_0x545953['push'](_0x545953['shift']());}}}(a192_0x58a8,0xd6548));import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';const SAVE_PATH=a192_0x2573c5(0x122),NON_ATOMIC_WARNING=a192_0x2573c5(0x11a);function a192_0xeb35(_0x3626e1,_0x3075a4){_0x3626e1=_0x3626e1-0xf5;const _0x58a875=a192_0x58a8();let _0xeb3531=_0x58a875[_0x3626e1];return _0xeb3531;}function readSetInput(_0x17b1ac){const _0x16956f=a192_0x2573c5,_0x3a6df0=readAppRuleType(_0x17b1ac),_0x5b9398=_0x17b1ac['str'](_0x16956f(0x104))['trim']();if(!_0x5b9398)throw appRuleError('app_rule_file_required',_0x16956f(0x109),_0x16956f(0x10d));const _0x135dd3=_0x17b1ac[_0x16956f(0x129)](_0x16956f(0xfe));let _0x33b11f;if(_0x135dd3!==undefined){_0x33b11f=Number(_0x135dd3);if(!Number[_0x16956f(0x10e)](_0x33b11f)||_0x33b11f<0x0)throw appRuleError(_0x16956f(0xf8),_0x16956f(0xf6));}return{'type':_0x3a6df0,'file':_0x5b9398,'expectedVersion':_0x33b11f};}async function prepareSet(_0xda97b3){const _0x33a6b7=a192_0x2573c5,_0x413dd8=readSetInput(_0xda97b3),_0x3cd76e=await readAppRuleFile(_0x413dd8[_0x33a6b7(0x104)]),_0x19ce11=await getAppRule(_0xda97b3[_0x33a6b7(0x11b)],{'appCode':_0xda97b3[_0x33a6b7(0x113)],'type':_0x413dd8[_0x33a6b7(0x107)]});if(_0x413dd8[_0x33a6b7(0xf9)]!==undefined&&_0x19ce11?.[_0x33a6b7(0xf7)]!==_0x413dd8[_0x33a6b7(0xf9)])throw appRuleError(_0x33a6b7(0x118),appRuleFileName(_0x413dd8[_0x33a6b7(0x107)])+_0x33a6b7(0x12e),_0x33a6b7(0x12c)+_0x413dd8[_0x33a6b7(0xf9)]+_0x33a6b7(0x131)+(_0x19ce11?.[_0x33a6b7(0xf7)]??'unconfigured')+_0x33a6b7(0x125));return{'input':_0x413dd8,'replacement':_0x3cd76e,'beforeRecord':_0x19ce11,'before':projectAppRule(_0x413dd8[_0x33a6b7(0x107)],_0x19ce11),'planned':{'type':_0x413dd8['type'],'fileName':appRuleFileName(_0x413dd8[_0x33a6b7(0x107)]),'contextScope':appRuleContextScope(_0x413dd8[_0x33a6b7(0x107)]),'enabled':!![],'appCode':_0xda97b3[_0x33a6b7(0x113)],'scope':_0x33a6b7(0x11c),'contentByteSize':_0x3cd76e[_0x33a6b7(0x11f)],'contentHash':_0x3cd76e[_0x33a6b7(0x101)]}};}function warningsFor(_0x37a7d6){return _0x37a7d6===undefined?[]:[NON_ATOMIC_WARNING];}export const ruleSet={'service':'rule','command':a192_0x2573c5(0x114),'description':a192_0x2573c5(0x110),'risk':a192_0x2573c5(0xff),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a192_0x2573c5(0x104),'type':a192_0x2573c5(0xfa),'required':!![],'description':'UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)'},{'name':a192_0x2573c5(0xfe),'type':'number','required':![],'description':a192_0x2573c5(0xfc)}],async 'validate'(_0x1cc97c){readSetInput(_0x1cc97c);},async 'dryRun'(_0x442880){const _0x16be11=a192_0x2573c5,_0x494e08=await prepareSet(_0x442880);return asDryRunResult({'operation':_0x16be11(0x114),'selector':{'appCode':_0x442880[_0x16be11(0x113)],'scope':'rules','type':_0x494e08['input']['type']},'before':_0x494e08[_0x16be11(0x123)],'after':_0x494e08[_0x16be11(0x105)],'dryRun':!![],'backend':{'method':_0x16be11(0xf5),'path':SAVE_PATH},'warnings':warningsFor(_0x494e08[_0x16be11(0x124)][_0x16be11(0xf9)]),'verification':{'expectedVersion':_0x494e08['input'][_0x16be11(0xf9)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x16be11(0x12f)+_0x494e08[_0x16be11(0x124)][_0x16be11(0x107)]+_0x16be11(0x116)}},{'method':_0x16be11(0xf5),'url':SAVE_PATH});},async 'execute'(_0x232caf){const _0xca4465=a192_0x2573c5,_0x1154f2=await prepareSet(_0x232caf);let _0x304c62=![];try{await saveAppRule(_0x232caf[_0xca4465(0x11b)],{'appCode':_0x232caf['appCode'],'type':_0x1154f2[_0xca4465(0x124)]['type'],'content':_0x1154f2[_0xca4465(0x126)][_0xca4465(0x12a)]});}catch(_0x5712e1){if(!isPlatformTransportFailure(_0x5712e1))throw _0x5712e1;_0x304c62=!![];}let _0x1d80d2;try{_0x1d80d2=await getAppRule(_0x232caf[_0xca4465(0x11b)],{'appCode':_0x232caf[_0xca4465(0x113)],'type':_0x1154f2[_0xca4465(0x124)][_0xca4465(0x107)]});}catch(_0x1a5d44){const _0x210a2b=appRuleError(_0x304c62?_0xca4465(0x10a):'app_rule_verification_unavailable',_0xca4465(0x127)+appRuleFileName(_0x1154f2[_0xca4465(0x124)][_0xca4465(0x107)])+_0xca4465(0x12b),_0xca4465(0x10b));Object['defineProperty'](_0x210a2b,_0xca4465(0x10c),{'value':_0x1a5d44,'enumerable':![]});throw _0x210a2b;}const _0x244132=_0x1d80d2&&inspectAppRuleContent(_0x1d80d2[_0xca4465(0x12a)])[_0xca4465(0x101)]===_0x1154f2[_0xca4465(0x126)][_0xca4465(0x101)],_0x3e9d53=_0x1d80d2&&(_0x1154f2[_0xca4465(0x121)]===null||_0x1d80d2['version']>_0x1154f2['beforeRecord'][_0xca4465(0xf7)]);if(!_0x1d80d2||!_0x244132||!_0x3e9d53)throw appRuleError(_0x304c62?_0xca4465(0x10a):_0xca4465(0x106),appRuleFileName(_0x1154f2[_0xca4465(0x124)]['type'])+'\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.',_0xca4465(0x120)+_0x1154f2['input'][_0xca4465(0x107)]+_0xca4465(0x128));const _0x334d62=warningsFor(_0x1154f2[_0xca4465(0x124)][_0xca4465(0xf9)]);_0x304c62&&_0x334d62[_0xca4465(0x102)](_0xca4465(0x111));const _0x2a4b1c=projectAppRule(_0x1154f2[_0xca4465(0x124)]['type'],_0x1d80d2);return{'ok':!![],'data':{'operation':_0xca4465(0x114),'selector':{'appCode':_0x232caf[_0xca4465(0x113)],'scope':_0xca4465(0x11c),'type':_0x1154f2['input'][_0xca4465(0x107)]},'before':_0x1154f2[_0xca4465(0x123)],'after':_0x2a4b1c,'dryRun':![],'backend':{'method':_0xca4465(0xf5),'path':SAVE_PATH},'warnings':_0x334d62,'verification':{'status':_0xca4465(0x103),'recoveredAfterUnknownResponse':_0x304c62,'expectedVersion':_0x1154f2[_0xca4465(0x124)][_0xca4465(0xf9)]??null,'atomicCompareAndSet':![],'lookupCommand':'rabetbase\x20rule\x20get\x20--type\x20'+_0x1154f2['input'][_0xca4465(0x107)]+_0xca4465(0x116)}},'message':_0xca4465(0x100)+appRuleFileName(_0x1154f2[_0xca4465(0x124)][_0xca4465(0x107)])+_0xca4465(0x10f)+_0x232caf[_0xca4465(0x113)]};}};function a192_0x58a8(){const _0x20a2b7=['7234260sAQXgr','Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version','8718615ZHSsjk','expected-version','write','Set\x20','contentHash','push','verified','file','planned','app_rule_verification_failed','type','3637820CeqWTn','--file\x20is\x20required.','app_rule_set_outcome_unknown','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','cause','Pass\x20a\x20UTF-8\x20Markdown\x20file.','isSafeInteger','\x20for\x20','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','2106587GCFVbX','appCode','set','2205472kBDHgY','\x20--format\x20compress','50SSVmEg','app_rule_version_mismatch','265324ekhowb','--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.','cookie','rules','3iNRmfy','4VRERtD','byteSize','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','beforeRecord','/smartapi/knowledge-base/save','before','input','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','replacement','The\x20set\x20request\x20was\x20sent,\x20but\x20','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','flag','content','\x20could\x20not\x20be\x20verified.','Expected\x20','8rgggpk','\x20version\x20changed\x20before\x20write.','rabetbase\x20rule\x20get\x20--type\x20','1292302kvkEUq',';\x20current\x20version\x20is\x20','POST','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','version','app_rule_expected_version_invalid','expectedVersion','string'];a192_0x58a8=function(){return _0x20a2b7;};return a192_0x58a8();}
@@ -0,0 +1,43 @@
1
+ import type { AppRuleRecord, AppRuleType } from "../../core/api-client.js";
2
+ import { CliError } from "../../errors.js";
3
+ import type { RuntimeContext } from "../../framework/types.js";
4
+ export declare const APP_RULE_TYPES: readonly AppRuleType[];
5
+ export declare const MAX_APP_RULE_BYTES: number;
6
+ export type AppRuleContextScope = "page-api-development" | "database-analysis";
7
+ export declare function appRuleError(code: string, message: string, hint?: string): CliError;
8
+ export declare function readAppRuleType(ctx: RuntimeContext): AppRuleType;
9
+ export declare function appRuleFileName(type: AppRuleType): "RULES.md" | "DATABASE.md";
10
+ export declare function appRuleContextScope(type: AppRuleType): AppRuleContextScope;
11
+ export interface AppRuleContent {
12
+ content: string;
13
+ byteSize: number;
14
+ contentHash: string;
15
+ }
16
+ export declare function inspectAppRuleContent(content: string): AppRuleContent;
17
+ export declare function readAppRuleFile(filePath: string): Promise<AppRuleContent>;
18
+ export declare function projectAppRule(type: AppRuleType, record: AppRuleRecord | null): {
19
+ type: AppRuleType;
20
+ fileName: "RULES.md" | "DATABASE.md";
21
+ contextScope: AppRuleContextScope;
22
+ enabled: boolean;
23
+ } | {
24
+ updateTime?: string | number | undefined;
25
+ createTime?: string | number | undefined;
26
+ type: AppRuleType;
27
+ fileName: "RULES.md" | "DATABASE.md";
28
+ contextScope: AppRuleContextScope;
29
+ enabled: boolean;
30
+ id: number;
31
+ scope: "rules";
32
+ appCode: string;
33
+ version: number;
34
+ contentByteSize: number;
35
+ contentHash: string;
36
+ };
37
+ export declare const APP_RULE_TYPE_FLAG: {
38
+ name: string;
39
+ type: "string";
40
+ required: boolean;
41
+ description: string;
42
+ enum: AppRuleType[];
43
+ };
@@ -0,0 +1 @@
1
+ const a193_0x13ccbb=a193_0x5ac9;(function(_0x2e5bcc,_0x59c149){const _0x20ec9c=a193_0x5ac9,_0x2b9c6f=_0x2e5bcc();while(!![]){try{const _0x57581d=parseInt(_0x20ec9c(0x15b))/0x1*(parseInt(_0x20ec9c(0x160))/0x2)+parseInt(_0x20ec9c(0x15d))/0x3+parseInt(_0x20ec9c(0x141))/0x4*(-parseInt(_0x20ec9c(0x145))/0x5)+-parseInt(_0x20ec9c(0x149))/0x6+parseInt(_0x20ec9c(0x14e))/0x7*(-parseInt(_0x20ec9c(0x154))/0x8)+-parseInt(_0x20ec9c(0x15a))/0x9+parseInt(_0x20ec9c(0x14a))/0xa;if(_0x57581d===_0x59c149)break;else _0x2b9c6f['push'](_0x2b9c6f['shift']());}catch(_0x40d42e){_0x2b9c6f['push'](_0x2b9c6f['shift']());}}}(a193_0x2d3e,0x6fe03));import{createHash}from'node:crypto';function a193_0x2d3e(){const _0x3b46d2=['rules','Pass\x20a\x20UTF-8\x20Markdown\x20file.','1472715lbfbzh','112251WvDyWC','str','1350726ZAYanF','update','RULES.md','4hSxvyC','hex','app_rule_content_too_large','trim','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','isFile','Cannot\x20access\x20app\x20rule\x20file:\x20','decode','byteSize','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','digest','app_rule_type_invalid','version','contentHash','createTime','byteLength','43124JxLHXR','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','utf8','255JJLsyZ','from','app_rule_file_unreadable','database-analysis','1548822ZUdWWm','8496610iipfdz','app_rule_file_required','utf-8','message','661913BEIiUu','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','string','toLowerCase','app_rule_file_invalid','updateTime','8utwUYe','type','app_rule_content_invalid','--file\x20is\x20required.'];a193_0x2d3e=function(){return _0x3b46d2;};return a193_0x2d3e();}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=[a193_0x13ccbb(0x158),'database'];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a193_0x13ccbb(0x15f),'database':'DATABASE.md'},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':a193_0x13ccbb(0x148)};function a193_0x5ac9(_0x88e666,_0x34ded8){_0x88e666=_0x88e666-0x13e;const _0x2d3edc=a193_0x2d3e();let _0x5ac928=_0x2d3edc[_0x88e666];return _0x5ac928;}export function appRuleError(_0x457833,_0x16cf7c,_0x385c26){return new CliError(_0x457833,0x1,_0x16cf7c,_0x385c26);}export function readAppRuleType(_0x2ccc16){const _0x184655=a193_0x13ccbb,_0x4abd84=_0x2ccc16[_0x184655(0x15c)](_0x184655(0x155))[_0x184655(0x163)]()[_0x184655(0x151)]();if(_0x4abd84!==_0x184655(0x158)&&_0x4abd84!=='database')throw appRuleError(_0x184655(0x16b),_0x184655(0x164));return _0x4abd84;}export function appRuleFileName(_0x53cd61){return APP_RULE_FILES[_0x53cd61];}export function appRuleContextScope(_0x2c90a6){return APP_RULE_CONTEXT_SCOPES[_0x2c90a6];}export function inspectAppRuleContent(_0x59b325){const _0x4f3e79=a193_0x13ccbb,_0x1b3347=Buffer[_0x4f3e79(0x146)](_0x59b325,_0x4f3e79(0x144));return{'content':_0x59b325,'byteSize':_0x1b3347[_0x4f3e79(0x140)],'contentHash':'sha256:'+createHash('sha256')[_0x4f3e79(0x15e)](_0x1b3347)[_0x4f3e79(0x16a)](_0x4f3e79(0x161))};}export async function readAppRuleFile(_0x24b29a){const _0x279963=a193_0x13ccbb,_0x50467d=_0x24b29a[_0x279963(0x163)]();if(!_0x50467d)throw appRuleError(_0x279963(0x14b),_0x279963(0x157),_0x279963(0x159));const _0x413b06=resolve(_0x50467d);let _0x3643a1;try{_0x3643a1=await stat(_0x413b06);}catch(_0x2c63a5){throw appRuleError(_0x279963(0x147),_0x279963(0x166)+_0x50467d,_0x2c63a5 instanceof Error?_0x2c63a5[_0x279963(0x14d)]:String(_0x2c63a5));}if(!_0x3643a1[_0x279963(0x165)]())throw appRuleError(_0x279963(0x152),_0x279963(0x143)+_0x50467d);if(_0x3643a1['size']>MAX_APP_RULE_BYTES)throw appRuleError('app_rule_content_too_large',_0x279963(0x142));let _0x26ce78;try{_0x26ce78=await readFile(_0x413b06);}catch(_0x21eadf){throw appRuleError('app_rule_file_unreadable','Cannot\x20read\x20app\x20rule\x20file:\x20'+_0x50467d,_0x21eadf instanceof Error?_0x21eadf[_0x279963(0x14d)]:String(_0x21eadf));}if(_0x26ce78[_0x279963(0x140)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x279963(0x162),'App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.');let _0x264bdb;try{_0x264bdb=new TextDecoder(_0x279963(0x14c),{'fatal':!![],'ignoreBOM':!![]})[_0x279963(0x167)](_0x26ce78);}catch{throw appRuleError(_0x279963(0x156),_0x279963(0x14f)+_0x50467d);}if(!_0x264bdb[_0x279963(0x163)]())throw appRuleError('app_rule_content_invalid','App\x20rule\x20file\x20is\x20blank:\x20'+_0x50467d);return inspectAppRuleContent(_0x264bdb);}export function projectAppRule(_0x409d43,_0x1b6a6e){const _0x5705f=a193_0x13ccbb;if(!_0x1b6a6e)return{'type':_0x409d43,'fileName':appRuleFileName(_0x409d43),'contextScope':appRuleContextScope(_0x409d43),'enabled':![]};const _0x8633ce=inspectAppRuleContent(_0x1b6a6e['content']);return{'type':_0x409d43,'fileName':appRuleFileName(_0x409d43),'contextScope':appRuleContextScope(_0x409d43),'enabled':!![],'id':_0x1b6a6e['id'],'scope':_0x1b6a6e['scope'],'appCode':_0x1b6a6e['appCode'],'version':_0x1b6a6e[_0x5705f(0x16c)],'contentByteSize':_0x8633ce[_0x5705f(0x168)],'contentHash':_0x8633ce[_0x5705f(0x13e)],..._0x1b6a6e['createTime']!==undefined&&_0x1b6a6e[_0x5705f(0x13f)]!==null?{'createTime':_0x1b6a6e['createTime']}:{},..._0x1b6a6e[_0x5705f(0x153)]!==undefined&&_0x1b6a6e[_0x5705f(0x153)]!==null?{'updateTime':_0x1b6a6e['updateTime']}:{}};}export const APP_RULE_TYPE_FLAG={'name':a193_0x13ccbb(0x155),'type':a193_0x13ccbb(0x150),'required':!![],'description':a193_0x13ccbb(0x169),'enum':[...APP_RULE_TYPES]};
@@ -1 +1 @@
1
- const a188_0x48de1d=a188_0x1134;function a188_0x1134(_0x2def65,_0x2097b1){_0x2def65=_0x2def65-0x8e;const _0x4a4c01=a188_0x4a4c();let _0x113425=_0x4a4c01[_0x2def65];return _0x113425;}(function(_0xa836ed,_0x423842){const _0xa16166=a188_0x1134,_0x197dca=_0xa836ed();while(!![]){try{const _0xf31f8d=-parseInt(_0xa16166(0xb3))/0x1+parseInt(_0xa16166(0xc7))/0x2*(-parseInt(_0xa16166(0xa2))/0x3)+-parseInt(_0xa16166(0x9c))/0x4+-parseInt(_0xa16166(0xab))/0x5*(parseInt(_0xa16166(0xae))/0x6)+-parseInt(_0xa16166(0x97))/0x7*(parseInt(_0xa16166(0xbc))/0x8)+-parseInt(_0xa16166(0x95))/0x9+parseInt(_0xa16166(0xb2))/0xa;if(_0xf31f8d===_0x423842)break;else _0x197dca['push'](_0x197dca['shift']());}catch(_0x226653){_0x197dca['push'](_0x197dca['shift']());}}}(a188_0x4a4c,0xa3e4e));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{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set(['start',a188_0x48de1d(0xa7)]);function readPackageScripts(_0x78d372){const _0x4a75e4=a188_0x48de1d,_0x559fda=resolve(_0x78d372,_0x4a75e4(0xaf));if(!existsSync(_0x559fda))return null;try{const _0x572d64=JSON[_0x4a75e4(0xcb)](readFileSync(_0x559fda,_0x4a75e4(0xb1)));return _0x572d64[_0x4a75e4(0xbf)]??{};}catch{return null;}}function detectPackageManager(_0x3f42e4){const _0x48aaea=a188_0x48de1d;if(existsSync(resolve(_0x3f42e4,_0x48aaea(0x98)))||existsSync(resolve(_0x3f42e4,'bun.lock')))return'bun';if(existsSync(resolve(_0x3f42e4,_0x48aaea(0xba))))return _0x48aaea(0x8f);if(existsSync(resolve(_0x3f42e4,_0x48aaea(0xb5))))return'yarn';return _0x48aaea(0xbb);}async function versionCheck(_0x193c94){const _0x26910d=a188_0x48de1d,_0x1f5d5d=await checkCliVersion();(_0x1f5d5d['needsUpgrade']||_0x1f5d5d[_0x26910d(0xb6)])&&(printCliUpgradeWarning(_0x1f5d5d),assertCliVersionSupported(_0x1f5d5d));const _0x1bc003=await checkSdkVersion(_0x193c94);if(_0x1bc003[_0x26910d(0xbe)])printSdkUpgradeWarning(_0x1bc003);}function a188_0x4a4c(){const _0x47b33a=['close','\x20\x20EXAMPLES','5326GqAmvb','preview','\x20run\x20preview','Script\x20name\x20defined\x20in\x20package.json','parse','write','pnpm','vite','\x22\x20not\x20found\x20in\x20package.json.','node_modules','args','build','6660486RJZesx','\x20\x20\x20\x20','50400zprIhP','bun.lockb','validation','keys','log','1067920bEyLDX','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','.bin','Enable\x20watch\x20mode\x20for\x20preview','has','No\x20package.json\x20found\x20in\x20current\x20directory.','213CMBPRi','\x0a\x20\x20Available\x20scripts:\x0a','script','inherit','slice','dev','bool','all','join','4175NREnzk','--watch','\x20run\x20build','1500xVlgfu','package.json','Run\x20a\x20package.json\x20script','utf-8','45242100HnPCtX','1260043ercsCg','boolean','yarn.lock','belowMinimum','\x20run\x20start','length','(none)','pnpm-lock.yaml','npm','1320NRyvlo','push','needsUpgrade','scripts','run','\x20run\x20preview\x20--watch','watch','No\x20scripts\x20defined\x20in\x20package.json.','error'];a188_0x4a4c=function(){return _0x47b33a;};return a188_0x4a4c();}function spawnScript(_0x50aa20,_0x1dd3b2,_0x54f68c,_0x131bb4){return new Promise((_0x1f5909,_0x3d1f6d)=>{const _0x4c3f4e=a188_0x1134,_0x437f64=[_0x4c3f4e(0xc0),_0x1dd3b2,..._0x54f68c],_0x91d755=spawn(_0x50aa20,_0x437f64,{'cwd':_0x131bb4,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x131bb4,'node_modules','.bin')+delimiter+process.env.PATH}});_0x91d755['on'](_0x4c3f4e(0xc5),_0x522ab1=>{if(_0x522ab1===0x0||_0x522ab1===null)_0x1f5909();else _0x3d1f6d(new Error(_0x50aa20+'\x20run\x20'+_0x1dd3b2+'\x20exited\x20with\x20code\x20'+_0x522ab1));}),_0x91d755['on'](_0x4c3f4e(0xc4),_0x3d1f6d);});}function spawnViteBuildWatch(_0x1604a4){return new Promise((_0x14b23f,_0xcb9131)=>{const _0x23cd9b=a188_0x1134,_0x3203f3=spawn(_0x23cd9b(0x90),[_0x23cd9b(0x94),_0x23cd9b(0xac)],{'cwd':_0x1604a4,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x1604a4,'node_modules',_0x23cd9b(0x9e))+delimiter+process.env.PATH}});_0x3203f3['on']('close',_0x44faae=>{const _0x516027=_0x23cd9b;if(_0x44faae===0x0||_0x44faae===null)_0x14b23f();else _0xcb9131(new Error(_0x516027(0x9d)+_0x44faae));}),_0x3203f3['on'](_0x23cd9b(0xc4),_0xcb9131);});}function spawnVitePreview(_0x663296){return new Promise((_0x119d4b,_0x893dc9)=>{const _0x202b86=a188_0x1134,_0x1cc755=spawn(_0x202b86(0x90),[_0x202b86(0xc8)],{'cwd':_0x663296,'stdio':_0x202b86(0xa5),'shell':!![],'env':{...process.env,'PATH':''+join(_0x663296,_0x202b86(0x92),_0x202b86(0x9e))+delimiter+process.env.PATH}});_0x1cc755['on']('close',_0xdad6df=>{if(_0xdad6df===0x0||_0xdad6df===null)_0x119d4b();else _0x893dc9(new Error('vite\x20preview\x20exited\x20with\x20code\x20'+_0xdad6df));}),_0x1cc755['on'](_0x202b86(0xc4),_0x893dc9);});}const runFlags=[{'name':a188_0x48de1d(0xc2),'type':a188_0x48de1d(0xb4),'description':a188_0x48de1d(0x9f),'default':![]}];export const runDefinition={'service':'run','command':a188_0x48de1d(0xc0),'description':a188_0x48de1d(0xb0),'risk':a188_0x48de1d(0x8e),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a188_0x48de1d(0xa4),'description':a188_0x48de1d(0xca),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x17d4a5=a188_0x48de1d,_0x14cc6c=[];return _0x14cc6c[_0x17d4a5(0xbd)](_0x17d4a5(0xc6)),_0x14cc6c[_0x17d4a5(0xbd)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x17d4a5(0xb7)),_0x14cc6c[_0x17d4a5(0xbd)](_0x17d4a5(0x96)+CLI_BIN_NAME+_0x17d4a5(0xad)),_0x14cc6c[_0x17d4a5(0xbd)](_0x17d4a5(0x96)+CLI_BIN_NAME+_0x17d4a5(0xc9)),_0x14cc6c[_0x17d4a5(0xbd)](_0x17d4a5(0x96)+CLI_BIN_NAME+_0x17d4a5(0xc1)),_0x14cc6c[_0x17d4a5(0xaa)]('\x0a');},async 'execute'(_0x660d01){const _0x5444e9=a188_0x48de1d,_0x21f669=process['cwd'](),_0x99d628=_0x660d01[_0x5444e9(0x93)][0x0],_0x1ce8a4=_0x660d01[_0x5444e9(0x93)][_0x5444e9(0xa6)](0x1),_0x4706e6=readPackageScripts(_0x21f669);if(!_0x4706e6)throw CliErrors[_0x5444e9(0x99)](_0x5444e9(0xa1));if(!_0x99d628){const _0x48ea68=Object[_0x5444e9(0x9a)](_0x4706e6);if(_0x48ea68[_0x5444e9(0xb8)]===0x0)console[_0x5444e9(0x9b)](_0x5444e9(0xc3));else{console[_0x5444e9(0x9b)](_0x5444e9(0xa3));for(const _0x38eb11 of _0x48ea68){console[_0x5444e9(0x9b)]('\x20\x20\x20\x20'+_0x38eb11);}console[_0x5444e9(0x9b)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x4706e6[_0x99d628])throw CliErrors[_0x5444e9(0x99)]('Script\x20\x22'+_0x99d628+_0x5444e9(0x91),'Available:\x20'+(Object[_0x5444e9(0x9a)](_0x4706e6)[_0x5444e9(0xaa)](',\x20')||_0x5444e9(0xb9)));const _0x230203=detectPackageManager(_0x21f669);VERSION_CHECK_SCRIPTS[_0x5444e9(0xa0)](_0x99d628)&&await versionCheck(_0x21f669);if(_0x99d628==='preview'&&_0x660d01[_0x5444e9(0xa8)](_0x5444e9(0xc2)))return await Promise[_0x5444e9(0xa9)]([spawnViteBuildWatch(_0x21f669),spawnVitePreview(_0x21f669)]),{'ok':!![]};return await spawnScript(_0x230203,_0x99d628,_0x1ce8a4,_0x21f669),{'ok':!![]};}};
1
+ const a194_0x9dd38b=a194_0x5ea2;(function(_0x10a797,_0x30b805){const _0x238fd7=a194_0x5ea2,_0x29ce03=_0x10a797();while(!![]){try{const _0xd21f7a=parseInt(_0x238fd7(0x181))/0x1+parseInt(_0x238fd7(0x18b))/0x2+-parseInt(_0x238fd7(0x186))/0x3*(parseInt(_0x238fd7(0x18a))/0x4)+parseInt(_0x238fd7(0x174))/0x5+parseInt(_0x238fd7(0x1a3))/0x6+-parseInt(_0x238fd7(0x18e))/0x7+parseInt(_0x238fd7(0x177))/0x8*(-parseInt(_0x238fd7(0x170))/0x9);if(_0xd21f7a===_0x30b805)break;else _0x29ce03['push'](_0x29ce03['shift']());}catch(_0x401902){_0x29ce03['push'](_0x29ce03['shift']());}}}(a194_0x3193,0x39201));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';function a194_0x3193(){const _0x2ee1c1=['inherit','bun.lock','\x20\x20EXAMPLES','length','Script\x20\x22','error','\x20run\x20<script>\x0a','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','\x20run\x20preview\x20--watch','pnpm-lock.yaml','dev','1714134lolZyj','No\x20package.json\x20found\x20in\x20current\x20directory.','start','cwd','push','bun.lockb','args','(none)','27NNDKRs','run','No\x20scripts\x20defined\x20in\x20package.json.','\x0a\x20\x20Available\x20scripts:\x0a','90640RuPUFZ','build','pnpm','505320oXnDOx','Enable\x20watch\x20mode\x20for\x20preview','\x20run\x20start','validation','Script\x20name\x20defined\x20in\x20package.json','npm','close','utf-8','keys','vite','446874oJvbQw','preview','Available:\x20','\x22\x20not\x20found\x20in\x20package.json.','vite\x20preview\x20exited\x20with\x20code\x20','6207WTzJGE','\x20run\x20build','\x20\x20\x20\x20','belowMinimum','712tsfQCd','570514WhLUQN','scripts','needsUpgrade','1709302YHJoEC','yarn','script','bun','log','node_modules','\x20exited\x20with\x20code\x20','has','package.json','.bin'];a194_0x3193=function(){return _0x2ee1c1;};return a194_0x3193();}import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';function a194_0x5ea2(_0x58644c,_0x30723c){_0x58644c=_0x58644c-0x16a;const _0x3193a9=a194_0x3193();let _0x5ea297=_0x3193a9[_0x58644c];return _0x5ea297;}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([a194_0x9dd38b(0x16a),a194_0x9dd38b(0x1a2)]);function readPackageScripts(_0x1113fc){const _0x2f9fb3=a194_0x9dd38b,_0x28e9bd=resolve(_0x1113fc,_0x2f9fb3(0x196));if(!existsSync(_0x28e9bd))return null;try{const _0x3708ca=JSON['parse'](readFileSync(_0x28e9bd,_0x2f9fb3(0x17e)));return _0x3708ca[_0x2f9fb3(0x18c)]??{};}catch{return null;}}function detectPackageManager(_0x2275f2){const _0x378bdf=a194_0x9dd38b;if(existsSync(resolve(_0x2275f2,_0x378bdf(0x16d)))||existsSync(resolve(_0x2275f2,_0x378bdf(0x199))))return _0x378bdf(0x191);if(existsSync(resolve(_0x2275f2,_0x378bdf(0x1a1))))return _0x378bdf(0x176);if(existsSync(resolve(_0x2275f2,'yarn.lock')))return _0x378bdf(0x18f);return _0x378bdf(0x17c);}async function versionCheck(_0x5b5a15){const _0x1efdd1=a194_0x9dd38b,_0x324c4e=await checkCliVersion();(_0x324c4e[_0x1efdd1(0x18d)]||_0x324c4e[_0x1efdd1(0x189)])&&(printCliUpgradeWarning(_0x324c4e),assertCliVersionSupported(_0x324c4e));const _0x5e1ea1=await checkSdkVersion(_0x5b5a15);if(_0x5e1ea1['needsUpgrade'])printSdkUpgradeWarning(_0x5e1ea1);}function spawnScript(_0x2e618f,_0x372060,_0x3d2c5d,_0x38a995){return new Promise((_0xf8890b,_0x5536ef)=>{const _0xef8549=a194_0x5ea2,_0x2dc60e=[_0xef8549(0x171),_0x372060,..._0x3d2c5d],_0x5ceb47=spawn(_0x2e618f,_0x2dc60e,{'cwd':_0x38a995,'stdio':_0xef8549(0x198),'shell':!![],'env':{...process.env,'PATH':''+join(_0x38a995,'node_modules',_0xef8549(0x197))+delimiter+process.env.PATH}});_0x5ceb47['on']('close',_0x4dd519=>{const _0x56ce53=_0xef8549;if(_0x4dd519===0x0||_0x4dd519===null)_0xf8890b();else _0x5536ef(new Error(_0x2e618f+'\x20run\x20'+_0x372060+_0x56ce53(0x194)+_0x4dd519));}),_0x5ceb47['on']('error',_0x5536ef);});}function spawnViteBuildWatch(_0x349d5a){return new Promise((_0x5646c6,_0x35c80b)=>{const _0x1e7413=a194_0x5ea2,_0x509e0e=spawn(_0x1e7413(0x180),[_0x1e7413(0x175),'--watch'],{'cwd':_0x349d5a,'stdio':_0x1e7413(0x198),'shell':!![],'env':{...process.env,'PATH':''+join(_0x349d5a,_0x1e7413(0x193),_0x1e7413(0x197))+delimiter+process.env.PATH}});_0x509e0e['on'](_0x1e7413(0x17d),_0x168ec5=>{const _0x3b5d7c=_0x1e7413;if(_0x168ec5===0x0||_0x168ec5===null)_0x5646c6();else _0x35c80b(new Error(_0x3b5d7c(0x19f)+_0x168ec5));}),_0x509e0e['on'](_0x1e7413(0x19d),_0x35c80b);});}function spawnVitePreview(_0x531fb1){return new Promise((_0x368010,_0x5524fc)=>{const _0x5db71d=a194_0x5ea2,_0x5c5036=spawn(_0x5db71d(0x180),['preview'],{'cwd':_0x531fb1,'stdio':_0x5db71d(0x198),'shell':!![],'env':{...process.env,'PATH':''+join(_0x531fb1,'node_modules',_0x5db71d(0x197))+delimiter+process.env.PATH}});_0x5c5036['on'](_0x5db71d(0x17d),_0x1fc45e=>{const _0x3aee61=_0x5db71d;if(_0x1fc45e===0x0||_0x1fc45e===null)_0x368010();else _0x5524fc(new Error(_0x3aee61(0x185)+_0x1fc45e));}),_0x5c5036['on'](_0x5db71d(0x19d),_0x5524fc);});}const runFlags=[{'name':'watch','type':'boolean','description':a194_0x9dd38b(0x178),'default':![]}];export const runDefinition={'service':'run','command':'run','description':'Run\x20a\x20package.json\x20script','risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a194_0x9dd38b(0x190),'description':a194_0x9dd38b(0x17b),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x24b387=a194_0x9dd38b,_0x301093=[];return _0x301093[_0x24b387(0x16c)](_0x24b387(0x19a)),_0x301093['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x24b387(0x179)),_0x301093[_0x24b387(0x16c)](_0x24b387(0x188)+CLI_BIN_NAME+_0x24b387(0x187)),_0x301093[_0x24b387(0x16c)](_0x24b387(0x188)+CLI_BIN_NAME+'\x20run\x20preview'),_0x301093['push'](_0x24b387(0x188)+CLI_BIN_NAME+_0x24b387(0x1a0)),_0x301093['join']('\x0a');},async 'execute'(_0x2888c1){const _0x546bb7=a194_0x9dd38b,_0x2cba8a=process[_0x546bb7(0x16b)](),_0x5c5303=_0x2888c1[_0x546bb7(0x16e)][0x0],_0xfaff52=_0x2888c1[_0x546bb7(0x16e)]['slice'](0x1),_0x266492=readPackageScripts(_0x2cba8a);if(!_0x266492)throw CliErrors[_0x546bb7(0x17a)](_0x546bb7(0x1a4));if(!_0x5c5303){const _0x44ca88=Object[_0x546bb7(0x17f)](_0x266492);if(_0x44ca88[_0x546bb7(0x19b)]===0x0)console[_0x546bb7(0x192)](_0x546bb7(0x172));else{console['log'](_0x546bb7(0x173));for(const _0x270bc6 of _0x44ca88){console['log'](_0x546bb7(0x188)+_0x270bc6);}console[_0x546bb7(0x192)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+_0x546bb7(0x19e));}return{'ok':!![]};}if(!_0x266492[_0x5c5303])throw CliErrors[_0x546bb7(0x17a)](_0x546bb7(0x19c)+_0x5c5303+_0x546bb7(0x184),_0x546bb7(0x183)+(Object['keys'](_0x266492)['join'](',\x20')||_0x546bb7(0x16f)));const _0xf39d45=detectPackageManager(_0x2cba8a);VERSION_CHECK_SCRIPTS[_0x546bb7(0x195)](_0x5c5303)&&await versionCheck(_0x2cba8a);if(_0x5c5303===_0x546bb7(0x182)&&_0x2888c1['bool']('watch'))return await Promise['all']([spawnViteBuildWatch(_0x2cba8a),spawnVitePreview(_0x2cba8a)]),{'ok':!![]};return await spawnScript(_0xf39d45,_0x5c5303,_0xfaff52,_0x2cba8a),{'ok':!![]};}};
@@ -1 +1 @@
1
- function a189_0x1001(_0x361234,_0x30e65a){_0x361234=_0x361234-0x85;const _0x1574ba=a189_0x1574();let _0x100187=_0x1574ba[_0x361234];return _0x100187;}const a189_0x3cd805=a189_0x1001;(function(_0x5cfe6f,_0x2aac87){const _0x29d2a2=a189_0x1001,_0x9ad6a=_0x5cfe6f();while(!![]){try{const _0x26d4ad=parseInt(_0x29d2a2(0x85))/0x1*(-parseInt(_0x29d2a2(0x88))/0x2)+parseInt(_0x29d2a2(0x86))/0x3+-parseInt(_0x29d2a2(0x89))/0x4+parseInt(_0x29d2a2(0x8d))/0x5+-parseInt(_0x29d2a2(0x90))/0x6*(-parseInt(_0x29d2a2(0x92))/0x7)+parseInt(_0x29d2a2(0x91))/0x8+parseInt(_0x29d2a2(0x8a))/0x9;if(_0x26d4ad===_0x2aac87)break;else _0x9ad6a['push'](_0x9ad6a['shift']());}catch(_0x5795a5){_0x9ad6a['push'](_0x9ad6a['shift']());}}}(a189_0x1574,0x64f5e));import{buildSchemaPayload}from'../framework/schema-export.js';function a189_0x1574(){const _0x5a5306=['export','1726635ZASfcB','Export\x20machine-readable\x20command\x20schema\x20(JSON)','read','588cNlHeu','2006544aYjQLh','6874kWmHZx','15221nWhdkN','245343vDezjT','json','78NZdgAi','300172YPmwDb','2772306YIlgmt','schema'];a189_0x1574=function(){return _0x5a5306;};return a189_0x1574();}async function execute(_0x1372c9){const _0x4d237c=await buildSchemaPayload();return{'ok':!![],'data':_0x4d237c};}export const schemaDefinition={'service':a189_0x3cd805(0x8b),'command':a189_0x3cd805(0x8c),'description':a189_0x3cd805(0x8e),'risk':a189_0x3cd805(0x8f),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a189_0x3cd805(0x87),'flags':[],'execute':execute};
1
+ const a195_0x480b1f=a195_0x1061;(function(_0x5c9c1a,_0x1f3945){const _0xbe4e64=a195_0x1061,_0x2d08ed=_0x5c9c1a();while(!![]){try{const _0x37b586=-parseInt(_0xbe4e64(0x177))/0x1*(-parseInt(_0xbe4e64(0x180))/0x2)+-parseInt(_0xbe4e64(0x178))/0x3+parseInt(_0xbe4e64(0x17a))/0x4*(parseInt(_0xbe4e64(0x17d))/0x5)+-parseInt(_0xbe4e64(0x17c))/0x6*(parseInt(_0xbe4e64(0x175))/0x7)+-parseInt(_0xbe4e64(0x179))/0x8+parseInt(_0xbe4e64(0x17b))/0x9+parseInt(_0xbe4e64(0x176))/0xa;if(_0x37b586===_0x1f3945)break;else _0x2d08ed['push'](_0x2d08ed['shift']());}catch(_0x5abbed){_0x2d08ed['push'](_0x2d08ed['shift']());}}}(a195_0x2ab8,0xc3bad));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x115a21){const _0x5b73f2=await buildSchemaPayload();return{'ok':!![],'data':_0x5b73f2};}function a195_0x1061(_0x3e4cc2,_0x466703){_0x3e4cc2=_0x3e4cc2-0x175;const _0x2ab875=a195_0x2ab8();let _0x1061cc=_0x2ab875[_0x3e4cc2];return _0x1061cc;}export const schemaDefinition={'service':'schema','command':a195_0x480b1f(0x181),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a195_0x480b1f(0x17f),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a195_0x480b1f(0x17e),'flags':[],'execute':execute};function a195_0x2ab8(){const _0x44c97e=['376NgiWNp','export','28veitOH','9867560ViEJsk','865OeKMed','4246017CDqMXY','3040608uOvwgq','3286076BPPOAb','12724677nqpNpG','1181436kPtCmG','5HBExvG','json','read'];a195_0x2ab8=function(){return _0x44c97e;};return a195_0x2ab8();}
@@ -1 +1 @@
1
- const a190_0x3297d1=a190_0x1254;(function(_0x17f3b4,_0x1b36f1){const _0x246368=a190_0x1254,_0x8dc3d8=_0x17f3b4();while(!![]){try{const _0x5a0d23=-parseInt(_0x246368(0x10c))/0x1+-parseInt(_0x246368(0x121))/0x2+parseInt(_0x246368(0xfe))/0x3*(-parseInt(_0x246368(0x120))/0x4)+parseInt(_0x246368(0x102))/0x5+parseInt(_0x246368(0xff))/0x6+-parseInt(_0x246368(0x10b))/0x7+parseInt(_0x246368(0x131))/0x8*(parseInt(_0x246368(0x122))/0x9);if(_0x5a0d23===_0x1b36f1)break;else _0x8dc3d8['push'](_0x8dc3d8['shift']());}catch(_0x206d74){_0x8dc3d8['push'](_0x8dc3d8['shift']());}}}(a190_0x19d9,0x6c24f));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(_0x26bfce){const _0x428236=a190_0x1254;if(_0x26bfce===_0x428236(0x12d))return[_0x428236(0x110),_0x428236(0x135),_0x428236(0x10f),''][_0x428236(0x126)]('\x0a');return[_0x428236(0x127),'']['join']('\x0a');}export const sqlCreate={'service':'sql','command':'create','description':a190_0x3297d1(0x101),'risk':a190_0x3297d1(0x10e),'flags':[{'name':a190_0x3297d1(0x123),'type':'string','description':'SQL\x20query\x20display\x20name'},{'name':a190_0x3297d1(0x130),'type':a190_0x3297d1(0x128),'description':a190_0x3297d1(0x132)},{'name':a190_0x3297d1(0xf6),'type':a190_0x3297d1(0x11b),'enum':[a190_0x3297d1(0x125),a190_0x3297d1(0x12d)],'description':a190_0x3297d1(0x109)}],async 'validate'(_0x460048){const _0x28ffdb=a190_0x3297d1;if(!_0x460048[_0x28ffdb(0xf5)])return;if(!_0x460048[_0x28ffdb(0x104)](_0x28ffdb(0x123))[_0x28ffdb(0x12e)]())throw CliErrors[_0x28ffdb(0x114)](_0x28ffdb(0x123),_0x28ffdb(0x11e));const _0x562803=resolveProvidedDbId(_0x460048);if(typeof _0x562803!==_0x28ffdb(0x128)||!Number[_0x28ffdb(0x100)](_0x562803)||_0x562803<=0x0)throw CliErrors[_0x28ffdb(0x114)]('db-id',_0x28ffdb(0xf7));if(!_0x460048['str'](_0x28ffdb(0xf6))[_0x28ffdb(0x12e)]())throw CliErrors['flagMissing'](_0x28ffdb(0xf6),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x401286){const _0xecfeec=a190_0x3297d1,_0x1e139f=loadSqlProjectConfig(_0x401286['appCode']),{sqlName:_0x6c0463,dbId:_0x4d642c,dbName:_0x549c8b,mode:_0x2d3252}=await resolveSqlNewInputs(_0x401286),_0x18df0f=buildSqlRelativePath(_0xecfeec(0xfd),_0x6c0463,_0x549c8b,_0x2d3252,_0x4d642c),_0x89c6d7=_0x1e139f[_0xecfeec(0x11a)]+'/'+_0x18df0f;return{'method':_0xecfeec(0xfb),'url':_0xecfeec(0x12a),'body':{'appCode':_0x401286[_0xecfeec(0x11c)],'sqlName':_0x6c0463,'dbId':_0x4d642c,'mode':_0x2d3252,'localPath':_0x89c6d7},'description':_0xecfeec(0x133)+_0x1e139f[_0xecfeec(0x11a)]};},async 'execute'(_0x5c4490){const _0x2b3f28=a190_0x3297d1,_0xf163f9=loadSqlProjectConfig(_0x5c4490[_0x2b3f28(0x11c)]),{sqlName:_0x1d83f5,dbId:_0x18e4cb,dbName:_0x423949,mode:_0x24d42e}=await resolveSqlNewInputs(_0x5c4490),_0x2b9f87=generateSqlTemplate(_0x24d42e),_0x3dcc2f=await createSqlQuery({'appCode':_0x5c4490[_0x2b3f28(0x11c)],'sqlName':_0x1d83f5,'dbId':_0x18e4cb,'sqlContent':_0x2b9f87}),_0x402688=ensureRemoteSqlContent(_0x3dcc2f),_0x4dc9dd=_0x423949||await getDbName(_0x5c4490['appCode'],_0x18e4cb)[_0x2b3f28(0x12f)](()=>undefined),_0x212516=buildSqlRelativePath(_0x3dcc2f[_0x2b3f28(0x118)],_0x3dcc2f[_0x2b3f28(0xf3)],_0x4dc9dd,_0x24d42e,_0x18e4cb),_0x56b898=_0xf163f9['sqlRootDir']+'/'+_0x212516,_0x59df5c=buildLocalSqlFileContent({'sqlCode':_0x3dcc2f[_0x2b3f28(0x118)],'sqlName':_0x3dcc2f[_0x2b3f28(0xf3)],'dbId':_0x3dcc2f[_0x2b3f28(0x119)]},_0x402688,{'dbName':_0x4dc9dd,'mode':_0x24d42e,'syncedAt':new Date()[_0x2b3f28(0x11f)](),'description':_0x3dcc2f[_0x2b3f28(0x129)]});if(await fileExists(_0x56b898))throw CliErrors[_0x2b3f28(0xfc)](_0x2b3f28(0xf4)+_0x56b898);await ensureParentDirectory(_0x56b898),await writeFile(_0x56b898,_0x59df5c,_0x2b3f28(0x11d));const _0x2bb0ef=await readSqlLockFile(_0xf163f9[_0x2b3f28(0x10d)]),{lockData:_0xe9a2a9,appLock:_0x393c29}=ensureSqlLockScope(_0x2bb0ef??createEmptySqlLock(),_0xf163f9['appCode'],_0xf163f9[_0x2b3f28(0x10a)],_0x2b3f28(0x136));return _0x393c29['sqls'][_0x3dcc2f[_0x2b3f28(0x118)]]={...buildSqlLockEntry(_0x3dcc2f,_0x402688,computeSqlContentHash(_0x59df5c),{'dbName':_0x4dc9dd}),'path':_0x212516,'mode':_0x24d42e},_0x393c29[_0x2b3f28(0x116)]=new Date()['toISOString'](),await writeSqlLockFile(_0xf163f9[_0x2b3f28(0x10d)],_0xe9a2a9),{'ok':!![],'data':{'id':_0x3dcc2f['id'],'sqlCode':_0x3dcc2f[_0x2b3f28(0x118)],'sqlName':_0x3dcc2f[_0x2b3f28(0xf3)],'dbId':_0x3dcc2f['dbId'],'path':_0x56b898,'mode':_0x24d42e},'message':_0x2b3f28(0x12b)+_0x3dcc2f['sqlCode']};}};function a190_0x1254(_0x3a0748,_0x27ee9f){_0x3a0748=_0x3a0748-0xf2;const _0x19d95f=a190_0x19d9();let _0x1254a4=_0x19d95f[_0x3a0748];return _0x1254a4;}async function resolveSqlNewInputs(_0x7552a8){const _0x1931cf=await resolveSqlNameInput(_0x7552a8),{dbId:_0x459ade,dbName:_0x36195f}=await resolveDbSelection(_0x7552a8),_0x300dfe=await resolveSqlModeInput(_0x7552a8);return{'sqlName':_0x1931cf,'dbId':_0x459ade,'dbName':_0x36195f,'mode':_0x300dfe};}async function resolveSqlNameInput(_0xb6e08a){const _0x4c41ce=a190_0x3297d1,_0x54918d=_0xb6e08a[_0x4c41ce(0x104)](_0x4c41ce(0x123))[_0x4c41ce(0x12e)]();if(_0x54918d)return _0x54918d;if(_0xb6e08a[_0x4c41ce(0xf5)])throw CliErrors['flagMissing'](_0x4c41ce(0x123),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x4c41ce(0xfa),'validate':_0x5ef6dc=>_0x5ef6dc[_0x4c41ce(0x12e)]()?!![]:_0x4c41ce(0x112)}))[_0x4c41ce(0x12e)]();}async function resolveDbSelection(_0x361d14){const _0x724d9c=a190_0x3297d1,_0x4e8a18=resolveProvidedDbId(_0x361d14);if(typeof _0x4e8a18==='number'&&Number[_0x724d9c(0x100)](_0x4e8a18)&&_0x4e8a18>0x0)return{'dbId':_0x4e8a18,'dbName':await getDbName(_0x361d14[_0x724d9c(0x11c)],_0x4e8a18)[_0x724d9c(0x12f)](()=>undefined)};if(_0x361d14[_0x724d9c(0xf5)])throw CliErrors['flagMissing'](_0x724d9c(0x130),_0x724d9c(0xf7));const _0x255c89=await listDatabases(_0x361d14[_0x724d9c(0x11c)])[_0x724d9c(0x12f)](()=>[]);if(_0x255c89[_0x724d9c(0x137)]===0x1)return{'dbId':_0x255c89[0x0][_0x724d9c(0x119)],'dbName':_0x255c89[0x0]['dbName']};if(_0x255c89[_0x724d9c(0x137)]>0x1){const _0x5d1dfa=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0x255c89[_0x724d9c(0x108)](_0x5bbaf8=>({'name':_0x5bbaf8[_0x724d9c(0xf8)]+'\x20('+_0x5bbaf8[_0x724d9c(0x119)]+')','value':serializeDbSelection(_0x5bbaf8)})),{'name':_0x724d9c(0xf9),'value':_0x724d9c(0x117)}]});if(_0x5d1dfa!==_0x724d9c(0x117))return deserializeDbSelection(_0x5d1dfa);}const _0x2b9a99=await input({'message':_0x724d9c(0x113),'validate':_0x3ca7b9=>{const _0x9d8653=_0x724d9c,_0x13ccf9=_0x3ca7b9[_0x9d8653(0x12e)]();if(!_0x13ccf9)return'dbId\x20cannot\x20be\x20empty';const _0x38b9e2=Number(_0x13ccf9);if(!Number[_0x9d8653(0x115)](_0x38b9e2)||_0x38b9e2<=0x0)return _0x9d8653(0x134);return!![];}});return{'dbId':Number(_0x2b9a99['trim']())};}async function resolveSqlModeInput(_0x48e7ba){const _0x382be7=a190_0x3297d1,_0x3c7123=_0x48e7ba[_0x382be7(0x104)](_0x382be7(0xf6))[_0x382be7(0x12e)]();if(_0x3c7123===_0x382be7(0x125)||_0x3c7123==='mybatisXml')return _0x3c7123;if(_0x48e7ba[_0x382be7(0xf5)])throw CliErrors[_0x382be7(0x114)](_0x382be7(0xf6),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':'Select\x20the\x20local\x20SQL\x20mode:','choices':[{'name':_0x382be7(0x111),'value':_0x382be7(0x125),'description':_0x382be7(0x105)},{'name':_0x382be7(0x106),'value':_0x382be7(0x12d),'description':_0x382be7(0x124)}]});}function serializeDbSelection(_0x544ae2){const _0xb70fa=a190_0x3297d1;return JSON[_0xb70fa(0x12c)]({'dbId':_0x544ae2['dbId'],'dbName':_0x544ae2[_0xb70fa(0xf8)]});}function a190_0x19d9(){const _0x4d8c62=['dbName','✎\x20Enter\x20dbId\x20manually','SQL\x20name:','POST','validation','<server-generated-sqlCode>','66477QjlAIj','3327828yJBcPg','isFinite','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','2962605gThxVc','flag','str','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','MyBatis\x20XML\x20(mybatisXml)','Invalid\x20database\x20selection\x20payload:\x20','map','Local\x20SQL\x20file\x20mode','sqlRoot','473046GRhKTk','344510PytloL','lockFilePath','write','</select>','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','Plain\x20SQL\x20(sql)','SQL\x20name\x20cannot\x20be\x20empty','Target\x20database\x20dbId:','flagMissing','isInteger','lastSync','__manual__','sqlCode','dbId','sqlRootDir','string','appCode','utf8','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','toISOString','124xwjAQY','831524XeBbjG','2431737bDvFse','name','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','sql','join','SELECT\x201\x20AS\x20id;','number','description','/smartapi/custom/saveUserCustomSql','Created\x20SQL\x20query\x20','stringify','mybatisXml','trim','catch','db-id','24bKEUYS','Target\x20database\x20ID','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','dbId\x20must\x20be\x20a\x20positive\x20integer','\x20\x20SELECT\x201\x20AS\x20id','new','length','parse','sqlName','File\x20already\x20exists:\x20','nonInteractive','mode','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.'];a190_0x19d9=function(){return _0x4d8c62;};return a190_0x19d9();}function deserializeDbSelection(_0x425a6b){const _0x587d27=a190_0x3297d1;try{const _0xeffba=JSON[_0x587d27(0xf2)](_0x425a6b);if(typeof _0xeffba['dbId']===_0x587d27(0x128)&&Number[_0x587d27(0x100)](_0xeffba['dbId']))return{'dbId':_0xeffba[_0x587d27(0x119)],'dbName':_0xeffba[_0x587d27(0xf8)]};}catch{}throw CliErrors[_0x587d27(0xfc)](_0x587d27(0x107)+_0x425a6b);}function resolveProvidedDbId(_0x19054a){const _0x136fc6=a190_0x3297d1,_0x434f94=_0x19054a[_0x136fc6(0x103)]('db-id');if(typeof _0x434f94==='number'&&Number[_0x136fc6(0x100)](_0x434f94))return _0x434f94;return undefined;}
1
+ const a196_0x244776=a196_0xd99b;(function(_0x4a2f56,_0x3accd0){const _0x59fec1=a196_0xd99b,_0x3990aa=_0x4a2f56();while(!![]){try{const _0x2ac65d=parseInt(_0x59fec1(0x207))/0x1+-parseInt(_0x59fec1(0x1f5))/0x2+-parseInt(_0x59fec1(0x1f2))/0x3+-parseInt(_0x59fec1(0x20a))/0x4+-parseInt(_0x59fec1(0x200))/0x5+parseInt(_0x59fec1(0x21d))/0x6*(parseInt(_0x59fec1(0x1fb))/0x7)+parseInt(_0x59fec1(0x1e8))/0x8*(parseInt(_0x59fec1(0x21c))/0x9);if(_0x2ac65d===_0x3accd0)break;else _0x3990aa['push'](_0x3990aa['shift']());}catch(_0x119a2e){_0x3990aa['push'](_0x3990aa['shift']());}}}(a196_0x346d,0x40e3f));function a196_0xd99b(_0x5e8457,_0x1b3171){_0x5e8457=_0x5e8457-0x1e7;const _0x346dae=a196_0x346d();let _0xd99b20=_0x346dae[_0x5e8457];return _0xd99b20;}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';function a196_0x346d(){const _0xfd6764=['Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','8NhLcWa','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','parse','Local\x20SQL\x20file\x20mode','number','lockFilePath','appCode','sqlRoot','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','121125mCrjwC','sqlName','str','265850yxYNeQ','isFinite','join','stringify','utf8','flagMissing','1739612ewXero','sqlCode','name','POST','length','593160pXvSgp','Plain\x20SQL\x20(sql)','Created\x20SQL\x20query\x20','SQL\x20name\x20cannot\x20be\x20empty','SQL\x20name:','Target\x20database\x20ID','SQL\x20query\x20display\x20name','86922kbVkYk','catch','dbId\x20cannot\x20be\x20empty','245908TbiFyr','new','File\x20already\x20exists:\x20','map','dbId\x20must\x20be\x20a\x20positive\x20integer','nonInteractive','validation','__manual__','write','dbId','sqlRootDir','toISOString','description','db-id','MyBatis\x20XML\x20(mybatisXml)','Select\x20the\x20target\x20database:','trim','mode','2553858jrvYhB','6ihJggW','sql','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','</select>','Select\x20the\x20local\x20SQL\x20mode:','SELECT\x201\x20AS\x20id;','create','mybatisXml','string','dbName','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'];a196_0x346d=function(){return _0xfd6764;};return a196_0x346d();}import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x26600d){const _0x44502a=a196_0xd99b;if(_0x26600d===_0x44502a(0x224))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','\x20\x20SELECT\x201\x20AS\x20id',_0x44502a(0x220),''][_0x44502a(0x1f7)]('\x0a');return[_0x44502a(0x222),''][_0x44502a(0x1f7)]('\x0a');}export const sqlCreate={'service':a196_0x244776(0x21e),'command':a196_0x244776(0x223),'description':a196_0x244776(0x1e7),'risk':a196_0x244776(0x212),'flags':[{'name':a196_0x244776(0x1fd),'type':a196_0x244776(0x225),'description':a196_0x244776(0x206)},{'name':a196_0x244776(0x217),'type':a196_0x244776(0x1ed),'description':a196_0x244776(0x205)},{'name':a196_0x244776(0x21b),'type':'string','enum':[a196_0x244776(0x21e),a196_0x244776(0x224)],'description':a196_0x244776(0x1ec)}],async 'validate'(_0x1ad0f8){const _0x5a5980=a196_0x244776;if(!_0x1ad0f8[_0x5a5980(0x20f)])return;if(!_0x1ad0f8[_0x5a5980(0x1f4)](_0x5a5980(0x1fd))['trim']())throw CliErrors[_0x5a5980(0x1fa)](_0x5a5980(0x1fd),_0x5a5980(0x1ea));const _0x2f70d2=resolveProvidedDbId(_0x1ad0f8);if(typeof _0x2f70d2!==_0x5a5980(0x1ed)||!Number['isFinite'](_0x2f70d2)||_0x2f70d2<=0x0)throw CliErrors[_0x5a5980(0x1fa)](_0x5a5980(0x217),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x1ad0f8[_0x5a5980(0x1f4)](_0x5a5980(0x21b))[_0x5a5980(0x21a)]())throw CliErrors['flagMissing'](_0x5a5980(0x21b),_0x5a5980(0x21f));},async 'dryRun'(_0x4373c8){const _0x3dc7cd=a196_0x244776,_0x260716=loadSqlProjectConfig(_0x4373c8[_0x3dc7cd(0x1ef)]),{sqlName:_0x45a015,dbId:_0x35d0ef,dbName:_0x6166f5,mode:_0x20058b}=await resolveSqlNewInputs(_0x4373c8),_0x576fcf=buildSqlRelativePath('<server-generated-sqlCode>',_0x45a015,_0x6166f5,_0x20058b,_0x35d0ef),_0x56fd40=_0x260716['sqlRootDir']+'/'+_0x576fcf;return{'method':_0x3dc7cd(0x1fe),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x4373c8[_0x3dc7cd(0x1ef)],'sqlName':_0x45a015,'dbId':_0x35d0ef,'mode':_0x20058b,'localPath':_0x56fd40},'description':_0x3dc7cd(0x227)+_0x260716[_0x3dc7cd(0x214)]};},async 'execute'(_0x5646d2){const _0x43d4bd=a196_0x244776,_0x5edebd=loadSqlProjectConfig(_0x5646d2[_0x43d4bd(0x1ef)]),{sqlName:_0x401152,dbId:_0x4c5721,dbName:_0x5ae6d3,mode:_0x3fa456}=await resolveSqlNewInputs(_0x5646d2),_0x1fe9b8=generateSqlTemplate(_0x3fa456),_0x1ea5e2=await createSqlQuery({'appCode':_0x5646d2[_0x43d4bd(0x1ef)],'sqlName':_0x401152,'dbId':_0x4c5721,'sqlContent':_0x1fe9b8}),_0xefaab2=ensureRemoteSqlContent(_0x1ea5e2),_0x4da70d=_0x5ae6d3||await getDbName(_0x5646d2['appCode'],_0x4c5721)[_0x43d4bd(0x208)](()=>undefined),_0x191438=buildSqlRelativePath(_0x1ea5e2['sqlCode'],_0x1ea5e2[_0x43d4bd(0x1f3)],_0x4da70d,_0x3fa456,_0x4c5721),_0x5c0caf=_0x5edebd[_0x43d4bd(0x214)]+'/'+_0x191438,_0x350bd1=buildLocalSqlFileContent({'sqlCode':_0x1ea5e2[_0x43d4bd(0x1fc)],'sqlName':_0x1ea5e2[_0x43d4bd(0x1f3)],'dbId':_0x1ea5e2['dbId']},_0xefaab2,{'dbName':_0x4da70d,'mode':_0x3fa456,'syncedAt':new Date()[_0x43d4bd(0x215)](),'description':_0x1ea5e2[_0x43d4bd(0x216)]});if(await fileExists(_0x5c0caf))throw CliErrors[_0x43d4bd(0x210)](_0x43d4bd(0x20c)+_0x5c0caf);await ensureParentDirectory(_0x5c0caf),await writeFile(_0x5c0caf,_0x350bd1,_0x43d4bd(0x1f9));const _0x111aa3=await readSqlLockFile(_0x5edebd[_0x43d4bd(0x1ee)]),{lockData:_0x14137b,appLock:_0x1662e2}=ensureSqlLockScope(_0x111aa3??createEmptySqlLock(),_0x5edebd[_0x43d4bd(0x1ef)],_0x5edebd[_0x43d4bd(0x1f0)],_0x43d4bd(0x20b));return _0x1662e2['sqls'][_0x1ea5e2['sqlCode']]={...buildSqlLockEntry(_0x1ea5e2,_0xefaab2,computeSqlContentHash(_0x350bd1),{'dbName':_0x4da70d}),'path':_0x191438,'mode':_0x3fa456},_0x1662e2['lastSync']=new Date()[_0x43d4bd(0x215)](),await writeSqlLockFile(_0x5edebd[_0x43d4bd(0x1ee)],_0x14137b),{'ok':!![],'data':{'id':_0x1ea5e2['id'],'sqlCode':_0x1ea5e2[_0x43d4bd(0x1fc)],'sqlName':_0x1ea5e2[_0x43d4bd(0x1f3)],'dbId':_0x1ea5e2[_0x43d4bd(0x213)],'path':_0x5c0caf,'mode':_0x3fa456},'message':_0x43d4bd(0x202)+_0x1ea5e2[_0x43d4bd(0x1fc)]};}};async function resolveSqlNewInputs(_0x5f0b2b){const _0x45d829=await resolveSqlNameInput(_0x5f0b2b),{dbId:_0x578e15,dbName:_0x127e96}=await resolveDbSelection(_0x5f0b2b),_0x58ac36=await resolveSqlModeInput(_0x5f0b2b);return{'sqlName':_0x45d829,'dbId':_0x578e15,'dbName':_0x127e96,'mode':_0x58ac36};}async function resolveSqlNameInput(_0x5b59b2){const _0x5a3aba=a196_0x244776,_0x27bfe6=_0x5b59b2['str'](_0x5a3aba(0x1fd))['trim']();if(_0x27bfe6)return _0x27bfe6;if(_0x5b59b2[_0x5a3aba(0x20f)])throw CliErrors[_0x5a3aba(0x1fa)]('name',_0x5a3aba(0x1ea));return(await input({'message':_0x5a3aba(0x204),'validate':_0x54d1c7=>_0x54d1c7[_0x5a3aba(0x21a)]()?!![]:_0x5a3aba(0x203)}))[_0x5a3aba(0x21a)]();}async function resolveDbSelection(_0x57e6c0){const _0x1a4e8d=a196_0x244776,_0x5eb8b5=resolveProvidedDbId(_0x57e6c0);if(typeof _0x5eb8b5===_0x1a4e8d(0x1ed)&&Number[_0x1a4e8d(0x1f6)](_0x5eb8b5)&&_0x5eb8b5>0x0)return{'dbId':_0x5eb8b5,'dbName':await getDbName(_0x57e6c0[_0x1a4e8d(0x1ef)],_0x5eb8b5)[_0x1a4e8d(0x208)](()=>undefined)};if(_0x57e6c0[_0x1a4e8d(0x20f)])throw CliErrors[_0x1a4e8d(0x1fa)](_0x1a4e8d(0x217),_0x1a4e8d(0x1f1));const _0x29873b=await listDatabases(_0x57e6c0[_0x1a4e8d(0x1ef)])['catch'](()=>[]);if(_0x29873b[_0x1a4e8d(0x1ff)]===0x1)return{'dbId':_0x29873b[0x0]['dbId'],'dbName':_0x29873b[0x0][_0x1a4e8d(0x226)]};if(_0x29873b[_0x1a4e8d(0x1ff)]>0x1){const _0x5c97d6=await select({'message':_0x1a4e8d(0x219),'choices':[..._0x29873b[_0x1a4e8d(0x20d)](_0x3bdf48=>({'name':_0x3bdf48['dbName']+'\x20('+_0x3bdf48['dbId']+')','value':serializeDbSelection(_0x3bdf48)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':_0x1a4e8d(0x211)}]});if(_0x5c97d6!==_0x1a4e8d(0x211))return deserializeDbSelection(_0x5c97d6);}const _0x42744a=await input({'message':'Target\x20database\x20dbId:','validate':_0x4cc554=>{const _0x3c4cb8=_0x1a4e8d,_0x4105fc=_0x4cc554['trim']();if(!_0x4105fc)return _0x3c4cb8(0x209);const _0x49444a=Number(_0x4105fc);if(!Number['isInteger'](_0x49444a)||_0x49444a<=0x0)return _0x3c4cb8(0x20e);return!![];}});return{'dbId':Number(_0x42744a[_0x1a4e8d(0x21a)]())};}async function resolveSqlModeInput(_0x151f50){const _0x50eff9=a196_0x244776,_0x42f37c=_0x151f50[_0x50eff9(0x1f4)](_0x50eff9(0x21b))[_0x50eff9(0x21a)]();if(_0x42f37c==='sql'||_0x42f37c===_0x50eff9(0x224))return _0x42f37c;if(_0x151f50[_0x50eff9(0x20f)])throw CliErrors[_0x50eff9(0x1fa)](_0x50eff9(0x21b),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x50eff9(0x221),'choices':[{'name':_0x50eff9(0x201),'value':_0x50eff9(0x21e),'description':_0x50eff9(0x1e9)},{'name':_0x50eff9(0x218),'value':_0x50eff9(0x224),'description':'For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags'}]});}function serializeDbSelection(_0x25be48){const _0x529588=a196_0x244776;return JSON[_0x529588(0x1f8)]({'dbId':_0x25be48['dbId'],'dbName':_0x25be48[_0x529588(0x226)]});}function deserializeDbSelection(_0x47eb5e){const _0x34d849=a196_0x244776;try{const _0x34e430=JSON[_0x34d849(0x1eb)](_0x47eb5e);if(typeof _0x34e430[_0x34d849(0x213)]==='number'&&Number[_0x34d849(0x1f6)](_0x34e430[_0x34d849(0x213)]))return{'dbId':_0x34e430[_0x34d849(0x213)],'dbName':_0x34e430[_0x34d849(0x226)]};}catch{}throw CliErrors['validation']('Invalid\x20database\x20selection\x20payload:\x20'+_0x47eb5e);}function resolveProvidedDbId(_0xf202fb){const _0x31717b=a196_0x244776,_0x44560a=_0xf202fb['flag'](_0x31717b(0x217));if(typeof _0x44560a===_0x31717b(0x1ed)&&Number[_0x31717b(0x1f6)](_0x44560a))return _0x44560a;return undefined;}
@@ -1 +1 @@
1
- const a191_0x4ceaee=a191_0x501d;(function(_0xdfe81c,_0x26f066){const _0x46ee2d=a191_0x501d,_0x16b26e=_0xdfe81c();while(!![]){try{const _0x362ef7=parseInt(_0x46ee2d(0xf3))/0x1*(-parseInt(_0x46ee2d(0x108))/0x2)+-parseInt(_0x46ee2d(0x104))/0x3+parseInt(_0x46ee2d(0xfa))/0x4+-parseInt(_0x46ee2d(0xfd))/0x5+-parseInt(_0x46ee2d(0x10e))/0x6+-parseInt(_0x46ee2d(0x112))/0x7*(parseInt(_0x46ee2d(0x106))/0x8)+parseInt(_0x46ee2d(0x103))/0x9;if(_0x362ef7===_0x26f066)break;else _0x16b26e['push'](_0x16b26e['shift']());}catch(_0x310b0e){_0x16b26e['push'](_0x16b26e['shift']());}}}(a191_0x22ff,0x8b9de));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';function a191_0x22ff(){const _0x56f41b=['delete','trashedTo','26960022itvKcL','532902oTCihU','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','24GdxHho','remoteId','122xHnIMf','projectRoot','validation','lastSync','toISOString','sqlRoot','3961620kNVhaJ','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','entries','startsWith','1484371cDapgN','sqlcode','POST','SQL\x20lock\x20file\x20not\x20found.','replace','length','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','high-risk-write','fromEntries','13378SXOvaU','sqls','sql','/smartapi/custom/deleteUserCustomSql','appCode','trashDir','str','2603764lQAqYX','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','\x20(local\x20file\x20moved\x20to\x20trash)','3922540vvYnmX','Would\x20delete\x20SQL\x20','lockFilePath','sqlRootDir'];a191_0x22ff=function(){return _0x56f41b;};return a191_0x22ff();}import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a191_0x4ceaee(0xf5),'command':a191_0x4ceaee(0x101),'description':a191_0x4ceaee(0xfb),'risk':a191_0x4ceaee(0xf1),'flags':[SQLCODE_FLAG],async 'validate'(_0x1c2ec2){const _0x188099=a191_0x4ceaee,_0x3fa988=loadSqlProjectConfig(_0x1c2ec2[_0x188099(0xf7)]),_0x291591=await readSqlLockFile(_0x3fa988[_0x188099(0xff)]);if(!_0x291591)throw CliErrors[_0x188099(0x10a)](_0x188099(0x105));},async 'dryRun'(_0x8b33b6){const _0x4fa637=a191_0x4ceaee,_0x2d023e=loadSqlProjectConfig(_0x8b33b6['appCode']),_0x1cc5f1=await readSqlLockFile(_0x2d023e['lockFilePath']);if(!_0x1cc5f1)throw CliErrors[_0x4fa637(0x10a)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x1f8cbd}=ensureSqlLockScope(_0x1cc5f1,_0x8b33b6[_0x4fa637(0xf7)],_0x2d023e[_0x4fa637(0x10d)],'delete'),_0x49518f=_0x8b33b6[_0x4fa637(0xf9)](_0x4fa637(0x113)),_0x5a54e0=_0x1f8cbd[_0x4fa637(0xf4)][_0x49518f];if(!_0x5a54e0)throw CliErrors[_0x4fa637(0x10a)](_0x4fa637(0x10f)+_0x49518f+'\x22.');return{'method':_0x4fa637(0x114),'url':_0x4fa637(0xf6),'body':{'sqlCode':_0x49518f,'id':_0x5a54e0[_0x4fa637(0x107)],'localPath':resolveLocalSqlFilePath(_0x2d023e,_0x49518f,_0x5a54e0)},'description':_0x4fa637(0xfe)+_0x49518f+_0x4fa637(0xf0)+_0x2d023e[_0x4fa637(0xf8)]};},async 'execute'(_0x2f4614){const _0x7202c5=a191_0x4ceaee,_0x3edd55=loadSqlProjectConfig(_0x2f4614[_0x7202c5(0xf7)]),_0x124af6=await readSqlLockFile(_0x3edd55['lockFilePath']);if(!_0x124af6)throw CliErrors[_0x7202c5(0x10a)](_0x7202c5(0xed));const {lockData:_0x5d50cb,appLock:_0x5af1c6}=ensureSqlLockScope(_0x124af6,_0x2f4614[_0x7202c5(0xf7)],_0x3edd55['sqlRoot'],_0x7202c5(0x101)),_0x5d59e2=_0x2f4614[_0x7202c5(0xf9)](_0x7202c5(0x113)),_0x1f32b7=_0x5af1c6[_0x7202c5(0xf4)][_0x5d59e2];if(!_0x1f32b7)throw CliErrors[_0x7202c5(0x10a)](_0x7202c5(0x10f)+_0x5d59e2+'\x22.');await deleteSqlQuery({'id':_0x1f32b7[_0x7202c5(0x107)],'sqlCode':_0x5d59e2}),_0x5af1c6[_0x7202c5(0xf4)]=Object[_0x7202c5(0xf2)](Object[_0x7202c5(0x110)](_0x5af1c6['sqls'])['filter'](([_0x3bfa46])=>_0x3bfa46!==_0x5d59e2)),_0x5af1c6[_0x7202c5(0x10b)]=new Date()[_0x7202c5(0x10c)](),await writeSqlLockFile(_0x3edd55[_0x7202c5(0xff)],_0x5d50cb);const _0x5767b4=resolveLocalSqlFilePath(_0x3edd55,_0x5d59e2,_0x1f32b7);let _0x2d1872;await fileExists(_0x5767b4)&&(_0x2d1872=await moveToTrash(_0x3edd55[_0x7202c5(0x109)],_0x3edd55[_0x7202c5(0xf8)],_0x5767b4),await cleanupEmptyDirectories(dirname(_0x5767b4),_0x3edd55[_0x7202c5(0x100)]));const _0x4be436={'deleted':_0x5d59e2,'remoteId':_0x1f32b7[_0x7202c5(0x107)]};if(_0x2d1872)_0x4be436[_0x7202c5(0x102)]=_0x2d1872;return{'ok':!![],'data':_0x4be436,'message':'Deleted\x20'+_0x5d59e2+(_0x2d1872?_0x7202c5(0xfc):'')};}};function a191_0x501d(_0x338ee7,_0x47a473){_0x338ee7=_0x338ee7-0xed;const _0x22ffb7=a191_0x22ff();let _0x501dc6=_0x22ffb7[_0x338ee7];return _0x501dc6;}async function moveToTrash(_0x22a04d,_0xe2f863,_0x134970){const _0x598557=a191_0x4ceaee,_0x320eab=new Date()['toISOString']()[_0x598557(0xee)](/[:.]/g,'-'),_0x2be874=relative(_0x22a04d,_0x134970),_0xbefa6c=join(_0xe2f863,_0x320eab,_0x2be874);return await mkdir(dirname(_0xbefa6c),{'recursive':!![]}),await rename(_0x134970,_0xbefa6c),_0xbefa6c;}async function cleanupEmptyDirectories(_0x5a75cf,_0x45bc64){const _0x19d956=a191_0x4ceaee;let _0x56f210=resolve(_0x5a75cf);const _0x4546e3=resolve(_0x45bc64);while(_0x56f210[_0x19d956(0x111)](''+_0x4546e3+sep)||_0x56f210===_0x4546e3){if(_0x56f210===_0x4546e3)return;try{const _0x4cb7cc=await readdir(_0x56f210);if(_0x4cb7cc[_0x19d956(0xef)]>0x0)return;await rmdir(_0x56f210);}catch{return;}_0x56f210=dirname(_0x56f210);}}
1
+ const a197_0x5544a1=a197_0x4350;(function(_0x5d1701,_0xe9512d){const _0x577ae8=a197_0x4350,_0x27ae66=_0x5d1701();while(!![]){try{const _0x14c652=parseInt(_0x577ae8(0x148))/0x1+parseInt(_0x577ae8(0x152))/0x2*(-parseInt(_0x577ae8(0x13f))/0x3)+-parseInt(_0x577ae8(0x145))/0x4+parseInt(_0x577ae8(0x141))/0x5+-parseInt(_0x577ae8(0x13a))/0x6*(-parseInt(_0x577ae8(0x13c))/0x7)+parseInt(_0x577ae8(0x15a))/0x8*(parseInt(_0x577ae8(0x13d))/0x9)+parseInt(_0x577ae8(0x142))/0xa*(-parseInt(_0x577ae8(0x15b))/0xb);if(_0x14c652===_0xe9512d)break;else _0x27ae66['push'](_0x27ae66['shift']());}catch(_0x34a273){_0x27ae66['push'](_0x27ae66['shift']());}}}(a197_0x2212,0xe3c0f));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a197_0x4350(_0xc66abe,_0x1f414c){_0xc66abe=_0xc66abe-0x135;const _0x22124d=a197_0x2212();let _0x4350bd=_0x22124d[_0xc66abe];return _0x4350bd;}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';function a197_0x2212(){const _0x1b6ad5=['70Ogzwcy','15752601tjdEMc','lastSync','110943mSrblm','trashedTo','2432865ivRmXL','2075630SwtUEU','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','validation','2258056dCUXqw','Deleted\x20','sqlcode','1098154VORBxl','delete','length','sqlRootDir','lockFilePath','/smartapi/custom/deleteUserCustomSql','\x20(local\x20file\x20moved\x20to\x20trash)','entries','POST','appCode','22FDAXOX','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','sqls','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','remoteId','Would\x20delete\x20SQL\x20','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','toISOString','8DrZDuq','154XWoDxk','projectRoot','SQL\x20lock\x20file\x20not\x20found.','high-risk-write','sql','filter','replace','str','startsWith','885030sfrABk','trashDir'];a197_0x2212=function(){return _0x1b6ad5;};return a197_0x2212();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a197_0x5544a1(0x135),'command':a197_0x5544a1(0x149),'description':a197_0x5544a1(0x155),'risk':a197_0x5544a1(0x15e),'flags':[SQLCODE_FLAG],async 'validate'(_0x379102){const _0xbfd4f8=a197_0x5544a1,_0x4da613=loadSqlProjectConfig(_0x379102[_0xbfd4f8(0x151)]),_0x22743c=await readSqlLockFile(_0x4da613[_0xbfd4f8(0x14c)]);if(!_0x22743c)throw CliErrors[_0xbfd4f8(0x144)](_0xbfd4f8(0x153));},async 'dryRun'(_0x3c130d){const _0x195a07=a197_0x5544a1,_0x23e0d6=loadSqlProjectConfig(_0x3c130d[_0x195a07(0x151)]),_0x19dc3f=await readSqlLockFile(_0x23e0d6[_0x195a07(0x14c)]);if(!_0x19dc3f)throw CliErrors['validation'](_0x195a07(0x153));const {appLock:_0x1524f4}=ensureSqlLockScope(_0x19dc3f,_0x3c130d[_0x195a07(0x151)],_0x23e0d6['sqlRoot'],_0x195a07(0x149)),_0xca07bc=_0x3c130d[_0x195a07(0x138)](_0x195a07(0x147)),_0x5f0aae=_0x1524f4['sqls'][_0xca07bc];if(!_0x5f0aae)throw CliErrors[_0x195a07(0x144)](_0x195a07(0x158)+_0xca07bc+'\x22.');return{'method':_0x195a07(0x150),'url':_0x195a07(0x14d),'body':{'sqlCode':_0xca07bc,'id':_0x5f0aae[_0x195a07(0x156)],'localPath':resolveLocalSqlFilePath(_0x23e0d6,_0xca07bc,_0x5f0aae)},'description':_0x195a07(0x157)+_0xca07bc+_0x195a07(0x143)+_0x23e0d6[_0x195a07(0x13b)]};},async 'execute'(_0x2df42c){const _0x3311ab=a197_0x5544a1,_0x2d29f9=loadSqlProjectConfig(_0x2df42c[_0x3311ab(0x151)]),_0x49235c=await readSqlLockFile(_0x2d29f9[_0x3311ab(0x14c)]);if(!_0x49235c)throw CliErrors['validation'](_0x3311ab(0x15d));const {lockData:_0x28d1f9,appLock:_0x2849e4}=ensureSqlLockScope(_0x49235c,_0x2df42c['appCode'],_0x2d29f9['sqlRoot'],_0x3311ab(0x149)),_0x5c6ef7=_0x2df42c[_0x3311ab(0x138)](_0x3311ab(0x147)),_0xada61=_0x2849e4[_0x3311ab(0x154)][_0x5c6ef7];if(!_0xada61)throw CliErrors[_0x3311ab(0x144)](_0x3311ab(0x158)+_0x5c6ef7+'\x22.');await deleteSqlQuery({'id':_0xada61[_0x3311ab(0x156)],'sqlCode':_0x5c6ef7}),_0x2849e4[_0x3311ab(0x154)]=Object['fromEntries'](Object[_0x3311ab(0x14f)](_0x2849e4['sqls'])[_0x3311ab(0x136)](([_0xb32f7e])=>_0xb32f7e!==_0x5c6ef7)),_0x2849e4[_0x3311ab(0x13e)]=new Date()[_0x3311ab(0x159)](),await writeSqlLockFile(_0x2d29f9[_0x3311ab(0x14c)],_0x28d1f9);const _0x212734=resolveLocalSqlFilePath(_0x2d29f9,_0x5c6ef7,_0xada61);let _0x4dc10d;await fileExists(_0x212734)&&(_0x4dc10d=await moveToTrash(_0x2d29f9[_0x3311ab(0x15c)],_0x2d29f9[_0x3311ab(0x13b)],_0x212734),await cleanupEmptyDirectories(dirname(_0x212734),_0x2d29f9[_0x3311ab(0x14b)]));const _0x522ba9={'deleted':_0x5c6ef7,'remoteId':_0xada61[_0x3311ab(0x156)]};if(_0x4dc10d)_0x522ba9[_0x3311ab(0x140)]=_0x4dc10d;return{'ok':!![],'data':_0x522ba9,'message':_0x3311ab(0x146)+_0x5c6ef7+(_0x4dc10d?_0x3311ab(0x14e):'')};}};async function moveToTrash(_0x2deba8,_0x18d0e7,_0x1130e4){const _0x3a9d6f=a197_0x5544a1,_0x2fd99e=new Date()[_0x3a9d6f(0x159)]()[_0x3a9d6f(0x137)](/[:.]/g,'-'),_0xae658=relative(_0x2deba8,_0x1130e4),_0x48e377=join(_0x18d0e7,_0x2fd99e,_0xae658);return await mkdir(dirname(_0x48e377),{'recursive':!![]}),await rename(_0x1130e4,_0x48e377),_0x48e377;}async function cleanupEmptyDirectories(_0x449ef1,_0x2717c3){const _0x35d7e4=a197_0x5544a1;let _0x8aacb9=resolve(_0x449ef1);const _0x22f509=resolve(_0x2717c3);while(_0x8aacb9[_0x35d7e4(0x139)](''+_0x22f509+sep)||_0x8aacb9===_0x22f509){if(_0x8aacb9===_0x22f509)return;try{const _0x2b817d=await readdir(_0x8aacb9);if(_0x2b817d[_0x35d7e4(0x14a)]>0x0)return;await rmdir(_0x8aacb9);}catch{return;}_0x8aacb9=dirname(_0x8aacb9);}}
@@ -1 +1 @@
1
- function a192_0x2807(){const _0x3c5198=['5763mMcLEz','bool','description','read','detail','154749VrTSBG','526540Hxjxlv','Return\x20full\x20raw\x20SQL\x20query\x20object','verbose','324744LAOisr','sql','sqlName','250650ovAiQJ','4vNZRVu','sqlCode','13017mdoVCN','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','sqlContent','dbId','31904OlvTHG','appCode'];a192_0x2807=function(){return _0x3c5198;};return a192_0x2807();}function a192_0x4966(_0x10bf7e,_0x5c439a){_0x10bf7e=_0x10bf7e-0x6c;const _0x280755=a192_0x2807();let _0x496673=_0x280755[_0x10bf7e];return _0x496673;}const a192_0x537cfd=a192_0x4966;(function(_0xb64ce0,_0x565268){const _0x1fda77=a192_0x4966,_0x486885=_0xb64ce0();while(!![]){try{const _0x39cda1=-parseInt(_0x1fda77(0x7f))/0x1+parseInt(_0x1fda77(0x7d))/0x2*(-parseInt(_0x1fda77(0x70))/0x3)+-parseInt(_0x1fda77(0x6e))/0x4+parseInt(_0x1fda77(0x76))/0x5+parseInt(_0x1fda77(0x7c))/0x6+parseInt(_0x1fda77(0x75))/0x7+-parseInt(_0x1fda77(0x79))/0x8;if(_0x39cda1===_0x565268)break;else _0x486885['push'](_0x486885['shift']());}catch(_0x4d6206){_0x486885['push'](_0x486885['shift']());}}}(a192_0x2807,0x19552));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a192_0x537cfd(0x7a),'command':a192_0x537cfd(0x74),'description':a192_0x537cfd(0x80),'risk':a192_0x537cfd(0x73),'flags':[SQLCODE_FLAG,{'name':'verbose','type':'boolean','description':a192_0x537cfd(0x77)}],async 'execute'(_0x520083){const _0x886ab9=a192_0x537cfd,_0x1a27f5=await getSqlQueryInfo(_0x520083[_0x886ab9(0x6f)],_0x520083['str']('sqlcode')),_0x28b7c5=_0x520083[_0x886ab9(0x71)](_0x886ab9(0x78));if(_0x28b7c5)return{'ok':!![],'data':_0x1a27f5};const _0x2c8c47=_0x1a27f5[_0x886ab9(0x6d)]?await getDbName(_0x520083[_0x886ab9(0x6f)],_0x1a27f5[_0x886ab9(0x6d)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x1a27f5[_0x886ab9(0x7e)],'sqlName':_0x1a27f5[_0x886ab9(0x7b)],'db':_0x2c8c47?_0x2c8c47+'\x20('+_0x1a27f5[_0x886ab9(0x6d)]+')':_0x1a27f5[_0x886ab9(0x6d)]??'','description':_0x1a27f5[_0x886ab9(0x72)]??'','sqlContent':_0x1a27f5[_0x886ab9(0x6c)]??''}};}};
1
+ const a198_0xbead87=a198_0x7e71;function a198_0x2fa2(){const _0x9ae9ba=['47650wRnsmt','8rnHJAy','sqlcode','sqlCode','boolean','detail','str','140mPNolM','dbId','6806840cXUtPl','652596bmNrBD','bool','description','verbose','461084vfOLii','1128162aMsnYI','appCode','1275050nPwYzu','read','Return\x20full\x20raw\x20SQL\x20query\x20object','1dxQbOZ','sqlContent','2947095WjimEq'];a198_0x2fa2=function(){return _0x9ae9ba;};return a198_0x2fa2();}function a198_0x7e71(_0xe46ee3,_0x3b7fac){_0xe46ee3=_0xe46ee3-0xe7;const _0x2fa277=a198_0x2fa2();let _0x7e7188=_0x2fa277[_0xe46ee3];return _0x7e7188;}(function(_0x26fadc,_0x5651f1){const _0x237fcb=a198_0x7e71,_0x38e361=_0x26fadc();while(!![]){try{const _0x83e140=-parseInt(_0x237fcb(0xf0))/0x1*(parseInt(_0x237fcb(0xea))/0x2)+parseInt(_0x237fcb(0xeb))/0x3+parseInt(_0x237fcb(0xfa))/0x4*(parseInt(_0x237fcb(0xf3))/0x5)+-parseInt(_0x237fcb(0xfd))/0x6+parseInt(_0x237fcb(0xed))/0x7*(parseInt(_0x237fcb(0xf4))/0x8)+parseInt(_0x237fcb(0xf2))/0x9+-parseInt(_0x237fcb(0xfc))/0xa;if(_0x83e140===_0x5651f1)break;else _0x38e361['push'](_0x38e361['shift']());}catch(_0x5cc3e3){_0x38e361['push'](_0x38e361['shift']());}}}(a198_0x2fa2,0x30a31));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':a198_0xbead87(0xf8),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a198_0xbead87(0xee),'flags':[SQLCODE_FLAG,{'name':a198_0xbead87(0xe9),'type':a198_0xbead87(0xf7),'description':a198_0xbead87(0xef)}],async 'execute'(_0x4e8b28){const _0x3d1985=a198_0xbead87,_0x587b71=await getSqlQueryInfo(_0x4e8b28[_0x3d1985(0xec)],_0x4e8b28[_0x3d1985(0xf9)](_0x3d1985(0xf5))),_0x52ac51=_0x4e8b28[_0x3d1985(0xe7)](_0x3d1985(0xe9));if(_0x52ac51)return{'ok':!![],'data':_0x587b71};const _0x5753b1=_0x587b71['dbId']?await getDbName(_0x4e8b28[_0x3d1985(0xec)],_0x587b71[_0x3d1985(0xfb)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x587b71[_0x3d1985(0xf6)],'sqlName':_0x587b71['sqlName'],'db':_0x5753b1?_0x5753b1+'\x20('+_0x587b71['dbId']+')':_0x587b71[_0x3d1985(0xfb)]??'','description':_0x587b71[_0x3d1985(0xe8)]??'','sqlContent':_0x587b71[_0x3d1985(0xf1)]??''}};}};
@@ -1 +1 @@
1
- const a193_0x416935=a193_0x589a;function a193_0x589a(_0x40aae0,_0x2cccd6){_0x40aae0=_0x40aae0-0x1ee;const _0x1e9018=a193_0x1e90();let _0x589ad5=_0x1e9018[_0x40aae0];return _0x589ad5;}(function(_0x205a1d,_0x19f70a){const _0x107805=a193_0x589a,_0x5d43c1=_0x205a1d();while(!![]){try{const _0x12e8e9=parseInt(_0x107805(0x1f7))/0x1*(parseInt(_0x107805(0x1f5))/0x2)+parseInt(_0x107805(0x1f1))/0x3+-parseInt(_0x107805(0x1ef))/0x4*(-parseInt(_0x107805(0x1f4))/0x5)+-parseInt(_0x107805(0x1f9))/0x6+-parseInt(_0x107805(0x1ee))/0x7+-parseInt(_0x107805(0x1fb))/0x8+-parseInt(_0x107805(0x204))/0x9*(-parseInt(_0x107805(0x1fe))/0xa);if(_0x12e8e9===_0x19f70a)break;else _0x5d43c1['push'](_0x5d43c1['shift']());}catch(_0x4d0122){_0x5d43c1['push'](_0x5d43c1['shift']());}}}(a193_0x1e90,0xaec4c));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a193_0x1e90(){const _0x4a89ca=['execSuccess','execError','exec','2358ltGtaQ','3533985bQnxCG','1751864qdmFsB','string','517965QekDbW','str','SQL\x20execution\x20failed','5aAFpmx','66smeVYz','params','16885wsWkuW','now','5380344YbxvsF','Returned\x20','10609016FSQZLX','\x20row(s)\x20in\x20','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','86860fftZoL','length','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode'];a193_0x1e90=function(){return _0x4a89ca;};return a193_0x1e90();}export const sqlExec={'service':'sql','command':a193_0x416935(0x203),'description':a193_0x416935(0x200),'risk':'read','flags':[SQLCODE_FLAG,{'name':a193_0x416935(0x1f6),'type':a193_0x416935(0x1f0),'description':a193_0x416935(0x1fd)}],async 'execute'(_0x436d22){const _0x237247=a193_0x416935,_0x555854=parseJsonParams(_0x436d22[_0x237247(0x1f2)](_0x237247(0x1f6))),_0x119ebe=Date[_0x237247(0x1f8)](),_0x2a7831=await executeSql(_0x436d22['appCode'],_0x436d22['str']('sqlcode'),_0x555854),_0x2ad541=Date[_0x237247(0x1f8)]()-_0x119ebe,_0x3ea0f5=_0x2a7831?.['execResult']??_0x2a7831,_0x894350=_0x2a7831?.[_0x237247(0x201)]??!![];if(!_0x894350)return{'ok':![],'data':{'error':_0x2a7831?.[_0x237247(0x202)]||_0x237247(0x1f3),'elapsed':_0x2ad541},'message':_0x237247(0x1f3)};const _0x56b8ea=Array['isArray'](_0x3ea0f5)?_0x3ea0f5:[];return{'ok':!![],'data':{'rows':_0x56b8ea,'rowCount':_0x56b8ea['length'],'elapsed':_0x2ad541},'message':_0x237247(0x1fa)+_0x56b8ea[_0x237247(0x1ff)]+_0x237247(0x1fc)+_0x2ad541+'ms'};}};
1
+ const a199_0x437d3b=a199_0x47fc;function a199_0x4ee3(){const _0x5d831d=['7661079jeuyTa','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','SQL\x20execution\x20failed','6089825YHGAaV','Returned\x20','1106ilCOPQ','length','7671EnoMGy','str','params','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','1067119ZeaTUH','execSuccess','string','4304884usTCqC','210GxHQHF','now','\x20row(s)\x20in\x20','read','sqlcode','11138120cloPyS','10QWQBDx','108870WOarmM','execError','isArray','exec','appCode'];a199_0x4ee3=function(){return _0x5d831d;};return a199_0x4ee3();}(function(_0x2dd024,_0x208581){const _0x49db94=a199_0x47fc,_0x3c359c=_0x2dd024();while(!![]){try{const _0xa1013e=-parseInt(_0x49db94(0x17d))/0x1+parseInt(_0x49db94(0x177))/0x2*(parseInt(_0x49db94(0x179))/0x3)+parseInt(_0x49db94(0x180))/0x4+parseInt(_0x49db94(0x166))/0x5*(parseInt(_0x49db94(0x16d))/0x6)+-parseInt(_0x49db94(0x175))/0x7+-parseInt(_0x49db94(0x16b))/0x8+-parseInt(_0x49db94(0x172))/0x9*(-parseInt(_0x49db94(0x16c))/0xa);if(_0xa1013e===_0x208581)break;else _0x3c359c['push'](_0x3c359c['shift']());}catch(_0x194454){_0x3c359c['push'](_0x3c359c['shift']());}}}(a199_0x4ee3,0xbd03c));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a199_0x47fc(_0x58924a,_0x1ba0a5){_0x58924a=_0x58924a-0x166;const _0x4ee375=a199_0x4ee3();let _0x47fced=_0x4ee375[_0x58924a];return _0x47fced;}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':'sql','command':a199_0x437d3b(0x170),'description':a199_0x437d3b(0x17c),'risk':a199_0x437d3b(0x169),'flags':[SQLCODE_FLAG,{'name':a199_0x437d3b(0x17b),'type':a199_0x437d3b(0x17f),'description':a199_0x437d3b(0x173)}],async 'execute'(_0xa4a6dd){const _0xc3e815=a199_0x437d3b,_0x3af79f=parseJsonParams(_0xa4a6dd['str']('params')),_0x5ad0c2=Date[_0xc3e815(0x167)](),_0x10af20=await executeSql(_0xa4a6dd[_0xc3e815(0x171)],_0xa4a6dd[_0xc3e815(0x17a)](_0xc3e815(0x16a)),_0x3af79f),_0x44dd80=Date['now']()-_0x5ad0c2,_0x18702c=_0x10af20?.['execResult']??_0x10af20,_0x3e396c=_0x10af20?.[_0xc3e815(0x17e)]??!![];if(!_0x3e396c)return{'ok':![],'data':{'error':_0x10af20?.[_0xc3e815(0x16e)]||_0xc3e815(0x174),'elapsed':_0x44dd80},'message':_0xc3e815(0x174)};const _0x1b0889=Array[_0xc3e815(0x16f)](_0x18702c)?_0x18702c:[];return{'ok':!![],'data':{'rows':_0x1b0889,'rowCount':_0x1b0889[_0xc3e815(0x178)],'elapsed':_0x44dd80},'message':_0xc3e815(0x176)+_0x1b0889['length']+_0xc3e815(0x168)+_0x44dd80+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x16d683,_0x425576){const _0x4c4999=a194_0x1b69,_0x224d76=_0x16d683();while(!![]){try{const _0x1d0d7f=-parseInt(_0x4c4999(0x19b))/0x1+-parseInt(_0x4c4999(0x19c))/0x2+-parseInt(_0x4c4999(0x19a))/0x3*(parseInt(_0x4c4999(0x198))/0x4)+-parseInt(_0x4c4999(0x196))/0x5*(parseInt(_0x4c4999(0x194))/0x6)+-parseInt(_0x4c4999(0x19d))/0x7*(-parseInt(_0x4c4999(0x197))/0x8)+-parseInt(_0x4c4999(0x199))/0x9+parseInt(_0x4c4999(0x195))/0xa;if(_0x1d0d7f===_0x425576)break;else _0x224d76['push'](_0x224d76['shift']());}catch(_0x377441){_0x224d76['push'](_0x224d76['shift']());}}}(a194_0x2235,0x9a2bd));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a194_0x1b69(_0x294fb0,_0x56557f){_0x294fb0=_0x294fb0-0x194;const _0x223512=a194_0x2235();let _0x1b6919=_0x223512[_0x294fb0];return _0x1b6919;}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];function a194_0x2235(){const _0x29e4bc=['45114850VUMEiV','2583395slkdrg','8FSgtVp','236nvtMhC','9634419JxmpqM','56121ZcfBSL','709686AGkeGm','2306420ZJYsEX','4716453GuWzcP','6AkdBhE'];a194_0x2235=function(){return _0x29e4bc;};return a194_0x2235();}
1
+ (function(_0x2fa013,_0x4c7270){const _0x1be528=a200_0x10e3,_0x4e6db5=_0x2fa013();while(!![]){try{const _0x1496a2=-parseInt(_0x1be528(0x165))/0x1*(parseInt(_0x1be528(0x15f))/0x2)+parseInt(_0x1be528(0x163))/0x3*(-parseInt(_0x1be528(0x15c))/0x4)+parseInt(_0x1be528(0x162))/0x5*(parseInt(_0x1be528(0x161))/0x6)+-parseInt(_0x1be528(0x15b))/0x7+parseInt(_0x1be528(0x15d))/0x8+-parseInt(_0x1be528(0x160))/0x9*(parseInt(_0x1be528(0x164))/0xa)+parseInt(_0x1be528(0x15e))/0xb;if(_0x1496a2===_0x4c7270)break;else _0x4e6db5['push'](_0x4e6db5['shift']());}catch(_0x56736f){_0x4e6db5['push'](_0x4e6db5['shift']());}}}(a200_0x7f86,0x3ac13));function a200_0x7f86(){const _0x45e05a=['3cYdHMa','3752050GKXuEe','1LSYEUI','337946dtILhC','259580OWnlVg','1965480SIkXwZ','3105982beGHJW','507406rvHjxm','9lnLOAD','2728158DDbeJk','5UtpuHc'];a200_0x7f86=function(){return _0x45e05a;};return a200_0x7f86();}import{sqlList}from'../../commands/sql/list.js';function a200_0x10e3(_0x162ec0,_0x141658){_0x162ec0=_0x162ec0-0x15b;const _0x7f86f4=a200_0x7f86();let _0x10e3a6=_0x7f86f4[_0x162ec0];return _0x10e3a6;}import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a195_0x5aa119=a195_0xe96c;(function(_0x388988,_0x481b9c){const _0x183740=a195_0xe96c,_0x16d492=_0x388988();while(!![]){try{const _0xf016bb=parseInt(_0x183740(0x18c))/0x1*(parseInt(_0x183740(0x19b))/0x2)+-parseInt(_0x183740(0x187))/0x3+-parseInt(_0x183740(0x199))/0x4*(-parseInt(_0x183740(0x195))/0x5)+-parseInt(_0x183740(0x185))/0x6+parseInt(_0x183740(0x194))/0x7+parseInt(_0x183740(0x1a2))/0x8+-parseInt(_0x183740(0x19f))/0x9;if(_0xf016bb===_0x481b9c)break;else _0x16d492['push'](_0x16d492['shift']());}catch(_0x4f3580){_0x16d492['push'](_0x16d492['shift']());}}}(a195_0x1a73,0xa74fd));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a195_0xe96c(_0x3e0131,_0x1cf952){_0x3e0131=_0x3e0131-0x180;const _0x1a7379=a195_0x1a73();let _0xe96c9a=_0x1a7379[_0x3e0131];return _0xe96c9a;}function a195_0x1a73(){const _0x27901a=['appCode','4257813xmkBTy','2958545RocUPy','number','bool','totalCount','4DuxYLI','name','165476zBqbGl','No\x20custom\x20SQL\x20queries\x20found.','Page\x20size','map','3292974vGmqvu','verbose','num','1205448xDvXPi','Page\x20number','boolean','string','sqlCode','paging','1341594OutXZl','Found\x20','3454347kToTRF','tableData','read','str','all','13oSWOWf','page','Filter\x20by\x20SQL\x20name','sqlName','length','dbId','pagesize'];a195_0x1a73=function(){return _0x27901a;};return a195_0x1a73();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':'list','description':'List\x20custom\x20SQL\x20queries','risk':a195_0x5aa119(0x189),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a195_0x5aa119(0x19a),'type':a195_0x5aa119(0x182),'description':a195_0x5aa119(0x18e)},{'name':a195_0x5aa119(0x18d),'type':a195_0x5aa119(0x196),'description':a195_0x5aa119(0x180),'default':0x1},{'name':a195_0x5aa119(0x192),'type':a195_0x5aa119(0x196),'description':a195_0x5aa119(0x19d)},{'name':a195_0x5aa119(0x1a0),'type':a195_0x5aa119(0x181),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x4a9e03){const _0x44ab46=a195_0x5aa119,_0x23e7d9=await listSqlQueries(_0x4a9e03[_0x44ab46(0x193)],{'sqlCode':_0x4a9e03['str']('sqlcode')||undefined,'sqlName':_0x4a9e03[_0x44ab46(0x18a)](_0x44ab46(0x19a))||undefined,'currentPage':_0x4a9e03[_0x44ab46(0x1a1)](_0x44ab46(0x18d)),'pageSize':_0x4a9e03[_0x44ab46(0x1a1)](_0x44ab46(0x192),0x32)}),_0x99ebd4=_0x4a9e03[_0x44ab46(0x197)]('verbose'),_0x1faad4=_0x23e7d9[_0x44ab46(0x188)]??[],_0x4fdfcb=_0x23e7d9[_0x44ab46(0x184)]?.[_0x44ab46(0x198)]??_0x1faad4[_0x44ab46(0x190)];let _0x2dbefd;return _0x99ebd4?_0x2dbefd=_0x1faad4:_0x2dbefd=await Promise[_0x44ab46(0x18b)](_0x1faad4[_0x44ab46(0x19e)](async _0x1bd708=>{const _0x2ef292=_0x44ab46;let _0x33f784;try{_0x33f784=_0x1bd708[_0x2ef292(0x191)]?await getDbName(_0x4a9e03[_0x2ef292(0x193)],_0x1bd708['dbId']):undefined;}catch{}return{'sqlCode':_0x1bd708[_0x2ef292(0x183)],'sqlName':_0x1bd708[_0x2ef292(0x18f)],'description':_0x1bd708['description']??'','db':_0x33f784?_0x33f784+'\x20('+_0x1bd708[_0x2ef292(0x191)]+')':_0x1bd708[_0x2ef292(0x191)]??''};})),{'ok':!![],'data':_0x2dbefd,'message':_0x1faad4['length']===0x0?_0x44ab46(0x19c):_0x44ab46(0x186)+_0x1faad4[_0x44ab46(0x190)]+'\x20SQL\x20queries\x20(total:\x20'+_0x4fdfcb+').'};}};
1
+ const a201_0x537520=a201_0x2bac;(function(_0x5df9a6,_0x31cf93){const _0x2c1032=a201_0x2bac,_0x147ca6=_0x5df9a6();while(!![]){try{const _0x4f0e52=-parseInt(_0x2c1032(0xe6))/0x1+parseInt(_0x2c1032(0xf7))/0x2*(parseInt(_0x2c1032(0xe8))/0x3)+-parseInt(_0x2c1032(0xf2))/0x4+-parseInt(_0x2c1032(0xf9))/0x5+-parseInt(_0x2c1032(0xef))/0x6+-parseInt(_0x2c1032(0xe7))/0x7*(parseInt(_0x2c1032(0xf4))/0x8)+parseInt(_0x2c1032(0xea))/0x9;if(_0x4f0e52===_0x31cf93)break;else _0x147ca6['push'](_0x147ca6['shift']());}catch(_0x1a4799){_0x147ca6['push'](_0x147ca6['shift']());}}}(a201_0x2f65,0xd7312));function a201_0x2bac(_0x3e91f5,_0x27c444){_0x3e91f5=_0x3e91f5-0xdf;const _0x2f65fe=a201_0x2f65();let _0x2baccd=_0x2f65fe[_0x3e91f5];return _0x2baccd;}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a201_0x537520(0xe5),'description':'List\x20custom\x20SQL\x20queries','risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a201_0x537520(0xfd),'type':a201_0x537520(0xf6),'description':a201_0x537520(0xf1)},{'name':a201_0x537520(0xe4),'type':a201_0x537520(0xe9),'description':a201_0x537520(0xfc),'default':0x1},{'name':a201_0x537520(0xf8),'type':'number','description':'Page\x20size'},{'name':a201_0x537520(0xe3),'type':a201_0x537520(0xfa),'description':a201_0x537520(0xfe)}],async 'execute'(_0x3708a5){const _0x5f1c09=a201_0x537520,_0x21389f=await listSqlQueries(_0x3708a5[_0x5f1c09(0xec)],{'sqlCode':_0x3708a5[_0x5f1c09(0xe1)]('sqlcode')||undefined,'sqlName':_0x3708a5[_0x5f1c09(0xe1)](_0x5f1c09(0xfd))||undefined,'currentPage':_0x3708a5[_0x5f1c09(0xed)]('page'),'pageSize':_0x3708a5[_0x5f1c09(0xed)]('pagesize',0x32)}),_0x98cdff=_0x3708a5['bool'](_0x5f1c09(0xe3)),_0x5a8786=_0x21389f['tableData']??[],_0x53933e=_0x21389f[_0x5f1c09(0xeb)]?.['totalCount']??_0x5a8786[_0x5f1c09(0xdf)];let _0x585a36;return _0x98cdff?_0x585a36=_0x5a8786:_0x585a36=await Promise[_0x5f1c09(0xf3)](_0x5a8786[_0x5f1c09(0xff)](async _0xfa737b=>{const _0x5f2ced=_0x5f1c09;let _0x123775;try{_0x123775=_0xfa737b[_0x5f2ced(0xfb)]?await getDbName(_0x3708a5['appCode'],_0xfa737b['dbId']):undefined;}catch{}return{'sqlCode':_0xfa737b[_0x5f2ced(0xf0)],'sqlName':_0xfa737b[_0x5f2ced(0xf5)],'description':_0xfa737b[_0x5f2ced(0x100)]??'','db':_0x123775?_0x123775+'\x20('+_0xfa737b[_0x5f2ced(0xfb)]+')':_0xfa737b['dbId']??''};})),{'ok':!![],'data':_0x585a36,'message':_0x5a8786[_0x5f1c09(0xdf)]===0x0?_0x5f1c09(0xee):_0x5f1c09(0xe2)+_0x5a8786[_0x5f1c09(0xdf)]+_0x5f1c09(0xe0)+_0x53933e+').'};}};function a201_0x2f65(){const _0x1fe02d=['sqlName','string','2GVzpjf','pagesize','4903315hIJTCn','boolean','dbId','Page\x20number','name','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','map','description','length','\x20SQL\x20queries\x20(total:\x20','str','Found\x20','verbose','page','list','102299YSsscV','3738VLmdiK','452964sNxIfg','number','43621614oCvQQZ','paging','appCode','num','No\x20custom\x20SQL\x20queries\x20found.','3234738rGaXUC','sqlCode','Filter\x20by\x20SQL\x20name','4947012KcXHjV','all','18840kGztvG'];a201_0x2f65=function(){return _0x1fe02d;};return a201_0x2f65();}
@@ -1 +1 @@
1
- function a196_0x2602(){const _0xbb9a1b=['bool','sqlRootDir','totalCount','4979826skyqXk','toISOString','test','sqlContent','str','\x20skipped,\x20','sqls','No\x20remote\x20SQL\x20queries\x20matched.','string','4002656iSTVVZ','53433tRPfeh','dbId','cancelled','lockFilePath','sqlRoot','sqlName','trimStart','pull','join','length','name','force','appCode','boolean','mybatisXml','10AVQjSs','read','replace','Pull\x20complete:\x20','sql','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','split','message','sqlcode','POST','apps','utf8','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','local\x20differs\x20from\x20remote','8898420cYkOHP','8RYKgdI','path','tableData','unchanged','skipped','push','76etJxZr','catch','sqlCode','Force\x20pull\x20cancelled.','\x20written,\x20','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','1432134UdsGMs','paging','37820NOKcJl','Filter\x20by\x20SQL\x20display\x20name','1456924kWVZcn','filter','description','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.'];a196_0x2602=function(){return _0xbb9a1b;};return a196_0x2602();}const a196_0x526ffc=a196_0x5812;(function(_0x4a1fea,_0x5422cc){const _0x2081c3=a196_0x5812,_0x2d0fc8=_0x4a1fea();while(!![]){try{const _0x511983=-parseInt(_0x2081c3(0x1c7))/0x1+-parseInt(_0x2081c3(0x1fe))/0x2*(-parseInt(_0x2081c3(0x1da))/0x3)+parseInt(_0x2081c3(0x1c9))/0x4*(-parseInt(_0x2081c3(0x1e9))/0x5)+-parseInt(_0x2081c3(0x1c5))/0x6+parseInt(_0x2081c3(0x1d9))/0x7+-parseInt(_0x2081c3(0x1f8))/0x8*(parseInt(_0x2081c3(0x1d0))/0x9)+parseInt(_0x2081c3(0x1f7))/0xa;if(_0x511983===_0x5422cc)break;else _0x2d0fc8['push'](_0x2d0fc8['shift']());}catch(_0x3d5957){_0x2d0fc8['push'](_0x2d0fc8['shift']());}}}(a196_0x2602,0x8da57));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x1de42f,_0x115c12){const _0x5a1361=a196_0x5812,_0x382927=[];let _0x25400f=0x1;while(!![]){const _0x3c38b5=await listSqlQueries(_0x1de42f,{'currentPage':_0x25400f,'pageSize':PAGE_SIZE,'sqlCode':_0x115c12[_0x5a1361(0x200)],'sqlName':_0x115c12[_0x5a1361(0x1df)]}),_0x557fe6=_0x3c38b5[_0x5a1361(0x1fa)]??[];_0x382927[_0x5a1361(0x1fd)](..._0x557fe6);if(_0x557fe6[_0x5a1361(0x1e3)]===0x0)break;const _0xb7f2ec=_0x3c38b5[_0x5a1361(0x1c6)]?.[_0x5a1361(0x1cf)];if(_0xb7f2ec!=null?_0x382927[_0x5a1361(0x1e3)]>=_0xb7f2ec:_0x557fe6[_0x5a1361(0x1e3)]<PAGE_SIZE)break;_0x25400f++;}return _0x382927;}async function ensureSqlContent(_0x10d459){const _0x36e492=a196_0x5812;if(_0x10d459[_0x36e492(0x1d3)]!=null&&String(_0x10d459[_0x36e492(0x1d3)])[_0x36e492(0x1e3)]>0x0)return _0x10d459;return getSqlQueryDetail(_0x10d459[_0x36e492(0x200)]);}export const sqlPull={'service':a196_0x526ffc(0x1ed),'command':a196_0x526ffc(0x1e1),'description':a196_0x526ffc(0x1ee),'risk':a196_0x526ffc(0x1ea),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a196_0x526ffc(0x1d8),'description':a196_0x526ffc(0x1c8)},{'name':a196_0x526ffc(0x1e5),'type':a196_0x526ffc(0x1e7),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x40073c){const _0x59f2d5=a196_0x526ffc,_0x1eb160=loadSqlProjectConfig(_0x40073c[_0x59f2d5(0x1e6)]),_0x12ef4e=await readSqlLockFile(_0x1eb160[_0x59f2d5(0x1dd)]),{appLock:_0x1dc880}=ensureSqlLockScope(_0x12ef4e??createEmptySqlLock(),_0x1eb160[_0x59f2d5(0x1e6)],_0x1eb160[_0x59f2d5(0x1de)],_0x59f2d5(0x1e1)),_0x48e95b=await fetchAllSqlQueries(_0x40073c[_0x59f2d5(0x1e6)],{'sqlCode':_0x40073c[_0x59f2d5(0x1d4)](_0x59f2d5(0x1f1))||undefined,'sqlName':_0x40073c[_0x59f2d5(0x1d4)](_0x59f2d5(0x1e4))||undefined}),_0x106dfd=[];for(const _0x4a5705 of _0x48e95b){const _0x2f73b9=await ensureSqlContent(_0x4a5705),_0x377a85=ensureRemoteSqlContent(_0x2f73b9),_0x3a8309=detectModeFromSql(_0x2f73b9),_0x2b49bc=_0x2f73b9['dbId']?await getDbName(_0x40073c[_0x59f2d5(0x1e6)],Number(_0x2f73b9[_0x59f2d5(0x1db)]))[_0x59f2d5(0x1ff)](()=>undefined):undefined,_0xa87c2b=buildLocalSqlFileContent({'sqlCode':_0x2f73b9[_0x59f2d5(0x200)],'sqlName':_0x2f73b9[_0x59f2d5(0x1df)],'dbId':_0x2f73b9['dbId']},_0x377a85,{'dbName':_0x2b49bc,'mode':_0x3a8309,'syncedAt':new Date()[_0x59f2d5(0x1d1)](),'description':_0x2f73b9[_0x59f2d5(0x1cb)]}),_0x4327e4=buildSqlLockEntry(_0x2f73b9,_0x377a85,'',{'dbName':_0x2b49bc}),_0x429d60=resolveLocalSqlFilePath(_0x1eb160,_0x2f73b9['sqlCode'],_0x4327e4);let _0x25d61b='would_pull',_0x3100d6;if(await fileExists(_0x429d60)){const _0x2690df=await readFile(_0x429d60,_0x59f2d5(0x1f4));isEquivalentPulledSqlFile(_0x2690df,_0xa87c2b,_0x3a8309)?(_0x25d61b=_0x59f2d5(0x1fc),_0x3100d6=_0x59f2d5(0x1fb)):(_0x25d61b='conflict',_0x3100d6=_0x59f2d5(0x203));}_0x106dfd[_0x59f2d5(0x1fd)]({'sqlCode':_0x2f73b9[_0x59f2d5(0x200)],'sqlName':_0x2f73b9[_0x59f2d5(0x1df)],'filePath':_0x429d60,'status':_0x25d61b,'reason':_0x3100d6});}return{'method':_0x59f2d5(0x1f2),'url':_0x59f2d5(0x1f5),'body':{'appCode':_0x40073c['appCode'],'sqlCode':_0x40073c['str'](_0x59f2d5(0x1f1))||null,'sqlName':_0x40073c['str'](_0x59f2d5(0x1e4))||null,'files':_0x106dfd},'description':'Would\x20pull\x20'+_0x106dfd[_0x59f2d5(0x1e3)]+'\x20SQL\x20file(s)\x20into\x20'+_0x1eb160[_0x59f2d5(0x1ce)]};},async 'execute'(_0x4fcc1e){const _0x25538b=a196_0x526ffc,_0x5d0b6e=loadSqlProjectConfig(_0x4fcc1e['appCode']),_0x31d6ff=await readSqlLockFile(_0x5d0b6e[_0x25538b(0x1dd)]),{lockData:_0x10d153,appLock:_0x213f4e}=ensureSqlLockScope(_0x31d6ff??createEmptySqlLock(),_0x5d0b6e[_0x25538b(0x1e6)],_0x5d0b6e[_0x25538b(0x1de)],_0x25538b(0x1e1)),_0x7c7a2b=_0x4fcc1e[_0x25538b(0x1cd)]('force'),_0x5c43d8=await fetchAllSqlQueries(_0x4fcc1e[_0x25538b(0x1e6)],{'sqlCode':_0x4fcc1e[_0x25538b(0x1d4)](_0x25538b(0x1f1))||undefined,'sqlName':_0x4fcc1e['str'](_0x25538b(0x1e4))||undefined});if(_0x5c43d8[_0x25538b(0x1e3)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x25538b(0x1d7)};const _0x3cfa6e=[],_0x81759d=[];for(const _0x2e9bb1 of _0x5c43d8){try{_0x3cfa6e['push'](await ensureSqlContent(_0x2e9bb1));}catch(_0x406b91){_0x81759d[_0x25538b(0x1fd)]({'sqlCode':_0x2e9bb1[_0x25538b(0x200)],'error':_0x406b91 instanceof Error?_0x406b91['message']:String(_0x406b91)});}}if(_0x7c7a2b&&!_0x4fcc1e['nonInteractive']){let _0x12d673=![];for(const _0x4f60c0 of _0x3cfa6e){const _0x377f8c=detectModeFromSql(_0x4f60c0),_0x511b4f=_0x4f60c0[_0x25538b(0x1db)]?await getDbName(_0x4fcc1e['appCode'],Number(_0x4f60c0['dbId']))[_0x25538b(0x1ff)](()=>undefined):undefined,_0x499423=buildLocalSqlFileContent({'sqlCode':_0x4f60c0[_0x25538b(0x200)],'sqlName':_0x4f60c0[_0x25538b(0x1df)],'dbId':_0x4f60c0[_0x25538b(0x1db)]},ensureRemoteSqlContent(_0x4f60c0),{'dbName':_0x511b4f,'mode':_0x377f8c,'syncedAt':new Date()[_0x25538b(0x1d1)](),'description':_0x4f60c0['description']}),_0x5d2a06=resolveLocalSqlFilePath(_0x5d0b6e,_0x4f60c0['sqlCode'],buildSqlLockEntry(_0x4f60c0,ensureRemoteSqlContent(_0x4f60c0),'',{'dbName':_0x511b4f}));if(await fileExists(_0x5d2a06)){const _0x2f8972=await readFile(_0x5d2a06,_0x25538b(0x1f4));if(!isEquivalentPulledSqlFile(_0x2f8972,_0x499423,_0x377f8c)){_0x12d673=!![];break;}}}if(_0x12d673){const _0x3c2372=await confirmForceOverwrite(_0x25538b(0x1cc));if(!_0x3c2372)throw CliErrors[_0x25538b(0x1dc)](_0x25538b(0x201));}}const _0x829c82=cloneSqlLockData(_0x10d153),_0x50ff32=_0x829c82[_0x25538b(0x1f3)][_0x5d0b6e[_0x25538b(0x1e6)]],_0x50a9bb=[],_0x23fa96=[];for(const _0xfa6f5a of _0x3cfa6e){const _0x52919e=_0x50ff32['sqls'][_0xfa6f5a[_0x25538b(0x200)]],_0x30d9c7=ensureRemoteSqlContent(_0xfa6f5a),_0x42c8e4=detectModeFromSql(_0xfa6f5a),_0x3271f1=_0xfa6f5a[_0x25538b(0x1db)]?await getDbName(_0x4fcc1e[_0x25538b(0x1e6)],Number(_0xfa6f5a[_0x25538b(0x1db)]))[_0x25538b(0x1ff)](()=>undefined):undefined,_0x4a9bf7=buildLocalSqlFileContent({'sqlCode':_0xfa6f5a['sqlCode'],'sqlName':_0xfa6f5a['sqlName'],'dbId':_0xfa6f5a['dbId']},_0x30d9c7,{'dbName':_0x3271f1,'mode':_0x42c8e4,'syncedAt':new Date()[_0x25538b(0x1d1)](),'description':_0xfa6f5a[_0x25538b(0x1cb)]}),_0x53a77c=buildSqlLockEntry(_0xfa6f5a,_0x30d9c7,computeSqlContentHash(_0x4a9bf7),{'dbName':_0x3271f1}),_0x2b355e=_0x53a77c[_0x25538b(0x1f9)],_0x4ac724=join(_0x5d0b6e['sqlRootDir'],_0x2b355e);try{if(await fileExists(_0x4ac724)){const _0x83a0d3=await readFile(_0x4ac724,_0x25538b(0x1f4));if(isEquivalentPulledSqlFile(_0x83a0d3,_0x4a9bf7,_0x42c8e4)){_0x23fa96[_0x25538b(0x1fd)]({'sqlCode':_0xfa6f5a[_0x25538b(0x200)],'reason':_0x25538b(0x1fb)}),_0x50ff32[_0x25538b(0x1d6)][_0xfa6f5a['sqlCode']]={..._0x53a77c,'hash':computeSqlContentHash(_0x83a0d3),'path':_0x2b355e};continue;}if(!_0x7c7a2b){_0x23fa96[_0x25538b(0x1fd)]({'sqlCode':_0xfa6f5a[_0x25538b(0x200)],'reason':_0x25538b(0x1f6)});continue;}}const _0x3b85cb=_0x52919e?.['path']?join(_0x5d0b6e[_0x25538b(0x1ce)],_0x52919e[_0x25538b(0x1f9)]):undefined;_0x3b85cb&&_0x3b85cb!==_0x4ac724&&await fileExists(_0x3b85cb)&&await rm(_0x3b85cb,{'force':!![]}),await ensureParentDirectory(_0x4ac724),await writeFile(_0x4ac724,_0x4a9bf7,_0x25538b(0x1f4)),_0x50ff32[_0x25538b(0x1d6)][_0xfa6f5a[_0x25538b(0x200)]]={..._0x53a77c,'path':_0x2b355e},_0x50a9bb[_0x25538b(0x1fd)]({'sqlCode':_0xfa6f5a[_0x25538b(0x200)],'filePath':_0x4ac724});}catch(_0x157aad){_0x81759d['push']({'sqlCode':_0xfa6f5a[_0x25538b(0x200)],'error':_0x157aad instanceof Error?_0x157aad[_0x25538b(0x1f0)]:String(_0x157aad)});}}return _0x50ff32['lastSync']=new Date()[_0x25538b(0x1d1)](),await writeSqlLockFile(_0x5d0b6e[_0x25538b(0x1dd)],_0x829c82),{'ok':_0x81759d[_0x25538b(0x1e3)]===0x0,'data':{'pulled':_0x50a9bb,'skipped':_0x23fa96,'failed':_0x81759d},'message':_0x25538b(0x1ec)+_0x50a9bb[_0x25538b(0x1e3)]+_0x25538b(0x202)+_0x23fa96[_0x25538b(0x1e3)]+_0x25538b(0x1d5)+_0x81759d[_0x25538b(0x1e3)]+'\x20failed'};}};function detectModeFromSql(_0x140074){const _0x41492f=a196_0x526ffc,_0x4e417f=ensureRemoteSqlContent(_0x140074),_0x39a90f=stripLocalSqlMetadata(_0x4e417f,'mybatisXml')[_0x41492f(0x1e0)]();if(/^<(select|insert|update|delete)\b/i[_0x41492f(0x1d2)](_0x39a90f))return _0x41492f(0x1e8);return'sql';}function a196_0x5812(_0x42326e,_0x242989){_0x42326e=_0x42326e-0x1c5;const _0x2602e6=a196_0x2602();let _0x5812f9=_0x2602e6[_0x42326e];return _0x5812f9;}function isEquivalentPulledSqlFile(_0x454520,_0x3d4f16,_0x4b915e){return normalizePullComparableContent(_0x454520,_0x4b915e)===normalizePullComparableContent(_0x3d4f16,_0x4b915e);}function normalizePullComparableContent(_0x5560c1,_0x3e9219){const _0x2da326=a196_0x526ffc,_0xae077d=_0x5560c1[_0x2da326(0x1eb)](/\r\n/g,'\x0a')[_0x2da326(0x1ef)]('\x0a'),_0x570ed8=_0xae077d[_0x2da326(0x1ca)](_0x224d57=>!isSyncedAtMetadataLine(_0x224d57,_0x3e9219));return _0x570ed8[_0x2da326(0x1e2)]('\x0a');}function isSyncedAtMetadataLine(_0x2e6dbd,_0x46e7db){const _0x289242=a196_0x526ffc;if(_0x46e7db===_0x289242(0x1e8))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x289242(0x1d2)](_0x2e6dbd);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x289242(0x1d2)](_0x2e6dbd);}
1
+ const a202_0x4333b4=a202_0x3599;(function(_0x193ac0,_0xf55b2c){const _0x83796=a202_0x3599,_0x490bc3=_0x193ac0();while(!![]){try{const _0x5efea5=parseInt(_0x83796(0x80))/0x1+parseInt(_0x83796(0xa4))/0x2*(-parseInt(_0x83796(0xa8))/0x3)+-parseInt(_0x83796(0x99))/0x4+-parseInt(_0x83796(0x9b))/0x5*(-parseInt(_0x83796(0xa2))/0x6)+parseInt(_0x83796(0xa6))/0x7+parseInt(_0x83796(0x92))/0x8+-parseInt(_0x83796(0x96))/0x9;if(_0x5efea5===_0xf55b2c)break;else _0x490bc3['push'](_0x490bc3['shift']());}catch(_0x28c270){_0x490bc3['push'](_0x490bc3['shift']());}}}(a202_0x4988,0x571af));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a202_0x4988(){const _0x1121fa=['lastSync','length','27466vzfsgz','local\x20differs\x20from\x20remote','appCode','replace','POST','trimStart','description','message','totalCount','join','tableData','cancelled','lockFilePath','read','sqlName','skipped','No\x20remote\x20SQL\x20queries\x20matched.','sqlRoot','5125392wgDPoZ','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','dbId','path','5687415pabygN','paging','filter','670516VlTadX','name','30vvsJRD','sqlcode','toISOString','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','apps','Force\x20pull\x20cancelled.','utf8','412638xfFPxH','\x20written,\x20','360644xcMzfW','mybatisXml','1791237eEhcZX','sqlContent','3ZNejlx','Force\x20overwrite\x20local\x20unsynced\x20changes','string','\x20failed','force','sqlCode','unchanged','push','boolean','Filter\x20by\x20SQL\x20display\x20name','Pull\x20complete:\x20','sql','split','sqls','pull','would_pull','test','bool','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sqlRootDir','str','catch','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql'];a202_0x4988=function(){return _0x1121fa;};return a202_0x4988();}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(_0x365407,_0x4c30b4){const _0x2d8f4f=a202_0x3599,_0x4e733c=[];let _0xf7d569=0x1;while(!![]){const _0x23201e=await listSqlQueries(_0x365407,{'currentPage':_0xf7d569,'pageSize':PAGE_SIZE,'sqlCode':_0x4c30b4[_0x2d8f4f(0xad)],'sqlName':_0x4c30b4['sqlName']}),_0x46c3f4=_0x23201e[_0x2d8f4f(0x8a)]??[];_0x4e733c[_0x2d8f4f(0xaf)](..._0x46c3f4);if(_0x46c3f4[_0x2d8f4f(0x7f)]===0x0)break;const _0x7386b4=_0x23201e[_0x2d8f4f(0x97)]?.[_0x2d8f4f(0x88)];if(_0x7386b4!=null?_0x4e733c[_0x2d8f4f(0x7f)]>=_0x7386b4:_0x46c3f4[_0x2d8f4f(0x7f)]<PAGE_SIZE)break;_0xf7d569++;}return _0x4e733c;}async function ensureSqlContent(_0x3a8f47){const _0x4bd4d2=a202_0x3599;if(_0x3a8f47[_0x4bd4d2(0xa7)]!=null&&String(_0x3a8f47[_0x4bd4d2(0xa7)])[_0x4bd4d2(0x7f)]>0x0)return _0x3a8f47;return getSqlQueryDetail(_0x3a8f47[_0x4bd4d2(0xad)]);}export const sqlPull={'service':a202_0x4333b4(0xb3),'command':a202_0x4333b4(0xb6),'description':a202_0x4333b4(0x9e),'risk':a202_0x4333b4(0x8d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a202_0x4333b4(0x9a),'type':a202_0x4333b4(0xaa),'description':a202_0x4333b4(0xb1)},{'name':'force','type':a202_0x4333b4(0xb0),'description':a202_0x4333b4(0xa9)}],async 'dryRun'(_0x4143a7){const _0x310d8b=a202_0x4333b4,_0x2e2ff4=loadSqlProjectConfig(_0x4143a7[_0x310d8b(0x82)]),_0x2857c5=await readSqlLockFile(_0x2e2ff4[_0x310d8b(0x8c)]),{appLock:_0x1e2395}=ensureSqlLockScope(_0x2857c5??createEmptySqlLock(),_0x2e2ff4[_0x310d8b(0x82)],_0x2e2ff4[_0x310d8b(0x91)],_0x310d8b(0xb6)),_0x42c463=await fetchAllSqlQueries(_0x4143a7['appCode'],{'sqlCode':_0x4143a7['str']('sqlcode')||undefined,'sqlName':_0x4143a7['str'](_0x310d8b(0x9a))||undefined}),_0x42e850=[];for(const _0x3cfcfa of _0x42c463){const _0x1cde41=await ensureSqlContent(_0x3cfcfa),_0x247962=ensureRemoteSqlContent(_0x1cde41),_0xc0e5c1=detectModeFromSql(_0x1cde41),_0xc7204=_0x1cde41[_0x310d8b(0x94)]?await getDbName(_0x4143a7['appCode'],Number(_0x1cde41[_0x310d8b(0x94)]))['catch'](()=>undefined):undefined,_0xa334ff=buildLocalSqlFileContent({'sqlCode':_0x1cde41[_0x310d8b(0xad)],'sqlName':_0x1cde41[_0x310d8b(0x8e)],'dbId':_0x1cde41['dbId']},_0x247962,{'dbName':_0xc7204,'mode':_0xc0e5c1,'syncedAt':new Date()[_0x310d8b(0x9d)](),'description':_0x1cde41[_0x310d8b(0x86)]}),_0x197e1b=buildSqlLockEntry(_0x1cde41,_0x247962,'',{'dbName':_0xc7204}),_0x1c667e=resolveLocalSqlFilePath(_0x2e2ff4,_0x1cde41[_0x310d8b(0xad)],_0x197e1b);let _0x13afdb=_0x310d8b(0xb7),_0x39edd5;if(await fileExists(_0x1c667e)){const _0x164e47=await readFile(_0x1c667e,_0x310d8b(0xa1));isEquivalentPulledSqlFile(_0x164e47,_0xa334ff,_0xc0e5c1)?(_0x13afdb=_0x310d8b(0x8f),_0x39edd5=_0x310d8b(0xae)):(_0x13afdb='conflict',_0x39edd5=_0x310d8b(0xba));}_0x42e850['push']({'sqlCode':_0x1cde41[_0x310d8b(0xad)],'sqlName':_0x1cde41[_0x310d8b(0x8e)],'filePath':_0x1c667e,'status':_0x13afdb,'reason':_0x39edd5});}return{'method':_0x310d8b(0x84),'url':_0x310d8b(0xbe),'body':{'appCode':_0x4143a7[_0x310d8b(0x82)],'sqlCode':_0x4143a7[_0x310d8b(0xbc)](_0x310d8b(0x9c))||null,'sqlName':_0x4143a7[_0x310d8b(0xbc)]('name')||null,'files':_0x42e850},'description':'Would\x20pull\x20'+_0x42e850[_0x310d8b(0x7f)]+'\x20SQL\x20file(s)\x20into\x20'+_0x2e2ff4[_0x310d8b(0xbb)]};},async 'execute'(_0x7be117){const _0x23149b=a202_0x4333b4,_0x3e3620=loadSqlProjectConfig(_0x7be117[_0x23149b(0x82)]),_0x4331de=await readSqlLockFile(_0x3e3620['lockFilePath']),{lockData:_0x418730,appLock:_0xfdc86e}=ensureSqlLockScope(_0x4331de??createEmptySqlLock(),_0x3e3620[_0x23149b(0x82)],_0x3e3620['sqlRoot'],'pull'),_0x40b274=_0x7be117[_0x23149b(0xb9)](_0x23149b(0xac)),_0x2dd93b=await fetchAllSqlQueries(_0x7be117[_0x23149b(0x82)],{'sqlCode':_0x7be117['str'](_0x23149b(0x9c))||undefined,'sqlName':_0x7be117[_0x23149b(0xbc)](_0x23149b(0x9a))||undefined});if(_0x2dd93b[_0x23149b(0x7f)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x23149b(0x90)};const _0x865d34=[],_0x34e9bb=[];for(const _0x596bb2 of _0x2dd93b){try{_0x865d34[_0x23149b(0xaf)](await ensureSqlContent(_0x596bb2));}catch(_0x2f3f23){_0x34e9bb[_0x23149b(0xaf)]({'sqlCode':_0x596bb2['sqlCode'],'error':_0x2f3f23 instanceof Error?_0x2f3f23[_0x23149b(0x87)]:String(_0x2f3f23)});}}if(_0x40b274&&!_0x7be117['nonInteractive']){let _0x587e71=![];for(const _0x4eff81 of _0x865d34){const _0x597bd2=detectModeFromSql(_0x4eff81),_0x263912=_0x4eff81[_0x23149b(0x94)]?await getDbName(_0x7be117[_0x23149b(0x82)],Number(_0x4eff81['dbId']))['catch'](()=>undefined):undefined,_0x35a82a=buildLocalSqlFileContent({'sqlCode':_0x4eff81[_0x23149b(0xad)],'sqlName':_0x4eff81[_0x23149b(0x8e)],'dbId':_0x4eff81[_0x23149b(0x94)]},ensureRemoteSqlContent(_0x4eff81),{'dbName':_0x263912,'mode':_0x597bd2,'syncedAt':new Date()[_0x23149b(0x9d)](),'description':_0x4eff81[_0x23149b(0x86)]}),_0x1fabda=resolveLocalSqlFilePath(_0x3e3620,_0x4eff81[_0x23149b(0xad)],buildSqlLockEntry(_0x4eff81,ensureRemoteSqlContent(_0x4eff81),'',{'dbName':_0x263912}));if(await fileExists(_0x1fabda)){const _0x350a65=await readFile(_0x1fabda,_0x23149b(0xa1));if(!isEquivalentPulledSqlFile(_0x350a65,_0x35a82a,_0x597bd2)){_0x587e71=!![];break;}}}if(_0x587e71){const _0x3fd3cf=await confirmForceOverwrite(_0x23149b(0x93));if(!_0x3fd3cf)throw CliErrors[_0x23149b(0x8b)](_0x23149b(0xa0));}}const _0x2a4525=cloneSqlLockData(_0x418730),_0x269208=_0x2a4525[_0x23149b(0x9f)][_0x3e3620['appCode']],_0x3ba361=[],_0x2fef96=[];for(const _0xd0ccd7 of _0x865d34){const _0xc3a44=_0x269208['sqls'][_0xd0ccd7[_0x23149b(0xad)]],_0x36c79e=ensureRemoteSqlContent(_0xd0ccd7),_0x4b7427=detectModeFromSql(_0xd0ccd7),_0x61e16a=_0xd0ccd7['dbId']?await getDbName(_0x7be117[_0x23149b(0x82)],Number(_0xd0ccd7['dbId']))[_0x23149b(0xbd)](()=>undefined):undefined,_0x5e6c78=buildLocalSqlFileContent({'sqlCode':_0xd0ccd7[_0x23149b(0xad)],'sqlName':_0xd0ccd7[_0x23149b(0x8e)],'dbId':_0xd0ccd7[_0x23149b(0x94)]},_0x36c79e,{'dbName':_0x61e16a,'mode':_0x4b7427,'syncedAt':new Date()['toISOString'](),'description':_0xd0ccd7[_0x23149b(0x86)]}),_0x597b11=buildSqlLockEntry(_0xd0ccd7,_0x36c79e,computeSqlContentHash(_0x5e6c78),{'dbName':_0x61e16a}),_0x431fce=_0x597b11[_0x23149b(0x95)],_0x3518cf=join(_0x3e3620['sqlRootDir'],_0x431fce);try{if(await fileExists(_0x3518cf)){const _0x2acdde=await readFile(_0x3518cf,_0x23149b(0xa1));if(isEquivalentPulledSqlFile(_0x2acdde,_0x5e6c78,_0x4b7427)){_0x2fef96['push']({'sqlCode':_0xd0ccd7['sqlCode'],'reason':_0x23149b(0xae)}),_0x269208[_0x23149b(0xb5)][_0xd0ccd7[_0x23149b(0xad)]]={..._0x597b11,'hash':computeSqlContentHash(_0x2acdde),'path':_0x431fce};continue;}if(!_0x40b274){_0x2fef96['push']({'sqlCode':_0xd0ccd7[_0x23149b(0xad)],'reason':_0x23149b(0x81)});continue;}}const _0x27e5ca=_0xc3a44?.[_0x23149b(0x95)]?join(_0x3e3620[_0x23149b(0xbb)],_0xc3a44[_0x23149b(0x95)]):undefined;_0x27e5ca&&_0x27e5ca!==_0x3518cf&&await fileExists(_0x27e5ca)&&await rm(_0x27e5ca,{'force':!![]}),await ensureParentDirectory(_0x3518cf),await writeFile(_0x3518cf,_0x5e6c78,_0x23149b(0xa1)),_0x269208['sqls'][_0xd0ccd7[_0x23149b(0xad)]]={..._0x597b11,'path':_0x431fce},_0x3ba361[_0x23149b(0xaf)]({'sqlCode':_0xd0ccd7[_0x23149b(0xad)],'filePath':_0x3518cf});}catch(_0x5e126b){_0x34e9bb['push']({'sqlCode':_0xd0ccd7['sqlCode'],'error':_0x5e126b instanceof Error?_0x5e126b[_0x23149b(0x87)]:String(_0x5e126b)});}}return _0x269208[_0x23149b(0xbf)]=new Date()[_0x23149b(0x9d)](),await writeSqlLockFile(_0x3e3620['lockFilePath'],_0x2a4525),{'ok':_0x34e9bb[_0x23149b(0x7f)]===0x0,'data':{'pulled':_0x3ba361,'skipped':_0x2fef96,'failed':_0x34e9bb},'message':_0x23149b(0xb2)+_0x3ba361[_0x23149b(0x7f)]+_0x23149b(0xa3)+_0x2fef96[_0x23149b(0x7f)]+'\x20skipped,\x20'+_0x34e9bb[_0x23149b(0x7f)]+_0x23149b(0xab)};}};function detectModeFromSql(_0x37602b){const _0x3e69d9=a202_0x4333b4,_0xc5f228=ensureRemoteSqlContent(_0x37602b),_0x58ceee=stripLocalSqlMetadata(_0xc5f228,'mybatisXml')[_0x3e69d9(0x85)]();if(/^<(select|insert|update|delete)\b/i[_0x3e69d9(0xb8)](_0x58ceee))return _0x3e69d9(0xa5);return _0x3e69d9(0xb3);}function isEquivalentPulledSqlFile(_0xe83dcc,_0x4d1961,_0x155a6c){return normalizePullComparableContent(_0xe83dcc,_0x155a6c)===normalizePullComparableContent(_0x4d1961,_0x155a6c);}function normalizePullComparableContent(_0xcc99,_0x4b9242){const _0x2645bc=a202_0x4333b4,_0x395639=_0xcc99[_0x2645bc(0x83)](/\r\n/g,'\x0a')[_0x2645bc(0xb4)]('\x0a'),_0x1c4e06=_0x395639[_0x2645bc(0x98)](_0x193011=>!isSyncedAtMetadataLine(_0x193011,_0x4b9242));return _0x1c4e06[_0x2645bc(0x89)]('\x0a');}function a202_0x3599(_0x1be343,_0x15cbf1){_0x1be343=_0x1be343-0x7f;const _0x49885d=a202_0x4988();let _0x3599ec=_0x49885d[_0x1be343];return _0x3599ec;}function isSyncedAtMetadataLine(_0x5a2002,_0x59cc8a){const _0x41094e=a202_0x4333b4;if(_0x59cc8a==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x41094e(0xb8)](_0x5a2002);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x41094e(0xb8)](_0x5a2002);}