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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/api-group.js +1 -1
  3. package/lib/api/fetch-model-list.js +1 -1
  4. package/lib/api/generate-api-file.js +1 -1
  5. package/lib/api/generate-sdk-config-file.js +1 -1
  6. package/lib/api/legacy-api-file.js +1 -1
  7. package/lib/api/model-registry-file.js +1 -1
  8. package/lib/api/model-registry-scaffold.js +1 -1
  9. package/lib/api/model-source.js +1 -1
  10. package/lib/auth/auth-server-ui.js +1 -1
  11. package/lib/auth/auth-server.js +1 -1
  12. package/lib/auth/constant.js +1 -1
  13. package/lib/auth/get-cookie.js +1 -1
  14. package/lib/auth/get-session-user.js +1 -1
  15. package/lib/auth/is-session-valid.js +1 -1
  16. package/lib/auth/login-success-html.js +1 -1
  17. package/lib/auth/logout.js +1 -1
  18. package/lib/cli-flags.js +1 -1
  19. package/lib/cli.js +1 -1
  20. package/lib/commands/api/generate.js +1 -1
  21. package/lib/commands/api/index.js +1 -1
  22. package/lib/commands/api/list.js +1 -1
  23. package/lib/commands/api/pull.js +1 -1
  24. package/lib/commands/api/shared.js +1 -1
  25. package/lib/commands/app/detail.js +1 -1
  26. package/lib/commands/app/index.js +1 -1
  27. package/lib/commands/app/list.js +1 -1
  28. package/lib/commands/app/members-list.js +1 -1
  29. package/lib/commands/app/remote-directory.js +1 -1
  30. package/lib/commands/app/shared.js +1 -1
  31. package/lib/commands/app-config/delete.js +1 -1
  32. package/lib/commands/app-config/get.js +1 -1
  33. package/lib/commands/app-config/index.js +1 -1
  34. package/lib/commands/app-config/list.js +1 -1
  35. package/lib/commands/app-config/set.js +1 -1
  36. package/lib/commands/app-config/shared.js +1 -1
  37. package/lib/commands/auth/index.js +1 -1
  38. package/lib/commands/bff/create.js +1 -1
  39. package/lib/commands/bff/delete.js +1 -1
  40. package/lib/commands/bff/detail.js +1 -1
  41. package/lib/commands/bff/index.js +1 -1
  42. package/lib/commands/bff/list.js +1 -1
  43. package/lib/commands/bff/logs.js +1 -1
  44. package/lib/commands/bff/pull.js +1 -1
  45. package/lib/commands/bff/push.js +1 -1
  46. package/lib/commands/bff/status.js +1 -1
  47. package/lib/commands/cli-skill/index.js +1 -1
  48. package/lib/commands/cli-update.js +1 -1
  49. package/lib/commands/codegen/index.js +1 -1
  50. package/lib/commands/codegen/sdk.js +1 -1
  51. package/lib/commands/codegen/sql.js +1 -1
  52. package/lib/commands/common/app-registry.js +1 -1
  53. package/lib/commands/common/app-selector.js +1 -1
  54. package/lib/commands/common/async-task.js +1 -1
  55. package/lib/commands/common/dry-run.js +1 -1
  56. package/lib/commands/common/flags.js +1 -1
  57. package/lib/commands/common/local-file.js +1 -1
  58. package/lib/commands/common/validate.js +1 -1
  59. package/lib/commands/config/delete.js +1 -1
  60. package/lib/commands/config/get.js +1 -1
  61. package/lib/commands/config/index.js +1 -1
  62. package/lib/commands/config/init.js +1 -1
  63. package/lib/commands/config/list.js +1 -1
  64. package/lib/commands/config/set.js +1 -1
  65. package/lib/commands/config/shared.js +1 -1
  66. package/lib/commands/dataset/batch-design.js +1 -1
  67. package/lib/commands/dataset/business-group-update.js +1 -1
  68. package/lib/commands/dataset/business-groups.js +1 -1
  69. package/lib/commands/dataset/capability.js +1 -1
  70. package/lib/commands/dataset/cross-relation-create.js +1 -1
  71. package/lib/commands/dataset/cross-relation-delete.js +1 -1
  72. package/lib/commands/dataset/cross-relation-list.js +1 -1
  73. package/lib/commands/dataset/cross-relation-shared.js +1 -1
  74. package/lib/commands/dataset/cross-relation-update.js +1 -1
  75. package/lib/commands/dataset/delete.js +1 -1
  76. package/lib/commands/dataset/design-context.js +1 -1
  77. package/lib/commands/dataset/design-start.js +1 -1
  78. package/lib/commands/dataset/design-status.js +1 -1
  79. package/lib/commands/dataset/design-sync-retry.js +1 -1
  80. package/lib/commands/dataset/design-sync-status.js +1 -1
  81. package/lib/commands/dataset/design-validate.js +1 -1
  82. package/lib/commands/dataset/detail.js +1 -1
  83. package/lib/commands/dataset/extend-update.js +1 -1
  84. package/lib/commands/dataset/field-restore.js +1 -1
  85. package/lib/commands/dataset/field-update.js +1 -1
  86. package/lib/commands/dataset/generate.js +1 -1
  87. package/lib/commands/dataset/index.js +1 -1
  88. package/lib/commands/dataset/list.js +1 -1
  89. package/lib/commands/dataset/operations.js +1 -1
  90. package/lib/commands/dataset/relation-audit.js +1 -1
  91. package/lib/commands/dataset/relation-create.js +1 -1
  92. package/lib/commands/dataset/relation-delete.js +1 -1
  93. package/lib/commands/dataset/relation-shared.js +1 -1
  94. package/lib/commands/dataset/relation-update.js +1 -1
  95. package/lib/commands/dataset/relations.js +1 -1
  96. package/lib/commands/dataset/rename.js +1 -1
  97. package/lib/commands/dataset/restore.js +1 -1
  98. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  99. package/lib/commands/db/analysis-batching.js +1 -1
  100. package/lib/commands/db/analyze-batch-plan.js +1 -1
  101. package/lib/commands/db/analyze-cancel.js +1 -1
  102. package/lib/commands/db/analyze-start.js +1 -1
  103. package/lib/commands/db/analyze-status.js +1 -1
  104. package/lib/commands/db/create.js +1 -1
  105. package/lib/commands/db/cross-db-analysis-shared.js +1 -1
  106. package/lib/commands/db/cross-db-analyze-latest.js +1 -1
  107. package/lib/commands/db/cross-db-analyze-start.js +1 -1
  108. package/lib/commands/db/cross-db-analyze-status.js +1 -1
  109. package/lib/commands/db/delete.js +1 -1
  110. package/lib/commands/db/detail.js +1 -1
  111. package/lib/commands/db/diff-refresh-start.js +1 -1
  112. package/lib/commands/db/diff-refresh-status.js +1 -1
  113. package/lib/commands/db/diff.js +1 -1
  114. package/lib/commands/db/index.js +1 -1
  115. package/lib/commands/db/list.js +1 -1
  116. package/lib/commands/db/shared.js +1 -1
  117. package/lib/commands/db/table-diff-shared.js +1 -1
  118. package/lib/commands/db/tables.js +1 -1
  119. package/lib/commands/db/test.js +1 -1
  120. package/lib/commands/db/update.js +1 -1
  121. package/lib/commands/deployment/index.js +1 -1
  122. package/lib/commands/deployment/sync-all.js +1 -1
  123. package/lib/commands/deployment/sync-jobs.js +1 -1
  124. package/lib/commands/deployment/sync-status.js +1 -1
  125. package/lib/commands/doctor.js +1 -1
  126. package/lib/commands/file/index.js +1 -1
  127. package/lib/commands/flow/create.js +1 -1
  128. package/lib/commands/flow/detail.js +1 -1
  129. package/lib/commands/flow/index.js +1 -1
  130. package/lib/commands/flow/list.js +1 -1
  131. package/lib/commands/flow/page-list.js +1 -1
  132. package/lib/commands/flow/publish.js +1 -1
  133. package/lib/commands/flow/runtime-resources-shared.js +1 -1
  134. package/lib/commands/flow/runtime-role-list.js +1 -1
  135. package/lib/commands/flow/runtime-role-user-list.js +1 -1
  136. package/lib/commands/flow/runtime-user-search.js +1 -1
  137. package/lib/commands/flow/shared.js +1 -1
  138. package/lib/commands/flow/update.js +1 -1
  139. package/lib/commands/flow/validate.js +1 -1
  140. package/lib/commands/instant-api-policy/current.js +1 -1
  141. package/lib/commands/instant-api-policy/index.js +1 -1
  142. package/lib/commands/instant-api-policy/init.js +1 -1
  143. package/lib/commands/instant-api-policy/publish.js +1 -1
  144. package/lib/commands/instant-api-policy/pull.js +1 -1
  145. package/lib/commands/instant-api-policy/revision.js +1 -1
  146. package/lib/commands/instant-api-policy/revisions.js +1 -1
  147. package/lib/commands/instant-api-policy/rollback.js +1 -1
  148. package/lib/commands/instant-api-policy/shared.js +1 -1
  149. package/lib/commands/instant-api-policy/validate.js +1 -1
  150. package/lib/commands/issue/context.js +1 -1
  151. package/lib/commands/issue/index.js +1 -1
  152. package/lib/commands/issue/nudge.js +1 -1
  153. package/lib/commands/issue/report.js +1 -1
  154. package/lib/commands/kb/create.js +1 -1
  155. package/lib/commands/kb/delete.js +1 -1
  156. package/lib/commands/kb/detail.js +1 -1
  157. package/lib/commands/kb/index.js +1 -1
  158. package/lib/commands/kb/list.js +1 -1
  159. package/lib/commands/kb/search.js +1 -1
  160. package/lib/commands/kb/shared.js +1 -1
  161. package/lib/commands/kb/update.js +1 -1
  162. package/lib/commands/logs/index.js +1 -1
  163. package/lib/commands/menu/asset-update.js +1 -1
  164. package/lib/commands/menu/delete.js +1 -1
  165. package/lib/commands/menu/external-link-create.js +1 -1
  166. package/lib/commands/menu/external-link-update.js +1 -1
  167. package/lib/commands/menu/group-create.js +1 -1
  168. package/lib/commands/menu/group-update.js +1 -1
  169. package/lib/commands/menu/index.js +1 -1
  170. package/lib/commands/menu/list.js +1 -1
  171. package/lib/commands/menu/move.js +1 -1
  172. package/lib/commands/menu/regroup-start.js +1 -1
  173. package/lib/commands/menu/rename.js +1 -1
  174. package/lib/commands/menu/shared/compare-table.js +1 -1
  175. package/lib/commands/menu/shared/delete-plan.js +1 -1
  176. package/lib/commands/menu/shared/facts.js +1 -1
  177. package/lib/commands/menu/shared/index.js +1 -1
  178. package/lib/commands/menu/shared/inquirer.js +1 -1
  179. package/lib/commands/menu/shared/local-pages.js +1 -1
  180. package/lib/commands/menu/shared/logic.js +1 -1
  181. package/lib/commands/menu/shared/mutations.js +1 -1
  182. package/lib/commands/menu/shared/path.js +1 -1
  183. package/lib/commands/menu/shared/service.js +1 -1
  184. package/lib/commands/menu/shared/subapp-assets.js +1 -1
  185. package/lib/commands/menu/shared/sync-core.js +1 -1
  186. package/lib/commands/menu/shared/update-core.js +1 -1
  187. package/lib/commands/menu/shared/valid-url.js +1 -1
  188. package/lib/commands/menu/subapp-assets-status.js +1 -1
  189. package/lib/commands/menu/subapp-assets-update.js +1 -1
  190. package/lib/commands/menu/sync.js +1 -1
  191. package/lib/commands/menu/visibility-update.js +1 -1
  192. package/lib/commands/notification/config-create.js +1 -1
  193. package/lib/commands/notification/config-delete.js +1 -1
  194. package/lib/commands/notification/config-list.js +1 -1
  195. package/lib/commands/notification/config-update.js +1 -1
  196. package/lib/commands/notification/index.js +1 -1
  197. package/lib/commands/notification/shared.js +1 -1
  198. package/lib/commands/ocr/index.js +1 -1
  199. package/lib/commands/page/create.js +1 -1
  200. package/lib/commands/page/custom/detail.js +1 -1
  201. package/lib/commands/page/custom/list.js +1 -1
  202. package/lib/commands/page/custom/publish.js +1 -1
  203. package/lib/commands/page/custom/shared.js +1 -1
  204. package/lib/commands/page/custom/syntax.js +1 -1
  205. package/lib/commands/page/custom/update.js +1 -1
  206. package/lib/commands/page/data-list-status.js +1 -1
  207. package/lib/commands/page/generate-start.js +1 -1
  208. package/lib/commands/page/generate-status.js +1 -1
  209. package/lib/commands/page/index.js +1 -1
  210. package/lib/commands/page/pull.js +1 -1
  211. package/lib/commands/page/push.js +1 -1
  212. package/lib/commands/page/relation-audit.js +1 -1
  213. package/lib/commands/page/restore.js +1 -1
  214. package/lib/commands/page/shared.js +1 -1
  215. package/lib/commands/page/sync.js +1 -1
  216. package/lib/commands/project/api-architecture-upgrade.js +1 -1
  217. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  218. package/lib/commands/project/create/format-elapsed.js +1 -1
  219. package/lib/commands/project/create/main.js +1 -1
  220. package/lib/commands/project/create/materialize-project-template.js +1 -1
  221. package/lib/commands/project/create/project-name.js +1 -1
  222. package/lib/commands/project/create/project-template-archive.js +1 -1
  223. package/lib/commands/project/create/project-template-path.js +1 -1
  224. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  225. package/lib/commands/project/create/use-format-code.js +1 -1
  226. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  227. package/lib/commands/project/domain-routing-sync.js +1 -1
  228. package/lib/commands/project/index.js +1 -1
  229. package/lib/commands/project/upgrade.js +1 -1
  230. package/lib/commands/registry.js +1 -1
  231. package/lib/commands/role/delete.js +1 -1
  232. package/lib/commands/role/detail.js +1 -1
  233. package/lib/commands/role/index.js +1 -1
  234. package/lib/commands/role/list.js +1 -1
  235. package/lib/commands/role/shared.js +1 -1
  236. package/lib/commands/role/update.js +1 -1
  237. package/lib/commands/role/user-add.js +1 -1
  238. package/lib/commands/role/user-remove.js +1 -1
  239. package/lib/commands/role/user-resolve.js +1 -1
  240. package/lib/commands/rule/get.js +1 -1
  241. package/lib/commands/rule/index.js +1 -1
  242. package/lib/commands/rule/list.js +1 -1
  243. package/lib/commands/rule/set.js +1 -1
  244. package/lib/commands/rule/shared.js +1 -1
  245. package/lib/commands/run/index.js +1 -1
  246. package/lib/commands/schema.js +1 -1
  247. package/lib/commands/sql/create.js +1 -1
  248. package/lib/commands/sql/delete.js +1 -1
  249. package/lib/commands/sql/detail.js +1 -1
  250. package/lib/commands/sql/exec.js +1 -1
  251. package/lib/commands/sql/index.js +1 -1
  252. package/lib/commands/sql/list.js +1 -1
  253. package/lib/commands/sql/pull.js +1 -1
  254. package/lib/commands/sql/push.js +1 -1
  255. package/lib/commands/sql/shared.js +1 -1
  256. package/lib/commands/sql/status.js +1 -1
  257. package/lib/commands/sql/validate.js +1 -1
  258. package/lib/commands/task/index.js +1 -1
  259. package/lib/commands/task/status.js +1 -1
  260. package/lib/commands/tenant/index.js +1 -1
  261. package/lib/commands/tenant/members-list.js +1 -1
  262. package/lib/commands/tenant/shared.js +1 -1
  263. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  264. package/lib/commands/user-account/feishu-bind.js +1 -1
  265. package/lib/commands/user-account/index.js +1 -1
  266. package/lib/commands/workspace/add.js +1 -1
  267. package/lib/commands/workspace/index.js +1 -1
  268. package/lib/commands/workspace/remove.js +1 -1
  269. package/lib/config/domain-config.js +1 -1
  270. package/lib/config/project-domain-routing.js +1 -1
  271. package/lib/config/region-config.js +1 -1
  272. package/lib/config/schema.js +1 -1
  273. package/lib/constant/cdn.js +1 -1
  274. package/lib/constant/cli.js +1 -1
  275. package/lib/constant/defaults.js +1 -1
  276. package/lib/constant/domain.js +1 -1
  277. package/lib/constant/env.js +1 -1
  278. package/lib/constant/output.js +1 -1
  279. package/lib/constant/paths.js +1 -1
  280. package/lib/constant/region.js +1 -1
  281. package/lib/constant/risk.js +1 -1
  282. package/lib/constant/routing-profile.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.js +1 -1
  289. package/lib/core/bff/config.js +1 -1
  290. package/lib/core/bff/file-system.js +1 -1
  291. package/lib/core/bff/hash.js +1 -1
  292. package/lib/core/bff/hook-directory.js +1 -1
  293. package/lib/core/bff/lock.js +1 -1
  294. package/lib/core/bff/utils.js +1 -1
  295. package/lib/core/cross-db-analysis.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/instant-api-policy/endpoints.js +1 -1
  301. package/lib/core/kb-management-client.js +1 -1
  302. package/lib/core/kb-search-client.js +1 -1
  303. package/lib/core/page/file-system.js +1 -1
  304. package/lib/core/page/hash.js +1 -1
  305. package/lib/core/page/lock.js +1 -1
  306. package/lib/core/page/lr-smart-jsx.js +1 -1
  307. package/lib/core/sql-index-auditor.js +1 -1
  308. package/lib/core/sql-sync/config.js +1 -1
  309. package/lib/core/sql-sync/file-system.js +1 -1
  310. package/lib/core/sql-sync/hash.js +1 -1
  311. package/lib/core/sql-sync/lock.js +1 -1
  312. package/lib/core/sql-sync/utils.js +1 -1
  313. package/lib/core/sql-validator.js +1 -1
  314. package/lib/errors.js +1 -1
  315. package/lib/framework/build-all-flags.js +1 -1
  316. package/lib/framework/error-output.js +1 -1
  317. package/lib/framework/explicit-yes.js +1 -1
  318. package/lib/framework/flags.js +1 -1
  319. package/lib/framework/help.js +1 -1
  320. package/lib/framework/index.js +1 -1
  321. package/lib/framework/output.js +1 -1
  322. package/lib/framework/response.js +1 -1
  323. package/lib/framework/runner-alias.js +1 -1
  324. package/lib/framework/runner.js +1 -1
  325. package/lib/framework/schema-export.js +1 -1
  326. package/lib/framework/supported-flags.js +1 -1
  327. package/lib/framework/types.js +1 -1
  328. package/lib/generated/build-info.d.ts +4 -4
  329. package/lib/generated/build-info.js +1 -1
  330. package/lib/generated/official-routing.js +1 -1
  331. package/lib/generated/routing-contract.js +1 -1
  332. package/lib/help.js +1 -1
  333. package/lib/postinstall.js +1 -1
  334. package/lib/runtime/confirmation.js +1 -1
  335. package/lib/runtime/event.js +1 -1
  336. package/lib/runtime/index.js +1 -1
  337. package/lib/runtime/queue.js +1 -1
  338. package/lib/runtime/resolve.js +1 -1
  339. package/lib/services/dataset-design/checkpoint.js +1 -1
  340. package/lib/services/dataset-design/commands.js +1 -1
  341. package/lib/services/dataset-design/contract.js +1 -1
  342. package/lib/skills/builtin-skill.js +1 -1
  343. package/lib/skills/main.js +1 -1
  344. package/lib/skills/npx-skills-add.js +1 -1
  345. package/lib/skills/skill-presence.js +1 -1
  346. package/lib/telemetry/cli-command-trace.js +1 -1
  347. package/lib/telemetry/cli-help-trace.js +1 -1
  348. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  349. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  350. package/lib/telemetry/send-cli-trace-log.js +1 -1
  351. package/lib/utils/ai_config.js +1 -1
  352. package/lib/utils/apply-jq-filter.js +1 -1
  353. package/lib/utils/cdn-config.js +1 -1
  354. package/lib/utils/check-sdk-version.js +1 -1
  355. package/lib/utils/cli-version-check.js +1 -1
  356. package/lib/utils/cli-version-policy.js +1 -1
  357. package/lib/utils/config.js +1 -1
  358. package/lib/utils/entity-with-id.js +1 -1
  359. package/lib/utils/file-utils.js +1 -1
  360. package/lib/utils/guides-cdn.js +1 -1
  361. package/lib/utils/http-client.js +1 -1
  362. package/lib/utils/is-non-interactive.js +1 -1
  363. package/lib/utils/logger.js +1 -1
  364. package/lib/utils/params.js +1 -1
  365. package/lib/utils/platform.js +1 -1
  366. package/lib/utils/sleep.js +1 -1
  367. package/lib/utils/template-replacer.js +1 -1
  368. package/lib/utils/update-notice.js +1 -1
  369. package/lib/utils/version.js +1 -1
  370. package/lib/utils/with-active-cookie.js +1 -1
  371. package/lib/utils/write-cli-side-channel.js +1 -1
  372. package/package.json +1 -1
  373. package/skills/rabetbase/SKILL.md +1 -1
  374. package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
  375. package/skills/rabetbase-page-generation/SKILL.md +1 -1
  376. package/skills/rabetbase.manifest.json +3 -3
