@lovrabet/rabetbase-cli 2.4.4-beta.1 → 2.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/fetch-model-list.js +1 -1
  3. package/lib/api/generate-api-file.js +1 -1
  4. package/lib/auth/auth-server-ui.js +1 -1
  5. package/lib/auth/auth-server.js +1 -1
  6. package/lib/auth/constant.js +1 -1
  7. package/lib/auth/get-cookie.js +1 -1
  8. package/lib/auth/get-session-user.js +1 -1
  9. package/lib/auth/is-session-valid.js +1 -1
  10. package/lib/auth/login-success-html.js +1 -1
  11. package/lib/auth/logout.js +1 -1
  12. package/lib/cli-flags.js +1 -1
  13. package/lib/cli.js +1 -1
  14. package/lib/commands/api/generate.js +1 -1
  15. package/lib/commands/api/index.js +1 -1
  16. package/lib/commands/api/list.js +1 -1
  17. package/lib/commands/api/pull.js +1 -1
  18. package/lib/commands/api/shared.js +1 -1
  19. package/lib/commands/app/index.js +1 -1
  20. package/lib/commands/app/list.js +1 -1
  21. package/lib/commands/app/members-list.js +1 -1
  22. package/lib/commands/app/remote-directory.js +1 -1
  23. package/lib/commands/app/shared.js +1 -1
  24. package/lib/commands/app-config/delete.js +1 -1
  25. package/lib/commands/app-config/get.js +1 -1
  26. package/lib/commands/app-config/index.js +1 -1
  27. package/lib/commands/app-config/list.js +1 -1
  28. package/lib/commands/app-config/set.js +1 -1
  29. package/lib/commands/app-config/shared.js +1 -1
  30. package/lib/commands/auth/index.js +1 -1
  31. package/lib/commands/bff/create.js +1 -1
  32. package/lib/commands/bff/delete.js +1 -1
  33. package/lib/commands/bff/detail.js +1 -1
  34. package/lib/commands/bff/index.js +1 -1
  35. package/lib/commands/bff/list.js +1 -1
  36. package/lib/commands/bff/pull.js +1 -1
  37. package/lib/commands/bff/push.js +1 -1
  38. package/lib/commands/bff/status.js +1 -1
  39. package/lib/commands/cli-skill/index.js +1 -1
  40. package/lib/commands/cli-update.js +1 -1
  41. package/lib/commands/codegen/index.js +1 -1
  42. package/lib/commands/codegen/sdk.js +1 -1
  43. package/lib/commands/codegen/sql.js +1 -1
  44. package/lib/commands/common/app-registry.js +1 -1
  45. package/lib/commands/common/app-selector.js +1 -1
  46. package/lib/commands/common/async-task.js +1 -1
  47. package/lib/commands/common/dry-run.js +1 -1
  48. package/lib/commands/common/flags.js +1 -1
  49. package/lib/commands/common/local-file.js +1 -1
  50. package/lib/commands/common/validate.js +1 -1
  51. package/lib/commands/config/get.js +1 -1
  52. package/lib/commands/config/index.js +1 -1
  53. package/lib/commands/config/list.js +1 -1
  54. package/lib/commands/config/set.js +1 -1
  55. package/lib/commands/config/shared.js +1 -1
  56. package/lib/commands/data/filter.js +1 -1
  57. package/lib/commands/data/getOne.js +1 -1
  58. package/lib/commands/data/index.js +1 -1
  59. package/lib/commands/data/shared.js +1 -1
  60. package/lib/commands/dataset/business-group-update.js +1 -1
  61. package/lib/commands/dataset/capability.js +1 -1
  62. package/lib/commands/dataset/delete.js +1 -1
  63. package/lib/commands/dataset/detail.js +1 -1
  64. package/lib/commands/dataset/extend-update.js +1 -1
  65. package/lib/commands/dataset/field-update.js +1 -1
  66. package/lib/commands/dataset/generate.js +1 -1
  67. package/lib/commands/dataset/index.js +1 -1
  68. package/lib/commands/dataset/list.js +1 -1
  69. package/lib/commands/dataset/operations.js +1 -1
  70. package/lib/commands/dataset/relation-audit.js +1 -1
  71. package/lib/commands/dataset/relation-create.js +1 -1
  72. package/lib/commands/dataset/relation-delete.js +1 -1
  73. package/lib/commands/dataset/relation-shared.js +1 -1
  74. package/lib/commands/dataset/relation-update.js +1 -1
  75. package/lib/commands/dataset/relations.js +1 -1
  76. package/lib/commands/dataset/rename.js +1 -1
  77. package/lib/commands/dataset/restore.js +1 -1
  78. package/lib/commands/db/analysis-batching.js +1 -1
  79. package/lib/commands/db/analyze-batch-plan.js +1 -1
  80. package/lib/commands/db/analyze-cancel.js +1 -1
  81. package/lib/commands/db/analyze-start.js +1 -1
  82. package/lib/commands/db/analyze-status.js +1 -1
  83. package/lib/commands/db/create.js +1 -1
  84. package/lib/commands/db/delete.js +1 -1
  85. package/lib/commands/db/detail.js +1 -1
  86. package/lib/commands/db/diff-refresh-start.js +1 -1
  87. package/lib/commands/db/diff-refresh-status.js +1 -1
  88. package/lib/commands/db/diff.js +1 -1
  89. package/lib/commands/db/index.js +1 -1
  90. package/lib/commands/db/list.js +1 -1
  91. package/lib/commands/db/shared.js +1 -1
  92. package/lib/commands/db/tables.js +1 -1
  93. package/lib/commands/db/test.js +1 -1
  94. package/lib/commands/db/update.js +1 -1
  95. package/lib/commands/doctor.js +1 -1
  96. package/lib/commands/file/index.js +1 -1
  97. package/lib/commands/init/index.js +1 -1
  98. package/lib/commands/issue/index.js +1 -1
  99. package/lib/commands/issue/nudge.js +1 -1
  100. package/lib/commands/issue/report.js +1 -1
  101. package/lib/commands/issue/shared.js +1 -1
  102. package/lib/commands/kb/create.js +1 -1
  103. package/lib/commands/kb/delete.js +1 -1
  104. package/lib/commands/kb/detail.js +1 -1
  105. package/lib/commands/kb/index.js +1 -1
  106. package/lib/commands/kb/list.js +1 -1
  107. package/lib/commands/kb/shared.js +1 -1
  108. package/lib/commands/kb/update.js +1 -1
  109. package/lib/commands/logs/index.js +1 -1
  110. package/lib/commands/menu/asset-update.js +1 -1
  111. package/lib/commands/menu/delete.js +1 -1
  112. package/lib/commands/menu/external-link-create.js +1 -1
  113. package/lib/commands/menu/external-link-update.js +1 -1
  114. package/lib/commands/menu/group-create.js +1 -1
  115. package/lib/commands/menu/group-update.js +1 -1
  116. package/lib/commands/menu/index.js +1 -1
  117. package/lib/commands/menu/list.js +1 -1
  118. package/lib/commands/menu/move.js +1 -1
  119. package/lib/commands/menu/regroup-start.js +1 -1
  120. package/lib/commands/menu/rename.js +1 -1
  121. package/lib/commands/menu/shared/compare-table.js +1 -1
  122. package/lib/commands/menu/shared/delete-plan.js +1 -1
  123. package/lib/commands/menu/shared/facts.js +1 -1
  124. package/lib/commands/menu/shared/index.js +1 -1
  125. package/lib/commands/menu/shared/inquirer.js +1 -1
  126. package/lib/commands/menu/shared/local-pages.js +1 -1
  127. package/lib/commands/menu/shared/logic.js +1 -1
  128. package/lib/commands/menu/shared/mutations.js +1 -1
  129. package/lib/commands/menu/shared/service.js +1 -1
  130. package/lib/commands/menu/shared/sync-core.js +1 -1
  131. package/lib/commands/menu/shared/update-core.js +1 -1
  132. package/lib/commands/menu/shared/valid-url.js +1 -1
  133. package/lib/commands/menu/sync.js +1 -1
  134. package/lib/commands/notification/config-create.js +1 -1
  135. package/lib/commands/notification/config-delete.js +1 -1
  136. package/lib/commands/notification/config-list.js +1 -1
  137. package/lib/commands/notification/config-update.js +1 -1
  138. package/lib/commands/notification/index.js +1 -1
  139. package/lib/commands/notification/shared.js +1 -1
  140. package/lib/commands/ocr/index.js +1 -1
  141. package/lib/commands/page/generate-start.js +1 -1
  142. package/lib/commands/page/generate-status.js +1 -1
  143. package/lib/commands/page/index.js +1 -1
  144. package/lib/commands/page/pull.js +1 -1
  145. package/lib/commands/page/push.js +1 -1
  146. package/lib/commands/page/react/create.js +1 -1
  147. package/lib/commands/page/react/detail.js +1 -1
  148. package/lib/commands/page/react/list.js +1 -1
  149. package/lib/commands/page/react/publish.js +1 -1
  150. package/lib/commands/page/react/shared.js +1 -1
  151. package/lib/commands/page/react/syntax.js +1 -1
  152. package/lib/commands/page/react/template.js +1 -1
  153. package/lib/commands/page/react/update.js +1 -1
  154. package/lib/commands/page/relation-audit.js +1 -1
  155. package/lib/commands/page/restore.js +1 -1
  156. package/lib/commands/page/shared.js +1 -1
  157. package/lib/commands/page/standard-page-status.js +1 -1
  158. package/lib/commands/page/sync.js +1 -1
  159. package/lib/commands/permit/index.js +1 -1
  160. package/lib/commands/permit/page-get.js +1 -1
  161. package/lib/commands/permit/page-set.js +1 -1
  162. package/lib/commands/permit/role-apis-set.js +1 -1
  163. package/lib/commands/permit/role-menus-set.js +1 -1
  164. package/lib/commands/permit/role-menus.js +1 -1
  165. package/lib/commands/permit/shared.js +1 -1
  166. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  167. package/lib/commands/project/create/format-elapsed.js +1 -1
  168. package/lib/commands/project/create/main.js +1 -1
  169. package/lib/commands/project/create/materialize-project-template.js +1 -1
  170. package/lib/commands/project/create/project-name.js +1 -1
  171. package/lib/commands/project/create/project-template-archive.js +1 -1
  172. package/lib/commands/project/create/project-template-path.js +1 -1
  173. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  174. package/lib/commands/project/create/use-format-code.js +1 -1
  175. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  176. package/lib/commands/project/index.js +1 -1
  177. package/lib/commands/project/upgrade.js +1 -1
  178. package/lib/commands/registry.js +1 -1
  179. package/lib/commands/role/create.js +1 -1
  180. package/lib/commands/role/delete.js +1 -1
  181. package/lib/commands/role/detail.js +1 -1
  182. package/lib/commands/role/index.js +1 -1
  183. package/lib/commands/role/list.js +1 -1
  184. package/lib/commands/role/shared.js +1 -1
  185. package/lib/commands/role/update.js +1 -1
  186. package/lib/commands/role/user-add.js +1 -1
  187. package/lib/commands/role/user-remove.js +1 -1
  188. package/lib/commands/role/user-resolve.js +1 -1
  189. package/lib/commands/run/index.js +1 -1
  190. package/lib/commands/schema.js +1 -1
  191. package/lib/commands/sql/create.js +1 -1
  192. package/lib/commands/sql/delete.js +1 -1
  193. package/lib/commands/sql/detail.js +1 -1
  194. package/lib/commands/sql/exec.js +1 -1
  195. package/lib/commands/sql/index.js +1 -1
  196. package/lib/commands/sql/list.js +1 -1
  197. package/lib/commands/sql/pull.js +1 -1
  198. package/lib/commands/sql/push.js +1 -1
  199. package/lib/commands/sql/shared.js +1 -1
  200. package/lib/commands/sql/status.js +1 -1
  201. package/lib/commands/sql/validate.js +1 -1
  202. package/lib/commands/task/index.js +1 -1
  203. package/lib/commands/task/status.js +1 -1
  204. package/lib/commands/tenant/index.js +1 -1
  205. package/lib/commands/tenant/members-list.js +1 -1
  206. package/lib/commands/tenant/shared.js +1 -1
  207. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  208. package/lib/commands/user-account/index.js +1 -1
  209. package/lib/commands/workspace/add.js +1 -1
  210. package/lib/commands/workspace/index.js +1 -1
  211. package/lib/commands/workspace/remove.js +1 -1
  212. package/lib/config/schema.js +1 -1
  213. package/lib/constant/cdn.js +1 -1
  214. package/lib/constant/cli.js +1 -1
  215. package/lib/constant/defaults.js +1 -1
  216. package/lib/constant/domain.js +1 -1
  217. package/lib/constant/env.js +1 -1
  218. package/lib/constant/output.js +1 -1
  219. package/lib/constant/paths.js +1 -1
  220. package/lib/constant/risk.js +1 -1
  221. package/lib/context/app-resolver.js +1 -1
  222. package/lib/context/auth-resolver.js +1 -1
  223. package/lib/context/config-loader.js +1 -1
  224. package/lib/context.js +1 -1
  225. package/lib/core/alias-resolver.js +1 -1
  226. package/lib/core/api-client.js +1 -1
  227. package/lib/core/bff/config.js +1 -1
  228. package/lib/core/bff/file-system.js +1 -1
  229. package/lib/core/bff/hash.js +1 -1
  230. package/lib/core/bff/lock.js +1 -1
  231. package/lib/core/bff/utils.js +1 -1
  232. package/lib/core/db-resolver.js +1 -1
  233. package/lib/core/page/file-system.js +1 -1
  234. package/lib/core/page/hash.js +1 -1
  235. package/lib/core/page/lock.js +1 -1
  236. package/lib/core/sql-index-auditor.js +1 -1
  237. package/lib/core/sql-sync/config.js +1 -1
  238. package/lib/core/sql-sync/file-system.js +1 -1
  239. package/lib/core/sql-sync/hash.js +1 -1
  240. package/lib/core/sql-sync/lock.js +1 -1
  241. package/lib/core/sql-sync/utils.js +1 -1
  242. package/lib/core/sql-validator.js +1 -1
  243. package/lib/errors.js +1 -1
  244. package/lib/framework/build-all-flags.js +1 -1
  245. package/lib/framework/error-output.js +1 -1
  246. package/lib/framework/explicit-yes.js +1 -1
  247. package/lib/framework/flags.js +1 -1
  248. package/lib/framework/help.js +1 -1
  249. package/lib/framework/index.js +1 -1
  250. package/lib/framework/output.js +1 -1
  251. package/lib/framework/response.js +1 -1
  252. package/lib/framework/runner-alias.js +1 -1
  253. package/lib/framework/runner.js +1 -1
  254. package/lib/framework/schema-export.js +1 -1
  255. package/lib/framework/types.js +1 -1
  256. package/lib/generated/build-info.d.ts +4 -4
  257. package/lib/generated/build-info.js +1 -1
  258. package/lib/help.js +1 -1
  259. package/lib/postinstall.js +1 -1
  260. package/lib/runtime/confirmation.js +1 -1
  261. package/lib/runtime/event.js +1 -1
  262. package/lib/runtime/index.js +1 -1
  263. package/lib/runtime/queue.js +1 -1
  264. package/lib/runtime/resolve.js +1 -1
  265. package/lib/skills/builtin-skill.js +1 -1
  266. package/lib/skills/main.js +1 -1
  267. package/lib/skills/npx-skills-add.js +1 -1
  268. package/lib/skills/skill-presence.js +1 -1
  269. package/lib/telemetry/cli-command-trace.js +1 -1
  270. package/lib/telemetry/cli-help-trace.js +1 -1
  271. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  272. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  273. package/lib/telemetry/send-cli-trace-log.js +1 -1
  274. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  275. package/lib/utils/ai_config.js +1 -1
  276. package/lib/utils/apply-jq-filter.js +1 -1
  277. package/lib/utils/cdn-config.js +1 -1
  278. package/lib/utils/check-sdk-version.js +1 -1
  279. package/lib/utils/cli-version-check.js +1 -1
  280. package/lib/utils/cli-version-policy.js +1 -1
  281. package/lib/utils/config.js +1 -1
  282. package/lib/utils/entity-with-id.js +1 -1
  283. package/lib/utils/file-utils.js +1 -1
  284. package/lib/utils/guides-cdn.js +1 -1
  285. package/lib/utils/http-client.js +1 -1
  286. package/lib/utils/is-non-interactive.js +1 -1
  287. package/lib/utils/logger.js +1 -1
  288. package/lib/utils/params.js +1 -1
  289. package/lib/utils/platform.js +1 -1
  290. package/lib/utils/rules-cdn.js +1 -1
  291. package/lib/utils/sleep.js +1 -1
  292. package/lib/utils/template-replacer.js +1 -1
  293. package/lib/utils/update-notice.js +1 -1
  294. package/lib/utils/version.js +1 -1
  295. package/lib/utils/with-active-cookie.js +1 -1
  296. package/lib/utils/write-cli-side-channel.js +1 -1
  297. package/package.json +1 -1
  298. package/skills/rabetbase/SKILL.md +1 -1
  299. package/skills/rabetbase.manifest.json +3 -3
