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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (388) hide show
  1. package/README.md +8 -2
  2. package/lib/api/api-doc.js +1 -1
  3. package/lib/api/api-group.js +1 -1
  4. package/lib/api/fetch-model-list.js +1 -1
  5. package/lib/api/generate-api-file.js +1 -1
  6. package/lib/api/generate-sdk-config-file.js +1 -1
  7. package/lib/api/legacy-api-file.js +1 -1
  8. package/lib/api/model-registry-file.js +1 -1
  9. package/lib/api/model-registry-scaffold.js +1 -1
  10. package/lib/api/model-source.js +1 -1
  11. package/lib/auth/auth-server-ui.js +1 -1
  12. package/lib/auth/auth-server.js +1 -1
  13. package/lib/auth/constant.js +1 -1
  14. package/lib/auth/get-cookie.js +1 -1
  15. package/lib/auth/get-session-user.js +1 -1
  16. package/lib/auth/is-session-valid.js +1 -1
  17. package/lib/auth/login-success-html.js +1 -1
  18. package/lib/auth/logout.js +1 -1
  19. package/lib/cli-flags.js +1 -1
  20. package/lib/cli.js +1 -1
  21. package/lib/commands/api/generate.js +1 -1
  22. package/lib/commands/api/index.js +1 -1
  23. package/lib/commands/api/list.js +1 -1
  24. package/lib/commands/api/pull.js +1 -1
  25. package/lib/commands/api/shared.js +1 -1
  26. package/lib/commands/app/detail.d.ts +2 -0
  27. package/lib/commands/app/detail.js +1 -0
  28. package/lib/commands/app/index.js +1 -1
  29. package/lib/commands/app/list.js +1 -1
  30. package/lib/commands/app/members-list.js +1 -1
  31. package/lib/commands/app/remote-directory.js +1 -1
  32. package/lib/commands/app/shared.js +1 -1
  33. package/lib/commands/app-config/delete.js +1 -1
  34. package/lib/commands/app-config/get.js +1 -1
  35. package/lib/commands/app-config/index.js +1 -1
  36. package/lib/commands/app-config/list.js +1 -1
  37. package/lib/commands/app-config/set.js +1 -1
  38. package/lib/commands/app-config/shared.js +1 -1
  39. package/lib/commands/auth/index.js +1 -1
  40. package/lib/commands/bff/create.js +1 -1
  41. package/lib/commands/bff/delete.js +1 -1
  42. package/lib/commands/bff/detail.js +1 -1
  43. package/lib/commands/bff/index.js +1 -1
  44. package/lib/commands/bff/list.js +1 -1
  45. package/lib/commands/bff/logs.js +1 -1
  46. package/lib/commands/bff/pull.js +1 -1
  47. package/lib/commands/bff/push.js +1 -1
  48. package/lib/commands/bff/status.js +1 -1
  49. package/lib/commands/cli-skill/index.js +1 -1
  50. package/lib/commands/cli-update.js +1 -1
  51. package/lib/commands/codegen/index.js +1 -1
  52. package/lib/commands/codegen/sdk.js +1 -1
  53. package/lib/commands/codegen/sql.js +1 -1
  54. package/lib/commands/common/app-registry.js +1 -1
  55. package/lib/commands/common/app-selector.js +1 -1
  56. package/lib/commands/common/async-task.js +1 -1
  57. package/lib/commands/common/dry-run.js +1 -1
  58. package/lib/commands/common/flags.js +1 -1
  59. package/lib/commands/common/local-file.js +1 -1
  60. package/lib/commands/common/validate.js +1 -1
  61. package/lib/commands/config/delete.js +1 -1
  62. package/lib/commands/config/get.js +1 -1
  63. package/lib/commands/config/index.js +1 -1
  64. package/lib/commands/config/init.js +1 -1
  65. package/lib/commands/config/list.js +1 -1
  66. package/lib/commands/config/set.js +1 -1
  67. package/lib/commands/config/shared.js +1 -1
  68. package/lib/commands/dataset/batch-design.js +1 -1
  69. package/lib/commands/dataset/business-group-update.js +1 -1
  70. package/lib/commands/dataset/business-groups.js +1 -1
  71. package/lib/commands/dataset/capability.js +1 -1
  72. package/lib/commands/dataset/cross-relation-create.js +1 -1
  73. package/lib/commands/dataset/cross-relation-delete.js +1 -1
  74. package/lib/commands/dataset/cross-relation-list.js +1 -1
  75. package/lib/commands/dataset/cross-relation-shared.js +1 -1
  76. package/lib/commands/dataset/cross-relation-update.js +1 -1
  77. package/lib/commands/dataset/delete.js +1 -1
  78. package/lib/commands/dataset/detail.js +1 -1
  79. package/lib/commands/dataset/extend-update.js +1 -1
  80. package/lib/commands/dataset/field-restore.js +1 -1
  81. package/lib/commands/dataset/field-update.js +1 -1
  82. package/lib/commands/dataset/generate.js +1 -1
  83. package/lib/commands/dataset/index.js +1 -1
  84. package/lib/commands/dataset/list.js +1 -1
  85. package/lib/commands/dataset/operations.js +1 -1
  86. package/lib/commands/dataset/relation-audit.js +1 -1
  87. package/lib/commands/dataset/relation-create.js +1 -1
  88. package/lib/commands/dataset/relation-delete.js +1 -1
  89. package/lib/commands/dataset/relation-shared.js +1 -1
  90. package/lib/commands/dataset/relation-update.js +1 -1
  91. package/lib/commands/dataset/relations.js +1 -1
  92. package/lib/commands/dataset/rename.js +1 -1
  93. package/lib/commands/dataset/restore.js +1 -1
  94. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  95. package/lib/commands/db/analysis-batching.js +1 -1
  96. package/lib/commands/db/analyze-batch-plan.js +1 -1
  97. package/lib/commands/db/analyze-cancel.js +1 -1
  98. package/lib/commands/db/analyze-start.js +1 -1
  99. package/lib/commands/db/analyze-status.js +1 -1
  100. package/lib/commands/db/create.js +1 -1
  101. package/lib/commands/db/delete.js +1 -1
  102. package/lib/commands/db/detail.js +1 -1
  103. package/lib/commands/db/diff-refresh-start.js +1 -1
  104. package/lib/commands/db/diff-refresh-status.js +1 -1
  105. package/lib/commands/db/diff.js +1 -1
  106. package/lib/commands/db/index.js +1 -1
  107. package/lib/commands/db/list.js +1 -1
  108. package/lib/commands/db/shared.js +1 -1
  109. package/lib/commands/db/table-diff-shared.js +1 -1
  110. package/lib/commands/db/tables.js +1 -1
  111. package/lib/commands/db/test.js +1 -1
  112. package/lib/commands/db/update.js +1 -1
  113. package/lib/commands/deployment/index.js +1 -1
  114. package/lib/commands/deployment/sync-all.js +1 -1
  115. package/lib/commands/deployment/sync-jobs.js +1 -1
  116. package/lib/commands/deployment/sync-status.js +1 -1
  117. package/lib/commands/doctor.js +1 -1
  118. package/lib/commands/file/index.js +1 -1
  119. package/lib/commands/flow/create.js +1 -1
  120. package/lib/commands/flow/detail.js +1 -1
  121. package/lib/commands/flow/index.js +1 -1
  122. package/lib/commands/flow/list.js +1 -1
  123. package/lib/commands/flow/publish.js +1 -1
  124. package/lib/commands/flow/runtime-resources-shared.js +1 -1
  125. package/lib/commands/flow/runtime-role-list.js +1 -1
  126. package/lib/commands/flow/runtime-role-user-list.js +1 -1
  127. package/lib/commands/flow/runtime-user-search.js +1 -1
  128. package/lib/commands/flow/shared.js +1 -1
  129. package/lib/commands/flow/update.js +1 -1
  130. package/lib/commands/flow/validate.js +1 -1
  131. package/lib/commands/instant-api-policy/current.js +1 -1
  132. package/lib/commands/instant-api-policy/index.js +1 -1
  133. package/lib/commands/instant-api-policy/init.js +1 -1
  134. package/lib/commands/instant-api-policy/publish.js +1 -1
  135. package/lib/commands/instant-api-policy/pull.js +1 -1
  136. package/lib/commands/instant-api-policy/revision.js +1 -1
  137. package/lib/commands/instant-api-policy/revisions.js +1 -1
  138. package/lib/commands/instant-api-policy/rollback.js +1 -1
  139. package/lib/commands/instant-api-policy/shared.js +1 -1
  140. package/lib/commands/instant-api-policy/validate.js +1 -1
  141. package/lib/commands/issue/index.js +1 -1
  142. package/lib/commands/issue/nudge.js +1 -1
  143. package/lib/commands/issue/report.js +1 -1
  144. package/lib/commands/issue/shared.js +1 -1
  145. package/lib/commands/kb/create.js +1 -1
  146. package/lib/commands/kb/delete.js +1 -1
  147. package/lib/commands/kb/detail.js +1 -1
  148. package/lib/commands/kb/index.js +1 -1
  149. package/lib/commands/kb/list.js +1 -1
  150. package/lib/commands/kb/search.js +1 -1
  151. package/lib/commands/kb/shared.js +1 -1
  152. package/lib/commands/kb/update.js +1 -1
  153. package/lib/commands/logs/index.js +1 -1
  154. package/lib/commands/menu/asset-update.js +1 -1
  155. package/lib/commands/menu/delete.js +1 -1
  156. package/lib/commands/menu/external-link-create.js +1 -1
  157. package/lib/commands/menu/external-link-update.js +1 -1
  158. package/lib/commands/menu/group-create.js +1 -1
  159. package/lib/commands/menu/group-update.js +1 -1
  160. package/lib/commands/menu/index.js +1 -1
  161. package/lib/commands/menu/list.js +1 -1
  162. package/lib/commands/menu/move.js +1 -1
  163. package/lib/commands/menu/regroup-start.js +1 -1
  164. package/lib/commands/menu/rename.js +1 -1
  165. package/lib/commands/menu/shared/compare-table.js +1 -1
  166. package/lib/commands/menu/shared/delete-plan.js +1 -1
  167. package/lib/commands/menu/shared/facts.js +1 -1
  168. package/lib/commands/menu/shared/index.js +1 -1
  169. package/lib/commands/menu/shared/inquirer.js +1 -1
  170. package/lib/commands/menu/shared/local-pages.d.ts +1 -1
  171. package/lib/commands/menu/shared/local-pages.js +1 -1
  172. package/lib/commands/menu/shared/logic.d.ts +3 -1
  173. package/lib/commands/menu/shared/logic.js +1 -1
  174. package/lib/commands/menu/shared/mutations.js +1 -1
  175. package/lib/commands/menu/shared/path.d.ts +2 -0
  176. package/lib/commands/menu/shared/path.js +1 -0
  177. package/lib/commands/menu/shared/service.d.ts +6 -1
  178. package/lib/commands/menu/shared/service.js +1 -1
  179. package/lib/commands/menu/shared/subapp-assets.d.ts +28 -0
  180. package/lib/commands/menu/shared/subapp-assets.js +1 -0
  181. package/lib/commands/menu/shared/sync-core.d.ts +2 -1
  182. package/lib/commands/menu/shared/sync-core.js +1 -1
  183. package/lib/commands/menu/shared/types.d.ts +14 -4
  184. package/lib/commands/menu/shared/update-core.js +1 -1
  185. package/lib/commands/menu/shared/valid-url.js +1 -1
  186. package/lib/commands/menu/subapp-assets-status.d.ts +2 -0
  187. package/lib/commands/menu/subapp-assets-status.js +1 -0
  188. package/lib/commands/menu/subapp-assets-update.d.ts +2 -0
  189. package/lib/commands/menu/subapp-assets-update.js +1 -0
  190. package/lib/commands/menu/sync.js +1 -1
  191. package/lib/commands/menu/visibility-update.js +1 -1
  192. package/lib/commands/notification/config-create.js +1 -1
  193. package/lib/commands/notification/config-delete.js +1 -1
  194. package/lib/commands/notification/config-list.js +1 -1
  195. package/lib/commands/notification/config-update.js +1 -1
  196. package/lib/commands/notification/index.js +1 -1
  197. package/lib/commands/notification/shared.js +1 -1
  198. package/lib/commands/ocr/index.js +1 -1
  199. package/lib/commands/page/create.js +1 -1
  200. package/lib/commands/page/custom/detail.js +1 -1
  201. package/lib/commands/page/custom/list.js +1 -1
  202. package/lib/commands/page/custom/publish.js +1 -1
  203. package/lib/commands/page/custom/shared.js +1 -1
  204. package/lib/commands/page/custom/syntax.js +1 -1
  205. package/lib/commands/page/custom/update.js +1 -1
  206. package/lib/commands/page/data-list-status.js +1 -1
  207. package/lib/commands/page/generate-start.js +1 -1
  208. package/lib/commands/page/generate-status.js +1 -1
  209. package/lib/commands/page/index.js +1 -1
  210. package/lib/commands/page/pull.js +1 -1
  211. package/lib/commands/page/push.js +1 -1
  212. package/lib/commands/page/relation-audit.js +1 -1
  213. package/lib/commands/page/restore.js +1 -1
  214. package/lib/commands/page/shared.js +1 -1
  215. package/lib/commands/page/sync.js +1 -1
  216. package/lib/commands/project/api-architecture-upgrade.js +1 -1
  217. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  218. package/lib/commands/project/create/format-elapsed.js +1 -1
  219. package/lib/commands/project/create/main.js +1 -1
  220. package/lib/commands/project/create/materialize-project-template.js +1 -1
  221. package/lib/commands/project/create/project-name.js +1 -1
  222. package/lib/commands/project/create/project-template-archive.js +1 -1
  223. package/lib/commands/project/create/project-template-path.js +1 -1
  224. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  225. package/lib/commands/project/create/use-format-code.js +1 -1
  226. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  227. package/lib/commands/project/domain-routing-sync.js +1 -1
  228. package/lib/commands/project/index.js +1 -1
  229. package/lib/commands/project/upgrade.js +1 -1
  230. package/lib/commands/registry.js +1 -1
  231. package/lib/commands/role/delete.js +1 -1
  232. package/lib/commands/role/detail.js +1 -1
  233. package/lib/commands/role/index.js +1 -1
  234. package/lib/commands/role/list.js +1 -1
  235. package/lib/commands/role/shared.js +1 -1
  236. package/lib/commands/role/update.js +1 -1
  237. package/lib/commands/role/user-add.js +1 -1
  238. package/lib/commands/role/user-remove.js +1 -1
  239. package/lib/commands/role/user-resolve.js +1 -1
  240. package/lib/commands/rule/get.js +1 -1
  241. package/lib/commands/rule/index.js +1 -1
  242. package/lib/commands/rule/list.js +1 -1
  243. package/lib/commands/rule/set.js +1 -1
  244. package/lib/commands/rule/shared.js +1 -1
  245. package/lib/commands/run/index.js +1 -1
  246. package/lib/commands/schema.js +1 -1
  247. package/lib/commands/sql/create.js +1 -1
  248. package/lib/commands/sql/delete.js +1 -1
  249. package/lib/commands/sql/detail.js +1 -1
  250. package/lib/commands/sql/exec.js +1 -1
  251. package/lib/commands/sql/index.js +1 -1
  252. package/lib/commands/sql/list.js +1 -1
  253. package/lib/commands/sql/pull.js +1 -1
  254. package/lib/commands/sql/push.js +1 -1
  255. package/lib/commands/sql/shared.js +1 -1
  256. package/lib/commands/sql/status.js +1 -1
  257. package/lib/commands/sql/validate.js +1 -1
  258. package/lib/commands/task/index.js +1 -1
  259. package/lib/commands/task/status.js +1 -1
  260. package/lib/commands/tenant/index.js +1 -1
  261. package/lib/commands/tenant/members-list.js +1 -1
  262. package/lib/commands/tenant/shared.js +1 -1
  263. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  264. package/lib/commands/user-account/feishu-bind.js +1 -1
  265. package/lib/commands/user-account/index.js +1 -1
  266. package/lib/commands/workspace/add.js +1 -1
  267. package/lib/commands/workspace/index.js +1 -1
  268. package/lib/commands/workspace/remove.js +1 -1
  269. package/lib/config/domain-config.js +1 -1
  270. package/lib/config/project-domain-routing.js +1 -1
  271. package/lib/config/region-config.js +1 -1
  272. package/lib/config/schema.js +1 -1
  273. package/lib/constant/cdn.js +1 -1
  274. package/lib/constant/cli.js +1 -1
  275. package/lib/constant/defaults.js +1 -1
  276. package/lib/constant/domain.js +1 -1
  277. package/lib/constant/env.js +1 -1
  278. package/lib/constant/output.js +1 -1
  279. package/lib/constant/paths.js +1 -1
  280. package/lib/constant/region.js +1 -1
  281. package/lib/constant/risk.js +1 -1
  282. package/lib/constant/routing-profile.js +1 -1
  283. package/lib/context/app-resolver.js +1 -1
  284. package/lib/context/auth-resolver.js +1 -1
  285. package/lib/context/config-loader.js +1 -1
  286. package/lib/context.js +1 -1
  287. package/lib/core/alias-resolver.js +1 -1
  288. package/lib/core/api-client.d.ts +15 -0
  289. package/lib/core/api-client.js +1 -1
  290. package/lib/core/bff/config.js +1 -1
  291. package/lib/core/bff/file-system.js +1 -1
  292. package/lib/core/bff/hash.js +1 -1
  293. package/lib/core/bff/hook-directory.js +1 -1
  294. package/lib/core/bff/lock.js +1 -1
  295. package/lib/core/bff/utils.js +1 -1
  296. package/lib/core/cross-db-relation.js +1 -1
  297. package/lib/core/db-resolver.js +1 -1
  298. package/lib/core/flow-config.js +1 -1
  299. package/lib/core/instant-api-policy/config.js +1 -1
  300. package/lib/core/kb-search-client.js +1 -1
  301. package/lib/core/page/file-system.js +1 -1
  302. package/lib/core/page/hash.js +1 -1
  303. package/lib/core/page/lock.js +1 -1
  304. package/lib/core/page/lr-smart-jsx.js +1 -1
  305. package/lib/core/sql-index-auditor.js +1 -1
  306. package/lib/core/sql-sync/config.js +1 -1
  307. package/lib/core/sql-sync/file-system.js +1 -1
  308. package/lib/core/sql-sync/hash.js +1 -1
  309. package/lib/core/sql-sync/lock.js +1 -1
  310. package/lib/core/sql-sync/utils.js +1 -1
  311. package/lib/core/sql-validator.js +1 -1
  312. package/lib/errors.js +1 -1
  313. package/lib/framework/build-all-flags.js +1 -1
  314. package/lib/framework/error-output.js +1 -1
  315. package/lib/framework/explicit-yes.js +1 -1
  316. package/lib/framework/flags.js +1 -1
  317. package/lib/framework/help.js +1 -1
  318. package/lib/framework/index.js +1 -1
  319. package/lib/framework/output.js +1 -1
  320. package/lib/framework/response.js +1 -1
  321. package/lib/framework/runner-alias.js +1 -1
  322. package/lib/framework/runner.js +1 -1
  323. package/lib/framework/schema-export.js +1 -1
  324. package/lib/framework/supported-flags.js +1 -1
  325. package/lib/framework/types.js +1 -1
  326. package/lib/generated/build-info.d.ts +4 -4
  327. package/lib/generated/build-info.js +1 -1
  328. package/lib/generated/official-routing.js +1 -1
  329. package/lib/generated/routing-contract.js +1 -1
  330. package/lib/help.js +1 -1
  331. package/lib/postinstall.js +1 -1
  332. package/lib/runtime/confirmation.js +1 -1
  333. package/lib/runtime/event.js +1 -1
  334. package/lib/runtime/index.js +1 -1
  335. package/lib/runtime/queue.js +1 -1
  336. package/lib/runtime/resolve.js +1 -1
  337. package/lib/skills/builtin-skill.js +1 -1
  338. package/lib/skills/main.js +1 -1
  339. package/lib/skills/npx-skills-add.js +1 -1
  340. package/lib/skills/skill-presence.js +1 -1
  341. package/lib/telemetry/cli-command-trace.js +1 -1
  342. package/lib/telemetry/cli-help-trace.js +1 -1
  343. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  344. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  345. package/lib/telemetry/send-cli-trace-log.js +1 -1
  346. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  347. package/lib/utils/ai_config.js +1 -1
  348. package/lib/utils/apply-jq-filter.js +1 -1
  349. package/lib/utils/cdn-config.js +1 -1
  350. package/lib/utils/check-sdk-version.js +1 -1
  351. package/lib/utils/cli-version-check.js +1 -1
  352. package/lib/utils/cli-version-policy.js +1 -1
  353. package/lib/utils/config.js +1 -1
  354. package/lib/utils/entity-with-id.js +1 -1
  355. package/lib/utils/file-utils.js +1 -1
  356. package/lib/utils/guides-cdn.js +1 -1
  357. package/lib/utils/http-client.js +1 -1
  358. package/lib/utils/is-non-interactive.js +1 -1
  359. package/lib/utils/logger.js +1 -1
  360. package/lib/utils/params.js +1 -1
  361. package/lib/utils/platform.js +1 -1
  362. package/lib/utils/sleep.js +1 -1
  363. package/lib/utils/template-replacer.js +1 -1
  364. package/lib/utils/update-notice.js +1 -1
  365. package/lib/utils/version.js +1 -1
  366. package/lib/utils/with-active-cookie.js +1 -1
  367. package/lib/utils/write-cli-side-channel.js +1 -1
  368. package/package.json +1 -1
  369. package/skills/rabetbase/SKILL.md +21 -12
  370. package/skills/rabetbase/guides/backend-function.md +2 -7
  371. package/skills/rabetbase/guides/bff-creation-workflow.md +24 -23
  372. package/skills/rabetbase/guides/host-frontend-integration.md +62 -0
  373. package/skills/rabetbase/guides/independent-deployment.md +45 -0
  374. package/skills/rabetbase/guides/troubleshooting.md +9 -1
  375. package/skills/rabetbase/references/rabetbase-app-detail.md +31 -0
  376. package/skills/rabetbase/references/rabetbase-bff-detail.md +1 -1
  377. package/skills/rabetbase/references/rabetbase-bff-push.md +2 -2
  378. package/skills/rabetbase/references/rabetbase-data-list-status.md +1 -0
  379. package/skills/rabetbase/references/rabetbase-deployment-sync-all.md +5 -1
  380. package/skills/rabetbase/references/rabetbase-menu-asset-update.md +9 -7
  381. package/skills/rabetbase/references/rabetbase-menu-list.md +2 -2
  382. package/skills/rabetbase/references/rabetbase-menu-subapp-assets-status.md +19 -0
  383. package/skills/rabetbase/references/rabetbase-menu-subapp-assets-update.md +27 -0
  384. package/skills/rabetbase/references/rabetbase-menu-sync.md +40 -14
  385. package/skills/rabetbase/references/rabetbase-page-create.md +1 -1
  386. package/skills/rabetbase/references/rabetbase-page-generate-start.md +5 -3
  387. package/skills/rabetbase/references/rabetbase-page-generate-status.md +1 -0
  388. package/skills/rabetbase.manifest.json +8 -3