@@ -1 +1 @@
1
- const a235_0x4704d6=a235_0x1601;(function(_0x52491c,_0x1320c8){const _0x10df1f=a235_0x1601,_0x1f4d4f=_0x52491c();while(!![]){try{const _0x5340bd=-parseInt(_0x10df1f(0x168))/0x1*(parseInt(_0x10df1f(0x188))/0x2)+parseInt(_0x10df1f(0x14e))/0x3+parseInt(_0x10df1f(0x17d))/0x4*(-parseInt(_0x10df1f(0x13b))/0x5)+parseInt(_0x10df1f(0x13d))/0x6+-parseInt(_0x10df1f(0x179))/0x7*(-parseInt(_0x10df1f(0x145))/0x8)+parseInt(_0x10df1f(0x14c))/0x9+parseInt(_0x10df1f(0x173))/0xa;if(_0x5340bd===_0x1320c8)break;else _0x1f4d4f['push'](_0x1f4d4f['shift']());}catch(_0x373e1d){_0x1f4d4f['push'](_0x1f4d4f['shift']());}}}(a235_0xea02,0x378dc));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':a235_0x4704d6(0x15b),'required':!![],'description':a235_0x4704d6(0x164)};export const ROLE_REF_FLAG={'name':'role','type':a235_0x4704d6(0x17f),'required':!![],'description':a235_0x4704d6(0x14f)};export const USER_REF_FLAG={'name':a235_0x4704d6(0x153),'type':'string','required':!![],'description':a235_0x4704d6(0x182)};export const NAME_FLAG={'name':a235_0x4704d6(0x185),'type':a235_0x4704d6(0x17f),'required':!![],'description':a235_0x4704d6(0x15e)};export const USER_NAME_FLAG={'name':a235_0x4704d6(0x185),'type':a235_0x4704d6(0x17f),'required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':a235_0x4704d6(0x141),'type':a235_0x4704d6(0x17f),'required':![],'description':a235_0x4704d6(0x140)};export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a235_0x4704d6(0x15b),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=[a235_0x4704d6(0x181),a235_0x4704d6(0x169),a235_0x4704d6(0x15a)];export function isBuiltinRole(_0x2ed7ec){const _0x1256b1=a235_0x4704d6;return BUILTIN_ROLE_TYPES[_0x1256b1(0x13c)](_0x2ed7ec);}export function assertCustomRole(_0x1a0f65,_0x527a24){const _0x2b5fa3=a235_0x4704d6;if(_0x1a0f65['roleType']!==_0x2b5fa3(0x155))throw CliErrors[_0x2b5fa3(0x171)](_0x2b5fa3(0x158)+_0x527a24+_0x2b5fa3(0x160)+_0x1a0f65['roleName']+'\x20('+_0x1a0f65[_0x2b5fa3(0x152)]+').','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.');}export function projectRole(_0x42205f){const _0x42957f=a235_0x4704d6;return{'id':_0x42205f['id'],'roleName':_0x42205f[_0x42957f(0x146)],'roleType':_0x42205f['roleType'],'remark':_0x42205f['remark'],'userCount':_0x42205f[_0x42957f(0x142)],'permitCount':_0x42205f['permitCount'],'builtin':isBuiltinRole(_0x42205f['roleType'])};}export async function resolveRoleRef(_0x1d26de,_0x3c2770){const _0x254879=a235_0x4704d6,_0x13bc8b=_0x3c2770[_0x254879(0x170)]();if(!_0x13bc8b)throw CliErrors[_0x254879(0x171)](_0x254879(0x167),'Pass\x20--role\x20<id|name>.');if(/^\d+$/['test'](_0x13bc8b))return getRoleById(_0x1d26de,Number(_0x13bc8b));const _0x31be14=await listAllAppRoles(_0x1d26de),_0x1e5ddf=_0x31be14['filter'](_0x415245=>_0x415245[_0x254879(0x146)]===_0x13bc8b);if(_0x1e5ddf[_0x254879(0x13e)]===0x0)throw CliErrors[_0x254879(0x171)](_0x254879(0x144)+_0x13bc8b+'\x22\x20not\x20found\x20in\x20app\x20'+_0x1d26de+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.');if(_0x1e5ddf[_0x254879(0x13e)]>0x1){const _0x3fa095=_0x1e5ddf[_0x254879(0x138)](_0x278122=>_0x278122['id'])[_0x254879(0x183)](',\x20');throw CliErrors[_0x254879(0x171)]('Role\x20name\x20\x22'+_0x13bc8b+_0x254879(0x17a)+_0x3fa095+').',_0x254879(0x14d));}return _0x1e5ddf[0x0];}export async function getRoleById(_0x30c368,_0x444f71){const _0x3ab03b=a235_0x4704d6,_0x22a0d0=await listAllAppRoles(_0x30c368),_0xce9043=_0x22a0d0[_0x3ab03b(0x151)](_0x3ce0cb=>_0x3ce0cb['id']===_0x444f71&&(!_0x3ce0cb[_0x3ab03b(0x178)]||_0x3ce0cb['appCode']===_0x30c368));if(_0xce9043[_0x3ab03b(0x13e)]!==0x1)throw CliErrors[_0x3ab03b(0x171)](_0x3ab03b(0x17c)+_0x444f71+_0x3ab03b(0x175)+_0x30c368+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');return _0xce9043[0x0];}async function listAllAppRoles(_0x103ef4){const _0x2d7fa6=a235_0x4704d6,_0x31cc35=0x64,_0x10297c=[];for(let _0x2cb0d0=0x1;;_0x2cb0d0+=0x1){const {items:_0xebdba4,paging:_0xc791fb}=await listAppRoles(_0x103ef4,{'currentPage':_0x2cb0d0,'pageSize':_0x31cc35});_0x10297c['push'](..._0xebdba4);if(_0xebdba4[_0x2d7fa6(0x13e)]<_0x31cc35||_0xc791fb&&_0x10297c['length']>=_0xc791fb['totalCount'])return _0x10297c;}}export async function resolveTenantCode(){const _0x48b6f2=a235_0x4704d6,_0x4d688a=await getSessionUserInfo(),_0x598fc7=_0x4d688a?.['user']?.[_0x48b6f2(0x147)]?.[_0x48b6f2(0x15c)];if(!_0x598fc7)throw CliErrors[_0x48b6f2(0x16f)](_0x48b6f2(0x174));return _0x598fc7;}function matchMember(_0xc52cac,_0x47afbd){const _0x37ec97=a235_0x4704d6,_0x5585b6=_0x47afbd[_0x37ec97(0x170)]()[_0x37ec97(0x14b)]();return(_0xc52cac[_0x37ec97(0x186)]??'')[_0x37ec97(0x14b)]()===_0x5585b6||(_0xc52cac[_0x37ec97(0x166)]??'')[_0x37ec97(0x14b)]()===_0x5585b6;}export async function resolveUserRef(_0x3232a7,_0x49773d=a235_0x4704d6(0x17e)){const _0x1ced8b=a235_0x4704d6,_0x450de8=_0x3232a7['trim']();if(!_0x450de8)throw CliErrors[_0x1ced8b(0x171)](_0x1ced8b(0x184),_0x1ced8b(0x157));const _0x4a1aa2=await resolveTenantCode(),_0x3a7898=await getTenantMembers(_0x4a1aa2);if(/^\d+$/[_0x1ced8b(0x139)](_0x450de8)){const _0x3a0772=Number(_0x450de8),_0x5e9712=_0x3a7898[_0x1ced8b(0x16d)](_0xc5469d=>_0xc5469d[_0x1ced8b(0x162)]===_0x3a0772);return{'userId':_0x3a0772,'username':_0x5e9712?.[_0x1ced8b(0x166)]??String(_0x3a0772),'nickname':_0x5e9712?.[_0x1ced8b(0x186)],'matchedBy':'id'};}const _0x422e38=_0x3a7898[_0x1ced8b(0x151)](_0x315434=>matchMember(_0x315434,_0x450de8));if(_0x422e38['length']===0x0)throw CliErrors[_0x1ced8b(0x171)](_0x1ced8b(0x154)+_0x450de8+'\x22.','Check\x20the\x20nickname/username.\x20'+_0x49773d);if(_0x422e38[_0x1ced8b(0x13e)]>0x1){const _0x215f8e=_0x422e38[_0x1ced8b(0x138)](_0x1525b5=>(_0x1525b5['nickname']??_0x1525b5[_0x1ced8b(0x166)]??'?')+'('+_0x1525b5['userId']+')')['join'](',\x20');throw CliErrors[_0x1ced8b(0x171)](_0x1ced8b(0x180)+_0x450de8+'\x22:\x20'+_0x215f8e+'.',_0x49773d);}const _0x8c0a6=_0x422e38[0x0];return{'userId':_0x8c0a6[_0x1ced8b(0x162)],'username':_0x8c0a6[_0x1ced8b(0x166)]??String(_0x8c0a6['userId']),'nickname':_0x8c0a6[_0x1ced8b(0x186)],'matchedBy':_0x1ced8b(0x185)};}export const CREATE_USER_ROLE_PATH=a235_0x4704d6(0x187);export const DELETE_USER_ROLE_PATH=a235_0x4704d6(0x149);export function computeRoleUserMutation(_0x7ebbdc){const _0x55b616=a235_0x4704d6,{operation:_0x48cbf7,appCode:_0x222114,role:_0x23bbdb,relations:_0x4a74eb,user:_0x2802fd}=_0x7ebbdc,_0x20a675=[...new Set(_0x4a74eb['map'](_0x57b7b6=>_0x57b7b6[_0x55b616(0x162)]))],_0x3e393c=[];if(_0x7ebbdc['expectUserCount']!==undefined&&_0x7ebbdc[_0x55b616(0x177)]!==_0x20a675[_0x55b616(0x13e)])throw CliErrors['validation'](_0x55b616(0x148)+_0x7ebbdc['expectUserCount']+_0x55b616(0x161)+_0x20a675[_0x55b616(0x13e)]+'.',_0x55b616(0x159));const _0x1ee467=_0x20a675[_0x55b616(0x13c)](_0x2802fd[_0x55b616(0x162)]),_0x4103e8=_0x4a74eb[_0x55b616(0x151)](_0x488c75=>_0x488c75[_0x55b616(0x162)]===_0x2802fd[_0x55b616(0x162)])[_0x55b616(0x138)](_0x406ce9=>_0x406ce9['id']),_0x48c782=_0x48cbf7==='user-add'?!_0x1ee467:_0x1ee467;let _0x16f70f=_0x20a675;_0x48cbf7==='user-add'?_0x1ee467?_0x3e393c[_0x55b616(0x176)](_0x55b616(0x163)+_0x2802fd[_0x55b616(0x162)]+'\x20is\x20already\x20a\x20member\x20of\x20role\x20'+_0x23bbdb['roleName']+';\x20no\x20change.'):_0x16f70f=[..._0x20a675,_0x2802fd[_0x55b616(0x162)]]:!_0x1ee467?_0x3e393c[_0x55b616(0x176)](_0x55b616(0x163)+_0x2802fd['userId']+_0x55b616(0x165)+_0x23bbdb['roleName']+_0x55b616(0x17b)):(_0x16f70f=_0x20a675[_0x55b616(0x151)](_0x19ff70=>_0x19ff70!==_0x2802fd[_0x55b616(0x162)]),_0x4103e8[_0x55b616(0x13e)]>0x1&&_0x3e393c[_0x55b616(0x176)](_0x55b616(0x16e)+_0x4103e8[_0x55b616(0x13e)]+_0x55b616(0x13a)+_0x2802fd[_0x55b616(0x162)]+'.'));const _0x340805={'scope':_0x55b616(0x15d),'operation':_0x48cbf7,'selector':{'appCode':_0x222114,'roleId':_0x23bbdb['id'],'roleName':_0x23bbdb[_0x55b616(0x146)],'userId':_0x2802fd[_0x55b616(0x162)]},'before':{'userIds':_0x20a675},'after':{'userIds':_0x16f70f},'dryRun':_0x7ebbdc[_0x55b616(0x143)],'backend':{'method':_0x55b616(0x13f),'path':_0x48cbf7==='user-add'?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x3e393c};return{'mutation':_0x340805,'changed':_0x48c782,'matchingRelationIds':_0x4103e8};}export async function loadDevRoleRelations(_0x921e68,_0x29f61a){const _0x59ff33=a235_0x4704d6,_0x4442f4=0x64,_0x25bd0d=[];for(let _0x3eaa99=0x1;;_0x3eaa99+=0x1){const {items:_0x5e444c,paging:_0x4f0910}=await listDevUserRoleRelations(_0x921e68,{'roleId':_0x29f61a,'currentPage':_0x3eaa99,'pageSize':_0x4442f4});_0x25bd0d['push'](..._0x5e444c);if(_0x5e444c[_0x59ff33(0x13e)]<_0x4442f4||_0x4f0910&&_0x25bd0d[_0x59ff33(0x13e)]>=_0x4f0910[_0x59ff33(0x172)])return _0x25bd0d;}}function a235_0xea02(){const _0x513f97=['Removed\x20','authRequired','trim','validation','totalCount','753370NWfTgR','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','\x20not\x20found\x20in\x20app\x20','push','expectUserCount','appCode','91126CMMgbz','\x22\x20is\x20ambiguous\x20(ids:\x20',';\x20no\x20change.','Role\x20id\x20','3372FZyCnl','Pass\x20--user\x20<id>.','string','Multiple\x20tenant\x20members\x20match\x20\x22','ADMIN','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','join','Missing\x20user\x20reference.','name','nickname','/smartapi/permit/user-role/create','5962SAEDPB','Pass\x20--role\x20<id|name>.','map','test','\x20duplicate\x20memberships\x20for\x20user\x20','2515saRrxj','includes','796254WLBWLS','length','POST','Optional\x20role\x20remark/description','remark','userCount','dryRun','Role\x20name\x20\x22','112PFLZPT','roleName','tenant','Anti-drift\x20check\x20failed:\x20expected\x20','/smartapi/permit/user-role/delete','\x20members\x20of\x20the\x20OWNER\x20role.','toLowerCase','400311hlpbUe','Disambiguate\x20with\x20--role\x20<id>.','1258524axUfIW','Role\x20id\x20or\x20exact\x20role\x20name','flag','filter','roleType','user','No\x20tenant\x20member\x20matches\x20\x22','CUSTOM','role','Pass\x20--user\x20<id|name>.','Cannot\x20','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','OWNER','number','tenant_code','dev','Role\x20name','flagMissing','\x20built-in\x20role\x20','\x20member(s)\x20but\x20role\x20has\x20','userId','User\x20','Role\x20id\x20(from\x20`role\x20list`)','\x20is\x20not\x20a\x20member\x20of\x20role\x20','username','Missing\x20role\x20reference.','68buiPAL','DEV','expect-user-count','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','str','find'];a235_0xea02=function(){return _0x513f97;};return a235_0xea02();}export function readRoleRef(_0x1022aa){const _0x151602=a235_0x4704d6,_0x751e4d=_0x1022aa['str'](_0x151602(0x156))[_0x151602(0x170)]();if(!_0x751e4d)throw CliErrors[_0x151602(0x15f)](_0x151602(0x156),_0x151602(0x189));return _0x751e4d;}function a235_0x1601(_0x5206d4,_0x5abf7e){_0x5206d4=_0x5206d4-0x138;const _0xea0229=a235_0xea02();let _0x1601dc=_0xea0229[_0x5206d4];return _0x1601dc;}export async function prepareUserMutation(_0x33d5d3,_0x59515b,_0x414906){const _0x4cd48e=a235_0x4704d6,_0x202088=readRoleRef(_0x33d5d3),_0x5b2632=_0x33d5d3[_0x4cd48e(0x16c)](_0x4cd48e(0x153))[_0x4cd48e(0x170)]();if(!_0x5b2632)throw CliErrors[_0x4cd48e(0x15f)](_0x4cd48e(0x153),_0x4cd48e(0x157));const _0x2f38cb=_0x33d5d3[_0x4cd48e(0x150)](_0x4cd48e(0x16a)),_0x537d5f=_0x2f38cb===undefined||_0x2f38cb===null?undefined:Number(_0x2f38cb),_0xedb88b=await resolveRoleRef(_0x33d5d3[_0x4cd48e(0x178)],_0x202088);if(_0xedb88b[_0x4cd48e(0x152)]==='OWNER')throw CliErrors[_0x4cd48e(0x171)](_0x4cd48e(0x158)+_0x59515b+_0x4cd48e(0x14a),_0x4cd48e(0x16b));const _0x3c4c4b=await resolveUserRef(_0x5b2632),_0x29c8d8=await loadDevRoleRelations(_0x33d5d3[_0x4cd48e(0x178)],_0xedb88b['id']);return{...computeRoleUserMutation({'operation':_0x59515b,'appCode':_0x33d5d3['appCode'],'role':_0xedb88b,'relations':_0x29c8d8,'user':{'userId':_0x3c4c4b['userId'],'username':_0x3c4c4b[_0x4cd48e(0x166)],'nickname':_0x3c4c4b['nickname']},'dryRun':_0x414906,..._0x537d5f!==undefined?{'expectUserCount':_0x537d5f}:{}}),'role':_0xedb88b,'user':_0x3c4c4b};}
1
+ const a235_0x1f828e=a235_0x5389;(function(_0x248671,_0x4c890a){const _0xf10414=a235_0x5389,_0x25f5c2=_0x248671();while(!![]){try{const _0x3ea8fe=parseInt(_0xf10414(0x121))/0x1*(-parseInt(_0xf10414(0xe1))/0x2)+parseInt(_0xf10414(0xe0))/0x3*(parseInt(_0xf10414(0xeb))/0x4)+parseInt(_0xf10414(0xf6))/0x5+parseInt(_0xf10414(0xf0))/0x6*(parseInt(_0xf10414(0x107))/0x7)+-parseInt(_0xf10414(0xdb))/0x8*(parseInt(_0xf10414(0x119))/0x9)+-parseInt(_0xf10414(0x11c))/0xa*(-parseInt(_0xf10414(0xe2))/0xb)+-parseInt(_0xf10414(0xf7))/0xc;if(_0x3ea8fe===_0x4c890a)break;else _0x25f5c2['push'](_0x25f5c2['shift']());}catch(_0x5a2bc5){_0x25f5c2['push'](_0x25f5c2['shift']());}}}(a235_0x1673,0x5f37d));function a235_0x5389(_0x2b0605,_0x1ac3cb){_0x2b0605=_0x2b0605-0xda;const _0x167315=a235_0x1673();let _0x5389cf=_0x167315[_0x2b0605];return _0x5389cf;}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':a235_0x1f828e(0xf5),'required':!![],'description':a235_0x1f828e(0x105)};export const ROLE_REF_FLAG={'name':'role','type':a235_0x1f828e(0x10c),'required':!![],'description':'Role\x20id\x20or\x20exact\x20role\x20name'};export const USER_REF_FLAG={'name':a235_0x1f828e(0xfe),'type':'string','required':!![],'description':'User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'};function a235_0x1673(){const _0x3a60d9=['expect-user-count','user-add','\x20not\x20found\x20in\x20app\x20','dev','map','Cannot\x20','No\x20tenant\x20member\x20matches\x20\x22','push','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','5802471IneMyg','username','nickname','408230EFDjCv','Role\x20id\x20','\x20member(s)\x20but\x20role\x20has\x20','appCode','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','15CCHPjj','\x22\x20not\x20found\x20in\x20app\x20','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','userCount','flagMissing','POST','\x20members\x20of\x20the\x20OWNER\x20role.','Pass\x20--user\x20<id|name>.','Role\x20name','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','join','8ePQeZH','remark','Pass\x20--role\x20<id|name>.','length','totalCount','1023kwfAia','2144kGRBHR','88KyNiLO','flag','\x20built-in\x20role\x20','authRequired','tenant_code','Missing\x20user\x20reference.','roleType','test','\x20duplicate\x20memberships\x20for\x20user\x20','12xnLEpz','validation','tenant','permitCount','userId','6uwjjen','toLowerCase',';\x20no\x20change.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','\x22:\x20','number','1410770CDogHL','1021200PCfTFh','roleName','role','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','Anti-drift\x20check\x20failed:\x20expected\x20','trim','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','user','includes','Role\x20name\x20\x22','Pass\x20--user\x20<id>.','Removed\x20','filter','User\x20','Role\x20id\x20(from\x20`role\x20list`)','str','3683057hGnmDQ','\x20is\x20already\x20a\x20member\x20of\x20role\x20','name','find','DEV','string','OWNER','/smartapi/permit/user-role/create','expectUserCount'];a235_0x1673=function(){return _0x3a60d9;};return a235_0x1673();}export const NAME_FLAG={'name':a235_0x1f828e(0x109),'type':a235_0x1f828e(0x10c),'required':!![],'description':a235_0x1f828e(0x129)};export const USER_NAME_FLAG={'name':a235_0x1f828e(0x109),'type':a235_0x1f828e(0x10c),'required':!![],'description':a235_0x1f828e(0x123)};export const REMARK_FLAG={'name':a235_0x1f828e(0xdc),'type':a235_0x1f828e(0x10c),'required':![],'description':'Optional\x20role\x20remark/description'};export const EXPECT_USER_COUNT_FLAG={'name':a235_0x1f828e(0x110),'type':a235_0x1f828e(0xf5),'required':![],'description':a235_0x1f828e(0x12a)};export const BUILTIN_ROLE_TYPES=['ADMIN',a235_0x1f828e(0x10b),a235_0x1f828e(0x10d)];export function isBuiltinRole(_0x537c25){return BUILTIN_ROLE_TYPES['includes'](_0x537c25);}export function assertCustomRole(_0x2063e8,_0x5cf8ef){const _0x4d1fb8=a235_0x1f828e;if(_0x2063e8['roleType']!=='CUSTOM')throw CliErrors[_0x4d1fb8(0xec)](_0x4d1fb8(0x115)+_0x5cf8ef+_0x4d1fb8(0xe4)+_0x2063e8[_0x4d1fb8(0xf8)]+'\x20('+_0x2063e8[_0x4d1fb8(0xe8)]+').',_0x4d1fb8(0x120));}export function projectRole(_0x287d2f){const _0x24838c=a235_0x1f828e;return{'id':_0x287d2f['id'],'roleName':_0x287d2f[_0x24838c(0xf8)],'roleType':_0x287d2f['roleType'],'remark':_0x287d2f[_0x24838c(0xdc)],'userCount':_0x287d2f[_0x24838c(0x124)],'permitCount':_0x287d2f[_0x24838c(0xee)],'builtin':isBuiltinRole(_0x287d2f[_0x24838c(0xe8)])};}export async function resolveRoleRef(_0x519f76,_0x515f3b){const _0x22c3f6=a235_0x1f828e,_0x4a932c=_0x515f3b['trim']();if(!_0x4a932c)throw CliErrors[_0x22c3f6(0xec)]('Missing\x20role\x20reference.',_0x22c3f6(0xdd));if(/^\d+$/[_0x22c3f6(0xe9)](_0x4a932c))return getRoleById(_0x519f76,Number(_0x4a932c));const _0x2974f8=await listAllAppRoles(_0x519f76),_0x297102=_0x2974f8[_0x22c3f6(0x103)](_0x5e0bb0=>_0x5e0bb0[_0x22c3f6(0xf8)]===_0x4a932c);if(_0x297102[_0x22c3f6(0xde)]===0x0)throw CliErrors[_0x22c3f6(0xec)](_0x22c3f6(0x100)+_0x4a932c+_0x22c3f6(0x122)+_0x519f76+'.',_0x22c3f6(0xfd));if(_0x297102[_0x22c3f6(0xde)]>0x1){const _0x28e6bb=_0x297102[_0x22c3f6(0x114)](_0x366612=>_0x366612['id'])[_0x22c3f6(0xda)](',\x20');throw CliErrors[_0x22c3f6(0xec)](_0x22c3f6(0x100)+_0x4a932c+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x28e6bb+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x297102[0x0];}export async function getRoleById(_0x53be9a,_0x30ccf1){const _0x26deb3=a235_0x1f828e,_0x427820=await listAllAppRoles(_0x53be9a),_0x2e775a=_0x427820[_0x26deb3(0x103)](_0xa490c4=>_0xa490c4['id']===_0x30ccf1&&(!_0xa490c4[_0x26deb3(0x11f)]||_0xa490c4['appCode']===_0x53be9a));if(_0x2e775a[_0x26deb3(0xde)]!==0x1)throw CliErrors[_0x26deb3(0xec)](_0x26deb3(0x11d)+_0x30ccf1+_0x26deb3(0x112)+_0x53be9a+'.',_0x26deb3(0x118));return _0x2e775a[0x0];}async function listAllAppRoles(_0x5507d0){const _0x21659f=a235_0x1f828e,_0x4b92e5=0x64,_0x2aa18c=[];for(let _0x5b4bbb=0x1;;_0x5b4bbb+=0x1){const {items:_0x34d9d8,paging:_0xd9078}=await listAppRoles(_0x5507d0,{'currentPage':_0x5b4bbb,'pageSize':_0x4b92e5});_0x2aa18c[_0x21659f(0x117)](..._0x34d9d8);if(_0x34d9d8['length']<_0x4b92e5||_0xd9078&&_0x2aa18c[_0x21659f(0xde)]>=_0xd9078['totalCount'])return _0x2aa18c;}}export async function resolveTenantCode(){const _0x142f1d=a235_0x1f828e,_0x12df2c=await getSessionUserInfo(),_0x5778ce=_0x12df2c?.[_0x142f1d(0xfe)]?.[_0x142f1d(0xed)]?.[_0x142f1d(0xe6)];if(!_0x5778ce)throw CliErrors[_0x142f1d(0xe5)]('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x5778ce;}function matchMember(_0x2e15b4,_0x43a7d4){const _0x3a4be8=a235_0x1f828e,_0x3b9532=_0x43a7d4[_0x3a4be8(0xfc)]()[_0x3a4be8(0xf1)]();return(_0x2e15b4[_0x3a4be8(0x11b)]??'')['toLowerCase']()===_0x3b9532||(_0x2e15b4['username']??'')[_0x3a4be8(0xf1)]()===_0x3b9532;}export async function resolveUserRef(_0xb05d9f,_0x546318=a235_0x1f828e(0x101)){const _0x5072de=a235_0x1f828e,_0x4d7b4d=_0xb05d9f[_0x5072de(0xfc)]();if(!_0x4d7b4d)throw CliErrors[_0x5072de(0xec)](_0x5072de(0xe7),_0x5072de(0x128));const _0x1514e9=await resolveTenantCode(),_0x438aea=await getTenantMembers(_0x1514e9);if(/^\d+$/[_0x5072de(0xe9)](_0x4d7b4d)){const _0x385ec9=Number(_0x4d7b4d),_0x21ffca=_0x438aea[_0x5072de(0x10a)](_0x1a26d0=>_0x1a26d0[_0x5072de(0xef)]===_0x385ec9);return{'userId':_0x385ec9,'username':_0x21ffca?.[_0x5072de(0x11a)]??String(_0x385ec9),'nickname':_0x21ffca?.[_0x5072de(0x11b)],'matchedBy':'id'};}const _0x2274f7=_0x438aea['filter'](_0x47b0ac=>matchMember(_0x47b0ac,_0x4d7b4d));if(_0x2274f7[_0x5072de(0xde)]===0x0)throw CliErrors[_0x5072de(0xec)](_0x5072de(0x116)+_0x4d7b4d+'\x22.','Check\x20the\x20nickname/username.\x20'+_0x546318);if(_0x2274f7['length']>0x1){const _0x5c02c5=_0x2274f7['map'](_0x57ab2e=>(_0x57ab2e[_0x5072de(0x11b)]??_0x57ab2e['username']??'?')+'('+_0x57ab2e[_0x5072de(0xef)]+')')[_0x5072de(0xda)](',\x20');throw CliErrors[_0x5072de(0xec)]('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x4d7b4d+_0x5072de(0xf4)+_0x5c02c5+'.',_0x546318);}const _0x1790f5=_0x2274f7[0x0];return{'userId':_0x1790f5[_0x5072de(0xef)],'username':_0x1790f5['username']??String(_0x1790f5[_0x5072de(0xef)]),'nickname':_0x1790f5[_0x5072de(0x11b)],'matchedBy':_0x5072de(0x109)};}export const CREATE_USER_ROLE_PATH=a235_0x1f828e(0x10e);export const DELETE_USER_ROLE_PATH='/smartapi/permit/user-role/delete';export function computeRoleUserMutation(_0x15357c){const _0x346d91=a235_0x1f828e,{operation:_0x175f59,appCode:_0x3027cf,role:_0x372426,relations:_0x11512c,user:_0x154f3e}=_0x15357c,_0x36aa30=[...new Set(_0x11512c[_0x346d91(0x114)](_0x186435=>_0x186435[_0x346d91(0xef)]))],_0xe8b05f=[];if(_0x15357c[_0x346d91(0x10f)]!==undefined&&_0x15357c['expectUserCount']!==_0x36aa30[_0x346d91(0xde)])throw CliErrors[_0x346d91(0xec)](_0x346d91(0xfb)+_0x15357c[_0x346d91(0x10f)]+_0x346d91(0x11e)+_0x36aa30[_0x346d91(0xde)]+'.',_0x346d91(0xf3));const _0x5067d6=_0x36aa30[_0x346d91(0xff)](_0x154f3e[_0x346d91(0xef)]),_0x1b464d=_0x11512c[_0x346d91(0x103)](_0x2cef16=>_0x2cef16[_0x346d91(0xef)]===_0x154f3e['userId'])[_0x346d91(0x114)](_0x18f5e6=>_0x18f5e6['id']),_0x536811=_0x175f59===_0x346d91(0x111)?!_0x5067d6:_0x5067d6;let _0x48fed3=_0x36aa30;_0x175f59===_0x346d91(0x111)?_0x5067d6?_0xe8b05f['push'](_0x346d91(0x104)+_0x154f3e[_0x346d91(0xef)]+_0x346d91(0x108)+_0x372426[_0x346d91(0xf8)]+';\x20no\x20change.'):_0x48fed3=[..._0x36aa30,_0x154f3e['userId']]:!_0x5067d6?_0xe8b05f[_0x346d91(0x117)](_0x346d91(0x104)+_0x154f3e['userId']+'\x20is\x20not\x20a\x20member\x20of\x20role\x20'+_0x372426[_0x346d91(0xf8)]+_0x346d91(0xf2)):(_0x48fed3=_0x36aa30[_0x346d91(0x103)](_0x143b22=>_0x143b22!==_0x154f3e[_0x346d91(0xef)]),_0x1b464d[_0x346d91(0xde)]>0x1&&_0xe8b05f['push'](_0x346d91(0x102)+_0x1b464d[_0x346d91(0xde)]+_0x346d91(0xea)+_0x154f3e[_0x346d91(0xef)]+'.'));const _0x34d665={'scope':_0x346d91(0x113),'operation':_0x175f59,'selector':{'appCode':_0x3027cf,'roleId':_0x372426['id'],'roleName':_0x372426[_0x346d91(0xf8)],'userId':_0x154f3e[_0x346d91(0xef)]},'before':{'userIds':_0x36aa30},'after':{'userIds':_0x48fed3},'dryRun':_0x15357c['dryRun'],'backend':{'method':_0x346d91(0x126),'path':_0x175f59===_0x346d91(0x111)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0xe8b05f};return{'mutation':_0x34d665,'changed':_0x536811,'matchingRelationIds':_0x1b464d};}export async function loadDevRoleRelations(_0x3dcb03,_0x542d17){const _0x3edf12=a235_0x1f828e,_0xdf43c=0x64,_0x29d6f5=[];for(let _0xee1322=0x1;;_0xee1322+=0x1){const {items:_0x13a8c0,paging:_0x1b4332}=await listDevUserRoleRelations(_0x3dcb03,{'roleId':_0x542d17,'currentPage':_0xee1322,'pageSize':_0xdf43c});_0x29d6f5[_0x3edf12(0x117)](..._0x13a8c0);if(_0x13a8c0[_0x3edf12(0xde)]<_0xdf43c||_0x1b4332&&_0x29d6f5[_0x3edf12(0xde)]>=_0x1b4332[_0x3edf12(0xdf)])return _0x29d6f5;}}export function readRoleRef(_0x405ea4){const _0x130e3b=a235_0x1f828e,_0x10caef=_0x405ea4[_0x130e3b(0x106)](_0x130e3b(0xf9))['trim']();if(!_0x10caef)throw CliErrors[_0x130e3b(0x125)](_0x130e3b(0xf9),_0x130e3b(0xdd));return _0x10caef;}export async function prepareUserMutation(_0x15e913,_0x4ddb0b,_0x3cd7dd){const _0x1466aa=a235_0x1f828e,_0x10917b=readRoleRef(_0x15e913),_0x5df929=_0x15e913[_0x1466aa(0x106)]('user')[_0x1466aa(0xfc)]();if(!_0x5df929)throw CliErrors['flagMissing'](_0x1466aa(0xfe),'Pass\x20--user\x20<id|name>.');const _0x271966=_0x15e913[_0x1466aa(0xe3)](_0x1466aa(0x110)),_0x45ab81=_0x271966===undefined||_0x271966===null?undefined:Number(_0x271966),_0x3290bf=await resolveRoleRef(_0x15e913[_0x1466aa(0x11f)],_0x10917b);if(_0x3290bf['roleType']===_0x1466aa(0x10d))throw CliErrors[_0x1466aa(0xec)](_0x1466aa(0x115)+_0x4ddb0b+_0x1466aa(0x127),_0x1466aa(0xfa));const _0x5a73a1=await resolveUserRef(_0x5df929),_0x1ab54a=await loadDevRoleRelations(_0x15e913[_0x1466aa(0x11f)],_0x3290bf['id']);return{...computeRoleUserMutation({'operation':_0x4ddb0b,'appCode':_0x15e913[_0x1466aa(0x11f)],'role':_0x3290bf,'relations':_0x1ab54a,'user':{'userId':_0x5a73a1['userId'],'username':_0x5a73a1[_0x1466aa(0x11a)],'nickname':_0x5a73a1[_0x1466aa(0x11b)]},'dryRun':_0x3cd7dd,..._0x45ab81!==undefined?{'expectUserCount':_0x45ab81}:{}}),'role':_0x3290bf,'user':_0x5a73a1};}
@@ -1 +1 @@
1
- const a236_0x2127e1=a236_0x4699;(function(_0x5c0ac8,_0x42cc50){const _0x2ca8b0=a236_0x4699,_0x158a71=_0x5c0ac8();while(!![]){try{const _0x4236c8=parseInt(_0x2ca8b0(0x85))/0x1+parseInt(_0x2ca8b0(0x77))/0x2*(-parseInt(_0x2ca8b0(0x7f))/0x3)+parseInt(_0x2ca8b0(0x88))/0x4*(parseInt(_0x2ca8b0(0x70))/0x5)+parseInt(_0x2ca8b0(0x7c))/0x6*(-parseInt(_0x2ca8b0(0x79))/0x7)+-parseInt(_0x2ca8b0(0x8b))/0x8*(parseInt(_0x2ca8b0(0x71))/0x9)+parseInt(_0x2ca8b0(0x83))/0xa+parseInt(_0x2ca8b0(0x8d))/0xb;if(_0x4236c8===_0x42cc50)break;else _0x158a71['push'](_0x158a71['shift']());}catch(_0x35adb7){_0x158a71['push'](_0x158a71['shift']());}}}(a236_0x582f,0xc3901));import{updateAppRole}from'../../core/api-client.js';function a236_0x582f(){const _0x134653=['num','56593aICMtu','write','flag','380JjVkHz','validation','/smartapi/permit/role/update','8ZgyLDU','appCode','27938669XZsTVF','POST','19905VWQVqW','7884603AknTDH','dev','trim','role','--name\x20cannot\x20be\x20empty.','remark','2SKoNCM','name','7UIXLPH','update','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','4950234RiKlZS','\x20(id=','Nothing\x20to\x20update.','3959088tjcTZP','Updated\x20role\x20','New\x20role\x20name','roleName','8471600cTUidE'];a236_0x582f=function(){return _0x134653;};return a236_0x582f();}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=a236_0x2127e1(0x8a);function a236_0x4699(_0x420bdc,_0xf94d56){_0x420bdc=_0x420bdc-0x70;const _0x582fe6=a236_0x582f();let _0x469930=_0x582fe6[_0x420bdc];return _0x469930;}function readPatch(_0x53332c){const _0x110259=a236_0x2127e1,_0xf9351a=_0x53332c[_0x110259(0x87)](_0x110259(0x78)),_0x3499ee=_0x53332c[_0x110259(0x87)](_0x110259(0x76)),_0x26ed43={};if(_0xf9351a!==undefined&&_0xf9351a!==null){const _0x42e256=String(_0xf9351a)[_0x110259(0x73)]();if(!_0x42e256)throw CliErrors['validation'](_0x110259(0x75));if(_0x42e256['length']>0x40)throw CliErrors['validation']('Role\x20name\x20cannot\x20exceed\x2064\x20characters.');_0x26ed43[_0x110259(0x82)]=_0x42e256;}_0x3499ee!==undefined&&_0x3499ee!==null&&(_0x26ed43[_0x110259(0x76)]=String(_0x3499ee));if(_0x26ed43[_0x110259(0x82)]===undefined&&_0x26ed43[_0x110259(0x76)]===undefined)throw CliErrors[_0x110259(0x89)](_0x110259(0x7e),'Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.');return _0x26ed43;}export const roleUpdate={'service':a236_0x2127e1(0x74),'command':a236_0x2127e1(0x7a),'description':a236_0x2127e1(0x7b),'risk':a236_0x2127e1(0x86),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a236_0x2127e1(0x78),'type':'string','required':![],'description':a236_0x2127e1(0x81)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x135ed7){readPatch(_0x135ed7);},async 'dryRun'(_0x4e9ab4){const _0x1244f2=a236_0x2127e1,_0x5e7355=_0x4e9ab4[_0x1244f2(0x84)]('id'),_0x4d1e05=readPatch(_0x4e9ab4),_0x4b1b80=await getRoleById(_0x4e9ab4[_0x1244f2(0x8c)],_0x5e7355);return assertCustomRole(_0x4b1b80,_0x1244f2(0x7a)),asDryRunResult({'scope':_0x1244f2(0x72),'operation':_0x1244f2(0x7a),'selector':{'appCode':_0x4e9ab4['appCode'],'roleId':_0x5e7355,'roleName':_0x4b1b80[_0x1244f2(0x82)]},'before':projectRole(_0x4b1b80),'after':projectRole({..._0x4b1b80,..._0x4d1e05[_0x1244f2(0x82)]!==undefined?{'roleName':_0x4d1e05['roleName']}:{},..._0x4d1e05['remark']!==undefined?{'remark':_0x4d1e05[_0x1244f2(0x76)]}:{}}),'dryRun':!![],'backend':{'method':_0x1244f2(0x8e),'path':UPDATE_PATH},'warnings':[]},{'method':_0x1244f2(0x8e),'url':UPDATE_PATH});},async 'execute'(_0x2f3d1d){const _0x10685f=a236_0x2127e1,_0x27ac7e=_0x2f3d1d[_0x10685f(0x84)]('id'),_0x5ef191=readPatch(_0x2f3d1d),_0x3acc24=await getRoleById(_0x2f3d1d[_0x10685f(0x8c)],_0x27ac7e);assertCustomRole(_0x3acc24,'update'),await updateAppRole({'id':_0x27ac7e,'appCode':_0x2f3d1d[_0x10685f(0x8c)],..._0x5ef191[_0x10685f(0x82)]!==undefined?{'roleName':_0x5ef191[_0x10685f(0x82)]}:{},..._0x5ef191[_0x10685f(0x76)]!==undefined?{'remark':_0x5ef191['remark']}:{}});const _0x1b1d8d=await getRoleById(_0x2f3d1d[_0x10685f(0x8c)],_0x27ac7e);return{'ok':!![],'data':{'scope':'dev','operation':_0x10685f(0x7a),'selector':{'appCode':_0x2f3d1d[_0x10685f(0x8c)],'roleId':_0x27ac7e,'roleName':_0x1b1d8d['roleName']},'before':projectRole(_0x3acc24),'after':projectRole(_0x1b1d8d),'dryRun':![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},'message':_0x10685f(0x80)+_0x1b1d8d[_0x10685f(0x82)]+_0x10685f(0x7d)+_0x27ac7e+')'};}};
1
+ const a236_0x5b9f41=a236_0x4cef;(function(_0x19689d,_0x2fc6fd){const _0x16af85=a236_0x4cef,_0x411b9c=_0x19689d();while(!![]){try{const _0xa8685d=-parseInt(_0x16af85(0x20e))/0x1*(-parseInt(_0x16af85(0x206))/0x2)+-parseInt(_0x16af85(0x1f3))/0x3+parseInt(_0x16af85(0x1fd))/0x4*(parseInt(_0x16af85(0x1f6))/0x5)+parseInt(_0x16af85(0x212))/0x6*(-parseInt(_0x16af85(0x1fb))/0x7)+parseInt(_0x16af85(0x214))/0x8*(parseInt(_0x16af85(0x210))/0x9)+-parseInt(_0x16af85(0x20b))/0xa*(parseInt(_0x16af85(0x213))/0xb)+parseInt(_0x16af85(0x1f7))/0xc;if(_0xa8685d===_0x2fc6fd)break;else _0x411b9c['push'](_0x411b9c['shift']());}catch(_0x2f6493){_0x411b9c['push'](_0x411b9c['shift']());}}}(a236_0x5b57,0xe895d));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a236_0x4cef(_0x358f71,_0x3f1f0c){_0x358f71=_0x358f71-0x1f3;const _0x5b57e4=a236_0x5b57();let _0x4cefa0=_0x5b57e4[_0x358f71];return _0x4cefa0;}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=a236_0x5b9f41(0x1fa);function readPatch(_0x1fe088){const _0xeaec2a=a236_0x5b9f41,_0x1a7e4f=_0x1fe088[_0xeaec2a(0x207)](_0xeaec2a(0x1ff)),_0xa7f62a=_0x1fe088[_0xeaec2a(0x207)](_0xeaec2a(0x200)),_0x1eb0dc={};if(_0x1a7e4f!==undefined&&_0x1a7e4f!==null){const _0x3f183f=String(_0x1a7e4f)[_0xeaec2a(0x20c)]();if(!_0x3f183f)throw CliErrors['validation'](_0xeaec2a(0x1f5));if(_0x3f183f[_0xeaec2a(0x205)]>0x40)throw CliErrors[_0xeaec2a(0x211)](_0xeaec2a(0x208));_0x1eb0dc[_0xeaec2a(0x1fc)]=_0x3f183f;}_0xa7f62a!==undefined&&_0xa7f62a!==null&&(_0x1eb0dc['remark']=String(_0xa7f62a));if(_0x1eb0dc['roleName']===undefined&&_0x1eb0dc[_0xeaec2a(0x200)]===undefined)throw CliErrors[_0xeaec2a(0x211)]('Nothing\x20to\x20update.',_0xeaec2a(0x209));return _0x1eb0dc;}export const roleUpdate={'service':'role','command':a236_0x5b9f41(0x204),'description':a236_0x5b9f41(0x20a),'risk':a236_0x5b9f41(0x1fe),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a236_0x5b9f41(0x1ff),'type':a236_0x5b9f41(0x1f4),'required':![],'description':a236_0x5b9f41(0x20d)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x3a0023){readPatch(_0x3a0023);},async 'dryRun'(_0x1ab135){const _0x3751d1=a236_0x5b9f41,_0x422d15=_0x1ab135['num']('id'),_0x18d90c=readPatch(_0x1ab135),_0x10207d=await getRoleById(_0x1ab135[_0x3751d1(0x20f)],_0x422d15);return assertCustomRole(_0x10207d,'update'),asDryRunResult({'scope':'dev','operation':_0x3751d1(0x204),'selector':{'appCode':_0x1ab135[_0x3751d1(0x20f)],'roleId':_0x422d15,'roleName':_0x10207d[_0x3751d1(0x1fc)]},'before':projectRole(_0x10207d),'after':projectRole({..._0x10207d,..._0x18d90c[_0x3751d1(0x1fc)]!==undefined?{'roleName':_0x18d90c[_0x3751d1(0x1fc)]}:{},..._0x18d90c[_0x3751d1(0x200)]!==undefined?{'remark':_0x18d90c[_0x3751d1(0x200)]}:{}}),'dryRun':!![],'backend':{'method':_0x3751d1(0x201),'path':UPDATE_PATH},'warnings':[]},{'method':_0x3751d1(0x201),'url':UPDATE_PATH});},async 'execute'(_0xc09f92){const _0x4badb5=a236_0x5b9f41,_0x32dba8=_0xc09f92[_0x4badb5(0x202)]('id'),_0x35b936=readPatch(_0xc09f92),_0x31387f=await getRoleById(_0xc09f92[_0x4badb5(0x20f)],_0x32dba8);assertCustomRole(_0x31387f,'update'),await updateAppRole({'id':_0x32dba8,'appCode':_0xc09f92[_0x4badb5(0x20f)],..._0x35b936[_0x4badb5(0x1fc)]!==undefined?{'roleName':_0x35b936['roleName']}:{},..._0x35b936[_0x4badb5(0x200)]!==undefined?{'remark':_0x35b936[_0x4badb5(0x200)]}:{}});const _0x2cf8f3=await getRoleById(_0xc09f92[_0x4badb5(0x20f)],_0x32dba8);return{'ok':!![],'data':{'scope':_0x4badb5(0x203),'operation':_0x4badb5(0x204),'selector':{'appCode':_0xc09f92[_0x4badb5(0x20f)],'roleId':_0x32dba8,'roleName':_0x2cf8f3[_0x4badb5(0x1fc)]},'before':projectRole(_0x31387f),'after':projectRole(_0x2cf8f3),'dryRun':![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},'message':_0x4badb5(0x1f8)+_0x2cf8f3[_0x4badb5(0x1fc)]+_0x4badb5(0x1f9)+_0x32dba8+')'};}};function a236_0x5b57(){const _0x21c255=['POST','num','dev','update','length','10adxgOu','flag','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','18328270CGwUHl','trim','New\x20role\x20name','11453EgbRcq','appCode','13649247RjIhIA','validation','222KlpeFX','11kFgtol','8bbtbMk','631398akEmre','string','--name\x20cannot\x20be\x20empty.','565IgvXXj','17077032hmnmbf','Updated\x20role\x20','\x20(id=','/smartapi/permit/role/update','156695bpExVj','roleName','29284WLiKIV','write','name','remark'];a236_0x5b57=function(){return _0x21c255;};return a236_0x5b57();}
@@ -1 +1 @@
1
- function a237_0x4162(){const _0x3ab6df=['roleType','roleName','POST','273825RQosBO','username','3212235dlVSKw','53158850MlhLVp','1986WTzqjm','user-add','7576vvNWNX','8063070XtaZbg','userId','\x20already\x20in\x20role\x20','8vImfYe','2933700cvlyVn','role','988654VamSaA','roleId','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','selector','2PAZbRX'];a237_0x4162=function(){return _0x3ab6df;};return a237_0x4162();}const a237_0x4c04f5=a237_0x16af;(function(_0x4cea09,_0x110737){const _0x5d0c76=a237_0x16af,_0x26050a=_0x4cea09();while(!![]){try{const _0x3077fe=parseInt(_0x5d0c76(0x100))/0x1*(-parseInt(_0x5d0c76(0x104))/0x2)+-parseInt(_0x5d0c76(0x10c))/0x3*(parseInt(_0x5d0c76(0x10e))/0x4)+-parseInt(_0x5d0c76(0x10a))/0x5+-parseInt(_0x5d0c76(0xfa))/0x6+-parseInt(_0x5d0c76(0xfe))/0x7+parseInt(_0x5d0c76(0xfd))/0x8*(parseInt(_0x5d0c76(0x108))/0x9)+parseInt(_0x5d0c76(0x10b))/0xa;if(_0x3077fe===_0x110737)break;else _0x26050a['push'](_0x26050a['shift']());}catch(_0x77e91a){_0x26050a['push'](_0x26050a['shift']());}}}(a237_0x4162,0xaa844));function a237_0x16af(_0x27e67d,_0x476294){_0x27e67d=_0x27e67d-0xfa;const _0x41629b=a237_0x4162();let _0x16af7f=_0x41629b[_0x27e67d];return _0x16af7f;}import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a237_0x4c04f5(0xff),'command':a237_0x4c04f5(0x10d),'description':a237_0x4c04f5(0x102),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x51f944){const _0x1593c8=a237_0x4c04f5,{mutation:_0x71481e}=await prepareUserMutation(_0x51f944,_0x1593c8(0x10d),!![]);return asDryRunResult(_0x71481e,{'method':_0x1593c8(0x107),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x312e32){const _0x16100f=a237_0x4c04f5,{mutation:_0x48cd53,changed:_0x21c823,role:_0xce48f3,user:_0x116bf6}=await prepareUserMutation(_0x312e32,_0x16100f(0x10d),![]);return _0x21c823&&await createDevUserRole({'appCode':_0x312e32['appCode'],'userId':_0x116bf6[_0x16100f(0xfb)],'username':_0x116bf6[_0x16100f(0x109)],'roleType':_0xce48f3[_0x16100f(0x105)],'roleId':_0x48cd53[_0x16100f(0x103)][_0x16100f(0x101)]}),{'ok':!![],'data':_0x48cd53,'message':_0x21c823?'Added\x20user\x20'+_0x48cd53[_0x16100f(0x103)][_0x16100f(0xfb)]+'\x20to\x20role\x20'+_0x48cd53['selector'][_0x16100f(0x106)]:'No\x20change:\x20user\x20'+_0x48cd53[_0x16100f(0x103)][_0x16100f(0xfb)]+_0x16100f(0xfc)+_0x48cd53[_0x16100f(0x103)][_0x16100f(0x106)]};}};
1
+ function a237_0x5af3(_0x40ca4a,_0x3391a6){_0x40ca4a=_0x40ca4a-0xfe;const _0x53b300=a237_0x53b3();let _0x5af383=_0x53b300[_0x40ca4a];return _0x5af383;}function a237_0x53b3(){const _0x275276=['user-add','userId','No\x20change:\x20user\x20','9068983RoWScm','20208NEkiLQ','79043BlyUzg','4zqIdoh','410XPKXhq','high-risk-write','16938hLUelN','4135312OHZjuM','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','roleName','130TTOSud','\x20already\x20in\x20role\x20','59742dQVkUa','appCode','296856KbyQBT','username','selector','role','roleType','1057WQwFNR'];a237_0x53b3=function(){return _0x275276;};return a237_0x53b3();}const a237_0x2ba698=a237_0x5af3;(function(_0x192943,_0x3abf00){const _0x2b5336=a237_0x5af3,_0x3ee46a=_0x192943();while(!![]){try{const _0x304ca2=parseInt(_0x2b5336(0x112))/0x1*(-parseInt(_0x2b5336(0x113))/0x2)+parseInt(_0x2b5336(0x107))/0x3+-parseInt(_0x2b5336(0x111))/0x4*(-parseInt(_0x2b5336(0x114))/0x5)+-parseInt(_0x2b5336(0xff))/0x6*(-parseInt(_0x2b5336(0x10c))/0x7)+parseInt(_0x2b5336(0x100))/0x8+parseInt(_0x2b5336(0x105))/0x9*(-parseInt(_0x2b5336(0x103))/0xa)+-parseInt(_0x2b5336(0x110))/0xb;if(_0x304ca2===_0x3abf00)break;else _0x3ee46a['push'](_0x3ee46a['shift']());}catch(_0x474b25){_0x3ee46a['push'](_0x3ee46a['shift']());}}}(a237_0x53b3,0x5e9f2));import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a237_0x2ba698(0x10a),'command':'user-add','description':a237_0x2ba698(0x101),'risk':a237_0x2ba698(0xfe),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x2b3637){const _0x220844=a237_0x2ba698,{mutation:_0x5a1c24}=await prepareUserMutation(_0x2b3637,_0x220844(0x10d),!![]);return asDryRunResult(_0x5a1c24,{'method':'POST','url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x11a3e3){const _0x577841=a237_0x2ba698,{mutation:_0x36b127,changed:_0x94a97e,role:_0x4bef95,user:_0x343f7e}=await prepareUserMutation(_0x11a3e3,'user-add',![]);return _0x94a97e&&await createDevUserRole({'appCode':_0x11a3e3[_0x577841(0x106)],'userId':_0x343f7e['userId'],'username':_0x343f7e[_0x577841(0x108)],'roleType':_0x4bef95[_0x577841(0x10b)],'roleId':_0x36b127[_0x577841(0x109)]['roleId']}),{'ok':!![],'data':_0x36b127,'message':_0x94a97e?'Added\x20user\x20'+_0x36b127['selector'][_0x577841(0x10e)]+'\x20to\x20role\x20'+_0x36b127[_0x577841(0x109)][_0x577841(0x102)]:_0x577841(0x10f)+_0x36b127[_0x577841(0x109)][_0x577841(0x10e)]+_0x577841(0x104)+_0x36b127[_0x577841(0x109)]['roleName']};}};
@@ -1 +1 @@
1
- const a238_0x139d18=a238_0x5ee9;(function(_0x5a036d,_0x5b0bea){const _0x3c1ef4=a238_0x5ee9,_0x594179=_0x5a036d();while(!![]){try{const _0x1bd90f=parseInt(_0x3c1ef4(0x1cd))/0x1*(parseInt(_0x3c1ef4(0x1c0))/0x2)+parseInt(_0x3c1ef4(0x1d0))/0x3+-parseInt(_0x3c1ef4(0x1be))/0x4*(parseInt(_0x3c1ef4(0x1c8))/0x5)+parseInt(_0x3c1ef4(0x1c6))/0x6+parseInt(_0x3c1ef4(0x1cb))/0x7*(parseInt(_0x3c1ef4(0x1bf))/0x8)+-parseInt(_0x3c1ef4(0x1ca))/0x9*(parseInt(_0x3c1ef4(0x1c3))/0xa)+-parseInt(_0x3c1ef4(0x1c4))/0xb;if(_0x1bd90f===_0x5b0bea)break;else _0x594179['push'](_0x594179['shift']());}catch(_0x5cac00){_0x594179['push'](_0x594179['shift']());}}}(a238_0x33be,0x2d265));import{deleteDevUserRole}from'../../core/api-client.js';function a238_0x33be(){const _0x549030=['Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','No\x20change:\x20user\x20','545901nZFYMg','user-remove','selector','1956pmSKtU','1712bPVNZW','2LBvLRl','role','Removed\x20user\x20','2209150NbjLDG','2851277CSlTri','high-risk-write','2084304kwgZWN','roleName','3095INiLwD','userId','9YXNAzS','6139Syqqde','\x20not\x20in\x20role\x20','250717FKbvfL'];a238_0x33be=function(){return _0x549030;};return a238_0x33be();}function a238_0x5ee9(_0x401946,_0x1badd9){_0x401946=_0x401946-0x1bc;const _0x33beb3=a238_0x33be();let _0x5ee90f=_0x33beb3[_0x401946];return _0x5ee90f;}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':a238_0x139d18(0x1c1),'command':a238_0x139d18(0x1bc),'description':a238_0x139d18(0x1ce),'risk':a238_0x139d18(0x1c5),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x9f1908){const _0x85ee47=a238_0x139d18,{mutation:_0xe65ce4}=await prepareUserMutation(_0x9f1908,_0x85ee47(0x1bc),!![]);return asDryRunResult(_0xe65ce4,{'method':'POST','url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x4d6868){const _0x2d58fe=a238_0x139d18,{matchingRelationIds:_0x315d9d,mutation:_0x436c37,changed:_0x1d63e7}=await prepareUserMutation(_0x4d6868,_0x2d58fe(0x1bc),![]);if(_0x1d63e7)for(const _0x38d9d6 of _0x315d9d){await deleteDevUserRole(_0x38d9d6);}return{'ok':!![],'data':_0x436c37,'message':_0x1d63e7?_0x2d58fe(0x1c2)+_0x436c37[_0x2d58fe(0x1bd)][_0x2d58fe(0x1c9)]+'\x20from\x20role\x20'+_0x436c37[_0x2d58fe(0x1bd)][_0x2d58fe(0x1c7)]:_0x2d58fe(0x1cf)+_0x436c37[_0x2d58fe(0x1bd)]['userId']+_0x2d58fe(0x1cc)+_0x436c37[_0x2d58fe(0x1bd)][_0x2d58fe(0x1c7)]};}};
1
+ const a238_0x4d7b56=a238_0x14b0;(function(_0x3edc87,_0xac560e){const _0x2dd2d9=a238_0x14b0,_0x1847d9=_0x3edc87();while(!![]){try{const _0x5ceeed=parseInt(_0x2dd2d9(0x109))/0x1+-parseInt(_0x2dd2d9(0x11a))/0x2+parseInt(_0x2dd2d9(0x110))/0x3+parseInt(_0x2dd2d9(0x119))/0x4*(parseInt(_0x2dd2d9(0x111))/0x5)+-parseInt(_0x2dd2d9(0x112))/0x6+-parseInt(_0x2dd2d9(0x10e))/0x7*(-parseInt(_0x2dd2d9(0x113))/0x8)+parseInt(_0x2dd2d9(0x118))/0x9*(-parseInt(_0x2dd2d9(0x10b))/0xa);if(_0x5ceeed===_0xac560e)break;else _0x1847d9['push'](_0x1847d9['shift']());}catch(_0xf1c415){_0x1847d9['push'](_0x1847d9['shift']());}}}(a238_0x2dc7,0x4ed94));import{deleteDevUserRole}from'../../core/api-client.js';function a238_0x2dc7(){const _0x3a04aa=['roleName','814854vBBiAA','459065QVIVNu','793602YykGBB','877408yZxrmB','Removed\x20user\x20','userId','role','high-risk-write','97938PiovhE','8pFyfPL','730286MyuoEI','253742hkJoKo','POST','200sZxOZl','user-remove','selector','21vkFNrO'];a238_0x2dc7=function(){return _0x3a04aa;};return a238_0x2dc7();}function a238_0x14b0(_0x50a26f,_0x513b53){_0x50a26f=_0x50a26f-0x109;const _0x2dc7e8=a238_0x2dc7();let _0x14b0b0=_0x2dc7e8[_0x50a26f];return _0x14b0b0;}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':a238_0x4d7b56(0x116),'command':a238_0x4d7b56(0x10c),'description':'Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','risk':a238_0x4d7b56(0x117),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x5cbcfa){const _0x4474f6=a238_0x4d7b56,{mutation:_0x5954e5}=await prepareUserMutation(_0x5cbcfa,_0x4474f6(0x10c),!![]);return asDryRunResult(_0x5954e5,{'method':_0x4474f6(0x10a),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x1a1f8e){const _0x51144f=a238_0x4d7b56,{matchingRelationIds:_0x20a1fa,mutation:_0x20250b,changed:_0x26ff03}=await prepareUserMutation(_0x1a1f8e,_0x51144f(0x10c),![]);if(_0x26ff03)for(const _0x3bf667 of _0x20a1fa){await deleteDevUserRole(_0x3bf667);}return{'ok':!![],'data':_0x20250b,'message':_0x26ff03?_0x51144f(0x114)+_0x20250b[_0x51144f(0x10d)]['userId']+'\x20from\x20role\x20'+_0x20250b[_0x51144f(0x10d)][_0x51144f(0x10f)]:'No\x20change:\x20user\x20'+_0x20250b[_0x51144f(0x10d)][_0x51144f(0x115)]+'\x20not\x20in\x20role\x20'+_0x20250b[_0x51144f(0x10d)][_0x51144f(0x10f)]};}};
@@ -1 +1 @@
1
- const a239_0x21607a=a239_0x3a21;function a239_0x14bb(){const _0x45fd52=['32otnpIf','nickname','role','886062OsoYZU','Pass\x20--name\x20<nickname|username>.','6476zuQRMx','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','read','665410QoatKa','1415Qcdcfm','\x22\x20→\x20userId\x20','flagMissing','23630751dlaiwT','userId','561806uZNtfa','name','trim','str','Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.','matchedBy','Resolved\x20\x22','1097656gxyFKq','671349BCYGMr'];a239_0x14bb=function(){return _0x45fd52;};return a239_0x14bb();}(function(_0x2cbb96,_0x17bdd0){const _0x122e10=a239_0x3a21,_0x569c5c=_0x2cbb96();while(!![]){try{const _0x452194=-parseInt(_0x122e10(0x115))/0x1+-parseInt(_0x122e10(0x122))/0x2+-parseInt(_0x122e10(0x123))/0x3+parseInt(_0x122e10(0x112))/0x4*(-parseInt(_0x122e10(0x116))/0x5)+parseInt(_0x122e10(0x110))/0x6+-parseInt(_0x122e10(0x11b))/0x7*(parseInt(_0x122e10(0x124))/0x8)+parseInt(_0x122e10(0x119))/0x9;if(_0x452194===_0x17bdd0)break;else _0x569c5c['push'](_0x569c5c['shift']());}catch(_0x2fe089){_0x569c5c['push'](_0x569c5c['shift']());}}}(a239_0x14bb,0x87c36));import{CliErrors}from'../../errors.js';function a239_0x3a21(_0x540e9b,_0x4f409b){_0x540e9b=_0x540e9b-0x10f;const _0x14bb22=a239_0x14bb();let _0x3a2142=_0x14bb22[_0x540e9b];return _0x3a2142;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a239_0x21607a(0x10f),'command':'user-resolve','description':a239_0x21607a(0x113),'risk':a239_0x21607a(0x114),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x20e90a){const _0x392081=a239_0x21607a;if(!_0x20e90a[_0x392081(0x11e)](_0x392081(0x11c))[_0x392081(0x11d)]())throw CliErrors[_0x392081(0x118)]('name',_0x392081(0x111));},async 'execute'(_0x4dab04){const _0x5dac76=a239_0x21607a,_0x19b413=_0x4dab04[_0x5dac76(0x11e)](_0x5dac76(0x11c))['trim'](),_0x4ee466=await resolveUserRef(_0x19b413,_0x5dac76(0x11f));return{'ok':!![],'data':{'user':{'userId':_0x4ee466[_0x5dac76(0x11a)],'username':_0x4ee466['username'],'nickname':_0x4ee466[_0x5dac76(0x125)],'matchedBy':_0x4ee466[_0x5dac76(0x120)]}},'message':_0x5dac76(0x121)+_0x19b413+_0x5dac76(0x117)+_0x4ee466[_0x5dac76(0x11a)]};}};
1
+ const a239_0xfacab3=a239_0x4037;function a239_0x4037(_0x2ce07f,_0x1c1502){_0x2ce07f=_0x2ce07f-0x19d;const _0x78d83d=a239_0x78d8();let _0x403771=_0x78d83d[_0x2ce07f];return _0x403771;}(function(_0x140fc2,_0x3a46f2){const _0x3ec675=a239_0x4037,_0x3d708c=_0x140fc2();while(!![]){try{const _0x4b09a=-parseInt(_0x3ec675(0x1aa))/0x1+-parseInt(_0x3ec675(0x1b1))/0x2*(-parseInt(_0x3ec675(0x1ae))/0x3)+parseInt(_0x3ec675(0x19f))/0x4+-parseInt(_0x3ec675(0x1ad))/0x5*(parseInt(_0x3ec675(0x1a8))/0x6)+-parseInt(_0x3ec675(0x1a1))/0x7+parseInt(_0x3ec675(0x19e))/0x8*(parseInt(_0x3ec675(0x1b4))/0x9)+parseInt(_0x3ec675(0x1a4))/0xa;if(_0x4b09a===_0x3a46f2)break;else _0x3d708c['push'](_0x3d708c['shift']());}catch(_0xe33980){_0x3d708c['push'](_0x3d708c['shift']());}}}(a239_0x78d8,0x588e2));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a239_0x78d8(){const _0x1580bc=['user-resolve','username','3472260oAQOdU','str','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','userId','3243918YwOCQz','\x22\x20→\x20userId\x20','3386jKcAKN','Pass\x20--name\x20<nickname|username>.','nickname','5mJZAyQ','3ODcGlW','matchedBy','Resolved\x20\x22','457954MJtUFf','role','name','942255UnNTbX','trim','32tfdflw','939888Glousu','read','2262358kcdhxH'];a239_0x78d8=function(){return _0x1580bc;};return a239_0x78d8();}import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a239_0xfacab3(0x1b2),'command':a239_0xfacab3(0x1a2),'description':a239_0xfacab3(0x1a6),'risk':a239_0xfacab3(0x1a0),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x5a6575){const _0x232ccb=a239_0xfacab3;if(!_0x5a6575[_0x232ccb(0x1a5)](_0x232ccb(0x1b3))[_0x232ccb(0x19d)]())throw CliErrors['flagMissing'](_0x232ccb(0x1b3),_0x232ccb(0x1ab));},async 'execute'(_0x14ae23){const _0x2c4815=a239_0xfacab3,_0x3cca27=_0x14ae23[_0x2c4815(0x1a5)](_0x2c4815(0x1b3))[_0x2c4815(0x19d)](),_0x4de02c=await resolveUserRef(_0x3cca27,'Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.');return{'ok':!![],'data':{'user':{'userId':_0x4de02c['userId'],'username':_0x4de02c[_0x2c4815(0x1a3)],'nickname':_0x4de02c[_0x2c4815(0x1ac)],'matchedBy':_0x4de02c[_0x2c4815(0x1af)]}},'message':_0x2c4815(0x1b0)+_0x3cca27+_0x2c4815(0x1a9)+_0x4de02c[_0x2c4815(0x1a7)]};}};
@@ -1 +1 @@
1
- const a240_0x3523fa=a240_0x2347;function a240_0xf2ae(){const _0x4d95f0=['Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20','\x20is\x20not\x20configured\x20for\x20app\x20','cookie','70sEIgEX','Loaded\x20','28957511GjxjGa','312qHhJSX','1327230famIcX','277333dacRlu','421164FLOeNO','3170wDSzkH','app_rule_not_found','read','rule','get','2323756TgNOKe','645dTTjOB','1236080rzZHVA','6MBHrvV','\x20for\x20','content','appCode'];a240_0xf2ae=function(){return _0x4d95f0;};return a240_0xf2ae();}(function(_0x4631cc,_0x1c3842){const _0x92b8cc=a240_0x2347,_0x59a2c6=_0x4631cc();while(!![]){try{const _0x5a573c=-parseInt(_0x92b8cc(0x90))/0x1*(-parseInt(_0x92b8cc(0x8a))/0x2)+-parseInt(_0x92b8cc(0x92))/0x3*(parseInt(_0x92b8cc(0x8f))/0x4)+-parseInt(_0x92b8cc(0x91))/0x5+-parseInt(_0x92b8cc(0x9d))/0x6+parseInt(_0x92b8cc(0x88))/0x7*(-parseInt(_0x92b8cc(0x9c))/0x8)+parseInt(_0x92b8cc(0x89))/0x9*(parseInt(_0x92b8cc(0x99))/0xa)+parseInt(_0x92b8cc(0x9b))/0xb;if(_0x5a573c===_0x1c3842)break;else _0x59a2c6['push'](_0x59a2c6['shift']());}catch(_0x1138bf){_0x59a2c6['push'](_0x59a2c6['shift']());}}}(a240_0xf2ae,0xc502e));import{getAppRule}from'../../core/api-client.js';function a240_0x2347(_0x42045b,_0x555ec5){_0x42045b=_0x42045b-0x88;const _0xf2ae92=a240_0xf2ae();let _0x2347db=_0xf2ae92[_0x42045b];return _0x2347db;}import{APP_RULE_TYPE_FLAG,appRuleError,appRuleFileName,projectAppRule,readAppRuleType}from'../../commands/rule/shared.js';export const ruleGet={'service':a240_0x3523fa(0x8d),'command':a240_0x3523fa(0x8e),'description':'Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','risk':a240_0x3523fa(0x8c),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x529f69){readAppRuleType(_0x529f69);},async 'execute'(_0x47919c){const _0x571301=a240_0x3523fa,_0x4cf9c3=readAppRuleType(_0x47919c),_0xfa5027=await getAppRule(_0x47919c[_0x571301(0x98)],{'appCode':_0x47919c['appCode'],'type':_0x4cf9c3});if(!_0xfa5027)throw appRuleError(_0x571301(0x8b),appRuleFileName(_0x4cf9c3)+_0x571301(0x97)+_0x47919c[_0x571301(0x95)]+'.',_0x571301(0x96)+_0x4cf9c3+'\x20--file\x20<path>\x20--dry-run`.');return{'ok':!![],'data':{'rule':{...projectAppRule(_0x4cf9c3,_0xfa5027),'content':_0xfa5027[_0x571301(0x94)]}},'message':_0x571301(0x9a)+appRuleFileName(_0x4cf9c3)+_0x571301(0x93)+_0x47919c[_0x571301(0x95)]};}};
1
+ const a240_0x3a059c=a240_0x2732;(function(_0x508e81,_0x68697a){const _0x261ac8=a240_0x2732,_0x28225d=_0x508e81();while(!![]){try{const _0x2f8c57=-parseInt(_0x261ac8(0x122))/0x1*(parseInt(_0x261ac8(0x12a))/0x2)+-parseInt(_0x261ac8(0x131))/0x3*(-parseInt(_0x261ac8(0x123))/0x4)+-parseInt(_0x261ac8(0x129))/0x5*(parseInt(_0x261ac8(0x12c))/0x6)+-parseInt(_0x261ac8(0x126))/0x7*(-parseInt(_0x261ac8(0x121))/0x8)+parseInt(_0x261ac8(0x12b))/0x9*(parseInt(_0x261ac8(0x12d))/0xa)+-parseInt(_0x261ac8(0x124))/0xb+-parseInt(_0x261ac8(0x11c))/0xc*(parseInt(_0x261ac8(0x130))/0xd);if(_0x2f8c57===_0x68697a)break;else _0x28225d['push'](_0x28225d['shift']());}catch(_0x9920d1){_0x28225d['push'](_0x28225d['shift']());}}}(a240_0x18e2,0x22648));import{getAppRule}from'../../core/api-client.js';function a240_0x2732(_0x22f09e,_0xdae7e3){_0x22f09e=_0x22f09e-0x11c;const _0x18e2d8=a240_0x18e2();let _0x27324f=_0x18e2d8[_0x22f09e];return _0x27324f;}import{APP_RULE_TYPE_FLAG,appRuleError,appRuleFileName,projectAppRule,readAppRuleType}from'../../commands/rule/shared.js';export const ruleGet={'service':a240_0x3a059c(0x127),'command':'get','description':'Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','risk':a240_0x3a059c(0x12f),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x53c73b){readAppRuleType(_0x53c73b);},async 'execute'(_0x29077f){const _0x5840ef=a240_0x3a059c,_0x5934d9=readAppRuleType(_0x29077f),_0x28fe6c=await getAppRule(_0x29077f[_0x5840ef(0x11f)],{'appCode':_0x29077f[_0x5840ef(0x132)],'type':_0x5934d9});if(!_0x28fe6c)throw appRuleError(_0x5840ef(0x11e),appRuleFileName(_0x5934d9)+_0x5840ef(0x125)+_0x29077f[_0x5840ef(0x132)]+'.',_0x5840ef(0x128)+_0x5934d9+_0x5840ef(0x11d));return{'ok':!![],'data':{'rule':{...projectAppRule(_0x5934d9,_0x28fe6c),'content':_0x28fe6c[_0x5840ef(0x12e)]}},'message':'Loaded\x20'+appRuleFileName(_0x5934d9)+_0x5840ef(0x120)+_0x29077f['appCode']};}};function a240_0x18e2(){const _0x16dd1d=['112qYnClf','459HplGDD','186rIpSwB','53190vkANyc','content','read','377416cBenpZ','829659xoOmja','appCode','24yqVsOF','\x20--file\x20<path>\x20--dry-run`.','app_rule_not_found','cookie','\x20for\x20','12632oxgazr','3379YYqHyw','4GNTtWX','670560srnLkA','\x20is\x20not\x20configured\x20for\x20app\x20','427erqcoY','rule','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20','31455MVMXoZ'];a240_0x18e2=function(){return _0x16dd1d;};return a240_0x18e2();}
@@ -1 +1 @@
1
- const a241_0x99a3c8=a241_0x4bba;(function(_0x96835f,_0x36afc6){const _0x211fab=a241_0x4bba,_0x5d90a8=_0x96835f();while(!![]){try{const _0x158eee=parseInt(_0x211fab(0x18b))/0x1*(-parseInt(_0x211fab(0x18f))/0x2)+-parseInt(_0x211fab(0x18c))/0x3*(-parseInt(_0x211fab(0x192))/0x4)+-parseInt(_0x211fab(0x191))/0x5*(parseInt(_0x211fab(0x18e))/0x6)+-parseInt(_0x211fab(0x196))/0x7*(-parseInt(_0x211fab(0x195))/0x8)+parseInt(_0x211fab(0x18d))/0x9+parseInt(_0x211fab(0x18a))/0xa+-parseInt(_0x211fab(0x189))/0xb;if(_0x158eee===_0x36afc6)break;else _0x5d90a8['push'](_0x5d90a8['shift']());}catch(_0x4d2633){_0x5d90a8['push'](_0x5d90a8['shift']());}}}(a241_0x3f4b,0x2adcf));import{withKbManagementSession}from'../../core/kb-management-client.js';import{ruleGet}from'../../commands/rule/get.js';function a241_0x4bba(_0x5e3938,_0x254719){_0x5e3938=_0x5e3938-0x189;const _0x3f4b0c=a241_0x3f4b();let _0x4bba85=_0x3f4b0c[_0x5e3938];return _0x4bba85;}function a241_0x3f4b(){const _0x304cac=['signal','17905ejxFEv','16xSMZAN','dryRun','map','88vSmoRA','95809pKkbnF','1221242SBhUrf','997130lhKWOc','61678GjrMcL','128031dOJXTF','2221191veuveO','432HiOGZZ','4ZMghGL'];a241_0x3f4b=function(){return _0x304cac;};return a241_0x3f4b();}import{ruleList}from'../../commands/rule/list.js';import{ruleSet}from'../../commands/rule/set.js';export const ruleDefinitions=[ruleList,ruleGet,ruleSet][a241_0x99a3c8(0x194)](_0x2c3b61=>({..._0x2c3b61,'execute':_0x106589=>withKbManagementSession(_0x106589[a241_0x99a3c8(0x190)],()=>_0x2c3b61['execute'](_0x106589)),..._0x2c3b61[a241_0x99a3c8(0x193)]?{'dryRun':_0x2c93fa=>withKbManagementSession(_0x2c93fa[a241_0x99a3c8(0x190)],()=>_0x2c3b61[a241_0x99a3c8(0x193)](_0x2c93fa))}:{}}));
1
+ const a241_0x3b1d39=a241_0x2915;function a241_0x25d0(){const _0xe1932a=['16aZBAsF','2852055nGdSSP','991368AxSupN','dryRun','330743qfPZCw','execute','2949RksERO','639238nGiCeo','4990968OHYxQg','3288rJkpxV','map','signal','529555fwTWeM'];a241_0x25d0=function(){return _0xe1932a;};return a241_0x25d0();}(function(_0xddcffa,_0x4fdd31){const _0x4636f7=a241_0x2915,_0x2c8940=_0xddcffa();while(!![]){try{const _0x53426f=parseInt(_0x4636f7(0x113))/0x1+-parseInt(_0x4636f7(0x10e))/0x2+-parseInt(_0x4636f7(0x112))/0x3*(parseInt(_0x4636f7(0x115))/0x4)+parseInt(_0x4636f7(0x10b))/0x5+parseInt(_0x4636f7(0x114))/0x6+parseInt(_0x4636f7(0x110))/0x7*(parseInt(_0x4636f7(0x10c))/0x8)+parseInt(_0x4636f7(0x10d))/0x9;if(_0x53426f===_0x4fdd31)break;else _0x2c8940['push'](_0x2c8940['shift']());}catch(_0xe231ed){_0x2c8940['push'](_0x2c8940['shift']());}}}(a241_0x25d0,0xa7274));import{withKbManagementSession}from'../../core/kb-management-client.js';function a241_0x2915(_0xec1034,_0x2a6331){_0xec1034=_0xec1034-0x10a;const _0x25d056=a241_0x25d0();let _0x2915ab=_0x25d056[_0xec1034];return _0x2915ab;}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][a241_0x3b1d39(0x116)](_0x4b995e=>({..._0x4b995e,'execute':_0x490c2d=>withKbManagementSession(_0x490c2d[a241_0x3b1d39(0x10a)],()=>_0x4b995e[a241_0x3b1d39(0x111)](_0x490c2d)),..._0x4b995e[a241_0x3b1d39(0x10f)]?{'dryRun':_0x26783a=>withKbManagementSession(_0x26783a[a241_0x3b1d39(0x10a)],()=>_0x4b995e[a241_0x3b1d39(0x10f)](_0x26783a))}:{}}));
@@ -1 +1 @@
1
- function a242_0x1e79(){const _0x35eba7=['880292QiFrbT','appCode','all','list','rule','40072oRNArw','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','Loaded\x20app\x20rule\x20configuration\x20for\x20','10cdxQgp','29080oUMrzK','2466KvpDFp','6607376EBKtHV','1851294FhcKSz','map','7FetSZS','2073072qKkliA','862532mwNExX'];a242_0x1e79=function(){return _0x35eba7;};return a242_0x1e79();}function a242_0x1e4b(_0x5994ad,_0x2db2e8){_0x5994ad=_0x5994ad-0xcd;const _0x1e79c5=a242_0x1e79();let _0x1e4b5a=_0x1e79c5[_0x5994ad];return _0x1e4b5a;}const a242_0x1cce6f=a242_0x1e4b;(function(_0x1a20c9,_0x163c39){const _0x42b07a=a242_0x1e4b,_0x2a1906=_0x1a20c9();while(!![]){try{const _0x4f59e6=-parseInt(_0x42b07a(0xd5))/0x1+parseInt(_0x42b07a(0xd0))/0x2+parseInt(_0x42b07a(0xdc))/0x3+parseInt(_0x42b07a(0xcf))/0x4+-parseInt(_0x42b07a(0xd8))/0x5*(parseInt(_0x42b07a(0xce))/0x6)+-parseInt(_0x42b07a(0xcd))/0x7*(-parseInt(_0x42b07a(0xdb))/0x8)+-parseInt(_0x42b07a(0xda))/0x9*(parseInt(_0x42b07a(0xd9))/0xa);if(_0x4f59e6===_0x163c39)break;else _0x2a1906['push'](_0x2a1906['shift']());}catch(_0xa94793){_0x2a1906['push'](_0x2a1906['shift']());}}}(a242_0x1e79,0x8b61f));import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':a242_0x1cce6f(0xd4),'command':a242_0x1cce6f(0xd3),'description':a242_0x1cce6f(0xd6),'risk':'read','requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x551637){const _0x331f1e=a242_0x1cce6f,_0x4165f9=await Promise[_0x331f1e(0xd2)](APP_RULE_TYPES[_0x331f1e(0xdd)](_0x371a81=>getAppRule(_0x551637['cookie'],{'appCode':_0x551637[_0x331f1e(0xd1)],'type':_0x371a81}))),_0x5880a2=APP_RULE_TYPES['map']((_0x53a083,_0x3ce8de)=>projectAppRule(_0x53a083,_0x4165f9[_0x3ce8de]??null));return{'ok':!![],'data':{'total':_0x5880a2['length'],'rules':_0x5880a2},'message':_0x331f1e(0xd7)+_0x551637[_0x331f1e(0xd1)]};}};
1
+ const a242_0x5e3137=a242_0x1603;function a242_0x4b26(){const _0xd85fa7=['79472WyFoth','69ekAvtP','read','3352761xgrtWs','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','2470000BQZpps','243506tSxQSl','Loaded\x20app\x20rule\x20configuration\x20for\x20','5823640uSAogq','4190538wYvDaL','2017736gpRkXT','2bmQiSu','8qbSPZv','cookie','length','map','appCode'];a242_0x4b26=function(){return _0xd85fa7;};return a242_0x4b26();}(function(_0x1226eb,_0xb5b071){const _0x457e30=a242_0x1603,_0x201695=_0x1226eb();while(!![]){try{const _0x5be033=-parseInt(_0x457e30(0x1db))/0x1*(-parseInt(_0x457e30(0x1e7))/0x2)+-parseInt(_0x457e30(0x1e2))/0x3*(-parseInt(_0x457e30(0x1e1))/0x4)+parseInt(_0x457e30(0x1d8))/0x5+-parseInt(_0x457e30(0x1d9))/0x6+parseInt(_0x457e30(0x1da))/0x7+-parseInt(_0x457e30(0x1dc))/0x8*(parseInt(_0x457e30(0x1e4))/0x9)+-parseInt(_0x457e30(0x1e6))/0xa;if(_0x5be033===_0xb5b071)break;else _0x201695['push'](_0x201695['shift']());}catch(_0x400ad3){_0x201695['push'](_0x201695['shift']());}}}(a242_0x4b26,0xcbfa6));import{getAppRule}from'../../core/api-client.js';function a242_0x1603(_0x2044d2,_0x3eaa6d){_0x2044d2=_0x2044d2-0x1d8;const _0x4b2616=a242_0x4b26();let _0x1603cf=_0x4b2616[_0x2044d2];return _0x1603cf;}import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':'rule','command':'list','description':a242_0x5e3137(0x1e5),'risk':a242_0x5e3137(0x1e3),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0x5cea91){const _0x1f5ce0=a242_0x5e3137,_0x27a3fd=await Promise['all'](APP_RULE_TYPES[_0x1f5ce0(0x1df)](_0x35b9fa=>getAppRule(_0x5cea91[_0x1f5ce0(0x1dd)],{'appCode':_0x5cea91[_0x1f5ce0(0x1e0)],'type':_0x35b9fa}))),_0x2ef084=APP_RULE_TYPES['map']((_0x98df8f,_0xa544bf)=>projectAppRule(_0x98df8f,_0x27a3fd[_0xa544bf]??null));return{'ok':!![],'data':{'total':_0x2ef084[_0x1f5ce0(0x1de)],'rules':_0x2ef084},'message':_0x1f5ce0(0x1e8)+_0x5cea91[_0x1f5ce0(0x1e0)]};}};
@@ -1 +1 @@
1
- function a243_0x18c4(){const _0x78365e=['app_rule_set_outcome_unknown','1676820fDIvrE','\x20--format\x20compress','7397UlrtnE','app_rule_expected_version_invalid','rules','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','POST','push','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','expected-version','str','RULES\x20content\x20exceeds\x202000\x20UTF-16\x20units.','app_rule_verification_failed','byteSize','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','update','unconfigured','cause','Set\x20','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','planned','isSafeInteger','version','1654620eiaAvP','\x20version\x20changed\x20before\x20write.','set','--file\x20is\x20required.','replacement','rule','contentHash','beforeRecord','\x20could\x20not\x20be\x20verified.','number','\x20for\x20','string','trim','app_rule_version_mismatch','input','The\x20received\x20rule\x20state\x20contradicts\x20the\x20requested\x20changes.','file','1062018SvgPTq','4278169mJdqWm','Require\x20the\x20current\x20version\x20before\x20atomic\x20compare-and-set','verified','appCode','UTF-8\x20Markdown\x20file\x20(RULES:\x202000\x20UTF-16\x20units;\x20DATABASE:\x205242880\x20units)','expectedVersion','cookie','defineProperty','26AeloRk','78960JUOejb','943032XRRzbv','content','before',';\x20current\x20version\x20is\x20','app_rule_file_required','create','type','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.'];a243_0x18c4=function(){return _0x78365e;};return a243_0x18c4();}const a243_0x3c8b44=a243_0x358e;(function(_0x4060d9,_0x58525d){const _0x110eae=a243_0x358e,_0xeb5516=_0x4060d9();while(!![]){try{const _0x3c9745=parseInt(_0x110eae(0xbe))/0x1*(-parseInt(_0x110eae(0xb1))/0x2)+parseInt(_0x110eae(0xbc))/0x3+parseInt(_0x110eae(0xd3))/0x4+-parseInt(_0x110eae(0xb2))/0x5+parseInt(_0x110eae(0xa8))/0x6+-parseInt(_0x110eae(0xa9))/0x7+-parseInt(_0x110eae(0xb3))/0x8;if(_0x3c9745===_0x58525d)break;else _0xeb5516['push'](_0xeb5516['shift']());}catch(_0x532b24){_0xeb5516['push'](_0xeb5516['shift']());}}}(a243_0x18c4,0x4b577));import{knowledgeDocumentsPath}from'../../core/api-client.js';import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';function readSetInput(_0x4a9d8a){const _0x41d680=a243_0x358e,_0x3eaea2=readAppRuleType(_0x4a9d8a),_0x20dc9d=_0x4a9d8a[_0x41d680(0xc6)]('file')[_0x41d680(0xa3)]();if(!_0x20dc9d)throw appRuleError(_0x41d680(0xb7),_0x41d680(0xd6),'Pass\x20a\x20UTF-8\x20Markdown\x20file.');const _0x41b76a=_0x4a9d8a['flag'](_0x41d680(0xc5));let _0x38dd3a;if(_0x41b76a!==undefined){_0x38dd3a=Number(_0x41b76a);if(!Number[_0x41d680(0xd1)](_0x38dd3a)||_0x38dd3a<0x0)throw appRuleError(_0x41d680(0xbf),'--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.');}return{'type':_0x3eaea2,'file':_0x20dc9d,'expectedVersion':_0x38dd3a};}async function prepareSet(_0x54ba5c){const _0x469d57=a243_0x358e,_0x1c8c9b=readSetInput(_0x54ba5c),_0x3ff889=await readAppRuleFile(_0x1c8c9b[_0x469d57(0xa7)]);if(_0x1c8c9b[_0x469d57(0xb9)]===_0x469d57(0xc0)&&_0x3ff889[_0x469d57(0xb4)]['length']>0x7d0)throw appRuleError('app_rule_content_too_large',_0x469d57(0xc7));const _0x4970a5=await getAppRule(_0x54ba5c[_0x469d57(0xaf)],{'appCode':_0x54ba5c[_0x469d57(0xac)],'type':_0x1c8c9b[_0x469d57(0xb9)]});if(_0x1c8c9b[_0x469d57(0xae)]!==undefined&&(_0x4970a5?.[_0x469d57(0xd2)]??0x0)!==_0x1c8c9b[_0x469d57(0xae)])throw appRuleError(_0x469d57(0xa4),appRuleFileName(_0x1c8c9b[_0x469d57(0xb9)])+_0x469d57(0xd4),'Expected\x20'+_0x1c8c9b['expectedVersion']+_0x469d57(0xb6)+(_0x4970a5?.['version']??_0x469d57(0xcc))+_0x469d57(0xba));return{'input':_0x1c8c9b,'replacement':_0x3ff889,'beforeRecord':_0x4970a5,'before':projectAppRule(_0x1c8c9b[_0x469d57(0xb9)],_0x4970a5),'planned':{'type':_0x1c8c9b[_0x469d57(0xb9)],'fileName':appRuleFileName(_0x1c8c9b[_0x469d57(0xb9)]),'contextScope':appRuleContextScope(_0x1c8c9b['type']),'enabled':!![],'appCode':_0x54ba5c[_0x469d57(0xac)],'scope':'rules','contentByteSize':_0x3ff889['byteSize'],'contentHash':_0x3ff889[_0x469d57(0xd9)]}};}function warningsFor(_0x94239){return[];}function a243_0x358e(_0x2f322e,_0x528aaa){_0x2f322e=_0x2f322e-0x9f;const _0x18c45b=a243_0x18c4();let _0x358eba=_0x18c45b[_0x2f322e];return _0x358eba;}export const ruleSet={'service':a243_0x3c8b44(0xd8),'command':a243_0x3c8b44(0xd5),'description':a243_0x3c8b44(0xc4),'risk':'write','requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a243_0x3c8b44(0xa7),'type':a243_0x3c8b44(0xa2),'required':!![],'description':a243_0x3c8b44(0xad)},{'name':a243_0x3c8b44(0xc5),'type':a243_0x3c8b44(0xa0),'required':![],'description':a243_0x3c8b44(0xaa)}],async 'validate'(_0x42d3dd){readSetInput(_0x42d3dd);},async 'dryRun'(_0x58773e){const _0x42d439=a243_0x3c8b44,_0x280699=await prepareSet(_0x58773e);return asDryRunResult({'operation':_0x42d439(0xd5),'selector':{'appCode':_0x58773e['appCode'],'scope':_0x42d439(0xc0),'type':_0x280699[_0x42d439(0xa5)][_0x42d439(0xb9)]},'before':_0x280699[_0x42d439(0xb5)],'after':_0x280699[_0x42d439(0xd0)],'dryRun':!![],'backend':{'method':_0x42d439(0xc2),'path':knowledgeDocumentsPath('rules',_0x280699[_0x42d439(0xda)]?_0x42d439(0xcb):'create'),'body':{'appCode':_0x58773e['appCode'],..._0x280699[_0x42d439(0xda)]?{'id':_0x280699[_0x42d439(0xda)]['id']}:{},'title':_0x280699['input']['type']===_0x42d439(0xc0)?'RULES':'DATABASE','contentHash':_0x280699[_0x42d439(0xd7)][_0x42d439(0xd9)],'contentByteSize':_0x280699['replacement'][_0x42d439(0xc9)],..._0x280699[_0x42d439(0xda)]?{'expectedVersion':_0x280699['beforeRecord'][_0x42d439(0xd2)]}:{}}},'warnings':warningsFor(_0x280699[_0x42d439(0xa5)]['expectedVersion']),'verification':{'expectedVersion':_0x280699[_0x42d439(0xda)]?.[_0x42d439(0xd2)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':'rabetbase\x20rule\x20get\x20--type\x20'+_0x280699[_0x42d439(0xa5)][_0x42d439(0xb9)]+_0x42d439(0xbd)}},{'method':'POST','url':knowledgeDocumentsPath(_0x42d439(0xc0),_0x280699[_0x42d439(0xda)]?'update':_0x42d439(0xb8))});},async 'execute'(_0x1d0061){const _0x722575=a243_0x3c8b44,_0x14d833=await prepareSet(_0x1d0061),_0x2908f6=_0x14d833['beforeRecord']===null?0x1:_0x14d833[_0x722575(0xda)][_0x722575(0xd2)]+(_0x14d833['beforeRecord'][_0x722575(0xb4)]===_0x14d833[_0x722575(0xd7)][_0x722575(0xb4)]?0x0:0x1);let _0x386c0d,_0x19eb55=![];try{_0x386c0d=await saveAppRule(_0x1d0061[_0x722575(0xaf)],{'appCode':_0x1d0061[_0x722575(0xac)],'type':_0x14d833[_0x722575(0xa5)]['type'],'content':_0x14d833[_0x722575(0xd7)][_0x722575(0xb4)],'expectedVersion':_0x14d833['beforeRecord']?.['version']??0x0,..._0x14d833[_0x722575(0xda)]?{'id':_0x14d833[_0x722575(0xda)]['id']}:{}});if(_0x386c0d[_0x722575(0xd2)]!==_0x2908f6||_0x386c0d[_0x722575(0xb4)]!==_0x14d833[_0x722575(0xd7)]['content']||_0x14d833[_0x722575(0xda)]!==null&&_0x386c0d['id']!==_0x14d833[_0x722575(0xda)]['id'])throw appRuleError(_0x722575(0xc8),_0x722575(0xa6),'Use\x20read-only\x20rule\x20reconciliation;\x20do\x20not\x20resubmit\x20automatically.');}catch(_0x177b8a){if(!isPlatformTransportFailure(_0x177b8a))throw _0x177b8a;_0x19eb55=!![];}let _0x33657b;try{_0x33657b=await getAppRule(_0x1d0061['cookie'],{'appCode':_0x1d0061[_0x722575(0xac)],'type':_0x14d833[_0x722575(0xa5)][_0x722575(0xb9)]});}catch(_0x5272a8){const _0xc0af7f=appRuleError(_0x19eb55?'app_rule_set_outcome_unknown':'app_rule_verification_unavailable','The\x20set\x20request\x20was\x20sent,\x20but\x20'+appRuleFileName(_0x14d833['input']['type'])+_0x722575(0x9f),'Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.');Object[_0x722575(0xb0)](_0xc0af7f,_0x722575(0xcd),{'value':_0x5272a8,'enumerable':![]});throw _0xc0af7f;}const _0x571e9a=_0x33657b&&inspectAppRuleContent(_0x33657b[_0x722575(0xb4)])[_0x722575(0xd9)]===_0x14d833[_0x722575(0xd7)]['contentHash'],_0x427b1c=_0x33657b&&_0x33657b[_0x722575(0xd2)]===_0x2908f6&&(!_0x386c0d||_0x33657b['id']===_0x386c0d['id']&&_0x33657b[_0x722575(0xd2)]===_0x386c0d[_0x722575(0xd2)]);if(!_0x33657b||!_0x571e9a||!_0x427b1c||_0x14d833[_0x722575(0xda)]!==null&&_0x33657b['id']!==_0x14d833[_0x722575(0xda)]['id'])throw appRuleError(_0x19eb55?_0x722575(0xbb):'app_rule_verification_failed',appRuleFileName(_0x14d833[_0x722575(0xa5)][_0x722575(0xb9)])+_0x722575(0xc1),_0x722575(0xca)+_0x14d833[_0x722575(0xa5)][_0x722575(0xb9)]+'\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.');const _0x21f047=warningsFor(_0x14d833[_0x722575(0xa5)][_0x722575(0xae)]);_0x19eb55&&_0x21f047[_0x722575(0xc3)](_0x722575(0xcf));const _0x41c418=projectAppRule(_0x14d833[_0x722575(0xa5)][_0x722575(0xb9)],_0x33657b);return{'ok':!![],'data':{'operation':_0x722575(0xd5),'selector':{'appCode':_0x1d0061[_0x722575(0xac)],'scope':_0x722575(0xc0),'type':_0x14d833[_0x722575(0xa5)][_0x722575(0xb9)]},'before':_0x14d833['before'],'after':_0x41c418,'dryRun':![],'backend':{'method':_0x722575(0xc2),'path':knowledgeDocumentsPath(_0x722575(0xc0),_0x14d833['beforeRecord']?'update':_0x722575(0xb8))},'warnings':_0x21f047,'verification':{'status':_0x722575(0xab),'recoveredAfterUnknownResponse':_0x19eb55,'expectedVersion':_0x14d833[_0x722575(0xda)]?.['version']??0x0,'atomicCompareAndSet':!![],'lookupCommand':'rabetbase\x20rule\x20get\x20--type\x20'+_0x14d833[_0x722575(0xa5)]['type']+_0x722575(0xbd)}},'message':_0x722575(0xce)+appRuleFileName(_0x14d833[_0x722575(0xa5)][_0x722575(0xb9)])+_0x722575(0xa1)+_0x1d0061[_0x722575(0xac)]};}};
1
+ const a243_0x3a4a87=a243_0x457a;(function(_0x5307f8,_0x1676fe){const _0x2e32f3=a243_0x457a,_0x525b34=_0x5307f8();while(!![]){try{const _0x528312=-parseInt(_0x2e32f3(0xc2))/0x1+-parseInt(_0x2e32f3(0xd4))/0x2+-parseInt(_0x2e32f3(0xec))/0x3*(-parseInt(_0x2e32f3(0xcf))/0x4)+-parseInt(_0x2e32f3(0xf5))/0x5*(-parseInt(_0x2e32f3(0xf4))/0x6)+parseInt(_0x2e32f3(0xd7))/0x7*(-parseInt(_0x2e32f3(0xde))/0x8)+parseInt(_0x2e32f3(0xf1))/0x9+parseInt(_0x2e32f3(0xea))/0xa*(parseInt(_0x2e32f3(0xd6))/0xb);if(_0x528312===_0x1676fe)break;else _0x525b34['push'](_0x525b34['shift']());}catch(_0x13ac74){_0x525b34['push'](_0x525b34['shift']());}}}(a243_0x25e2,0x3c434));function a243_0x457a(_0x481ab8,_0x16d318){_0x481ab8=_0x481ab8-0xc1;const _0x25e220=a243_0x25e2();let _0x457a08=_0x25e220[_0x481ab8];return _0x457a08;}import{knowledgeDocumentsPath}from'../../core/api-client.js';import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';function a243_0x25e2(){const _0x3945c2=['Require\x20the\x20current\x20version\x20before\x20atomic\x20compare-and-set','6egYoKl','1842890hzxHxQ','app_rule_content_too_large','DATABASE','isSafeInteger','input','length','unconfigured','beforeRecord','Pass\x20a\x20UTF-8\x20Markdown\x20file.','appCode','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','31864tfawxe','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','rules','app_rule_verification_unavailable','\x20for\x20','\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.','file','type','replacement','expected-version','string','Expected\x20','byteSize','20XFVjHe','The\x20received\x20rule\x20state\x20contradicts\x20the\x20requested\x20changes.','--file\x20is\x20required.','app_rule_set_outcome_unknown',';\x20current\x20version\x20is\x20','818984NpIOpz','\x20--format\x20compress','1211947QihOix','2480086IoViji','cookie','RULES','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','POST','flag','The\x20set\x20request\x20was\x20sent,\x20but\x20','8sEfSHV','update','verified','push','number','before','contentHash','planned','content','set','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','app_rule_verification_failed','10tfYFsK','\x20could\x20not\x20be\x20verified.','100797wzvKcT','rabetbase\x20rule\x20get\x20--type\x20','RULES\x20content\x20exceeds\x202000\x20UTF-16\x20units.','expectedVersion','version','3561660hANhoc','create'];a243_0x25e2=function(){return _0x3945c2;};return a243_0x25e2();}import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';function readSetInput(_0x7e0133){const _0x1073f6=a243_0x457a,_0x3f6d7d=readAppRuleType(_0x7e0133),_0x4815d3=_0x7e0133['str'](_0x1073f6(0xc8))['trim']();if(!_0x4815d3)throw appRuleError('app_rule_file_required',_0x1073f6(0xd1),_0x1073f6(0xfd));const _0x2520cb=_0x7e0133[_0x1073f6(0xdc)](_0x1073f6(0xcb));let _0x15e25a;if(_0x2520cb!==undefined){_0x15e25a=Number(_0x2520cb);if(!Number[_0x1073f6(0xf8)](_0x15e25a)||_0x15e25a<0x0)throw appRuleError('app_rule_expected_version_invalid','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.');}return{'type':_0x3f6d7d,'file':_0x4815d3,'expectedVersion':_0x15e25a};}async function prepareSet(_0x1cf1ca){const _0x400dfb=a243_0x457a,_0x1ba3ad=readSetInput(_0x1cf1ca),_0x4cca26=await readAppRuleFile(_0x1ba3ad[_0x400dfb(0xc8)]);if(_0x1ba3ad['type']===_0x400dfb(0xc4)&&_0x4cca26[_0x400dfb(0xe6)][_0x400dfb(0xfa)]>0x7d0)throw appRuleError(_0x400dfb(0xf6),_0x400dfb(0xee));const _0x2adbaa=await getAppRule(_0x1cf1ca[_0x400dfb(0xd8)],{'appCode':_0x1cf1ca[_0x400dfb(0xfe)],'type':_0x1ba3ad[_0x400dfb(0xc9)]});if(_0x1ba3ad['expectedVersion']!==undefined&&(_0x2adbaa?.['version']??0x0)!==_0x1ba3ad[_0x400dfb(0xef)])throw appRuleError('app_rule_version_mismatch',appRuleFileName(_0x1ba3ad[_0x400dfb(0xc9)])+'\x20version\x20changed\x20before\x20write.',_0x400dfb(0xcd)+_0x1ba3ad[_0x400dfb(0xef)]+_0x400dfb(0xd3)+(_0x2adbaa?.[_0x400dfb(0xf0)]??_0x400dfb(0xfb))+_0x400dfb(0xe8));return{'input':_0x1ba3ad,'replacement':_0x4cca26,'beforeRecord':_0x2adbaa,'before':projectAppRule(_0x1ba3ad[_0x400dfb(0xc9)],_0x2adbaa),'planned':{'type':_0x1ba3ad[_0x400dfb(0xc9)],'fileName':appRuleFileName(_0x1ba3ad['type']),'contextScope':appRuleContextScope(_0x1ba3ad[_0x400dfb(0xc9)]),'enabled':!![],'appCode':_0x1cf1ca[_0x400dfb(0xfe)],'scope':'rules','contentByteSize':_0x4cca26['byteSize'],'contentHash':_0x4cca26[_0x400dfb(0xe4)]}};}function warningsFor(_0x32ecbe){return[];}export const ruleSet={'service':'rule','command':a243_0x3a4a87(0xe7),'description':'Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','risk':'write','requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a243_0x3a4a87(0xc8),'type':a243_0x3a4a87(0xcc),'required':!![],'description':'UTF-8\x20Markdown\x20file\x20(RULES:\x202000\x20UTF-16\x20units;\x20DATABASE:\x205242880\x20units)'},{'name':'expected-version','type':a243_0x3a4a87(0xe2),'required':![],'description':a243_0x3a4a87(0xf3)}],async 'validate'(_0x4dd49b){readSetInput(_0x4dd49b);},async 'dryRun'(_0x15df51){const _0x1b2760=a243_0x3a4a87,_0x482f62=await prepareSet(_0x15df51);return asDryRunResult({'operation':_0x1b2760(0xe7),'selector':{'appCode':_0x15df51[_0x1b2760(0xfe)],'scope':'rules','type':_0x482f62[_0x1b2760(0xf9)][_0x1b2760(0xc9)]},'before':_0x482f62[_0x1b2760(0xe3)],'after':_0x482f62[_0x1b2760(0xe5)],'dryRun':!![],'backend':{'method':_0x1b2760(0xdb),'path':knowledgeDocumentsPath('rules',_0x482f62[_0x1b2760(0xfc)]?_0x1b2760(0xdf):_0x1b2760(0xf2)),'body':{'appCode':_0x15df51['appCode'],..._0x482f62[_0x1b2760(0xfc)]?{'id':_0x482f62[_0x1b2760(0xfc)]['id']}:{},'title':_0x482f62[_0x1b2760(0xf9)][_0x1b2760(0xc9)]===_0x1b2760(0xc4)?_0x1b2760(0xd9):_0x1b2760(0xf7),'contentHash':_0x482f62[_0x1b2760(0xca)][_0x1b2760(0xe4)],'contentByteSize':_0x482f62[_0x1b2760(0xca)][_0x1b2760(0xce)],..._0x482f62[_0x1b2760(0xfc)]?{'expectedVersion':_0x482f62['beforeRecord'][_0x1b2760(0xf0)]}:{}}},'warnings':warningsFor(_0x482f62[_0x1b2760(0xf9)]['expectedVersion']),'verification':{'expectedVersion':_0x482f62['beforeRecord']?.['version']??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x1b2760(0xed)+_0x482f62['input'][_0x1b2760(0xc9)]+_0x1b2760(0xd5)}},{'method':_0x1b2760(0xdb),'url':knowledgeDocumentsPath(_0x1b2760(0xc4),_0x482f62[_0x1b2760(0xfc)]?'update':_0x1b2760(0xf2))});},async 'execute'(_0x542289){const _0x4b71c7=a243_0x3a4a87,_0x463058=await prepareSet(_0x542289),_0x47b545=_0x463058[_0x4b71c7(0xfc)]===null?0x1:_0x463058[_0x4b71c7(0xfc)][_0x4b71c7(0xf0)]+(_0x463058[_0x4b71c7(0xfc)][_0x4b71c7(0xe6)]===_0x463058[_0x4b71c7(0xca)][_0x4b71c7(0xe6)]?0x0:0x1);let _0x190d8e,_0x5501cf=![];try{_0x190d8e=await saveAppRule(_0x542289[_0x4b71c7(0xd8)],{'appCode':_0x542289['appCode'],'type':_0x463058[_0x4b71c7(0xf9)][_0x4b71c7(0xc9)],'content':_0x463058[_0x4b71c7(0xca)][_0x4b71c7(0xe6)],'expectedVersion':_0x463058[_0x4b71c7(0xfc)]?.[_0x4b71c7(0xf0)]??0x0,..._0x463058[_0x4b71c7(0xfc)]?{'id':_0x463058[_0x4b71c7(0xfc)]['id']}:{}});if(_0x190d8e[_0x4b71c7(0xf0)]!==_0x47b545||_0x190d8e[_0x4b71c7(0xe6)]!==_0x463058['replacement']['content']||_0x463058[_0x4b71c7(0xfc)]!==null&&_0x190d8e['id']!==_0x463058[_0x4b71c7(0xfc)]['id'])throw appRuleError('app_rule_verification_failed',_0x4b71c7(0xd0),'Use\x20read-only\x20rule\x20reconciliation;\x20do\x20not\x20resubmit\x20automatically.');}catch(_0x476125){if(!isPlatformTransportFailure(_0x476125))throw _0x476125;_0x5501cf=!![];}let _0x213f60;try{_0x213f60=await getAppRule(_0x542289[_0x4b71c7(0xd8)],{'appCode':_0x542289[_0x4b71c7(0xfe)],'type':_0x463058[_0x4b71c7(0xf9)][_0x4b71c7(0xc9)]});}catch(_0x38b4cb){const _0x15fa46=appRuleError(_0x5501cf?_0x4b71c7(0xd2):_0x4b71c7(0xc5),_0x4b71c7(0xdd)+appRuleFileName(_0x463058['input'][_0x4b71c7(0xc9)])+_0x4b71c7(0xeb),_0x4b71c7(0xda));Object['defineProperty'](_0x15fa46,'cause',{'value':_0x38b4cb,'enumerable':![]});throw _0x15fa46;}const _0x4ab1a7=_0x213f60&&inspectAppRuleContent(_0x213f60['content'])[_0x4b71c7(0xe4)]===_0x463058[_0x4b71c7(0xca)][_0x4b71c7(0xe4)],_0x4346b7=_0x213f60&&_0x213f60[_0x4b71c7(0xf0)]===_0x47b545&&(!_0x190d8e||_0x213f60['id']===_0x190d8e['id']&&_0x213f60[_0x4b71c7(0xf0)]===_0x190d8e['version']);if(!_0x213f60||!_0x4ab1a7||!_0x4346b7||_0x463058[_0x4b71c7(0xfc)]!==null&&_0x213f60['id']!==_0x463058[_0x4b71c7(0xfc)]['id'])throw appRuleError(_0x5501cf?_0x4b71c7(0xd2):_0x4b71c7(0xe9),appRuleFileName(_0x463058[_0x4b71c7(0xf9)][_0x4b71c7(0xc9)])+_0x4b71c7(0xc7),_0x4b71c7(0xc1)+_0x463058['input'][_0x4b71c7(0xc9)]+_0x4b71c7(0xc3));const _0x1c7a48=warningsFor(_0x463058['input'][_0x4b71c7(0xef)]);_0x5501cf&&_0x1c7a48[_0x4b71c7(0xe1)]('Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.');const _0x4bf8e5=projectAppRule(_0x463058['input'][_0x4b71c7(0xc9)],_0x213f60);return{'ok':!![],'data':{'operation':_0x4b71c7(0xe7),'selector':{'appCode':_0x542289[_0x4b71c7(0xfe)],'scope':_0x4b71c7(0xc4),'type':_0x463058[_0x4b71c7(0xf9)][_0x4b71c7(0xc9)]},'before':_0x463058[_0x4b71c7(0xe3)],'after':_0x4bf8e5,'dryRun':![],'backend':{'method':_0x4b71c7(0xdb),'path':knowledgeDocumentsPath(_0x4b71c7(0xc4),_0x463058[_0x4b71c7(0xfc)]?_0x4b71c7(0xdf):_0x4b71c7(0xf2))},'warnings':_0x1c7a48,'verification':{'status':_0x4b71c7(0xe0),'recoveredAfterUnknownResponse':_0x5501cf,'expectedVersion':_0x463058[_0x4b71c7(0xfc)]?.[_0x4b71c7(0xf0)]??0x0,'atomicCompareAndSet':!![],'lookupCommand':_0x4b71c7(0xed)+_0x463058['input'][_0x4b71c7(0xc9)]+_0x4b71c7(0xd5)}},'message':'Set\x20'+appRuleFileName(_0x463058[_0x4b71c7(0xf9)][_0x4b71c7(0xc9)])+_0x4b71c7(0xc6)+_0x542289[_0x4b71c7(0xfe)]};}};
@@ -1 +1 @@
1
- const a244_0x5644e6=a244_0x3da8;(function(_0x490827,_0x185418){const _0x26d0c0=a244_0x3da8,_0x1f4f38=_0x490827();while(!![]){try{const _0x4542b0=-parseInt(_0x26d0c0(0x99))/0x1*(-parseInt(_0x26d0c0(0x8d))/0x2)+parseInt(_0x26d0c0(0xa8))/0x3*(parseInt(_0x26d0c0(0x87))/0x4)+-parseInt(_0x26d0c0(0x94))/0x5*(-parseInt(_0x26d0c0(0x91))/0x6)+parseInt(_0x26d0c0(0x95))/0x7*(parseInt(_0x26d0c0(0xa3))/0x8)+-parseInt(_0x26d0c0(0x9b))/0x9+parseInt(_0x26d0c0(0x86))/0xa+-parseInt(_0x26d0c0(0xa5))/0xb;if(_0x4542b0===_0x185418)break;else _0x1f4f38['push'](_0x1f4f38['shift']());}catch(_0xe976c7){_0x1f4f38['push'](_0x1f4f38['shift']());}}}(a244_0x3bb1,0xcfe1d));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';function a244_0x3bb1(){const _0x36f038=['database','127918Bdeiji','byteSize','4862268qfbRVv','indexStatus','App\x20rule\x20content\x20exceeds\x205242880\x20UTF-16\x20units.','appCode','byteLength','str','--file\x20is\x20required.','RULES.md','8sseZxb','sha256','39531272uQvJyL','size','app_rule_content_too_large','3xOzroY','message','contentHash','utf8','from','DATABASE.md','database-analysis','string','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','hex','7650140mUTAaU','905508nDTlmh','app_rule_file_unreadable','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','App\x20rule\x20content\x20exceeds\x20the\x20bounded\x20UTF-8\x20file\x20limit.','rules','updateTime','26QocMMd','trim','app_rule_content_invalid','sha256:','9785382SfpNAE','update','createTime','5tKLFNj','4901869RZkaHN','isFile','type'];a244_0x3bb1=function(){return _0x36f038;};return a244_0x3bb1();}import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a244_0x5644e6(0x8b),'database'];export const MAX_APP_RULE_UNITS=0x5*0x400*0x400;export const MAX_APP_RULE_BYTES=MAX_APP_RULE_UNITS*0x4;const APP_RULE_FILES={'rules':a244_0x5644e6(0xa2),'database':a244_0x5644e6(0xad)},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':a244_0x5644e6(0xae)};export function appRuleError(_0x110564,_0x3433e6,_0x152929){return new CliError(_0x110564,0x1,_0x3433e6,_0x152929);}function a244_0x3da8(_0x2d3933,_0x4db1f9){_0x2d3933=_0x2d3933-0x83;const _0x3bb15b=a244_0x3bb1();let _0x3da81e=_0x3bb15b[_0x2d3933];return _0x3da81e;}export function readAppRuleType(_0x16f736){const _0x1e0ab1=a244_0x5644e6,_0x225b45=_0x16f736[_0x1e0ab1(0xa0)]('type')[_0x1e0ab1(0x8e)]()['toLowerCase']();if(_0x225b45!==_0x1e0ab1(0x8b)&&_0x225b45!==_0x1e0ab1(0x98))throw appRuleError('app_rule_type_invalid','--type\x20must\x20be\x20either\x20rules\x20or\x20database.');return _0x225b45;}export function appRuleFileName(_0x213773){return APP_RULE_FILES[_0x213773];}export function appRuleContextScope(_0x5293b2){return APP_RULE_CONTEXT_SCOPES[_0x5293b2];}export function inspectAppRuleContent(_0x26205f){const _0x1fefb3=a244_0x5644e6,_0x5a6e61=Buffer[_0x1fefb3(0xac)](_0x26205f,_0x1fefb3(0xab));return{'content':_0x26205f,'byteSize':_0x5a6e61[_0x1fefb3(0x9f)],'contentHash':_0x1fefb3(0x90)+createHash(_0x1fefb3(0xa4))[_0x1fefb3(0x92)](_0x5a6e61)['digest'](_0x1fefb3(0x85))};}export async function readAppRuleFile(_0xd0ff98){const _0x2c8bc0=a244_0x5644e6,_0x4e36ec=_0xd0ff98[_0x2c8bc0(0x8e)]();if(!_0x4e36ec)throw appRuleError('app_rule_file_required',_0x2c8bc0(0xa1),'Pass\x20a\x20UTF-8\x20Markdown\x20file.');const _0x25d9a3=resolve(_0x4e36ec);let _0x39249e;try{_0x39249e=await stat(_0x25d9a3);}catch(_0x172a3e){throw appRuleError(_0x2c8bc0(0x88),'Cannot\x20access\x20app\x20rule\x20file:\x20'+_0x4e36ec,_0x172a3e instanceof Error?_0x172a3e[_0x2c8bc0(0xa9)]:String(_0x172a3e));}if(!_0x39249e[_0x2c8bc0(0x96)]())throw appRuleError('app_rule_file_invalid','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20'+_0x4e36ec);if(_0x39249e[_0x2c8bc0(0xa6)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x2c8bc0(0xa7),_0x2c8bc0(0x8a));let _0x22045f;try{_0x22045f=await readFile(_0x25d9a3);}catch(_0x39e751){throw appRuleError(_0x2c8bc0(0x88),'Cannot\x20read\x20app\x20rule\x20file:\x20'+_0x4e36ec,_0x39e751 instanceof Error?_0x39e751[_0x2c8bc0(0xa9)]:String(_0x39e751));}if(_0x22045f[_0x2c8bc0(0x9f)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x2c8bc0(0xa7),_0x2c8bc0(0x8a));let _0x19676e;try{_0x19676e=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})['decode'](_0x22045f);}catch{throw appRuleError(_0x2c8bc0(0x8f),_0x2c8bc0(0x84)+_0x4e36ec);}if(_0x19676e['length']>MAX_APP_RULE_UNITS)throw appRuleError(_0x2c8bc0(0xa7),_0x2c8bc0(0x9d));if(!_0x19676e[_0x2c8bc0(0x8e)]())throw appRuleError(_0x2c8bc0(0x8f),'App\x20rule\x20file\x20is\x20blank:\x20'+_0x4e36ec);return inspectAppRuleContent(_0x19676e);}export function projectAppRule(_0x30e8d,_0x462d02){const _0xffb08b=a244_0x5644e6;if(!_0x462d02)return{'type':_0x30e8d,'fileName':appRuleFileName(_0x30e8d),'contextScope':appRuleContextScope(_0x30e8d),'enabled':![]};const _0x4981e9=inspectAppRuleContent(_0x462d02['content']);return{'type':_0x30e8d,'fileName':appRuleFileName(_0x30e8d),'contextScope':appRuleContextScope(_0x30e8d),'enabled':!![],'id':_0x462d02['id'],'scope':_0x462d02['scope'],'appCode':_0x462d02[_0xffb08b(0x9e)],'version':_0x462d02['version'],..._0x462d02[_0xffb08b(0x9c)]!==undefined?{'indexStatus':_0x462d02[_0xffb08b(0x9c)]}:{},'contentByteSize':_0x4981e9[_0xffb08b(0x9a)],'contentHash':_0x4981e9[_0xffb08b(0xaa)],..._0x462d02[_0xffb08b(0x93)]!==undefined&&_0x462d02['createTime']!==null?{'createTime':_0x462d02[_0xffb08b(0x93)]}:{},..._0x462d02[_0xffb08b(0x8c)]!==undefined&&_0x462d02[_0xffb08b(0x8c)]!==null?{'updateTime':_0x462d02[_0xffb08b(0x8c)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x5644e6(0x97),'type':a244_0x5644e6(0x83),'required':!![],'description':a244_0x5644e6(0x89),'enum':[...APP_RULE_TYPES]};
1
+ const a244_0x4d9b6d=a244_0x8d69;(function(_0x29e328,_0x38dc03){const _0x21a69c=a244_0x8d69,_0x2290fd=_0x29e328();while(!![]){try{const _0x3d93fa=parseInt(_0x21a69c(0x1ab))/0x1*(-parseInt(_0x21a69c(0x1a2))/0x2)+parseInt(_0x21a69c(0x1b4))/0x3+parseInt(_0x21a69c(0x1ae))/0x4*(parseInt(_0x21a69c(0x19a))/0x5)+-parseInt(_0x21a69c(0x1a4))/0x6+-parseInt(_0x21a69c(0x1ba))/0x7+parseInt(_0x21a69c(0x1bf))/0x8*(parseInt(_0x21a69c(0x197))/0x9)+parseInt(_0x21a69c(0x1a6))/0xa;if(_0x3d93fa===_0x38dc03)break;else _0x2290fd['push'](_0x2290fd['shift']());}catch(_0x2ec1a8){_0x2290fd['push'](_0x2290fd['shift']());}}}(a244_0x31a9,0x342de));import{createHash}from'node:crypto';import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a244_0x4d9b6d(0x1b5),'database'];export const MAX_APP_RULE_UNITS=0x5*0x400*0x400;export const MAX_APP_RULE_BYTES=MAX_APP_RULE_UNITS*0x4;const APP_RULE_FILES={'rules':a244_0x4d9b6d(0x1c0),'database':a244_0x4d9b6d(0x1a8)},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':'database-analysis'};function a244_0x8d69(_0x41f4b9,_0x4bd798){_0x41f4b9=_0x41f4b9-0x192;const _0x31a916=a244_0x31a9();let _0x8d69e3=_0x31a916[_0x41f4b9];return _0x8d69e3;}function a244_0x31a9(){const _0xea8c29=['8xCVsoL','RULES.md','App\x20rule\x20file\x20is\x20blank:\x20','updateTime','appCode','message','Pass\x20a\x20UTF-8\x20Markdown\x20file.','byteLength','createTime','size','app_rule_content_invalid','isFile','213309sYGdkH','app_rule_file_invalid','indexStatus','95lbjQpm','App\x20rule\x20content\x20exceeds\x20the\x20bounded\x20UTF-8\x20file\x20limit.','content','hex','utf8','app_rule_type_invalid','decode','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','13388hjEsbc','byteSize','2339778BZXoCs','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','6891290WJPaNS','str','DATABASE.md','Cannot\x20access\x20app\x20rule\x20file:\x20','contentHash','11zoqmkv','update','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','3268atAhzV','length','app_rule_file_unreadable','--file\x20is\x20required.','type','App\x20rule\x20content\x20exceeds\x205242880\x20UTF-16\x20units.','457464kLqgvA','rules','digest','string','app_rule_content_too_large','database','1424626zGaaeT','app_rule_file_required','Cannot\x20read\x20app\x20rule\x20file:\x20','trim','from'];a244_0x31a9=function(){return _0xea8c29;};return a244_0x31a9();}export function appRuleError(_0x22c938,_0x314636,_0x241c5c){return new CliError(_0x22c938,0x1,_0x314636,_0x241c5c);}export function readAppRuleType(_0x198825){const _0x40a5b0=a244_0x4d9b6d,_0x2ba2b7=_0x198825[_0x40a5b0(0x1a7)](_0x40a5b0(0x1b2))[_0x40a5b0(0x1bd)]()['toLowerCase']();if(_0x2ba2b7!==_0x40a5b0(0x1b5)&&_0x2ba2b7!==_0x40a5b0(0x1b9))throw appRuleError(_0x40a5b0(0x19f),_0x40a5b0(0x1a5));return _0x2ba2b7;}export function appRuleFileName(_0x54ea0b){return APP_RULE_FILES[_0x54ea0b];}export function appRuleContextScope(_0x3733a4){return APP_RULE_CONTEXT_SCOPES[_0x3733a4];}export function inspectAppRuleContent(_0x25559f){const _0xdb166b=a244_0x4d9b6d,_0x60e866=Buffer[_0xdb166b(0x1be)](_0x25559f,_0xdb166b(0x19e));return{'content':_0x25559f,'byteSize':_0x60e866['byteLength'],'contentHash':'sha256:'+createHash('sha256')[_0xdb166b(0x1ac)](_0x60e866)[_0xdb166b(0x1b6)](_0xdb166b(0x19d))};}export async function readAppRuleFile(_0x1df64f){const _0x1e1b9d=a244_0x4d9b6d,_0x5e5579=_0x1df64f[_0x1e1b9d(0x1bd)]();if(!_0x5e5579)throw appRuleError(_0x1e1b9d(0x1bb),_0x1e1b9d(0x1b1),_0x1e1b9d(0x1c5));const _0xec515a=resolve(_0x5e5579);let _0x2c4dc2;try{_0x2c4dc2=await stat(_0xec515a);}catch(_0x2d8d26){throw appRuleError(_0x1e1b9d(0x1b0),_0x1e1b9d(0x1a9)+_0x5e5579,_0x2d8d26 instanceof Error?_0x2d8d26[_0x1e1b9d(0x1c4)]:String(_0x2d8d26));}if(!_0x2c4dc2[_0x1e1b9d(0x196)]())throw appRuleError(_0x1e1b9d(0x198),'App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20'+_0x5e5579);if(_0x2c4dc2[_0x1e1b9d(0x194)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x1e1b9d(0x1b8),_0x1e1b9d(0x19b));let _0x5c9e5f;try{_0x5c9e5f=await readFile(_0xec515a);}catch(_0x2f3d9a){throw appRuleError('app_rule_file_unreadable',_0x1e1b9d(0x1bc)+_0x5e5579,_0x2f3d9a instanceof Error?_0x2f3d9a[_0x1e1b9d(0x1c4)]:String(_0x2f3d9a));}if(_0x5c9e5f[_0x1e1b9d(0x192)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x1e1b9d(0x1b8),_0x1e1b9d(0x19b));let _0x3e9f34;try{_0x3e9f34=new TextDecoder('utf-8',{'fatal':!![],'ignoreBOM':!![]})[_0x1e1b9d(0x1a0)](_0x5c9e5f);}catch{throw appRuleError(_0x1e1b9d(0x195),_0x1e1b9d(0x1a1)+_0x5e5579);}if(_0x3e9f34[_0x1e1b9d(0x1af)]>MAX_APP_RULE_UNITS)throw appRuleError(_0x1e1b9d(0x1b8),_0x1e1b9d(0x1b3));if(!_0x3e9f34[_0x1e1b9d(0x1bd)]())throw appRuleError(_0x1e1b9d(0x195),_0x1e1b9d(0x1c1)+_0x5e5579);return inspectAppRuleContent(_0x3e9f34);}export function projectAppRule(_0x478422,_0x28fea3){const _0x24931c=a244_0x4d9b6d;if(!_0x28fea3)return{'type':_0x478422,'fileName':appRuleFileName(_0x478422),'contextScope':appRuleContextScope(_0x478422),'enabled':![]};const _0x34fc5d=inspectAppRuleContent(_0x28fea3[_0x24931c(0x19c)]);return{'type':_0x478422,'fileName':appRuleFileName(_0x478422),'contextScope':appRuleContextScope(_0x478422),'enabled':!![],'id':_0x28fea3['id'],'scope':_0x28fea3['scope'],'appCode':_0x28fea3[_0x24931c(0x1c3)],'version':_0x28fea3['version'],..._0x28fea3[_0x24931c(0x199)]!==undefined?{'indexStatus':_0x28fea3[_0x24931c(0x199)]}:{},'contentByteSize':_0x34fc5d[_0x24931c(0x1a3)],'contentHash':_0x34fc5d[_0x24931c(0x1aa)],..._0x28fea3[_0x24931c(0x193)]!==undefined&&_0x28fea3[_0x24931c(0x193)]!==null?{'createTime':_0x28fea3[_0x24931c(0x193)]}:{},..._0x28fea3['updateTime']!==undefined&&_0x28fea3[_0x24931c(0x1c2)]!==null?{'updateTime':_0x28fea3[_0x24931c(0x1c2)]}:{}};}export const APP_RULE_TYPE_FLAG={'name':a244_0x4d9b6d(0x1b2),'type':a244_0x4d9b6d(0x1b7),'required':!![],'description':a244_0x4d9b6d(0x1ad),'enum':[...APP_RULE_TYPES]};
@@ -1 +1 @@
1
- const a245_0x599f59=a245_0x1b34;(function(_0x28762f,_0x411525){const _0x4df9b9=a245_0x1b34,_0xe50b6e=_0x28762f();while(!![]){try{const _0x29e457=parseInt(_0x4df9b9(0x132))/0x1+-parseInt(_0x4df9b9(0x12e))/0x2*(-parseInt(_0x4df9b9(0x158))/0x3)+-parseInt(_0x4df9b9(0x152))/0x4*(parseInt(_0x4df9b9(0x135))/0x5)+parseInt(_0x4df9b9(0x156))/0x6+parseInt(_0x4df9b9(0x133))/0x7+parseInt(_0x4df9b9(0x16c))/0x8*(parseInt(_0x4df9b9(0x153))/0x9)+parseInt(_0x4df9b9(0x145))/0xa*(-parseInt(_0x4df9b9(0x164))/0xb);if(_0x29e457===_0x411525)break;else _0xe50b6e['push'](_0xe50b6e['shift']());}catch(_0x16fbc8){_0xe50b6e['push'](_0xe50b6e['shift']());}}}(a245_0xa241,0x8bae8));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{findProjectRootDirectory,resolveConfigPath}from'../../context/config-loader.js';import{writeProjectDomainRoutingManifest}from'../../config/project-domain-routing.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a245_0x599f59(0x159),a245_0x599f59(0x14d)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a245_0x599f59(0x159),'dev',a245_0x599f59(0x134),a245_0x599f59(0x13a)]);export function syncProjectDomainRoutingBeforeScript(_0x5ea0bb,_0x3677ac){const _0x586424=a245_0x599f59;if(!DOMAIN_ROUTING_SYNC_SCRIPTS[_0x586424(0x155)](_0x3677ac))return null;const _0x53d6f0=findProjectRootDirectory(_0x5ea0bb);if(!resolveConfigPath(_0x53d6f0))return null;const _0x1792ec=writeProjectDomainRoutingManifest(_0x53d6f0);return{'path':_0x1792ec[_0x586424(0x15d)],'changed':_0x1792ec[_0x586424(0x14f)]};}function readPackageScripts(_0x9b184c){const _0x1e49fd=a245_0x599f59,_0x11802c=resolve(_0x9b184c,_0x1e49fd(0x171));if(!existsSync(_0x11802c))return null;try{const _0xd6c097=JSON[_0x1e49fd(0x139)](readFileSync(_0x11802c,_0x1e49fd(0x13e)));return _0xd6c097['scripts']??{};}catch{return null;}}function a245_0x1b34(_0x17e0f0,_0x51233b){_0x17e0f0=_0x17e0f0-0x12a;const _0xa241bf=a245_0xa241();let _0x1b3489=_0xa241bf[_0x17e0f0];return _0x1b3489;}function detectPackageManager(_0x7f4454){const _0x542a0f=a245_0x599f59;if(existsSync(resolve(_0x7f4454,_0x542a0f(0x12b)))||existsSync(resolve(_0x7f4454,_0x542a0f(0x13d))))return _0x542a0f(0x12d);if(existsSync(resolve(_0x7f4454,'pnpm-lock.yaml')))return _0x542a0f(0x12a);if(existsSync(resolve(_0x7f4454,_0x542a0f(0x137))))return _0x542a0f(0x16e);return _0x542a0f(0x14c);}async function versionCheck(_0x60452b){const _0x115921=a245_0x599f59,_0x5ad0d1=await checkCliVersion();(_0x5ad0d1['needsUpgrade']||_0x5ad0d1[_0x115921(0x169)])&&(printCliUpgradeWarning(_0x5ad0d1),assertCliVersionSupported(_0x5ad0d1));const _0x16ef81=await checkSdkVersion(_0x60452b);if(_0x16ef81[_0x115921(0x147)])printSdkUpgradeWarning(_0x16ef81);}function spawnScript(_0x410d2e,_0x5611ed,_0x213fc5,_0x147f90){return new Promise((_0x345dcf,_0x893ee3)=>{const _0x2763c6=a245_0x1b34,_0x544a27=[_0x2763c6(0x13f),_0x5611ed,..._0x213fc5],_0x1c22f3=spawn(_0x410d2e,_0x544a27,{'cwd':_0x147f90,'stdio':_0x2763c6(0x138),'shell':!![],'env':{...process.env,'PATH':''+join(_0x147f90,_0x2763c6(0x15f),'.bin')+delimiter+process.env.PATH}});_0x1c22f3['on'](_0x2763c6(0x16b),_0x2b0b39=>{const _0x5d0eb5=_0x2763c6;if(_0x2b0b39===0x0||_0x2b0b39===null)_0x345dcf();else _0x893ee3(new Error(_0x410d2e+_0x5d0eb5(0x157)+_0x5611ed+_0x5d0eb5(0x15e)+_0x2b0b39));}),_0x1c22f3['on'](_0x2763c6(0x130),_0x893ee3);});}function spawnViteBuildWatch(_0x323842){return new Promise((_0x33062c,_0x200925)=>{const _0x1d2698=a245_0x1b34,_0x9dbb4d=spawn(_0x1d2698(0x14b),[_0x1d2698(0x134),_0x1d2698(0x136)],{'cwd':_0x323842,'stdio':_0x1d2698(0x138),'shell':!![],'env':{...process.env,'PATH':''+join(_0x323842,_0x1d2698(0x15f),'.bin')+delimiter+process.env.PATH}});_0x9dbb4d['on'](_0x1d2698(0x16b),_0x5e6825=>{const _0xbd09f=_0x1d2698;if(_0x5e6825===0x0||_0x5e6825===null)_0x33062c();else _0x200925(new Error(_0xbd09f(0x165)+_0x5e6825));}),_0x9dbb4d['on'](_0x1d2698(0x130),_0x200925);});}function spawnVitePreview(_0x1b048b){return new Promise((_0x15cdde,_0x728f88)=>{const _0x36a1ee=a245_0x1b34,_0x48a50e=spawn('vite',[_0x36a1ee(0x13a)],{'cwd':_0x1b048b,'stdio':_0x36a1ee(0x138),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1b048b,_0x36a1ee(0x15f),_0x36a1ee(0x146))+delimiter+process.env.PATH}});_0x48a50e['on']('close',_0x326912=>{const _0x5381e8=_0x36a1ee;if(_0x326912===0x0||_0x326912===null)_0x15cdde();else _0x728f88(new Error(_0x5381e8(0x16a)+_0x326912));}),_0x48a50e['on'](_0x36a1ee(0x130),_0x728f88);});}function a245_0xa241(){const _0xcc9804=['48fpHakG','Enable\x20watch\x20mode\x20for\x20preview','yarn','\x0a\x20\x20Usage:\x20','cwd','package.json','pnpm','bun.lockb','\x22\x20not\x20found\x20in\x20package.json.','bun','2VvAReT','\x20run\x20<script>\x0a','error','keys','997171ZszkJj','1481648cVozsZ','build','10IVpwSW','--watch','yarn.lock','inherit','parse','preview','slice','write','bun.lock','utf-8','run','\x20run\x20preview','\x20run\x20build','\x20run\x20preview\x20--watch','No\x20package.json\x20found\x20in\x20current\x20directory.','No\x20scripts\x20defined\x20in\x20package.json.','5510piVASx','.bin','needsUpgrade','log','Script\x20name\x20defined\x20in\x20package.json','\x0a\x20\x20Available\x20scripts:\x0a','vite','npm','dev','Run\x20a\x20package.json\x20script','changed','all','Available:\x20','1763636kaCAAA','1442313xzHMUC','validation','has','1078728NnQEuA','\x20run\x20','1761243UxpPTJ','start','Domain\x20routing\x20synchronized:\x20','watch','\x20\x20EXAMPLES','path','\x20exited\x20with\x20code\x20','node_modules','\x20\x20\x20\x20','Script\x20\x22','join','push','29612ksRVHL','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','\x20run\x20start','args','bool','belowMinimum','vite\x20preview\x20exited\x20with\x20code\x20','close'];a245_0xa241=function(){return _0xcc9804;};return a245_0xa241();}const runFlags=[{'name':a245_0x599f59(0x15b),'type':'boolean','description':a245_0x599f59(0x16d),'default':![]}];export const runDefinition={'service':a245_0x599f59(0x13f),'command':'run','description':a245_0x599f59(0x14e),'risk':a245_0x599f59(0x13c),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':a245_0x599f59(0x149),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x390a33=a245_0x599f59,_0x5a1487=[];return _0x5a1487[_0x390a33(0x163)](_0x390a33(0x15c)),_0x5a1487[_0x390a33(0x163)](_0x390a33(0x160)+CLI_BIN_NAME+_0x390a33(0x166)),_0x5a1487[_0x390a33(0x163)](_0x390a33(0x160)+CLI_BIN_NAME+_0x390a33(0x141)),_0x5a1487['push'](_0x390a33(0x160)+CLI_BIN_NAME+_0x390a33(0x140)),_0x5a1487[_0x390a33(0x163)](_0x390a33(0x160)+CLI_BIN_NAME+_0x390a33(0x142)),_0x5a1487[_0x390a33(0x162)]('\x0a');},async 'execute'(_0x3b4bd9){const _0x2654d1=a245_0x599f59,_0x1e45b9=process[_0x2654d1(0x170)](),_0x3c67b9=_0x3b4bd9[_0x2654d1(0x167)][0x0],_0x398a08=_0x3b4bd9[_0x2654d1(0x167)][_0x2654d1(0x13b)](0x1),_0x9d04cd=readPackageScripts(_0x1e45b9);if(!_0x9d04cd)throw CliErrors['validation'](_0x2654d1(0x143));if(!_0x3c67b9){const _0x3b6416=Object[_0x2654d1(0x131)](_0x9d04cd);if(_0x3b6416['length']===0x0)console['log'](_0x2654d1(0x144));else{console['log'](_0x2654d1(0x14a));for(const _0x20358c of _0x3b6416){console[_0x2654d1(0x148)](_0x2654d1(0x160)+_0x20358c);}console[_0x2654d1(0x148)](_0x2654d1(0x16f)+CLI_BIN_NAME+_0x2654d1(0x12f));}return{'ok':!![]};}if(!_0x9d04cd[_0x3c67b9])throw CliErrors[_0x2654d1(0x154)](_0x2654d1(0x161)+_0x3c67b9+_0x2654d1(0x12c),_0x2654d1(0x151)+(Object['keys'](_0x9d04cd)['join'](',\x20')||'(none)'));const _0x5a3ee5=detectPackageManager(_0x1e45b9),_0x1730e2=syncProjectDomainRoutingBeforeScript(_0x1e45b9,_0x3c67b9);_0x1730e2?.[_0x2654d1(0x14f)]&&console[_0x2654d1(0x130)](_0x2654d1(0x15a)+_0x1730e2[_0x2654d1(0x15d)]);VERSION_CHECK_SCRIPTS[_0x2654d1(0x155)](_0x3c67b9)&&await versionCheck(_0x1e45b9);if(_0x3c67b9===_0x2654d1(0x13a)&&_0x3b4bd9[_0x2654d1(0x168)](_0x2654d1(0x15b)))return await Promise[_0x2654d1(0x150)]([spawnViteBuildWatch(_0x1e45b9),spawnVitePreview(_0x1e45b9)]),{'ok':!![]};return await spawnScript(_0x5a3ee5,_0x3c67b9,_0x398a08,_0x1e45b9),{'ok':!![]};}};
1
+ const a245_0x1d51dc=a245_0x35d2;(function(_0x1733ef,_0x3d9b48){const _0xdf22f4=a245_0x35d2,_0x2bcec1=_0x1733ef();while(!![]){try{const _0x394928=-parseInt(_0xdf22f4(0x1dc))/0x1+parseInt(_0xdf22f4(0x1df))/0x2+parseInt(_0xdf22f4(0x1f7))/0x3+parseInt(_0xdf22f4(0x20a))/0x4+parseInt(_0xdf22f4(0x1d3))/0x5+-parseInt(_0xdf22f4(0x20d))/0x6+-parseInt(_0xdf22f4(0x1ed))/0x7;if(_0x394928===_0x3d9b48)break;else _0x2bcec1['push'](_0x2bcec1['shift']());}catch(_0x515de8){_0x2bcec1['push'](_0x2bcec1['shift']());}}}(a245_0x3f23,0xeaefa));function a245_0x3f23(){const _0x5471b5=['node_modules','\x20\x20EXAMPLES','needsUpgrade','\x20run\x20preview\x20--watch','slice','run','start','(none)','inherit','dev','4730026QgpQEH','close','length','npm','log','watch','Script\x20name\x20defined\x20in\x20package.json','pnpm','yarn.lock','\x20run\x20','881385scCNWb','bool','Available:\x20','\x20run\x20start','bun.lockb','.bin','args','--watch','scripts','preview','\x20\x20\x20\x20','bun','path','No\x20package.json\x20found\x20in\x20current\x20directory.','\x0a\x20\x20Available\x20scripts:\x0a','vite\x20preview\x20exited\x20with\x20code\x20','bun.lock','build','write','5399528rwyXpV','cwd','parse','10054344hkqccO','6568390RgqcIi','belowMinimum','has','Enable\x20watch\x20mode\x20for\x20preview','pnpm-lock.yaml','push','error','Domain\x20routing\x20synchronized:\x20','changed','1211828aHzXvf','script','validation','3136426oGDquB','Script\x20\x22','vite','vite\x20build\x20--watch\x20exited\x20with\x20code\x20'];a245_0x3f23=function(){return _0x5471b5;};return a245_0x3f23();}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';function a245_0x35d2(_0x11ed10,_0x15cbdb){_0x11ed10=_0x11ed10-0x1d3;const _0x3f237b=a245_0x3f23();let _0x35d289=_0x3f237b[_0x11ed10];return _0x35d289;}import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a245_0x1d51dc(0x1e9),a245_0x1d51dc(0x1ec)]),DOMAIN_ROUTING_SYNC_SCRIPTS=new Set([a245_0x1d51dc(0x1e9),a245_0x1d51dc(0x1ec),a245_0x1d51dc(0x208),a245_0x1d51dc(0x200)]);export function syncProjectDomainRoutingBeforeScript(_0x31c3ab,_0x5bb64c){const _0x2590e6=a245_0x1d51dc;if(!DOMAIN_ROUTING_SYNC_SCRIPTS['has'](_0x5bb64c))return null;const _0x1a3c3d=findProjectRootDirectory(_0x31c3ab);if(!resolveConfigPath(_0x1a3c3d))return null;const _0xcd0090=writeProjectDomainRoutingManifest(_0x1a3c3d);return{'path':_0xcd0090['path'],'changed':_0xcd0090[_0x2590e6(0x1db)]};}function readPackageScripts(_0x2ca0db){const _0x358fa7=a245_0x1d51dc,_0x54c697=resolve(_0x2ca0db,'package.json');if(!existsSync(_0x54c697))return null;try{const _0x18dd8b=JSON[_0x358fa7(0x20c)](readFileSync(_0x54c697,'utf-8'));return _0x18dd8b[_0x358fa7(0x1ff)]??{};}catch{return null;}}function detectPackageManager(_0x5bccec){const _0x5c5745=a245_0x1d51dc;if(existsSync(resolve(_0x5bccec,_0x5c5745(0x1fb)))||existsSync(resolve(_0x5bccec,_0x5c5745(0x207))))return _0x5c5745(0x202);if(existsSync(resolve(_0x5bccec,_0x5c5745(0x1d7))))return _0x5c5745(0x1f4);if(existsSync(resolve(_0x5bccec,_0x5c5745(0x1f5))))return'yarn';return _0x5c5745(0x1f0);}async function versionCheck(_0x459206){const _0x2f0892=a245_0x1d51dc,_0x3aab20=await checkCliVersion();(_0x3aab20[_0x2f0892(0x1e5)]||_0x3aab20[_0x2f0892(0x1d4)])&&(printCliUpgradeWarning(_0x3aab20),assertCliVersionSupported(_0x3aab20));const _0x57c5c1=await checkSdkVersion(_0x459206);if(_0x57c5c1[_0x2f0892(0x1e5)])printSdkUpgradeWarning(_0x57c5c1);}function spawnScript(_0x6f292a,_0x26ace4,_0x282e2e,_0xe75507){return new Promise((_0x672ca5,_0x48d093)=>{const _0x26c104=a245_0x35d2,_0x358cf5=[_0x26c104(0x1e8),_0x26ace4,..._0x282e2e],_0x43176a=spawn(_0x6f292a,_0x358cf5,{'cwd':_0xe75507,'stdio':_0x26c104(0x1eb),'shell':!![],'env':{...process.env,'PATH':''+join(_0xe75507,_0x26c104(0x1e3),_0x26c104(0x1fc))+delimiter+process.env.PATH}});_0x43176a['on'](_0x26c104(0x1ee),_0x1d1058=>{const _0x16b97c=_0x26c104;if(_0x1d1058===0x0||_0x1d1058===null)_0x672ca5();else _0x48d093(new Error(_0x6f292a+_0x16b97c(0x1f6)+_0x26ace4+'\x20exited\x20with\x20code\x20'+_0x1d1058));}),_0x43176a['on'](_0x26c104(0x1d9),_0x48d093);});}function spawnViteBuildWatch(_0x355a76){return new Promise((_0x220283,_0x8eccd1)=>{const _0x4cdc9a=a245_0x35d2,_0x385b77=spawn(_0x4cdc9a(0x1e1),[_0x4cdc9a(0x208),_0x4cdc9a(0x1fe)],{'cwd':_0x355a76,'stdio':_0x4cdc9a(0x1eb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x355a76,'node_modules',_0x4cdc9a(0x1fc))+delimiter+process.env.PATH}});_0x385b77['on'](_0x4cdc9a(0x1ee),_0x1a8619=>{const _0x1483bf=_0x4cdc9a;if(_0x1a8619===0x0||_0x1a8619===null)_0x220283();else _0x8eccd1(new Error(_0x1483bf(0x1e2)+_0x1a8619));}),_0x385b77['on']('error',_0x8eccd1);});}function spawnVitePreview(_0x1656f8){return new Promise((_0x4cb262,_0x1d668d)=>{const _0x396cb2=a245_0x35d2,_0x3d1436=spawn('vite',[_0x396cb2(0x200)],{'cwd':_0x1656f8,'stdio':_0x396cb2(0x1eb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1656f8,_0x396cb2(0x1e3),_0x396cb2(0x1fc))+delimiter+process.env.PATH}});_0x3d1436['on'](_0x396cb2(0x1ee),_0x1a4e8c=>{const _0x3740c9=_0x396cb2;if(_0x1a4e8c===0x0||_0x1a4e8c===null)_0x4cb262();else _0x1d668d(new Error(_0x3740c9(0x206)+_0x1a4e8c));}),_0x3d1436['on']('error',_0x1d668d);});}const runFlags=[{'name':a245_0x1d51dc(0x1f2),'type':'boolean','description':a245_0x1d51dc(0x1d6),'default':![]}];export const runDefinition={'service':a245_0x1d51dc(0x1e8),'command':'run','description':'Run\x20a\x20package.json\x20script','risk':a245_0x1d51dc(0x209),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a245_0x1d51dc(0x1dd),'description':a245_0x1d51dc(0x1f3),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x3bd86a=a245_0x1d51dc,_0x470235=[];return _0x470235[_0x3bd86a(0x1d8)](_0x3bd86a(0x1e4)),_0x470235[_0x3bd86a(0x1d8)](_0x3bd86a(0x201)+CLI_BIN_NAME+_0x3bd86a(0x1fa)),_0x470235['push'](_0x3bd86a(0x201)+CLI_BIN_NAME+'\x20run\x20build'),_0x470235[_0x3bd86a(0x1d8)](_0x3bd86a(0x201)+CLI_BIN_NAME+'\x20run\x20preview'),_0x470235[_0x3bd86a(0x1d8)](_0x3bd86a(0x201)+CLI_BIN_NAME+_0x3bd86a(0x1e6)),_0x470235['join']('\x0a');},async 'execute'(_0x15e8e5){const _0x571dd2=a245_0x1d51dc,_0x5ea0d1=process[_0x571dd2(0x20b)](),_0x546839=_0x15e8e5[_0x571dd2(0x1fd)][0x0],_0x5b6fba=_0x15e8e5[_0x571dd2(0x1fd)][_0x571dd2(0x1e7)](0x1),_0x2bffa4=readPackageScripts(_0x5ea0d1);if(!_0x2bffa4)throw CliErrors['validation'](_0x571dd2(0x204));if(!_0x546839){const _0x4c5165=Object['keys'](_0x2bffa4);if(_0x4c5165[_0x571dd2(0x1ef)]===0x0)console[_0x571dd2(0x1f1)]('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x571dd2(0x1f1)](_0x571dd2(0x205));for(const _0xdf48cd of _0x4c5165){console[_0x571dd2(0x1f1)](_0x571dd2(0x201)+_0xdf48cd);}console[_0x571dd2(0x1f1)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x2bffa4[_0x546839])throw CliErrors[_0x571dd2(0x1de)](_0x571dd2(0x1e0)+_0x546839+'\x22\x20not\x20found\x20in\x20package.json.',_0x571dd2(0x1f9)+(Object['keys'](_0x2bffa4)['join'](',\x20')||_0x571dd2(0x1ea)));const _0x5d9e36=detectPackageManager(_0x5ea0d1),_0x3df0ae=syncProjectDomainRoutingBeforeScript(_0x5ea0d1,_0x546839);_0x3df0ae?.[_0x571dd2(0x1db)]&&console[_0x571dd2(0x1d9)](_0x571dd2(0x1da)+_0x3df0ae[_0x571dd2(0x203)]);VERSION_CHECK_SCRIPTS[_0x571dd2(0x1d5)](_0x546839)&&await versionCheck(_0x5ea0d1);if(_0x546839===_0x571dd2(0x200)&&_0x15e8e5[_0x571dd2(0x1f8)](_0x571dd2(0x1f2)))return await Promise['all']([spawnViteBuildWatch(_0x5ea0d1),spawnVitePreview(_0x5ea0d1)]),{'ok':!![]};return await spawnScript(_0x5d9e36,_0x546839,_0x5b6fba,_0x5ea0d1),{'ok':!![]};}};
@@ -1 +1 @@
1
- const a246_0x93ef6d=a246_0x4f34;function a246_0x4f34(_0xd13647,_0x2cf494){_0xd13647=_0xd13647-0x159;const _0x31155d=a246_0x3115();let _0x4f34aa=_0x31155d[_0xd13647];return _0x4f34aa;}(function(_0x5966ce,_0x268d61){const _0x34f497=a246_0x4f34,_0x1d7168=_0x5966ce();while(!![]){try{const _0x416100=parseInt(_0x34f497(0x15e))/0x1+parseInt(_0x34f497(0x15f))/0x2+-parseInt(_0x34f497(0x15b))/0x3+-parseInt(_0x34f497(0x15d))/0x4*(parseInt(_0x34f497(0x160))/0x5)+parseInt(_0x34f497(0x159))/0x6*(parseInt(_0x34f497(0x15c))/0x7)+parseInt(_0x34f497(0x15a))/0x8+parseInt(_0x34f497(0x162))/0x9;if(_0x416100===_0x268d61)break;else _0x1d7168['push'](_0x1d7168['shift']());}catch(_0x2ba23c){_0x1d7168['push'](_0x1d7168['shift']());}}}(a246_0x3115,0xb476e));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x1fd9c9){const _0x1edf4f=await buildSchemaPayload();return{'ok':!![],'data':_0x1edf4f};}function a246_0x3115(){const _0x49065e=['262562fSKaZR','1054190HPDehv','schema','6395895VpsFTZ','18wIrHJL','596160zOxOZn','4032384ussfzo','2192148lzUBbL','12KycKfx','859876GAIVru'];a246_0x3115=function(){return _0x49065e;};return a246_0x3115();}export const schemaDefinition={'service':a246_0x93ef6d(0x161),'command':'export','description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
1
+ const a246_0x53e3b5=a246_0xfc5a;function a246_0x2667(){const _0x88114a=['260ftUywh','98412QkWroQ','818044xPEOXY','642342pVAhUh','schema','11FVbbyJ','1626639RhQruI','999122xXpDRb','read','4261914PfGeZD','15294910QHSqtV','json','8PEUJFn','8zaHuqB'];a246_0x2667=function(){return _0x88114a;};return a246_0x2667();}function a246_0xfc5a(_0xd98708,_0x1b223a){_0xd98708=_0xd98708-0x139;const _0x2667f4=a246_0x2667();let _0xfc5ae3=_0x2667f4[_0xd98708];return _0xfc5ae3;}(function(_0x1d847d,_0x41fa46){const _0x24a8d2=a246_0xfc5a,_0x3f9314=_0x1d847d();while(!![]){try{const _0x493d64=-parseInt(_0x24a8d2(0x13d))/0x1+parseInt(_0x24a8d2(0x142))/0x2+-parseInt(_0x24a8d2(0x13e))/0x3*(parseInt(_0x24a8d2(0x139))/0x4)+parseInt(_0x24a8d2(0x13b))/0x5*(-parseInt(_0x24a8d2(0x13c))/0x6)+parseInt(_0x24a8d2(0x141))/0x7+-parseInt(_0x24a8d2(0x13a))/0x8*(-parseInt(_0x24a8d2(0x144))/0x9)+-parseInt(_0x24a8d2(0x145))/0xa*(-parseInt(_0x24a8d2(0x140))/0xb);if(_0x493d64===_0x41fa46)break;else _0x3f9314['push'](_0x3f9314['shift']());}catch(_0x19cf2b){_0x3f9314['push'](_0x3f9314['shift']());}}}(a246_0x2667,0x9b397));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x123b18){const _0x1886f3=await buildSchemaPayload();return{'ok':!![],'data':_0x1886f3};}export const schemaDefinition={'service':a246_0x53e3b5(0x13f),'command':'export','description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a246_0x53e3b5(0x143),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a246_0x53e3b5(0x146),'flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a247_0xce62b3=a247_0x26c6;(function(_0x262efa,_0x335d71){const _0x23a803=a247_0x26c6,_0x5ab64b=_0x262efa();while(!![]){try{const _0x5abfcf=parseInt(_0x23a803(0xea))/0x1+-parseInt(_0x23a803(0xcb))/0x2*(-parseInt(_0x23a803(0xda))/0x3)+-parseInt(_0x23a803(0xf2))/0x4*(parseInt(_0x23a803(0xfa))/0x5)+-parseInt(_0x23a803(0xcf))/0x6*(-parseInt(_0x23a803(0xe1))/0x7)+parseInt(_0x23a803(0xc3))/0x8+-parseInt(_0x23a803(0xf3))/0x9*(-parseInt(_0x23a803(0xf6))/0xa)+parseInt(_0x23a803(0xd7))/0xb*(-parseInt(_0x23a803(0xed))/0xc);if(_0x5abfcf===_0x335d71)break;else _0x5ab64b['push'](_0x5ab64b['shift']());}catch(_0x5bc2fc){_0x5ab64b['push'](_0x5ab64b['shift']());}}}(a247_0x148e,0x34e88));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';function a247_0x26c6(_0x18d78c,_0x259ae6){_0x18d78c=_0x18d78c-0xbd;const _0x148e3c=a247_0x148e();let _0x26c6e0=_0x148e3c[_0x18d78c];return _0x26c6e0;}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(_0x33ed1b){const _0x4b43ed=a247_0x26c6;if(_0x33ed1b==='mybatisXml')return[_0x4b43ed(0xe3),'\x20\x20SELECT\x201\x20AS\x20id',_0x4b43ed(0xf8),''][_0x4b43ed(0xd4)]('\x0a');return[_0x4b43ed(0xcc),''][_0x4b43ed(0xd4)]('\x0a');}export const sqlCreate={'service':'sql','command':a247_0xce62b3(0xd1),'description':a247_0xce62b3(0xd2),'risk':a247_0xce62b3(0xd5),'flags':[{'name':a247_0xce62b3(0x100),'type':a247_0xce62b3(0xc6),'description':a247_0xce62b3(0xbe)},{'name':a247_0xce62b3(0xe5),'type':a247_0xce62b3(0xc9),'description':'Target\x20database\x20ID'},{'name':a247_0xce62b3(0xf4),'type':'string','enum':[a247_0xce62b3(0xc8),a247_0xce62b3(0xf5)],'description':a247_0xce62b3(0xf7)}],async 'validate'(_0x585e0c){const _0x4fceba=a247_0xce62b3;if(!_0x585e0c[_0x4fceba(0xef)])return;if(!_0x585e0c['str'](_0x4fceba(0x100))['trim']())throw CliErrors[_0x4fceba(0xc5)]('name',_0x4fceba(0xfd));const _0x5b4297=resolveProvidedDbId(_0x585e0c);if(typeof _0x5b4297!==_0x4fceba(0xc9)||!Number[_0x4fceba(0xee)](_0x5b4297)||_0x5b4297<=0x0)throw CliErrors['flagMissing']('db-id',_0x4fceba(0xde));if(!_0x585e0c['str']('mode')[_0x4fceba(0xc1)]())throw CliErrors[_0x4fceba(0xc5)](_0x4fceba(0xf4),_0x4fceba(0xd8));},async 'dryRun'(_0x260079){const _0x4fd6bf=a247_0xce62b3,_0x5e9c11=loadSqlProjectConfig(_0x260079[_0x4fd6bf(0xfe)]),{sqlName:_0x4251e3,dbId:_0xe7e4d9,dbName:_0x192c08,mode:_0x3d855a}=await resolveSqlNewInputs(_0x260079),_0xbde4d=buildSqlRelativePath(_0x4fd6bf(0xf9),_0x4251e3,_0x192c08,_0x3d855a,_0xe7e4d9),_0x1a23ca=_0x5e9c11[_0x4fd6bf(0x102)]+'/'+_0xbde4d;return{'method':_0x4fd6bf(0xd3),'url':_0x4fd6bf(0xe7),'body':{'appCode':_0x260079[_0x4fd6bf(0xfe)],'sqlName':_0x4251e3,'dbId':_0xe7e4d9,'mode':_0x3d855a,'localPath':_0x1a23ca},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x5e9c11[_0x4fd6bf(0x102)]};},async 'execute'(_0x2a5d40){const _0x367ffa=a247_0xce62b3,_0x5970e7=loadSqlProjectConfig(_0x2a5d40[_0x367ffa(0xfe)]),{sqlName:_0x5ba33f,dbId:_0x5532a6,dbName:_0x7631ac,mode:_0x1743a8}=await resolveSqlNewInputs(_0x2a5d40),_0x567ebb=generateSqlTemplate(_0x1743a8),_0x358e01=await createSqlQuery({'appCode':_0x2a5d40[_0x367ffa(0xfe)],'sqlName':_0x5ba33f,'dbId':_0x5532a6,'sqlContent':_0x567ebb}),_0x377760=ensureRemoteSqlContent(_0x358e01),_0x3d0ef9=_0x7631ac||await getDbName(_0x2a5d40[_0x367ffa(0xfe)],_0x5532a6)['catch'](()=>undefined),_0x5348ee=buildSqlRelativePath(_0x358e01[_0x367ffa(0xff)],_0x358e01[_0x367ffa(0xca)],_0x3d0ef9,_0x1743a8,_0x5532a6),_0x521fb5=_0x5970e7[_0x367ffa(0x102)]+'/'+_0x5348ee,_0x1df0ff=buildLocalSqlFileContent({'sqlCode':_0x358e01[_0x367ffa(0xff)],'sqlName':_0x358e01[_0x367ffa(0xca)],'dbId':_0x358e01[_0x367ffa(0xe0)]},_0x377760,{'dbName':_0x3d0ef9,'mode':_0x1743a8,'syncedAt':new Date()[_0x367ffa(0xce)](),'description':_0x358e01[_0x367ffa(0xc0)]});if(await fileExists(_0x521fb5))throw CliErrors['validation'](_0x367ffa(0xdc)+_0x521fb5);await ensureParentDirectory(_0x521fb5),await writeFile(_0x521fb5,_0x1df0ff,'utf8');const _0xe42b7c=await readSqlLockFile(_0x5970e7[_0x367ffa(0xe4)]),{lockData:_0x13ad9d,appLock:_0x67407f}=ensureSqlLockScope(_0xe42b7c??createEmptySqlLock(),_0x5970e7[_0x367ffa(0xfe)],_0x5970e7[_0x367ffa(0xec)],_0x367ffa(0xbf));return _0x67407f['sqls'][_0x358e01[_0x367ffa(0xff)]]={...buildSqlLockEntry(_0x358e01,_0x377760,computeSqlContentHash(_0x1df0ff),{'dbName':_0x3d0ef9}),'path':_0x5348ee,'mode':_0x1743a8},_0x67407f[_0x367ffa(0xc7)]=new Date()[_0x367ffa(0xce)](),await writeSqlLockFile(_0x5970e7[_0x367ffa(0xe4)],_0x13ad9d),{'ok':!![],'data':{'id':_0x358e01['id'],'sqlCode':_0x358e01[_0x367ffa(0xff)],'sqlName':_0x358e01['sqlName'],'dbId':_0x358e01[_0x367ffa(0xe0)],'path':_0x521fb5,'mode':_0x1743a8},'message':'Created\x20SQL\x20query\x20'+_0x358e01['sqlCode']};}};async function resolveSqlNewInputs(_0x346e0e){const _0x19eb89=await resolveSqlNameInput(_0x346e0e),{dbId:_0x11a483,dbName:_0x4004b4}=await resolveDbSelection(_0x346e0e),_0x4186da=await resolveSqlModeInput(_0x346e0e);return{'sqlName':_0x19eb89,'dbId':_0x11a483,'dbName':_0x4004b4,'mode':_0x4186da};}async function resolveSqlNameInput(_0x16359f){const _0x28ea3f=a247_0xce62b3,_0x1120c9=_0x16359f[_0x28ea3f(0xf0)](_0x28ea3f(0x100))[_0x28ea3f(0xc1)]();if(_0x1120c9)return _0x1120c9;if(_0x16359f[_0x28ea3f(0xef)])throw CliErrors[_0x28ea3f(0xc5)](_0x28ea3f(0x100),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':'SQL\x20name:','validate':_0x279f20=>_0x279f20[_0x28ea3f(0xc1)]()?!![]:_0x28ea3f(0xd9)}))[_0x28ea3f(0xc1)]();}async function resolveDbSelection(_0x8f7f93){const _0x302b57=a247_0xce62b3,_0x23c32d=resolveProvidedDbId(_0x8f7f93);if(typeof _0x23c32d==='number'&&Number[_0x302b57(0xee)](_0x23c32d)&&_0x23c32d>0x0)return{'dbId':_0x23c32d,'dbName':await getDbName(_0x8f7f93[_0x302b57(0xfe)],_0x23c32d)[_0x302b57(0xcd)](()=>undefined)};if(_0x8f7f93[_0x302b57(0xef)])throw CliErrors[_0x302b57(0xc5)]('db-id','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x2f53cb=await listDatabases(_0x8f7f93[_0x302b57(0xfe)])[_0x302b57(0xcd)](()=>[]);if(_0x2f53cb['length']===0x1)return{'dbId':_0x2f53cb[0x0][_0x302b57(0xe0)],'dbName':_0x2f53cb[0x0][_0x302b57(0x101)]};if(_0x2f53cb[_0x302b57(0xe8)]>0x1){const _0x526c33=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0x2f53cb[_0x302b57(0xe9)](_0x46d354=>({'name':_0x46d354[_0x302b57(0x101)]+'\x20('+_0x46d354[_0x302b57(0xe0)]+')','value':serializeDbSelection(_0x46d354)})),{'name':_0x302b57(0xd6),'value':_0x302b57(0xdf)}]});if(_0x526c33!==_0x302b57(0xdf))return deserializeDbSelection(_0x526c33);}const _0x13892c=await input({'message':_0x302b57(0xe2),'validate':_0x47639e=>{const _0x25c321=_0x302b57,_0x309aae=_0x47639e[_0x25c321(0xc1)]();if(!_0x309aae)return _0x25c321(0xbd);const _0x439ddf=Number(_0x309aae);if(!Number[_0x25c321(0xe6)](_0x439ddf)||_0x439ddf<=0x0)return _0x25c321(0xdb);return!![];}});return{'dbId':Number(_0x13892c['trim']())};}async function resolveSqlModeInput(_0xe050aa){const _0x1f031e=a247_0xce62b3,_0x17711f=_0xe050aa[_0x1f031e(0xf0)](_0x1f031e(0xf4))[_0x1f031e(0xc1)]();if(_0x17711f===_0x1f031e(0xc8)||_0x17711f===_0x1f031e(0xf5))return _0x17711f;if(_0xe050aa['nonInteractive'])throw CliErrors['flagMissing']('mode',_0x1f031e(0xd8));return await select({'message':_0x1f031e(0xfc),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':_0x1f031e(0xc8),'description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x1f031e(0xc2),'value':_0x1f031e(0xf5),'description':_0x1f031e(0xf1)}]});}function serializeDbSelection(_0x16e2ed){const _0x6e8806=a247_0xce62b3;return JSON[_0x6e8806(0xeb)]({'dbId':_0x16e2ed[_0x6e8806(0xe0)],'dbName':_0x16e2ed['dbName']});}function deserializeDbSelection(_0x13b939){const _0x2e43f6=a247_0xce62b3;try{const _0x44956f=JSON[_0x2e43f6(0xd0)](_0x13b939);if(typeof _0x44956f[_0x2e43f6(0xe0)]===_0x2e43f6(0xc9)&&Number[_0x2e43f6(0xee)](_0x44956f[_0x2e43f6(0xe0)]))return{'dbId':_0x44956f[_0x2e43f6(0xe0)],'dbName':_0x44956f['dbName']};}catch{}throw CliErrors[_0x2e43f6(0xfb)](_0x2e43f6(0xdd)+_0x13b939);}function resolveProvidedDbId(_0xe2e0ec){const _0x22f88a=a247_0xce62b3,_0x1e589b=_0xe2e0ec[_0x22f88a(0xc4)](_0x22f88a(0xe5));if(typeof _0x1e589b===_0x22f88a(0xc9)&&Number[_0x22f88a(0xee)](_0x1e589b))return _0x1e589b;return undefined;}function a247_0x148e(){const _0x54582c=['Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','POST','join','write','✎\x20Enter\x20dbId\x20manually','1595jOVwMh','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20name\x20cannot\x20be\x20empty','408xvVbQS','dbId\x20must\x20be\x20a\x20positive\x20integer','File\x20already\x20exists:\x20','Invalid\x20database\x20selection\x20payload:\x20','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','__manual__','dbId','25459Arpxpn','Target\x20database\x20dbId:','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','lockFilePath','db-id','isInteger','/smartapi/custom/saveUserCustomSql','length','map','311653rxYvpW','stringify','sqlRoot','43308IOrMGr','isFinite','nonInteractive','str','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','344YsAzFX','123426gDOnIy','mode','mybatisXml','40qKiClr','Local\x20SQL\x20file\x20mode','</select>','<server-generated-sqlCode>','13840MLIIJz','validation','Select\x20the\x20local\x20SQL\x20mode:','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','appCode','sqlCode','name','dbName','sqlRootDir','dbId\x20cannot\x20be\x20empty','SQL\x20query\x20display\x20name','new','description','trim','MyBatis\x20XML\x20(mybatisXml)','1718008vqeTCm','flag','flagMissing','string','lastSync','sql','number','sqlName','5354YSNruf','SELECT\x201\x20AS\x20id;','catch','toISOString','54gPslgq','parse','create'];a247_0x148e=function(){return _0x54582c;};return a247_0x148e();}
1
+ const a247_0x2ee645=a247_0x51f5;(function(_0x3b3638,_0x1f9d7a){const _0xdb2c7e=a247_0x51f5,_0xadf74c=_0x3b3638();while(!![]){try{const _0x42ec41=parseInt(_0xdb2c7e(0x123))/0x1+parseInt(_0xdb2c7e(0x157))/0x2*(parseInt(_0xdb2c7e(0x14f))/0x3)+parseInt(_0xdb2c7e(0x14e))/0x4*(-parseInt(_0xdb2c7e(0x117))/0x5)+parseInt(_0xdb2c7e(0x129))/0x6*(parseInt(_0xdb2c7e(0x124))/0x7)+parseInt(_0xdb2c7e(0x13d))/0x8*(-parseInt(_0xdb2c7e(0x13e))/0x9)+-parseInt(_0xdb2c7e(0x12b))/0xa+-parseInt(_0xdb2c7e(0x15d))/0xb*(-parseInt(_0xdb2c7e(0x135))/0xc);if(_0x42ec41===_0x1f9d7a)break;else _0xadf74c['push'](_0xadf74c['shift']());}catch(_0x5c5245){_0xadf74c['push'](_0xadf74c['shift']());}}}(a247_0x5213,0xd5b0e));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';function a247_0x51f5(_0x5b0c99,_0xcc300b){_0x5b0c99=_0x5b0c99-0x117;const _0x5213ef=a247_0x5213();let _0x51f51c=_0x5213ef[_0x5b0c99];return _0x51f51c;}import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a247_0x5213(){const _0x212a81=['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','db-id','create','new','toISOString','sqls','sqlRootDir','description','179418FrjtkX','11241587UWsLss','SELECT\x201\x20AS\x20id;','str','sqlCode','isInteger','6gqvRyW','Target\x20database\x20ID','15469440THOTOg','dbId','string','catch','sqlRoot','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','stringify','dbId\x20must\x20be\x20a\x20positive\x20integer','map','SQL\x20query\x20display\x20name','36fKPgBJ','join','Select\x20the\x20local\x20SQL\x20mode:','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','length','lastSync','POST','parse','2328xPzdxs','5589LLAWxH','/smartapi/custom/saveUserCustomSql','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20name\x20cannot\x20be\x20empty','nonInteractive','lockFilePath','dbId\x20cannot\x20be\x20empty','number','__manual__','trim','write','Select\x20the\x20target\x20database:','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','dbName','sql','48tMDvJE','105MZmrEq','flagMissing','mybatisXml','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','Created\x20SQL\x20query\x20','\x20\x20SELECT\x201\x20AS\x20id','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','appCode','49190tTzgbY','validation','✎\x20Enter\x20dbId\x20manually','mode','MyBatis\x20XML\x20(mybatisXml)','name','3718649bNAsBX','440595yUKdXo','isFinite','sqlName','Invalid\x20database\x20selection\x20payload:\x20'];a247_0x5213=function(){return _0x212a81;};return a247_0x5213();}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(_0x2fa646){const _0x3b42e4=a247_0x51f5;if(_0x2fa646===_0x3b42e4(0x151))return[_0x3b42e4(0x11b),_0x3b42e4(0x154),'</select>',''][_0x3b42e4(0x136)]('\x0a');return[_0x3b42e4(0x125),'']['join']('\x0a');}export const sqlCreate={'service':a247_0x2ee645(0x14d),'command':a247_0x2ee645(0x11d),'description':a247_0x2ee645(0x130),'risk':a247_0x2ee645(0x148),'flags':[{'name':'name','type':a247_0x2ee645(0x12d),'description':a247_0x2ee645(0x134)},{'name':a247_0x2ee645(0x11c),'type':a247_0x2ee645(0x145),'description':a247_0x2ee645(0x12a)},{'name':a247_0x2ee645(0x15a),'type':a247_0x2ee645(0x12d),'enum':[a247_0x2ee645(0x14d),a247_0x2ee645(0x151)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x358a3e){const _0x380627=a247_0x2ee645;if(!_0x358a3e[_0x380627(0x142)])return;if(!_0x358a3e[_0x380627(0x126)](_0x380627(0x15c))[_0x380627(0x147)]())throw CliErrors['flagMissing'](_0x380627(0x15c),_0x380627(0x138));const _0x3d2928=resolveProvidedDbId(_0x358a3e);if(typeof _0x3d2928!==_0x380627(0x145)||!Number[_0x380627(0x118)](_0x3d2928)||_0x3d2928<=0x0)throw CliErrors[_0x380627(0x150)](_0x380627(0x11c),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x358a3e[_0x380627(0x126)](_0x380627(0x15a))['trim']())throw CliErrors[_0x380627(0x150)](_0x380627(0x15a),_0x380627(0x152));},async 'dryRun'(_0x206882){const _0x1a978e=a247_0x2ee645,_0x568aaa=loadSqlProjectConfig(_0x206882['appCode']),{sqlName:_0x13af2c,dbId:_0x3e8a15,dbName:_0x45a7c9,mode:_0x9b8441}=await resolveSqlNewInputs(_0x206882),_0x597127=buildSqlRelativePath('<server-generated-sqlCode>',_0x13af2c,_0x45a7c9,_0x9b8441,_0x3e8a15),_0x41c465=_0x568aaa['sqlRootDir']+'/'+_0x597127;return{'method':_0x1a978e(0x13b),'url':_0x1a978e(0x13f),'body':{'appCode':_0x206882[_0x1a978e(0x156)],'sqlName':_0x13af2c,'dbId':_0x3e8a15,'mode':_0x9b8441,'localPath':_0x41c465},'description':_0x1a978e(0x14b)+_0x568aaa[_0x1a978e(0x121)]};},async 'execute'(_0x20abb3){const _0x357500=a247_0x2ee645,_0x2ce8e5=loadSqlProjectConfig(_0x20abb3[_0x357500(0x156)]),{sqlName:_0x56fdcb,dbId:_0x258966,dbName:_0x417189,mode:_0x3d8932}=await resolveSqlNewInputs(_0x20abb3),_0x3b00aa=generateSqlTemplate(_0x3d8932),_0x6d2040=await createSqlQuery({'appCode':_0x20abb3[_0x357500(0x156)],'sqlName':_0x56fdcb,'dbId':_0x258966,'sqlContent':_0x3b00aa}),_0x320cf8=ensureRemoteSqlContent(_0x6d2040),_0x319eb2=_0x417189||await getDbName(_0x20abb3[_0x357500(0x156)],_0x258966)[_0x357500(0x12e)](()=>undefined),_0x2b8a43=buildSqlRelativePath(_0x6d2040[_0x357500(0x127)],_0x6d2040[_0x357500(0x119)],_0x319eb2,_0x3d8932,_0x258966),_0x798366=_0x2ce8e5['sqlRootDir']+'/'+_0x2b8a43,_0x266dbf=buildLocalSqlFileContent({'sqlCode':_0x6d2040[_0x357500(0x127)],'sqlName':_0x6d2040[_0x357500(0x119)],'dbId':_0x6d2040[_0x357500(0x12c)]},_0x320cf8,{'dbName':_0x319eb2,'mode':_0x3d8932,'syncedAt':new Date()[_0x357500(0x11f)](),'description':_0x6d2040[_0x357500(0x122)]});if(await fileExists(_0x798366))throw CliErrors[_0x357500(0x158)]('File\x20already\x20exists:\x20'+_0x798366);await ensureParentDirectory(_0x798366),await writeFile(_0x798366,_0x266dbf,'utf8');const _0x472cf3=await readSqlLockFile(_0x2ce8e5[_0x357500(0x143)]),{lockData:_0x25eb6d,appLock:_0x4aef70}=ensureSqlLockScope(_0x472cf3??createEmptySqlLock(),_0x2ce8e5['appCode'],_0x2ce8e5[_0x357500(0x12f)],_0x357500(0x11e));return _0x4aef70[_0x357500(0x120)][_0x6d2040[_0x357500(0x127)]]={...buildSqlLockEntry(_0x6d2040,_0x320cf8,computeSqlContentHash(_0x266dbf),{'dbName':_0x319eb2}),'path':_0x2b8a43,'mode':_0x3d8932},_0x4aef70[_0x357500(0x13a)]=new Date()[_0x357500(0x11f)](),await writeSqlLockFile(_0x2ce8e5[_0x357500(0x143)],_0x25eb6d),{'ok':!![],'data':{'id':_0x6d2040['id'],'sqlCode':_0x6d2040[_0x357500(0x127)],'sqlName':_0x6d2040[_0x357500(0x119)],'dbId':_0x6d2040[_0x357500(0x12c)],'path':_0x798366,'mode':_0x3d8932},'message':_0x357500(0x153)+_0x6d2040[_0x357500(0x127)]};}};async function resolveSqlNewInputs(_0x479911){const _0xcdbdf1=await resolveSqlNameInput(_0x479911),{dbId:_0xbcccc6,dbName:_0x2413fe}=await resolveDbSelection(_0x479911),_0x3d678d=await resolveSqlModeInput(_0x479911);return{'sqlName':_0xcdbdf1,'dbId':_0xbcccc6,'dbName':_0x2413fe,'mode':_0x3d678d};}async function resolveSqlNameInput(_0x31015e){const _0x2e03f3=a247_0x2ee645,_0x4f3308=_0x31015e[_0x2e03f3(0x126)](_0x2e03f3(0x15c))[_0x2e03f3(0x147)]();if(_0x4f3308)return _0x4f3308;if(_0x31015e[_0x2e03f3(0x142)])throw CliErrors[_0x2e03f3(0x150)](_0x2e03f3(0x15c),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':'SQL\x20name:','validate':_0x1c4bb1=>_0x1c4bb1[_0x2e03f3(0x147)]()?!![]:_0x2e03f3(0x141)}))[_0x2e03f3(0x147)]();}async function resolveDbSelection(_0x5be8d9){const _0x19e46e=a247_0x2ee645,_0x6230c4=resolveProvidedDbId(_0x5be8d9);if(typeof _0x6230c4===_0x19e46e(0x145)&&Number[_0x19e46e(0x118)](_0x6230c4)&&_0x6230c4>0x0)return{'dbId':_0x6230c4,'dbName':await getDbName(_0x5be8d9[_0x19e46e(0x156)],_0x6230c4)[_0x19e46e(0x12e)](()=>undefined)};if(_0x5be8d9[_0x19e46e(0x142)])throw CliErrors[_0x19e46e(0x150)](_0x19e46e(0x11c),_0x19e46e(0x140));const _0x12650c=await listDatabases(_0x5be8d9[_0x19e46e(0x156)])['catch'](()=>[]);if(_0x12650c[_0x19e46e(0x139)]===0x1)return{'dbId':_0x12650c[0x0][_0x19e46e(0x12c)],'dbName':_0x12650c[0x0]['dbName']};if(_0x12650c[_0x19e46e(0x139)]>0x1){const _0x3af36c=await select({'message':_0x19e46e(0x149),'choices':[..._0x12650c[_0x19e46e(0x133)](_0x1d2c52=>({'name':_0x1d2c52[_0x19e46e(0x14c)]+'\x20('+_0x1d2c52[_0x19e46e(0x12c)]+')','value':serializeDbSelection(_0x1d2c52)})),{'name':_0x19e46e(0x159),'value':_0x19e46e(0x146)}]});if(_0x3af36c!==_0x19e46e(0x146))return deserializeDbSelection(_0x3af36c);}const _0x3c53d=await input({'message':'Target\x20database\x20dbId:','validate':_0x126e1d=>{const _0x1937ac=_0x19e46e,_0x1282f7=_0x126e1d[_0x1937ac(0x147)]();if(!_0x1282f7)return _0x1937ac(0x144);const _0x421421=Number(_0x1282f7);if(!Number[_0x1937ac(0x128)](_0x421421)||_0x421421<=0x0)return _0x1937ac(0x132);return!![];}});return{'dbId':Number(_0x3c53d[_0x19e46e(0x147)]())};}async function resolveSqlModeInput(_0x11cc5b){const _0x5a6ed6=a247_0x2ee645,_0x573647=_0x11cc5b[_0x5a6ed6(0x126)](_0x5a6ed6(0x15a))[_0x5a6ed6(0x147)]();if(_0x573647===_0x5a6ed6(0x14d)||_0x573647===_0x5a6ed6(0x151))return _0x573647;if(_0x11cc5b[_0x5a6ed6(0x142)])throw CliErrors[_0x5a6ed6(0x150)](_0x5a6ed6(0x15a),_0x5a6ed6(0x152));return await select({'message':_0x5a6ed6(0x137),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':_0x5a6ed6(0x14d),'description':_0x5a6ed6(0x155)},{'name':_0x5a6ed6(0x15b),'value':_0x5a6ed6(0x151),'description':_0x5a6ed6(0x14a)}]});}function serializeDbSelection(_0x53ae49){const _0x20b54c=a247_0x2ee645;return JSON[_0x20b54c(0x131)]({'dbId':_0x53ae49['dbId'],'dbName':_0x53ae49[_0x20b54c(0x14c)]});}function deserializeDbSelection(_0x1e734d){const _0x3b3636=a247_0x2ee645;try{const _0x25e50b=JSON[_0x3b3636(0x13c)](_0x1e734d);if(typeof _0x25e50b['dbId']===_0x3b3636(0x145)&&Number['isFinite'](_0x25e50b[_0x3b3636(0x12c)]))return{'dbId':_0x25e50b['dbId'],'dbName':_0x25e50b[_0x3b3636(0x14c)]};}catch{}throw CliErrors[_0x3b3636(0x158)](_0x3b3636(0x11a)+_0x1e734d);}function resolveProvidedDbId(_0x39d80e){const _0xb3cbf0=a247_0x2ee645,_0x230a02=_0x39d80e['flag'](_0xb3cbf0(0x11c));if(typeof _0x230a02===_0xb3cbf0(0x145)&&Number[_0xb3cbf0(0x118)](_0x230a02))return _0x230a02;return undefined;}
@@ -1 +1 @@
1
- const a248_0x5f2078=a248_0x3ac0;(function(_0x2fa61e,_0x1f08bf){const _0x562e2d=a248_0x3ac0,_0x4b06f0=_0x2fa61e();while(!![]){try{const _0x248fe8=-parseInt(_0x562e2d(0x1fe))/0x1+parseInt(_0x562e2d(0x201))/0x2+parseInt(_0x562e2d(0x204))/0x3+parseInt(_0x562e2d(0x1e9))/0x4+-parseInt(_0x562e2d(0x1f6))/0x5*(-parseInt(_0x562e2d(0x200))/0x6)+parseInt(_0x562e2d(0x1f9))/0x7+-parseInt(_0x562e2d(0x1f3))/0x8;if(_0x248fe8===_0x1f08bf)break;else _0x4b06f0['push'](_0x4b06f0['shift']());}catch(_0x398e4b){_0x4b06f0['push'](_0x4b06f0['shift']());}}}(a248_0x1075,0x42394));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';function a248_0x1075(){const _0xe1e51b=['No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','1421508yIiDQo','Would\x20delete\x20SQL\x20','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','remoteId','\x20(local\x20file\x20moved\x20to\x20trash)','sqlRoot','delete','sqls','/smartapi/custom/deleteUserCustomSql','toISOString','6954112XpORCb','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','high-risk-write','5JOdebE','POST','projectRoot','2030798FcYMub','lockFilePath','Deleted\x20','trashedTo','validation','393643FMFYrW','appCode','1851384yXurLL','1016282AXxJNO','sqlcode','entries','215889huNOnv','startsWith','trashDir','str'];a248_0x1075=function(){return _0xe1e51b;};return a248_0x1075();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a248_0x3ac0(_0x27af13,_0x34ab52){_0x27af13=_0x27af13-0x1e9;const _0x107568=a248_0x1075();let _0x3ac0e4=_0x107568[_0x27af13];return _0x3ac0e4;}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':'sql','command':a248_0x5f2078(0x1ef),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a248_0x5f2078(0x1f5),'flags':[SQLCODE_FLAG],async 'validate'(_0x163e4a){const _0x1c0479=a248_0x5f2078,_0x5ed0d0=loadSqlProjectConfig(_0x163e4a[_0x1c0479(0x1ff)]),_0x588637=await readSqlLockFile(_0x5ed0d0[_0x1c0479(0x1fa)]);if(!_0x588637)throw CliErrors[_0x1c0479(0x1fd)](_0x1c0479(0x1f4));},async 'dryRun'(_0x88bf65){const _0x585102=a248_0x5f2078,_0xe87a90=loadSqlProjectConfig(_0x88bf65[_0x585102(0x1ff)]),_0x2aa3d8=await readSqlLockFile(_0xe87a90[_0x585102(0x1fa)]);if(!_0x2aa3d8)throw CliErrors[_0x585102(0x1fd)](_0x585102(0x1f4));const {appLock:_0x4e5dcb}=ensureSqlLockScope(_0x2aa3d8,_0x88bf65[_0x585102(0x1ff)],_0xe87a90['sqlRoot'],_0x585102(0x1ef)),_0x46e99b=_0x88bf65['str'](_0x585102(0x202)),_0x35c10b=_0x4e5dcb[_0x585102(0x1f0)][_0x46e99b];if(!_0x35c10b)throw CliErrors[_0x585102(0x1fd)](_0x585102(0x208)+_0x46e99b+'\x22.');return{'method':_0x585102(0x1f7),'url':_0x585102(0x1f1),'body':{'sqlCode':_0x46e99b,'id':_0x35c10b[_0x585102(0x1ec)],'localPath':resolveLocalSqlFilePath(_0xe87a90,_0x46e99b,_0x35c10b)},'description':_0x585102(0x1ea)+_0x46e99b+_0x585102(0x1eb)+_0xe87a90[_0x585102(0x206)]};},async 'execute'(_0x41b3b2){const _0x30471f=a248_0x5f2078,_0x1b9891=loadSqlProjectConfig(_0x41b3b2['appCode']),_0x3dc5ed=await readSqlLockFile(_0x1b9891[_0x30471f(0x1fa)]);if(!_0x3dc5ed)throw CliErrors[_0x30471f(0x1fd)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x43d98b,appLock:_0x38697d}=ensureSqlLockScope(_0x3dc5ed,_0x41b3b2['appCode'],_0x1b9891[_0x30471f(0x1ee)],_0x30471f(0x1ef)),_0x52fb96=_0x41b3b2[_0x30471f(0x207)](_0x30471f(0x202)),_0x357305=_0x38697d[_0x30471f(0x1f0)][_0x52fb96];if(!_0x357305)throw CliErrors[_0x30471f(0x1fd)](_0x30471f(0x208)+_0x52fb96+'\x22.');await deleteSqlQuery({'id':_0x357305['remoteId'],'sqlCode':_0x52fb96}),_0x38697d[_0x30471f(0x1f0)]=Object['fromEntries'](Object[_0x30471f(0x203)](_0x38697d[_0x30471f(0x1f0)])['filter'](([_0x1ae6e0])=>_0x1ae6e0!==_0x52fb96)),_0x38697d['lastSync']=new Date()[_0x30471f(0x1f2)](),await writeSqlLockFile(_0x1b9891[_0x30471f(0x1fa)],_0x43d98b);const _0x3dd3e8=resolveLocalSqlFilePath(_0x1b9891,_0x52fb96,_0x357305);let _0x43023d;await fileExists(_0x3dd3e8)&&(_0x43023d=await moveToTrash(_0x1b9891[_0x30471f(0x1f8)],_0x1b9891[_0x30471f(0x206)],_0x3dd3e8),await cleanupEmptyDirectories(dirname(_0x3dd3e8),_0x1b9891['sqlRootDir']));const _0x4e0528={'deleted':_0x52fb96,'remoteId':_0x357305[_0x30471f(0x1ec)]};if(_0x43023d)_0x4e0528[_0x30471f(0x1fc)]=_0x43023d;return{'ok':!![],'data':_0x4e0528,'message':_0x30471f(0x1fb)+_0x52fb96+(_0x43023d?_0x30471f(0x1ed):'')};}};async function moveToTrash(_0x3d13b3,_0x14fc51,_0x2877e5){const _0x15952a=a248_0x5f2078,_0x4ae245=new Date()[_0x15952a(0x1f2)]()['replace'](/[:.]/g,'-'),_0x3470f2=relative(_0x3d13b3,_0x2877e5),_0x4436ee=join(_0x14fc51,_0x4ae245,_0x3470f2);return await mkdir(dirname(_0x4436ee),{'recursive':!![]}),await rename(_0x2877e5,_0x4436ee),_0x4436ee;}async function cleanupEmptyDirectories(_0x529562,_0x50605f){const _0x5eb882=a248_0x5f2078;let _0x2d2f52=resolve(_0x529562);const _0x43477f=resolve(_0x50605f);while(_0x2d2f52[_0x5eb882(0x205)](''+_0x43477f+sep)||_0x2d2f52===_0x43477f){if(_0x2d2f52===_0x43477f)return;try{const _0x571dba=await readdir(_0x2d2f52);if(_0x571dba['length']>0x0)return;await rmdir(_0x2d2f52);}catch{return;}_0x2d2f52=dirname(_0x2d2f52);}}
1
+ const a248_0x3cc8dd=a248_0x36be;(function(_0xa41f16,_0x2297b2){const _0xc1427a=a248_0x36be,_0x24eb75=_0xa41f16();while(!![]){try{const _0x1a74fa=-parseInt(_0xc1427a(0x7b))/0x1*(parseInt(_0xc1427a(0x81))/0x2)+parseInt(_0xc1427a(0x74))/0x3*(-parseInt(_0xc1427a(0x83))/0x4)+-parseInt(_0xc1427a(0x7d))/0x5+parseInt(_0xc1427a(0x6f))/0x6*(parseInt(_0xc1427a(0x79))/0x7)+parseInt(_0xc1427a(0x67))/0x8*(parseInt(_0xc1427a(0x7f))/0x9)+parseInt(_0xc1427a(0x87))/0xa+parseInt(_0xc1427a(0x78))/0xb*(parseInt(_0xc1427a(0x77))/0xc);if(_0x1a74fa===_0x2297b2)break;else _0x24eb75['push'](_0x24eb75['shift']());}catch(_0xda93b6){_0x24eb75['push'](_0x24eb75['shift']());}}}(a248_0x16ca,0x54726));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';function a248_0x16ca(){const _0x559c77=['sqlcode','sqls','314859HAoKdU','toISOString','trashDir','4591752BjVmBK','11GDZCMK','1156932kDVmlg','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','608nSdQTP','trashedTo','1321130cLAbeB','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','1246473NFEIMr','lockFilePath','2182ilKvXt','fromEntries','12ySYKiN','high-risk-write','projectRoot','Would\x20delete\x20SQL\x20','4328390iRoytS','Deleted\x20','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','sqlRootDir','filter','16ihePpu','delete','startsWith','validation','POST','\x20(local\x20file\x20moved\x20to\x20trash)','sqlRoot','appCode','18uhsQrZ','sql','str'];a248_0x16ca=function(){return _0x559c77;};return a248_0x16ca();}function a248_0x36be(_0x316271,_0x49ed00){_0x316271=_0x316271-0x66;const _0x16ca35=a248_0x16ca();let _0x36be45=_0x16ca35[_0x316271];return _0x36be45;}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':a248_0x3cc8dd(0x70),'command':'delete','description':a248_0x3cc8dd(0x7a),'risk':a248_0x3cc8dd(0x84),'flags':[SQLCODE_FLAG],async 'validate'(_0x552dd1){const _0x536002=a248_0x3cc8dd,_0x1d6f31=loadSqlProjectConfig(_0x552dd1['appCode']),_0x162918=await readSqlLockFile(_0x1d6f31[_0x536002(0x80)]);if(!_0x162918)throw CliErrors[_0x536002(0x6a)](_0x536002(0x7e));},async 'dryRun'(_0x28b444){const _0x4f09d0=a248_0x3cc8dd,_0x732023=loadSqlProjectConfig(_0x28b444['appCode']),_0x4e82c0=await readSqlLockFile(_0x732023['lockFilePath']);if(!_0x4e82c0)throw CliErrors[_0x4f09d0(0x6a)](_0x4f09d0(0x7e));const {appLock:_0x1c147e}=ensureSqlLockScope(_0x4e82c0,_0x28b444[_0x4f09d0(0x6e)],_0x732023['sqlRoot'],_0x4f09d0(0x68)),_0x53db5e=_0x28b444[_0x4f09d0(0x71)](_0x4f09d0(0x72)),_0x10e5ad=_0x1c147e['sqls'][_0x53db5e];if(!_0x10e5ad)throw CliErrors[_0x4f09d0(0x6a)](_0x4f09d0(0x89)+_0x53db5e+'\x22.');return{'method':_0x4f09d0(0x6b),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x53db5e,'id':_0x10e5ad['remoteId'],'localPath':resolveLocalSqlFilePath(_0x732023,_0x53db5e,_0x10e5ad)},'description':_0x4f09d0(0x86)+_0x53db5e+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x732023['trashDir']};},async 'execute'(_0x4eb3df){const _0xe13078=a248_0x3cc8dd,_0x9c9df9=loadSqlProjectConfig(_0x4eb3df[_0xe13078(0x6e)]),_0x3c80c2=await readSqlLockFile(_0x9c9df9[_0xe13078(0x80)]);if(!_0x3c80c2)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x3254b3,appLock:_0x1e962d}=ensureSqlLockScope(_0x3c80c2,_0x4eb3df['appCode'],_0x9c9df9[_0xe13078(0x6d)],_0xe13078(0x68)),_0x2d13e0=_0x4eb3df[_0xe13078(0x71)](_0xe13078(0x72)),_0x4d2194=_0x1e962d['sqls'][_0x2d13e0];if(!_0x4d2194)throw CliErrors[_0xe13078(0x6a)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x2d13e0+'\x22.');await deleteSqlQuery({'id':_0x4d2194['remoteId'],'sqlCode':_0x2d13e0}),_0x1e962d[_0xe13078(0x73)]=Object[_0xe13078(0x82)](Object['entries'](_0x1e962d[_0xe13078(0x73)])[_0xe13078(0x66)](([_0x54cbf6])=>_0x54cbf6!==_0x2d13e0)),_0x1e962d['lastSync']=new Date()[_0xe13078(0x75)](),await writeSqlLockFile(_0x9c9df9[_0xe13078(0x80)],_0x3254b3);const _0xbaa2f8=resolveLocalSqlFilePath(_0x9c9df9,_0x2d13e0,_0x4d2194);let _0x575b63;await fileExists(_0xbaa2f8)&&(_0x575b63=await moveToTrash(_0x9c9df9[_0xe13078(0x85)],_0x9c9df9[_0xe13078(0x76)],_0xbaa2f8),await cleanupEmptyDirectories(dirname(_0xbaa2f8),_0x9c9df9[_0xe13078(0x8a)]));const _0x5c45fd={'deleted':_0x2d13e0,'remoteId':_0x4d2194['remoteId']};if(_0x575b63)_0x5c45fd[_0xe13078(0x7c)]=_0x575b63;return{'ok':!![],'data':_0x5c45fd,'message':_0xe13078(0x88)+_0x2d13e0+(_0x575b63?_0xe13078(0x6c):'')};}};async function moveToTrash(_0x8f1203,_0x358488,_0x42005f){const _0x1d4255=a248_0x3cc8dd,_0x90f61b=new Date()[_0x1d4255(0x75)]()['replace'](/[:.]/g,'-'),_0x5982e3=relative(_0x8f1203,_0x42005f),_0x3866c4=join(_0x358488,_0x90f61b,_0x5982e3);return await mkdir(dirname(_0x3866c4),{'recursive':!![]}),await rename(_0x42005f,_0x3866c4),_0x3866c4;}async function cleanupEmptyDirectories(_0x45f982,_0x1730c){const _0x568ba7=a248_0x3cc8dd;let _0x6cc443=resolve(_0x45f982);const _0x135b79=resolve(_0x1730c);while(_0x6cc443[_0x568ba7(0x69)](''+_0x135b79+sep)||_0x6cc443===_0x135b79){if(_0x6cc443===_0x135b79)return;try{const _0x113699=await readdir(_0x6cc443);if(_0x113699['length']>0x0)return;await rmdir(_0x6cc443);}catch{return;}_0x6cc443=dirname(_0x6cc443);}}