@@ -1 +1 @@
1
- const a184_0x3f8d3a=a184_0x2794;(function(_0x1d3080,_0x1b5fd1){const _0x5aa456=a184_0x2794,_0x14149f=_0x1d3080();while(!![]){try{const _0x18ab67=-parseInt(_0x5aa456(0x18d))/0x1*(parseInt(_0x5aa456(0x199))/0x2)+parseInt(_0x5aa456(0x18c))/0x3*(-parseInt(_0x5aa456(0x186))/0x4)+-parseInt(_0x5aa456(0x17e))/0x5+-parseInt(_0x5aa456(0x19f))/0x6+-parseInt(_0x5aa456(0x157))/0x7*(parseInt(_0x5aa456(0x1a4))/0x8)+parseInt(_0x5aa456(0x182))/0x9+parseInt(_0x5aa456(0x16d))/0xa;if(_0x18ab67===_0x1b5fd1)break;else _0x14149f['push'](_0x14149f['shift']());}catch(_0x177122){_0x14149f['push'](_0x14149f['shift']());}}}(a184_0x39a3,0x2cfa4));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';function a184_0x39a3(){const _0x32eecc=['validation','\x20not\x20found\x20in\x20the\x20user-role\x20list.','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','Pass\x20--user\x20<id|name>.','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','8603tfvSSw','Missing\x20role\x20reference.','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','test','Role\x20name\x20\x22','permitCount','\x20not\x20found\x20in\x20app\x20','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','map',';\x20no\x20change.','Disambiguate\x20with\x20--role\x20<id>.','join','POST','Cannot\x20','string','Role\x20id\x20(from\x20`role\x20list`)','push','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','\x20is\x20already\x20a\x20member\x20of\x20role\x20','Missing\x20user\x20reference.','remark','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','10288170iLOrPW','role','splice','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','expectUserCount','str','Role\x20name','name','Optional\x20role\x20remark/description','flagMissing','dryRun','Multiple\x20tenant\x20members\x20match\x20\x22','roleType','Anti-drift\x20check\x20failed:\x20expected\x20','userList','ADMIN','username','1360525pWVfqc','user','User\x20','appCode','1345059LGUASr','expect-user-count','Disambiguate\x20with\x20--user\x20<id>.','length','12476uEnPzK','find','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','CUSTOM','totalCount','DEV','57bYIQcB','4142LzvWrm','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','tenant','Pass\x20--role\x20<id|name>.','USER','/smartapi/permit/user-role/update-user-list','filter','trim','No\x20tenant\x20member\x20matches\x20\x22','\x22:\x20','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20','number','6iVKaAv','\x22\x20not\x20found\x20in\x20app\x20','Role\x20id\x20','nickname','userId','toLowerCase','1903134jFoMdA','includes','authRequired','roleName','\x20is\x20not\x20a\x20member\x20of\x20role\x20','2168qdYEtg'];a184_0x39a3=function(){return _0x32eecc;};return a184_0x39a3();}import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a184_0x3f8d3a(0x198),'required':!![],'description':a184_0x3f8d3a(0x166)};export const ROLE_REF_FLAG={'name':a184_0x3f8d3a(0x16e),'type':a184_0x3f8d3a(0x165),'required':!![],'description':a184_0x3f8d3a(0x188)};export const USER_REF_FLAG={'name':a184_0x3f8d3a(0x17f),'type':a184_0x3f8d3a(0x165),'required':!![],'description':a184_0x3f8d3a(0x170)};function a184_0x2794(_0x410ae8,_0x336959){_0x410ae8=_0x410ae8-0x152;const _0x39a3fa=a184_0x39a3();let _0x27946b=_0x39a3fa[_0x410ae8];return _0x27946b;}export const NAME_FLAG={'name':'name','type':a184_0x3f8d3a(0x165),'required':!![],'description':a184_0x3f8d3a(0x173)};export const USER_NAME_FLAG={'name':a184_0x3f8d3a(0x174),'type':a184_0x3f8d3a(0x165),'required':!![],'description':a184_0x3f8d3a(0x159)};export const REMARK_FLAG={'name':a184_0x3f8d3a(0x16b),'type':a184_0x3f8d3a(0x165),'required':![],'description':a184_0x3f8d3a(0x175)};export const EXPECT_USER_COUNT_FLAG={'name':a184_0x3f8d3a(0x183),'type':'number','required':![],'description':a184_0x3f8d3a(0x154)};export const BUILTIN_ROLE_TYPES=[a184_0x3f8d3a(0x17c),a184_0x3f8d3a(0x18b),a184_0x3f8d3a(0x191)];export function isBuiltinRole(_0x90e268){const _0x4c1615=a184_0x3f8d3a;return BUILTIN_ROLE_TYPES[_0x4c1615(0x1a0)](_0x90e268);}export function assertCustomRole(_0x3984ea,_0x2e32af){const _0x3e4d9b=a184_0x3f8d3a;if(_0x3984ea[_0x3e4d9b(0x179)]!==_0x3e4d9b(0x189))throw CliErrors[_0x3e4d9b(0x152)](_0x3e4d9b(0x164)+_0x2e32af+'\x20built-in\x20role\x20'+_0x3984ea[_0x3e4d9b(0x1a2)]+'\x20('+_0x3984ea[_0x3e4d9b(0x179)]+').','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.');}export function assertPermConfigurable(_0x12079f){const _0xc0a586=a184_0x3f8d3a;if(_0x12079f[_0xc0a586(0x179)]==='DEV'||_0x12079f[_0xc0a586(0x179)]===_0xc0a586(0x17c))throw CliErrors['validation'](_0xc0a586(0x197)+_0x12079f[_0xc0a586(0x1a2)]+'\x20('+_0x12079f[_0xc0a586(0x179)]+').',_0xc0a586(0x168));}export function projectRole(_0x27fcfc){const _0x15175f=a184_0x3f8d3a;return{'id':_0x27fcfc['id'],'roleName':_0x27fcfc['roleName'],'roleType':_0x27fcfc[_0x15175f(0x179)],'remark':_0x27fcfc[_0x15175f(0x16b)],'userCount':_0x27fcfc['userCount'],'permitCount':_0x27fcfc[_0x15175f(0x15c)],'builtin':isBuiltinRole(_0x27fcfc[_0x15175f(0x179)])};}export async function resolveRoleRef(_0x361374,_0x59835a){const _0x3f9a7b=a184_0x3f8d3a,_0x5b2597=_0x59835a['trim']();if(!_0x5b2597)throw CliErrors[_0x3f9a7b(0x152)](_0x3f9a7b(0x158),_0x3f9a7b(0x190));if(/^\d+$/[_0x3f9a7b(0x15a)](_0x5b2597))return getRoleById(_0x361374,Number(_0x5b2597));const _0x23c21d=await listAllAppRoles(_0x361374),_0x2e4f1=_0x23c21d['filter'](_0x59d8c8=>_0x59d8c8[_0x3f9a7b(0x1a2)]===_0x5b2597);if(_0x2e4f1['length']===0x0)throw CliErrors[_0x3f9a7b(0x152)](_0x3f9a7b(0x15b)+_0x5b2597+_0x3f9a7b(0x19a)+_0x361374+'.',_0x3f9a7b(0x18e));if(_0x2e4f1[_0x3f9a7b(0x185)]>0x1){const _0x3b43c1=_0x2e4f1[_0x3f9a7b(0x15f)](_0x1bb4ba=>_0x1bb4ba['id'])['join'](',\x20');throw CliErrors['validation'](_0x3f9a7b(0x15b)+_0x5b2597+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x3b43c1+').',_0x3f9a7b(0x161));}return _0x2e4f1[0x0];}export async function getRoleById(_0x36e972,_0x47f800){const _0x2346a5=a184_0x3f8d3a,_0x24adcf=await getAppRole(_0x47f800);if(!_0x24adcf)throw CliErrors[_0x2346a5(0x152)](_0x2346a5(0x19b)+_0x47f800+_0x2346a5(0x15d)+_0x36e972+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');return _0x24adcf;}async function listAllAppRoles(_0x5ed08b){const _0x2133f8=a184_0x3f8d3a,_0x2f0d60=0x64,_0x45434c=[];for(let _0x24463=0x1;;_0x24463+=0x1){const {items:_0x166865,paging:_0x4c524b}=await listAppRoles(_0x5ed08b,{'currentPage':_0x24463,'pageSize':_0x2f0d60});_0x45434c[_0x2133f8(0x167)](..._0x166865);if(_0x166865[_0x2133f8(0x185)]<_0x2f0d60||_0x4c524b&&_0x45434c[_0x2133f8(0x185)]>=_0x4c524b[_0x2133f8(0x18a)])return _0x45434c;}}export async function resolveTenantCode(){const _0xb261a=a184_0x3f8d3a,_0x1af543=await getSessionUserInfo(),_0x3c4c58=_0x1af543?.[_0xb261a(0x17f)]?.[_0xb261a(0x18f)]?.['tenant_code'];if(!_0x3c4c58)throw CliErrors[_0xb261a(0x1a1)](_0xb261a(0x156));return _0x3c4c58;}function matchMember(_0x46817d,_0x2c1f14){const _0x2cba07=a184_0x3f8d3a,_0x29cdd6=_0x2c1f14['trim']()[_0x2cba07(0x19e)]();return(_0x46817d['nickname']??'')[_0x2cba07(0x19e)]()===_0x29cdd6||(_0x46817d['username']??'')[_0x2cba07(0x19e)]()===_0x29cdd6;}export async function resolveUserRef(_0x34e115){const _0x1e980f=a184_0x3f8d3a,_0x3e2a6e=_0x34e115['trim']();if(!_0x3e2a6e)throw CliErrors['validation'](_0x1e980f(0x16a),_0x1e980f(0x155));const _0x1cfb89=await resolveTenantCode(),_0x489567=await getTenantMembers(_0x1cfb89);if(/^\d+$/[_0x1e980f(0x15a)](_0x3e2a6e)){const _0x3efac3=Number(_0x3e2a6e),_0x411df9=_0x489567[_0x1e980f(0x187)](_0x35173e=>_0x35173e['userId']===_0x3efac3);return{'userId':_0x3efac3,'username':_0x411df9?.[_0x1e980f(0x17d)]??String(_0x3efac3),'nickname':_0x411df9?.[_0x1e980f(0x19c)],'matchedBy':'id'};}const _0xca4c3e=_0x489567[_0x1e980f(0x193)](_0x195630=>matchMember(_0x195630,_0x3e2a6e));if(_0xca4c3e[_0x1e980f(0x185)]===0x0)throw CliErrors[_0x1e980f(0x152)](_0x1e980f(0x195)+_0x3e2a6e+'\x22.',_0x1e980f(0x15e));if(_0xca4c3e['length']>0x1){const _0x111df1=_0xca4c3e[_0x1e980f(0x15f)](_0x3d4adc=>(_0x3d4adc['nickname']??_0x3d4adc[_0x1e980f(0x17d)]??'?')+'('+_0x3d4adc[_0x1e980f(0x19d)]+')')[_0x1e980f(0x162)](',\x20');throw CliErrors[_0x1e980f(0x152)](_0x1e980f(0x178)+_0x3e2a6e+_0x1e980f(0x196)+_0x111df1+'.',_0x1e980f(0x184));}const _0x3fa3a9=_0xca4c3e[0x0];return{'userId':_0x3fa3a9[_0x1e980f(0x19d)],'username':_0x3fa3a9[_0x1e980f(0x17d)]??String(_0x3fa3a9[_0x1e980f(0x19d)]),'nickname':_0x3fa3a9[_0x1e980f(0x19c)],'matchedBy':_0x1e980f(0x174)};}export const UPDATE_USER_LIST_PATH=a184_0x3f8d3a(0x192);function userIdsOf(_0x4d44ef){const _0x7b6f5c=a184_0x3f8d3a;return(_0x4d44ef?.[_0x7b6f5c(0x17b)]??[])[_0x7b6f5c(0x15f)](_0x3ff3e4=>_0x3ff3e4['userId']);}export function computeRoleUserMutation(_0x3db006){const _0x1ab7db=a184_0x3f8d3a,{operation:_0x566328,appCode:_0x3f7f09,roleUsers:_0x517921,targetRoleId:_0x407ab9,user:_0x46a064}=_0x3db006,_0x2055c1=_0x517921['find'](_0x3f93ef=>_0x3f93ef['id']===_0x407ab9);if(!_0x2055c1)throw CliErrors[_0x1ab7db(0x152)](_0x1ab7db(0x19b)+_0x407ab9+_0x1ab7db(0x153),_0x1ab7db(0x16c));const _0x1a2465=userIdsOf(_0x2055c1),_0x18192b=[];if(_0x3db006[_0x1ab7db(0x171)]!==undefined&&_0x3db006[_0x1ab7db(0x171)]!==_0x1a2465[_0x1ab7db(0x185)])throw CliErrors[_0x1ab7db(0x152)](_0x1ab7db(0x17a)+_0x3db006[_0x1ab7db(0x171)]+'\x20member(s)\x20but\x20role\x20has\x20'+_0x1a2465['length']+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x4c9afd=_0x1a2465[_0x1ab7db(0x1a0)](_0x46a064[_0x1ab7db(0x19d)]);let _0x7ff2b4=![];const _0x22f19b=[..._0x2055c1[_0x1ab7db(0x17b)]];if(_0x566328==='user-add')_0x4c9afd?_0x18192b[_0x1ab7db(0x167)](_0x1ab7db(0x180)+_0x46a064[_0x1ab7db(0x19d)]+_0x1ab7db(0x169)+_0x2055c1['roleName']+';\x20no\x20change.'):(_0x22f19b[_0x1ab7db(0x167)]({'userId':_0x46a064[_0x1ab7db(0x19d)],'username':_0x46a064['username'],..._0x46a064[_0x1ab7db(0x19c)]?{'nickname':_0x46a064[_0x1ab7db(0x19c)]}:{}}),_0x7ff2b4=!![]);else{if(!_0x4c9afd)_0x18192b[_0x1ab7db(0x167)](_0x1ab7db(0x180)+_0x46a064[_0x1ab7db(0x19d)]+_0x1ab7db(0x1a3)+_0x2055c1[_0x1ab7db(0x1a2)]+_0x1ab7db(0x160));else{const _0x4cbaa3=_0x22f19b['findIndex'](_0x5557d2=>_0x5557d2[_0x1ab7db(0x19d)]===_0x46a064[_0x1ab7db(0x19d)]);if(_0x4cbaa3>=0x0)_0x22f19b[_0x1ab7db(0x16f)](_0x4cbaa3,0x1);_0x7ff2b4=!![];}}const _0x178b52=_0x517921['map'](_0x503a95=>_0x503a95['id']===_0x407ab9?{..._0x503a95,'userList':_0x22f19b}:_0x503a95),_0x5e9ec5=_0x22f19b['map'](_0x59e91b=>_0x59e91b[_0x1ab7db(0x19d)]),_0x3d11d7={'operation':_0x566328,'selector':{'appCode':_0x3f7f09,'roleId':_0x407ab9,'roleName':_0x2055c1[_0x1ab7db(0x1a2)],'userId':_0x46a064['userId']},'before':{'userIds':_0x1a2465},'after':{'userIds':_0x5e9ec5},'dryRun':_0x3db006[_0x1ab7db(0x177)],'backend':{'method':_0x1ab7db(0x163),'path':UPDATE_USER_LIST_PATH},'warnings':_0x18192b};return{'roleList':_0x178b52,'mutation':_0x3d11d7,'changed':_0x7ff2b4};}export async function loadRoleUsers(_0x77522f){return listRoleUsers(_0x77522f);}export function readRoleRef(_0x3bf3bb){const _0x45d5c6=a184_0x3f8d3a,_0x235f55=_0x3bf3bb[_0x45d5c6(0x172)]('role')[_0x45d5c6(0x194)]();if(!_0x235f55)throw CliErrors[_0x45d5c6(0x176)](_0x45d5c6(0x16e),_0x45d5c6(0x190));return _0x235f55;}export async function prepareUserMutation(_0x15298e,_0x1897eb,_0x53f680){const _0x2c1173=a184_0x3f8d3a,_0x18d2d2=readRoleRef(_0x15298e),_0x1faa83=_0x15298e[_0x2c1173(0x172)](_0x2c1173(0x17f))['trim']();if(!_0x1faa83)throw CliErrors['flagMissing'](_0x2c1173(0x17f),_0x2c1173(0x155));const _0x37b18=_0x15298e['flag'](_0x2c1173(0x183)),_0xd4a469=_0x37b18===undefined||_0x37b18===null?undefined:Number(_0x37b18),_0x4e3369=await resolveRoleRef(_0x15298e[_0x2c1173(0x181)],_0x18d2d2),_0x15a5b8=await resolveUserRef(_0x1faa83),_0x4c5b37=await loadRoleUsers(_0x15298e['appCode']);return computeRoleUserMutation({'operation':_0x1897eb,'appCode':_0x15298e[_0x2c1173(0x181)],'roleUsers':_0x4c5b37,'targetRoleId':_0x4e3369['id'],'user':{'userId':_0x15a5b8[_0x2c1173(0x19d)],'username':_0x15a5b8[_0x2c1173(0x17d)],'nickname':_0x15a5b8[_0x2c1173(0x19c)]},'dryRun':_0x53f680,..._0xd4a469!==undefined?{'expectUserCount':_0xd4a469}:{}});}
1
+ const a184_0x2b58e8=a184_0xbdd4;(function(_0x8252c5,_0x2260e6){const _0x52f8a5=a184_0xbdd4,_0x53d173=_0x8252c5();while(!![]){try{const _0x4a1318=-parseInt(_0x52f8a5(0x1f0))/0x1+-parseInt(_0x52f8a5(0x1d8))/0x2+-parseInt(_0x52f8a5(0x1fe))/0x3*(parseInt(_0x52f8a5(0x1c1))/0x4)+parseInt(_0x52f8a5(0x1cb))/0x5*(parseInt(_0x52f8a5(0x1c7))/0x6)+-parseInt(_0x52f8a5(0x1ed))/0x7+parseInt(_0x52f8a5(0x1d6))/0x8*(parseInt(_0x52f8a5(0x1d1))/0x9)+parseInt(_0x52f8a5(0x1cc))/0xa*(parseInt(_0x52f8a5(0x1e5))/0xb);if(_0x4a1318===_0x2260e6)break;else _0x53d173['push'](_0x53d173['shift']());}catch(_0x44d1ff){_0x53d173['push'](_0x53d173['shift']());}}}(a184_0x4b94,0xb2641));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';function a184_0xbdd4(_0x4fa63e,_0x5ad8a0){_0x4fa63e=_0x4fa63e-0x1bb;const _0x4b94d7=a184_0x4b94();let _0xbdd417=_0x4b94d7[_0x4fa63e];return _0xbdd417;}export const ROLE_ID_FLAG={'name':'id','type':a184_0x2b58e8(0x1be),'required':!![],'description':'Role\x20id\x20(from\x20`role\x20list`)'};export const ROLE_REF_FLAG={'name':a184_0x2b58e8(0x1bd),'type':'string','required':!![],'description':'Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)'};export const USER_REF_FLAG={'name':a184_0x2b58e8(0x1c6),'type':a184_0x2b58e8(0x1d9),'required':!![],'description':a184_0x2b58e8(0x1bb)};export const NAME_FLAG={'name':a184_0x2b58e8(0x1f7),'type':a184_0x2b58e8(0x1d9),'required':!![],'description':a184_0x2b58e8(0x1de)};export const USER_NAME_FLAG={'name':a184_0x2b58e8(0x1f7),'type':'string','required':!![],'description':a184_0x2b58e8(0x1cf)};export const REMARK_FLAG={'name':a184_0x2b58e8(0x1fa),'type':a184_0x2b58e8(0x1d9),'required':![],'description':'Optional\x20role\x20remark/description'};export const EXPECT_USER_COUNT_FLAG={'name':a184_0x2b58e8(0x1f2),'type':a184_0x2b58e8(0x1be),'required':![],'description':a184_0x2b58e8(0x1f4)};function a184_0x4b94(){const _0x341e9c=['Role\x20id\x20','82608WAcbDw','roleName',';\x20no\x20change.','ADMIN','\x20member(s)\x20but\x20role\x20has\x20','user','5556ijcbjy','toLowerCase','Missing\x20user\x20reference.','roleType','4520dzXxaW','20kYbqEr','User\x20','userId','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','flag','135nwtVsH','str','splice','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','582008pQWISk','filter','1992090kMPsiE','string','\x20built-in\x20role\x20','DEV','Pass\x20--role\x20<id|name>.','expectUserCount','Role\x20name','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','Multiple\x20tenant\x20members\x20match\x20\x22','trim','Role\x20name\x20\x22','CUSTOM','tenant_code','13684429kTfsRl','userCount','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','userList','\x22:\x20','\x20is\x20not\x20a\x20member\x20of\x20role\x20','includes','10133802RinTcB','Cannot\x20','nickname','230079jnjhTU','Anti-drift\x20check\x20failed:\x20expected\x20','expect-user-count','appCode','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','POST','username','name','test','\x20is\x20already\x20a\x20member\x20of\x20role\x20','remark','flagMissing','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20','Disambiguate\x20with\x20--role\x20<id>.','147qLebuh','dryRun','/smartapi/permit/user-role/update-user-list','validation','authRequired','\x20not\x20found\x20in\x20the\x20user-role\x20list.','user-add','totalCount','map','length','tenant','findIndex','join','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','role','number','push'];a184_0x4b94=function(){return _0x341e9c;};return a184_0x4b94();}export const BUILTIN_ROLE_TYPES=[a184_0x2b58e8(0x1c4),a184_0x2b58e8(0x1db),'USER'];export function isBuiltinRole(_0x50d879){const _0x3a90d6=a184_0x2b58e8;return BUILTIN_ROLE_TYPES[_0x3a90d6(0x1ec)](_0x50d879);}export function assertCustomRole(_0x396c97,_0x179734){const _0x580a2d=a184_0x2b58e8;if(_0x396c97[_0x580a2d(0x1ca)]!==_0x580a2d(0x1e3))throw CliErrors[_0x580a2d(0x201)](_0x580a2d(0x1ee)+_0x179734+_0x580a2d(0x1da)+_0x396c97['roleName']+'\x20('+_0x396c97['roleType']+').',_0x580a2d(0x1d5));}export function assertPermConfigurable(_0x5cc18e){const _0x4ec77e=a184_0x2b58e8;if(_0x5cc18e[_0x4ec77e(0x1ca)]===_0x4ec77e(0x1db)||_0x5cc18e[_0x4ec77e(0x1ca)]===_0x4ec77e(0x1c4))throw CliErrors[_0x4ec77e(0x201)](_0x4ec77e(0x1fc)+_0x5cc18e[_0x4ec77e(0x1c2)]+'\x20('+_0x5cc18e[_0x4ec77e(0x1ca)]+').',_0x4ec77e(0x1df));}export function projectRole(_0x2a7821){const _0x41c4bd=a184_0x2b58e8;return{'id':_0x2a7821['id'],'roleName':_0x2a7821[_0x41c4bd(0x1c2)],'roleType':_0x2a7821[_0x41c4bd(0x1ca)],'remark':_0x2a7821[_0x41c4bd(0x1fa)],'userCount':_0x2a7821[_0x41c4bd(0x1e6)],'permitCount':_0x2a7821['permitCount'],'builtin':isBuiltinRole(_0x2a7821[_0x41c4bd(0x1ca)])};}export async function resolveRoleRef(_0x4138a,_0x451cc7){const _0x50bd7a=a184_0x2b58e8,_0x232f9a=_0x451cc7['trim']();if(!_0x232f9a)throw CliErrors['validation']('Missing\x20role\x20reference.',_0x50bd7a(0x1dc));if(/^\d+$/[_0x50bd7a(0x1f8)](_0x232f9a))return getRoleById(_0x4138a,Number(_0x232f9a));const _0x4605a3=await listAllAppRoles(_0x4138a),_0x4f518c=_0x4605a3[_0x50bd7a(0x1d7)](_0x429e9c=>_0x429e9c['roleName']===_0x232f9a);if(_0x4f518c[_0x50bd7a(0x207)]===0x0)throw CliErrors[_0x50bd7a(0x201)](_0x50bd7a(0x1e2)+_0x232f9a+'\x22\x20not\x20found\x20in\x20app\x20'+_0x4138a+'.',_0x50bd7a(0x1d4));if(_0x4f518c[_0x50bd7a(0x207)]>0x1){const _0x23b6be=_0x4f518c[_0x50bd7a(0x206)](_0x22408f=>_0x22408f['id'])[_0x50bd7a(0x20a)](',\x20');throw CliErrors[_0x50bd7a(0x201)](_0x50bd7a(0x1e2)+_0x232f9a+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x23b6be+').',_0x50bd7a(0x1fd));}return _0x4f518c[0x0];}export async function getRoleById(_0x54d434,_0x70fb3){const _0x48683f=a184_0x2b58e8,_0x5bb89f=await getAppRole(_0x70fb3);if(!_0x5bb89f)throw CliErrors[_0x48683f(0x201)]('Role\x20id\x20'+_0x70fb3+'\x20not\x20found\x20in\x20app\x20'+_0x54d434+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');return _0x5bb89f;}async function listAllAppRoles(_0x28adb7){const _0x97fc3d=a184_0x2b58e8,_0x38f410=0x64,_0x1b3f76=[];for(let _0x16d031=0x1;;_0x16d031+=0x1){const {items:_0xf48251,paging:_0x230646}=await listAppRoles(_0x28adb7,{'currentPage':_0x16d031,'pageSize':_0x38f410});_0x1b3f76['push'](..._0xf48251);if(_0xf48251[_0x97fc3d(0x207)]<_0x38f410||_0x230646&&_0x1b3f76[_0x97fc3d(0x207)]>=_0x230646[_0x97fc3d(0x205)])return _0x1b3f76;}}export async function resolveTenantCode(){const _0x18410f=a184_0x2b58e8,_0x33f6d0=await getSessionUserInfo(),_0x31d337=_0x33f6d0?.[_0x18410f(0x1c6)]?.[_0x18410f(0x208)]?.[_0x18410f(0x1e4)];if(!_0x31d337)throw CliErrors[_0x18410f(0x202)]('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x31d337;}function matchMember(_0xb170da,_0x2815a6){const _0x366ed2=a184_0x2b58e8,_0x362665=_0x2815a6['trim']()[_0x366ed2(0x1c8)]();return(_0xb170da['nickname']??'')[_0x366ed2(0x1c8)]()===_0x362665||(_0xb170da[_0x366ed2(0x1f6)]??'')['toLowerCase']()===_0x362665;}export async function resolveUserRef(_0x40a643){const _0x117bed=a184_0x2b58e8,_0x3e53a3=_0x40a643[_0x117bed(0x1e1)]();if(!_0x3e53a3)throw CliErrors[_0x117bed(0x201)](_0x117bed(0x1c9),'Pass\x20--user\x20<id|name>.');const _0x1a6324=await resolveTenantCode(),_0x1ef98b=await getTenantMembers(_0x1a6324);if(/^\d+$/[_0x117bed(0x1f8)](_0x3e53a3)){const _0x28e948=Number(_0x3e53a3),_0x271c42=_0x1ef98b['find'](_0x143e3b=>_0x143e3b['userId']===_0x28e948);return{'userId':_0x28e948,'username':_0x271c42?.[_0x117bed(0x1f6)]??String(_0x28e948),'nickname':_0x271c42?.[_0x117bed(0x1ef)],'matchedBy':'id'};}const _0x58e008=_0x1ef98b['filter'](_0x1dee2e=>matchMember(_0x1dee2e,_0x3e53a3));if(_0x58e008[_0x117bed(0x207)]===0x0)throw CliErrors[_0x117bed(0x201)]('No\x20tenant\x20member\x20matches\x20\x22'+_0x3e53a3+'\x22.',_0x117bed(0x1e8));if(_0x58e008[_0x117bed(0x207)]>0x1){const _0xf7421c=_0x58e008[_0x117bed(0x206)](_0x430b64=>(_0x430b64[_0x117bed(0x1ef)]??_0x430b64[_0x117bed(0x1f6)]??'?')+'('+_0x430b64[_0x117bed(0x1ce)]+')')[_0x117bed(0x20a)](',\x20');throw CliErrors[_0x117bed(0x201)](_0x117bed(0x1e0)+_0x3e53a3+_0x117bed(0x1ea)+_0xf7421c+'.','Disambiguate\x20with\x20--user\x20<id>.');}const _0x5438d1=_0x58e008[0x0];return{'userId':_0x5438d1['userId'],'username':_0x5438d1[_0x117bed(0x1f6)]??String(_0x5438d1[_0x117bed(0x1ce)]),'nickname':_0x5438d1[_0x117bed(0x1ef)],'matchedBy':'name'};}export const UPDATE_USER_LIST_PATH=a184_0x2b58e8(0x200);function userIdsOf(_0x16dd22){const _0x10dae8=a184_0x2b58e8;return(_0x16dd22?.[_0x10dae8(0x1e9)]??[])[_0x10dae8(0x206)](_0x558289=>_0x558289[_0x10dae8(0x1ce)]);}export function computeRoleUserMutation(_0xd518ef){const _0x4fc736=a184_0x2b58e8,{operation:_0x2fc291,appCode:_0x11f6dc,roleUsers:_0x309f81,targetRoleId:_0x36ae6d,user:_0x536b42}=_0xd518ef,_0x45259a=_0x309f81['find'](_0x30c32f=>_0x30c32f['id']===_0x36ae6d);if(!_0x45259a)throw CliErrors[_0x4fc736(0x201)](_0x4fc736(0x1c0)+_0x36ae6d+_0x4fc736(0x203),_0x4fc736(0x1e7));const _0x44beef=userIdsOf(_0x45259a),_0x508b4a=[];if(_0xd518ef[_0x4fc736(0x1dd)]!==undefined&&_0xd518ef[_0x4fc736(0x1dd)]!==_0x44beef['length'])throw CliErrors[_0x4fc736(0x201)](_0x4fc736(0x1f1)+_0xd518ef['expectUserCount']+_0x4fc736(0x1c5)+_0x44beef[_0x4fc736(0x207)]+'.',_0x4fc736(0x1bc));const _0x4a49da=_0x44beef[_0x4fc736(0x1ec)](_0x536b42[_0x4fc736(0x1ce)]);let _0x781a=![];const _0x271a8a=[..._0x45259a[_0x4fc736(0x1e9)]];if(_0x2fc291===_0x4fc736(0x204))_0x4a49da?_0x508b4a[_0x4fc736(0x1bf)](_0x4fc736(0x1cd)+_0x536b42[_0x4fc736(0x1ce)]+_0x4fc736(0x1f9)+_0x45259a['roleName']+_0x4fc736(0x1c3)):(_0x271a8a['push']({'userId':_0x536b42[_0x4fc736(0x1ce)],'username':_0x536b42[_0x4fc736(0x1f6)],..._0x536b42[_0x4fc736(0x1ef)]?{'nickname':_0x536b42['nickname']}:{}}),_0x781a=!![]);else{if(!_0x4a49da)_0x508b4a['push']('User\x20'+_0x536b42['userId']+_0x4fc736(0x1eb)+_0x45259a[_0x4fc736(0x1c2)]+_0x4fc736(0x1c3));else{const _0x48bf5d=_0x271a8a[_0x4fc736(0x209)](_0x2928bb=>_0x2928bb[_0x4fc736(0x1ce)]===_0x536b42['userId']);if(_0x48bf5d>=0x0)_0x271a8a[_0x4fc736(0x1d3)](_0x48bf5d,0x1);_0x781a=!![];}}const _0x252040=_0x309f81['map'](_0x32ed3f=>_0x32ed3f['id']===_0x36ae6d?{..._0x32ed3f,'userList':_0x271a8a}:_0x32ed3f),_0x5a62f4=_0x271a8a[_0x4fc736(0x206)](_0x968a45=>_0x968a45['userId']),_0x583d84={'operation':_0x2fc291,'selector':{'appCode':_0x11f6dc,'roleId':_0x36ae6d,'roleName':_0x45259a[_0x4fc736(0x1c2)],'userId':_0x536b42[_0x4fc736(0x1ce)]},'before':{'userIds':_0x44beef},'after':{'userIds':_0x5a62f4},'dryRun':_0xd518ef[_0x4fc736(0x1ff)],'backend':{'method':_0x4fc736(0x1f5),'path':UPDATE_USER_LIST_PATH},'warnings':_0x508b4a};return{'roleList':_0x252040,'mutation':_0x583d84,'changed':_0x781a};}export async function loadRoleUsers(_0x39d6c2){return listRoleUsers(_0x39d6c2);}export function readRoleRef(_0x508d9c){const _0x39fde0=a184_0x2b58e8,_0x3732ea=_0x508d9c[_0x39fde0(0x1d2)](_0x39fde0(0x1bd))[_0x39fde0(0x1e1)]();if(!_0x3732ea)throw CliErrors[_0x39fde0(0x1fb)]('role','Pass\x20--role\x20<id|name>.');return _0x3732ea;}export async function prepareUserMutation(_0x8d0d4e,_0x497ad4,_0x43e754){const _0x42fbfd=a184_0x2b58e8,_0x2e28ad=readRoleRef(_0x8d0d4e),_0x4e368d=_0x8d0d4e[_0x42fbfd(0x1d2)](_0x42fbfd(0x1c6))[_0x42fbfd(0x1e1)]();if(!_0x4e368d)throw CliErrors[_0x42fbfd(0x1fb)](_0x42fbfd(0x1c6),'Pass\x20--user\x20<id|name>.');const _0x35097a=_0x8d0d4e[_0x42fbfd(0x1d0)]('expect-user-count'),_0x560248=_0x35097a===undefined||_0x35097a===null?undefined:Number(_0x35097a),_0x262555=await resolveRoleRef(_0x8d0d4e[_0x42fbfd(0x1f3)],_0x2e28ad),_0x51062b=await resolveUserRef(_0x4e368d),_0x930f4b=await loadRoleUsers(_0x8d0d4e[_0x42fbfd(0x1f3)]);return computeRoleUserMutation({'operation':_0x497ad4,'appCode':_0x8d0d4e[_0x42fbfd(0x1f3)],'roleUsers':_0x930f4b,'targetRoleId':_0x262555['id'],'user':{'userId':_0x51062b['userId'],'username':_0x51062b[_0x42fbfd(0x1f6)],'nickname':_0x51062b[_0x42fbfd(0x1ef)]},'dryRun':_0x43e754,..._0x560248!==undefined?{'expectUserCount':_0x560248}:{}});}
@@ -1 +1 @@
1
- const a185_0x50058b=a185_0x13f7;(function(_0x24d52f,_0x31b8ab){const _0x50a62a=a185_0x13f7,_0x552d5c=_0x24d52f();while(!![]){try{const _0x1105c9=-parseInt(_0x50a62a(0x144))/0x1*(parseInt(_0x50a62a(0x14f))/0x2)+parseInt(_0x50a62a(0x14d))/0x3+-parseInt(_0x50a62a(0x153))/0x4*(-parseInt(_0x50a62a(0x148))/0x5)+parseInt(_0x50a62a(0x138))/0x6+parseInt(_0x50a62a(0x142))/0x7+-parseInt(_0x50a62a(0x150))/0x8*(parseInt(_0x50a62a(0x146))/0x9)+parseInt(_0x50a62a(0x147))/0xa;if(_0x1105c9===_0x31b8ab)break;else _0x552d5c['push'](_0x552d5c['shift']());}catch(_0x40920c){_0x552d5c['push'](_0x552d5c['shift']());}}}(a185_0x37e5,0x36226));function a185_0x37e5(){const _0x1c73b8=['999460OcPgBO','POST','10228mtPJuz','num','306dJJtOM','1276860KCHjYR','64490QdqcEZ','trim','Updated\x20role\x20','string','roleName','144390uMWddM','appCode','38qPndxl','62584YHZCbd','update','/smartapi/permit/role/update','4qIghgh','remark','2103324ucCSiO','validation','Nothing\x20to\x20update.','length','write','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','--name\x20cannot\x20be\x20empty.','\x20(id=','flag'];a185_0x37e5=function(){return _0x1c73b8;};return a185_0x37e5();}import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a185_0x50058b(0x152);function readPatch(_0x386c94){const _0x425b65=a185_0x50058b,_0x10820e=_0x386c94[_0x425b65(0x141)]('name'),_0x10ae75=_0x386c94['flag'](_0x425b65(0x137)),_0x2e43e4={};if(_0x10820e!==undefined&&_0x10820e!==null){const _0x4d7874=String(_0x10820e)[_0x425b65(0x149)]();if(!_0x4d7874)throw CliErrors['validation'](_0x425b65(0x13f));if(_0x4d7874[_0x425b65(0x13b)]>0x40)throw CliErrors[_0x425b65(0x139)](_0x425b65(0x13e));_0x2e43e4['roleName']=_0x4d7874;}_0x10ae75!==undefined&&_0x10ae75!==null&&(_0x2e43e4[_0x425b65(0x137)]=String(_0x10ae75));if(_0x2e43e4['roleName']===undefined&&_0x2e43e4['remark']===undefined)throw CliErrors[_0x425b65(0x139)](_0x425b65(0x13a),_0x425b65(0x13d));return _0x2e43e4;}function a185_0x13f7(_0x12ee40,_0x16380c){_0x12ee40=_0x12ee40-0x137;const _0x37e55e=a185_0x37e5();let _0x13f7aa=_0x37e55e[_0x12ee40];return _0x13f7aa;}export const roleUpdate={'service':'role','command':a185_0x50058b(0x151),'description':'Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','risk':a185_0x50058b(0x13c),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':'name','type':a185_0x50058b(0x14b),'required':![],'description':'New\x20role\x20name'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x58ab2f){readPatch(_0x58ab2f);},async 'dryRun'(_0x579760){const _0x453eb8=a185_0x50058b,_0x597ce3=_0x579760[_0x453eb8(0x145)]('id'),_0x5082e0=readPatch(_0x579760),_0x5c0d03=await getRoleById(_0x579760['appCode'],_0x597ce3);return assertCustomRole(_0x5c0d03,_0x453eb8(0x151)),asDryRunResult({'operation':_0x453eb8(0x151),'selector':{'appCode':_0x579760[_0x453eb8(0x14e)],'roleId':_0x597ce3,'roleName':_0x5c0d03[_0x453eb8(0x14c)]},'before':projectRole(_0x5c0d03),'after':projectRole({..._0x5c0d03,..._0x5082e0['roleName']!==undefined?{'roleName':_0x5082e0['roleName']}:{},..._0x5082e0[_0x453eb8(0x137)]!==undefined?{'remark':_0x5082e0['remark']}:{}}),'dryRun':!![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},{'method':_0x453eb8(0x143),'url':UPDATE_PATH});},async 'execute'(_0x355b43){const _0x244e9f=a185_0x50058b,_0x1b1bd0=_0x355b43[_0x244e9f(0x145)]('id'),_0x40c9d4=readPatch(_0x355b43),_0x58b4a5=await getRoleById(_0x355b43[_0x244e9f(0x14e)],_0x1b1bd0);assertCustomRole(_0x58b4a5,_0x244e9f(0x151)),await updateAppRole({'id':_0x1b1bd0,'appCode':_0x355b43[_0x244e9f(0x14e)],..._0x40c9d4[_0x244e9f(0x14c)]!==undefined?{'roleName':_0x40c9d4['roleName']}:{},..._0x40c9d4[_0x244e9f(0x137)]!==undefined?{'remark':_0x40c9d4[_0x244e9f(0x137)]}:{}});const _0x1c7c4b=await getRoleById(_0x355b43['appCode'],_0x1b1bd0);return{'ok':!![],'data':{'operation':_0x244e9f(0x151),'selector':{'appCode':_0x355b43[_0x244e9f(0x14e)],'roleId':_0x1b1bd0,'roleName':_0x1c7c4b[_0x244e9f(0x14c)]},'before':projectRole(_0x58b4a5),'after':projectRole(_0x1c7c4b),'dryRun':![],'backend':{'method':_0x244e9f(0x143),'path':UPDATE_PATH},'warnings':[]},'message':_0x244e9f(0x14a)+_0x1c7c4b[_0x244e9f(0x14c)]+_0x244e9f(0x140)+_0x1b1bd0+')'};}};
1
+ const a185_0x73fcba=a185_0x3c4f;(function(_0x28d542,_0x4b1f97){const _0x3c553d=a185_0x3c4f,_0x4f7aac=_0x28d542();while(!![]){try{const _0x4bec57=parseInt(_0x3c553d(0x1cd))/0x1+parseInt(_0x3c553d(0x1c4))/0x2*(parseInt(_0x3c553d(0x1d3))/0x3)+-parseInt(_0x3c553d(0x1c7))/0x4*(-parseInt(_0x3c553d(0x1cf))/0x5)+parseInt(_0x3c553d(0x1c6))/0x6+-parseInt(_0x3c553d(0x1d4))/0x7*(parseInt(_0x3c553d(0x1d7))/0x8)+-parseInt(_0x3c553d(0x1d6))/0x9*(-parseInt(_0x3c553d(0x1d2))/0xa)+-parseInt(_0x3c553d(0x1d5))/0xb*(-parseInt(_0x3c553d(0x1dc))/0xc);if(_0x4bec57===_0x4b1f97)break;else _0x4f7aac['push'](_0x4f7aac['shift']());}catch(_0x26320c){_0x4f7aac['push'](_0x4f7aac['shift']());}}}(a185_0x3c92,0x9d4ea));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a185_0x3c92(){const _0x472be2=['update','2282544QJxhJj','824EhEmjj','Updated\x20role\x20','/smartapi/permit/role/update','validation','\x20(id=','name','125326tqMzmt','num','1230AKlZNd','trim','Nothing\x20to\x20update.','2102510SNjnaL','1335OCWlOV','7LiAXoV','1529jUKvnx','9wDhOWl','9687280nUjAkn','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','POST','appCode','roleName','83604ecmxOb','string','flag','write','length','remark','540Mjixou'];a185_0x3c92=function(){return _0x472be2;};return a185_0x3c92();}import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a185_0x73fcba(0x1c9);function a185_0x3c4f(_0x2471e0,_0x25ed50){_0x2471e0=_0x2471e0-0x1c1;const _0x3c9270=a185_0x3c92();let _0x3c4f19=_0x3c9270[_0x2471e0];return _0x3c4f19;}function readPatch(_0x508633){const _0x8f7a6a=a185_0x73fcba,_0x5e51b4=_0x508633[_0x8f7a6a(0x1de)](_0x8f7a6a(0x1cc)),_0x404879=_0x508633[_0x8f7a6a(0x1de)](_0x8f7a6a(0x1c3)),_0x5dc84c={};if(_0x5e51b4!==undefined&&_0x5e51b4!==null){const _0x28c93e=String(_0x5e51b4)[_0x8f7a6a(0x1d0)]();if(!_0x28c93e)throw CliErrors[_0x8f7a6a(0x1ca)]('--name\x20cannot\x20be\x20empty.');if(_0x28c93e[_0x8f7a6a(0x1c2)]>0x40)throw CliErrors[_0x8f7a6a(0x1ca)]('Role\x20name\x20cannot\x20exceed\x2064\x20characters.');_0x5dc84c[_0x8f7a6a(0x1db)]=_0x28c93e;}_0x404879!==undefined&&_0x404879!==null&&(_0x5dc84c['remark']=String(_0x404879));if(_0x5dc84c[_0x8f7a6a(0x1db)]===undefined&&_0x5dc84c[_0x8f7a6a(0x1c3)]===undefined)throw CliErrors[_0x8f7a6a(0x1ca)](_0x8f7a6a(0x1d1),_0x8f7a6a(0x1d8));return _0x5dc84c;}export const roleUpdate={'service':'role','command':a185_0x73fcba(0x1c5),'description':'Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','risk':a185_0x73fcba(0x1c1),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a185_0x73fcba(0x1cc),'type':a185_0x73fcba(0x1dd),'required':![],'description':'New\x20role\x20name'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x4c77b5){readPatch(_0x4c77b5);},async 'dryRun'(_0x2a6016){const _0x188365=a185_0x73fcba,_0x79a266=_0x2a6016['num']('id'),_0xcb7d28=readPatch(_0x2a6016),_0x4a0109=await getRoleById(_0x2a6016[_0x188365(0x1da)],_0x79a266);return assertCustomRole(_0x4a0109,'update'),asDryRunResult({'operation':_0x188365(0x1c5),'selector':{'appCode':_0x2a6016['appCode'],'roleId':_0x79a266,'roleName':_0x4a0109['roleName']},'before':projectRole(_0x4a0109),'after':projectRole({..._0x4a0109,..._0xcb7d28[_0x188365(0x1db)]!==undefined?{'roleName':_0xcb7d28[_0x188365(0x1db)]}:{},..._0xcb7d28[_0x188365(0x1c3)]!==undefined?{'remark':_0xcb7d28[_0x188365(0x1c3)]}:{}}),'dryRun':!![],'backend':{'method':_0x188365(0x1d9),'path':UPDATE_PATH},'warnings':[]},{'method':'POST','url':UPDATE_PATH});},async 'execute'(_0x44c1ec){const _0x528f64=a185_0x73fcba,_0x3ec08a=_0x44c1ec[_0x528f64(0x1ce)]('id'),_0x5502ea=readPatch(_0x44c1ec),_0x296fe6=await getRoleById(_0x44c1ec[_0x528f64(0x1da)],_0x3ec08a);assertCustomRole(_0x296fe6,_0x528f64(0x1c5)),await updateAppRole({'id':_0x3ec08a,'appCode':_0x44c1ec[_0x528f64(0x1da)],..._0x5502ea[_0x528f64(0x1db)]!==undefined?{'roleName':_0x5502ea[_0x528f64(0x1db)]}:{},..._0x5502ea[_0x528f64(0x1c3)]!==undefined?{'remark':_0x5502ea[_0x528f64(0x1c3)]}:{}});const _0x120f5b=await getRoleById(_0x44c1ec[_0x528f64(0x1da)],_0x3ec08a);return{'ok':!![],'data':{'operation':_0x528f64(0x1c5),'selector':{'appCode':_0x44c1ec[_0x528f64(0x1da)],'roleId':_0x3ec08a,'roleName':_0x120f5b[_0x528f64(0x1db)]},'before':projectRole(_0x296fe6),'after':projectRole(_0x120f5b),'dryRun':![],'backend':{'method':_0x528f64(0x1d9),'path':UPDATE_PATH},'warnings':[]},'message':_0x528f64(0x1c8)+_0x120f5b['roleName']+_0x528f64(0x1cb)+_0x3ec08a+')'};}};
@@ -1 +1 @@
1
- const a186_0x1edc10=a186_0x235b;(function(_0x45475a,_0x6a1ce7){const _0x3a9695=a186_0x235b,_0x2c1373=_0x45475a();while(!![]){try{const _0x1b2072=parseInt(_0x3a9695(0xc2))/0x1+-parseInt(_0x3a9695(0xc8))/0x2+parseInt(_0x3a9695(0xba))/0x3*(-parseInt(_0x3a9695(0xc3))/0x4)+-parseInt(_0x3a9695(0xc9))/0x5+-parseInt(_0x3a9695(0xb9))/0x6*(-parseInt(_0x3a9695(0xbb))/0x7)+parseInt(_0x3a9695(0xc5))/0x8+-parseInt(_0x3a9695(0xb5))/0x9*(-parseInt(_0x3a9695(0xc0))/0xa);if(_0x1b2072===_0x6a1ce7)break;else _0x2c1373['push'](_0x2c1373['shift']());}catch(_0x4aabde){_0x2c1373['push'](_0x2c1373['shift']());}}}(a186_0xc7c6,0xc4e17));import{updateRoleUsers}from'../../core/api-client.js';function a186_0xc7c6(){const _0x208861=['22370TRVuKa','high-risk-write','264994fyBHqy','4bSBmbI','userId','2072120lxKFhg','\x20to\x20role\x20','appCode','2404952szaYfa','8051485zRPTPp','Added\x20user\x20','11943UTHlZJ','user-add','role','selector','5784TjiEWw','510672RxXypA','2156aQYwRl','No\x20change:\x20user\x20','Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','POST','roleName'];a186_0xc7c6=function(){return _0x208861;};return a186_0xc7c6();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';function a186_0x235b(_0x2817f2,_0x33675e){_0x2817f2=_0x2817f2-0xb5;const _0xc7c60b=a186_0xc7c6();let _0x235ba8=_0xc7c60b[_0x2817f2];return _0x235ba8;}export const roleUserAdd={'service':a186_0x1edc10(0xb7),'command':'user-add','description':a186_0x1edc10(0xbd),'risk':a186_0x1edc10(0xc1),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0xe24983){const _0x10361c=a186_0x1edc10,{mutation:_0x4261a8}=await prepareUserMutation(_0xe24983,_0x10361c(0xb6),!![]);return asDryRunResult(_0x4261a8,{'method':_0x10361c(0xbe),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x6b05c6){const _0x41d19d=a186_0x1edc10,{roleList:_0x5b7428,mutation:_0x147f0a,changed:_0x5c3de7}=await prepareUserMutation(_0x6b05c6,_0x41d19d(0xb6),![]);return _0x5c3de7&&await updateRoleUsers(_0x6b05c6[_0x41d19d(0xc7)],_0x5b7428),{'ok':!![],'data':_0x147f0a,'message':_0x5c3de7?_0x41d19d(0xca)+_0x147f0a[_0x41d19d(0xb8)][_0x41d19d(0xc4)]+_0x41d19d(0xc6)+_0x147f0a[_0x41d19d(0xb8)][_0x41d19d(0xbf)]:_0x41d19d(0xbc)+_0x147f0a[_0x41d19d(0xb8)]['userId']+'\x20already\x20in\x20role\x20'+_0x147f0a[_0x41d19d(0xb8)]['roleName']};}};
1
+ const a186_0x52070d=a186_0x1a69;(function(_0x13fc95,_0x107fc0){const _0x286b41=a186_0x1a69,_0x3e1ccf=_0x13fc95();while(!![]){try{const _0x24405a=-parseInt(_0x286b41(0xeb))/0x1*(parseInt(_0x286b41(0xec))/0x2)+parseInt(_0x286b41(0xe6))/0x3*(-parseInt(_0x286b41(0xe7))/0x4)+parseInt(_0x286b41(0xde))/0x5+parseInt(_0x286b41(0xea))/0x6*(-parseInt(_0x286b41(0xda))/0x7)+parseInt(_0x286b41(0xe4))/0x8*(parseInt(_0x286b41(0xdb))/0x9)+parseInt(_0x286b41(0xe3))/0xa+-parseInt(_0x286b41(0xe9))/0xb*(parseInt(_0x286b41(0xd9))/0xc);if(_0x24405a===_0x107fc0)break;else _0x3e1ccf['push'](_0x3e1ccf['shift']());}catch(_0xe5009){_0x3e1ccf['push'](_0x3e1ccf['shift']());}}}(a186_0x5a7f,0x9136c));import{updateRoleUsers}from'../../core/api-client.js';function a186_0x1a69(_0x328e1a,_0x26e961){_0x328e1a=_0x328e1a-0xd9;const _0x5a7f77=a186_0x5a7f();let _0x1a6932=_0x5a7f77[_0x328e1a];return _0x1a6932;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';function a186_0x5a7f(){const _0x41a45c=['user-add','Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','\x20to\x20role\x20','POST','8073950MKVgZj','24gxDLtZ','roleName','3MhhHsU','848372JjXYVX','selector','5588eYMnWA','3216lqylTk','9489gmiakK','54RGgcZv','userId','role','8508htOQXI','336KTjHkR','588429ZutfbD','high-risk-write','No\x20change:\x20user\x20','2227270ezwqIR'];a186_0x5a7f=function(){return _0x41a45c;};return a186_0x5a7f();}export const roleUserAdd={'service':a186_0x52070d(0xee),'command':a186_0x52070d(0xdf),'description':a186_0x52070d(0xe0),'risk':a186_0x52070d(0xdc),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x46e984){const _0x2a8a01=a186_0x52070d,{mutation:_0x51f272}=await prepareUserMutation(_0x46e984,_0x2a8a01(0xdf),!![]);return asDryRunResult(_0x51f272,{'method':_0x2a8a01(0xe2),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x4da61c){const _0x1dcb59=a186_0x52070d,{roleList:_0x50a45f,mutation:_0x219c9f,changed:_0x2777d2}=await prepareUserMutation(_0x4da61c,_0x1dcb59(0xdf),![]);return _0x2777d2&&await updateRoleUsers(_0x4da61c['appCode'],_0x50a45f),{'ok':!![],'data':_0x219c9f,'message':_0x2777d2?'Added\x20user\x20'+_0x219c9f[_0x1dcb59(0xe8)][_0x1dcb59(0xed)]+_0x1dcb59(0xe1)+_0x219c9f['selector'][_0x1dcb59(0xe5)]:_0x1dcb59(0xdd)+_0x219c9f[_0x1dcb59(0xe8)][_0x1dcb59(0xed)]+'\x20already\x20in\x20role\x20'+_0x219c9f[_0x1dcb59(0xe8)][_0x1dcb59(0xe5)]};}};
@@ -1 +1 @@
1
- const a187_0x499735=a187_0x16cd;(function(_0x390665,_0x53aa8a){const _0x225930=a187_0x16cd,_0x3c366c=_0x390665();while(!![]){try{const _0x32885d=parseInt(_0x225930(0x89))/0x1*(-parseInt(_0x225930(0x7a))/0x2)+-parseInt(_0x225930(0x79))/0x3+parseInt(_0x225930(0x8a))/0x4+-parseInt(_0x225930(0x88))/0x5*(parseInt(_0x225930(0x84))/0x6)+parseInt(_0x225930(0x86))/0x7+-parseInt(_0x225930(0x82))/0x8+parseInt(_0x225930(0x78))/0x9*(parseInt(_0x225930(0x7d))/0xa);if(_0x32885d===_0x53aa8a)break;else _0x3c366c['push'](_0x3c366c['shift']());}catch(_0x186d89){_0x3c366c['push'](_0x3c366c['shift']());}}}(a187_0x4966,0x953b3));import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a187_0x16cd(_0x2a45f2,_0x114df4){_0x2a45f2=_0x2a45f2-0x78;const _0x4966b2=a187_0x4966();let _0x16cd45=_0x4966b2[_0x2a45f2];return _0x16cd45;}import{asDryRunResult}from'../../commands/common/dry-run.js';function a187_0x4966(){const _0x269dcb=['70smrGqM','Removed\x20user\x20','appCode','No\x20change:\x20user\x20','userId','5030544BrexgW','user-remove','6259326tQbwGN','POST','210378uWOIDP','roleName','5YJzPrc','1tHpquB','97436tJIIGx','selector','4183020tWuqYX','1112250ACuTlD','1307666UWpGbo','\x20from\x20role\x20','high-risk-write'];a187_0x4966=function(){return _0x269dcb;};return a187_0x4966();}import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':'role','command':'user-remove','description':'Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','risk':a187_0x499735(0x7c),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x192042){const _0x5215f8=a187_0x499735,{mutation:_0x45d2a7}=await prepareUserMutation(_0x192042,_0x5215f8(0x83),!![]);return asDryRunResult(_0x45d2a7,{'method':_0x5215f8(0x85),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0xfa2eff){const _0x40fa74=a187_0x499735,{roleList:_0x4b1f91,mutation:_0x14f12d,changed:_0x3f189}=await prepareUserMutation(_0xfa2eff,_0x40fa74(0x83),![]);return _0x3f189&&await updateRoleUsers(_0xfa2eff[_0x40fa74(0x7f)],_0x4b1f91),{'ok':!![],'data':_0x14f12d,'message':_0x3f189?_0x40fa74(0x7e)+_0x14f12d[_0x40fa74(0x8b)][_0x40fa74(0x81)]+_0x40fa74(0x7b)+_0x14f12d['selector'][_0x40fa74(0x87)]:_0x40fa74(0x80)+_0x14f12d[_0x40fa74(0x8b)][_0x40fa74(0x81)]+'\x20not\x20in\x20role\x20'+_0x14f12d[_0x40fa74(0x8b)][_0x40fa74(0x87)]};}};
1
+ function a187_0x4a14(){const _0x1f2f87=['Removed\x20user\x20','2604EUoLRw','4171592UqMBgv','8616490hChjZw','selector','127448Grwrwu','POST','user-remove','roleName','3205DcyYMx','6126IIDrWL','11RoVgGn','high-risk-write','Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','7231546gALSVT','\x20from\x20role\x20','\x20not\x20in\x20role\x20','userId','4517946UvcnwC','3NaEyBt','appCode','role','235xjyjlo'];a187_0x4a14=function(){return _0x1f2f87;};return a187_0x4a14();}const a187_0x1bedb3=a187_0x287c;(function(_0x2655ca,_0x11b424){const _0x24cda1=a187_0x287c,_0x2fcaf6=_0x2655ca();while(!![]){try{const _0x262fff=parseInt(_0x24cda1(0x91))/0x1*(parseInt(_0x24cda1(0x85))/0x2)+parseInt(_0x24cda1(0x8e))/0x3*(-parseInt(_0x24cda1(0x94))/0x4)+parseInt(_0x24cda1(0x84))/0x5*(parseInt(_0x24cda1(0x93))/0x6)+parseInt(_0x24cda1(0x89))/0x7+parseInt(_0x24cda1(0x80))/0x8+parseInt(_0x24cda1(0x8d))/0x9+parseInt(_0x24cda1(0x95))/0xa*(-parseInt(_0x24cda1(0x86))/0xb);if(_0x262fff===_0x11b424)break;else _0x2fcaf6['push'](_0x2fcaf6['shift']());}catch(_0x8f17aa){_0x2fcaf6['push'](_0x2fcaf6['shift']());}}}(a187_0x4a14,0x9d567));import{updateRoleUsers}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,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';function a187_0x287c(_0x2bba42,_0x4d2f89){_0x2bba42=_0x2bba42-0x7f;const _0x4a14ce=a187_0x4a14();let _0x287cb6=_0x4a14ce[_0x2bba42];return _0x287cb6;}export const roleUserRemove={'service':a187_0x1bedb3(0x90),'command':a187_0x1bedb3(0x82),'description':a187_0x1bedb3(0x88),'risk':a187_0x1bedb3(0x87),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x204147){const _0x168f73=a187_0x1bedb3,{mutation:_0x2701e5}=await prepareUserMutation(_0x204147,_0x168f73(0x82),!![]);return asDryRunResult(_0x2701e5,{'method':_0x168f73(0x81),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x4690c1){const _0x8cb806=a187_0x1bedb3,{roleList:_0x2fa13a,mutation:_0x430c25,changed:_0x312de6}=await prepareUserMutation(_0x4690c1,_0x8cb806(0x82),![]);return _0x312de6&&await updateRoleUsers(_0x4690c1[_0x8cb806(0x8f)],_0x2fa13a),{'ok':!![],'data':_0x430c25,'message':_0x312de6?_0x8cb806(0x92)+_0x430c25[_0x8cb806(0x7f)][_0x8cb806(0x8c)]+_0x8cb806(0x8a)+_0x430c25[_0x8cb806(0x7f)][_0x8cb806(0x83)]:'No\x20change:\x20user\x20'+_0x430c25['selector'][_0x8cb806(0x8c)]+_0x8cb806(0x8b)+_0x430c25[_0x8cb806(0x7f)][_0x8cb806(0x83)]};}};
@@ -1 +1 @@
1
- function a188_0x5471(_0x9e2d36,_0x10932e){_0x9e2d36=_0x9e2d36-0x14d;const _0x54694f=a188_0x5469();let _0x547131=_0x54694f[_0x9e2d36];return _0x547131;}const a188_0x28acb9=a188_0x5471;(function(_0x4b608c,_0x4649a){const _0x70db65=a188_0x5471,_0x3b95ed=_0x4b608c();while(!![]){try{const _0x2b7260=-parseInt(_0x70db65(0x162))/0x1*(parseInt(_0x70db65(0x154))/0x2)+-parseInt(_0x70db65(0x167))/0x3*(-parseInt(_0x70db65(0x150))/0x4)+parseInt(_0x70db65(0x14e))/0x5*(-parseInt(_0x70db65(0x15b))/0x6)+-parseInt(_0x70db65(0x151))/0x7+parseInt(_0x70db65(0x160))/0x8*(parseInt(_0x70db65(0x161))/0x9)+parseInt(_0x70db65(0x152))/0xa*(parseInt(_0x70db65(0x157))/0xb)+parseInt(_0x70db65(0x158))/0xc;if(_0x2b7260===_0x4649a)break;else _0x3b95ed['push'](_0x3b95ed['shift']());}catch(_0x777b36){_0x3b95ed['push'](_0x3b95ed['shift']());}}}(a188_0x5469,0x81ef9));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';function a188_0x5469(){const _0x5d79a4=['username','1142590uuNPJf','userId','441052yZbCnp','5198739xVrRed','60gumJxL','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','105414IiJbZX','nickname','read','978560ZdYRlq','11588604axdQIO','str','name','6iWMSWa','matchedBy','\x22\x20→\x20userId\x20','flagMissing','role','32qHDAsG','1269711uusiox','19LxKHWG','Pass\x20--name\x20<nickname|username>.','trim','Resolved\x20\x22','user-resolve','12ufUROi'];a188_0x5469=function(){return _0x5d79a4;};return a188_0x5469();}export const roleUserResolve={'service':a188_0x28acb9(0x15f),'command':a188_0x28acb9(0x166),'description':a188_0x28acb9(0x153),'risk':a188_0x28acb9(0x156),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0xa42e14){const _0x48d6e3=a188_0x28acb9;if(!_0xa42e14[_0x48d6e3(0x159)](_0x48d6e3(0x15a))[_0x48d6e3(0x164)]())throw CliErrors[_0x48d6e3(0x15e)](_0x48d6e3(0x15a),_0x48d6e3(0x163));},async 'execute'(_0x48ab93){const _0x172e92=a188_0x28acb9,_0x2c4e9a=_0x48ab93[_0x172e92(0x159)]('name')['trim'](),_0x36c760=await resolveUserRef(_0x2c4e9a);return{'ok':!![],'data':{'user':{'userId':_0x36c760[_0x172e92(0x14f)],'username':_0x36c760[_0x172e92(0x14d)],'nickname':_0x36c760[_0x172e92(0x155)],'matchedBy':_0x36c760[_0x172e92(0x15c)]}},'message':_0x172e92(0x165)+_0x2c4e9a+_0x172e92(0x15d)+_0x36c760[_0x172e92(0x14f)]};}};
1
+ function a188_0xdf81(){const _0x332142=['name','read','Pass\x20--name\x20<nickname|username>.','Resolved\x20\x22','\x22\x20→\x20userId\x20','user-resolve','29613oZTZMS','342748qMxBvQ','12447BFTKtO','115SmSmZw','3634815LtWEGF','248ittvlF','8613654IZQMoL','role','username','trim','str','matchedBy','23920EbnnlW','4SBWYhv','11170pHSMXl','userId','12hkmUwp','33523556WISvQD'];a188_0xdf81=function(){return _0x332142;};return a188_0xdf81();}const a188_0x541470=a188_0x9e75;function a188_0x9e75(_0x21b461,_0x1ae0d2){_0x21b461=_0x21b461-0xc7;const _0xdf813f=a188_0xdf81();let _0x9e7537=_0xdf813f[_0x21b461];return _0x9e7537;}(function(_0x36e540,_0x420985){const _0x34768d=a188_0x9e75,_0x1694cf=_0x36e540();while(!![]){try{const _0x33cf99=-parseInt(_0x34768d(0xda))/0x1*(parseInt(_0x34768d(0xcb))/0x2)+-parseInt(_0x34768d(0xd7))/0x3*(parseInt(_0x34768d(0xcc))/0x4)+parseInt(_0x34768d(0xdb))/0x5+parseInt(_0x34768d(0xdd))/0x6+-parseInt(_0x34768d(0xd8))/0x7*(-parseInt(_0x34768d(0xdc))/0x8)+parseInt(_0x34768d(0xd9))/0x9*(parseInt(_0x34768d(0xcd))/0xa)+-parseInt(_0x34768d(0xd0))/0xb*(parseInt(_0x34768d(0xcf))/0xc);if(_0x33cf99===_0x420985)break;else _0x1694cf['push'](_0x1694cf['shift']());}catch(_0x51c686){_0x1694cf['push'](_0x1694cf['shift']());}}}(a188_0xdf81,0xc1750));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a188_0x541470(0xde),'command':a188_0x541470(0xd6),'description':'Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','risk':a188_0x541470(0xd2),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x4e8c3e){const _0x87c5ae=a188_0x541470;if(!_0x4e8c3e['str'](_0x87c5ae(0xd1))[_0x87c5ae(0xc8)]())throw CliErrors['flagMissing'](_0x87c5ae(0xd1),_0x87c5ae(0xd3));},async 'execute'(_0x19680f){const _0xbecab0=a188_0x541470,_0x500030=_0x19680f[_0xbecab0(0xc9)](_0xbecab0(0xd1))['trim'](),_0x5a1cfc=await resolveUserRef(_0x500030);return{'ok':!![],'data':{'user':{'userId':_0x5a1cfc[_0xbecab0(0xce)],'username':_0x5a1cfc[_0xbecab0(0xc7)],'nickname':_0x5a1cfc['nickname'],'matchedBy':_0x5a1cfc[_0xbecab0(0xca)]}},'message':_0xbecab0(0xd4)+_0x500030+_0xbecab0(0xd5)+_0x5a1cfc[_0xbecab0(0xce)]};}};
@@ -1 +1 @@
1
- const a189_0x5e10bb=a189_0x5ad4;(function(_0x38a412,_0x1aa8d2){const _0x257d9c=a189_0x5ad4,_0x506700=_0x38a412();while(!![]){try{const _0x4686e3=-parseInt(_0x257d9c(0x18b))/0x1+-parseInt(_0x257d9c(0x16f))/0x2*(parseInt(_0x257d9c(0x17d))/0x3)+-parseInt(_0x257d9c(0x189))/0x4+-parseInt(_0x257d9c(0x17a))/0x5+-parseInt(_0x257d9c(0x173))/0x6+parseInt(_0x257d9c(0x16a))/0x7*(parseInt(_0x257d9c(0x16b))/0x8)+parseInt(_0x257d9c(0x18e))/0x9;if(_0x4686e3===_0x1aa8d2)break;else _0x506700['push'](_0x506700['shift']());}catch(_0x1eae7c){_0x506700['push'](_0x506700['shift']());}}}(a189_0x410c,0x97733));import{readFileSync,existsSync}from'node:fs';function a189_0x5ad4(_0x1ce497,_0x30f006){_0x1ce497=_0x1ce497-0x169;const _0x410c95=a189_0x410c();let _0x5ad496=_0x410c95[_0x1ce497];return _0x5ad496;}import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';function a189_0x410c(){const _0x4968c0=['build','No\x20package.json\x20found\x20in\x20current\x20directory.','belowMinimum','cwd','slice','\x20run\x20','Enable\x20watch\x20mode\x20for\x20preview','No\x20scripts\x20defined\x20in\x20package.json.','node_modules','log','\x20run\x20build','keys','yarn.lock','start','--watch','run','.bin','length','\x20exited\x20with\x20code\x20','\x20\x20\x20\x20','1295NmSBAU','5064eweLDS','close','bun','\x0a\x20\x20Usage:\x20','884srQTwy','bun.lock','validation','needsUpgrade','3117432zGZfFy','script','has','parse','Script\x20\x22','inherit','(none)','3804090cLENwV','\x22\x20not\x20found\x20in\x20package.json.','boolean','5538lJTuVa','join','scripts','vite\x20preview\x20exited\x20with\x20code\x20','watch','push','Script\x20name\x20defined\x20in\x20package.json','npm','Run\x20a\x20package.json\x20script','\x20run\x20<script>\x0a','args','\x0a\x20\x20Available\x20scripts:\x0a','924200cXEBtO','preview','83489RCkreX','yarn','vite','26226855BPuRLZ','error'];a189_0x410c=function(){return _0x4968c0;};return a189_0x410c();}import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a189_0x5e10bb(0x19d),'dev']);function readPackageScripts(_0x23d101){const _0x2ae8fb=a189_0x5e10bb,_0x52255c=resolve(_0x23d101,'package.json');if(!existsSync(_0x52255c))return null;try{const _0x3ae475=JSON[_0x2ae8fb(0x176)](readFileSync(_0x52255c,'utf-8'));return _0x3ae475[_0x2ae8fb(0x17f)]??{};}catch{return null;}}function detectPackageManager(_0x1078b7){const _0x317719=a189_0x5e10bb;if(existsSync(resolve(_0x1078b7,'bun.lockb'))||existsSync(resolve(_0x1078b7,_0x317719(0x170))))return _0x317719(0x16d);if(existsSync(resolve(_0x1078b7,'pnpm-lock.yaml')))return'pnpm';if(existsSync(resolve(_0x1078b7,_0x317719(0x19c))))return _0x317719(0x18c);return _0x317719(0x184);}async function versionCheck(_0x21bd7f){const _0x3ac79a=a189_0x5e10bb,_0x37753c=await checkCliVersion();(_0x37753c[_0x3ac79a(0x172)]||_0x37753c[_0x3ac79a(0x192)])&&(printCliUpgradeWarning(_0x37753c),assertCliVersionSupported(_0x37753c));const _0x57f79c=await checkSdkVersion(_0x21bd7f);if(_0x57f79c['needsUpgrade'])printSdkUpgradeWarning(_0x57f79c);}function spawnScript(_0x453ac2,_0x826d0a,_0x3024da,_0x275b9d){return new Promise((_0x5ab73a,_0x1f81d9)=>{const _0x11d197=a189_0x5ad4,_0x5e74b8=[_0x11d197(0x19f),_0x826d0a,..._0x3024da],_0x1106b6=spawn(_0x453ac2,_0x5e74b8,{'cwd':_0x275b9d,'stdio':_0x11d197(0x178),'shell':!![],'env':{...process.env,'PATH':''+join(_0x275b9d,_0x11d197(0x198),_0x11d197(0x1a0))+delimiter+process.env.PATH}});_0x1106b6['on'](_0x11d197(0x16c),_0x556f2a=>{const _0x468e67=_0x11d197;if(_0x556f2a===0x0||_0x556f2a===null)_0x5ab73a();else _0x1f81d9(new Error(_0x453ac2+_0x468e67(0x195)+_0x826d0a+_0x468e67(0x1a2)+_0x556f2a));}),_0x1106b6['on'](_0x11d197(0x18f),_0x1f81d9);});}function spawnViteBuildWatch(_0x3936e2){return new Promise((_0x42d02f,_0x3aa133)=>{const _0x1f6aa5=a189_0x5ad4,_0x16e36f=spawn(_0x1f6aa5(0x18d),[_0x1f6aa5(0x190),_0x1f6aa5(0x19e)],{'cwd':_0x3936e2,'stdio':_0x1f6aa5(0x178),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3936e2,_0x1f6aa5(0x198),_0x1f6aa5(0x1a0))+delimiter+process.env.PATH}});_0x16e36f['on'](_0x1f6aa5(0x16c),_0x30f8e4=>{if(_0x30f8e4===0x0||_0x30f8e4===null)_0x42d02f();else _0x3aa133(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x30f8e4));}),_0x16e36f['on'](_0x1f6aa5(0x18f),_0x3aa133);});}function spawnVitePreview(_0x433dec){return new Promise((_0x46aa3c,_0x56d628)=>{const _0x5c4bd3=a189_0x5ad4,_0x4034f0=spawn('vite',[_0x5c4bd3(0x18a)],{'cwd':_0x433dec,'stdio':_0x5c4bd3(0x178),'shell':!![],'env':{...process.env,'PATH':''+join(_0x433dec,_0x5c4bd3(0x198),_0x5c4bd3(0x1a0))+delimiter+process.env.PATH}});_0x4034f0['on'](_0x5c4bd3(0x16c),_0x26a1d9=>{const _0x42adaf=_0x5c4bd3;if(_0x26a1d9===0x0||_0x26a1d9===null)_0x46aa3c();else _0x56d628(new Error(_0x42adaf(0x180)+_0x26a1d9));}),_0x4034f0['on']('error',_0x56d628);});}const runFlags=[{'name':'watch','type':a189_0x5e10bb(0x17c),'description':a189_0x5e10bb(0x196),'default':![]}];export const runDefinition={'service':'run','command':a189_0x5e10bb(0x19f),'description':a189_0x5e10bb(0x185),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a189_0x5e10bb(0x174),'description':a189_0x5e10bb(0x183),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0xfbffeb=a189_0x5e10bb,_0x359d36=[];return _0x359d36['push']('\x20\x20EXAMPLES'),_0x359d36[_0xfbffeb(0x182)](_0xfbffeb(0x169)+CLI_BIN_NAME+'\x20run\x20start'),_0x359d36[_0xfbffeb(0x182)](_0xfbffeb(0x169)+CLI_BIN_NAME+_0xfbffeb(0x19a)),_0x359d36[_0xfbffeb(0x182)](_0xfbffeb(0x169)+CLI_BIN_NAME+'\x20run\x20preview'),_0x359d36[_0xfbffeb(0x182)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x359d36[_0xfbffeb(0x17e)]('\x0a');},async 'execute'(_0x4d0b1c){const _0x173a56=a189_0x5e10bb,_0x246da4=process[_0x173a56(0x193)](),_0x379747=_0x4d0b1c[_0x173a56(0x187)][0x0],_0x14079f=_0x4d0b1c[_0x173a56(0x187)][_0x173a56(0x194)](0x1),_0xe41caa=readPackageScripts(_0x246da4);if(!_0xe41caa)throw CliErrors[_0x173a56(0x171)](_0x173a56(0x191));if(!_0x379747){const _0x48e191=Object[_0x173a56(0x19b)](_0xe41caa);if(_0x48e191[_0x173a56(0x1a1)]===0x0)console['log'](_0x173a56(0x197));else{console[_0x173a56(0x199)](_0x173a56(0x188));for(const _0x3c84a9 of _0x48e191){console['log'](_0x173a56(0x169)+_0x3c84a9);}console[_0x173a56(0x199)](_0x173a56(0x16e)+CLI_BIN_NAME+_0x173a56(0x186));}return{'ok':!![]};}if(!_0xe41caa[_0x379747])throw CliErrors[_0x173a56(0x171)](_0x173a56(0x177)+_0x379747+_0x173a56(0x17b),'Available:\x20'+(Object['keys'](_0xe41caa)[_0x173a56(0x17e)](',\x20')||_0x173a56(0x179)));const _0x4674c2=detectPackageManager(_0x246da4);VERSION_CHECK_SCRIPTS[_0x173a56(0x175)](_0x379747)&&await versionCheck(_0x246da4);if(_0x379747==='preview'&&_0x4d0b1c['bool'](_0x173a56(0x181)))return await Promise['all']([spawnViteBuildWatch(_0x246da4),spawnVitePreview(_0x246da4)]),{'ok':!![]};return await spawnScript(_0x4674c2,_0x379747,_0x14079f,_0x246da4),{'ok':!![]};}};
1
+ const a189_0x4b7edf=a189_0x416e;(function(_0x1ea5ce,_0xd76d2a){const _0x5019dd=a189_0x416e,_0x4bfdda=_0x1ea5ce();while(!![]){try{const _0x569b71=-parseInt(_0x5019dd(0x1fc))/0x1*(-parseInt(_0x5019dd(0x1fb))/0x2)+parseInt(_0x5019dd(0x1d1))/0x3*(-parseInt(_0x5019dd(0x1dc))/0x4)+parseInt(_0x5019dd(0x1c3))/0x5+parseInt(_0x5019dd(0x1f6))/0x6*(parseInt(_0x5019dd(0x1d5))/0x7)+parseInt(_0x5019dd(0x1e4))/0x8+-parseInt(_0x5019dd(0x1ca))/0x9+-parseInt(_0x5019dd(0x1f7))/0xa;if(_0x569b71===_0xd76d2a)break;else _0x4bfdda['push'](_0x4bfdda['shift']());}catch(_0x8475b5){_0x4bfdda['push'](_0x4bfdda['shift']());}}}(a189_0xc4bb,0x4451a));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';function a189_0x416e(_0x325114,_0x2c757f){_0x325114=_0x325114-0x1bd;const _0xc4bb58=a189_0xc4bb();let _0x416e51=_0xc4bb58[_0x325114];return _0x416e51;}import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set(['start',a189_0x4b7edf(0x1db)]);function readPackageScripts(_0x7265ca){const _0x4b5efc=a189_0x4b7edf,_0x206976=resolve(_0x7265ca,_0x4b5efc(0x1c5));if(!existsSync(_0x206976))return null;try{const _0x484316=JSON[_0x4b5efc(0x1ce)](readFileSync(_0x206976,_0x4b5efc(0x1d8)));return _0x484316[_0x4b5efc(0x1dd)]??{};}catch{return null;}}function detectPackageManager(_0x5ee9d4){const _0x57b158=a189_0x4b7edf;if(existsSync(resolve(_0x5ee9d4,_0x57b158(0x1c4)))||existsSync(resolve(_0x5ee9d4,_0x57b158(0x1d2))))return _0x57b158(0x1d4);if(existsSync(resolve(_0x5ee9d4,_0x57b158(0x1f2))))return _0x57b158(0x1f3);if(existsSync(resolve(_0x5ee9d4,_0x57b158(0x1c6))))return _0x57b158(0x1f1);return _0x57b158(0x1e3);}function a189_0xc4bb(){const _0x5bd9b6=['\x20run\x20<script>\x0a','yarn','pnpm-lock.yaml','pnpm','vite','join','122622rIHGsU','2438220kVZmsJ','Available:\x20','close','\x20run\x20preview','2qyXoOE','237983QdTVKj','needsUpgrade','No\x20scripts\x20defined\x20in\x20package.json.','\x20run\x20build','(none)','slice','build','481860XMNeBw','bun.lockb','package.json','yarn.lock','preview','\x20run\x20preview\x20--watch','keys','3193092CuNoER','Run\x20a\x20package.json\x20script','belowMinimum','\x20exited\x20with\x20code\x20','parse','\x20\x20EXAMPLES','script','27609cyGUOX','bun.lock','\x0a\x20\x20Usage:\x20','bun','161mzgqsK','\x20run\x20start','inherit','utf-8','--watch','No\x20package.json\x20found\x20in\x20current\x20directory.','dev','12EVYxsO','scripts','node_modules','write','cwd','watch','validation','npm','813176tuRhGe','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','Script\x20name\x20defined\x20in\x20package.json','boolean','run','\x20\x20\x20\x20','bool','.bin','has','log','push','\x0a\x20\x20Available\x20scripts:\x0a'];a189_0xc4bb=function(){return _0x5bd9b6;};return a189_0xc4bb();}async function versionCheck(_0xce07f){const _0xb522bc=a189_0x4b7edf,_0x5918d7=await checkCliVersion();(_0x5918d7[_0xb522bc(0x1bd)]||_0x5918d7[_0xb522bc(0x1cc)])&&(printCliUpgradeWarning(_0x5918d7),assertCliVersionSupported(_0x5918d7));const _0x3d8d8a=await checkSdkVersion(_0xce07f);if(_0x3d8d8a[_0xb522bc(0x1bd)])printSdkUpgradeWarning(_0x3d8d8a);}function spawnScript(_0x3c6c3d,_0x983f10,_0xcb87d6,_0x23dfc6){return new Promise((_0x4b5de7,_0x2513d3)=>{const _0x16766a=a189_0x416e,_0x153da3=['run',_0x983f10,..._0xcb87d6],_0x55a8f6=spawn(_0x3c6c3d,_0x153da3,{'cwd':_0x23dfc6,'stdio':_0x16766a(0x1d7),'shell':!![],'env':{...process.env,'PATH':''+join(_0x23dfc6,_0x16766a(0x1de),'.bin')+delimiter+process.env.PATH}});_0x55a8f6['on'](_0x16766a(0x1f9),_0x461a99=>{const _0x23a357=_0x16766a;if(_0x461a99===0x0||_0x461a99===null)_0x4b5de7();else _0x2513d3(new Error(_0x3c6c3d+'\x20run\x20'+_0x983f10+_0x23a357(0x1cd)+_0x461a99));}),_0x55a8f6['on']('error',_0x2513d3);});}function spawnViteBuildWatch(_0x273b08){return new Promise((_0x2cefb2,_0x4c9605)=>{const _0x3d7576=a189_0x416e,_0x5a4047=spawn(_0x3d7576(0x1f4),[_0x3d7576(0x1c2),_0x3d7576(0x1d9)],{'cwd':_0x273b08,'stdio':_0x3d7576(0x1d7),'shell':!![],'env':{...process.env,'PATH':''+join(_0x273b08,_0x3d7576(0x1de),_0x3d7576(0x1eb))+delimiter+process.env.PATH}});_0x5a4047['on']('close',_0x43b893=>{const _0x1caae1=_0x3d7576;if(_0x43b893===0x0||_0x43b893===null)_0x2cefb2();else _0x4c9605(new Error(_0x1caae1(0x1e5)+_0x43b893));}),_0x5a4047['on']('error',_0x4c9605);});}function spawnVitePreview(_0x4238f3){return new Promise((_0x3b7a71,_0x59df68)=>{const _0x564b0c=a189_0x416e,_0x3c2530=spawn(_0x564b0c(0x1f4),[_0x564b0c(0x1c7)],{'cwd':_0x4238f3,'stdio':_0x564b0c(0x1d7),'shell':!![],'env':{...process.env,'PATH':''+join(_0x4238f3,_0x564b0c(0x1de),_0x564b0c(0x1eb))+delimiter+process.env.PATH}});_0x3c2530['on'](_0x564b0c(0x1f9),_0x28d64c=>{if(_0x28d64c===0x0||_0x28d64c===null)_0x3b7a71();else _0x59df68(new Error('vite\x20preview\x20exited\x20with\x20code\x20'+_0x28d64c));}),_0x3c2530['on']('error',_0x59df68);});}const runFlags=[{'name':a189_0x4b7edf(0x1e1),'type':a189_0x4b7edf(0x1e7),'description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':'run','command':a189_0x4b7edf(0x1e8),'description':a189_0x4b7edf(0x1cb),'risk':a189_0x4b7edf(0x1df),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a189_0x4b7edf(0x1d0),'description':a189_0x4b7edf(0x1e6),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x494b41=a189_0x4b7edf,_0x4fa7f1=[];return _0x4fa7f1['push'](_0x494b41(0x1cf)),_0x4fa7f1[_0x494b41(0x1ee)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x494b41(0x1d6)),_0x4fa7f1['push'](_0x494b41(0x1e9)+CLI_BIN_NAME+_0x494b41(0x1bf)),_0x4fa7f1[_0x494b41(0x1ee)](_0x494b41(0x1e9)+CLI_BIN_NAME+_0x494b41(0x1fa)),_0x4fa7f1['push'](_0x494b41(0x1e9)+CLI_BIN_NAME+_0x494b41(0x1c8)),_0x4fa7f1[_0x494b41(0x1f5)]('\x0a');},async 'execute'(_0x3dd610){const _0xfb23d2=a189_0x4b7edf,_0x36638d=process[_0xfb23d2(0x1e0)](),_0x4fd0d3=_0x3dd610['args'][0x0],_0x9fa7fb=_0x3dd610['args'][_0xfb23d2(0x1c1)](0x1),_0x3cf5fb=readPackageScripts(_0x36638d);if(!_0x3cf5fb)throw CliErrors['validation'](_0xfb23d2(0x1da));if(!_0x4fd0d3){const _0x2fe73a=Object[_0xfb23d2(0x1c9)](_0x3cf5fb);if(_0x2fe73a['length']===0x0)console[_0xfb23d2(0x1ed)](_0xfb23d2(0x1be));else{console['log'](_0xfb23d2(0x1ef));for(const _0x5e6a89 of _0x2fe73a){console[_0xfb23d2(0x1ed)](_0xfb23d2(0x1e9)+_0x5e6a89);}console[_0xfb23d2(0x1ed)](_0xfb23d2(0x1d3)+CLI_BIN_NAME+_0xfb23d2(0x1f0));}return{'ok':!![]};}if(!_0x3cf5fb[_0x4fd0d3])throw CliErrors[_0xfb23d2(0x1e2)]('Script\x20\x22'+_0x4fd0d3+'\x22\x20not\x20found\x20in\x20package.json.',_0xfb23d2(0x1f8)+(Object[_0xfb23d2(0x1c9)](_0x3cf5fb)[_0xfb23d2(0x1f5)](',\x20')||_0xfb23d2(0x1c0)));const _0x20f937=detectPackageManager(_0x36638d);VERSION_CHECK_SCRIPTS[_0xfb23d2(0x1ec)](_0x4fd0d3)&&await versionCheck(_0x36638d);if(_0x4fd0d3===_0xfb23d2(0x1c7)&&_0x3dd610[_0xfb23d2(0x1ea)](_0xfb23d2(0x1e1)))return await Promise['all']([spawnViteBuildWatch(_0x36638d),spawnVitePreview(_0x36638d)]),{'ok':!![]};return await spawnScript(_0x20f937,_0x4fd0d3,_0x9fa7fb,_0x36638d),{'ok':!![]};}};
@@ -1 +1 @@
1
- function a190_0x5228(){const _0x494c72=['json','5PgZaeV','630242jnVXei','schema','2940954JErjmy','99ZEWevw','2788748EGcZLE','3247782thkLvy','28384vuClxD','792tSoJdN','2phVbAl','export','3585281wmtKPH','1914690HyImGf'];a190_0x5228=function(){return _0x494c72;};return a190_0x5228();}const a190_0x291db9=a190_0x31c3;(function(_0x30f981,_0x108519){const _0x2e780f=a190_0x31c3,_0x5e19ae=_0x30f981();while(!![]){try{const _0x19dde9=-parseInt(_0x2e780f(0xc9))/0x1*(parseInt(_0x2e780f(0xc1))/0x2)+-parseInt(_0x2e780f(0xc3))/0x3+parseInt(_0x2e780f(0xc5))/0x4*(parseInt(_0x2e780f(0xc0))/0x5)+parseInt(_0x2e780f(0xc6))/0x6+-parseInt(_0x2e780f(0xcb))/0x7+parseInt(_0x2e780f(0xc7))/0x8*(-parseInt(_0x2e780f(0xc8))/0x9)+-parseInt(_0x2e780f(0xbe))/0xa*(-parseInt(_0x2e780f(0xc4))/0xb);if(_0x19dde9===_0x108519)break;else _0x5e19ae['push'](_0x5e19ae['shift']());}catch(_0x2d9b92){_0x5e19ae['push'](_0x5e19ae['shift']());}}}(a190_0x5228,0x80992));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x47c93a){const _0x44c2e5=await buildSchemaPayload();return{'ok':!![],'data':_0x44c2e5};}function a190_0x31c3(_0x52d74b,_0x3e2139){_0x52d74b=_0x52d74b-0xbe;const _0x522837=a190_0x5228();let _0x31c3e3=_0x522837[_0x52d74b];return _0x31c3e3;}export const schemaDefinition={'service':a190_0x291db9(0xc2),'command':a190_0x291db9(0xca),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a190_0x291db9(0xbf),'flags':[],'execute':execute};
1
+ function a190_0x252b(){const _0x899a37=['8260505BRdLpp','177332nFlYYY','80hGiJrV','1894338vhsbVa','schema','10AGBIZc','5972190xOlbzr','94545CJPgnG','2144556zGxqpm','export','6rimPWL','Export\x20machine-readable\x20command\x20schema\x20(JSON)','15BtcZDQ','689286yPfoEA','json','read'];a190_0x252b=function(){return _0x899a37;};return a190_0x252b();}const a190_0x5565d9=a190_0x4491;(function(_0x11cfe5,_0x29ae0b){const _0x1a1ef0=a190_0x4491,_0x400724=_0x11cfe5();while(!![]){try{const _0x50a91c=parseInt(_0x1a1ef0(0xc4))/0x1+parseInt(_0x1a1ef0(0xb8))/0x2*(-parseInt(_0x1a1ef0(0xc1))/0x3)+-parseInt(_0x1a1ef0(0xbf))/0x4+parseInt(_0x1a1ef0(0xc3))/0x5*(parseInt(_0x1a1ef0(0xba))/0x6)+-parseInt(_0x1a1ef0(0xbd))/0x7+-parseInt(_0x1a1ef0(0xb9))/0x8*(parseInt(_0x1a1ef0(0xbe))/0x9)+-parseInt(_0x1a1ef0(0xbc))/0xa*(-parseInt(_0x1a1ef0(0xb7))/0xb);if(_0x50a91c===_0x29ae0b)break;else _0x400724['push'](_0x400724['shift']());}catch(_0x1a79da){_0x400724['push'](_0x400724['shift']());}}}(a190_0x252b,0xaebc7));function a190_0x4491(_0x11459e,_0x5b5c8c){_0x11459e=_0x11459e-0xb7;const _0x252bad=a190_0x252b();let _0x4491f9=_0x252bad[_0x11459e];return _0x4491f9;}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x1a29c7){const _0xb6f4ad=await buildSchemaPayload();return{'ok':!![],'data':_0xb6f4ad};}export const schemaDefinition={'service':a190_0x5565d9(0xbb),'command':a190_0x5565d9(0xc0),'description':a190_0x5565d9(0xc2),'risk':a190_0x5565d9(0xc6),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a190_0x5565d9(0xc5),'flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a191_0x12aca0=a191_0x1695;(function(_0x46ea70,_0x4e4022){const _0x2053d2=a191_0x1695,_0x180c00=_0x46ea70();while(!![]){try{const _0x230b8a=parseInt(_0x2053d2(0x1a6))/0x1*(parseInt(_0x2053d2(0x1a8))/0x2)+-parseInt(_0x2053d2(0x1b8))/0x3+-parseInt(_0x2053d2(0x175))/0x4*(parseInt(_0x2053d2(0x17a))/0x5)+-parseInt(_0x2053d2(0x191))/0x6*(parseInt(_0x2053d2(0x176))/0x7)+-parseInt(_0x2053d2(0x18d))/0x8+parseInt(_0x2053d2(0x1a5))/0x9*(parseInt(_0x2053d2(0x1a9))/0xa)+parseInt(_0x2053d2(0x179))/0xb;if(_0x230b8a===_0x4e4022)break;else _0x180c00['push'](_0x180c00['shift']());}catch(_0x13f340){_0x180c00['push'](_0x180c00['shift']());}}}(a191_0x21c9,0xd0d8f));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';function a191_0x21c9(){const _0x37d402=['length','str','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','lockFilePath','validation','请输入\x20SQL\x20名称:','name','7392208RtSHdM','join','dbName','请选择本地\x20SQL\x20模式:','18voQvCa','</select>','db-id','File\x20already\x20exists:\x20','catch','sqlRoot','dbId','sqlRootDir','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','sqlName','dbId\x20必须为正整数','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','isInteger','mode','/smartapi/custom/saveUserCustomSql','description','\x20\x20SELECT\x201\x20AS\x20id','__manual__','create','4050CmfzJN','2549SQYzgU','appCode','8HqdOed','3690RRolpI','utf8','SQL\x20名称不能为空','请输入目标数据库\x20dbId:','请选择目标数据库:','sqlCode','trim','MyBatis\x20XML(mybatisXml)','string','parse','Created\x20SQL\x20query\x20','Local\x20SQL\x20file\x20mode','普通\x20SQL(sql)','toISOString','Invalid\x20database\x20selection\x20payload:\x20','4566051eLpyaN','1324CaSujr','387611xqtdbC','map','nonInteractive','53321246bUctur','23505uLuVsK','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','POST','sql','flagMissing','dbId\x20不能为空','flag','mybatisXml','isFinite','<server-generated-sqlCode>','SQL\x20query\x20display\x20name','number'];a191_0x21c9=function(){return _0x37d402;};return a191_0x21c9();}function a191_0x1695(_0x35b219,_0x2d7c06){_0x35b219=_0x35b219-0x175;const _0x21c9de=a191_0x21c9();let _0x169511=_0x21c9de[_0x35b219];return _0x169511;}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(_0x2e2f09){const _0x1ed679=a191_0x1695;if(_0x2e2f09===_0x1ed679(0x181))return[_0x1ed679(0x19a),_0x1ed679(0x1a2),_0x1ed679(0x192),'']['join']('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x1ed679(0x18e)]('\x0a');}export const sqlCreate={'service':a191_0x12aca0(0x17d),'command':a191_0x12aca0(0x1a4),'description':a191_0x12aca0(0x19d),'risk':'write','flags':[{'name':'name','type':a191_0x12aca0(0x1b1),'description':a191_0x12aca0(0x184)},{'name':'db-id','type':a191_0x12aca0(0x185),'description':'Target\x20database\x20ID'},{'name':'mode','type':'string','enum':[a191_0x12aca0(0x17d),a191_0x12aca0(0x181)],'description':a191_0x12aca0(0x1b4)}],async 'validate'(_0x5a8ea4){const _0x2fe0d8=a191_0x12aca0;if(!_0x5a8ea4[_0x2fe0d8(0x178)])return;if(!_0x5a8ea4['str']('name')[_0x2fe0d8(0x1af)]())throw CliErrors[_0x2fe0d8(0x17e)](_0x2fe0d8(0x18c),_0x2fe0d8(0x188));const _0x4fc9c7=resolveProvidedDbId(_0x5a8ea4);if(typeof _0x4fc9c7!==_0x2fe0d8(0x185)||!Number[_0x2fe0d8(0x182)](_0x4fc9c7)||_0x4fc9c7<=0x0)throw CliErrors[_0x2fe0d8(0x17e)](_0x2fe0d8(0x193),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x5a8ea4[_0x2fe0d8(0x187)](_0x2fe0d8(0x19f))['trim']())throw CliErrors['flagMissing'](_0x2fe0d8(0x19f),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x41eb76){const _0x588c70=a191_0x12aca0,_0x5224f2=loadSqlProjectConfig(_0x41eb76[_0x588c70(0x1a7)]),{sqlName:_0x3286a,dbId:_0x5da765,dbName:_0x596dce,mode:_0x33f0ce}=await resolveSqlNewInputs(_0x41eb76),_0x1f46dd=buildSqlRelativePath(_0x588c70(0x183),_0x3286a,_0x596dce,_0x33f0ce,_0x5da765),_0x315680=_0x5224f2['sqlRootDir']+'/'+_0x1f46dd;return{'method':_0x588c70(0x17c),'url':_0x588c70(0x1a0),'body':{'appCode':_0x41eb76[_0x588c70(0x1a7)],'sqlName':_0x3286a,'dbId':_0x5da765,'mode':_0x33f0ce,'localPath':_0x315680},'description':_0x588c70(0x17b)+_0x5224f2[_0x588c70(0x198)]};},async 'execute'(_0x23297e){const _0x4cc5b2=a191_0x12aca0,_0x130d9e=loadSqlProjectConfig(_0x23297e[_0x4cc5b2(0x1a7)]),{sqlName:_0x1740be,dbId:_0x5a1ab0,dbName:_0x568514,mode:_0x104711}=await resolveSqlNewInputs(_0x23297e),_0x12b094=generateSqlTemplate(_0x104711),_0x3bc93f=await createSqlQuery({'appCode':_0x23297e['appCode'],'sqlName':_0x1740be,'dbId':_0x5a1ab0,'sqlContent':_0x12b094}),_0x2a74ca=ensureRemoteSqlContent(_0x3bc93f),_0x48d189=_0x568514||await getDbName(_0x23297e[_0x4cc5b2(0x1a7)],_0x5a1ab0)['catch'](()=>undefined),_0x348080=buildSqlRelativePath(_0x3bc93f['sqlCode'],_0x3bc93f[_0x4cc5b2(0x19b)],_0x48d189,_0x104711,_0x5a1ab0),_0x1e4441=_0x130d9e[_0x4cc5b2(0x198)]+'/'+_0x348080,_0x26f556=buildLocalSqlFileContent({'sqlCode':_0x3bc93f[_0x4cc5b2(0x1ae)],'sqlName':_0x3bc93f[_0x4cc5b2(0x19b)],'dbId':_0x3bc93f[_0x4cc5b2(0x197)]},_0x2a74ca,{'dbName':_0x48d189,'mode':_0x104711,'syncedAt':new Date()[_0x4cc5b2(0x1b6)](),'description':_0x3bc93f[_0x4cc5b2(0x1a1)]});if(await fileExists(_0x1e4441))throw CliErrors['validation'](_0x4cc5b2(0x194)+_0x1e4441);await ensureParentDirectory(_0x1e4441),await writeFile(_0x1e4441,_0x26f556,_0x4cc5b2(0x1aa));const _0x157b5e=await readSqlLockFile(_0x130d9e[_0x4cc5b2(0x189)]),{lockData:_0x5051bf,appLock:_0x4e8216}=ensureSqlLockScope(_0x157b5e??createEmptySqlLock(),_0x130d9e[_0x4cc5b2(0x1a7)],_0x130d9e[_0x4cc5b2(0x196)],'new');return _0x4e8216['sqls'][_0x3bc93f[_0x4cc5b2(0x1ae)]]={...buildSqlLockEntry(_0x3bc93f,_0x2a74ca,computeSqlContentHash(_0x26f556),{'dbName':_0x48d189}),'path':_0x348080,'mode':_0x104711},_0x4e8216['lastSync']=new Date()[_0x4cc5b2(0x1b6)](),await writeSqlLockFile(_0x130d9e[_0x4cc5b2(0x189)],_0x5051bf),{'ok':!![],'data':{'id':_0x3bc93f['id'],'sqlCode':_0x3bc93f['sqlCode'],'sqlName':_0x3bc93f[_0x4cc5b2(0x19b)],'dbId':_0x3bc93f[_0x4cc5b2(0x197)],'path':_0x1e4441,'mode':_0x104711},'message':_0x4cc5b2(0x1b3)+_0x3bc93f[_0x4cc5b2(0x1ae)]};}};async function resolveSqlNewInputs(_0x32a74d){const _0x3f5f65=await resolveSqlNameInput(_0x32a74d),{dbId:_0x16a194,dbName:_0x1df74a}=await resolveDbSelection(_0x32a74d),_0x123334=await resolveSqlModeInput(_0x32a74d);return{'sqlName':_0x3f5f65,'dbId':_0x16a194,'dbName':_0x1df74a,'mode':_0x123334};}async function resolveSqlNameInput(_0x25c935){const _0x447dd4=a191_0x12aca0,_0x32e51a=_0x25c935[_0x447dd4(0x187)]('name')[_0x447dd4(0x1af)]();if(_0x32e51a)return _0x32e51a;if(_0x25c935[_0x447dd4(0x178)])throw CliErrors[_0x447dd4(0x17e)](_0x447dd4(0x18c),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x447dd4(0x18b),'validate':_0x38b99d=>_0x38b99d[_0x447dd4(0x1af)]()?!![]:_0x447dd4(0x1ab)}))[_0x447dd4(0x1af)]();}async function resolveDbSelection(_0x33eed5){const _0x17cadb=a191_0x12aca0,_0x2b7a69=resolveProvidedDbId(_0x33eed5);if(typeof _0x2b7a69==='number'&&Number[_0x17cadb(0x182)](_0x2b7a69)&&_0x2b7a69>0x0)return{'dbId':_0x2b7a69,'dbName':await getDbName(_0x33eed5[_0x17cadb(0x1a7)],_0x2b7a69)['catch'](()=>undefined)};if(_0x33eed5[_0x17cadb(0x178)])throw CliErrors['flagMissing']('db-id','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x44b2d0=await listDatabases(_0x33eed5[_0x17cadb(0x1a7)])[_0x17cadb(0x195)](()=>[]);if(_0x44b2d0[_0x17cadb(0x186)]===0x1)return{'dbId':_0x44b2d0[0x0][_0x17cadb(0x197)],'dbName':_0x44b2d0[0x0][_0x17cadb(0x18f)]};if(_0x44b2d0[_0x17cadb(0x186)]>0x1){const _0x3fda32=await select({'message':_0x17cadb(0x1ad),'choices':[..._0x44b2d0[_0x17cadb(0x177)](_0x5238e3=>({'name':_0x5238e3[_0x17cadb(0x18f)]+'\x20('+_0x5238e3[_0x17cadb(0x197)]+')','value':serializeDbSelection(_0x5238e3)})),{'name':'✎\x20手动输入\x20dbId','value':_0x17cadb(0x1a3)}]});if(_0x3fda32!==_0x17cadb(0x1a3))return deserializeDbSelection(_0x3fda32);}const _0x4e008e=await input({'message':_0x17cadb(0x1ac),'validate':_0x2319a8=>{const _0x16de84=_0x17cadb,_0x4649dd=_0x2319a8['trim']();if(!_0x4649dd)return _0x16de84(0x17f);const _0x47c8de=Number(_0x4649dd);if(!Number[_0x16de84(0x19e)](_0x47c8de)||_0x47c8de<=0x0)return _0x16de84(0x19c);return!![];}});return{'dbId':Number(_0x4e008e['trim']())};}async function resolveSqlModeInput(_0x21ac8b){const _0x33aa70=a191_0x12aca0,_0xec6789=_0x21ac8b[_0x33aa70(0x187)](_0x33aa70(0x19f))[_0x33aa70(0x1af)]();if(_0xec6789===_0x33aa70(0x17d)||_0xec6789==='mybatisXml')return _0xec6789;if(_0x21ac8b[_0x33aa70(0x178)])throw CliErrors[_0x33aa70(0x17e)](_0x33aa70(0x19f),_0x33aa70(0x199));return await select({'message':_0x33aa70(0x190),'choices':[{'name':_0x33aa70(0x1b5),'value':_0x33aa70(0x17d),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0x33aa70(0x1b0),'value':_0x33aa70(0x181),'description':'适合带动态标签的\x20MyBatis\x20XML\x20SQL'}]});}function serializeDbSelection(_0x9dcdd2){const _0x36c90c=a191_0x12aca0;return JSON['stringify']({'dbId':_0x9dcdd2[_0x36c90c(0x197)],'dbName':_0x9dcdd2[_0x36c90c(0x18f)]});}function deserializeDbSelection(_0x169085){const _0x4f651d=a191_0x12aca0;try{const _0x696fb0=JSON[_0x4f651d(0x1b2)](_0x169085);if(typeof _0x696fb0[_0x4f651d(0x197)]===_0x4f651d(0x185)&&Number[_0x4f651d(0x182)](_0x696fb0[_0x4f651d(0x197)]))return{'dbId':_0x696fb0['dbId'],'dbName':_0x696fb0[_0x4f651d(0x18f)]};}catch{}throw CliErrors[_0x4f651d(0x18a)](_0x4f651d(0x1b7)+_0x169085);}function resolveProvidedDbId(_0x30d0d3){const _0x21bae2=a191_0x12aca0,_0xdabe5b=_0x30d0d3[_0x21bae2(0x180)](_0x21bae2(0x193));if(typeof _0xdabe5b===_0x21bae2(0x185)&&Number[_0x21bae2(0x182)](_0xdabe5b))return _0xdabe5b;return undefined;}
1
+ const a191_0x5d46b3=a191_0x259a;(function(_0x423951,_0x5dd6b3){const _0x388853=a191_0x259a,_0x28ec13=_0x423951();while(!![]){try{const _0x63cd0a=-parseInt(_0x388853(0x91))/0x1*(-parseInt(_0x388853(0x82))/0x2)+-parseInt(_0x388853(0x88))/0x3*(-parseInt(_0x388853(0x74))/0x4)+-parseInt(_0x388853(0x7c))/0x5*(parseInt(_0x388853(0x7a))/0x6)+-parseInt(_0x388853(0x9b))/0x7*(parseInt(_0x388853(0x72))/0x8)+-parseInt(_0x388853(0xae))/0x9+-parseInt(_0x388853(0xb1))/0xa*(-parseInt(_0x388853(0x71))/0xb)+-parseInt(_0x388853(0x77))/0xc*(-parseInt(_0x388853(0x87))/0xd);if(_0x63cd0a===_0x5dd6b3)break;else _0x28ec13['push'](_0x28ec13['shift']());}catch(_0x269aee){_0x28ec13['push'](_0x28ec13['shift']());}}}(a191_0x5569,0x73ca1));import{writeFile}from'node:fs/promises';function a191_0x5569(){const _0xeaeab1=['适合带动态标签的\x20MyBatis\x20XML\x20SQL','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','Local\x20SQL\x20file\x20mode','description','5899478vTRArs','9474TpkXSv','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','validation','toISOString','flagMissing','join','Invalid\x20database\x20selection\x20payload:\x20','dbName','sql','2wJgLst','__manual__','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','number','str','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','mode','stringify','lastSync','dbId\x20不能为空','21LilQsU','sqlRootDir','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','db-id','Target\x20database\x20ID','✎\x20手动输入\x20dbId','write','new','请选择本地\x20SQL\x20模式:','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','SELECT\x201\x20AS\x20id;','string','appCode','sqlName','utf8','SQL\x20名称不能为空','SQL\x20query\x20display\x20name','请选择目标数据库:','catch','595548YCOzBp','mybatisXml','length','50IXeYqE','sqlRoot','普通\x20SQL(sql)','请输入\x20SQL\x20名称:','606925guLtDc','1868656wumshg','sqls','556fYNfEL','map','nonInteractive','12NKWbmS','trim','dbId','1309452aGqJYT','sqlCode','10Xihiac','POST','isFinite','name','isInteger','请输入目标数据库\x20dbId:','509032NiTsas'];a191_0x5569=function(){return _0xeaeab1;};return a191_0x5569();}import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';function a191_0x259a(_0x124f97,_0x12d53d){_0x124f97=_0x124f97-0x70;const _0x5569ea=a191_0x5569();let _0x259a34=_0x5569ea[_0x124f97];return _0x259a34;}import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x43743a){const _0x18b6ee=a191_0x259a;if(_0x43743a===_0x18b6ee(0xaf))return[_0x18b6ee(0x89),'\x20\x20SELECT\x201\x20AS\x20id','</select>',''][_0x18b6ee(0x8d)]('\x0a');return[_0x18b6ee(0xa5),''][_0x18b6ee(0x8d)]('\x0a');}export const sqlCreate={'service':a191_0x5d46b3(0x90),'command':'create','description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a191_0x5d46b3(0xa1),'flags':[{'name':'name','type':a191_0x5d46b3(0xa6),'description':a191_0x5d46b3(0xab)},{'name':a191_0x5d46b3(0x9e),'type':a191_0x5d46b3(0x94),'description':a191_0x5d46b3(0x9f)},{'name':'mode','type':a191_0x5d46b3(0xa6),'enum':[a191_0x5d46b3(0x90),a191_0x5d46b3(0xaf)],'description':a191_0x5d46b3(0x85)}],async 'validate'(_0x889349){const _0x5b24f2=a191_0x5d46b3;if(!_0x889349[_0x5b24f2(0x76)])return;if(!_0x889349[_0x5b24f2(0x95)](_0x5b24f2(0x7f))[_0x5b24f2(0x78)]())throw CliErrors[_0x5b24f2(0x8c)](_0x5b24f2(0x7f),_0x5b24f2(0x9d));const _0x2ad156=resolveProvidedDbId(_0x889349);if(typeof _0x2ad156!=='number'||!Number[_0x5b24f2(0x7e)](_0x2ad156)||_0x2ad156<=0x0)throw CliErrors[_0x5b24f2(0x8c)](_0x5b24f2(0x9e),_0x5b24f2(0x84));if(!_0x889349[_0x5b24f2(0x95)]('mode')[_0x5b24f2(0x78)]())throw CliErrors[_0x5b24f2(0x8c)]('mode',_0x5b24f2(0x96));},async 'dryRun'(_0x56df83){const _0x2447bb=a191_0x5d46b3,_0x1afde9=loadSqlProjectConfig(_0x56df83[_0x2447bb(0xa7)]),{sqlName:_0x46ebb7,dbId:_0x1edf6d,dbName:_0x5c6eb1,mode:_0x5dce17}=await resolveSqlNewInputs(_0x56df83),_0x3f7983=buildSqlRelativePath('<server-generated-sqlCode>',_0x46ebb7,_0x5c6eb1,_0x5dce17,_0x1edf6d),_0x4278b2=_0x1afde9[_0x2447bb(0x9c)]+'/'+_0x3f7983;return{'method':_0x2447bb(0x7d),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x56df83['appCode'],'sqlName':_0x46ebb7,'dbId':_0x1edf6d,'mode':_0x5dce17,'localPath':_0x4278b2},'description':_0x2447bb(0x93)+_0x1afde9[_0x2447bb(0x9c)]};},async 'execute'(_0x3d0a22){const _0x1f4565=a191_0x5d46b3,_0xd28dc1=loadSqlProjectConfig(_0x3d0a22['appCode']),{sqlName:_0x59db43,dbId:_0x53ce8e,dbName:_0x311fb6,mode:_0x5a1867}=await resolveSqlNewInputs(_0x3d0a22),_0x147140=generateSqlTemplate(_0x5a1867),_0x402560=await createSqlQuery({'appCode':_0x3d0a22[_0x1f4565(0xa7)],'sqlName':_0x59db43,'dbId':_0x53ce8e,'sqlContent':_0x147140}),_0x502365=ensureRemoteSqlContent(_0x402560),_0x21bb53=_0x311fb6||await getDbName(_0x3d0a22[_0x1f4565(0xa7)],_0x53ce8e)[_0x1f4565(0xad)](()=>undefined),_0x385581=buildSqlRelativePath(_0x402560[_0x1f4565(0x7b)],_0x402560['sqlName'],_0x21bb53,_0x5a1867,_0x53ce8e),_0xa30790=_0xd28dc1[_0x1f4565(0x9c)]+'/'+_0x385581,_0x5ee49e=buildLocalSqlFileContent({'sqlCode':_0x402560[_0x1f4565(0x7b)],'sqlName':_0x402560[_0x1f4565(0xa8)],'dbId':_0x402560[_0x1f4565(0x79)]},_0x502365,{'dbName':_0x21bb53,'mode':_0x5a1867,'syncedAt':new Date()[_0x1f4565(0x8b)](),'description':_0x402560[_0x1f4565(0x86)]});if(await fileExists(_0xa30790))throw CliErrors[_0x1f4565(0x8a)]('File\x20already\x20exists:\x20'+_0xa30790);await ensureParentDirectory(_0xa30790),await writeFile(_0xa30790,_0x5ee49e,_0x1f4565(0xa9));const _0x45e3f1=await readSqlLockFile(_0xd28dc1['lockFilePath']),{lockData:_0x1cad03,appLock:_0x46fbbe}=ensureSqlLockScope(_0x45e3f1??createEmptySqlLock(),_0xd28dc1[_0x1f4565(0xa7)],_0xd28dc1[_0x1f4565(0xb2)],_0x1f4565(0xa2));return _0x46fbbe[_0x1f4565(0x73)][_0x402560[_0x1f4565(0x7b)]]={...buildSqlLockEntry(_0x402560,_0x502365,computeSqlContentHash(_0x5ee49e),{'dbName':_0x21bb53}),'path':_0x385581,'mode':_0x5a1867},_0x46fbbe[_0x1f4565(0x99)]=new Date()[_0x1f4565(0x8b)](),await writeSqlLockFile(_0xd28dc1['lockFilePath'],_0x1cad03),{'ok':!![],'data':{'id':_0x402560['id'],'sqlCode':_0x402560[_0x1f4565(0x7b)],'sqlName':_0x402560[_0x1f4565(0xa8)],'dbId':_0x402560[_0x1f4565(0x79)],'path':_0xa30790,'mode':_0x5a1867},'message':'Created\x20SQL\x20query\x20'+_0x402560[_0x1f4565(0x7b)]};}};async function resolveSqlNewInputs(_0x19c605){const _0x462531=await resolveSqlNameInput(_0x19c605),{dbId:_0x2a7f7b,dbName:_0x2cd7c9}=await resolveDbSelection(_0x19c605),_0x117516=await resolveSqlModeInput(_0x19c605);return{'sqlName':_0x462531,'dbId':_0x2a7f7b,'dbName':_0x2cd7c9,'mode':_0x117516};}async function resolveSqlNameInput(_0x508450){const _0x441506=a191_0x5d46b3,_0x1f5c09=_0x508450[_0x441506(0x95)](_0x441506(0x7f))[_0x441506(0x78)]();if(_0x1f5c09)return _0x1f5c09;if(_0x508450['nonInteractive'])throw CliErrors[_0x441506(0x8c)](_0x441506(0x7f),_0x441506(0x9d));return(await input({'message':_0x441506(0x70),'validate':_0x5940f0=>_0x5940f0[_0x441506(0x78)]()?!![]:_0x441506(0xaa)}))[_0x441506(0x78)]();}async function resolveDbSelection(_0x5acb26){const _0x3b9fe7=a191_0x5d46b3,_0x1d9ad6=resolveProvidedDbId(_0x5acb26);if(typeof _0x1d9ad6===_0x3b9fe7(0x94)&&Number['isFinite'](_0x1d9ad6)&&_0x1d9ad6>0x0)return{'dbId':_0x1d9ad6,'dbName':await getDbName(_0x5acb26['appCode'],_0x1d9ad6)[_0x3b9fe7(0xad)](()=>undefined)};if(_0x5acb26[_0x3b9fe7(0x76)])throw CliErrors[_0x3b9fe7(0x8c)](_0x3b9fe7(0x9e),_0x3b9fe7(0x84));const _0x47c5a7=await listDatabases(_0x5acb26[_0x3b9fe7(0xa7)])['catch'](()=>[]);if(_0x47c5a7['length']===0x1)return{'dbId':_0x47c5a7[0x0]['dbId'],'dbName':_0x47c5a7[0x0]['dbName']};if(_0x47c5a7[_0x3b9fe7(0xb0)]>0x1){const _0xb14569=await select({'message':_0x3b9fe7(0xac),'choices':[..._0x47c5a7[_0x3b9fe7(0x75)](_0x4e9158=>({'name':_0x4e9158[_0x3b9fe7(0x8f)]+'\x20('+_0x4e9158[_0x3b9fe7(0x79)]+')','value':serializeDbSelection(_0x4e9158)})),{'name':_0x3b9fe7(0xa0),'value':_0x3b9fe7(0x92)}]});if(_0xb14569!=='__manual__')return deserializeDbSelection(_0xb14569);}const _0x1b2f11=await input({'message':_0x3b9fe7(0x81),'validate':_0x3b0dfa=>{const _0x2d35f9=_0x3b9fe7,_0x358861=_0x3b0dfa[_0x2d35f9(0x78)]();if(!_0x358861)return _0x2d35f9(0x9a);const _0x49f452=Number(_0x358861);if(!Number[_0x2d35f9(0x80)](_0x49f452)||_0x49f452<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x1b2f11[_0x3b9fe7(0x78)]())};}async function resolveSqlModeInput(_0x50b5b1){const _0x598b9e=a191_0x5d46b3,_0x434e61=_0x50b5b1['str'](_0x598b9e(0x97))[_0x598b9e(0x78)]();if(_0x434e61==='sql'||_0x434e61===_0x598b9e(0xaf))return _0x434e61;if(_0x50b5b1[_0x598b9e(0x76)])throw CliErrors[_0x598b9e(0x8c)](_0x598b9e(0x97),_0x598b9e(0x96));return await select({'message':_0x598b9e(0xa3),'choices':[{'name':_0x598b9e(0xb3),'value':_0x598b9e(0x90),'description':_0x598b9e(0xa4)},{'name':'MyBatis\x20XML(mybatisXml)','value':'mybatisXml','description':_0x598b9e(0x83)}]});}function serializeDbSelection(_0x710f12){const _0x2aa626=a191_0x5d46b3;return JSON[_0x2aa626(0x98)]({'dbId':_0x710f12['dbId'],'dbName':_0x710f12[_0x2aa626(0x8f)]});}function deserializeDbSelection(_0x3210f7){const _0x2343bc=a191_0x5d46b3;try{const _0x25e1f4=JSON['parse'](_0x3210f7);if(typeof _0x25e1f4[_0x2343bc(0x79)]===_0x2343bc(0x94)&&Number['isFinite'](_0x25e1f4[_0x2343bc(0x79)]))return{'dbId':_0x25e1f4[_0x2343bc(0x79)],'dbName':_0x25e1f4[_0x2343bc(0x8f)]};}catch{}throw CliErrors[_0x2343bc(0x8a)](_0x2343bc(0x8e)+_0x3210f7);}function resolveProvidedDbId(_0x364ce5){const _0xb55e29=a191_0x5d46b3,_0x3262f7=_0x364ce5['flag'](_0xb55e29(0x9e));if(typeof _0x3262f7==='number'&&Number['isFinite'](_0x3262f7))return _0x3262f7;return undefined;}
@@ -1 +1 @@
1
- const a192_0x1f8781=a192_0x416e;(function(_0x444e6f,_0x17184d){const _0x2a2db8=a192_0x416e,_0x4d6b83=_0x444e6f();while(!![]){try{const _0x489cec=-parseInt(_0x2a2db8(0x78))/0x1*(-parseInt(_0x2a2db8(0x6b))/0x2)+parseInt(_0x2a2db8(0x82))/0x3+-parseInt(_0x2a2db8(0x75))/0x4*(-parseInt(_0x2a2db8(0x6f))/0x5)+-parseInt(_0x2a2db8(0x74))/0x6*(parseInt(_0x2a2db8(0x81))/0x7)+parseInt(_0x2a2db8(0x7f))/0x8+parseInt(_0x2a2db8(0x87))/0x9+-parseInt(_0x2a2db8(0x6e))/0xa*(parseInt(_0x2a2db8(0x84))/0xb);if(_0x489cec===_0x17184d)break;else _0x4d6b83['push'](_0x4d6b83['shift']());}catch(_0x21a9ee){_0x4d6b83['push'](_0x4d6b83['shift']());}}}(a192_0xb2b3,0x2ae0c));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a192_0x416e(_0xf2cbe6,_0x246daf){_0xf2cbe6=_0xf2cbe6-0x69;const _0xb2b31f=a192_0xb2b3();let _0x416e3a=_0xb2b31f[_0xf2cbe6];return _0x416e3a;}export const sqlDelete={'service':a192_0x1f8781(0x6c),'command':a192_0x1f8781(0x88),'description':a192_0x1f8781(0x7e),'risk':a192_0x1f8781(0x6d),'flags':[SQLCODE_FLAG],async 'validate'(_0x2394f0){const _0x39d13e=a192_0x1f8781,_0x3c533c=loadSqlProjectConfig(_0x2394f0['appCode']),_0x1e206f=await readSqlLockFile(_0x3c533c[_0x39d13e(0x76)]);if(!_0x1e206f)throw CliErrors['validation'](_0x39d13e(0x72));},async 'dryRun'(_0xdb20a8){const _0x547dc8=a192_0x1f8781,_0x56bbb9=loadSqlProjectConfig(_0xdb20a8[_0x547dc8(0x6a)]),_0x46a7fe=await readSqlLockFile(_0x56bbb9[_0x547dc8(0x76)]);if(!_0x46a7fe)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x5f3f62}=ensureSqlLockScope(_0x46a7fe,_0xdb20a8[_0x547dc8(0x6a)],_0x56bbb9[_0x547dc8(0x79)],_0x547dc8(0x88)),_0x54891a=_0xdb20a8[_0x547dc8(0x69)](_0x547dc8(0x80)),_0x1b622a=_0x5f3f62[_0x547dc8(0x86)][_0x54891a];if(!_0x1b622a)throw CliErrors[_0x547dc8(0x7d)](_0x547dc8(0x83)+_0x54891a+'\x22.');return{'method':_0x547dc8(0x89),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x54891a,'id':_0x1b622a[_0x547dc8(0x70)],'localPath':resolveLocalSqlFilePath(_0x56bbb9,_0x54891a,_0x1b622a)},'description':_0x547dc8(0x8a)+_0x54891a+_0x547dc8(0x7c)+_0x56bbb9[_0x547dc8(0x7a)]};},async 'execute'(_0x346bdf){const _0x3e9f01=a192_0x1f8781,_0x359700=loadSqlProjectConfig(_0x346bdf[_0x3e9f01(0x6a)]),_0x5d8914=await readSqlLockFile(_0x359700['lockFilePath']);if(!_0x5d8914)throw CliErrors[_0x3e9f01(0x7d)](_0x3e9f01(0x77));const {lockData:_0x2b4884,appLock:_0x406ab5}=ensureSqlLockScope(_0x5d8914,_0x346bdf['appCode'],_0x359700[_0x3e9f01(0x79)],_0x3e9f01(0x88)),_0x2aeb54=_0x346bdf[_0x3e9f01(0x69)](_0x3e9f01(0x80)),_0x587a65=_0x406ab5[_0x3e9f01(0x86)][_0x2aeb54];if(!_0x587a65)throw CliErrors[_0x3e9f01(0x7d)](_0x3e9f01(0x83)+_0x2aeb54+'\x22.');await deleteSqlQuery({'id':_0x587a65[_0x3e9f01(0x70)],'sqlCode':_0x2aeb54}),_0x406ab5['sqls']=Object[_0x3e9f01(0x73)](Object[_0x3e9f01(0x85)](_0x406ab5[_0x3e9f01(0x86)])['filter'](([_0x456972])=>_0x456972!==_0x2aeb54)),_0x406ab5[_0x3e9f01(0x71)]=new Date()[_0x3e9f01(0x7b)](),await writeSqlLockFile(_0x359700[_0x3e9f01(0x76)],_0x2b4884);const _0x1c7888=resolveLocalSqlFilePath(_0x359700,_0x2aeb54,_0x587a65);let _0x5f073f;await fileExists(_0x1c7888)&&(_0x5f073f=await moveToTrash(_0x359700['projectRoot'],_0x359700['trashDir'],_0x1c7888),await cleanupEmptyDirectories(dirname(_0x1c7888),_0x359700['sqlRootDir']));const _0x20c8e0={'deleted':_0x2aeb54,'remoteId':_0x587a65[_0x3e9f01(0x70)]};if(_0x5f073f)_0x20c8e0['trashedTo']=_0x5f073f;return{'ok':!![],'data':_0x20c8e0,'message':'Deleted\x20'+_0x2aeb54+(_0x5f073f?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0xafed6d,_0x3a1894,_0x3b2e43){const _0x4a90d1=a192_0x1f8781,_0x1931bb=new Date()[_0x4a90d1(0x7b)]()['replace'](/[:.]/g,'-'),_0x11edc2=relative(_0xafed6d,_0x3b2e43),_0x6bb2c9=join(_0x3a1894,_0x1931bb,_0x11edc2);return await mkdir(dirname(_0x6bb2c9),{'recursive':!![]}),await rename(_0x3b2e43,_0x6bb2c9),_0x6bb2c9;}function a192_0xb2b3(){const _0xcea13f=['Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','434344UZJNPL','sqlcode','110663TASVvx','518487NDetOC','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','110uoDoZg','entries','sqls','2904057QwjVcl','delete','POST','Would\x20delete\x20SQL\x20','str','appCode','6zxRpiy','sql','high-risk-write','327190bOqYKR','203575GKnWmY','remoteId','lastSync','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','fromEntries','42OjgqjA','4TQpmHB','lockFilePath','SQL\x20lock\x20file\x20not\x20found.','7657qmrEfr','sqlRoot','trashDir','toISOString','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','validation'];a192_0xb2b3=function(){return _0xcea13f;};return a192_0xb2b3();}async function cleanupEmptyDirectories(_0x25502f,_0x5e3381){let _0x241100=resolve(_0x25502f);const _0x3007ce=resolve(_0x5e3381);while(_0x241100['startsWith'](''+_0x3007ce+sep)||_0x241100===_0x3007ce){if(_0x241100===_0x3007ce)return;try{const _0x186032=await readdir(_0x241100);if(_0x186032['length']>0x0)return;await rmdir(_0x241100);}catch{return;}_0x241100=dirname(_0x241100);}}
1
+ const a192_0x5778c2=a192_0x2d58;(function(_0x5280b8,_0x267d8c){const _0x97c99f=a192_0x2d58,_0x52c921=_0x5280b8();while(!![]){try{const _0x18a61a=parseInt(_0x97c99f(0x157))/0x1*(-parseInt(_0x97c99f(0x16b))/0x2)+parseInt(_0x97c99f(0x14b))/0x3+-parseInt(_0x97c99f(0x14d))/0x4*(parseInt(_0x97c99f(0x146))/0x5)+parseInt(_0x97c99f(0x147))/0x6+parseInt(_0x97c99f(0x148))/0x7+-parseInt(_0x97c99f(0x15a))/0x8*(parseInt(_0x97c99f(0x16a))/0x9)+-parseInt(_0x97c99f(0x14f))/0xa*(-parseInt(_0x97c99f(0x158))/0xb);if(_0x18a61a===_0x267d8c)break;else _0x52c921['push'](_0x52c921['shift']());}catch(_0x4ea182){_0x52c921['push'](_0x52c921['shift']());}}}(a192_0x3a39,0xb9140));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':'sql','command':a192_0x5778c2(0x153),'description':a192_0x5778c2(0x168),'risk':a192_0x5778c2(0x16d),'flags':[SQLCODE_FLAG],async 'validate'(_0x329929){const _0x366ec7=a192_0x5778c2,_0x4a8b3b=loadSqlProjectConfig(_0x329929[_0x366ec7(0x156)]),_0x4f03df=await readSqlLockFile(_0x4a8b3b[_0x366ec7(0x167)]);if(!_0x4f03df)throw CliErrors[_0x366ec7(0x14c)](_0x366ec7(0x164));},async 'dryRun'(_0x212d64){const _0x4a2014=a192_0x5778c2,_0x1d22bd=loadSqlProjectConfig(_0x212d64[_0x4a2014(0x156)]),_0x2ee674=await readSqlLockFile(_0x1d22bd[_0x4a2014(0x167)]);if(!_0x2ee674)throw CliErrors[_0x4a2014(0x14c)](_0x4a2014(0x164));const {appLock:_0x3371d9}=ensureSqlLockScope(_0x2ee674,_0x212d64[_0x4a2014(0x156)],_0x1d22bd['sqlRoot'],_0x4a2014(0x153)),_0x390dce=_0x212d64[_0x4a2014(0x169)](_0x4a2014(0x144)),_0x59eee3=_0x3371d9[_0x4a2014(0x166)][_0x390dce];if(!_0x59eee3)throw CliErrors[_0x4a2014(0x14c)](_0x4a2014(0x154)+_0x390dce+'\x22.');return{'method':_0x4a2014(0x15b),'url':_0x4a2014(0x15e),'body':{'sqlCode':_0x390dce,'id':_0x59eee3[_0x4a2014(0x160)],'localPath':resolveLocalSqlFilePath(_0x1d22bd,_0x390dce,_0x59eee3)},'description':_0x4a2014(0x16c)+_0x390dce+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x1d22bd[_0x4a2014(0x162)]};},async 'execute'(_0x477524){const _0x17dc87=a192_0x5778c2,_0x6275b0=loadSqlProjectConfig(_0x477524['appCode']),_0x5c864d=await readSqlLockFile(_0x6275b0[_0x17dc87(0x167)]);if(!_0x5c864d)throw CliErrors[_0x17dc87(0x14c)](_0x17dc87(0x145));const {lockData:_0x44841d,appLock:_0x3db27c}=ensureSqlLockScope(_0x5c864d,_0x477524['appCode'],_0x6275b0[_0x17dc87(0x14a)],'delete'),_0x58b1b1=_0x477524[_0x17dc87(0x169)](_0x17dc87(0x144)),_0x3c0170=_0x3db27c[_0x17dc87(0x166)][_0x58b1b1];if(!_0x3c0170)throw CliErrors[_0x17dc87(0x14c)](_0x17dc87(0x154)+_0x58b1b1+'\x22.');await deleteSqlQuery({'id':_0x3c0170['remoteId'],'sqlCode':_0x58b1b1}),_0x3db27c[_0x17dc87(0x166)]=Object[_0x17dc87(0x149)](Object[_0x17dc87(0x15d)](_0x3db27c[_0x17dc87(0x166)])[_0x17dc87(0x15c)](([_0xc1e602])=>_0xc1e602!==_0x58b1b1)),_0x3db27c[_0x17dc87(0x152)]=new Date()[_0x17dc87(0x163)](),await writeSqlLockFile(_0x6275b0[_0x17dc87(0x167)],_0x44841d);const _0x2ac6da=resolveLocalSqlFilePath(_0x6275b0,_0x58b1b1,_0x3c0170);let _0x301e3a;await fileExists(_0x2ac6da)&&(_0x301e3a=await moveToTrash(_0x6275b0[_0x17dc87(0x150)],_0x6275b0['trashDir'],_0x2ac6da),await cleanupEmptyDirectories(dirname(_0x2ac6da),_0x6275b0[_0x17dc87(0x165)]));const _0x9a4257={'deleted':_0x58b1b1,'remoteId':_0x3c0170[_0x17dc87(0x160)]};if(_0x301e3a)_0x9a4257[_0x17dc87(0x14e)]=_0x301e3a;return{'ok':!![],'data':_0x9a4257,'message':_0x17dc87(0x161)+_0x58b1b1+(_0x301e3a?_0x17dc87(0x151):'')};}};async function moveToTrash(_0x33a706,_0xf21855,_0x339ddf){const _0x227560=a192_0x5778c2,_0x29125a=new Date()[_0x227560(0x163)]()[_0x227560(0x159)](/[:.]/g,'-'),_0x344b42=relative(_0x33a706,_0x339ddf),_0x56d860=join(_0xf21855,_0x29125a,_0x344b42);return await mkdir(dirname(_0x56d860),{'recursive':!![]}),await rename(_0x339ddf,_0x56d860),_0x56d860;}function a192_0x2d58(_0x40bdaa,_0x43aa2b){_0x40bdaa=_0x40bdaa-0x144;const _0x3a39bb=a192_0x3a39();let _0x2d5858=_0x3a39bb[_0x40bdaa];return _0x2d5858;}async function cleanupEmptyDirectories(_0x3372ed,_0x23cd2a){const _0x724c77=a192_0x5778c2;let _0x3bfb37=resolve(_0x3372ed);const _0x148925=resolve(_0x23cd2a);while(_0x3bfb37[_0x724c77(0x15f)](''+_0x148925+sep)||_0x3bfb37===_0x148925){if(_0x3bfb37===_0x148925)return;try{const _0xc93fb6=await readdir(_0x3bfb37);if(_0xc93fb6[_0x724c77(0x155)]>0x0)return;await rmdir(_0x3bfb37);}catch{return;}_0x3bfb37=dirname(_0x3bfb37);}}function a192_0x3a39(){const _0x3b6ce8=['1727cKkcEl','replace','1708408PGJOcF','POST','filter','entries','/smartapi/custom/deleteUserCustomSql','startsWith','remoteId','Deleted\x20','trashDir','toISOString','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','sqlRootDir','sqls','lockFilePath','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','str','9Zfmfjl','1862cQKrje','Would\x20delete\x20SQL\x20','high-risk-write','sqlcode','SQL\x20lock\x20file\x20not\x20found.','105gjmIMS','6533376MHnjWK','5462289MYHxlX','fromEntries','sqlRoot','322896ZgajDF','validation','231784xARhOT','trashedTo','86300szTHQm','projectRoot','\x20(local\x20file\x20moved\x20to\x20trash)','lastSync','delete','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','length','appCode','1228nhEdVu'];a192_0x3a39=function(){return _0x3b6ce8;};return a192_0x3a39();}
@@ -1 +1 @@
1
- const a193_0x1bbcdc=a193_0x46c6;function a193_0x392d(){const _0x5702cd=['2137446YMyjIG','boolean','detail','str','dbId','sqlCode','6963385LtvCyQ','sqlContent','5010580bEMPOl','54sksQpN','sqlcode','16OZlDEv','7119500RVHVxh','3xxtQeg','411365SVmgdb','4tEIWgA','960890eHtDqZ','12HetmKm','appCode','verbose','sql','265062xkgELQ','bool'];a193_0x392d=function(){return _0x5702cd;};return a193_0x392d();}function a193_0x46c6(_0x356957,_0x445902){_0x356957=_0x356957-0x139;const _0x392dab=a193_0x392d();let _0x46c61c=_0x392dab[_0x356957];return _0x46c61c;}(function(_0x153466,_0x41baf8){const _0x1310dd=a193_0x46c6,_0x2c0892=_0x153466();while(!![]){try{const _0x4b9aae=parseInt(_0x1310dd(0x14f))/0x1*(-parseInt(_0x1310dd(0x149))/0x2)+parseInt(_0x1310dd(0x147))/0x3*(-parseInt(_0x1310dd(0x142))/0x4)+-parseInt(_0x1310dd(0x148))/0x5*(-parseInt(_0x1310dd(0x143))/0x6)+-parseInt(_0x1310dd(0x14a))/0x7+-parseInt(_0x1310dd(0x145))/0x8*(-parseInt(_0x1310dd(0x13a))/0x9)+parseInt(_0x1310dd(0x146))/0xa+parseInt(_0x1310dd(0x140))/0xb*(parseInt(_0x1310dd(0x14b))/0xc);if(_0x4b9aae===_0x41baf8)break;else _0x2c0892['push'](_0x2c0892['shift']());}catch(_0x2b96b2){_0x2c0892['push'](_0x2c0892['shift']());}}}(a193_0x392d,0x9c587));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a193_0x1bbcdc(0x14e),'command':a193_0x1bbcdc(0x13c),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':'read','flags':[SQLCODE_FLAG,{'name':a193_0x1bbcdc(0x14d),'type':a193_0x1bbcdc(0x13b),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x42ea64){const _0x2e35f8=a193_0x1bbcdc,_0x544883=await getSqlQueryInfo(_0x42ea64[_0x2e35f8(0x14c)],_0x42ea64[_0x2e35f8(0x13d)](_0x2e35f8(0x144))),_0x19f62f=_0x42ea64[_0x2e35f8(0x139)]('verbose');if(_0x19f62f)return{'ok':!![],'data':_0x544883};const _0x575cf5=_0x544883[_0x2e35f8(0x13e)]?await getDbName(_0x42ea64[_0x2e35f8(0x14c)],_0x544883['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x544883[_0x2e35f8(0x13f)],'sqlName':_0x544883['sqlName'],'db':_0x575cf5?_0x575cf5+'\x20('+_0x544883[_0x2e35f8(0x13e)]+')':_0x544883[_0x2e35f8(0x13e)]??'','description':_0x544883['description']??'','sqlContent':_0x544883[_0x2e35f8(0x141)]??''}};}};
1
+ function a193_0x1d93(_0x4e9861,_0x249125){_0x4e9861=_0x4e9861-0x85;const _0x560a5b=a193_0x560a();let _0x1d9308=_0x560a5b[_0x4e9861];return _0x1d9308;}function a193_0x560a(){const _0x303718=['121bIaYmJ','dbId','474Pargyo','27771276kTawNp','Return\x20full\x20raw\x20SQL\x20query\x20object','sqlContent','13DYliLf','bool','description','8KeDMBs','27498zZEiiD','sqlName','read','verbose','24970SsPSIJ','785hDihGo','sqlCode','454PrMQUZ','67785gjeXCU','sqlcode','104jggyRl','3826584OilHxW','str','sql','appCode','6587224TlQqiR'];a193_0x560a=function(){return _0x303718;};return a193_0x560a();}const a193_0x58cedd=a193_0x1d93;(function(_0x13d67c,_0x419638){const _0x2cf49c=a193_0x1d93,_0x4d3b3d=_0x13d67c();while(!![]){try{const _0x27b956=parseInt(_0x2cf49c(0x96))/0x1*(parseInt(_0x2cf49c(0x87))/0x2)+-parseInt(_0x2cf49c(0x97))/0x3*(-parseInt(_0x2cf49c(0x99))/0x4)+-parseInt(_0x2cf49c(0x94))/0x5*(-parseInt(_0x2cf49c(0x8f))/0x6)+parseInt(_0x2cf49c(0x9e))/0x7+-parseInt(_0x2cf49c(0x8e))/0x8*(-parseInt(_0x2cf49c(0x9a))/0x9)+-parseInt(_0x2cf49c(0x93))/0xa*(-parseInt(_0x2cf49c(0x85))/0xb)+-parseInt(_0x2cf49c(0x88))/0xc*(parseInt(_0x2cf49c(0x8b))/0xd);if(_0x27b956===_0x419638)break;else _0x4d3b3d['push'](_0x4d3b3d['shift']());}catch(_0x47552d){_0x4d3b3d['push'](_0x4d3b3d['shift']());}}}(a193_0x560a,0x789b1));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a193_0x58cedd(0x9c),'command':'detail','description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a193_0x58cedd(0x91),'flags':[SQLCODE_FLAG,{'name':a193_0x58cedd(0x92),'type':'boolean','description':a193_0x58cedd(0x89)}],async 'execute'(_0xf5ffc2){const _0x448b57=a193_0x58cedd,_0x78f68=await getSqlQueryInfo(_0xf5ffc2['appCode'],_0xf5ffc2[_0x448b57(0x9b)](_0x448b57(0x98))),_0x1a7f99=_0xf5ffc2[_0x448b57(0x8c)](_0x448b57(0x92));if(_0x1a7f99)return{'ok':!![],'data':_0x78f68};const _0x52ac58=_0x78f68['dbId']?await getDbName(_0xf5ffc2[_0x448b57(0x9d)],_0x78f68[_0x448b57(0x86)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x78f68[_0x448b57(0x95)],'sqlName':_0x78f68[_0x448b57(0x90)],'db':_0x52ac58?_0x52ac58+'\x20('+_0x78f68['dbId']+')':_0x78f68[_0x448b57(0x86)]??'','description':_0x78f68[_0x448b57(0x8d)]??'','sqlContent':_0x78f68[_0x448b57(0x8a)]??''}};}};
@@ -1 +1 @@
1
- const a194_0xb736=a194_0x3297;(function(_0x26968d,_0x59b7ec){const _0x5bf3a5=a194_0x3297,_0x2de89c=_0x26968d();while(!![]){try{const _0x1340d7=parseInt(_0x5bf3a5(0x132))/0x1*(parseInt(_0x5bf3a5(0x13e))/0x2)+-parseInt(_0x5bf3a5(0x13d))/0x3*(parseInt(_0x5bf3a5(0x137))/0x4)+parseInt(_0x5bf3a5(0x13c))/0x5+parseInt(_0x5bf3a5(0x131))/0x6+parseInt(_0x5bf3a5(0x13b))/0x7*(parseInt(_0x5bf3a5(0x138))/0x8)+-parseInt(_0x5bf3a5(0x12b))/0x9+-parseInt(_0x5bf3a5(0x134))/0xa;if(_0x1340d7===_0x59b7ec)break;else _0x2de89c['push'](_0x2de89c['shift']());}catch(_0x57e593){_0x2de89c['push'](_0x2de89c['shift']());}}}(a194_0x19d5,0x85690));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a194_0x19d5(){const _0x15603a=['string','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','length','32184hesMNy','72NTmHmH','\x20row(s)\x20in\x20','90150bnrFCS','sql','str','22004Zezazp','1142256jVKmkH','now','execError','7hWYNRR','2792980qOYqAZ','195kmDcSy','15122paqCAM','params','read','exec','sqlcode','Returned\x20','execResult','3042954ukedjj','execSuccess'];a194_0x19d5=function(){return _0x15603a;};return a194_0x19d5();}function a194_0x3297(_0x2c4123,_0x500717){_0x2c4123=_0x2c4123-0x127;const _0x19d5be=a194_0x19d5();let _0x329754=_0x19d5be[_0x2c4123];return _0x329754;}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a194_0xb736(0x135),'command':a194_0xb736(0x127),'description':a194_0xb736(0x12f),'risk':a194_0xb736(0x140),'flags':[SQLCODE_FLAG,{'name':a194_0xb736(0x13f),'type':a194_0xb736(0x12d),'description':a194_0xb736(0x12e)}],async 'execute'(_0xd930de){const _0x4cdd30=a194_0xb736,_0x181bf1=parseJsonParams(_0xd930de['str'](_0x4cdd30(0x13f))),_0x4daf30=Date[_0x4cdd30(0x139)](),_0x2ff07a=await executeSql(_0xd930de['appCode'],_0xd930de[_0x4cdd30(0x136)](_0x4cdd30(0x128)),_0x181bf1),_0x421fef=Date['now']()-_0x4daf30,_0x4d6b2a=_0x2ff07a?.[_0x4cdd30(0x12a)]??_0x2ff07a,_0x5453a6=_0x2ff07a?.[_0x4cdd30(0x12c)]??!![];if(!_0x5453a6)return{'ok':![],'data':{'error':_0x2ff07a?.[_0x4cdd30(0x13a)]||'SQL\x20execution\x20failed','elapsed':_0x421fef},'message':'SQL\x20execution\x20failed'};const _0x3987a6=Array['isArray'](_0x4d6b2a)?_0x4d6b2a:[];return{'ok':!![],'data':{'rows':_0x3987a6,'rowCount':_0x3987a6[_0x4cdd30(0x130)],'elapsed':_0x421fef},'message':_0x4cdd30(0x129)+_0x3987a6[_0x4cdd30(0x130)]+_0x4cdd30(0x133)+_0x421fef+'ms'};}};
1
+ const a194_0xbf14f7=a194_0x5854;(function(_0x133eec,_0x470cab){const _0x209866=a194_0x5854,_0x141c9c=_0x133eec();while(!![]){try{const _0xdb5869=parseInt(_0x209866(0xa5))/0x1+-parseInt(_0x209866(0x98))/0x2*(parseInt(_0x209866(0xad))/0x3)+-parseInt(_0x209866(0x94))/0x4+-parseInt(_0x209866(0x99))/0x5*(parseInt(_0x209866(0x9b))/0x6)+-parseInt(_0x209866(0x9c))/0x7*(-parseInt(_0x209866(0x9e))/0x8)+-parseInt(_0x209866(0xa8))/0x9+parseInt(_0x209866(0xa2))/0xa;if(_0xdb5869===_0x470cab)break;else _0x141c9c['push'](_0x141c9c['shift']());}catch(_0x999473){_0x141c9c['push'](_0x141c9c['shift']());}}}(a194_0x45f3,0x721c6));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a194_0x5854(_0x1ba5af,_0x2c1817){_0x1ba5af=_0x1ba5af-0x94;const _0x45f304=a194_0x45f3();let _0x5854a5=_0x45f304[_0x1ba5af];return _0x5854a5;}function a194_0x45f3(){const _0x404499=['2523320iOQzWC','read','params','length','14tnkOJd','95985SfbSkY','SQL\x20execution\x20failed','198Btilzt','7oxQVvV','now','67888gVxRRb','appCode','execError','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','18058450GqNHLT','execSuccess','string','625198KfOdAc','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','str','389610PzCkdg','Returned\x20','isArray','execResult','exec','284790MFnzbE'];a194_0x45f3=function(){return _0x404499;};return a194_0x45f3();}export const sqlExec={'service':'sql','command':a194_0xbf14f7(0xac),'description':a194_0xbf14f7(0xa6),'risk':a194_0xbf14f7(0x95),'flags':[SQLCODE_FLAG,{'name':a194_0xbf14f7(0x96),'type':a194_0xbf14f7(0xa4),'description':a194_0xbf14f7(0xa1)}],async 'execute'(_0x161da8){const _0x300d81=a194_0xbf14f7,_0x5cf25e=parseJsonParams(_0x161da8[_0x300d81(0xa7)](_0x300d81(0x96))),_0x475723=Date['now'](),_0x575a1a=await executeSql(_0x161da8[_0x300d81(0x9f)],_0x161da8['str']('sqlcode'),_0x5cf25e),_0x1a59fb=Date[_0x300d81(0x9d)]()-_0x475723,_0x4c02c7=_0x575a1a?.[_0x300d81(0xab)]??_0x575a1a,_0x3a1c33=_0x575a1a?.[_0x300d81(0xa3)]??!![];if(!_0x3a1c33)return{'ok':![],'data':{'error':_0x575a1a?.[_0x300d81(0xa0)]||_0x300d81(0x9a),'elapsed':_0x1a59fb},'message':'SQL\x20execution\x20failed'};const _0x539d9c=Array[_0x300d81(0xaa)](_0x4c02c7)?_0x4c02c7:[];return{'ok':!![],'data':{'rows':_0x539d9c,'rowCount':_0x539d9c[_0x300d81(0x97)],'elapsed':_0x1a59fb},'message':_0x300d81(0xa9)+_0x539d9c[_0x300d81(0x97)]+'\x20row(s)\x20in\x20'+_0x1a59fb+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x5e750c,_0x5c191a){const _0x430ced=a195_0x339c,_0x205776=_0x5e750c();while(!![]){try{const _0x164453=-parseInt(_0x430ced(0x17d))/0x1+-parseInt(_0x430ced(0x178))/0x2*(-parseInt(_0x430ced(0x172))/0x3)+-parseInt(_0x430ced(0x179))/0x4*(-parseInt(_0x430ced(0x174))/0x5)+-parseInt(_0x430ced(0x176))/0x6+-parseInt(_0x430ced(0x17a))/0x7*(parseInt(_0x430ced(0x17c))/0x8)+-parseInt(_0x430ced(0x17b))/0x9*(-parseInt(_0x430ced(0x175))/0xa)+-parseInt(_0x430ced(0x177))/0xb*(-parseInt(_0x430ced(0x173))/0xc);if(_0x164453===_0x5c191a)break;else _0x205776['push'](_0x205776['shift']());}catch(_0x51429c){_0x205776['push'](_0x205776['shift']());}}}(a195_0x17ad,0xc8e12));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';function a195_0x339c(_0x4d86f8,_0x3b0e0c){_0x4d86f8=_0x4d86f8-0x172;const _0x17ade4=a195_0x17ad();let _0x339c2a=_0x17ade4[_0x4d86f8];return _0x339c2a;}import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];function a195_0x17ad(){const _0x6ef8d3=['211349hltBFs','3MVBwGv','341244pcfItx','4420uZvgSU','2676130ZXjqEJ','6789060OqOdrz','418xQaoYO','3062498yXbYmf','92scFGTG','10758846DAMcez','36hxhQXn','8xbmUwZ'];a195_0x17ad=function(){return _0x6ef8d3;};return a195_0x17ad();}
1
+ (function(_0x1476e0,_0x212b5e){const _0x13b831=a195_0x8889,_0x355767=_0x1476e0();while(!![]){try{const _0x581ba7=-parseInt(_0x13b831(0x16f))/0x1+-parseInt(_0x13b831(0x170))/0x2*(parseInt(_0x13b831(0x174))/0x3)+parseInt(_0x13b831(0x173))/0x4+-parseInt(_0x13b831(0x175))/0x5+parseInt(_0x13b831(0x171))/0x6+parseInt(_0x13b831(0x16e))/0x7*(parseInt(_0x13b831(0x172))/0x8)+parseInt(_0x13b831(0x176))/0x9;if(_0x581ba7===_0x212b5e)break;else _0x355767['push'](_0x355767['shift']());}catch(_0x4c18dd){_0x355767['push'](_0x355767['shift']());}}}(a195_0x48cd,0x69a8a));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';function a195_0x48cd(){const _0x3f4c32=['241100Ffqbdf','839376QkJasR','1588984AXeXTi','2943348dWOuFO','15wvDDcT','132060aIjbKb','3950469hAHOBm','14uzsjTl','649980sFpHUp'];a195_0x48cd=function(){return _0x3f4c32;};return a195_0x48cd();}import{sqlPull}from'../../commands/sql/pull.js';function a195_0x8889(_0x2db616,_0x4b696a){_0x2db616=_0x2db616-0x16e;const _0x48cda0=a195_0x48cd();let _0x8889c0=_0x48cda0[_0x2db616];return _0x8889c0;}import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a196_0x29fdf7=a196_0x48dc;(function(_0x5a3027,_0xbdb5df){const _0x27ffe2=a196_0x48dc,_0x458e13=_0x5a3027();while(!![]){try{const _0x1ee157=-parseInt(_0x27ffe2(0x19c))/0x1+parseInt(_0x27ffe2(0x187))/0x2*(parseInt(_0x27ffe2(0x195))/0x3)+parseInt(_0x27ffe2(0x1a2))/0x4*(-parseInt(_0x27ffe2(0x190))/0x5)+-parseInt(_0x27ffe2(0x193))/0x6*(-parseInt(_0x27ffe2(0x1a6))/0x7)+-parseInt(_0x27ffe2(0x18e))/0x8*(-parseInt(_0x27ffe2(0x1a3))/0x9)+parseInt(_0x27ffe2(0x1ad))/0xa+parseInt(_0x27ffe2(0x198))/0xb;if(_0x1ee157===_0xbdb5df)break;else _0x458e13['push'](_0x458e13['shift']());}catch(_0x32fd89){_0x458e13['push'](_0x458e13['shift']());}}}(a196_0xdb16,0x8b988));import{listSqlQueries}from'../../core/api-client.js';function a196_0x48dc(_0x21fdba,_0x31c038){_0x21fdba=_0x21fdba-0x187;const _0xdb16f6=a196_0xdb16();let _0x48dcd8=_0xdb16f6[_0x21fdba];return _0x48dcd8;}function a196_0xdb16(){const _0xb2b41f=['Page\x20size','2457965UoUfED','sqlcode','length','538374zyNZRe','sqlCode','1108173TMbRGV','all','bool','1686938MbBpvu','string','List\x20custom\x20SQL\x20queries','appCode','357935ZJapDb','list','pagesize','read','number','boolean','4pwxuSt','117alyRqM','name','verbose','7bawVFx','sqlName','No\x20custom\x20SQL\x20queries\x20found.','dbId','Found\x20','totalCount','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','6884930zLXBJJ','2FbrJKE','Filter\x20by\x20SQL\x20name','page','num','str','description','tableData','74056Jscdll'];a196_0xdb16=function(){return _0xb2b41f;};return a196_0xdb16();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a196_0x29fdf7(0x19d),'description':a196_0x29fdf7(0x19a),'risk':a196_0x29fdf7(0x19f),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a196_0x29fdf7(0x1a4),'type':a196_0x29fdf7(0x199),'description':a196_0x29fdf7(0x188)},{'name':a196_0x29fdf7(0x189),'type':a196_0x29fdf7(0x1a0),'description':'Page\x20number','default':0x1},{'name':a196_0x29fdf7(0x19e),'type':a196_0x29fdf7(0x1a0),'description':a196_0x29fdf7(0x18f)},{'name':a196_0x29fdf7(0x1a5),'type':a196_0x29fdf7(0x1a1),'description':a196_0x29fdf7(0x1ac)}],async 'execute'(_0x5bbc82){const _0x51d76b=a196_0x29fdf7,_0x42edc3=await listSqlQueries(_0x5bbc82[_0x51d76b(0x19b)],{'sqlCode':_0x5bbc82[_0x51d76b(0x18b)](_0x51d76b(0x191))||undefined,'sqlName':_0x5bbc82['str']('name')||undefined,'currentPage':_0x5bbc82[_0x51d76b(0x18a)](_0x51d76b(0x189)),'pageSize':_0x5bbc82['num']('pagesize',0x32)}),_0x1fc36d=_0x5bbc82[_0x51d76b(0x197)](_0x51d76b(0x1a5)),_0x2fcd6d=_0x42edc3[_0x51d76b(0x18d)]??[],_0x222582=_0x42edc3['paging']?.[_0x51d76b(0x1ab)]??_0x2fcd6d[_0x51d76b(0x192)];let _0x26abcf;return _0x1fc36d?_0x26abcf=_0x2fcd6d:_0x26abcf=await Promise[_0x51d76b(0x196)](_0x2fcd6d['map'](async _0x54384d=>{const _0x29b075=_0x51d76b;let _0x3121d1;try{_0x3121d1=_0x54384d[_0x29b075(0x1a9)]?await getDbName(_0x5bbc82[_0x29b075(0x19b)],_0x54384d['dbId']):undefined;}catch{}return{'sqlCode':_0x54384d[_0x29b075(0x194)],'sqlName':_0x54384d[_0x29b075(0x1a7)],'description':_0x54384d[_0x29b075(0x18c)]??'','db':_0x3121d1?_0x3121d1+'\x20('+_0x54384d[_0x29b075(0x1a9)]+')':_0x54384d[_0x29b075(0x1a9)]??''};})),{'ok':!![],'data':_0x26abcf,'message':_0x2fcd6d[_0x51d76b(0x192)]===0x0?_0x51d76b(0x1a8):_0x51d76b(0x1aa)+_0x2fcd6d['length']+'\x20SQL\x20queries\x20(total:\x20'+_0x222582+').'};}};
1
+ const a196_0xdf3e2=a196_0x496d;(function(_0x7ada95,_0x44b1d6){const _0x2a24b6=a196_0x496d,_0x2404ef=_0x7ada95();while(!![]){try{const _0x5a7831=parseInt(_0x2a24b6(0x13c))/0x1+-parseInt(_0x2a24b6(0x12a))/0x2*(parseInt(_0x2a24b6(0x146))/0x3)+-parseInt(_0x2a24b6(0x12e))/0x4*(parseInt(_0x2a24b6(0x132))/0x5)+-parseInt(_0x2a24b6(0x143))/0x6+parseInt(_0x2a24b6(0x14a))/0x7+-parseInt(_0x2a24b6(0x139))/0x8+-parseInt(_0x2a24b6(0x13d))/0x9*(-parseInt(_0x2a24b6(0x13b))/0xa);if(_0x5a7831===_0x44b1d6)break;else _0x2404ef['push'](_0x2404ef['shift']());}catch(_0x461b60){_0x2404ef['push'](_0x2404ef['shift']());}}}(a196_0x56d5,0x73475));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a196_0x496d(_0x1a7e2f,_0x4fb40c){_0x1a7e2f=_0x1a7e2f-0x128;const _0x56d5c4=a196_0x56d5();let _0x496dab=_0x56d5c4[_0x1a7e2f];return _0x496dab;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a196_0xdf3e2(0x141),'command':a196_0xdf3e2(0x148),'description':a196_0xdf3e2(0x13a),'risk':a196_0xdf3e2(0x136),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a196_0xdf3e2(0x12c),'type':a196_0xdf3e2(0x137),'description':a196_0xdf3e2(0x12b)},{'name':a196_0xdf3e2(0x134),'type':a196_0xdf3e2(0x149),'description':a196_0xdf3e2(0x145),'default':0x1},{'name':'pagesize','type':a196_0xdf3e2(0x149),'description':a196_0xdf3e2(0x13f)},{'name':a196_0xdf3e2(0x128),'type':'boolean','description':a196_0xdf3e2(0x133)}],async 'execute'(_0x27f54c){const _0x4d1a4f=a196_0xdf3e2,_0x516065=await listSqlQueries(_0x27f54c[_0x4d1a4f(0x14c)],{'sqlCode':_0x27f54c['str'](_0x4d1a4f(0x14b))||undefined,'sqlName':_0x27f54c[_0x4d1a4f(0x144)](_0x4d1a4f(0x12c))||undefined,'currentPage':_0x27f54c['num']('page'),'pageSize':_0x27f54c[_0x4d1a4f(0x147)](_0x4d1a4f(0x138),0x32)}),_0x2eb098=_0x27f54c[_0x4d1a4f(0x129)](_0x4d1a4f(0x128)),_0x52dfc6=_0x516065[_0x4d1a4f(0x130)]??[],_0x13074b=_0x516065[_0x4d1a4f(0x13e)]?.[_0x4d1a4f(0x140)]??_0x52dfc6[_0x4d1a4f(0x131)];let _0x2912bc;return _0x2eb098?_0x2912bc=_0x52dfc6:_0x2912bc=await Promise['all'](_0x52dfc6['map'](async _0xf0ef9f=>{const _0x4bd9b4=_0x4d1a4f;let _0x48f0c2;try{_0x48f0c2=_0xf0ef9f[_0x4bd9b4(0x135)]?await getDbName(_0x27f54c['appCode'],_0xf0ef9f[_0x4bd9b4(0x135)]):undefined;}catch{}return{'sqlCode':_0xf0ef9f['sqlCode'],'sqlName':_0xf0ef9f[_0x4bd9b4(0x142)],'description':_0xf0ef9f['description']??'','db':_0x48f0c2?_0x48f0c2+'\x20('+_0xf0ef9f[_0x4bd9b4(0x135)]+')':_0xf0ef9f[_0x4bd9b4(0x135)]??''};})),{'ok':!![],'data':_0x2912bc,'message':_0x52dfc6[_0x4d1a4f(0x131)]===0x0?_0x4d1a4f(0x12d):_0x4d1a4f(0x12f)+_0x52dfc6[_0x4d1a4f(0x131)]+'\x20SQL\x20queries\x20(total:\x20'+_0x13074b+').'};}};function a196_0x56d5(){const _0x94c381=['3974117KJuarv','sqlcode','appCode','verbose','bool','270386qTQMqZ','Filter\x20by\x20SQL\x20name','name','No\x20custom\x20SQL\x20queries\x20found.','1899644ZTvkpa','Found\x20','tableData','length','5xHisfH','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','page','dbId','read','string','pagesize','38456xtkQXA','List\x20custom\x20SQL\x20queries','39740gweMoL','567189XQTvJj','1611CctgYm','paging','Page\x20size','totalCount','sql','sqlName','1310412EKPiiT','str','Page\x20number','15kyRriX','num','list','number'];a196_0x56d5=function(){return _0x94c381;};return a196_0x56d5();}
@@ -1 +1 @@
1
- const a197_0x226a4a=a197_0x2956;(function(_0x63f39a,_0x4243d4){const _0x8f1cb6=a197_0x2956,_0x5ecdb6=_0x63f39a();while(!![]){try{const _0x58fbd6=-parseInt(_0x8f1cb6(0x93))/0x1+-parseInt(_0x8f1cb6(0xbe))/0x2+-parseInt(_0x8f1cb6(0x9c))/0x3+parseInt(_0x8f1cb6(0x98))/0x4*(parseInt(_0x8f1cb6(0xca))/0x5)+-parseInt(_0x8f1cb6(0xc9))/0x6+parseInt(_0x8f1cb6(0xc6))/0x7+-parseInt(_0x8f1cb6(0xa5))/0x8*(-parseInt(_0x8f1cb6(0xbd))/0x9);if(_0x58fbd6===_0x4243d4)break;else _0x5ecdb6['push'](_0x5ecdb6['shift']());}catch(_0x2c4e95){_0x5ecdb6['push'](_0x5ecdb6['shift']());}}}(a197_0x3e82,0xe0b70));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';function a197_0x2956(_0x267d55,_0x1a38ff){_0x267d55=_0x267d55-0x91;const _0x3e825d=a197_0x3e82();let _0x295627=_0x3e825d[_0x267d55];return _0x295627;}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x258785,_0x411dfc){const _0x546146=a197_0x2956,_0x59b7b8=[];let _0x1b9864=0x1;while(!![]){const _0xd9d97=await listSqlQueries(_0x258785,{'currentPage':_0x1b9864,'pageSize':PAGE_SIZE,'sqlCode':_0x411dfc[_0x546146(0xa3)],'sqlName':_0x411dfc[_0x546146(0xa8)]}),_0x50859a=_0xd9d97[_0x546146(0xac)]??[];_0x59b7b8['push'](..._0x50859a);if(_0x50859a[_0x546146(0x9d)]===0x0)break;const _0x4ed2aa=_0xd9d97[_0x546146(0xb6)]?.[_0x546146(0xa9)];if(_0x4ed2aa!=null?_0x59b7b8[_0x546146(0x9d)]>=_0x4ed2aa:_0x50859a[_0x546146(0x9d)]<PAGE_SIZE)break;_0x1b9864++;}return _0x59b7b8;}async function ensureSqlContent(_0x115c18){const _0x120fdd=a197_0x2956;if(_0x115c18['sqlContent']!=null&&String(_0x115c18['sqlContent'])[_0x120fdd(0x9d)]>0x0)return _0x115c18;return getSqlQueryDetail(_0x115c18[_0x120fdd(0xa3)]);}export const sqlPull={'service':'sql','command':'pull','description':a197_0x226a4a(0x94),'risk':a197_0x226a4a(0xab),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a197_0x226a4a(0xb4),'description':a197_0x226a4a(0xc0)},{'name':a197_0x226a4a(0x91),'type':'boolean','description':a197_0x226a4a(0xce)}],async 'dryRun'(_0x3976c1){const _0x5c0b99=a197_0x226a4a,_0x52c31d=loadSqlProjectConfig(_0x3976c1[_0x5c0b99(0xba)]),_0x5cb7b5=await readSqlLockFile(_0x52c31d['lockFilePath']),{appLock:_0xe09721}=ensureSqlLockScope(_0x5cb7b5??createEmptySqlLock(),_0x52c31d['appCode'],_0x52c31d[_0x5c0b99(0xa2)],_0x5c0b99(0x92)),_0x15227c=await fetchAllSqlQueries(_0x3976c1['appCode'],{'sqlCode':_0x3976c1[_0x5c0b99(0xcd)](_0x5c0b99(0x96))||undefined,'sqlName':_0x3976c1['str'](_0x5c0b99(0xb0))||undefined}),_0x4e4932=[];for(const _0xb4a57f of _0x15227c){const _0x3cc8d3=await ensureSqlContent(_0xb4a57f),_0x3bcd84=ensureRemoteSqlContent(_0x3cc8d3),_0x2e0372=detectModeFromSql(_0x3cc8d3),_0x53beb5=_0x3cc8d3[_0x5c0b99(0xbb)]?await getDbName(_0x3976c1[_0x5c0b99(0xba)],Number(_0x3cc8d3['dbId']))[_0x5c0b99(0xb2)](()=>undefined):undefined,_0x3e5654=buildLocalSqlFileContent({'sqlCode':_0x3cc8d3[_0x5c0b99(0xa3)],'sqlName':_0x3cc8d3['sqlName'],'dbId':_0x3cc8d3[_0x5c0b99(0xbb)]},_0x3bcd84,{'dbName':_0x53beb5,'mode':_0x2e0372,'syncedAt':new Date()['toISOString'](),'description':_0x3cc8d3[_0x5c0b99(0x9b)]}),_0x4066eb=buildSqlLockEntry(_0x3cc8d3,_0x3bcd84,'',{'dbName':_0x53beb5}),_0x316fa4=resolveLocalSqlFilePath(_0x52c31d,_0x3cc8d3[_0x5c0b99(0xa3)],_0x4066eb);let _0x52e915=_0x5c0b99(0xa4),_0x5d1f88;if(await fileExists(_0x316fa4)){const _0x40b47f=await readFile(_0x316fa4,_0x5c0b99(0xaf));isEquivalentPulledSqlFile(_0x40b47f,_0x3e5654,_0x2e0372)?(_0x52e915=_0x5c0b99(0xc1),_0x5d1f88=_0x5c0b99(0xaa)):(_0x52e915=_0x5c0b99(0xa7),_0x5d1f88=_0x5c0b99(0xcb));}_0x4e4932[_0x5c0b99(0xbc)]({'sqlCode':_0x3cc8d3[_0x5c0b99(0xa3)],'sqlName':_0x3cc8d3[_0x5c0b99(0xa8)],'filePath':_0x316fa4,'status':_0x52e915,'reason':_0x5d1f88});}return{'method':_0x5c0b99(0x9f),'url':_0x5c0b99(0x9a),'body':{'appCode':_0x3976c1['appCode'],'sqlCode':_0x3976c1[_0x5c0b99(0xcd)](_0x5c0b99(0x96))||null,'sqlName':_0x3976c1[_0x5c0b99(0xcd)](_0x5c0b99(0xb0))||null,'files':_0x4e4932},'description':_0x5c0b99(0xbf)+_0x4e4932['length']+_0x5c0b99(0x97)+_0x52c31d['sqlRootDir']};},async 'execute'(_0x3388be){const _0x2b360d=a197_0x226a4a,_0x2d8a60=loadSqlProjectConfig(_0x3388be['appCode']),_0x23c595=await readSqlLockFile(_0x2d8a60['lockFilePath']),{lockData:_0x4d3618,appLock:_0xbd9ba1}=ensureSqlLockScope(_0x23c595??createEmptySqlLock(),_0x2d8a60[_0x2b360d(0xba)],_0x2d8a60[_0x2b360d(0xa2)],_0x2b360d(0x92)),_0x4cbb66=_0x3388be[_0x2b360d(0xb3)](_0x2b360d(0x91)),_0x451d59=await fetchAllSqlQueries(_0x3388be[_0x2b360d(0xba)],{'sqlCode':_0x3388be[_0x2b360d(0xcd)](_0x2b360d(0x96))||undefined,'sqlName':_0x3388be[_0x2b360d(0xcd)](_0x2b360d(0xb0))||undefined});if(_0x451d59['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x2b360d(0xa0)};const _0x2da7bb=[],_0xd0a2e2=[];for(const _0x20d831 of _0x451d59){try{_0x2da7bb[_0x2b360d(0xbc)](await ensureSqlContent(_0x20d831));}catch(_0x321a6b){_0xd0a2e2[_0x2b360d(0xbc)]({'sqlCode':_0x20d831['sqlCode'],'error':_0x321a6b instanceof Error?_0x321a6b[_0x2b360d(0x9e)]:String(_0x321a6b)});}}if(_0x4cbb66&&!_0x3388be[_0x2b360d(0xad)]){let _0x2700c3=![];for(const _0x40776f of _0x2da7bb){const _0x10c2cd=detectModeFromSql(_0x40776f),_0x12dda1=_0x40776f['dbId']?await getDbName(_0x3388be[_0x2b360d(0xba)],Number(_0x40776f[_0x2b360d(0xbb)]))[_0x2b360d(0xb2)](()=>undefined):undefined,_0x202531=buildLocalSqlFileContent({'sqlCode':_0x40776f[_0x2b360d(0xa3)],'sqlName':_0x40776f[_0x2b360d(0xa8)],'dbId':_0x40776f[_0x2b360d(0xbb)]},ensureRemoteSqlContent(_0x40776f),{'dbName':_0x12dda1,'mode':_0x10c2cd,'syncedAt':new Date()['toISOString'](),'description':_0x40776f[_0x2b360d(0x9b)]}),_0x3b142f=resolveLocalSqlFilePath(_0x2d8a60,_0x40776f['sqlCode'],buildSqlLockEntry(_0x40776f,ensureRemoteSqlContent(_0x40776f),'',{'dbName':_0x12dda1}));if(await fileExists(_0x3b142f)){const _0x3df556=await readFile(_0x3b142f,_0x2b360d(0xaf));if(!isEquivalentPulledSqlFile(_0x3df556,_0x202531,_0x10c2cd)){_0x2700c3=!![];break;}}}if(_0x2700c3){const _0x1f5472=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x1f5472)throw CliErrors[_0x2b360d(0xae)](_0x2b360d(0xa1));}}const _0x22c732=cloneSqlLockData(_0x4d3618),_0x5e8f5f=_0x22c732[_0x2b360d(0xc4)][_0x2d8a60[_0x2b360d(0xba)]],_0x5e20d4=[],_0x393236=[];for(const _0x1bbbd6 of _0x2da7bb){const _0x865035=_0x5e8f5f['sqls'][_0x1bbbd6['sqlCode']],_0x16f245=ensureRemoteSqlContent(_0x1bbbd6),_0x262550=detectModeFromSql(_0x1bbbd6),_0x8c6344=_0x1bbbd6[_0x2b360d(0xbb)]?await getDbName(_0x3388be[_0x2b360d(0xba)],Number(_0x1bbbd6[_0x2b360d(0xbb)]))[_0x2b360d(0xb2)](()=>undefined):undefined,_0x4b9ee8=buildLocalSqlFileContent({'sqlCode':_0x1bbbd6['sqlCode'],'sqlName':_0x1bbbd6['sqlName'],'dbId':_0x1bbbd6[_0x2b360d(0xbb)]},_0x16f245,{'dbName':_0x8c6344,'mode':_0x262550,'syncedAt':new Date()[_0x2b360d(0xb8)](),'description':_0x1bbbd6['description']}),_0x3fe226=buildSqlLockEntry(_0x1bbbd6,_0x16f245,computeSqlContentHash(_0x4b9ee8),{'dbName':_0x8c6344}),_0x24b5f8=_0x3fe226['path'],_0x197543=join(_0x2d8a60[_0x2b360d(0x95)],_0x24b5f8);try{if(await fileExists(_0x197543)){const _0x534106=await readFile(_0x197543,_0x2b360d(0xaf));if(isEquivalentPulledSqlFile(_0x534106,_0x4b9ee8,_0x262550)){_0x393236['push']({'sqlCode':_0x1bbbd6[_0x2b360d(0xa3)],'reason':_0x2b360d(0xaa)}),_0x5e8f5f[_0x2b360d(0xb1)][_0x1bbbd6[_0x2b360d(0xa3)]]={..._0x3fe226,'hash':computeSqlContentHash(_0x534106),'path':_0x24b5f8};continue;}if(!_0x4cbb66){_0x393236['push']({'sqlCode':_0x1bbbd6[_0x2b360d(0xa3)],'reason':_0x2b360d(0xc5)});continue;}}const _0x5b222e=_0x865035?.[_0x2b360d(0xd0)]?join(_0x2d8a60[_0x2b360d(0x95)],_0x865035[_0x2b360d(0xd0)]):undefined;_0x5b222e&&_0x5b222e!==_0x197543&&await fileExists(_0x5b222e)&&await rm(_0x5b222e,{'force':!![]}),await ensureParentDirectory(_0x197543),await writeFile(_0x197543,_0x4b9ee8,_0x2b360d(0xaf)),_0x5e8f5f[_0x2b360d(0xb1)][_0x1bbbd6[_0x2b360d(0xa3)]]={..._0x3fe226,'path':_0x24b5f8},_0x5e20d4['push']({'sqlCode':_0x1bbbd6[_0x2b360d(0xa3)],'filePath':_0x197543});}catch(_0x1f103b){_0xd0a2e2[_0x2b360d(0xbc)]({'sqlCode':_0x1bbbd6[_0x2b360d(0xa3)],'error':_0x1f103b instanceof Error?_0x1f103b[_0x2b360d(0x9e)]:String(_0x1f103b)});}}return _0x5e8f5f['lastSync']=new Date()[_0x2b360d(0xb8)](),await writeSqlLockFile(_0x2d8a60[_0x2b360d(0xcc)],_0x22c732),{'ok':_0xd0a2e2['length']===0x0,'data':{'pulled':_0x5e20d4,'skipped':_0x393236,'failed':_0xd0a2e2},'message':'Pull\x20complete:\x20'+_0x5e20d4['length']+_0x2b360d(0xa6)+_0x393236[_0x2b360d(0x9d)]+_0x2b360d(0xc3)+_0xd0a2e2['length']+_0x2b360d(0xc2)};}};function detectModeFromSql(_0x571162){const _0x2e3625=a197_0x226a4a,_0x5ca7b6=ensureRemoteSqlContent(_0x571162),_0x415221=stripLocalSqlMetadata(_0x5ca7b6,_0x2e3625(0x99))[_0x2e3625(0xc8)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x415221))return'mybatisXml';return _0x2e3625(0xcf);}function isEquivalentPulledSqlFile(_0x4bb0d3,_0x3acdc3,_0x442026){return normalizePullComparableContent(_0x4bb0d3,_0x442026)===normalizePullComparableContent(_0x3acdc3,_0x442026);}function normalizePullComparableContent(_0x1e0217,_0x44009e){const _0x465998=a197_0x226a4a,_0x11af7f=_0x1e0217['replace'](/\r\n/g,'\x0a')[_0x465998(0xc7)]('\x0a'),_0x20e66b=_0x11af7f[_0x465998(0xb5)](_0x1de9e7=>!isSyncedAtMetadataLine(_0x1de9e7,_0x44009e));return _0x20e66b[_0x465998(0xb7)]('\x0a');}function a197_0x3e82(){const _0x6e94=['push','18891ONhHCA','3400306kDkmtc','Would\x20pull\x20','Filter\x20by\x20SQL\x20display\x20name','skipped','\x20failed','\x20skipped,\x20','apps','local\x20differs\x20from\x20remote','7590079NEVIQD','split','trimStart','10638228QEYVdJ','815PipCsZ','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','lockFilePath','str','Force\x20overwrite\x20local\x20unsynced\x20changes','sql','path','force','pull','859283esNpzL','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlRootDir','sqlcode','\x20SQL\x20file(s)\x20into\x20','31760mNbJmd','mybatisXml','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','description','1401657ZSVOHO','length','message','POST','No\x20remote\x20SQL\x20queries\x20matched.','Force\x20pull\x20cancelled.','sqlRoot','sqlCode','would_pull','12736AvYDnv','\x20written,\x20','conflict','sqlName','totalCount','unchanged','read','tableData','nonInteractive','cancelled','utf8','name','sqls','catch','bool','string','filter','paging','join','toISOString','test','appCode','dbId'];a197_0x3e82=function(){return _0x6e94;};return a197_0x3e82();}function isSyncedAtMetadataLine(_0x4c9fcc,_0x259240){const _0x394487=a197_0x226a4a;if(_0x259240===_0x394487(0x99))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x4c9fcc);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x394487(0xb9)](_0x4c9fcc);}
1
+ const a197_0x426c60=a197_0x8d1b;(function(_0x176ec8,_0x81b284){const _0x14d08d=a197_0x8d1b,_0x1d7e6c=_0x176ec8();while(!![]){try{const _0x597add=-parseInt(_0x14d08d(0x1e8))/0x1*(-parseInt(_0x14d08d(0x1c5))/0x2)+parseInt(_0x14d08d(0x1e2))/0x3*(parseInt(_0x14d08d(0x1d9))/0x4)+-parseInt(_0x14d08d(0x1cd))/0x5*(-parseInt(_0x14d08d(0x1b0))/0x6)+parseInt(_0x14d08d(0x1d1))/0x7+parseInt(_0x14d08d(0x1ae))/0x8*(parseInt(_0x14d08d(0x1bd))/0x9)+-parseInt(_0x14d08d(0x1c2))/0xa+parseInt(_0x14d08d(0x1e1))/0xb*(-parseInt(_0x14d08d(0x1b9))/0xc);if(_0x597add===_0x81b284)break;else _0x1d7e6c['push'](_0x1d7e6c['shift']());}catch(_0x22e9b0){_0x1d7e6c['push'](_0x1d7e6c['shift']());}}}(a197_0x5a81,0x459a5));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x25e88c,_0x431816){const _0x2266e1=a197_0x8d1b,_0x11a7ea=[];let _0x295490=0x1;while(!![]){const _0x12227f=await listSqlQueries(_0x25e88c,{'currentPage':_0x295490,'pageSize':PAGE_SIZE,'sqlCode':_0x431816[_0x2266e1(0x1dd)],'sqlName':_0x431816[_0x2266e1(0x1de)]}),_0x132eae=_0x12227f[_0x2266e1(0x1c4)]??[];_0x11a7ea['push'](..._0x132eae);if(_0x132eae[_0x2266e1(0x1ad)]===0x0)break;const _0x44590b=_0x12227f['paging']?.[_0x2266e1(0x1be)];if(_0x44590b!=null?_0x11a7ea[_0x2266e1(0x1ad)]>=_0x44590b:_0x132eae[_0x2266e1(0x1ad)]<PAGE_SIZE)break;_0x295490++;}return _0x11a7ea;}async function ensureSqlContent(_0x5c31f7){const _0x80dd7e=a197_0x8d1b;if(_0x5c31f7['sqlContent']!=null&&String(_0x5c31f7[_0x80dd7e(0x1c6)])[_0x80dd7e(0x1ad)]>0x0)return _0x5c31f7;return getSqlQueryDetail(_0x5c31f7[_0x80dd7e(0x1dd)]);}export const sqlPull={'service':a197_0x426c60(0x1b1),'command':a197_0x426c60(0x1e9),'description':a197_0x426c60(0x1da),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a197_0x426c60(0x1ec),'type':a197_0x426c60(0x1b2),'description':a197_0x426c60(0x1d3)},{'name':a197_0x426c60(0x1cf),'type':a197_0x426c60(0x1ed),'description':a197_0x426c60(0x1d2)}],async 'dryRun'(_0x7544cf){const _0x48b495=a197_0x426c60,_0x3beec2=loadSqlProjectConfig(_0x7544cf[_0x48b495(0x1c0)]),_0x37b454=await readSqlLockFile(_0x3beec2['lockFilePath']),{appLock:_0x277602}=ensureSqlLockScope(_0x37b454??createEmptySqlLock(),_0x3beec2[_0x48b495(0x1c0)],_0x3beec2[_0x48b495(0x1b7)],_0x48b495(0x1e9)),_0x38d8de=await fetchAllSqlQueries(_0x7544cf[_0x48b495(0x1c0)],{'sqlCode':_0x7544cf[_0x48b495(0x1d5)]('sqlcode')||undefined,'sqlName':_0x7544cf[_0x48b495(0x1d5)](_0x48b495(0x1ec))||undefined}),_0x48be89=[];for(const _0x33b0ea of _0x38d8de){const _0x17d2bd=await ensureSqlContent(_0x33b0ea),_0xda0c41=ensureRemoteSqlContent(_0x17d2bd),_0x477ea9=detectModeFromSql(_0x17d2bd),_0x3e0672=_0x17d2bd[_0x48b495(0x1c7)]?await getDbName(_0x7544cf[_0x48b495(0x1c0)],Number(_0x17d2bd[_0x48b495(0x1c7)]))[_0x48b495(0x1e7)](()=>undefined):undefined,_0x1be82a=buildLocalSqlFileContent({'sqlCode':_0x17d2bd[_0x48b495(0x1dd)],'sqlName':_0x17d2bd['sqlName'],'dbId':_0x17d2bd[_0x48b495(0x1c7)]},_0xda0c41,{'dbName':_0x3e0672,'mode':_0x477ea9,'syncedAt':new Date()[_0x48b495(0x1b5)](),'description':_0x17d2bd['description']}),_0x1142b8=buildSqlLockEntry(_0x17d2bd,_0xda0c41,'',{'dbName':_0x3e0672}),_0xe9cb82=resolveLocalSqlFilePath(_0x3beec2,_0x17d2bd[_0x48b495(0x1dd)],_0x1142b8);let _0x401cf6=_0x48b495(0x1eb),_0x7b6761;if(await fileExists(_0xe9cb82)){const _0x249109=await readFile(_0xe9cb82,'utf8');isEquivalentPulledSqlFile(_0x249109,_0x1be82a,_0x477ea9)?(_0x401cf6=_0x48b495(0x1ca),_0x7b6761=_0x48b495(0x1cb)):(_0x401cf6=_0x48b495(0x1d6),_0x7b6761=_0x48b495(0x1ea));}_0x48be89[_0x48b495(0x1ac)]({'sqlCode':_0x17d2bd[_0x48b495(0x1dd)],'sqlName':_0x17d2bd['sqlName'],'filePath':_0xe9cb82,'status':_0x401cf6,'reason':_0x7b6761});}return{'method':_0x48b495(0x1e4),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x7544cf['appCode'],'sqlCode':_0x7544cf[_0x48b495(0x1d5)](_0x48b495(0x1bf))||null,'sqlName':_0x7544cf[_0x48b495(0x1d5)](_0x48b495(0x1ec))||null,'files':_0x48be89},'description':_0x48b495(0x1d4)+_0x48be89[_0x48b495(0x1ad)]+_0x48b495(0x1d0)+_0x3beec2[_0x48b495(0x1e6)]};},async 'execute'(_0x114dc5){const _0x562c70=a197_0x426c60,_0x304e58=loadSqlProjectConfig(_0x114dc5[_0x562c70(0x1c0)]),_0x21b8ce=await readSqlLockFile(_0x304e58[_0x562c70(0x1e3)]),{lockData:_0x4683e7,appLock:_0x3067d6}=ensureSqlLockScope(_0x21b8ce??createEmptySqlLock(),_0x304e58['appCode'],_0x304e58['sqlRoot'],_0x562c70(0x1e9)),_0x3aa001=_0x114dc5[_0x562c70(0x1ce)]('force'),_0x1e2e4=await fetchAllSqlQueries(_0x114dc5[_0x562c70(0x1c0)],{'sqlCode':_0x114dc5[_0x562c70(0x1d5)](_0x562c70(0x1bf))||undefined,'sqlName':_0x114dc5[_0x562c70(0x1d5)](_0x562c70(0x1ec))||undefined});if(_0x1e2e4[_0x562c70(0x1ad)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x1ed442=[],_0x41587a=[];for(const _0x3e4a4d of _0x1e2e4){try{_0x1ed442[_0x562c70(0x1ac)](await ensureSqlContent(_0x3e4a4d));}catch(_0x35891e){_0x41587a[_0x562c70(0x1ac)]({'sqlCode':_0x3e4a4d[_0x562c70(0x1dd)],'error':_0x35891e instanceof Error?_0x35891e['message']:String(_0x35891e)});}}if(_0x3aa001&&!_0x114dc5[_0x562c70(0x1ba)]){let _0xf3c2c=![];for(const _0x489084 of _0x1ed442){const _0x48d109=detectModeFromSql(_0x489084),_0x4e63ec=_0x489084[_0x562c70(0x1c7)]?await getDbName(_0x114dc5[_0x562c70(0x1c0)],Number(_0x489084['dbId']))[_0x562c70(0x1e7)](()=>undefined):undefined,_0x1ac98a=buildLocalSqlFileContent({'sqlCode':_0x489084[_0x562c70(0x1dd)],'sqlName':_0x489084[_0x562c70(0x1de)],'dbId':_0x489084[_0x562c70(0x1c7)]},ensureRemoteSqlContent(_0x489084),{'dbName':_0x4e63ec,'mode':_0x48d109,'syncedAt':new Date()[_0x562c70(0x1b5)](),'description':_0x489084['description']}),_0x212903=resolveLocalSqlFilePath(_0x304e58,_0x489084['sqlCode'],buildSqlLockEntry(_0x489084,ensureRemoteSqlContent(_0x489084),'',{'dbName':_0x4e63ec}));if(await fileExists(_0x212903)){const _0x58e039=await readFile(_0x212903,'utf8');if(!isEquivalentPulledSqlFile(_0x58e039,_0x1ac98a,_0x48d109)){_0xf3c2c=!![];break;}}}if(_0xf3c2c){const _0x4bd775=await confirmForceOverwrite(_0x562c70(0x1e0));if(!_0x4bd775)throw CliErrors['cancelled']('Force\x20pull\x20cancelled.');}}const _0x5b719a=cloneSqlLockData(_0x4683e7),_0x26de66=_0x5b719a[_0x562c70(0x1c9)][_0x304e58[_0x562c70(0x1c0)]],_0x4c9d19=[],_0x504a6e=[];for(const _0x565e4a of _0x1ed442){const _0x3479ad=_0x26de66[_0x562c70(0x1b4)][_0x565e4a[_0x562c70(0x1dd)]],_0x5502b0=ensureRemoteSqlContent(_0x565e4a),_0x3f44da=detectModeFromSql(_0x565e4a),_0x1ea73f=_0x565e4a['dbId']?await getDbName(_0x114dc5['appCode'],Number(_0x565e4a[_0x562c70(0x1c7)]))[_0x562c70(0x1e7)](()=>undefined):undefined,_0x1a6072=buildLocalSqlFileContent({'sqlCode':_0x565e4a['sqlCode'],'sqlName':_0x565e4a[_0x562c70(0x1de)],'dbId':_0x565e4a[_0x562c70(0x1c7)]},_0x5502b0,{'dbName':_0x1ea73f,'mode':_0x3f44da,'syncedAt':new Date()[_0x562c70(0x1b5)](),'description':_0x565e4a[_0x562c70(0x1dc)]}),_0x1dd297=buildSqlLockEntry(_0x565e4a,_0x5502b0,computeSqlContentHash(_0x1a6072),{'dbName':_0x1ea73f}),_0x170abd=_0x1dd297['path'],_0x7bc63b=join(_0x304e58['sqlRootDir'],_0x170abd);try{if(await fileExists(_0x7bc63b)){const _0x309608=await readFile(_0x7bc63b,_0x562c70(0x1d8));if(isEquivalentPulledSqlFile(_0x309608,_0x1a6072,_0x3f44da)){_0x504a6e[_0x562c70(0x1ac)]({'sqlCode':_0x565e4a[_0x562c70(0x1dd)],'reason':_0x562c70(0x1cb)}),_0x26de66[_0x562c70(0x1b4)][_0x565e4a['sqlCode']]={..._0x1dd297,'hash':computeSqlContentHash(_0x309608),'path':_0x170abd};continue;}if(!_0x3aa001){_0x504a6e['push']({'sqlCode':_0x565e4a['sqlCode'],'reason':_0x562c70(0x1b3)});continue;}}const _0x3d8876=_0x3479ad?.['path']?join(_0x304e58['sqlRootDir'],_0x3479ad[_0x562c70(0x1c3)]):undefined;_0x3d8876&&_0x3d8876!==_0x7bc63b&&await fileExists(_0x3d8876)&&await rm(_0x3d8876,{'force':!![]}),await ensureParentDirectory(_0x7bc63b),await writeFile(_0x7bc63b,_0x1a6072,_0x562c70(0x1d8)),_0x26de66[_0x562c70(0x1b4)][_0x565e4a[_0x562c70(0x1dd)]]={..._0x1dd297,'path':_0x170abd},_0x4c9d19[_0x562c70(0x1ac)]({'sqlCode':_0x565e4a[_0x562c70(0x1dd)],'filePath':_0x7bc63b});}catch(_0x314217){_0x41587a[_0x562c70(0x1ac)]({'sqlCode':_0x565e4a[_0x562c70(0x1dd)],'error':_0x314217 instanceof Error?_0x314217[_0x562c70(0x1bb)]:String(_0x314217)});}}return _0x26de66['lastSync']=new Date()[_0x562c70(0x1b5)](),await writeSqlLockFile(_0x304e58[_0x562c70(0x1e3)],_0x5b719a),{'ok':_0x41587a[_0x562c70(0x1ad)]===0x0,'data':{'pulled':_0x4c9d19,'skipped':_0x504a6e,'failed':_0x41587a},'message':_0x562c70(0x1c1)+_0x4c9d19[_0x562c70(0x1ad)]+_0x562c70(0x1df)+_0x504a6e[_0x562c70(0x1ad)]+_0x562c70(0x1b6)+_0x41587a[_0x562c70(0x1ad)]+_0x562c70(0x1af)};}};function detectModeFromSql(_0x1bfdd5){const _0x1f3504=a197_0x426c60,_0x351dc6=ensureRemoteSqlContent(_0x1bfdd5),_0x278fcb=stripLocalSqlMetadata(_0x351dc6,_0x1f3504(0x1bc))[_0x1f3504(0x1cc)]();if(/^<(select|insert|update|delete)\b/i[_0x1f3504(0x1c8)](_0x278fcb))return _0x1f3504(0x1bc);return _0x1f3504(0x1b1);}function isEquivalentPulledSqlFile(_0x338858,_0x23e883,_0x10ed32){return normalizePullComparableContent(_0x338858,_0x10ed32)===normalizePullComparableContent(_0x23e883,_0x10ed32);}function a197_0x8d1b(_0x171217,_0x338e94){_0x171217=_0x171217-0x1ac;const _0x5a8139=a197_0x5a81();let _0x8d1b22=_0x5a8139[_0x171217];return _0x8d1b22;}function a197_0x5a81(){const _0x293f6a=['trimStart','490125Ajpmur','bool','force','\x20SQL\x20file(s)\x20into\x20','3264149iYrjBq','Force\x20overwrite\x20local\x20unsynced\x20changes','Filter\x20by\x20SQL\x20display\x20name','Would\x20pull\x20','str','conflict','split','utf8','36jLEsJi','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','join','description','sqlCode','sqlName','\x20written,\x20','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','11ymAmLq','139581ooIzbt','lockFilePath','POST','replace','sqlRootDir','catch','43PTgMvA','pull','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','would_pull','name','boolean','push','length','808nfiSbv','\x20failed','18WJGTDB','sql','string','local\x20differs\x20from\x20remote','sqls','toISOString','\x20skipped,\x20','sqlRoot','filter','15049752vSbkzE','nonInteractive','message','mybatisXml','7578Nmwmpi','totalCount','sqlcode','appCode','Pull\x20complete:\x20','1450810rHupgE','path','tableData','19542DgDiVt','sqlContent','dbId','test','apps','skipped','unchanged'];a197_0x5a81=function(){return _0x293f6a;};return a197_0x5a81();}function normalizePullComparableContent(_0x49b6b0,_0x19b0d5){const _0x52e808=a197_0x426c60,_0x2aa26b=_0x49b6b0[_0x52e808(0x1e5)](/\r\n/g,'\x0a')[_0x52e808(0x1d7)]('\x0a'),_0x2c00e7=_0x2aa26b[_0x52e808(0x1b8)](_0x4123b3=>!isSyncedAtMetadataLine(_0x4123b3,_0x19b0d5));return _0x2c00e7[_0x52e808(0x1db)]('\x0a');}function isSyncedAtMetadataLine(_0x406a98,_0x39cb57){const _0x176c50=a197_0x426c60;if(_0x39cb57===_0x176c50(0x1bc))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x406a98);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x176c50(0x1c8)](_0x406a98);}