@@ -1 +1 @@
1
- const a219_0x14d093=a219_0x3397;(function(_0x4b68a7,_0x1bf900){const _0x42419d=a219_0x3397,_0x35ca4b=_0x4b68a7();while(!![]){try{const _0x278839=-parseInt(_0x42419d(0xa9))/0x1+parseInt(_0x42419d(0xd8))/0x2+parseInt(_0x42419d(0xb5))/0x3+-parseInt(_0x42419d(0xb1))/0x4+-parseInt(_0x42419d(0xbe))/0x5+-parseInt(_0x42419d(0xf0))/0x6*(parseInt(_0x42419d(0xe0))/0x7)+parseInt(_0x42419d(0xf2))/0x8;if(_0x278839===_0x1bf900)break;else _0x35ca4b['push'](_0x35ca4b['shift']());}catch(_0x132358){_0x35ca4b['push'](_0x35ca4b['shift']());}}}(a219_0x5cc1,0x9a945));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a219_0x14d093(0xd9),'required':!![],'description':a219_0x14d093(0xd7)};export const ROLE_REF_FLAG={'name':a219_0x14d093(0xf4),'type':a219_0x14d093(0xeb),'required':!![],'description':a219_0x14d093(0xdf)};export const USER_REF_FLAG={'name':a219_0x14d093(0xa8),'type':a219_0x14d093(0xeb),'required':!![],'description':a219_0x14d093(0xb8)};export const NAME_FLAG={'name':a219_0x14d093(0xc5),'type':a219_0x14d093(0xeb),'required':!![],'description':a219_0x14d093(0xb4)};export const USER_NAME_FLAG={'name':'name','type':a219_0x14d093(0xeb),'required':!![],'description':a219_0x14d093(0xd1)};export const REMARK_FLAG={'name':'remark','type':a219_0x14d093(0xeb),'required':![],'description':a219_0x14d093(0xf6)};export const EXPECT_USER_COUNT_FLAG={'name':a219_0x14d093(0xcb),'type':a219_0x14d093(0xd9),'required':![],'description':a219_0x14d093(0xab)};export const BUILTIN_ROLE_TYPES=[a219_0x14d093(0xb7),a219_0x14d093(0xda),a219_0x14d093(0xb0)];export function isBuiltinRole(_0x31523e){const _0x4d6f90=a219_0x14d093;return BUILTIN_ROLE_TYPES[_0x4d6f90(0xb2)](_0x31523e);}export function assertCustomRole(_0x2d33b0,_0x4c4f8e){const _0x27c059=a219_0x14d093;if(_0x2d33b0[_0x27c059(0xc0)]!==_0x27c059(0xc2))throw CliErrors[_0x27c059(0xad)](_0x27c059(0xe2)+_0x4c4f8e+_0x27c059(0xdd)+_0x2d33b0[_0x27c059(0xaa)]+'\x20('+_0x2d33b0[_0x27c059(0xc0)]+').',_0x27c059(0xd3));}export function projectRole(_0x412fc2){const _0x2d44f7=a219_0x14d093;return{'id':_0x412fc2['id'],'roleName':_0x412fc2[_0x2d44f7(0xaa)],'roleType':_0x412fc2[_0x2d44f7(0xc0)],'remark':_0x412fc2['remark'],'userCount':_0x412fc2[_0x2d44f7(0xe3)],'permitCount':_0x412fc2['permitCount'],'builtin':isBuiltinRole(_0x412fc2['roleType'])};}export async function resolveRoleRef(_0x5cd510,_0x35ae64){const _0x43064b=a219_0x14d093,_0x438ceb=_0x35ae64[_0x43064b(0xe1)]();if(!_0x438ceb)throw CliErrors[_0x43064b(0xad)](_0x43064b(0xf5),_0x43064b(0xe8));if(/^\d+$/[_0x43064b(0xd5)](_0x438ceb))return getRoleById(_0x5cd510,Number(_0x438ceb));const _0x2cef3f=await listAllAppRoles(_0x5cd510),_0x2a1535=_0x2cef3f[_0x43064b(0xb6)](_0x1f0c6e=>_0x1f0c6e[_0x43064b(0xaa)]===_0x438ceb);if(_0x2a1535[_0x43064b(0xb3)]===0x0)throw CliErrors[_0x43064b(0xad)](_0x43064b(0xe7)+_0x438ceb+_0x43064b(0xac)+_0x5cd510+'.',_0x43064b(0xbf));if(_0x2a1535[_0x43064b(0xb3)]>0x1){const _0x537d75=_0x2a1535['map'](_0x2592ab=>_0x2592ab['id'])['join'](',\x20');throw CliErrors[_0x43064b(0xad)]('Role\x20name\x20\x22'+_0x438ceb+_0x43064b(0xbb)+_0x537d75+').',_0x43064b(0xd4));}return _0x2a1535[0x0];}export async function getRoleById(_0x43ffc6,_0x3feedd){const _0x12e386=a219_0x14d093,_0x583075=await listAllAppRoles(_0x43ffc6),_0x3292fa=_0x583075[_0x12e386(0xb6)](_0xe9a368=>_0xe9a368['id']===_0x3feedd&&(!_0xe9a368[_0x12e386(0xd2)]||_0xe9a368[_0x12e386(0xd2)]===_0x43ffc6));if(_0x3292fa['length']!==0x1)throw CliErrors[_0x12e386(0xad)]('Role\x20id\x20'+_0x3feedd+_0x12e386(0xb9)+_0x43ffc6+'.',_0x12e386(0xdb));return _0x3292fa[0x0];}async function listAllAppRoles(_0x1a4662){const _0x3cfb53=a219_0x14d093,_0x4294fc=0x64,_0x2c725c=[];for(let _0x40031f=0x1;;_0x40031f+=0x1){const {items:_0x192035,paging:_0x3bd34e}=await listAppRoles(_0x1a4662,{'currentPage':_0x40031f,'pageSize':_0x4294fc});_0x2c725c[_0x3cfb53(0xed)](..._0x192035);if(_0x192035['length']<_0x4294fc||_0x3bd34e&&_0x2c725c[_0x3cfb53(0xb3)]>=_0x3bd34e['totalCount'])return _0x2c725c;}}export async function resolveTenantCode(){const _0x13428b=a219_0x14d093,_0x3c9944=await getSessionUserInfo(),_0x5058ae=_0x3c9944?.[_0x13428b(0xa8)]?.[_0x13428b(0xcf)]?.[_0x13428b(0xbc)];if(!_0x5058ae)throw CliErrors[_0x13428b(0xef)](_0x13428b(0xae));return _0x5058ae;}function matchMember(_0x41d1bd,_0x6e4183){const _0x5806ae=a219_0x14d093,_0x5e545c=_0x6e4183['trim']()['toLowerCase']();return(_0x41d1bd[_0x5806ae(0xc6)]??'')[_0x5806ae(0xe9)]()===_0x5e545c||(_0x41d1bd[_0x5806ae(0xce)]??'')[_0x5806ae(0xe9)]()===_0x5e545c;}export async function resolveUserRef(_0x32ec12,_0x4c0db0='Pass\x20--user\x20<id>.'){const _0x35c711=a219_0x14d093,_0x911de6=_0x32ec12[_0x35c711(0xe1)]();if(!_0x911de6)throw CliErrors[_0x35c711(0xad)]('Missing\x20user\x20reference.',_0x35c711(0xaf));const _0x5b3e78=await resolveTenantCode(),_0x30dd2b=await getTenantMembers(_0x5b3e78);if(/^\d+$/[_0x35c711(0xd5)](_0x911de6)){const _0x3cfdf2=Number(_0x911de6),_0x418118=_0x30dd2b[_0x35c711(0xe6)](_0x11e04e=>_0x11e04e[_0x35c711(0xf7)]===_0x3cfdf2);return{'userId':_0x3cfdf2,'username':_0x418118?.[_0x35c711(0xce)]??String(_0x3cfdf2),'nickname':_0x418118?.[_0x35c711(0xc6)],'matchedBy':'id'};}const _0x245139=_0x30dd2b[_0x35c711(0xb6)](_0x50969e=>matchMember(_0x50969e,_0x911de6));if(_0x245139[_0x35c711(0xb3)]===0x0)throw CliErrors[_0x35c711(0xad)](_0x35c711(0xdc)+_0x911de6+'\x22.',_0x35c711(0xa7)+_0x4c0db0);if(_0x245139['length']>0x1){const _0x432ed7=_0x245139[_0x35c711(0xcc)](_0x1d9755=>(_0x1d9755[_0x35c711(0xc6)]??_0x1d9755[_0x35c711(0xce)]??'?')+'('+_0x1d9755['userId']+')')[_0x35c711(0xe4)](',\x20');throw CliErrors[_0x35c711(0xad)](_0x35c711(0xc9)+_0x911de6+'\x22:\x20'+_0x432ed7+'.',_0x4c0db0);}const _0x28030b=_0x245139[0x0];return{'userId':_0x28030b['userId'],'username':_0x28030b[_0x35c711(0xce)]??String(_0x28030b['userId']),'nickname':_0x28030b[_0x35c711(0xc6)],'matchedBy':_0x35c711(0xc5)};}export const CREATE_USER_ROLE_PATH=a219_0x14d093(0xea);export const DELETE_USER_ROLE_PATH=a219_0x14d093(0xca);export function computeRoleUserMutation(_0x2b9c2d){const _0x92539b=a219_0x14d093,{operation:_0x14ecea,appCode:_0x3dfb8e,role:_0x491f00,relations:_0x43af9b,user:_0x47a4f0}=_0x2b9c2d,_0x41bc92=[...new Set(_0x43af9b[_0x92539b(0xcc)](_0x28bbc1=>_0x28bbc1['userId']))],_0x97f4a4=[];if(_0x2b9c2d[_0x92539b(0xc1)]!==undefined&&_0x2b9c2d[_0x92539b(0xc1)]!==_0x41bc92[_0x92539b(0xb3)])throw CliErrors[_0x92539b(0xad)]('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x2b9c2d[_0x92539b(0xc1)]+_0x92539b(0xd6)+_0x41bc92[_0x92539b(0xb3)]+'.',_0x92539b(0xcd));const _0x93b1a9=_0x41bc92[_0x92539b(0xb2)](_0x47a4f0['userId']),_0x8f7d5f=_0x43af9b[_0x92539b(0xb6)](_0x817b5b=>_0x817b5b[_0x92539b(0xf7)]===_0x47a4f0[_0x92539b(0xf7)])['map'](_0x41cc15=>_0x41cc15['id']),_0x9f9ac8=_0x14ecea===_0x92539b(0xbd)?!_0x93b1a9:_0x93b1a9;let _0x4de105=_0x41bc92;_0x14ecea===_0x92539b(0xbd)?_0x93b1a9?_0x97f4a4['push'](_0x92539b(0xe5)+_0x47a4f0[_0x92539b(0xf7)]+_0x92539b(0xc3)+_0x491f00[_0x92539b(0xaa)]+_0x92539b(0xf1)):_0x4de105=[..._0x41bc92,_0x47a4f0[_0x92539b(0xf7)]]:!_0x93b1a9?_0x97f4a4[_0x92539b(0xed)]('User\x20'+_0x47a4f0[_0x92539b(0xf7)]+_0x92539b(0xee)+_0x491f00[_0x92539b(0xaa)]+_0x92539b(0xf1)):(_0x4de105=_0x41bc92[_0x92539b(0xb6)](_0x5c8ad6=>_0x5c8ad6!==_0x47a4f0[_0x92539b(0xf7)]),_0x8f7d5f['length']>0x1&&_0x97f4a4[_0x92539b(0xed)](_0x92539b(0xd0)+_0x8f7d5f[_0x92539b(0xb3)]+'\x20duplicate\x20memberships\x20for\x20user\x20'+_0x47a4f0[_0x92539b(0xf7)]+'.'));const _0x2f5a8d={'scope':_0x92539b(0xf3),'operation':_0x14ecea,'selector':{'appCode':_0x3dfb8e,'roleId':_0x491f00['id'],'roleName':_0x491f00[_0x92539b(0xaa)],'userId':_0x47a4f0[_0x92539b(0xf7)]},'before':{'userIds':_0x41bc92},'after':{'userIds':_0x4de105},'dryRun':_0x2b9c2d['dryRun'],'backend':{'method':_0x92539b(0xde),'path':_0x14ecea==='user-add'?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x97f4a4};return{'mutation':_0x2f5a8d,'changed':_0x9f9ac8,'matchingRelationIds':_0x8f7d5f};}function a219_0x3397(_0x92d656,_0x51e8bf){_0x92d656=_0x92d656-0xa7;const _0x5cc124=a219_0x5cc1();let _0x3397d4=_0x5cc124[_0x92d656];return _0x3397d4;}export async function loadDevRoleRelations(_0x392850,_0x634ba){const _0x1210ff=a219_0x14d093,_0xf64214=0x64,_0x3ca357=[];for(let _0x4a9a9a=0x1;;_0x4a9a9a+=0x1){const {items:_0x5d071e,paging:_0x2eee6b}=await listDevUserRoleRelations(_0x392850,{'roleId':_0x634ba,'currentPage':_0x4a9a9a,'pageSize':_0xf64214});_0x3ca357['push'](..._0x5d071e);if(_0x5d071e[_0x1210ff(0xb3)]<_0xf64214||_0x2eee6b&&_0x3ca357[_0x1210ff(0xb3)]>=_0x2eee6b[_0x1210ff(0xc7)])return _0x3ca357;}}export function readRoleRef(_0x38d103){const _0x2a91fc=a219_0x14d093,_0x1739d4=_0x38d103[_0x2a91fc(0xba)](_0x2a91fc(0xf4))[_0x2a91fc(0xe1)]();if(!_0x1739d4)throw CliErrors[_0x2a91fc(0xc8)](_0x2a91fc(0xf4),_0x2a91fc(0xe8));return _0x1739d4;}function a219_0x5cc1(){const _0x16bb32=['1581505FnCODH','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','roleType','expectUserCount','CUSTOM','\x20is\x20already\x20a\x20member\x20of\x20role\x20','flag','name','nickname','totalCount','flagMissing','Multiple\x20tenant\x20members\x20match\x20\x22','/smartapi/permit/user-role/delete','expect-user-count','map','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','username','tenant','Removed\x20','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','appCode','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','Disambiguate\x20with\x20--role\x20<id>.','test','\x20member(s)\x20but\x20role\x20has\x20','Role\x20id\x20(from\x20`role\x20list`)','855952PYdWOi','number','DEV','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','No\x20tenant\x20member\x20matches\x20\x22','\x20built-in\x20role\x20','POST','Role\x20id\x20or\x20exact\x20role\x20name','7119sNWotm','trim','Cannot\x20','userCount','join','User\x20','find','Role\x20name\x20\x22','Pass\x20--role\x20<id|name>.','toLowerCase','/smartapi/permit/user-role/create','string','\x20members\x20of\x20the\x20OWNER\x20role.','push','\x20is\x20not\x20a\x20member\x20of\x20role\x20','authRequired','174yojTuh',';\x20no\x20change.','15611848wMGfaX','dev','role','Missing\x20role\x20reference.','Optional\x20role\x20remark/description','userId','Check\x20the\x20nickname/username.\x20','user','1016346Dbgzjx','roleName','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','\x22\x20not\x20found\x20in\x20app\x20','validation','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','Pass\x20--user\x20<id|name>.','OWNER','3218084pmpHyH','includes','length','Role\x20name','1261083cRrfGQ','filter','ADMIN','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','\x20not\x20found\x20in\x20app\x20','str','\x22\x20is\x20ambiguous\x20(ids:\x20','tenant_code','user-add'];a219_0x5cc1=function(){return _0x16bb32;};return a219_0x5cc1();}export async function prepareUserMutation(_0x2ccc8d,_0x294fff,_0xb36a5){const _0x5a2b32=a219_0x14d093,_0x2f5de8=readRoleRef(_0x2ccc8d),_0x323951=_0x2ccc8d[_0x5a2b32(0xba)](_0x5a2b32(0xa8))[_0x5a2b32(0xe1)]();if(!_0x323951)throw CliErrors['flagMissing'](_0x5a2b32(0xa8),_0x5a2b32(0xaf));const _0x57f2c9=_0x2ccc8d[_0x5a2b32(0xc4)]('expect-user-count'),_0x253a5a=_0x57f2c9===undefined||_0x57f2c9===null?undefined:Number(_0x57f2c9),_0x333906=await resolveRoleRef(_0x2ccc8d['appCode'],_0x2f5de8);if(_0x333906[_0x5a2b32(0xc0)]===_0x5a2b32(0xb0))throw CliErrors[_0x5a2b32(0xad)](_0x5a2b32(0xe2)+_0x294fff+_0x5a2b32(0xec),'Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.');const _0x30be37=await resolveUserRef(_0x323951),_0x3ed31f=await loadDevRoleRelations(_0x2ccc8d[_0x5a2b32(0xd2)],_0x333906['id']);return{...computeRoleUserMutation({'operation':_0x294fff,'appCode':_0x2ccc8d[_0x5a2b32(0xd2)],'role':_0x333906,'relations':_0x3ed31f,'user':{'userId':_0x30be37[_0x5a2b32(0xf7)],'username':_0x30be37['username'],'nickname':_0x30be37[_0x5a2b32(0xc6)]},'dryRun':_0xb36a5,..._0x253a5a!==undefined?{'expectUserCount':_0x253a5a}:{}}),'role':_0x333906,'user':_0x30be37};}
1
+ const a224_0x13a989=a224_0x3862;(function(_0x3d750c,_0x3eeaf8){const _0x1ec2ad=a224_0x3862,_0x1278ef=_0x3d750c();while(!![]){try{const _0x3b27a7=parseInt(_0x1ec2ad(0xb8))/0x1+-parseInt(_0x1ec2ad(0xc7))/0x2+-parseInt(_0x1ec2ad(0xeb))/0x3+parseInt(_0x1ec2ad(0xd2))/0x4*(-parseInt(_0x1ec2ad(0xc5))/0x5)+parseInt(_0x1ec2ad(0xba))/0x6+-parseInt(_0x1ec2ad(0xd1))/0x7*(parseInt(_0x1ec2ad(0xea))/0x8)+parseInt(_0x1ec2ad(0xd3))/0x9;if(_0x3b27a7===_0x3eeaf8)break;else _0x1278ef['push'](_0x1278ef['shift']());}catch(_0x5df6ab){_0x1278ef['push'](_0x1278ef['shift']());}}}(a224_0x10bc,0x3e6ca));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';function a224_0x10bc(){const _0x3491d8=['flagMissing','Role\x20name','string','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','expectUserCount','No\x20tenant\x20member\x20matches\x20\x22','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','Disambiguate\x20with\x20--role\x20<id>.','nickname','push','Missing\x20user\x20reference.','Pass\x20--role\x20<id|name>.','Role\x20id\x20or\x20exact\x20role\x20name','Anti-drift\x20check\x20failed:\x20expected\x20','Pass\x20--user\x20<id|name>.','Cannot\x20',';\x20no\x20change.','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','ADMIN','user','510258dDlwqm','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','2081046pQSyMt','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','includes','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','dryRun','OWNER','role','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','\x20duplicate\x20memberships\x20for\x20user\x20','validation','\x20is\x20already\x20a\x20member\x20of\x20role\x20','720740HxFwQT','remark','391520doLJaB','/smartapi/permit/user-role/create','dev','totalCount','appCode','user-add','expect-user-count','test','DEV','\x20members\x20of\x20the\x20OWNER\x20role.','8218IwaZoF','12gDrkHQ','5955597rMrNMk','filter','name','trim','map','userId','\x20built-in\x20role\x20','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','Multiple\x20tenant\x20members\x20match\x20\x22','\x22:\x20','tenant_code','str','Role\x20name\x20\x22','Role\x20id\x20','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','username','CUSTOM','toLowerCase','roleType','number','roleName','Check\x20the\x20nickname/username.\x20','User\x20','1552zXDLQT','1221546EpSTxM','length','join','\x20is\x20not\x20a\x20member\x20of\x20role\x20'];a224_0x10bc=function(){return _0x3491d8;};return a224_0x10bc();}export const ROLE_ID_FLAG={'name':'id','type':'number','required':!![],'description':'Role\x20id\x20(from\x20`role\x20list`)'};export const ROLE_REF_FLAG={'name':a224_0x13a989(0xc0),'type':a224_0x13a989(0xf1),'required':!![],'description':a224_0x13a989(0xfb)};export const USER_REF_FLAG={'name':'user','type':a224_0x13a989(0xf1),'required':!![],'description':a224_0x13a989(0xda)};export const NAME_FLAG={'name':a224_0x13a989(0xd5),'type':a224_0x13a989(0xf1),'required':!![],'description':a224_0x13a989(0xf0)};export const USER_NAME_FLAG={'name':a224_0x13a989(0xd5),'type':a224_0x13a989(0xf1),'required':!![],'description':a224_0x13a989(0xc1)};export const REMARK_FLAG={'name':a224_0x13a989(0xc6),'type':'string','required':![],'description':'Optional\x20role\x20remark/description'};export const EXPECT_USER_COUNT_FLAG={'name':a224_0x13a989(0xcd),'type':a224_0x13a989(0xe6),'required':![],'description':a224_0x13a989(0xbd)};export const BUILTIN_ROLE_TYPES=[a224_0x13a989(0x101),a224_0x13a989(0xcf),a224_0x13a989(0xbf)];export function isBuiltinRole(_0x34331b){return BUILTIN_ROLE_TYPES['includes'](_0x34331b);}export function assertCustomRole(_0x558208,_0x1058e0){const _0x20f4e4=a224_0x13a989;if(_0x558208[_0x20f4e4(0xe5)]!==_0x20f4e4(0xe3))throw CliErrors[_0x20f4e4(0xc3)](_0x20f4e4(0xfe)+_0x1058e0+_0x20f4e4(0xd9)+_0x558208['roleName']+'\x20('+_0x558208[_0x20f4e4(0xe5)]+').',_0x20f4e4(0xbb));}export function projectRole(_0x552e1e){const _0x32f6c7=a224_0x13a989;return{'id':_0x552e1e['id'],'roleName':_0x552e1e['roleName'],'roleType':_0x552e1e[_0x32f6c7(0xe5)],'remark':_0x552e1e[_0x32f6c7(0xc6)],'userCount':_0x552e1e['userCount'],'permitCount':_0x552e1e['permitCount'],'builtin':isBuiltinRole(_0x552e1e[_0x32f6c7(0xe5)])};}export async function resolveRoleRef(_0x4fbf47,_0x38a803){const _0x246ddc=a224_0x13a989,_0x2f5085=_0x38a803[_0x246ddc(0xd6)]();if(!_0x2f5085)throw CliErrors[_0x246ddc(0xc3)]('Missing\x20role\x20reference.',_0x246ddc(0xfa));if(/^\d+$/[_0x246ddc(0xce)](_0x2f5085))return getRoleById(_0x4fbf47,Number(_0x2f5085));const _0xe52568=await listAllAppRoles(_0x4fbf47),_0x215c81=_0xe52568['filter'](_0x4ba6ed=>_0x4ba6ed[_0x246ddc(0xe7)]===_0x2f5085);if(_0x215c81[_0x246ddc(0xec)]===0x0)throw CliErrors[_0x246ddc(0xc3)](_0x246ddc(0xdf)+_0x2f5085+'\x22\x20not\x20found\x20in\x20app\x20'+_0x4fbf47+'.',_0x246ddc(0xf2));if(_0x215c81['length']>0x1){const _0x10da1f=_0x215c81[_0x246ddc(0xd7)](_0x8f35f9=>_0x8f35f9['id'])[_0x246ddc(0xed)](',\x20');throw CliErrors[_0x246ddc(0xc3)](_0x246ddc(0xdf)+_0x2f5085+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x10da1f+').',_0x246ddc(0xf6));}return _0x215c81[0x0];}export async function getRoleById(_0x89ead5,_0x385935){const _0x5164b2=a224_0x13a989,_0x29527c=await listAllAppRoles(_0x89ead5),_0x5ed7ae=_0x29527c['filter'](_0x1ae5b6=>_0x1ae5b6['id']===_0x385935&&(!_0x1ae5b6[_0x5164b2(0xcb)]||_0x1ae5b6[_0x5164b2(0xcb)]===_0x89ead5));if(_0x5ed7ae['length']!==0x1)throw CliErrors[_0x5164b2(0xc3)](_0x5164b2(0xe0)+_0x385935+'\x20not\x20found\x20in\x20app\x20'+_0x89ead5+'.',_0x5164b2(0xb9));return _0x5ed7ae[0x0];}async function listAllAppRoles(_0x11b06a){const _0x3e5722=a224_0x13a989,_0x4b3298=0x64,_0x1844b1=[];for(let _0x5dddd8=0x1;;_0x5dddd8+=0x1){const {items:_0x233a77,paging:_0x5588b6}=await listAppRoles(_0x11b06a,{'currentPage':_0x5dddd8,'pageSize':_0x4b3298});_0x1844b1[_0x3e5722(0xf8)](..._0x233a77);if(_0x233a77['length']<_0x4b3298||_0x5588b6&&_0x1844b1[_0x3e5722(0xec)]>=_0x5588b6[_0x3e5722(0xca)])return _0x1844b1;}}export async function resolveTenantCode(){const _0xd467eb=a224_0x13a989,_0x183c70=await getSessionUserInfo(),_0x49a378=_0x183c70?.[_0xd467eb(0x102)]?.['tenant']?.[_0xd467eb(0xdd)];if(!_0x49a378)throw CliErrors['authRequired'](_0xd467eb(0xe1));return _0x49a378;}function matchMember(_0x177ee8,_0x284817){const _0x43e3ff=a224_0x13a989,_0x3ad84b=_0x284817['trim']()[_0x43e3ff(0xe4)]();return(_0x177ee8[_0x43e3ff(0xf7)]??'')[_0x43e3ff(0xe4)]()===_0x3ad84b||(_0x177ee8['username']??'')[_0x43e3ff(0xe4)]()===_0x3ad84b;}export async function resolveUserRef(_0x282482,_0x229115='Pass\x20--user\x20<id>.'){const _0x25187c=a224_0x13a989,_0x47f415=_0x282482[_0x25187c(0xd6)]();if(!_0x47f415)throw CliErrors['validation'](_0x25187c(0xf9),'Pass\x20--user\x20<id|name>.');const _0xf39834=await resolveTenantCode(),_0x47811e=await getTenantMembers(_0xf39834);if(/^\d+$/['test'](_0x47f415)){const _0x4a59ad=Number(_0x47f415),_0x5c1567=_0x47811e['find'](_0x80ec02=>_0x80ec02[_0x25187c(0xd8)]===_0x4a59ad);return{'userId':_0x4a59ad,'username':_0x5c1567?.[_0x25187c(0xe2)]??String(_0x4a59ad),'nickname':_0x5c1567?.[_0x25187c(0xf7)],'matchedBy':'id'};}const _0x38d031=_0x47811e[_0x25187c(0xd4)](_0x448984=>matchMember(_0x448984,_0x47f415));if(_0x38d031['length']===0x0)throw CliErrors[_0x25187c(0xc3)](_0x25187c(0xf4)+_0x47f415+'\x22.',_0x25187c(0xe8)+_0x229115);if(_0x38d031[_0x25187c(0xec)]>0x1){const _0x243847=_0x38d031[_0x25187c(0xd7)](_0x2b63dd=>(_0x2b63dd[_0x25187c(0xf7)]??_0x2b63dd[_0x25187c(0xe2)]??'?')+'('+_0x2b63dd[_0x25187c(0xd8)]+')')[_0x25187c(0xed)](',\x20');throw CliErrors['validation'](_0x25187c(0xdb)+_0x47f415+_0x25187c(0xdc)+_0x243847+'.',_0x229115);}const _0x4b3668=_0x38d031[0x0];return{'userId':_0x4b3668[_0x25187c(0xd8)],'username':_0x4b3668[_0x25187c(0xe2)]??String(_0x4b3668['userId']),'nickname':_0x4b3668['nickname'],'matchedBy':_0x25187c(0xd5)};}export const CREATE_USER_ROLE_PATH=a224_0x13a989(0xc8);export const DELETE_USER_ROLE_PATH='/smartapi/permit/user-role/delete';function a224_0x3862(_0x560146,_0x5a7f4e){_0x560146=_0x560146-0xb8;const _0x10bce1=a224_0x10bc();let _0x3862b4=_0x10bce1[_0x560146];return _0x3862b4;}export function computeRoleUserMutation(_0x7c936f){const _0x4bd4fc=a224_0x13a989,{operation:_0x3dc7e7,appCode:_0x4a19fd,role:_0x2a4949,relations:_0x5bf429,user:_0x103820}=_0x7c936f,_0x4003c2=[...new Set(_0x5bf429[_0x4bd4fc(0xd7)](_0x402a16=>_0x402a16['userId']))],_0x21c3d2=[];if(_0x7c936f[_0x4bd4fc(0xf3)]!==undefined&&_0x7c936f[_0x4bd4fc(0xf3)]!==_0x4003c2['length'])throw CliErrors[_0x4bd4fc(0xc3)](_0x4bd4fc(0xfc)+_0x7c936f[_0x4bd4fc(0xf3)]+'\x20member(s)\x20but\x20role\x20has\x20'+_0x4003c2[_0x4bd4fc(0xec)]+'.',_0x4bd4fc(0xf5));const _0x405259=_0x4003c2[_0x4bd4fc(0xbc)](_0x103820[_0x4bd4fc(0xd8)]),_0x42fdaa=_0x5bf429[_0x4bd4fc(0xd4)](_0x4252bb=>_0x4252bb[_0x4bd4fc(0xd8)]===_0x103820[_0x4bd4fc(0xd8)])[_0x4bd4fc(0xd7)](_0x5a5718=>_0x5a5718['id']),_0x14cc8f=_0x3dc7e7===_0x4bd4fc(0xcc)?!_0x405259:_0x405259;let _0xdef93c=_0x4003c2;_0x3dc7e7==='user-add'?_0x405259?_0x21c3d2[_0x4bd4fc(0xf8)](_0x4bd4fc(0xe9)+_0x103820['userId']+_0x4bd4fc(0xc4)+_0x2a4949[_0x4bd4fc(0xe7)]+_0x4bd4fc(0xff)):_0xdef93c=[..._0x4003c2,_0x103820[_0x4bd4fc(0xd8)]]:!_0x405259?_0x21c3d2['push'](_0x4bd4fc(0xe9)+_0x103820[_0x4bd4fc(0xd8)]+_0x4bd4fc(0xee)+_0x2a4949[_0x4bd4fc(0xe7)]+';\x20no\x20change.'):(_0xdef93c=_0x4003c2[_0x4bd4fc(0xd4)](_0x2fde82=>_0x2fde82!==_0x103820[_0x4bd4fc(0xd8)]),_0x42fdaa[_0x4bd4fc(0xec)]>0x1&&_0x21c3d2['push']('Removed\x20'+_0x42fdaa['length']+_0x4bd4fc(0xc2)+_0x103820[_0x4bd4fc(0xd8)]+'.'));const _0xfef06d={'scope':_0x4bd4fc(0xc9),'operation':_0x3dc7e7,'selector':{'appCode':_0x4a19fd,'roleId':_0x2a4949['id'],'roleName':_0x2a4949[_0x4bd4fc(0xe7)],'userId':_0x103820[_0x4bd4fc(0xd8)]},'before':{'userIds':_0x4003c2},'after':{'userIds':_0xdef93c},'dryRun':_0x7c936f[_0x4bd4fc(0xbe)],'backend':{'method':'POST','path':_0x3dc7e7===_0x4bd4fc(0xcc)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x21c3d2};return{'mutation':_0xfef06d,'changed':_0x14cc8f,'matchingRelationIds':_0x42fdaa};}export async function loadDevRoleRelations(_0x346e4a,_0x484887){const _0x2cafde=a224_0x13a989,_0x4f479f=0x64,_0x197634=[];for(let _0xd44399=0x1;;_0xd44399+=0x1){const {items:_0x102670,paging:_0x461099}=await listDevUserRoleRelations(_0x346e4a,{'roleId':_0x484887,'currentPage':_0xd44399,'pageSize':_0x4f479f});_0x197634['push'](..._0x102670);if(_0x102670[_0x2cafde(0xec)]<_0x4f479f||_0x461099&&_0x197634[_0x2cafde(0xec)]>=_0x461099[_0x2cafde(0xca)])return _0x197634;}}export function readRoleRef(_0xfd6f83){const _0x1ebec6=a224_0x13a989,_0x14c8da=_0xfd6f83[_0x1ebec6(0xde)](_0x1ebec6(0xc0))[_0x1ebec6(0xd6)]();if(!_0x14c8da)throw CliErrors[_0x1ebec6(0xef)](_0x1ebec6(0xc0),_0x1ebec6(0xfa));return _0x14c8da;}export async function prepareUserMutation(_0x1110c4,_0x42870c,_0x5aebe9){const _0x2e52e6=a224_0x13a989,_0x29adf8=readRoleRef(_0x1110c4),_0x4cc5c3=_0x1110c4[_0x2e52e6(0xde)](_0x2e52e6(0x102))[_0x2e52e6(0xd6)]();if(!_0x4cc5c3)throw CliErrors[_0x2e52e6(0xef)](_0x2e52e6(0x102),_0x2e52e6(0xfd));const _0x488be6=_0x1110c4['flag'](_0x2e52e6(0xcd)),_0x15cd91=_0x488be6===undefined||_0x488be6===null?undefined:Number(_0x488be6),_0xe39348=await resolveRoleRef(_0x1110c4[_0x2e52e6(0xcb)],_0x29adf8);if(_0xe39348['roleType']===_0x2e52e6(0xbf))throw CliErrors['validation'](_0x2e52e6(0xfe)+_0x42870c+_0x2e52e6(0xd0),_0x2e52e6(0x100));const _0x161078=await resolveUserRef(_0x4cc5c3),_0x33f0ae=await loadDevRoleRelations(_0x1110c4['appCode'],_0xe39348['id']);return{...computeRoleUserMutation({'operation':_0x42870c,'appCode':_0x1110c4[_0x2e52e6(0xcb)],'role':_0xe39348,'relations':_0x33f0ae,'user':{'userId':_0x161078[_0x2e52e6(0xd8)],'username':_0x161078[_0x2e52e6(0xe2)],'nickname':_0x161078['nickname']},'dryRun':_0x5aebe9,..._0x15cd91!==undefined?{'expectUserCount':_0x15cd91}:{}}),'role':_0xe39348,'user':_0x161078};}
@@ -1 +1 @@
1
- const a220_0x5b65d1=a220_0x3c46;(function(_0x213c10,_0x4cfda0){const _0x5a1175=a220_0x3c46,_0x450192=_0x213c10();while(!![]){try{const _0x11132a=-parseInt(_0x5a1175(0x1df))/0x1*(parseInt(_0x5a1175(0x1e3))/0x2)+parseInt(_0x5a1175(0x1f6))/0x3+-parseInt(_0x5a1175(0x1f2))/0x4+-parseInt(_0x5a1175(0x1e4))/0x5+-parseInt(_0x5a1175(0x1e9))/0x6*(parseInt(_0x5a1175(0x1f8))/0x7)+parseInt(_0x5a1175(0x1f4))/0x8+-parseInt(_0x5a1175(0x1e8))/0x9*(-parseInt(_0x5a1175(0x1e7))/0xa);if(_0x11132a===_0x4cfda0)break;else _0x450192['push'](_0x450192['shift']());}catch(_0x32b591){_0x450192['push'](_0x450192['shift']());}}}(a220_0x549a,0x711c2));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a220_0x3c46(_0xdf6e24,_0x1cb421){_0xdf6e24=_0xdf6e24-0x1dd;const _0x549aad=a220_0x549a();let _0x3c46d2=_0x549aad[_0xdf6e24];return _0x3c46d2;}import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH='/smartapi/permit/role/update';function readPatch(_0x2927d9){const _0x4b1c7a=a220_0x3c46,_0x42531c=_0x2927d9[_0x4b1c7a(0x1ee)](_0x4b1c7a(0x1ea)),_0x1dbb6c=_0x2927d9[_0x4b1c7a(0x1ee)]('remark'),_0x419b80={};if(_0x42531c!==undefined&&_0x42531c!==null){const _0x59ddcb=String(_0x42531c)[_0x4b1c7a(0x1f1)]();if(!_0x59ddcb)throw CliErrors[_0x4b1c7a(0x1e0)]('--name\x20cannot\x20be\x20empty.');if(_0x59ddcb['length']>0x40)throw CliErrors[_0x4b1c7a(0x1e0)](_0x4b1c7a(0x1f9));_0x419b80['roleName']=_0x59ddcb;}_0x1dbb6c!==undefined&&_0x1dbb6c!==null&&(_0x419b80[_0x4b1c7a(0x1e2)]=String(_0x1dbb6c));if(_0x419b80[_0x4b1c7a(0x1eb)]===undefined&&_0x419b80['remark']===undefined)throw CliErrors[_0x4b1c7a(0x1e0)](_0x4b1c7a(0x1f7),_0x4b1c7a(0x1f5));return _0x419b80;}export const roleUpdate={'service':a220_0x5b65d1(0x1e1),'command':a220_0x5b65d1(0x1f0),'description':'Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','risk':a220_0x5b65d1(0x1de),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a220_0x5b65d1(0x1ea),'type':a220_0x5b65d1(0x1ec),'required':![],'description':a220_0x5b65d1(0x1e5)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x20ddd7){readPatch(_0x20ddd7);},async 'dryRun'(_0x406fc1){const _0x16e9d0=a220_0x5b65d1,_0x1053dd=_0x406fc1[_0x16e9d0(0x1e6)]('id'),_0x3b6cf9=readPatch(_0x406fc1),_0x5e8ff5=await getRoleById(_0x406fc1[_0x16e9d0(0x1dd)],_0x1053dd);return assertCustomRole(_0x5e8ff5,_0x16e9d0(0x1f0)),asDryRunResult({'scope':_0x16e9d0(0x1f3),'operation':'update','selector':{'appCode':_0x406fc1['appCode'],'roleId':_0x1053dd,'roleName':_0x5e8ff5['roleName']},'before':projectRole(_0x5e8ff5),'after':projectRole({..._0x5e8ff5,..._0x3b6cf9[_0x16e9d0(0x1eb)]!==undefined?{'roleName':_0x3b6cf9[_0x16e9d0(0x1eb)]}:{},..._0x3b6cf9[_0x16e9d0(0x1e2)]!==undefined?{'remark':_0x3b6cf9[_0x16e9d0(0x1e2)]}:{}}),'dryRun':!![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},{'method':_0x16e9d0(0x1ed),'url':UPDATE_PATH});},async 'execute'(_0x572ab7){const _0x1864a8=a220_0x5b65d1,_0x87a5b=_0x572ab7[_0x1864a8(0x1e6)]('id'),_0x1c7988=readPatch(_0x572ab7),_0x1d106d=await getRoleById(_0x572ab7[_0x1864a8(0x1dd)],_0x87a5b);assertCustomRole(_0x1d106d,_0x1864a8(0x1f0)),await updateAppRole({'id':_0x87a5b,'appCode':_0x572ab7['appCode'],..._0x1c7988[_0x1864a8(0x1eb)]!==undefined?{'roleName':_0x1c7988[_0x1864a8(0x1eb)]}:{},..._0x1c7988[_0x1864a8(0x1e2)]!==undefined?{'remark':_0x1c7988[_0x1864a8(0x1e2)]}:{}});const _0x598f23=await getRoleById(_0x572ab7[_0x1864a8(0x1dd)],_0x87a5b);return{'ok':!![],'data':{'scope':_0x1864a8(0x1f3),'operation':_0x1864a8(0x1f0),'selector':{'appCode':_0x572ab7[_0x1864a8(0x1dd)],'roleId':_0x87a5b,'roleName':_0x598f23['roleName']},'before':projectRole(_0x1d106d),'after':projectRole(_0x598f23),'dryRun':![],'backend':{'method':_0x1864a8(0x1ed),'path':UPDATE_PATH},'warnings':[]},'message':'Updated\x20role\x20'+_0x598f23[_0x1864a8(0x1eb)]+_0x1864a8(0x1ef)+_0x87a5b+')'};}};function a220_0x549a(){const _0x1029c7=['update','trim','1642200rCWdVm','dev','5189448MyzDUH','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','190494qglNYh','Nothing\x20to\x20update.','21mrxBwV','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','appCode','write','97385FHqHgt','validation','role','remark','8MZxKrI','843910SiLyVy','New\x20role\x20name','num','180CrQcTs','447507SwRcWC','350046dyQTln','name','roleName','string','POST','flag','\x20(id='];a220_0x549a=function(){return _0x1029c7;};return a220_0x549a();}
1
+ const a225_0x4f7d4f=a225_0x50c9;function a225_0x50c9(_0x3d79f1,_0x2c667e){_0x3d79f1=_0x3d79f1-0x1bb;const _0x73f32a=a225_0x73f3();let _0x50c9e4=_0x73f32a[_0x3d79f1];return _0x50c9e4;}function a225_0x73f3(){const _0x179e80=['New\x20role\x20name','dev','roleName','94JrVxvG','349745uUinBO','validation','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','/smartapi/permit/role/update','trim','length','16019ypKZIp','update','10lJZquF','remark','7581717pFHDfQ','num','name','8ZIzTYH','776PxwlDQ','flag','role','--name\x20cannot\x20be\x20empty.','40859687flZjra','POST','appCode','2730225wJDuGa','48937EwixiF','Nothing\x20to\x20update.','write','5151276DGXmKR','\x20(id=','Role\x20name\x20cannot\x20exceed\x2064\x20characters.'];a225_0x73f3=function(){return _0x179e80;};return a225_0x73f3();}(function(_0x579f06,_0x99e4f3){const _0x2c9ad9=a225_0x50c9,_0x4a6ce6=_0x579f06();while(!![]){try{const _0x28041a=-parseInt(_0x2c9ad9(0x1d0))/0x1*(-parseInt(_0x2c9ad9(0x1c9))/0x2)+parseInt(_0x2c9ad9(0x1bf))/0x3+parseInt(_0x2c9ad9(0x1d7))/0x4*(parseInt(_0x2c9ad9(0x1ca))/0x5)+parseInt(_0x2c9ad9(0x1c3))/0x6+-parseInt(_0x2c9ad9(0x1c0))/0x7*(-parseInt(_0x2c9ad9(0x1d8))/0x8)+parseInt(_0x2c9ad9(0x1d4))/0x9+-parseInt(_0x2c9ad9(0x1d2))/0xa*(parseInt(_0x2c9ad9(0x1bc))/0xb);if(_0x28041a===_0x99e4f3)break;else _0x4a6ce6['push'](_0x4a6ce6['shift']());}catch(_0x4b895c){_0x4a6ce6['push'](_0x4a6ce6['shift']());}}}(a225_0x73f3,0x721eb));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a225_0x4f7d4f(0x1cd);function readPatch(_0x1eff98){const _0x10cdea=a225_0x4f7d4f,_0x1bc04e=_0x1eff98[_0x10cdea(0x1d9)](_0x10cdea(0x1d6)),_0x7fd07e=_0x1eff98[_0x10cdea(0x1d9)]('remark'),_0xf4a86c={};if(_0x1bc04e!==undefined&&_0x1bc04e!==null){const _0x38320d=String(_0x1bc04e)[_0x10cdea(0x1ce)]();if(!_0x38320d)throw CliErrors[_0x10cdea(0x1cb)](_0x10cdea(0x1bb));if(_0x38320d[_0x10cdea(0x1cf)]>0x40)throw CliErrors['validation'](_0x10cdea(0x1c5));_0xf4a86c[_0x10cdea(0x1c8)]=_0x38320d;}_0x7fd07e!==undefined&&_0x7fd07e!==null&&(_0xf4a86c[_0x10cdea(0x1d3)]=String(_0x7fd07e));if(_0xf4a86c['roleName']===undefined&&_0xf4a86c['remark']===undefined)throw CliErrors[_0x10cdea(0x1cb)](_0x10cdea(0x1c1),'Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.');return _0xf4a86c;}export const roleUpdate={'service':a225_0x4f7d4f(0x1da),'command':'update','description':a225_0x4f7d4f(0x1cc),'risk':a225_0x4f7d4f(0x1c2),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a225_0x4f7d4f(0x1d6),'type':'string','required':![],'description':a225_0x4f7d4f(0x1c6)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1737d8){readPatch(_0x1737d8);},async 'dryRun'(_0x468e7d){const _0x103ef0=a225_0x4f7d4f,_0x5687ac=_0x468e7d[_0x103ef0(0x1d5)]('id'),_0x1179fe=readPatch(_0x468e7d),_0x234a94=await getRoleById(_0x468e7d[_0x103ef0(0x1be)],_0x5687ac);return assertCustomRole(_0x234a94,_0x103ef0(0x1d1)),asDryRunResult({'scope':'dev','operation':_0x103ef0(0x1d1),'selector':{'appCode':_0x468e7d['appCode'],'roleId':_0x5687ac,'roleName':_0x234a94['roleName']},'before':projectRole(_0x234a94),'after':projectRole({..._0x234a94,..._0x1179fe['roleName']!==undefined?{'roleName':_0x1179fe[_0x103ef0(0x1c8)]}:{},..._0x1179fe[_0x103ef0(0x1d3)]!==undefined?{'remark':_0x1179fe[_0x103ef0(0x1d3)]}:{}}),'dryRun':!![],'backend':{'method':_0x103ef0(0x1bd),'path':UPDATE_PATH},'warnings':[]},{'method':_0x103ef0(0x1bd),'url':UPDATE_PATH});},async 'execute'(_0x39ca27){const _0x537942=a225_0x4f7d4f,_0x6b9051=_0x39ca27[_0x537942(0x1d5)]('id'),_0x142342=readPatch(_0x39ca27),_0x33e37a=await getRoleById(_0x39ca27[_0x537942(0x1be)],_0x6b9051);assertCustomRole(_0x33e37a,_0x537942(0x1d1)),await updateAppRole({'id':_0x6b9051,'appCode':_0x39ca27[_0x537942(0x1be)],..._0x142342['roleName']!==undefined?{'roleName':_0x142342[_0x537942(0x1c8)]}:{},..._0x142342[_0x537942(0x1d3)]!==undefined?{'remark':_0x142342[_0x537942(0x1d3)]}:{}});const _0xc00cba=await getRoleById(_0x39ca27[_0x537942(0x1be)],_0x6b9051);return{'ok':!![],'data':{'scope':_0x537942(0x1c7),'operation':'update','selector':{'appCode':_0x39ca27[_0x537942(0x1be)],'roleId':_0x6b9051,'roleName':_0xc00cba[_0x537942(0x1c8)]},'before':projectRole(_0x33e37a),'after':projectRole(_0xc00cba),'dryRun':![],'backend':{'method':_0x537942(0x1bd),'path':UPDATE_PATH},'warnings':[]},'message':'Updated\x20role\x20'+_0xc00cba['roleName']+_0x537942(0x1c4)+_0x6b9051+')'};}};
@@ -1 +1 @@
1
- const a221_0x59a583=a221_0x2d7a;(function(_0x1862eb,_0x568808){const _0x4b6df3=a221_0x2d7a,_0x2ba0d8=_0x1862eb();while(!![]){try{const _0x4099b9=parseInt(_0x4b6df3(0x107))/0x1+parseInt(_0x4b6df3(0x102))/0x2*(parseInt(_0x4b6df3(0x108))/0x3)+-parseInt(_0x4b6df3(0xff))/0x4+parseInt(_0x4b6df3(0x105))/0x5*(-parseInt(_0x4b6df3(0x10a))/0x6)+-parseInt(_0x4b6df3(0xfb))/0x7*(parseInt(_0x4b6df3(0x109))/0x8)+-parseInt(_0x4b6df3(0xf7))/0x9+parseInt(_0x4b6df3(0x103))/0xa;if(_0x4099b9===_0x568808)break;else _0x2ba0d8['push'](_0x2ba0d8['shift']());}catch(_0x46bbd1){_0x2ba0d8['push'](_0x2ba0d8['shift']());}}}(a221_0x311f,0x6a3ac));import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a221_0x2d7a(_0x47e887,_0x383c62){_0x47e887=_0x47e887-0xf4;const _0x311f26=a221_0x311f();let _0x2d7a37=_0x311f26[_0x47e887];return _0x2d7a37;}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':a221_0x59a583(0xfe),'command':a221_0x59a583(0x101),'description':a221_0x59a583(0xf9),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x410bb4){const {mutation:_0x66ac2a}=await prepareUserMutation(_0x410bb4,'user-add',!![]);return asDryRunResult(_0x66ac2a,{'method':'POST','url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x1516ab){const _0x2fb710=a221_0x59a583,{mutation:_0x1314a5,changed:_0x3c44fc,role:_0x1f9247,user:_0x1d6bf9}=await prepareUserMutation(_0x1516ab,_0x2fb710(0x101),![]);return _0x3c44fc&&await createDevUserRole({'appCode':_0x1516ab[_0x2fb710(0xf8)],'userId':_0x1d6bf9[_0x2fb710(0xfd)],'username':_0x1d6bf9[_0x2fb710(0xfa)],'roleType':_0x1f9247[_0x2fb710(0x100)],'roleId':_0x1314a5[_0x2fb710(0xfc)][_0x2fb710(0x106)]}),{'ok':!![],'data':_0x1314a5,'message':_0x3c44fc?_0x2fb710(0xf6)+_0x1314a5[_0x2fb710(0xfc)][_0x2fb710(0xfd)]+_0x2fb710(0xf5)+_0x1314a5[_0x2fb710(0xfc)][_0x2fb710(0x104)]:'No\x20change:\x20user\x20'+_0x1314a5['selector'][_0x2fb710(0xfd)]+_0x2fb710(0xf4)+_0x1314a5[_0x2fb710(0xfc)][_0x2fb710(0x104)]};}};function a221_0x311f(){const _0x691dfd=['selector','userId','role','450600lxOOOk','roleType','user-add','1438ARuXhR','6064080GqyQlF','roleName','70FNmrZW','roleId','622068VIFsQi','357HwLpGG','296uLFSiV','948SzhzYF','\x20already\x20in\x20role\x20','\x20to\x20role\x20','Added\x20user\x20','3201210eMdYcl','appCode','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','username','77259Sxkubv'];a221_0x311f=function(){return _0x691dfd;};return a221_0x311f();}
1
+ function a226_0x24c1(_0xbe052b,_0x53afb3){_0xbe052b=_0xbe052b-0x7d;const _0x3685ce=a226_0x3685();let _0x24c105=_0x3685ce[_0xbe052b];return _0x24c105;}const a226_0x59bc1b=a226_0x24c1;(function(_0x688a11,_0x2f9551){const _0x41bb5e=a226_0x24c1,_0x4fb034=_0x688a11();while(!![]){try{const _0x5118d0=parseInt(_0x41bb5e(0x89))/0x1*(-parseInt(_0x41bb5e(0x95))/0x2)+parseInt(_0x41bb5e(0x7d))/0x3+-parseInt(_0x41bb5e(0x83))/0x4*(parseInt(_0x41bb5e(0x91))/0x5)+parseInt(_0x41bb5e(0x8a))/0x6*(parseInt(_0x41bb5e(0x8c))/0x7)+-parseInt(_0x41bb5e(0x7e))/0x8*(parseInt(_0x41bb5e(0x7f))/0x9)+-parseInt(_0x41bb5e(0x88))/0xa+-parseInt(_0x41bb5e(0x8f))/0xb*(-parseInt(_0x41bb5e(0x85))/0xc);if(_0x5118d0===_0x2f9551)break;else _0x4fb034['push'](_0x4fb034['shift']());}catch(_0x33ea92){_0x4fb034['push'](_0x4fb034['shift']());}}}(a226_0x3685,0x6e27a));import{createDevUserRole}from'../../core/api-client.js';function a226_0x3685(){const _0x1ef3c7=['31048LTwaKJ','1449HsKQVk','userId','No\x20change:\x20user\x20','Added\x20user\x20','124808vIJrxO','roleId','12WHlvRW','username','roleType','6729690OQUOMH','11959ARBmWt','114IZnukK','\x20to\x20role\x20','294616HRBVkR','roleName','user-add','20186584uQGfPG','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','70cdUzvi','appCode','POST','selector','76IzSroU','high-risk-write','16374MGUfbe'];a226_0x3685=function(){return _0x1ef3c7;};return a226_0x3685();}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':'role','command':a226_0x59bc1b(0x8e),'description':a226_0x59bc1b(0x90),'risk':a226_0x59bc1b(0x96),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x315036){const _0x48d903=a226_0x59bc1b,{mutation:_0x35d0c3}=await prepareUserMutation(_0x315036,_0x48d903(0x8e),!![]);return asDryRunResult(_0x35d0c3,{'method':_0x48d903(0x93),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x1c74f7){const _0x29bf5a=a226_0x59bc1b,{mutation:_0x44cca0,changed:_0x3c58c1,role:_0x57ec25,user:_0x9ac33e}=await prepareUserMutation(_0x1c74f7,'user-add',![]);return _0x3c58c1&&await createDevUserRole({'appCode':_0x1c74f7[_0x29bf5a(0x92)],'userId':_0x9ac33e[_0x29bf5a(0x80)],'username':_0x9ac33e[_0x29bf5a(0x86)],'roleType':_0x57ec25[_0x29bf5a(0x87)],'roleId':_0x44cca0[_0x29bf5a(0x94)][_0x29bf5a(0x84)]}),{'ok':!![],'data':_0x44cca0,'message':_0x3c58c1?_0x29bf5a(0x82)+_0x44cca0[_0x29bf5a(0x94)][_0x29bf5a(0x80)]+_0x29bf5a(0x8b)+_0x44cca0[_0x29bf5a(0x94)][_0x29bf5a(0x8d)]:_0x29bf5a(0x81)+_0x44cca0[_0x29bf5a(0x94)]['userId']+'\x20already\x20in\x20role\x20'+_0x44cca0[_0x29bf5a(0x94)]['roleName']};}};
@@ -1 +1 @@
1
- function a222_0x3ba3(_0x5f5051,_0x57a63d){_0x5f5051=_0x5f5051-0x1bd;const _0x3e29c3=a222_0x3e29();let _0x3ba315=_0x3e29c3[_0x5f5051];return _0x3ba315;}const a222_0xecce39=a222_0x3ba3;(function(_0x4d9f56,_0x868c29){const _0x4ba2f9=a222_0x3ba3,_0xd969ca=_0x4d9f56();while(!![]){try{const _0x49c2bd=-parseInt(_0x4ba2f9(0x1c8))/0x1+-parseInt(_0x4ba2f9(0x1ce))/0x2*(parseInt(_0x4ba2f9(0x1cb))/0x3)+parseInt(_0x4ba2f9(0x1cd))/0x4*(-parseInt(_0x4ba2f9(0x1c0))/0x5)+-parseInt(_0x4ba2f9(0x1c1))/0x6+-parseInt(_0x4ba2f9(0x1c5))/0x7+parseInt(_0x4ba2f9(0x1ca))/0x8*(parseInt(_0x4ba2f9(0x1bd))/0x9)+-parseInt(_0x4ba2f9(0x1cc))/0xa*(-parseInt(_0x4ba2f9(0x1c6))/0xb);if(_0x49c2bd===_0x868c29)break;else _0xd969ca['push'](_0xd969ca['shift']());}catch(_0x2f0e24){_0xd969ca['push'](_0xd969ca['shift']());}}}(a222_0x3e29,0x7f64b));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':a222_0xecce39(0x1bf),'command':a222_0xecce39(0x1be),'description':a222_0xecce39(0x1c7),'risk':a222_0xecce39(0x1c9),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x4bf249){const _0x16a417=a222_0xecce39,{mutation:_0x323b88}=await prepareUserMutation(_0x4bf249,_0x16a417(0x1be),!![]);return asDryRunResult(_0x323b88,{'method':'POST','url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x12294a){const _0x9b1da9=a222_0xecce39,{matchingRelationIds:_0x34085d,mutation:_0x27a954,changed:_0x51510f}=await prepareUserMutation(_0x12294a,'user-remove',![]);if(_0x51510f)for(const _0x34cae6 of _0x34085d){await deleteDevUserRole(_0x34cae6);}return{'ok':!![],'data':_0x27a954,'message':_0x51510f?_0x9b1da9(0x1c2)+_0x27a954[_0x9b1da9(0x1c4)]['userId']+_0x9b1da9(0x1cf)+_0x27a954[_0x9b1da9(0x1c4)][_0x9b1da9(0x1d1)]:'No\x20change:\x20user\x20'+_0x27a954['selector'][_0x9b1da9(0x1d0)]+_0x9b1da9(0x1c3)+_0x27a954[_0x9b1da9(0x1c4)][_0x9b1da9(0x1d1)]};}};function a222_0x3e29(){const _0x5093dc=['role','5RXjJmN','1769766emqoRb','Removed\x20user\x20','\x20not\x20in\x20role\x20','selector','5825701oGXBCn','117381wSrfBK','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','356249PjfGsZ','high-risk-write','2635168yAeygV','298161yMJHRM','1910qJFRTB','2096632sArpRZ','10WnKSbZ','\x20from\x20role\x20','userId','roleName','27sOCCPh','user-remove'];a222_0x3e29=function(){return _0x5093dc;};return a222_0x3e29();}
1
+ const a227_0x39bf9b=a227_0x311a;(function(_0x1c5e17,_0x1bc4e2){const _0x119988=a227_0x311a,_0x10ec19=_0x1c5e17();while(!![]){try{const _0x28b554=parseInt(_0x119988(0x194))/0x1*(parseInt(_0x119988(0x19b))/0x2)+-parseInt(_0x119988(0x197))/0x3*(parseInt(_0x119988(0x199))/0x4)+parseInt(_0x119988(0x1a0))/0x5*(-parseInt(_0x119988(0x19f))/0x6)+-parseInt(_0x119988(0x19e))/0x7+-parseInt(_0x119988(0x192))/0x8+parseInt(_0x119988(0x198))/0x9*(-parseInt(_0x119988(0x18b))/0xa)+parseInt(_0x119988(0x18f))/0xb;if(_0x28b554===_0x1bc4e2)break;else _0x10ec19['push'](_0x10ec19['shift']());}catch(_0x23af57){_0x10ec19['push'](_0x10ec19['shift']());}}}(a227_0x12ef,0x4986f));function a227_0x12ef(){const _0xafa19b=['selector','1211DcYzfc','high-risk-write','user-remove','330tJjSHn','4266909YWfIDw','6824xSPiyj','roleName','436IwzXXV','POST','Removed\x20user\x20','3334499kHpfZk','318fEKJMU','51415UKVQkN','10bahvit','role','\x20from\x20role\x20','No\x20change:\x20user\x20','24612973aqOsRI','\x20not\x20in\x20role\x20','userId','4138056nXwWZo'];a227_0x12ef=function(){return _0xafa19b;};return a227_0x12ef();}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 a227_0x311a(_0x2b1417,_0x310b10){_0x2b1417=_0x2b1417-0x18b;const _0x12ef26=a227_0x12ef();let _0x311a8d=_0x12ef26[_0x2b1417];return _0x311a8d;}export const roleUserRemove={'service':a227_0x39bf9b(0x18c),'command':a227_0x39bf9b(0x196),'description':'Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','risk':a227_0x39bf9b(0x195),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x5542ce){const _0x103701=a227_0x39bf9b,{mutation:_0x41ac39}=await prepareUserMutation(_0x5542ce,_0x103701(0x196),!![]);return asDryRunResult(_0x41ac39,{'method':_0x103701(0x19c),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x33ba46){const _0x284fc2=a227_0x39bf9b,{matchingRelationIds:_0x4f856e,mutation:_0x325871,changed:_0x3bc160}=await prepareUserMutation(_0x33ba46,'user-remove',![]);if(_0x3bc160)for(const _0x404385 of _0x4f856e){await deleteDevUserRole(_0x404385);}return{'ok':!![],'data':_0x325871,'message':_0x3bc160?_0x284fc2(0x19d)+_0x325871[_0x284fc2(0x193)][_0x284fc2(0x191)]+_0x284fc2(0x18d)+_0x325871[_0x284fc2(0x193)][_0x284fc2(0x19a)]:_0x284fc2(0x18e)+_0x325871['selector'][_0x284fc2(0x191)]+_0x284fc2(0x190)+_0x325871[_0x284fc2(0x193)][_0x284fc2(0x19a)]};}};
@@ -1 +1 @@
1
- const a223_0x2c78e6=a223_0xd3b5;(function(_0x14e6ec,_0x22d806){const _0x49b9bd=a223_0xd3b5,_0x8e1f4a=_0x14e6ec();while(!![]){try{const _0x24636d=-parseInt(_0x49b9bd(0xb2))/0x1*(-parseInt(_0x49b9bd(0xb8))/0x2)+-parseInt(_0x49b9bd(0xc5))/0x3+parseInt(_0x49b9bd(0xbb))/0x4*(-parseInt(_0x49b9bd(0xb9))/0x5)+-parseInt(_0x49b9bd(0xb4))/0x6+parseInt(_0x49b9bd(0xc3))/0x7+parseInt(_0x49b9bd(0xc4))/0x8+parseInt(_0x49b9bd(0xba))/0x9;if(_0x24636d===_0x22d806)break;else _0x8e1f4a['push'](_0x8e1f4a['shift']());}catch(_0x2ef446){_0x8e1f4a['push'](_0x8e1f4a['shift']());}}}(a223_0x3d78,0xe32d7));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':a223_0x2c78e6(0xb5),'command':a223_0x2c78e6(0xb7),'description':a223_0x2c78e6(0xb3),'risk':a223_0x2c78e6(0xbc),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1bf156){const _0x422e71=a223_0x2c78e6;if(!_0x1bf156[_0x422e71(0xc1)]('name')['trim']())throw CliErrors[_0x422e71(0xc6)](_0x422e71(0xbd),_0x422e71(0xbe));},async 'execute'(_0x218cb6){const _0x1e1273=a223_0x2c78e6,_0x2e7fe1=_0x218cb6[_0x1e1273(0xc1)]('name')[_0x1e1273(0xb6)](),_0x155e90=await resolveUserRef(_0x2e7fe1,_0x1e1273(0xc7));return{'ok':!![],'data':{'user':{'userId':_0x155e90[_0x1e1273(0xbf)],'username':_0x155e90['username'],'nickname':_0x155e90[_0x1e1273(0xc0)],'matchedBy':_0x155e90['matchedBy']}},'message':_0x1e1273(0xc2)+_0x2e7fe1+'\x22\x20→\x20userId\x20'+_0x155e90[_0x1e1273(0xbf)]};}};function a223_0xd3b5(_0x2afe75,_0x746037){_0x2afe75=_0x2afe75-0xb2;const _0x3d78bf=a223_0x3d78();let _0xd3b5e1=_0x3d78bf[_0x2afe75];return _0xd3b5e1;}function a223_0x3d78(){const _0x54e534=['Resolved\x20\x22','3499993cLRZDV','564080kbEKZR','699276JwpSXy','flagMissing','Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.','79kfgSVy','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','4583358zKKiZh','role','trim','user-resolve','9574EGpMTN','15zgETIz','12026907sbSoDy','476668dEsTdI','read','name','Pass\x20--name\x20<nickname|username>.','userId','nickname','str'];a223_0x3d78=function(){return _0x54e534;};return a223_0x3d78();}
1
+ const a228_0x3a5805=a228_0x151a;(function(_0x1cd5dc,_0x6e6ba4){const _0x354320=a228_0x151a,_0x7aa84e=_0x1cd5dc();while(!![]){try{const _0x351028=-parseInt(_0x354320(0x1f9))/0x1+parseInt(_0x354320(0x202))/0x2+parseInt(_0x354320(0x1fb))/0x3+parseInt(_0x354320(0x203))/0x4*(parseInt(_0x354320(0x206))/0x5)+parseInt(_0x354320(0x1f3))/0x6*(parseInt(_0x354320(0x1f4))/0x7)+-parseInt(_0x354320(0x1f2))/0x8*(parseInt(_0x354320(0x1fc))/0x9)+-parseInt(_0x354320(0x1fa))/0xa;if(_0x351028===_0x6e6ba4)break;else _0x7aa84e['push'](_0x7aa84e['shift']());}catch(_0x48893e){_0x7aa84e['push'](_0x7aa84e['shift']());}}}(a228_0x2d8d,0xb34e2));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a228_0x151a(_0xf78f98,_0xb1c517){_0xf78f98=_0xf78f98-0x1f0;const _0x2d8d27=a228_0x2d8d();let _0x151a24=_0x2d8d27[_0xf78f98];return _0x151a24;}import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';function a228_0x2d8d(){const _0x4f3f37=['38322gviEvE','matchedBy','nickname','Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.','role','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','1432828Mclnqy','5785204rXXVjs','Resolved\x20\x22','flagMissing','5lfRMYg','trim','read','520MxObQZ','583014rXymTV','7ueUNKB','name','str','\x22\x20→\x20userId\x20','Pass\x20--name\x20<nickname|username>.','1306878kDyCey','6901640QDySIR','2245086GZiTGD'];a228_0x2d8d=function(){return _0x4f3f37;};return a228_0x2d8d();}export const roleUserResolve={'service':a228_0x3a5805(0x200),'command':'user-resolve','description':a228_0x3a5805(0x201),'risk':a228_0x3a5805(0x1f1),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1f7dd5){const _0x45a248=a228_0x3a5805;if(!_0x1f7dd5[_0x45a248(0x1f6)](_0x45a248(0x1f5))['trim']())throw CliErrors[_0x45a248(0x205)](_0x45a248(0x1f5),_0x45a248(0x1f8));},async 'execute'(_0x2c8d51){const _0x4b83b7=a228_0x3a5805,_0xa6badb=_0x2c8d51[_0x4b83b7(0x1f6)](_0x4b83b7(0x1f5))[_0x4b83b7(0x1f0)](),_0x4e09d4=await resolveUserRef(_0xa6badb,_0x4b83b7(0x1ff));return{'ok':!![],'data':{'user':{'userId':_0x4e09d4['userId'],'username':_0x4e09d4['username'],'nickname':_0x4e09d4[_0x4b83b7(0x1fe)],'matchedBy':_0x4e09d4[_0x4b83b7(0x1fd)]}},'message':_0x4b83b7(0x204)+_0xa6badb+_0x4b83b7(0x1f7)+_0x4e09d4['userId']};}};
@@ -1 +1 @@
1
- const a224_0x53d9e3=a224_0x57cd;(function(_0x350900,_0x1ddc0f){const _0x4cfb30=a224_0x57cd,_0x7f6617=_0x350900();while(!![]){try{const _0x47ca50=-parseInt(_0x4cfb30(0x1e9))/0x1+parseInt(_0x4cfb30(0x1e5))/0x2*(parseInt(_0x4cfb30(0x1e3))/0x3)+parseInt(_0x4cfb30(0x1ed))/0x4+-parseInt(_0x4cfb30(0x1e6))/0x5*(-parseInt(_0x4cfb30(0x1e0))/0x6)+-parseInt(_0x4cfb30(0x1eb))/0x7+parseInt(_0x4cfb30(0x1e7))/0x8+-parseInt(_0x4cfb30(0x1ee))/0x9;if(_0x47ca50===_0x1ddc0f)break;else _0x7f6617['push'](_0x7f6617['shift']());}catch(_0x590b23){_0x7f6617['push'](_0x7f6617['shift']());}}}(a224_0x3b7f,0x48ff1));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPE_FLAG,appRuleError,appRuleFileName,projectAppRule,readAppRuleType}from'../../commands/rule/shared.js';function a224_0x57cd(_0x24638d,_0x3b0448){_0x24638d=_0x24638d-0x1df;const _0x3b7f40=a224_0x3b7f();let _0x57cdff=_0x3b7f40[_0x24638d];return _0x57cdff;}export const ruleGet={'service':a224_0x53d9e3(0x1e2),'command':a224_0x53d9e3(0x1e1),'description':'Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','risk':'read','requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x3a72e8){readAppRuleType(_0x3a72e8);},async 'execute'(_0x2d09c8){const _0x3bbad8=a224_0x53d9e3,_0x186d19=readAppRuleType(_0x2d09c8),_0x420397=await getAppRule(_0x2d09c8['cookie'],{'appCode':_0x2d09c8[_0x3bbad8(0x1e8)],'type':_0x186d19});if(!_0x420397)throw appRuleError(_0x3bbad8(0x1ea),appRuleFileName(_0x186d19)+_0x3bbad8(0x1e4)+_0x2d09c8[_0x3bbad8(0x1e8)]+'.','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20'+_0x186d19+_0x3bbad8(0x1df));return{'ok':!![],'data':{'rule':{...projectAppRule(_0x186d19,_0x420397),'content':_0x420397[_0x3bbad8(0x1ec)]}},'message':'Loaded\x20'+appRuleFileName(_0x186d19)+'\x20for\x20'+_0x2d09c8[_0x3bbad8(0x1e8)]};}};function a224_0x3b7f(){const _0x22e9aa=['appCode','526312oQDeaF','app_rule_not_found','466683kQXzMm','content','130848OaPEog','2000439pOfsgr','\x20--file\x20<path>\x20--dry-run`.','30UKPhKD','get','rule','1061445zoKxkn','\x20is\x20not\x20configured\x20for\x20app\x20','2lgoXlc','309395vLCFlU','3346584PgmiVG'];a224_0x3b7f=function(){return _0x22e9aa;};return a224_0x3b7f();}
1
+ function a229_0x4ceb(){const _0x6c45d7=['13660641XWDDqc','read','5499rJgaln','3093910anurAS','926112RLKCiq','Loaded\x20','content','\x20is\x20not\x20configured\x20for\x20app\x20','2000WefNDD','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20','appCode','Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','\x20for\x20','31395zZqvDe','2919008PObvLW','158nzGOLT','rule','450078qpvPqD'];a229_0x4ceb=function(){return _0x6c45d7;};return a229_0x4ceb();}const a229_0x47af6d=a229_0x440e;(function(_0x26ea98,_0x3e249b){const _0x6026ac=a229_0x440e,_0x48aeb3=_0x26ea98();while(!![]){try{const _0x4f99f0=-parseInt(_0x6026ac(0xcb))/0x1+parseInt(_0x6026ac(0xc4))/0x2*(parseInt(_0x6026ac(0xc9))/0x3)+-parseInt(_0x6026ac(0xc3))/0x4+-parseInt(_0x6026ac(0xca))/0x5+parseInt(_0x6026ac(0xc6))/0x6+-parseInt(_0x6026ac(0xc2))/0x7*(-parseInt(_0x6026ac(0xbd))/0x8)+parseInt(_0x6026ac(0xc7))/0x9;if(_0x4f99f0===_0x3e249b)break;else _0x48aeb3['push'](_0x48aeb3['shift']());}catch(_0x24a2de){_0x48aeb3['push'](_0x48aeb3['shift']());}}}(a229_0x4ceb,0x8ea51));function a229_0x440e(_0x5646cd,_0x258242){_0x5646cd=_0x5646cd-0xbb;const _0x4ceb39=a229_0x4ceb();let _0x440e42=_0x4ceb39[_0x5646cd];return _0x440e42;}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':a229_0x47af6d(0xc5),'command':'get','description':a229_0x47af6d(0xc0),'risk':a229_0x47af6d(0xc8),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x573013){readAppRuleType(_0x573013);},async 'execute'(_0x39d82f){const _0x4b35cb=a229_0x47af6d,_0x5212db=readAppRuleType(_0x39d82f),_0x2fed62=await getAppRule(_0x39d82f['cookie'],{'appCode':_0x39d82f['appCode'],'type':_0x5212db});if(!_0x2fed62)throw appRuleError('app_rule_not_found',appRuleFileName(_0x5212db)+_0x4b35cb(0xbc)+_0x39d82f[_0x4b35cb(0xbf)]+'.',_0x4b35cb(0xbe)+_0x5212db+'\x20--file\x20<path>\x20--dry-run`.');return{'ok':!![],'data':{'rule':{...projectAppRule(_0x5212db,_0x2fed62),'content':_0x2fed62[_0x4b35cb(0xbb)]}},'message':_0x4b35cb(0xcc)+appRuleFileName(_0x5212db)+_0x4b35cb(0xc1)+_0x39d82f[_0x4b35cb(0xbf)]};}};
@@ -1 +1 @@
1
- (function(_0x4d1085,_0x4f8066){const _0x536222=a225_0x3a00,_0x1b1dbc=_0x4d1085();while(!![]){try{const _0xfd4c03=-parseInt(_0x536222(0x169))/0x1+-parseInt(_0x536222(0x165))/0x2*(parseInt(_0x536222(0x167))/0x3)+parseInt(_0x536222(0x16c))/0x4+parseInt(_0x536222(0x16d))/0x5+-parseInt(_0x536222(0x16a))/0x6+-parseInt(_0x536222(0x16b))/0x7+parseInt(_0x536222(0x166))/0x8*(parseInt(_0x536222(0x168))/0x9);if(_0xfd4c03===_0x4f8066)break;else _0x1b1dbc['push'](_0x1b1dbc['shift']());}catch(_0x111646){_0x1b1dbc['push'](_0x1b1dbc['shift']());}}}(a225_0x3bd9,0xa03c1));import{ruleGet}from'../../commands/rule/get.js';function a225_0x3a00(_0x3b21d7,_0x1e43e1){_0x3b21d7=_0x3b21d7-0x165;const _0x3bd977=a225_0x3bd9();let _0x3a006c=_0x3bd977[_0x3b21d7];return _0x3a006c;}function a225_0x3bd9(){const _0x2efe2d=['3782850rUuPvH','510xPHOJg','824HdyfkC','1689jiFRNp','172332lYGhVS','666754hkfuZW','3144222qyKKgf','8874278VlmsWl','2118468hXVzny'];a225_0x3bd9=function(){return _0x2efe2d;};return a225_0x3bd9();}import{ruleList}from'../../commands/rule/list.js';import{ruleSet}from'../../commands/rule/set.js';export const ruleDefinitions=[ruleList,ruleGet,ruleSet];
1
+ function a230_0x5b9a(_0x14c777,_0x4b7a47){_0x14c777=_0x14c777-0x1e2;const _0x558598=a230_0x5585();let _0x5b9aa2=_0x558598[_0x14c777];return _0x5b9aa2;}function a230_0x5585(){const _0x32f302=['1556224SOBKsV','75GiKuoS','1526744EfRXUU','430588TJmfRU','130upRpvg','3110715JoSHVC','1456355JierAs','1064106wInFvt','56KKJWhj','3459705CTryfl'];a230_0x5585=function(){return _0x32f302;};return a230_0x5585();}(function(_0x443add,_0x164124){const _0xd524fa=a230_0x5b9a,_0x3e0946=_0x443add();while(!![]){try{const _0x2989e6=-parseInt(_0xd524fa(0x1eb))/0x1+-parseInt(_0xd524fa(0x1e5))/0x2+-parseInt(_0xd524fa(0x1e4))/0x3+parseInt(_0xd524fa(0x1e8))/0x4*(-parseInt(_0xd524fa(0x1e6))/0x5)+-parseInt(_0xd524fa(0x1e2))/0x6+-parseInt(_0xd524fa(0x1e3))/0x7*(-parseInt(_0xd524fa(0x1e7))/0x8)+-parseInt(_0xd524fa(0x1ea))/0x9*(-parseInt(_0xd524fa(0x1e9))/0xa);if(_0x2989e6===_0x164124)break;else _0x3e0946['push'](_0x3e0946['shift']());}catch(_0x59bd2a){_0x3e0946['push'](_0x3e0946['shift']());}}}(a230_0x5585,0xcd231));import{ruleGet}from'../../commands/rule/get.js';import{ruleList}from'../../commands/rule/list.js';import{ruleSet}from'../../commands/rule/set.js';export const ruleDefinitions=[ruleList,ruleGet,ruleSet];
@@ -1 +1 @@
1
- const a226_0x3ea05e=a226_0x46eb;function a226_0x5a39(){const _0x561cc3=['160yHgfVB','365717LcZBOI','5000lpncVZ','49ermseV','160NqGLcf','9nwnyBD','appCode','101eWvtcE','read','map','cookie','318732AtweeO','rule','Loaded\x20app\x20rule\x20configuration\x20for\x20','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','17496300tbBKpi','1648JKOxZq','286890HMPHyA','917848xDFWPG'];a226_0x5a39=function(){return _0x561cc3;};return a226_0x5a39();}(function(_0x49a5a6,_0x5cfd7a){const _0x3b1eea=a226_0x46eb,_0x445c91=_0x49a5a6();while(!![]){try{const _0x394776=-parseInt(_0x3b1eea(0x172))/0x1*(parseInt(_0x3b1eea(0x168))/0x2)+-parseInt(_0x3b1eea(0x169))/0x3+-parseInt(_0x3b1eea(0x16f))/0x4*(-parseInt(_0x3b1eea(0x16d))/0x5)+-parseInt(_0x3b1eea(0x176))/0x6*(parseInt(_0x3b1eea(0x16e))/0x7)+parseInt(_0x3b1eea(0x16a))/0x8*(-parseInt(_0x3b1eea(0x170))/0x9)+parseInt(_0x3b1eea(0x16b))/0xa*(-parseInt(_0x3b1eea(0x16c))/0xb)+parseInt(_0x3b1eea(0x17a))/0xc;if(_0x394776===_0x5cfd7a)break;else _0x445c91['push'](_0x445c91['shift']());}catch(_0x4c69dc){_0x445c91['push'](_0x445c91['shift']());}}}(a226_0x5a39,0x4965a));function a226_0x46eb(_0x28db85,_0x2e2d46){_0x28db85=_0x28db85-0x168;const _0x5a39c4=a226_0x5a39();let _0x46eb25=_0x5a39c4[_0x28db85];return _0x46eb25;}import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':a226_0x3ea05e(0x177),'command':'list','description':a226_0x3ea05e(0x179),'risk':a226_0x3ea05e(0x173),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x275af4){const _0x28c2b5=a226_0x3ea05e,_0x493c4a=await Promise['all'](APP_RULE_TYPES[_0x28c2b5(0x174)](_0x405a2c=>getAppRule(_0x275af4[_0x28c2b5(0x175)],{'appCode':_0x275af4[_0x28c2b5(0x171)],'type':_0x405a2c}))),_0x4bf38e=APP_RULE_TYPES[_0x28c2b5(0x174)]((_0x1f14a8,_0x30b11)=>projectAppRule(_0x1f14a8,_0x493c4a[_0x30b11]??null));return{'ok':!![],'data':{'total':_0x4bf38e['length'],'rules':_0x4bf38e},'message':_0x28c2b5(0x178)+_0x275af4[_0x28c2b5(0x171)]};}};
1
+ const a231_0x4f8345=a231_0x8b23;function a231_0x8b23(_0x3782e6,_0x37e2d4){_0x3782e6=_0x3782e6-0x72;const _0x5002ba=a231_0x5002();let _0x8b232b=_0x5002ba[_0x3782e6];return _0x8b232b;}(function(_0x5a564a,_0x2306d2){const _0x5d60ae=a231_0x8b23,_0x32d65c=_0x5a564a();while(!![]){try{const _0x2c2bdc=parseInt(_0x5d60ae(0x7b))/0x1+parseInt(_0x5d60ae(0x7a))/0x2*(-parseInt(_0x5d60ae(0x75))/0x3)+-parseInt(_0x5d60ae(0x80))/0x4*(parseInt(_0x5d60ae(0x74))/0x5)+parseInt(_0x5d60ae(0x7c))/0x6+parseInt(_0x5d60ae(0x7d))/0x7+-parseInt(_0x5d60ae(0x7f))/0x8*(parseInt(_0x5d60ae(0x79))/0x9)+parseInt(_0x5d60ae(0x7e))/0xa*(-parseInt(_0x5d60ae(0x84))/0xb);if(_0x2c2bdc===_0x2306d2)break;else _0x32d65c['push'](_0x32d65c['shift']());}catch(_0x29b680){_0x32d65c['push'](_0x32d65c['shift']());}}}(a231_0x5002,0x5062a));import{getAppRule}from'../../core/api-client.js';function a231_0x5002(){const _0x3ad577=['all','Loaded\x20app\x20rule\x20configuration\x20for\x20','4653nmXxZn','104086VzYiWK','576738PwKOCH','2528574CMyjLS','3721207FXxPZN','150BlpSnp','4768ElyHbF','1309908OkCDkX','appCode','rule','read','337931YlCncI','cookie','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','5ETVRFL','6FzYkxE','length'];a231_0x5002=function(){return _0x3ad577;};return a231_0x5002();}import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':a231_0x4f8345(0x82),'command':'list','description':a231_0x4f8345(0x73),'risk':a231_0x4f8345(0x83),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x31907e){const _0x3fd99e=a231_0x4f8345,_0x499eb6=await Promise[_0x3fd99e(0x77)](APP_RULE_TYPES['map'](_0x3859b8=>getAppRule(_0x31907e[_0x3fd99e(0x72)],{'appCode':_0x31907e[_0x3fd99e(0x81)],'type':_0x3859b8}))),_0x3e832c=APP_RULE_TYPES['map']((_0x1b15b6,_0x5c8a82)=>projectAppRule(_0x1b15b6,_0x499eb6[_0x5c8a82]??null));return{'ok':!![],'data':{'total':_0x3e832c[_0x3fd99e(0x76)],'rules':_0x3e832c},'message':_0x3fd99e(0x78)+_0x31907e[_0x3fd99e(0x81)]};}};
@@ -1 +1 @@
1
- function a227_0x2010(_0x426341,_0x310611){_0x426341=_0x426341-0xe5;const _0x55213a=a227_0x5521();let _0x2010d4=_0x55213a[_0x426341];return _0x2010d4;}const a227_0x59df97=a227_0x2010;(function(_0xdddfe8,_0x334ba8){const _0x5b3157=a227_0x2010,_0x950bf1=_0xdddfe8();while(!![]){try{const _0x31d967=parseInt(_0x5b3157(0x10b))/0x1*(parseInt(_0x5b3157(0x120))/0x2)+parseInt(_0x5b3157(0xfd))/0x3+parseInt(_0x5b3157(0x104))/0x4+-parseInt(_0x5b3157(0x102))/0x5+-parseInt(_0x5b3157(0xf8))/0x6+parseInt(_0x5b3157(0xeb))/0x7*(parseInt(_0x5b3157(0x10c))/0x8)+-parseInt(_0x5b3157(0x107))/0x9;if(_0x31d967===_0x334ba8)break;else _0x950bf1['push'](_0x950bf1['shift']());}catch(_0x1d13e3){_0x950bf1['push'](_0x950bf1['shift']());}}}(a227_0x5521,0xcc508));import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';const SAVE_PATH=a227_0x59df97(0x101),NON_ATOMIC_WARNING=a227_0x59df97(0xf5);function readSetInput(_0x492d6e){const _0x487ded=a227_0x59df97,_0x5d8a52=readAppRuleType(_0x492d6e),_0x37e3b4=_0x492d6e['str'](_0x487ded(0x122))['trim']();if(!_0x37e3b4)throw appRuleError(_0x487ded(0x116),_0x487ded(0xe6),_0x487ded(0xed));const _0x5f44f4=_0x492d6e[_0x487ded(0xee)](_0x487ded(0xe5));let _0x381805;if(_0x5f44f4!==undefined){_0x381805=Number(_0x5f44f4);if(!Number[_0x487ded(0x108)](_0x381805)||_0x381805<0x0)throw appRuleError(_0x487ded(0x118),'--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.');}return{'type':_0x5d8a52,'file':_0x37e3b4,'expectedVersion':_0x381805};}async function prepareSet(_0x4fff9c){const _0x1b6c76=a227_0x59df97,_0x33f96d=readSetInput(_0x4fff9c),_0x2af1e2=await readAppRuleFile(_0x33f96d[_0x1b6c76(0x122)]),_0x1847ca=await getAppRule(_0x4fff9c[_0x1b6c76(0xfa)],{'appCode':_0x4fff9c[_0x1b6c76(0xf4)],'type':_0x33f96d[_0x1b6c76(0xef)]});if(_0x33f96d[_0x1b6c76(0xe7)]!==undefined&&_0x1847ca?.[_0x1b6c76(0x117)]!==_0x33f96d[_0x1b6c76(0xe7)])throw appRuleError(_0x1b6c76(0xea),appRuleFileName(_0x33f96d[_0x1b6c76(0xef)])+_0x1b6c76(0x11c),_0x1b6c76(0x10d)+_0x33f96d[_0x1b6c76(0xe7)]+';\x20current\x20version\x20is\x20'+(_0x1847ca?.[_0x1b6c76(0x117)]??_0x1b6c76(0x11b))+_0x1b6c76(0x115));return{'input':_0x33f96d,'replacement':_0x2af1e2,'beforeRecord':_0x1847ca,'before':projectAppRule(_0x33f96d[_0x1b6c76(0xef)],_0x1847ca),'planned':{'type':_0x33f96d[_0x1b6c76(0xef)],'fileName':appRuleFileName(_0x33f96d[_0x1b6c76(0xef)]),'contextScope':appRuleContextScope(_0x33f96d['type']),'enabled':!![],'appCode':_0x4fff9c[_0x1b6c76(0xf4)],'scope':_0x1b6c76(0xf9),'contentByteSize':_0x2af1e2[_0x1b6c76(0x11a)],'contentHash':_0x2af1e2[_0x1b6c76(0xe9)]}};}function warningsFor(_0x5c41a6){return _0x5c41a6===undefined?[]:[NON_ATOMIC_WARNING];}function a227_0x5521(){const _0x46cb66=['Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','Pass\x20a\x20UTF-8\x20Markdown\x20file.','flag','type','\x20--format\x20compress','before','app_rule_set_outcome_unknown','rabetbase\x20rule\x20get\x20--type\x20','appCode','--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.','set','Set\x20','5851302TuHqPN','rules','cookie','POST','verified','1903977rDilOt','\x20for\x20','number','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','/smartapi/knowledge-base/save','2945975iuVzXZ','cause','3167988ltyGQo','planned','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','2691234yBjXGq','isSafeInteger','app_rule_verification_unavailable','Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version','2ODBSYL','288tImnTh','Expected\x20','string','push','rule','input','content','\x20could\x20not\x20be\x20verified.','replacement','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','app_rule_file_required','version','app_rule_expected_version_invalid','write','byteSize','unconfigured','\x20version\x20changed\x20before\x20write.','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','beforeRecord','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','259066OiNgAS','UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)','file','expected-version','--file\x20is\x20required.','expectedVersion','defineProperty','contentHash','app_rule_version_mismatch','197281MbAJcS'];a227_0x5521=function(){return _0x46cb66;};return a227_0x5521();}export const ruleSet={'service':a227_0x59df97(0x110),'command':a227_0x59df97(0xf6),'description':'Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','risk':a227_0x59df97(0x119),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a227_0x59df97(0x122),'type':a227_0x59df97(0x10e),'required':!![],'description':a227_0x59df97(0x121)},{'name':a227_0x59df97(0xe5),'type':a227_0x59df97(0xff),'required':![],'description':a227_0x59df97(0x10a)}],async 'validate'(_0x2aad95){readSetInput(_0x2aad95);},async 'dryRun'(_0x13d43e){const _0x2fdb1e=a227_0x59df97,_0xe958b3=await prepareSet(_0x13d43e);return asDryRunResult({'operation':'set','selector':{'appCode':_0x13d43e[_0x2fdb1e(0xf4)],'scope':_0x2fdb1e(0xf9),'type':_0xe958b3[_0x2fdb1e(0x111)]['type']},'before':_0xe958b3['before'],'after':_0xe958b3[_0x2fdb1e(0x105)],'dryRun':!![],'backend':{'method':_0x2fdb1e(0xfb),'path':SAVE_PATH},'warnings':warningsFor(_0xe958b3[_0x2fdb1e(0x111)][_0x2fdb1e(0xe7)]),'verification':{'expectedVersion':_0xe958b3[_0x2fdb1e(0x111)][_0x2fdb1e(0xe7)]??null,'atomicCompareAndSet':![],'lookupCommand':'rabetbase\x20rule\x20get\x20--type\x20'+_0xe958b3[_0x2fdb1e(0x111)][_0x2fdb1e(0xef)]+_0x2fdb1e(0xf0)}},{'method':_0x2fdb1e(0xfb),'url':SAVE_PATH});},async 'execute'(_0x1939ff){const _0x262aad=a227_0x59df97,_0x100c2c=await prepareSet(_0x1939ff);let _0x139c61=![];try{await saveAppRule(_0x1939ff['cookie'],{'appCode':_0x1939ff[_0x262aad(0xf4)],'type':_0x100c2c[_0x262aad(0x111)][_0x262aad(0xef)],'content':_0x100c2c[_0x262aad(0x114)][_0x262aad(0x112)]});}catch(_0x1e19a2){if(!isPlatformTransportFailure(_0x1e19a2))throw _0x1e19a2;_0x139c61=!![];}let _0x35531c;try{_0x35531c=await getAppRule(_0x1939ff[_0x262aad(0xfa)],{'appCode':_0x1939ff[_0x262aad(0xf4)],'type':_0x100c2c[_0x262aad(0x111)][_0x262aad(0xef)]});}catch(_0x2ba5dd){const _0x3545b8=appRuleError(_0x139c61?_0x262aad(0xf2):_0x262aad(0x109),'The\x20set\x20request\x20was\x20sent,\x20but\x20'+appRuleFileName(_0x100c2c[_0x262aad(0x111)]['type'])+_0x262aad(0x113),_0x262aad(0xec));Object[_0x262aad(0xe8)](_0x3545b8,_0x262aad(0x103),{'value':_0x2ba5dd,'enumerable':![]});throw _0x3545b8;}const _0x490a8f=_0x35531c&&inspectAppRuleContent(_0x35531c[_0x262aad(0x112)])[_0x262aad(0xe9)]===_0x100c2c[_0x262aad(0x114)][_0x262aad(0xe9)],_0x2a79ce=_0x35531c&&(_0x100c2c[_0x262aad(0x11e)]===null||_0x35531c['version']>_0x100c2c[_0x262aad(0x11e)][_0x262aad(0x117)]);if(!_0x35531c||!_0x490a8f||!_0x2a79ce)throw appRuleError(_0x139c61?_0x262aad(0xf2):'app_rule_verification_failed',appRuleFileName(_0x100c2c[_0x262aad(0x111)][_0x262aad(0xef)])+_0x262aad(0x106),_0x262aad(0x11d)+_0x100c2c[_0x262aad(0x111)][_0x262aad(0xef)]+_0x262aad(0x11f));const _0x12fff5=warningsFor(_0x100c2c['input']['expectedVersion']);_0x139c61&&_0x12fff5[_0x262aad(0x10f)](_0x262aad(0x100));const _0x34a247=projectAppRule(_0x100c2c['input']['type'],_0x35531c);return{'ok':!![],'data':{'operation':_0x262aad(0xf6),'selector':{'appCode':_0x1939ff['appCode'],'scope':'rules','type':_0x100c2c[_0x262aad(0x111)][_0x262aad(0xef)]},'before':_0x100c2c[_0x262aad(0xf1)],'after':_0x34a247,'dryRun':![],'backend':{'method':'POST','path':SAVE_PATH},'warnings':_0x12fff5,'verification':{'status':_0x262aad(0xfc),'recoveredAfterUnknownResponse':_0x139c61,'expectedVersion':_0x100c2c[_0x262aad(0x111)][_0x262aad(0xe7)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x262aad(0xf3)+_0x100c2c[_0x262aad(0x111)][_0x262aad(0xef)]+_0x262aad(0xf0)}},'message':_0x262aad(0xf7)+appRuleFileName(_0x100c2c['input'][_0x262aad(0xef)])+_0x262aad(0xfe)+_0x1939ff[_0x262aad(0xf4)]};}};
1
+ const a232_0x4bf09e=a232_0x2801;function a232_0x2801(_0x53fe50,_0x54e131){_0x53fe50=_0x53fe50-0xcd;const _0x4aa26c=a232_0x4aa2();let _0x2801af=_0x4aa26c[_0x53fe50];return _0x2801af;}(function(_0xada9e,_0x29add9){const _0x58357a=a232_0x2801,_0x4d7c6f=_0xada9e();while(!![]){try{const _0x4bd29e=-parseInt(_0x58357a(0xcd))/0x1+parseInt(_0x58357a(0xdc))/0x2*(parseInt(_0x58357a(0xd6))/0x3)+parseInt(_0x58357a(0x101))/0x4*(-parseInt(_0x58357a(0xf3))/0x5)+-parseInt(_0x58357a(0xe2))/0x6+parseInt(_0x58357a(0xfd))/0x7+parseInt(_0x58357a(0xce))/0x8+parseInt(_0x58357a(0x104))/0x9;if(_0x4bd29e===_0x29add9)break;else _0x4d7c6f['push'](_0x4d7c6f['shift']());}catch(_0x23475a){_0x4d7c6f['push'](_0x4d7c6f['shift']());}}}(a232_0x4aa2,0xb897c));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=a232_0x4bf09e(0xd1),NON_ATOMIC_WARNING=a232_0x4bf09e(0xe7);function readSetInput(_0x5ee6a7){const _0x40e0e7=a232_0x4bf09e,_0x44782b=readAppRuleType(_0x5ee6a7),_0x4c1747=_0x5ee6a7[_0x40e0e7(0xf9)](_0x40e0e7(0xd2))[_0x40e0e7(0xe6)]();if(!_0x4c1747)throw appRuleError(_0x40e0e7(0x102),_0x40e0e7(0xf7),'Pass\x20a\x20UTF-8\x20Markdown\x20file.');const _0x363b0a=_0x5ee6a7[_0x40e0e7(0xfa)](_0x40e0e7(0xe4));let _0x116135;if(_0x363b0a!==undefined){_0x116135=Number(_0x363b0a);if(!Number['isSafeInteger'](_0x116135)||_0x116135<0x0)throw appRuleError(_0x40e0e7(0xe0),_0x40e0e7(0xf1));}return{'type':_0x44782b,'file':_0x4c1747,'expectedVersion':_0x116135};}function a232_0x4aa2(){const _0x3ca7a4=['trim','--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.','verified','replacement','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','app_rule_set_outcome_unknown','\x20version\x20changed\x20before\x20write.','Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version','version','UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)','rules','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','unconfigured','5wkdZyV','defineProperty','contentHash','POST','--file\x20is\x20required.','set','str','flag','type','rabetbase\x20rule\x20get\x20--type\x20','8841889eSFVuT','cause','number','push','3242584XBWfZa','app_rule_file_required','appCode','11940633yzhzgZ','planned','1045913ZWnTHD','6005968JeCVGq','\x20--format\x20compress','\x20for\x20','/smartapi/knowledge-base/save','file','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','cookie','app_rule_verification_failed','9777LdjYQx','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','expectedVersion','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','string','136qFHVjD','app_rule_version_mismatch',';\x20current\x20version\x20is\x20','before','app_rule_expected_version_invalid','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','5697426tnpWGD','input','expected-version','content'];a232_0x4aa2=function(){return _0x3ca7a4;};return a232_0x4aa2();}async function prepareSet(_0x4d76d8){const _0x53837d=a232_0x4bf09e,_0x40d70c=readSetInput(_0x4d76d8),_0x11c442=await readAppRuleFile(_0x40d70c[_0x53837d(0xd2)]),_0x5bd628=await getAppRule(_0x4d76d8[_0x53837d(0xd4)],{'appCode':_0x4d76d8[_0x53837d(0x103)],'type':_0x40d70c[_0x53837d(0xfb)]});if(_0x40d70c['expectedVersion']!==undefined&&_0x5bd628?.[_0x53837d(0xee)]!==_0x40d70c[_0x53837d(0xd9)])throw appRuleError(_0x53837d(0xdd),appRuleFileName(_0x40d70c[_0x53837d(0xfb)])+_0x53837d(0xec),'Expected\x20'+_0x40d70c[_0x53837d(0xd9)]+_0x53837d(0xde)+(_0x5bd628?.[_0x53837d(0xee)]??_0x53837d(0xf2))+'.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.');return{'input':_0x40d70c,'replacement':_0x11c442,'beforeRecord':_0x5bd628,'before':projectAppRule(_0x40d70c['type'],_0x5bd628),'planned':{'type':_0x40d70c[_0x53837d(0xfb)],'fileName':appRuleFileName(_0x40d70c[_0x53837d(0xfb)]),'contextScope':appRuleContextScope(_0x40d70c['type']),'enabled':!![],'appCode':_0x4d76d8['appCode'],'scope':'rules','contentByteSize':_0x11c442['byteSize'],'contentHash':_0x11c442[_0x53837d(0xf5)]}};}function warningsFor(_0x319a88){return _0x319a88===undefined?[]:[NON_ATOMIC_WARNING];}export const ruleSet={'service':'rule','command':'set','description':a232_0x4bf09e(0xd7),'risk':'write','requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a232_0x4bf09e(0xd2),'type':a232_0x4bf09e(0xdb),'required':!![],'description':a232_0x4bf09e(0xef)},{'name':'expected-version','type':a232_0x4bf09e(0xff),'required':![],'description':a232_0x4bf09e(0xed)}],async 'validate'(_0x15073f){readSetInput(_0x15073f);},async 'dryRun'(_0x1cda51){const _0x6da87a=a232_0x4bf09e,_0x500d7e=await prepareSet(_0x1cda51);return asDryRunResult({'operation':_0x6da87a(0xf8),'selector':{'appCode':_0x1cda51['appCode'],'scope':_0x6da87a(0xf0),'type':_0x500d7e['input'][_0x6da87a(0xfb)]},'before':_0x500d7e[_0x6da87a(0xdf)],'after':_0x500d7e[_0x6da87a(0x105)],'dryRun':!![],'backend':{'method':_0x6da87a(0xf6),'path':SAVE_PATH},'warnings':warningsFor(_0x500d7e[_0x6da87a(0xe3)]['expectedVersion']),'verification':{'expectedVersion':_0x500d7e[_0x6da87a(0xe3)][_0x6da87a(0xd9)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x6da87a(0xfc)+_0x500d7e[_0x6da87a(0xe3)]['type']+'\x20--format\x20compress'}},{'method':_0x6da87a(0xf6),'url':SAVE_PATH});},async 'execute'(_0x23d724){const _0x26fde7=a232_0x4bf09e,_0x720555=await prepareSet(_0x23d724);let _0xa65b12=![];try{await saveAppRule(_0x23d724[_0x26fde7(0xd4)],{'appCode':_0x23d724['appCode'],'type':_0x720555[_0x26fde7(0xe3)]['type'],'content':_0x720555['replacement'][_0x26fde7(0xe5)]});}catch(_0xe8de4c){if(!isPlatformTransportFailure(_0xe8de4c))throw _0xe8de4c;_0xa65b12=!![];}let _0x172699;try{_0x172699=await getAppRule(_0x23d724[_0x26fde7(0xd4)],{'appCode':_0x23d724[_0x26fde7(0x103)],'type':_0x720555['input']['type']});}catch(_0x5e8a36){const _0xf51787=appRuleError(_0xa65b12?_0x26fde7(0xeb):'app_rule_verification_unavailable','The\x20set\x20request\x20was\x20sent,\x20but\x20'+appRuleFileName(_0x720555[_0x26fde7(0xe3)][_0x26fde7(0xfb)])+'\x20could\x20not\x20be\x20verified.',_0x26fde7(0xd3));Object[_0x26fde7(0xf4)](_0xf51787,_0x26fde7(0xfe),{'value':_0x5e8a36,'enumerable':![]});throw _0xf51787;}const _0x4e47c8=_0x172699&&inspectAppRuleContent(_0x172699['content'])[_0x26fde7(0xf5)]===_0x720555[_0x26fde7(0xe9)]['contentHash'],_0x166185=_0x172699&&(_0x720555['beforeRecord']===null||_0x172699['version']>_0x720555['beforeRecord'][_0x26fde7(0xee)]);if(!_0x172699||!_0x4e47c8||!_0x166185)throw appRuleError(_0xa65b12?_0x26fde7(0xeb):_0x26fde7(0xd5),appRuleFileName(_0x720555[_0x26fde7(0xe3)][_0x26fde7(0xfb)])+_0x26fde7(0xd8),_0x26fde7(0xda)+_0x720555[_0x26fde7(0xe3)][_0x26fde7(0xfb)]+_0x26fde7(0xe1));const _0x440520=warningsFor(_0x720555['input'][_0x26fde7(0xd9)]);_0xa65b12&&_0x440520[_0x26fde7(0x100)](_0x26fde7(0xea));const _0x155f96=projectAppRule(_0x720555[_0x26fde7(0xe3)]['type'],_0x172699);return{'ok':!![],'data':{'operation':'set','selector':{'appCode':_0x23d724[_0x26fde7(0x103)],'scope':_0x26fde7(0xf0),'type':_0x720555[_0x26fde7(0xe3)]['type']},'before':_0x720555['before'],'after':_0x155f96,'dryRun':![],'backend':{'method':_0x26fde7(0xf6),'path':SAVE_PATH},'warnings':_0x440520,'verification':{'status':_0x26fde7(0xe8),'recoveredAfterUnknownResponse':_0xa65b12,'expectedVersion':_0x720555[_0x26fde7(0xe3)]['expectedVersion']??null,'atomicCompareAndSet':![],'lookupCommand':_0x26fde7(0xfc)+_0x720555[_0x26fde7(0xe3)][_0x26fde7(0xfb)]+_0x26fde7(0xcf)}},'message':'Set\x20'+appRuleFileName(_0x720555['input'][_0x26fde7(0xfb)])+_0x26fde7(0xd0)+_0x23d724[_0x26fde7(0x103)]};}};
@@ -1 +1 @@
1
- const a228_0x42fe83=a228_0x5190;function a228_0x5190(_0x13cce8,_0x28919a){_0x13cce8=_0x13cce8-0x77;const _0x378c6d=a228_0x378c();let _0x5190c5=_0x378c6d[_0x13cce8];return _0x5190c5;}(function(_0x2251eb,_0x2bb3d2){const _0xe4327d=a228_0x5190,_0x1c2454=_0x2251eb();while(!![]){try{const _0x168f05=parseInt(_0xe4327d(0x7d))/0x1+-parseInt(_0xe4327d(0x99))/0x2+-parseInt(_0xe4327d(0x9b))/0x3*(-parseInt(_0xe4327d(0x84))/0x4)+parseInt(_0xe4327d(0x87))/0x5+-parseInt(_0xe4327d(0x8f))/0x6*(parseInt(_0xe4327d(0x80))/0x7)+parseInt(_0xe4327d(0xa2))/0x8+-parseInt(_0xe4327d(0x7a))/0x9*(parseInt(_0xe4327d(0x95))/0xa);if(_0x168f05===_0x2bb3d2)break;else _0x1c2454['push'](_0x1c2454['shift']());}catch(_0x6cce58){_0x1c2454['push'](_0x1c2454['shift']());}}}(a228_0x378c,0xa6e86));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';function a228_0x378c(){const _0x161622=['rules','version','467590TrLJya','updateTime','3DsmCuf','Cannot\x20access\x20app\x20rule\x20file:\x20','database','App\x20rule\x20file\x20is\x20blank:\x20','Pass\x20a\x20UTF-8\x20Markdown\x20file.','byteSize','app_rule_content_invalid','4365352FIqHIw','str','app_rule_file_invalid','from','9Cmwdvb','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','app_rule_content_too_large','951800ruGKZY','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','size','1241338cnnLsB','sha256:','trim','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','2903124fsLhhD','byteLength','app_rule_file_required','4735275eOmuAo','createTime','database-analysis','message','utf8','app_rule_file_unreadable','RULES.md','digest','12CwQIvm','decode','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','toLowerCase','sha256','content','18981880DaOlBT','DATABASE.md'];a228_0x378c=function(){return _0x161622;};return a228_0x378c();}import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a228_0x42fe83(0x97),a228_0x42fe83(0x9d)];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a228_0x42fe83(0x8d),'database':a228_0x42fe83(0x96)},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':a228_0x42fe83(0x89)};export function appRuleError(_0x2ca0a6,_0x5bbaac,_0x3c9fdb){return new CliError(_0x2ca0a6,0x1,_0x5bbaac,_0x3c9fdb);}export function readAppRuleType(_0x31624f){const _0x250493=a228_0x42fe83,_0x4cc7fe=_0x31624f[_0x250493(0x77)]('type')[_0x250493(0x82)]()[_0x250493(0x92)]();if(_0x4cc7fe!==_0x250493(0x97)&&_0x4cc7fe!==_0x250493(0x9d))throw appRuleError('app_rule_type_invalid','--type\x20must\x20be\x20either\x20rules\x20or\x20database.');return _0x4cc7fe;}export function appRuleFileName(_0x56578f){return APP_RULE_FILES[_0x56578f];}export function appRuleContextScope(_0x25eb52){return APP_RULE_CONTEXT_SCOPES[_0x25eb52];}export function inspectAppRuleContent(_0x241e2f){const _0x555f27=a228_0x42fe83,_0x4e45da=Buffer[_0x555f27(0x79)](_0x241e2f,_0x555f27(0x8b));return{'content':_0x241e2f,'byteSize':_0x4e45da[_0x555f27(0x85)],'contentHash':_0x555f27(0x81)+createHash(_0x555f27(0x93))['update'](_0x4e45da)[_0x555f27(0x8e)]('hex')};}export async function readAppRuleFile(_0xa58923){const _0x3714dd=a228_0x42fe83,_0x4377a7=_0xa58923[_0x3714dd(0x82)]();if(!_0x4377a7)throw appRuleError(_0x3714dd(0x86),'--file\x20is\x20required.',_0x3714dd(0x9f));const _0xfbcc6f=resolve(_0x4377a7);let _0x5dd320;try{_0x5dd320=await stat(_0xfbcc6f);}catch(_0x29481e){throw appRuleError(_0x3714dd(0x8c),_0x3714dd(0x9c)+_0x4377a7,_0x29481e instanceof Error?_0x29481e[_0x3714dd(0x8a)]:String(_0x29481e));}if(!_0x5dd320['isFile']())throw appRuleError(_0x3714dd(0x78),_0x3714dd(0x83)+_0x4377a7);if(_0x5dd320[_0x3714dd(0x7f)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x3714dd(0x7c),_0x3714dd(0x91));let _0x40f042;try{_0x40f042=await readFile(_0xfbcc6f);}catch(_0x5283ee){throw appRuleError(_0x3714dd(0x8c),'Cannot\x20read\x20app\x20rule\x20file:\x20'+_0x4377a7,_0x5283ee instanceof Error?_0x5283ee[_0x3714dd(0x8a)]:String(_0x5283ee));}if(_0x40f042[_0x3714dd(0x85)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x3714dd(0x7c),_0x3714dd(0x91));let _0x4f60e5;try{_0x4f60e5=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})[_0x3714dd(0x90)](_0x40f042);}catch{throw appRuleError('app_rule_content_invalid',_0x3714dd(0x7b)+_0x4377a7);}if(!_0x4f60e5[_0x3714dd(0x82)]())throw appRuleError(_0x3714dd(0xa1),_0x3714dd(0x9e)+_0x4377a7);return inspectAppRuleContent(_0x4f60e5);}export function projectAppRule(_0xe45f2b,_0x12268e){const _0x210efd=a228_0x42fe83;if(!_0x12268e)return{'type':_0xe45f2b,'fileName':appRuleFileName(_0xe45f2b),'contextScope':appRuleContextScope(_0xe45f2b),'enabled':![]};const _0x562307=inspectAppRuleContent(_0x12268e[_0x210efd(0x94)]);return{'type':_0xe45f2b,'fileName':appRuleFileName(_0xe45f2b),'contextScope':appRuleContextScope(_0xe45f2b),'enabled':!![],'id':_0x12268e['id'],'scope':_0x12268e['scope'],'appCode':_0x12268e['appCode'],'version':_0x12268e[_0x210efd(0x98)],'contentByteSize':_0x562307[_0x210efd(0xa0)],'contentHash':_0x562307['contentHash'],..._0x12268e['createTime']!==undefined&&_0x12268e[_0x210efd(0x88)]!==null?{'createTime':_0x12268e[_0x210efd(0x88)]}:{},..._0x12268e[_0x210efd(0x9a)]!==undefined&&_0x12268e[_0x210efd(0x9a)]!==null?{'updateTime':_0x12268e[_0x210efd(0x9a)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':'type','type':'string','required':!![],'description':a228_0x42fe83(0x7e),'enum':[...APP_RULE_TYPES]};
1
+ const a233_0x26382b=a233_0x5a8d;function a233_0x5a8d(_0x1a6351,_0x26b93d){_0x1a6351=_0x1a6351-0x79;const _0x5ea92f=a233_0x5ea9();let _0x5a8d4e=_0x5ea92f[_0x1a6351];return _0x5a8d4e;}(function(_0x5ae463,_0x5bf4d6){const _0x287f15=a233_0x5a8d,_0x5b12e9=_0x5ae463();while(!![]){try{const _0x2b0771=-parseInt(_0x287f15(0xa9))/0x1+parseInt(_0x287f15(0x9c))/0x2+-parseInt(_0x287f15(0x87))/0x3+parseInt(_0x287f15(0x7b))/0x4*(-parseInt(_0x287f15(0x88))/0x5)+parseInt(_0x287f15(0x98))/0x6*(-parseInt(_0x287f15(0x89))/0x7)+-parseInt(_0x287f15(0x93))/0x8+-parseInt(_0x287f15(0x80))/0x9*(-parseInt(_0x287f15(0xa5))/0xa);if(_0x2b0771===_0x5bf4d6)break;else _0x5b12e9['push'](_0x5b12e9['shift']());}catch(_0x10f07a){_0x5b12e9['push'](_0x5b12e9['shift']());}}}(a233_0x5ea9,0x29e5c));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a233_0x26382b(0x8d),'database'];function a233_0x5ea9(){const _0x1245fe=['content','App\x20rule\x20file\x20is\x20blank:\x20','7790910tWjGKi','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','scope','contentHash','116428jDgFtj','app_rule_type_invalid','update','createTime','version','530844ygMYrb','app_rule_file_required','Pass\x20a\x20UTF-8\x20Markdown\x20file.','size','sha256','9cEgBaS','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','toLowerCase','page-api-development','message','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','type','633621unkaUa','5tmTICn','900242Afelng','app_rule_file_invalid','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','app_rule_content_invalid','rules','RULES.md','utf8','app_rule_file_unreadable','byteLength','from','1366688IIWXBj','Cannot\x20access\x20app\x20rule\x20file:\x20','Cannot\x20read\x20app\x20rule\x20file:\x20','updateTime','decode','6lzwPiQ','str','database','byteSize','304618EkfwNz','sha256:','app_rule_content_too_large','trim','hex','appCode','database-analysis'];a233_0x5ea9=function(){return _0x1245fe;};return a233_0x5ea9();}export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a233_0x26382b(0x8e),'database':'DATABASE.md'},APP_RULE_CONTEXT_SCOPES={'rules':a233_0x26382b(0x83),'database':a233_0x26382b(0xa2)};export function appRuleError(_0x1a4a4d,_0x4fd732,_0x2d2f9b){return new CliError(_0x1a4a4d,0x1,_0x4fd732,_0x2d2f9b);}export function readAppRuleType(_0x18fd38){const _0x34541b=a233_0x26382b,_0xc5ec15=_0x18fd38[_0x34541b(0x99)](_0x34541b(0x86))['trim']()[_0x34541b(0x82)]();if(_0xc5ec15!==_0x34541b(0x8d)&&_0xc5ec15!==_0x34541b(0x9a))throw appRuleError(_0x34541b(0xaa),'--type\x20must\x20be\x20either\x20rules\x20or\x20database.');return _0xc5ec15;}export function appRuleFileName(_0x2e0487){return APP_RULE_FILES[_0x2e0487];}export function appRuleContextScope(_0x283f23){return APP_RULE_CONTEXT_SCOPES[_0x283f23];}export function inspectAppRuleContent(_0x4cbcdf){const _0x2dd3f6=a233_0x26382b,_0x117064=Buffer[_0x2dd3f6(0x92)](_0x4cbcdf,_0x2dd3f6(0x8f));return{'content':_0x4cbcdf,'byteSize':_0x117064[_0x2dd3f6(0x91)],'contentHash':_0x2dd3f6(0x9d)+createHash(_0x2dd3f6(0x7f))[_0x2dd3f6(0xab)](_0x117064)['digest'](_0x2dd3f6(0xa0))};}export async function readAppRuleFile(_0x47356e){const _0x2fd226=a233_0x26382b,_0x28c8c9=_0x47356e[_0x2fd226(0x9f)]();if(!_0x28c8c9)throw appRuleError(_0x2fd226(0x7c),'--file\x20is\x20required.',_0x2fd226(0x7d));const _0x2f035d=resolve(_0x28c8c9);let _0x4e503;try{_0x4e503=await stat(_0x2f035d);}catch(_0xea325d){throw appRuleError(_0x2fd226(0x90),_0x2fd226(0x94)+_0x28c8c9,_0xea325d instanceof Error?_0xea325d['message']:String(_0xea325d));}if(!_0x4e503['isFile']())throw appRuleError(_0x2fd226(0x8a),_0x2fd226(0x81)+_0x28c8c9);if(_0x4e503[_0x2fd226(0x7e)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x2fd226(0x9e),_0x2fd226(0x85));let _0x5ba523;try{_0x5ba523=await readFile(_0x2f035d);}catch(_0x1716d1){throw appRuleError(_0x2fd226(0x90),_0x2fd226(0x95)+_0x28c8c9,_0x1716d1 instanceof Error?_0x1716d1[_0x2fd226(0x84)]:String(_0x1716d1));}if(_0x5ba523['byteLength']>MAX_APP_RULE_BYTES)throw appRuleError(_0x2fd226(0x9e),_0x2fd226(0x85));let _0x2823d7;try{_0x2823d7=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})[_0x2fd226(0x97)](_0x5ba523);}catch{throw appRuleError(_0x2fd226(0x8c),_0x2fd226(0x8b)+_0x28c8c9);}if(!_0x2823d7[_0x2fd226(0x9f)]())throw appRuleError(_0x2fd226(0x8c),_0x2fd226(0xa4)+_0x28c8c9);return inspectAppRuleContent(_0x2823d7);}export function projectAppRule(_0x2e9234,_0x2f6981){const _0x843809=a233_0x26382b;if(!_0x2f6981)return{'type':_0x2e9234,'fileName':appRuleFileName(_0x2e9234),'contextScope':appRuleContextScope(_0x2e9234),'enabled':![]};const _0x1f0e43=inspectAppRuleContent(_0x2f6981[_0x843809(0xa3)]);return{'type':_0x2e9234,'fileName':appRuleFileName(_0x2e9234),'contextScope':appRuleContextScope(_0x2e9234),'enabled':!![],'id':_0x2f6981['id'],'scope':_0x2f6981[_0x843809(0xa7)],'appCode':_0x2f6981[_0x843809(0xa1)],'version':_0x2f6981[_0x843809(0x7a)],'contentByteSize':_0x1f0e43[_0x843809(0x9b)],'contentHash':_0x1f0e43[_0x843809(0xa8)],..._0x2f6981[_0x843809(0x79)]!==undefined&&_0x2f6981['createTime']!==null?{'createTime':_0x2f6981[_0x843809(0x79)]}:{},..._0x2f6981['updateTime']!==undefined&&_0x2f6981[_0x843809(0x96)]!==null?{'updateTime':_0x2f6981[_0x843809(0x96)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a233_0x26382b(0x86),'type':'string','required':!![],'description':a233_0x26382b(0xa6),'enum':[...APP_RULE_TYPES]};
@@ -1 +1 @@
1
- const a229_0x552c43=a229_0x34e3;(function(_0x1eb039,_0x103cb5){const _0x5acc90=a229_0x34e3,_0x4da8ca=_0x1eb039();while(!![]){try{const _0x2a8470=-parseInt(_0x5acc90(0x17d))/0x1+parseInt(_0x5acc90(0x163))/0x2*(-parseInt(_0x5acc90(0x164))/0x3)+-parseInt(_0x5acc90(0x183))/0x4+-parseInt(_0x5acc90(0x167))/0x5*(-parseInt(_0x5acc90(0x190))/0x6)+-parseInt(_0x5acc90(0x188))/0x7*(parseInt(_0x5acc90(0x17c))/0x8)+-parseInt(_0x5acc90(0x152))/0x9*(parseInt(_0x5acc90(0x15c))/0xa)+parseInt(_0x5acc90(0x16c))/0xb;if(_0x2a8470===_0x103cb5)break;else _0x4da8ca['push'](_0x4da8ca['shift']());}catch(_0x29419b){_0x4da8ca['push'](_0x4da8ca['shift']());}}}(a229_0x4b5e,0x4859a));import{readFileSync,existsSync}from'node:fs';function a229_0x4b5e(){const _0xfe2278=['utf-8','error','push','close','13996917foyapR','Script\x20\x22','bool','No\x20package.json\x20found\x20in\x20current\x20directory.','log','--watch','pnpm','Available:\x20','\x20run\x20','write','vite','inherit','.bin','length','slice','belowMinimum','125928xwGKtG','95352OvmqJl','\x20run\x20preview\x20--watch','preview','\x22\x20not\x20found\x20in\x20package.json.','validation','\x20run\x20start','2298832aeyyCe','bun.lock','Script\x20name\x20defined\x20in\x20package.json','watch','needsUpgrade','21FmPLbT','Enable\x20watch\x20mode\x20for\x20preview','args','cwd','all','\x20run\x20build','bun.lockb','join','178440LlpEPy','Domain\x20routing\x20synchronized:\x20','start','build','script','run','\x0a\x20\x20Usage:\x20','4194mMvomq','yarn.lock','vite\x20preview\x20exited\x20with\x20code\x20','node_modules','changed','has','Run\x20a\x20package.json\x20script','(none)','boolean','\x20\x20\x20\x20','12130eYSdcc','dev','npm','keys','No\x20scripts\x20defined\x20in\x20package.json.','\x20run\x20<script>\x0a','path','4220AiqujR','114NCgUKO','\x20run\x20preview','\x20\x20EXAMPLES','65MKGazS'];a229_0x4b5e=function(){return _0xfe2278;};return a229_0x4b5e();}import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a229_0x552c43(0x14d),a229_0x552c43(0x15d)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a229_0x552c43(0x14d),a229_0x552c43(0x15d),a229_0x552c43(0x14e),a229_0x552c43(0x17f)]);export function syncProjectDomainRoutingBeforeScript(_0x194121,_0x247046){const _0x5252cc=a229_0x552c43;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x5252cc(0x157)](_0x247046))return null;const _0x62178e=findProjectRootDirectory(_0x194121);if(!resolveConfigPath(_0x62178e))return null;const _0xb5111a=writeProjectDomainRoutingManifest(_0x62178e);return{'path':_0xb5111a[_0x5252cc(0x162)],'changed':_0xb5111a[_0x5252cc(0x156)]};}function readPackageScripts(_0x4e0e7b){const _0x5d574b=a229_0x552c43,_0x5ca81d=resolve(_0x4e0e7b,'package.json');if(!existsSync(_0x5ca81d))return null;try{const _0x4b6dda=JSON['parse'](readFileSync(_0x5ca81d,_0x5d574b(0x168)));return _0x4b6dda['scripts']??{};}catch{return null;}}function detectPackageManager(_0x188909){const _0x56a3fd=a229_0x552c43;if(existsSync(resolve(_0x188909,_0x56a3fd(0x18e)))||existsSync(resolve(_0x188909,_0x56a3fd(0x184))))return'bun';if(existsSync(resolve(_0x188909,'pnpm-lock.yaml')))return _0x56a3fd(0x172);if(existsSync(resolve(_0x188909,_0x56a3fd(0x153))))return'yarn';return _0x56a3fd(0x15e);}async function versionCheck(_0x31bd51){const _0x52eb5f=a229_0x552c43,_0x653ffb=await checkCliVersion();(_0x653ffb[_0x52eb5f(0x187)]||_0x653ffb[_0x52eb5f(0x17b)])&&(printCliUpgradeWarning(_0x653ffb),assertCliVersionSupported(_0x653ffb));const _0x4d6cd3=await checkSdkVersion(_0x31bd51);if(_0x4d6cd3[_0x52eb5f(0x187)])printSdkUpgradeWarning(_0x4d6cd3);}function spawnScript(_0x267295,_0x3fcbf4,_0x104a04,_0x489931){return new Promise((_0x126eec,_0x19a365)=>{const _0x4a8b5c=a229_0x34e3,_0x42cd37=[_0x4a8b5c(0x150),_0x3fcbf4,..._0x104a04],_0x3fb6e9=spawn(_0x267295,_0x42cd37,{'cwd':_0x489931,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x489931,_0x4a8b5c(0x155),_0x4a8b5c(0x178))+delimiter+process.env.PATH}});_0x3fb6e9['on'](_0x4a8b5c(0x16b),_0x250bb2=>{const _0xc51c42=_0x4a8b5c;if(_0x250bb2===0x0||_0x250bb2===null)_0x126eec();else _0x19a365(new Error(_0x267295+_0xc51c42(0x174)+_0x3fcbf4+'\x20exited\x20with\x20code\x20'+_0x250bb2));}),_0x3fb6e9['on'](_0x4a8b5c(0x169),_0x19a365);});}function spawnViteBuildWatch(_0x25aa64){return new Promise((_0xaa3482,_0x4cd7b9)=>{const _0x34a256=a229_0x34e3,_0x345e73=spawn('vite',['build',_0x34a256(0x171)],{'cwd':_0x25aa64,'stdio':_0x34a256(0x177),'shell':!![],'env':{...process.env,'PATH':''+join(_0x25aa64,_0x34a256(0x155),_0x34a256(0x178))+delimiter+process.env.PATH}});_0x345e73['on'](_0x34a256(0x16b),_0x173c9d=>{if(_0x173c9d===0x0||_0x173c9d===null)_0xaa3482();else _0x4cd7b9(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x173c9d));}),_0x345e73['on']('error',_0x4cd7b9);});}function spawnVitePreview(_0x376b0f){return new Promise((_0x5dcfae,_0x19441b)=>{const _0x359904=a229_0x34e3,_0x5cb990=spawn(_0x359904(0x176),[_0x359904(0x17f)],{'cwd':_0x376b0f,'stdio':_0x359904(0x177),'shell':!![],'env':{...process.env,'PATH':''+join(_0x376b0f,_0x359904(0x155),_0x359904(0x178))+delimiter+process.env.PATH}});_0x5cb990['on'](_0x359904(0x16b),_0x50b8c8=>{const _0x1684dc=_0x359904;if(_0x50b8c8===0x0||_0x50b8c8===null)_0x5dcfae();else _0x19441b(new Error(_0x1684dc(0x154)+_0x50b8c8));}),_0x5cb990['on'](_0x359904(0x169),_0x19441b);});}function a229_0x34e3(_0x593ff3,_0x3ae015){_0x593ff3=_0x593ff3-0x14c;const _0x4b5eb2=a229_0x4b5e();let _0x34e37b=_0x4b5eb2[_0x593ff3];return _0x34e37b;}const runFlags=[{'name':'watch','type':a229_0x552c43(0x15a),'description':a229_0x552c43(0x189),'default':![]}];export const runDefinition={'service':'run','command':a229_0x552c43(0x150),'description':a229_0x552c43(0x158),'risk':a229_0x552c43(0x175),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a229_0x552c43(0x14f),'description':a229_0x552c43(0x185),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x42637d=a229_0x552c43,_0x286028=[];return _0x286028[_0x42637d(0x16a)](_0x42637d(0x166)),_0x286028['push'](_0x42637d(0x15b)+CLI_BIN_NAME+_0x42637d(0x182)),_0x286028[_0x42637d(0x16a)](_0x42637d(0x15b)+CLI_BIN_NAME+_0x42637d(0x18d)),_0x286028[_0x42637d(0x16a)](_0x42637d(0x15b)+CLI_BIN_NAME+_0x42637d(0x165)),_0x286028[_0x42637d(0x16a)](_0x42637d(0x15b)+CLI_BIN_NAME+_0x42637d(0x17e)),_0x286028['join']('\x0a');},async 'execute'(_0xef8cda){const _0xbf3fd2=a229_0x552c43,_0x4b3374=process[_0xbf3fd2(0x18b)](),_0xaa2439=_0xef8cda['args'][0x0],_0x19eb59=_0xef8cda[_0xbf3fd2(0x18a)][_0xbf3fd2(0x17a)](0x1),_0x442f53=readPackageScripts(_0x4b3374);if(!_0x442f53)throw CliErrors[_0xbf3fd2(0x181)](_0xbf3fd2(0x16f));if(!_0xaa2439){const _0x314611=Object[_0xbf3fd2(0x15f)](_0x442f53);if(_0x314611[_0xbf3fd2(0x179)]===0x0)console[_0xbf3fd2(0x170)](_0xbf3fd2(0x160));else{console[_0xbf3fd2(0x170)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x54874a of _0x314611){console['log'](_0xbf3fd2(0x15b)+_0x54874a);}console[_0xbf3fd2(0x170)](_0xbf3fd2(0x151)+CLI_BIN_NAME+_0xbf3fd2(0x161));}return{'ok':!![]};}if(!_0x442f53[_0xaa2439])throw CliErrors[_0xbf3fd2(0x181)](_0xbf3fd2(0x16d)+_0xaa2439+_0xbf3fd2(0x180),_0xbf3fd2(0x173)+(Object['keys'](_0x442f53)[_0xbf3fd2(0x18f)](',\x20')||_0xbf3fd2(0x159)));const _0x14b7a4=detectPackageManager(_0x4b3374),_0x22c1f2=syncProjectDomainRoutingBeforeScript(_0x4b3374,_0xaa2439);_0x22c1f2?.['changed']&&console['error'](_0xbf3fd2(0x14c)+_0x22c1f2[_0xbf3fd2(0x162)]);VERSION_CHECK_SCRIPTS[_0xbf3fd2(0x157)](_0xaa2439)&&await versionCheck(_0x4b3374);if(_0xaa2439===_0xbf3fd2(0x17f)&&_0xef8cda[_0xbf3fd2(0x16e)](_0xbf3fd2(0x186)))return await Promise[_0xbf3fd2(0x18c)]([spawnViteBuildWatch(_0x4b3374),spawnVitePreview(_0x4b3374)]),{'ok':!![]};return await spawnScript(_0x14b7a4,_0xaa2439,_0x19eb59,_0x4b3374),{'ok':!![]};}};
1
+ const a234_0x53374d=a234_0x6c1e;(function(_0xef83ba,_0x2d8978){const _0xf38b=a234_0x6c1e,_0x272098=_0xef83ba();while(!![]){try{const _0x3d1789=-parseInt(_0xf38b(0x133))/0x1*(-parseInt(_0xf38b(0x137))/0x2)+-parseInt(_0xf38b(0x124))/0x3*(-parseInt(_0xf38b(0x164))/0x4)+-parseInt(_0xf38b(0x15f))/0x5+parseInt(_0xf38b(0x12e))/0x6*(parseInt(_0xf38b(0x126))/0x7)+-parseInt(_0xf38b(0x147))/0x8*(-parseInt(_0xf38b(0x156))/0x9)+-parseInt(_0xf38b(0x15c))/0xa*(-parseInt(_0xf38b(0x140))/0xb)+parseInt(_0xf38b(0x154))/0xc*(-parseInt(_0xf38b(0x139))/0xd);if(_0x3d1789===_0x2d8978)break;else _0x272098['push'](_0x272098['shift']());}catch(_0x3a3ace){_0x272098['push'](_0x272098['shift']());}}}(a234_0x2d77,0x6ba71));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';function a234_0x2d77(){const _0x3be63e=['\x22\x20not\x20found\x20in\x20package.json.','scripts','write','433292VcyYjZ','bun','(none)','yarn','4IXwlxD','run','14524887xObedJ','inherit','\x0a\x20\x20Usage:\x20','yarn.lock','changed','\x20run\x20','has','11zpJIID','Enable\x20watch\x20mode\x20for\x20preview','vite','pnpm','.bin','\x20run\x20start','bun.lock','485592VCXdcE','log','\x0a\x20\x20Available\x20scripts:\x0a','args','path','error','bool','close','build','Available:\x20','\x20run\x20<script>\x0a','node_modules','--watch','12Pvlwge','script','27gFZoTB','\x20\x20EXAMPLES','start','push','\x20run\x20preview','Script\x20\x22','4788280fKXpsb','pnpm-lock.yaml','No\x20scripts\x20defined\x20in\x20package.json.','3963390JzQTlE','\x20run\x20preview\x20--watch','\x20\x20\x20\x20','dev','cwd','4QOYkGn','No\x20package.json\x20found\x20in\x20current\x20directory.','preview','utf-8','vite\x20preview\x20exited\x20with\x20code\x20','1147071xSAQiY','needsUpgrade','1078znrOVx','join','validation','keys','Run\x20a\x20package.json\x20script','Domain\x20routing\x20synchronized:\x20','\x20run\x20build','bun.lockb','17184vXwsTb','watch'];a234_0x2d77=function(){return _0x3be63e;};return a234_0x2d77();}const VERSION_CHECK_SCRIPTS=new Set([a234_0x53374d(0x158),a234_0x53374d(0x162)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a234_0x53374d(0x158),a234_0x53374d(0x162),a234_0x53374d(0x14f),a234_0x53374d(0x166)]);export function syncProjectDomainRoutingBeforeScript(_0x2f3918,_0x511bed){const _0x55b9ff=a234_0x53374d;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x55b9ff(0x13f)](_0x511bed))return null;const _0x1ccf6b=findProjectRootDirectory(_0x2f3918);if(!resolveConfigPath(_0x1ccf6b))return null;const _0x4b9b98=writeProjectDomainRoutingManifest(_0x1ccf6b);return{'path':_0x4b9b98['path'],'changed':_0x4b9b98[_0x55b9ff(0x13d)]};}function readPackageScripts(_0x357581){const _0x5da456=a234_0x53374d,_0x2fe336=resolve(_0x357581,'package.json');if(!existsSync(_0x2fe336))return null;try{const _0x22a1a8=JSON['parse'](readFileSync(_0x2fe336,_0x5da456(0x167)));return _0x22a1a8[_0x5da456(0x131)]??{};}catch{return null;}}function detectPackageManager(_0x1dc83c){const _0x4d5aba=a234_0x53374d;if(existsSync(resolve(_0x1dc83c,_0x4d5aba(0x12d)))||existsSync(resolve(_0x1dc83c,_0x4d5aba(0x146))))return _0x4d5aba(0x134);if(existsSync(resolve(_0x1dc83c,_0x4d5aba(0x15d))))return _0x4d5aba(0x143);if(existsSync(resolve(_0x1dc83c,_0x4d5aba(0x13c))))return _0x4d5aba(0x136);return'npm';}async function versionCheck(_0x5e5dda){const _0xffcf9c=a234_0x53374d,_0x29d8e7=await checkCliVersion();(_0x29d8e7['needsUpgrade']||_0x29d8e7['belowMinimum'])&&(printCliUpgradeWarning(_0x29d8e7),assertCliVersionSupported(_0x29d8e7));const _0x59bd54=await checkSdkVersion(_0x5e5dda);if(_0x59bd54[_0xffcf9c(0x125)])printSdkUpgradeWarning(_0x59bd54);}function a234_0x6c1e(_0x27bcb0,_0x4a6140){_0x27bcb0=_0x27bcb0-0x123;const _0x2d77ad=a234_0x2d77();let _0x6c1e0b=_0x2d77ad[_0x27bcb0];return _0x6c1e0b;}function spawnScript(_0x3fe2ea,_0xcbb93d,_0x1955c3,_0x2a141e){return new Promise((_0x745466,_0xaa9e52)=>{const _0x385579=a234_0x6c1e,_0x51a1ee=['run',_0xcbb93d,..._0x1955c3],_0x30b903=spawn(_0x3fe2ea,_0x51a1ee,{'cwd':_0x2a141e,'stdio':_0x385579(0x13a),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2a141e,_0x385579(0x152),_0x385579(0x144))+delimiter+process.env.PATH}});_0x30b903['on'](_0x385579(0x14e),_0x5017dd=>{const _0x4fba3e=_0x385579;if(_0x5017dd===0x0||_0x5017dd===null)_0x745466();else _0xaa9e52(new Error(_0x3fe2ea+_0x4fba3e(0x13e)+_0xcbb93d+'\x20exited\x20with\x20code\x20'+_0x5017dd));}),_0x30b903['on'](_0x385579(0x14c),_0xaa9e52);});}function spawnViteBuildWatch(_0xb705c3){return new Promise((_0x4e3f73,_0xeefba6)=>{const _0x385a61=a234_0x6c1e,_0x12622f=spawn(_0x385a61(0x142),[_0x385a61(0x14f),_0x385a61(0x153)],{'cwd':_0xb705c3,'stdio':_0x385a61(0x13a),'shell':!![],'env':{...process.env,'PATH':''+join(_0xb705c3,_0x385a61(0x152),_0x385a61(0x144))+delimiter+process.env.PATH}});_0x12622f['on']('close',_0x75b6a1=>{if(_0x75b6a1===0x0||_0x75b6a1===null)_0x4e3f73();else _0xeefba6(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x75b6a1));}),_0x12622f['on']('error',_0xeefba6);});}function spawnVitePreview(_0x3e3757){return new Promise((_0x322d2b,_0x269642)=>{const _0x18f8a5=a234_0x6c1e,_0x2ad049=spawn('vite',[_0x18f8a5(0x166)],{'cwd':_0x3e3757,'stdio':_0x18f8a5(0x13a),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3e3757,'node_modules',_0x18f8a5(0x144))+delimiter+process.env.PATH}});_0x2ad049['on'](_0x18f8a5(0x14e),_0xe92859=>{const _0x5b57ca=_0x18f8a5;if(_0xe92859===0x0||_0xe92859===null)_0x322d2b();else _0x269642(new Error(_0x5b57ca(0x123)+_0xe92859));}),_0x2ad049['on'](_0x18f8a5(0x14c),_0x269642);});}const runFlags=[{'name':a234_0x53374d(0x12f),'type':'boolean','description':a234_0x53374d(0x141),'default':![]}];export const runDefinition={'service':a234_0x53374d(0x138),'command':a234_0x53374d(0x138),'description':a234_0x53374d(0x12a),'risk':a234_0x53374d(0x132),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a234_0x53374d(0x155),'description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x22a42e=a234_0x53374d,_0x522bef=[];return _0x522bef[_0x22a42e(0x159)](_0x22a42e(0x157)),_0x522bef[_0x22a42e(0x159)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x22a42e(0x145)),_0x522bef[_0x22a42e(0x159)](_0x22a42e(0x161)+CLI_BIN_NAME+_0x22a42e(0x12c)),_0x522bef[_0x22a42e(0x159)](_0x22a42e(0x161)+CLI_BIN_NAME+_0x22a42e(0x15a)),_0x522bef[_0x22a42e(0x159)](_0x22a42e(0x161)+CLI_BIN_NAME+_0x22a42e(0x160)),_0x522bef['join']('\x0a');},async 'execute'(_0x439db1){const _0x12b62b=a234_0x53374d,_0x370692=process[_0x12b62b(0x163)](),_0x2eb927=_0x439db1[_0x12b62b(0x14a)][0x0],_0x4a23c2=_0x439db1[_0x12b62b(0x14a)]['slice'](0x1),_0x3a4ca7=readPackageScripts(_0x370692);if(!_0x3a4ca7)throw CliErrors[_0x12b62b(0x128)](_0x12b62b(0x165));if(!_0x2eb927){const _0x30f84b=Object[_0x12b62b(0x129)](_0x3a4ca7);if(_0x30f84b['length']===0x0)console['log'](_0x12b62b(0x15e));else{console['log'](_0x12b62b(0x149));for(const _0x4f8627 of _0x30f84b){console[_0x12b62b(0x148)](_0x12b62b(0x161)+_0x4f8627);}console[_0x12b62b(0x148)](_0x12b62b(0x13b)+CLI_BIN_NAME+_0x12b62b(0x151));}return{'ok':!![]};}if(!_0x3a4ca7[_0x2eb927])throw CliErrors['validation'](_0x12b62b(0x15b)+_0x2eb927+_0x12b62b(0x130),_0x12b62b(0x150)+(Object[_0x12b62b(0x129)](_0x3a4ca7)[_0x12b62b(0x127)](',\x20')||_0x12b62b(0x135)));const _0xe0042d=detectPackageManager(_0x370692),_0x1d61b8=syncProjectDomainRoutingBeforeScript(_0x370692,_0x2eb927);_0x1d61b8?.[_0x12b62b(0x13d)]&&console['error'](_0x12b62b(0x12b)+_0x1d61b8[_0x12b62b(0x14b)]);VERSION_CHECK_SCRIPTS[_0x12b62b(0x13f)](_0x2eb927)&&await versionCheck(_0x370692);if(_0x2eb927===_0x12b62b(0x166)&&_0x439db1[_0x12b62b(0x14d)](_0x12b62b(0x12f)))return await Promise['all']([spawnViteBuildWatch(_0x370692),spawnVitePreview(_0x370692)]),{'ok':!![]};return await spawnScript(_0xe0042d,_0x2eb927,_0x4a23c2,_0x370692),{'ok':!![]};}};
@@ -1 +1 @@
1
- const a230_0x1a213f=a230_0x53a5;(function(_0x2b383e,_0x27cf3f){const _0xe587db=a230_0x53a5,_0xd2747a=_0x2b383e();while(!![]){try{const _0x13e3bd=parseInt(_0xe587db(0xcb))/0x1+-parseInt(_0xe587db(0xce))/0x2+parseInt(_0xe587db(0xd7))/0x3+-parseInt(_0xe587db(0xd4))/0x4*(-parseInt(_0xe587db(0xd0))/0x5)+-parseInt(_0xe587db(0xcf))/0x6+parseInt(_0xe587db(0xd6))/0x7+-parseInt(_0xe587db(0xd5))/0x8*(-parseInt(_0xe587db(0xd1))/0x9);if(_0x13e3bd===_0x27cf3f)break;else _0xd2747a['push'](_0xd2747a['shift']());}catch(_0x1f26d6){_0xd2747a['push'](_0xd2747a['shift']());}}}(a230_0x2b99,0x6d737));function a230_0x53a5(_0x534815,_0x1d5d4e){_0x534815=_0x534815-0xcb;const _0x2b99b6=a230_0x2b99();let _0x53a5d0=_0x2b99b6[_0x534815];return _0x53a5d0;}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x208f9e){const _0x1fbc67=await buildSchemaPayload();return{'ok':!![],'data':_0x1fbc67};}function a230_0x2b99(){const _0xe75322=['15896AKZkrB','1181054miATdT','320415iMjMGO','json','71681bEaMxr','Export\x20machine-readable\x20command\x20schema\x20(JSON)','export','1746034jADveH','5374458FPDNOj','3890lPrFXg','6489FkYJph','schema','read','2248EmXyBv'];a230_0x2b99=function(){return _0xe75322;};return a230_0x2b99();}export const schemaDefinition={'service':a230_0x1a213f(0xd2),'command':a230_0x1a213f(0xcd),'description':a230_0x1a213f(0xcc),'risk':a230_0x1a213f(0xd3),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a230_0x1a213f(0xd8),'flags':[],'execute':execute};
1
+ const a235_0x4dcecc=a235_0x12c9;(function(_0x8cf7e4,_0x99822e){const _0x89c125=a235_0x12c9,_0x222da1=_0x8cf7e4();while(!![]){try{const _0x35e81e=parseInt(_0x89c125(0x138))/0x1*(parseInt(_0x89c125(0x134))/0x2)+parseInt(_0x89c125(0x139))/0x3+-parseInt(_0x89c125(0x12e))/0x4*(parseInt(_0x89c125(0x130))/0x5)+parseInt(_0x89c125(0x136))/0x6*(parseInt(_0x89c125(0x132))/0x7)+parseInt(_0x89c125(0x133))/0x8+-parseInt(_0x89c125(0x13a))/0x9+parseInt(_0x89c125(0x135))/0xa*(parseInt(_0x89c125(0x137))/0xb);if(_0x35e81e===_0x99822e)break;else _0x222da1['push'](_0x222da1['shift']());}catch(_0x3db4e3){_0x222da1['push'](_0x222da1['shift']());}}}(a235_0x141f,0xd716f));function a235_0x141f(){const _0xfaf159=['schema','5AAXezW','Export\x20machine-readable\x20command\x20schema\x20(JSON)','20020XoCHwP','7370240iNamzc','4OczjoA','44300shvVZe','1494GCaVmR','352XDLtrv','74552QcmzHb','986217UUBhPM','5867001uyBGMO','read','json','2880508ZtdPXu'];a235_0x141f=function(){return _0xfaf159;};return a235_0x141f();}import{buildSchemaPayload}from'../framework/schema-export.js';function a235_0x12c9(_0x5f03c9,_0x540bef){_0x5f03c9=_0x5f03c9-0x12c;const _0x141fbb=a235_0x141f();let _0x12c942=_0x141fbb[_0x5f03c9];return _0x12c942;}async function execute(_0x50743e){const _0x4ff271=await buildSchemaPayload();return{'ok':!![],'data':_0x4ff271};}export const schemaDefinition={'service':a235_0x4dcecc(0x12f),'command':'export','description':a235_0x4dcecc(0x131),'risk':a235_0x4dcecc(0x12c),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a235_0x4dcecc(0x12d),'flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a231_0x566dd3=a231_0xd28a;(function(_0x35cc05,_0x550b9c){const _0x1fe057=a231_0xd28a,_0xfc56f=_0x35cc05();while(!![]){try{const _0x4e1958=parseInt(_0x1fe057(0x16e))/0x1*(parseInt(_0x1fe057(0x18e))/0x2)+parseInt(_0x1fe057(0x185))/0x3+parseInt(_0x1fe057(0x16b))/0x4*(parseInt(_0x1fe057(0x17f))/0x5)+parseInt(_0x1fe057(0x189))/0x6*(parseInt(_0x1fe057(0x168))/0x7)+parseInt(_0x1fe057(0x15d))/0x8*(parseInt(_0x1fe057(0x193))/0x9)+parseInt(_0x1fe057(0x19f))/0xa+-parseInt(_0x1fe057(0x176))/0xb*(parseInt(_0x1fe057(0x195))/0xc);if(_0x4e1958===_0x550b9c)break;else _0xfc56f['push'](_0xfc56f['shift']());}catch(_0x1c7b8f){_0xfc56f['push'](_0xfc56f['shift']());}}}(a231_0x3065,0x807ce));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x4f1e67){const _0x336874=a231_0xd28a;if(_0x4f1e67===_0x336874(0x169))return[_0x336874(0x191),'\x20\x20SELECT\x201\x20AS\x20id',_0x336874(0x180),'']['join']('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x336874(0x198)]('\x0a');}function a231_0xd28a(_0x22bdcc,_0xe274f){_0x22bdcc=_0x22bdcc-0x15d;const _0x306530=a231_0x3065();let _0xd28a5f=_0x306530[_0x22bdcc];return _0xd28a5f;}export const sqlCreate={'service':a231_0x566dd3(0x179),'command':a231_0x566dd3(0x172),'description':a231_0x566dd3(0x164),'risk':a231_0x566dd3(0x16c),'flags':[{'name':a231_0x566dd3(0x194),'type':a231_0x566dd3(0x19b),'description':'SQL\x20query\x20display\x20name'},{'name':'db-id','type':a231_0x566dd3(0x175),'description':'Target\x20database\x20ID'},{'name':a231_0x566dd3(0x16a),'type':'string','enum':[a231_0x566dd3(0x179),a231_0x566dd3(0x169)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x826d60){const _0x280a66=a231_0x566dd3;if(!_0x826d60[_0x280a66(0x18a)])return;if(!_0x826d60['str'](_0x280a66(0x194))[_0x280a66(0x18c)]())throw CliErrors['flagMissing'](_0x280a66(0x194),_0x280a66(0x178));const _0x40c859=resolveProvidedDbId(_0x826d60);if(typeof _0x40c859!=='number'||!Number[_0x280a66(0x196)](_0x40c859)||_0x40c859<=0x0)throw CliErrors[_0x280a66(0x17d)](_0x280a66(0x183),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x826d60[_0x280a66(0x162)]('mode')[_0x280a66(0x18c)]())throw CliErrors['flagMissing']('mode',_0x280a66(0x15e));},async 'dryRun'(_0x371917){const _0x11b2a9=a231_0x566dd3,_0x84339f=loadSqlProjectConfig(_0x371917[_0x11b2a9(0x184)]),{sqlName:_0x1bf548,dbId:_0x37e4e8,dbName:_0x4fffaf,mode:_0x3874da}=await resolveSqlNewInputs(_0x371917),_0x5b95b9=buildSqlRelativePath('<server-generated-sqlCode>',_0x1bf548,_0x4fffaf,_0x3874da,_0x37e4e8),_0x484baf=_0x84339f['sqlRootDir']+'/'+_0x5b95b9;return{'method':'POST','url':_0x11b2a9(0x181),'body':{'appCode':_0x371917[_0x11b2a9(0x184)],'sqlName':_0x1bf548,'dbId':_0x37e4e8,'mode':_0x3874da,'localPath':_0x484baf},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x84339f[_0x11b2a9(0x16d)]};},async 'execute'(_0x548417){const _0x4fff21=a231_0x566dd3,_0xaf2e3c=loadSqlProjectConfig(_0x548417[_0x4fff21(0x184)]),{sqlName:_0x1a46dd,dbId:_0x85cd6e,dbName:_0x15600a,mode:_0x1f8572}=await resolveSqlNewInputs(_0x548417),_0x33de63=generateSqlTemplate(_0x1f8572),_0x478a16=await createSqlQuery({'appCode':_0x548417[_0x4fff21(0x184)],'sqlName':_0x1a46dd,'dbId':_0x85cd6e,'sqlContent':_0x33de63}),_0x23c86b=ensureRemoteSqlContent(_0x478a16),_0xd0f99a=_0x15600a||await getDbName(_0x548417[_0x4fff21(0x184)],_0x85cd6e)[_0x4fff21(0x17a)](()=>undefined),_0x496d40=buildSqlRelativePath(_0x478a16[_0x4fff21(0x1a0)],_0x478a16[_0x4fff21(0x19a)],_0xd0f99a,_0x1f8572,_0x85cd6e),_0x55149a=_0xaf2e3c[_0x4fff21(0x16d)]+'/'+_0x496d40,_0x2ad1bc=buildLocalSqlFileContent({'sqlCode':_0x478a16['sqlCode'],'sqlName':_0x478a16['sqlName'],'dbId':_0x478a16[_0x4fff21(0x166)]},_0x23c86b,{'dbName':_0xd0f99a,'mode':_0x1f8572,'syncedAt':new Date()[_0x4fff21(0x174)](),'description':_0x478a16[_0x4fff21(0x18f)]});if(await fileExists(_0x55149a))throw CliErrors['validation'](_0x4fff21(0x18b)+_0x55149a);await ensureParentDirectory(_0x55149a),await writeFile(_0x55149a,_0x2ad1bc,_0x4fff21(0x15f));const _0x481b1f=await readSqlLockFile(_0xaf2e3c['lockFilePath']),{lockData:_0x3b7a4d,appLock:_0x718922}=ensureSqlLockScope(_0x481b1f??createEmptySqlLock(),_0xaf2e3c[_0x4fff21(0x184)],_0xaf2e3c[_0x4fff21(0x17b)],_0x4fff21(0x182));return _0x718922[_0x4fff21(0x19e)][_0x478a16[_0x4fff21(0x1a0)]]={...buildSqlLockEntry(_0x478a16,_0x23c86b,computeSqlContentHash(_0x2ad1bc),{'dbName':_0xd0f99a}),'path':_0x496d40,'mode':_0x1f8572},_0x718922[_0x4fff21(0x197)]=new Date()['toISOString'](),await writeSqlLockFile(_0xaf2e3c['lockFilePath'],_0x3b7a4d),{'ok':!![],'data':{'id':_0x478a16['id'],'sqlCode':_0x478a16[_0x4fff21(0x1a0)],'sqlName':_0x478a16['sqlName'],'dbId':_0x478a16[_0x4fff21(0x166)],'path':_0x55149a,'mode':_0x1f8572},'message':_0x4fff21(0x17c)+_0x478a16['sqlCode']};}};async function resolveSqlNewInputs(_0x4fe1dd){const _0x592e44=await resolveSqlNameInput(_0x4fe1dd),{dbId:_0x23c821,dbName:_0x1994dd}=await resolveDbSelection(_0x4fe1dd),_0x4c89b4=await resolveSqlModeInput(_0x4fe1dd);return{'sqlName':_0x592e44,'dbId':_0x23c821,'dbName':_0x1994dd,'mode':_0x4c89b4};}async function resolveSqlNameInput(_0x394a85){const _0x558bc9=a231_0x566dd3,_0x42cce1=_0x394a85[_0x558bc9(0x162)](_0x558bc9(0x194))[_0x558bc9(0x18c)]();if(_0x42cce1)return _0x42cce1;if(_0x394a85[_0x558bc9(0x18a)])throw CliErrors['flagMissing']('name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x558bc9(0x173),'validate':_0x2d4ec7=>_0x2d4ec7['trim']()?!![]:_0x558bc9(0x177)}))['trim']();}async function resolveDbSelection(_0x105140){const _0x5532d6=a231_0x566dd3,_0x2f5332=resolveProvidedDbId(_0x105140);if(typeof _0x2f5332===_0x5532d6(0x175)&&Number['isFinite'](_0x2f5332)&&_0x2f5332>0x0)return{'dbId':_0x2f5332,'dbName':await getDbName(_0x105140[_0x5532d6(0x184)],_0x2f5332)[_0x5532d6(0x17a)](()=>undefined)};if(_0x105140[_0x5532d6(0x18a)])throw CliErrors[_0x5532d6(0x17d)](_0x5532d6(0x183),_0x5532d6(0x170));const _0x55410e=await listDatabases(_0x105140['appCode'])[_0x5532d6(0x17a)](()=>[]);if(_0x55410e[_0x5532d6(0x161)]===0x1)return{'dbId':_0x55410e[0x0]['dbId'],'dbName':_0x55410e[0x0]['dbName']};if(_0x55410e['length']>0x1){const _0x14c178=await select({'message':_0x5532d6(0x192),'choices':[..._0x55410e[_0x5532d6(0x199)](_0x315ad3=>({'name':_0x315ad3[_0x5532d6(0x171)]+'\x20('+_0x315ad3[_0x5532d6(0x166)]+')','value':serializeDbSelection(_0x315ad3)})),{'name':_0x5532d6(0x187),'value':_0x5532d6(0x163)}]});if(_0x14c178!==_0x5532d6(0x163))return deserializeDbSelection(_0x14c178);}const _0x56b3a3=await input({'message':_0x5532d6(0x19d),'validate':_0x46c324=>{const _0x493d70=_0x5532d6,_0x1cb7f3=_0x46c324[_0x493d70(0x18c)]();if(!_0x1cb7f3)return'dbId\x20cannot\x20be\x20empty';const _0xd41a6e=Number(_0x1cb7f3);if(!Number[_0x493d70(0x167)](_0xd41a6e)||_0xd41a6e<=0x0)return _0x493d70(0x19c);return!![];}});return{'dbId':Number(_0x56b3a3[_0x5532d6(0x18c)]())};}async function resolveSqlModeInput(_0x20dfac){const _0x99979f=a231_0x566dd3,_0x15bc98=_0x20dfac[_0x99979f(0x162)](_0x99979f(0x16a))[_0x99979f(0x18c)]();if(_0x15bc98===_0x99979f(0x179)||_0x15bc98==='mybatisXml')return _0x15bc98;if(_0x20dfac['nonInteractive'])throw CliErrors[_0x99979f(0x17d)](_0x99979f(0x16a),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x99979f(0x17e),'choices':[{'name':_0x99979f(0x18d),'value':'sql','description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x99979f(0x190),'value':_0x99979f(0x169),'description':_0x99979f(0x160)}]});}function serializeDbSelection(_0x1a7de9){const _0x5d9a22=a231_0x566dd3;return JSON[_0x5d9a22(0x165)]({'dbId':_0x1a7de9[_0x5d9a22(0x166)],'dbName':_0x1a7de9[_0x5d9a22(0x171)]});}function deserializeDbSelection(_0x5cd41f){const _0x22baf8=a231_0x566dd3;try{const _0x1de7e7=JSON[_0x22baf8(0x16f)](_0x5cd41f);if(typeof _0x1de7e7[_0x22baf8(0x166)]==='number'&&Number[_0x22baf8(0x196)](_0x1de7e7[_0x22baf8(0x166)]))return{'dbId':_0x1de7e7['dbId'],'dbName':_0x1de7e7[_0x22baf8(0x171)]};}catch{}throw CliErrors[_0x22baf8(0x186)](_0x22baf8(0x188)+_0x5cd41f);}function resolveProvidedDbId(_0x551b72){const _0x4bf646=a231_0x566dd3,_0x361dd4=_0x551b72['flag'](_0x4bf646(0x183));if(typeof _0x361dd4===_0x4bf646(0x175)&&Number[_0x4bf646(0x196)](_0x361dd4))return _0x361dd4;return undefined;}function a231_0x3065(){const _0x371cbe=['6DpvQWC','nonInteractive','File\x20already\x20exists:\x20','trim','Plain\x20SQL\x20(sql)','2vcaUtq','description','MyBatis\x20XML\x20(mybatisXml)','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','Select\x20the\x20target\x20database:','273096lDheIl','name','24tQKKNB','isFinite','lastSync','join','map','sqlName','string','dbId\x20must\x20be\x20a\x20positive\x20integer','Target\x20database\x20dbId:','sqls','8319330gyIJxr','sqlCode','32mcAdSJ','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','utf8','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','length','str','__manual__','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','stringify','dbId','isInteger','3121874vkNbKN','mybatisXml','mode','2341100ywXqTf','write','sqlRootDir','393522VMtxns','parse','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','dbName','create','SQL\x20name:','toISOString','number','12707717ibDrGu','SQL\x20name\x20cannot\x20be\x20empty','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','sql','catch','sqlRoot','Created\x20SQL\x20query\x20','flagMissing','Select\x20the\x20local\x20SQL\x20mode:','5sbfFuZ','</select>','/smartapi/custom/saveUserCustomSql','new','db-id','appCode','1376076gyvSGc','validation','✎\x20Enter\x20dbId\x20manually','Invalid\x20database\x20selection\x20payload:\x20'];a231_0x3065=function(){return _0x371cbe;};return a231_0x3065();}
1
+ const a236_0x56c34f=a236_0x4b53;(function(_0xf85d38,_0x523f7f){const _0x3a56b0=a236_0x4b53,_0x4a1d70=_0xf85d38();while(!![]){try{const _0xa91b85=-parseInt(_0x3a56b0(0x145))/0x1*(-parseInt(_0x3a56b0(0x16d))/0x2)+parseInt(_0x3a56b0(0x12d))/0x3*(-parseInt(_0x3a56b0(0x15b))/0x4)+-parseInt(_0x3a56b0(0x16e))/0x5*(-parseInt(_0x3a56b0(0x15c))/0x6)+parseInt(_0x3a56b0(0x157))/0x7+parseInt(_0x3a56b0(0x151))/0x8*(parseInt(_0x3a56b0(0x168))/0x9)+-parseInt(_0x3a56b0(0x130))/0xa*(parseInt(_0x3a56b0(0x15a))/0xb)+parseInt(_0x3a56b0(0x139))/0xc*(-parseInt(_0x3a56b0(0x138))/0xd);if(_0xa91b85===_0x523f7f)break;else _0x4a1d70['push'](_0x4a1d70['shift']());}catch(_0x14b55a){_0x4a1d70['push'](_0x4a1d70['shift']());}}}(a236_0x33ae,0x71127));import{writeFile}from'node:fs/promises';function a236_0x33ae(){const _0xf659e3=['dbId\x20must\x20be\x20a\x20positive\x20integer','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20name:','Invalid\x20database\x20selection\x20payload:\x20','flagMissing','description','Select\x20the\x20local\x20SQL\x20mode:','</select>','isFinite','2AJowOu','sqlCode','number','str','lockFilePath','SQL\x20name\x20cannot\x20be\x20empty','Target\x20database\x20dbId:','length','✎\x20Enter\x20dbId\x20manually','join','toISOString','mode','5961688xnUwKs','\x20\x20SELECT\x201\x20AS\x20id','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','sqlRootDir','mybatisXml','appCode','1652889NQqNnk','sqlName','dbId\x20cannot\x20be\x20empty','1639957VnJkdm','156KyESce','102eBriRr','dbName','utf8','isInteger','Target\x20database\x20ID','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','sqls','trim','dbId','validation','POST','File\x20already\x20exists:\x20','9WxHAkL','string','new','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','MyBatis\x20XML\x20(mybatisXml)','529798diTJcF','157615GIAzoR','db-id','name','catch','Select\x20the\x20target\x20database:','nonInteractive','46356LVYxSZ','<server-generated-sqlCode>','parse','60LSeTJI','Created\x20SQL\x20query\x20','Local\x20SQL\x20file\x20mode','lastSync','__manual__','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','sqlRoot','sql','1127542GIBArK','12rBWqTe','/smartapi/custom/saveUserCustomSql','create'];a236_0x33ae=function(){return _0xf659e3;};return a236_0x33ae();}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(_0x5386f9){const _0x22d0c6=a236_0x4b53;if(_0x5386f9===_0x22d0c6(0x155))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x22d0c6(0x152),_0x22d0c6(0x143),'']['join']('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x22d0c6(0x14e)]('\x0a');}export const sqlCreate={'service':'sql','command':a236_0x56c34f(0x13b),'description':a236_0x56c34f(0x135),'risk':'write','flags':[{'name':a236_0x56c34f(0x170),'type':'string','description':'SQL\x20query\x20display\x20name'},{'name':a236_0x56c34f(0x16f),'type':a236_0x56c34f(0x147),'description':a236_0x56c34f(0x160)},{'name':a236_0x56c34f(0x150),'type':a236_0x56c34f(0x169),'enum':[a236_0x56c34f(0x137),a236_0x56c34f(0x155)],'description':a236_0x56c34f(0x132)}],async 'validate'(_0x38e9de){const _0x2baa77=a236_0x56c34f;if(!_0x38e9de[_0x2baa77(0x12c)])return;if(!_0x38e9de[_0x2baa77(0x148)](_0x2baa77(0x170))[_0x2baa77(0x163)]())throw CliErrors['flagMissing'](_0x2baa77(0x170),_0x2baa77(0x161));const _0x1e18cf=resolveProvidedDbId(_0x38e9de);if(typeof _0x1e18cf!==_0x2baa77(0x147)||!Number['isFinite'](_0x1e18cf)||_0x1e18cf<=0x0)throw CliErrors['flagMissing'](_0x2baa77(0x16f),_0x2baa77(0x16b));if(!_0x38e9de[_0x2baa77(0x148)](_0x2baa77(0x150))[_0x2baa77(0x163)]())throw CliErrors[_0x2baa77(0x140)](_0x2baa77(0x150),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x517ee4){const _0x5ae061=a236_0x56c34f,_0x2af7da=loadSqlProjectConfig(_0x517ee4[_0x5ae061(0x156)]),{sqlName:_0xfe88e5,dbId:_0x40d473,dbName:_0x165cdd,mode:_0x14cb41}=await resolveSqlNewInputs(_0x517ee4),_0x455d0d=buildSqlRelativePath(_0x5ae061(0x12e),_0xfe88e5,_0x165cdd,_0x14cb41,_0x40d473),_0x2b7f40=_0x2af7da[_0x5ae061(0x154)]+'/'+_0x455d0d;return{'method':_0x5ae061(0x166),'url':_0x5ae061(0x13a),'body':{'appCode':_0x517ee4[_0x5ae061(0x156)],'sqlName':_0xfe88e5,'dbId':_0x40d473,'mode':_0x14cb41,'localPath':_0x2b7f40},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x2af7da[_0x5ae061(0x154)]};},async 'execute'(_0xd33b3b){const _0x235f5a=a236_0x56c34f,_0x5c7687=loadSqlProjectConfig(_0xd33b3b[_0x235f5a(0x156)]),{sqlName:_0x1deb48,dbId:_0x3f3e9e,dbName:_0x249b92,mode:_0x57269f}=await resolveSqlNewInputs(_0xd33b3b),_0xc9c76=generateSqlTemplate(_0x57269f),_0x1485ce=await createSqlQuery({'appCode':_0xd33b3b[_0x235f5a(0x156)],'sqlName':_0x1deb48,'dbId':_0x3f3e9e,'sqlContent':_0xc9c76}),_0x577225=ensureRemoteSqlContent(_0x1485ce),_0x2c14de=_0x249b92||await getDbName(_0xd33b3b['appCode'],_0x3f3e9e)[_0x235f5a(0x171)](()=>undefined),_0x15a23c=buildSqlRelativePath(_0x1485ce[_0x235f5a(0x146)],_0x1485ce[_0x235f5a(0x158)],_0x2c14de,_0x57269f,_0x3f3e9e),_0x4a03b7=_0x5c7687[_0x235f5a(0x154)]+'/'+_0x15a23c,_0x25df59=buildLocalSqlFileContent({'sqlCode':_0x1485ce['sqlCode'],'sqlName':_0x1485ce['sqlName'],'dbId':_0x1485ce['dbId']},_0x577225,{'dbName':_0x2c14de,'mode':_0x57269f,'syncedAt':new Date()[_0x235f5a(0x14f)](),'description':_0x1485ce[_0x235f5a(0x141)]});if(await fileExists(_0x4a03b7))throw CliErrors[_0x235f5a(0x165)](_0x235f5a(0x167)+_0x4a03b7);await ensureParentDirectory(_0x4a03b7),await writeFile(_0x4a03b7,_0x25df59,_0x235f5a(0x15e));const _0x14c0af=await readSqlLockFile(_0x5c7687[_0x235f5a(0x149)]),{lockData:_0x20b8d3,appLock:_0x42c8af}=ensureSqlLockScope(_0x14c0af??createEmptySqlLock(),_0x5c7687[_0x235f5a(0x156)],_0x5c7687[_0x235f5a(0x136)],_0x235f5a(0x16a));return _0x42c8af[_0x235f5a(0x162)][_0x1485ce[_0x235f5a(0x146)]]={...buildSqlLockEntry(_0x1485ce,_0x577225,computeSqlContentHash(_0x25df59),{'dbName':_0x2c14de}),'path':_0x15a23c,'mode':_0x57269f},_0x42c8af[_0x235f5a(0x133)]=new Date()[_0x235f5a(0x14f)](),await writeSqlLockFile(_0x5c7687[_0x235f5a(0x149)],_0x20b8d3),{'ok':!![],'data':{'id':_0x1485ce['id'],'sqlCode':_0x1485ce[_0x235f5a(0x146)],'sqlName':_0x1485ce[_0x235f5a(0x158)],'dbId':_0x1485ce[_0x235f5a(0x164)],'path':_0x4a03b7,'mode':_0x57269f},'message':_0x235f5a(0x131)+_0x1485ce[_0x235f5a(0x146)]};}};function a236_0x4b53(_0x28f032,_0x47125d){_0x28f032=_0x28f032-0x12c;const _0x33ae65=a236_0x33ae();let _0x4b5386=_0x33ae65[_0x28f032];return _0x4b5386;}async function resolveSqlNewInputs(_0x5324b4){const _0x227703=await resolveSqlNameInput(_0x5324b4),{dbId:_0x4f7e85,dbName:_0x576658}=await resolveDbSelection(_0x5324b4),_0xb2c645=await resolveSqlModeInput(_0x5324b4);return{'sqlName':_0x227703,'dbId':_0x4f7e85,'dbName':_0x576658,'mode':_0xb2c645};}async function resolveSqlNameInput(_0x350dc7){const _0x586407=a236_0x56c34f,_0x20f9f5=_0x350dc7[_0x586407(0x148)](_0x586407(0x170))[_0x586407(0x163)]();if(_0x20f9f5)return _0x20f9f5;if(_0x350dc7[_0x586407(0x12c)])throw CliErrors['flagMissing'](_0x586407(0x170),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x586407(0x13e),'validate':_0x1f20f9=>_0x1f20f9['trim']()?!![]:_0x586407(0x14a)}))[_0x586407(0x163)]();}async function resolveDbSelection(_0x1e5dd1){const _0x54191d=a236_0x56c34f,_0x3124f7=resolveProvidedDbId(_0x1e5dd1);if(typeof _0x3124f7===_0x54191d(0x147)&&Number[_0x54191d(0x144)](_0x3124f7)&&_0x3124f7>0x0)return{'dbId':_0x3124f7,'dbName':await getDbName(_0x1e5dd1['appCode'],_0x3124f7)[_0x54191d(0x171)](()=>undefined)};if(_0x1e5dd1[_0x54191d(0x12c)])throw CliErrors[_0x54191d(0x140)](_0x54191d(0x16f),_0x54191d(0x16b));const _0x186d01=await listDatabases(_0x1e5dd1[_0x54191d(0x156)])[_0x54191d(0x171)](()=>[]);if(_0x186d01[_0x54191d(0x14c)]===0x1)return{'dbId':_0x186d01[0x0]['dbId'],'dbName':_0x186d01[0x0][_0x54191d(0x15d)]};if(_0x186d01[_0x54191d(0x14c)]>0x1){const _0x4167d0=await select({'message':_0x54191d(0x172),'choices':[..._0x186d01['map'](_0x4dc9f1=>({'name':_0x4dc9f1[_0x54191d(0x15d)]+'\x20('+_0x4dc9f1['dbId']+')','value':serializeDbSelection(_0x4dc9f1)})),{'name':_0x54191d(0x14d),'value':_0x54191d(0x134)}]});if(_0x4167d0!==_0x54191d(0x134))return deserializeDbSelection(_0x4167d0);}const _0x3a3bc5=await input({'message':_0x54191d(0x14b),'validate':_0x46028c=>{const _0x671f5e=_0x54191d,_0x3cf2e2=_0x46028c[_0x671f5e(0x163)]();if(!_0x3cf2e2)return _0x671f5e(0x159);const _0x59bf67=Number(_0x3cf2e2);if(!Number[_0x671f5e(0x15f)](_0x59bf67)||_0x59bf67<=0x0)return _0x671f5e(0x13c);return!![];}});return{'dbId':Number(_0x3a3bc5['trim']())};}async function resolveSqlModeInput(_0xe9a7fd){const _0x223ea1=a236_0x56c34f,_0x7e14a5=_0xe9a7fd[_0x223ea1(0x148)](_0x223ea1(0x150))[_0x223ea1(0x163)]();if(_0x7e14a5==='sql'||_0x7e14a5===_0x223ea1(0x155))return _0x7e14a5;if(_0xe9a7fd['nonInteractive'])throw CliErrors['flagMissing'](_0x223ea1(0x150),_0x223ea1(0x13d));return await select({'message':_0x223ea1(0x142),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':'sql','description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x223ea1(0x16c),'value':_0x223ea1(0x155),'description':_0x223ea1(0x153)}]});}function serializeDbSelection(_0x195fd0){const _0x18d6c3=a236_0x56c34f;return JSON['stringify']({'dbId':_0x195fd0[_0x18d6c3(0x164)],'dbName':_0x195fd0[_0x18d6c3(0x15d)]});}function deserializeDbSelection(_0x29a9df){const _0x22f87b=a236_0x56c34f;try{const _0x3e4cc8=JSON[_0x22f87b(0x12f)](_0x29a9df);if(typeof _0x3e4cc8[_0x22f87b(0x164)]===_0x22f87b(0x147)&&Number['isFinite'](_0x3e4cc8['dbId']))return{'dbId':_0x3e4cc8[_0x22f87b(0x164)],'dbName':_0x3e4cc8[_0x22f87b(0x15d)]};}catch{}throw CliErrors[_0x22f87b(0x165)](_0x22f87b(0x13f)+_0x29a9df);}function resolveProvidedDbId(_0x4de77c){const _0x1b5308=a236_0x56c34f,_0x53439d=_0x4de77c['flag'](_0x1b5308(0x16f));if(typeof _0x53439d===_0x1b5308(0x147)&&Number[_0x1b5308(0x144)](_0x53439d))return _0x53439d;return undefined;}
@@ -1 +1 @@
1
- const a232_0x296974=a232_0x1b73;(function(_0xf83938,_0x3a255a){const _0x4659aa=a232_0x1b73,_0x2d9af7=_0xf83938();while(!![]){try{const _0x1a2d69=parseInt(_0x4659aa(0x1c5))/0x1+parseInt(_0x4659aa(0x1b1))/0x2*(parseInt(_0x4659aa(0x1c3))/0x3)+-parseInt(_0x4659aa(0x1b7))/0x4*(-parseInt(_0x4659aa(0x1b3))/0x5)+parseInt(_0x4659aa(0x1c9))/0x6*(parseInt(_0x4659aa(0x1ab))/0x7)+-parseInt(_0x4659aa(0x1c8))/0x8+-parseInt(_0x4659aa(0x1ae))/0x9+parseInt(_0x4659aa(0x1b0))/0xa*(-parseInt(_0x4659aa(0x1bc))/0xb);if(_0x1a2d69===_0x3a255a)break;else _0x2d9af7['push'](_0x2d9af7['shift']());}catch(_0x3cb73f){_0x2d9af7['push'](_0x2d9af7['shift']());}}}(a232_0x3132,0x7aab9));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a232_0x1b73(_0x5f33fe,_0x525d34){_0x5f33fe=_0x5f33fe-0x1a6;const _0x31328f=a232_0x3132();let _0x1b731c=_0x31328f[_0x5f33fe];return _0x1b731c;}import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a232_0x296974(0x1a7),'command':a232_0x296974(0x1b9),'description':a232_0x296974(0x1bf),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x5d8ebc){const _0x41b13c=a232_0x296974,_0x51292e=loadSqlProjectConfig(_0x5d8ebc[_0x41b13c(0x1a9)]),_0x22589a=await readSqlLockFile(_0x51292e[_0x41b13c(0x1c4)]);if(!_0x22589a)throw CliErrors[_0x41b13c(0x1be)](_0x41b13c(0x1b2));},async 'dryRun'(_0x5be366){const _0x1ddd73=a232_0x296974,_0x146852=loadSqlProjectConfig(_0x5be366[_0x1ddd73(0x1a9)]),_0xb84ff3=await readSqlLockFile(_0x146852[_0x1ddd73(0x1c4)]);if(!_0xb84ff3)throw CliErrors[_0x1ddd73(0x1be)](_0x1ddd73(0x1b2));const {appLock:_0x10329f}=ensureSqlLockScope(_0xb84ff3,_0x5be366[_0x1ddd73(0x1a9)],_0x146852[_0x1ddd73(0x1aa)],_0x1ddd73(0x1b9)),_0x21b48f=_0x5be366['str'](_0x1ddd73(0x1bb)),_0x2056e3=_0x10329f[_0x1ddd73(0x1c2)][_0x21b48f];if(!_0x2056e3)throw CliErrors['validation'](_0x1ddd73(0x1c6)+_0x21b48f+'\x22.');return{'method':_0x1ddd73(0x1c1),'url':_0x1ddd73(0x1ad),'body':{'sqlCode':_0x21b48f,'id':_0x2056e3[_0x1ddd73(0x1c0)],'localPath':resolveLocalSqlFilePath(_0x146852,_0x21b48f,_0x2056e3)},'description':_0x1ddd73(0x1af)+_0x21b48f+_0x1ddd73(0x1b4)+_0x146852['trashDir']};},async 'execute'(_0x5ef9a6){const _0x13234f=a232_0x296974,_0x57cecd=loadSqlProjectConfig(_0x5ef9a6['appCode']),_0x51fdd7=await readSqlLockFile(_0x57cecd[_0x13234f(0x1c4)]);if(!_0x51fdd7)throw CliErrors[_0x13234f(0x1be)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x3f9645,appLock:_0x209b1a}=ensureSqlLockScope(_0x51fdd7,_0x5ef9a6[_0x13234f(0x1a9)],_0x57cecd['sqlRoot'],_0x13234f(0x1b9)),_0x2712a0=_0x5ef9a6[_0x13234f(0x1bd)]('sqlcode'),_0x3fd67c=_0x209b1a[_0x13234f(0x1c2)][_0x2712a0];if(!_0x3fd67c)throw CliErrors[_0x13234f(0x1be)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x2712a0+'\x22.');await deleteSqlQuery({'id':_0x3fd67c[_0x13234f(0x1c0)],'sqlCode':_0x2712a0}),_0x209b1a[_0x13234f(0x1c2)]=Object[_0x13234f(0x1ac)](Object[_0x13234f(0x1a8)](_0x209b1a[_0x13234f(0x1c2)])[_0x13234f(0x1b5)](([_0x324378])=>_0x324378!==_0x2712a0)),_0x209b1a['lastSync']=new Date()[_0x13234f(0x1ba)](),await writeSqlLockFile(_0x57cecd[_0x13234f(0x1c4)],_0x3f9645);const _0x5c80da=resolveLocalSqlFilePath(_0x57cecd,_0x2712a0,_0x3fd67c);let _0x855015;await fileExists(_0x5c80da)&&(_0x855015=await moveToTrash(_0x57cecd['projectRoot'],_0x57cecd[_0x13234f(0x1b6)],_0x5c80da),await cleanupEmptyDirectories(dirname(_0x5c80da),_0x57cecd[_0x13234f(0x1b8)]));const _0x544a16={'deleted':_0x2712a0,'remoteId':_0x3fd67c[_0x13234f(0x1c0)]};if(_0x855015)_0x544a16['trashedTo']=_0x855015;return{'ok':!![],'data':_0x544a16,'message':_0x13234f(0x1c7)+_0x2712a0+(_0x855015?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function a232_0x3132(){const _0x301079=['SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','5RhGFNF','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','filter','trashDir','628424MkGCEs','sqlRootDir','delete','toISOString','sqlcode','209mfXUTt','str','validation','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','remoteId','POST','sqls','21OjmmuF','lockFilePath','186361FmiNZN','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','Deleted\x20','1648048deerXo','366tEvZSU','length','sql','entries','appCode','sqlRoot','92484DuDsYP','fromEntries','/smartapi/custom/deleteUserCustomSql','6834717ATEoAS','Would\x20delete\x20SQL\x20','104920nsbOhn','147950iiivnS'];a232_0x3132=function(){return _0x301079;};return a232_0x3132();}async function moveToTrash(_0x39ed15,_0x184f1f,_0x100c97){const _0x356882=a232_0x296974,_0x41208e=new Date()[_0x356882(0x1ba)]()['replace'](/[:.]/g,'-'),_0x3a7d98=relative(_0x39ed15,_0x100c97),_0x2bd918=join(_0x184f1f,_0x41208e,_0x3a7d98);return await mkdir(dirname(_0x2bd918),{'recursive':!![]}),await rename(_0x100c97,_0x2bd918),_0x2bd918;}async function cleanupEmptyDirectories(_0x5989de,_0x48eb09){const _0x55162f=a232_0x296974;let _0x233618=resolve(_0x5989de);const _0x475c39=resolve(_0x48eb09);while(_0x233618['startsWith'](''+_0x475c39+sep)||_0x233618===_0x475c39){if(_0x233618===_0x475c39)return;try{const _0x11acdc=await readdir(_0x233618);if(_0x11acdc[_0x55162f(0x1a6)]>0x0)return;await rmdir(_0x233618);}catch{return;}_0x233618=dirname(_0x233618);}}
1
+ function a237_0x26a8(){const _0x280d26=['lastSync','trashDir','projectRoot','length','validation','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','145355iWMJia','9148QLAGJs','466713ktlNwu','replace','remoteId','5019212YsLCtH','high-risk-write','toISOString','SQL\x20lock\x20file\x20not\x20found.','997780hbkVcD','2569084qCReUe','sqls','94LXppdu','appCode','sql','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','delete','lockFilePath','1210539HCHNsI','sqlRoot','102aGQKer','sqlRootDir','sqlcode','/smartapi/custom/deleteUserCustomSql','POST','40ockWbz','entries','trashedTo','Deleted\x20','fromEntries','110MmvtNb','\x20(local\x20file\x20moved\x20to\x20trash)','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'];a237_0x26a8=function(){return _0x280d26;};return a237_0x26a8();}const a237_0x53d290=a237_0x28a9;(function(_0x24de0e,_0x36da60){const _0x115cb0=a237_0x28a9,_0x5d68f8=_0x24de0e();while(!![]){try{const _0x1e4031=-parseInt(_0x115cb0(0x138))/0x1*(-parseInt(_0x115cb0(0x143))/0x2)+-parseInt(_0x115cb0(0x122))/0x3+-parseInt(_0x115cb0(0x141))/0x4+parseInt(_0x115cb0(0x137))/0x5*(parseInt(_0x115cb0(0x124))/0x6)+parseInt(_0x115cb0(0x140))/0x7*(parseInt(_0x115cb0(0x129))/0x8)+-parseInt(_0x115cb0(0x139))/0x9*(parseInt(_0x115cb0(0x12e))/0xa)+parseInt(_0x115cb0(0x13c))/0xb;if(_0x1e4031===_0x36da60)break;else _0x5d68f8['push'](_0x5d68f8['shift']());}catch(_0x40fe4d){_0x5d68f8['push'](_0x5d68f8['shift']());}}}(a237_0x26a8,0x74710));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a237_0x28a9(_0x40d4d3,_0x1ccb7a){_0x40d4d3=_0x40d4d3-0x122;const _0x26a87b=a237_0x26a8();let _0x28a932=_0x26a87b[_0x40d4d3];return _0x28a932;}import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a237_0x53d290(0x145),'command':a237_0x53d290(0x147),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a237_0x53d290(0x13d),'flags':[SQLCODE_FLAG],async 'validate'(_0x32009c){const _0xef56a2=a237_0x53d290,_0x56d529=loadSqlProjectConfig(_0x32009c[_0xef56a2(0x144)]),_0x2fb808=await readSqlLockFile(_0x56d529['lockFilePath']);if(!_0x2fb808)throw CliErrors[_0xef56a2(0x135)](_0xef56a2(0x146));},async 'dryRun'(_0x3c8069){const _0x101aa6=a237_0x53d290,_0x179203=loadSqlProjectConfig(_0x3c8069[_0x101aa6(0x144)]),_0x2a1395=await readSqlLockFile(_0x179203['lockFilePath']);if(!_0x2a1395)throw CliErrors['validation'](_0x101aa6(0x146));const {appLock:_0x4812e}=ensureSqlLockScope(_0x2a1395,_0x3c8069[_0x101aa6(0x144)],_0x179203[_0x101aa6(0x123)],_0x101aa6(0x147)),_0x4778e8=_0x3c8069['str'](_0x101aa6(0x126)),_0x57ef0f=_0x4812e[_0x101aa6(0x142)][_0x4778e8];if(!_0x57ef0f)throw CliErrors[_0x101aa6(0x135)](_0x101aa6(0x136)+_0x4778e8+'\x22.');return{'method':_0x101aa6(0x128),'url':_0x101aa6(0x127),'body':{'sqlCode':_0x4778e8,'id':_0x57ef0f['remoteId'],'localPath':resolveLocalSqlFilePath(_0x179203,_0x4778e8,_0x57ef0f)},'description':'Would\x20delete\x20SQL\x20'+_0x4778e8+_0x101aa6(0x130)+_0x179203[_0x101aa6(0x132)]};},async 'execute'(_0x3bbc48){const _0x3d83c5=a237_0x53d290,_0x5a516a=loadSqlProjectConfig(_0x3bbc48[_0x3d83c5(0x144)]),_0x4675a8=await readSqlLockFile(_0x5a516a['lockFilePath']);if(!_0x4675a8)throw CliErrors['validation'](_0x3d83c5(0x13f));const {lockData:_0x47e3ba,appLock:_0x2e3650}=ensureSqlLockScope(_0x4675a8,_0x3bbc48['appCode'],_0x5a516a[_0x3d83c5(0x123)],_0x3d83c5(0x147)),_0x35b23b=_0x3bbc48['str'](_0x3d83c5(0x126)),_0x27e31e=_0x2e3650[_0x3d83c5(0x142)][_0x35b23b];if(!_0x27e31e)throw CliErrors['validation']('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x35b23b+'\x22.');await deleteSqlQuery({'id':_0x27e31e[_0x3d83c5(0x13b)],'sqlCode':_0x35b23b}),_0x2e3650['sqls']=Object[_0x3d83c5(0x12d)](Object[_0x3d83c5(0x12a)](_0x2e3650['sqls'])['filter'](([_0xb0b447])=>_0xb0b447!==_0x35b23b)),_0x2e3650[_0x3d83c5(0x131)]=new Date()[_0x3d83c5(0x13e)](),await writeSqlLockFile(_0x5a516a[_0x3d83c5(0x148)],_0x47e3ba);const _0x3687af=resolveLocalSqlFilePath(_0x5a516a,_0x35b23b,_0x27e31e);let _0x5da5ae;await fileExists(_0x3687af)&&(_0x5da5ae=await moveToTrash(_0x5a516a[_0x3d83c5(0x133)],_0x5a516a[_0x3d83c5(0x132)],_0x3687af),await cleanupEmptyDirectories(dirname(_0x3687af),_0x5a516a[_0x3d83c5(0x125)]));const _0x371bbd={'deleted':_0x35b23b,'remoteId':_0x27e31e[_0x3d83c5(0x13b)]};if(_0x5da5ae)_0x371bbd[_0x3d83c5(0x12b)]=_0x5da5ae;return{'ok':!![],'data':_0x371bbd,'message':_0x3d83c5(0x12c)+_0x35b23b+(_0x5da5ae?_0x3d83c5(0x12f):'')};}};async function moveToTrash(_0x37ee74,_0x2d570a,_0x31a8a1){const _0x8e82af=a237_0x53d290,_0x329928=new Date()[_0x8e82af(0x13e)]()[_0x8e82af(0x13a)](/[:.]/g,'-'),_0x1acfe9=relative(_0x37ee74,_0x31a8a1),_0x304ab8=join(_0x2d570a,_0x329928,_0x1acfe9);return await mkdir(dirname(_0x304ab8),{'recursive':!![]}),await rename(_0x31a8a1,_0x304ab8),_0x304ab8;}async function cleanupEmptyDirectories(_0x3cd6c0,_0x2e2cdc){const _0x3e8065=a237_0x53d290;let _0x260e8b=resolve(_0x3cd6c0);const _0x2394e3=resolve(_0x2e2cdc);while(_0x260e8b['startsWith'](''+_0x2394e3+sep)||_0x260e8b===_0x2394e3){if(_0x260e8b===_0x2394e3)return;try{const _0xdb796c=await readdir(_0x260e8b);if(_0xdb796c[_0x3e8065(0x134)]>0x0)return;await rmdir(_0x260e8b);}catch{return;}_0x260e8b=dirname(_0x260e8b);}}
@@ -1 +1 @@
1
- const a233_0x1c8b95=a233_0x1e1a;(function(_0x32678d,_0x445107){const _0x1c6fc7=a233_0x1e1a,_0x390524=_0x32678d();while(!![]){try{const _0x4a4406=parseInt(_0x1c6fc7(0x189))/0x1+parseInt(_0x1c6fc7(0x182))/0x2+-parseInt(_0x1c6fc7(0x18f))/0x3*(parseInt(_0x1c6fc7(0x194))/0x4)+-parseInt(_0x1c6fc7(0x185))/0x5+-parseInt(_0x1c6fc7(0x191))/0x6+parseInt(_0x1c6fc7(0x18e))/0x7+parseInt(_0x1c6fc7(0x186))/0x8;if(_0x4a4406===_0x445107)break;else _0x390524['push'](_0x390524['shift']());}catch(_0x2ce2b4){_0x390524['push'](_0x390524['shift']());}}}(a233_0x240d,0x44a93));function a233_0x240d(){const _0x2c2faa=['sqlCode','appCode','260lbYrmk','detail','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','375902YNthDL','sqlContent','dbId','487840tlxsjY','50536MBIxpx','bool','str','494776DaKuLn','sqlName','sql','read','verbose','1411928AMIhFF','21555BTRDEi','boolean','269520yQrTEg'];a233_0x240d=function(){return _0x2c2faa;};return a233_0x240d();}function a233_0x1e1a(_0x523c27,_0x1b51b2){_0x523c27=_0x523c27-0x180;const _0x240d5f=a233_0x240d();let _0x1e1ab3=_0x240d5f[_0x523c27];return _0x1e1ab3;}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a233_0x1c8b95(0x18b),'command':a233_0x1c8b95(0x180),'description':a233_0x1c8b95(0x181),'risk':a233_0x1c8b95(0x18c),'flags':[SQLCODE_FLAG,{'name':a233_0x1c8b95(0x18d),'type':a233_0x1c8b95(0x190),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x52b531){const _0x48ff1a=a233_0x1c8b95,_0x2f347b=await getSqlQueryInfo(_0x52b531[_0x48ff1a(0x193)],_0x52b531[_0x48ff1a(0x188)]('sqlcode')),_0x1295b9=_0x52b531[_0x48ff1a(0x187)](_0x48ff1a(0x18d));if(_0x1295b9)return{'ok':!![],'data':_0x2f347b};const _0x2ece30=_0x2f347b[_0x48ff1a(0x184)]?await getDbName(_0x52b531[_0x48ff1a(0x193)],_0x2f347b['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x2f347b[_0x48ff1a(0x192)],'sqlName':_0x2f347b[_0x48ff1a(0x18a)],'db':_0x2ece30?_0x2ece30+'\x20('+_0x2f347b[_0x48ff1a(0x184)]+')':_0x2f347b[_0x48ff1a(0x184)]??'','description':_0x2f347b['description']??'','sqlContent':_0x2f347b[_0x48ff1a(0x183)]??''}};}};
1
+ const a238_0x19d200=a238_0xd731;function a238_0x180e(){const _0x4ffec3=['57445056rwYXfX','36AmodZp','1590425MEftUk','detail','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','bool','175kZkGmS','appCode','sqlcode','description','9wDhgSx','365865FHLgfN','484341TKilEN','3HKQfrx','2696002zqLKsa','boolean','read','dbId','sqlContent','10912528fSxbPY','sqlCode','sqlName','verbose','180ndTaYs','266082GcRFgP'];a238_0x180e=function(){return _0x4ffec3;};return a238_0x180e();}(function(_0x3d2264,_0x41f56b){const _0x478c30=a238_0xd731,_0x407024=_0x3d2264();while(!![]){try{const _0x1aa7dc=-parseInt(_0x478c30(0x113))/0x1+parseInt(_0x478c30(0x106))/0x2*(-parseInt(_0x478c30(0x105))/0x3)+-parseInt(_0x478c30(0x112))/0x4*(-parseInt(_0x478c30(0x103))/0x5)+-parseInt(_0x478c30(0x110))/0x6*(parseInt(_0x478c30(0x117))/0x7)+parseInt(_0x478c30(0x10b))/0x8*(-parseInt(_0x478c30(0x11b))/0x9)+-parseInt(_0x478c30(0x10f))/0xa*(-parseInt(_0x478c30(0x104))/0xb)+parseInt(_0x478c30(0x111))/0xc;if(_0x1aa7dc===_0x41f56b)break;else _0x407024['push'](_0x407024['shift']());}catch(_0x83ff6){_0x407024['push'](_0x407024['shift']());}}}(a238_0x180e,0xc9e9c));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a238_0xd731(_0x31b2f4,_0x2c1a05){_0x31b2f4=_0x31b2f4-0x103;const _0x180ea3=a238_0x180e();let _0xd73188=_0x180ea3[_0x31b2f4];return _0xd73188;}export const sqlDetail={'service':'sql','command':a238_0x19d200(0x114),'description':a238_0x19d200(0x115),'risk':a238_0x19d200(0x108),'flags':[SQLCODE_FLAG,{'name':a238_0x19d200(0x10e),'type':a238_0x19d200(0x107),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x44b4fa){const _0x3ceb5a=a238_0x19d200,_0x35901b=await getSqlQueryInfo(_0x44b4fa['appCode'],_0x44b4fa['str'](_0x3ceb5a(0x119))),_0x15f5b9=_0x44b4fa[_0x3ceb5a(0x116)](_0x3ceb5a(0x10e));if(_0x15f5b9)return{'ok':!![],'data':_0x35901b};const _0x13cad5=_0x35901b[_0x3ceb5a(0x109)]?await getDbName(_0x44b4fa[_0x3ceb5a(0x118)],_0x35901b[_0x3ceb5a(0x109)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x35901b[_0x3ceb5a(0x10c)],'sqlName':_0x35901b[_0x3ceb5a(0x10d)],'db':_0x13cad5?_0x13cad5+'\x20('+_0x35901b[_0x3ceb5a(0x109)]+')':_0x35901b[_0x3ceb5a(0x109)]??'','description':_0x35901b[_0x3ceb5a(0x11a)]??'','sqlContent':_0x35901b[_0x3ceb5a(0x10a)]??''}};}};