@lovrabet/rabetbase-cli 2.3.16-beta.1 → 2.3.16-beta.2

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 (277) hide show
  1. package/README.md +1 -1
  2. package/lib/api/api-doc.js +1 -1
  3. package/lib/api/fetch-model-list.js +1 -1
  4. package/lib/api/generate-api-file.js +1 -1
  5. package/lib/auth/auth-server-ui.js +1 -1
  6. package/lib/auth/auth-server.js +1 -1
  7. package/lib/auth/constant.js +1 -1
  8. package/lib/auth/get-cookie.js +1 -1
  9. package/lib/auth/get-session-user.js +1 -1
  10. package/lib/auth/is-session-valid.js +1 -1
  11. package/lib/auth/login-success-html.js +1 -1
  12. package/lib/auth/logout.js +1 -1
  13. package/lib/cli-flags.js +1 -1
  14. package/lib/cli.js +1 -1
  15. package/lib/commands/api/generate.js +1 -1
  16. package/lib/commands/api/index.js +1 -1
  17. package/lib/commands/api/list.js +1 -1
  18. package/lib/commands/api/pull.js +1 -1
  19. package/lib/commands/api/shared.js +1 -1
  20. package/lib/commands/app/index.js +1 -1
  21. package/lib/commands/app/list.js +1 -1
  22. package/lib/commands/app/members-list.js +1 -0
  23. package/lib/commands/app/remote-directory.js +1 -1
  24. package/lib/commands/app/shared.js +1 -1
  25. package/lib/commands/app-config/delete.js +1 -1
  26. package/lib/commands/app-config/get.js +1 -1
  27. package/lib/commands/app-config/index.js +1 -1
  28. package/lib/commands/app-config/list.js +1 -1
  29. package/lib/commands/app-config/set.js +1 -1
  30. package/lib/commands/app-config/shared.js +1 -1
  31. package/lib/commands/auth/index.js +1 -1
  32. package/lib/commands/bff/create.js +1 -1
  33. package/lib/commands/bff/delete.js +1 -1
  34. package/lib/commands/bff/detail.js +1 -1
  35. package/lib/commands/bff/index.js +1 -1
  36. package/lib/commands/bff/list.js +1 -1
  37. package/lib/commands/bff/pull.js +1 -1
  38. package/lib/commands/bff/push.js +1 -1
  39. package/lib/commands/bff/status.js +1 -1
  40. package/lib/commands/cli-skill/index.js +1 -1
  41. package/lib/commands/cli-update.js +1 -1
  42. package/lib/commands/codegen/index.js +1 -1
  43. package/lib/commands/codegen/sdk.js +1 -1
  44. package/lib/commands/codegen/sql.js +1 -1
  45. package/lib/commands/common/app-registry.js +1 -1
  46. package/lib/commands/common/app-selector.js +1 -1
  47. package/lib/commands/common/async-task.js +1 -1
  48. package/lib/commands/common/dry-run.js +1 -1
  49. package/lib/commands/common/flags.js +1 -1
  50. package/lib/commands/common/local-file.js +1 -1
  51. package/lib/commands/common/validate.js +1 -1
  52. package/lib/commands/config/get.js +1 -1
  53. package/lib/commands/config/index.js +1 -1
  54. package/lib/commands/config/list.js +1 -1
  55. package/lib/commands/config/set.js +1 -1
  56. package/lib/commands/config/shared.js +1 -1
  57. package/lib/commands/data/filter.js +1 -1
  58. package/lib/commands/data/getOne.js +1 -1
  59. package/lib/commands/data/index.js +1 -1
  60. package/lib/commands/data/shared.js +1 -1
  61. package/lib/commands/dataset/business-group-update.js +1 -1
  62. package/lib/commands/dataset/capability.js +1 -1
  63. package/lib/commands/dataset/delete.js +1 -1
  64. package/lib/commands/dataset/detail.js +1 -1
  65. package/lib/commands/dataset/extend-update.js +1 -1
  66. package/lib/commands/dataset/field-update.js +1 -1
  67. package/lib/commands/dataset/generate.js +1 -1
  68. package/lib/commands/dataset/index.js +1 -1
  69. package/lib/commands/dataset/list.js +1 -1
  70. package/lib/commands/dataset/operations.js +1 -1
  71. package/lib/commands/dataset/relation-audit.js +1 -1
  72. package/lib/commands/dataset/relation-create.js +1 -1
  73. package/lib/commands/dataset/relation-delete.js +1 -1
  74. package/lib/commands/dataset/relation-shared.js +1 -1
  75. package/lib/commands/dataset/relation-update.js +1 -1
  76. package/lib/commands/dataset/relations.js +1 -1
  77. package/lib/commands/dataset/rename.js +1 -1
  78. package/lib/commands/dataset/restore.js +1 -1
  79. package/lib/commands/db/analysis-batching.js +1 -1
  80. package/lib/commands/db/analyze-batch-plan.js +1 -1
  81. package/lib/commands/db/analyze-cancel.js +1 -1
  82. package/lib/commands/db/analyze-start.js +1 -1
  83. package/lib/commands/db/analyze-status.js +1 -1
  84. package/lib/commands/db/create.js +1 -1
  85. package/lib/commands/db/delete.js +1 -1
  86. package/lib/commands/db/detail.js +1 -1
  87. package/lib/commands/db/diff.js +1 -1
  88. package/lib/commands/db/index.js +1 -1
  89. package/lib/commands/db/list.js +1 -1
  90. package/lib/commands/db/shared.js +1 -1
  91. package/lib/commands/db/tables.js +1 -1
  92. package/lib/commands/db/test.js +1 -1
  93. package/lib/commands/db/update.js +1 -1
  94. package/lib/commands/doctor.js +1 -1
  95. package/lib/commands/file/index.js +1 -1
  96. package/lib/commands/init/index.js +1 -1
  97. package/lib/commands/issue/index.js +1 -1
  98. package/lib/commands/issue/nudge.js +1 -1
  99. package/lib/commands/issue/report.js +1 -1
  100. package/lib/commands/issue/shared.js +1 -1
  101. package/lib/commands/kb/create.js +1 -1
  102. package/lib/commands/kb/delete.js +1 -1
  103. package/lib/commands/kb/detail.js +1 -1
  104. package/lib/commands/kb/index.js +1 -1
  105. package/lib/commands/kb/list.js +1 -1
  106. package/lib/commands/kb/shared.js +1 -1
  107. package/lib/commands/kb/update.js +1 -1
  108. package/lib/commands/logs/index.js +1 -1
  109. package/lib/commands/menu/asset-update.js +1 -1
  110. package/lib/commands/menu/delete.js +1 -1
  111. package/lib/commands/menu/external-link-create.js +1 -1
  112. package/lib/commands/menu/external-link-update.js +1 -1
  113. package/lib/commands/menu/group-create.js +1 -1
  114. package/lib/commands/menu/group-update.js +1 -1
  115. package/lib/commands/menu/index.js +1 -1
  116. package/lib/commands/menu/list.js +1 -1
  117. package/lib/commands/menu/move.js +1 -1
  118. package/lib/commands/menu/regroup-start.js +1 -1
  119. package/lib/commands/menu/rename.js +1 -1
  120. package/lib/commands/menu/shared/compare-table.js +1 -1
  121. package/lib/commands/menu/shared/delete-plan.js +1 -1
  122. package/lib/commands/menu/shared/facts.js +1 -1
  123. package/lib/commands/menu/shared/index.js +1 -1
  124. package/lib/commands/menu/shared/inquirer.js +1 -1
  125. package/lib/commands/menu/shared/local-pages.js +1 -1
  126. package/lib/commands/menu/shared/logic.js +1 -1
  127. package/lib/commands/menu/shared/mutations.js +1 -1
  128. package/lib/commands/menu/shared/service.js +1 -1
  129. package/lib/commands/menu/shared/sync-core.js +1 -1
  130. package/lib/commands/menu/shared/update-core.js +1 -1
  131. package/lib/commands/menu/shared/valid-url.js +1 -1
  132. package/lib/commands/menu/sync.js +1 -1
  133. package/lib/commands/notification/config-list.js +1 -1
  134. package/lib/commands/notification/index.js +1 -1
  135. package/lib/commands/ocr/index.js +1 -1
  136. package/lib/commands/page/generate-start.js +1 -1
  137. package/lib/commands/page/generate-status.js +1 -1
  138. package/lib/commands/page/index.js +1 -1
  139. package/lib/commands/page/pull.js +1 -1
  140. package/lib/commands/page/push.js +1 -1
  141. package/lib/commands/page/relation-audit.js +1 -1
  142. package/lib/commands/page/restore.js +1 -1
  143. package/lib/commands/page/shared.js +1 -1
  144. package/lib/commands/page/standard-page-status.js +1 -1
  145. package/lib/commands/page/sync.js +1 -1
  146. package/lib/commands/permit/index.js +1 -1
  147. package/lib/commands/permit/page-get.js +1 -1
  148. package/lib/commands/permit/page-set.js +1 -1
  149. package/lib/commands/permit/role-apis-set.js +1 -1
  150. package/lib/commands/permit/role-menus-set.js +1 -1
  151. package/lib/commands/permit/role-menus.js +1 -1
  152. package/lib/commands/permit/shared.js +1 -1
  153. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  154. package/lib/commands/project/create/format-elapsed.js +1 -1
  155. package/lib/commands/project/create/main.js +1 -1
  156. package/lib/commands/project/create/non-interactive.js +1 -1
  157. package/lib/commands/project/create/project-template-path.js +1 -1
  158. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  159. package/lib/commands/project/create/use-format-code.js +1 -1
  160. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  161. package/lib/commands/project/index.js +1 -1
  162. package/lib/commands/project/init.js +1 -1
  163. package/lib/commands/project/upgrade.js +1 -1
  164. package/lib/commands/registry.js +1 -1
  165. package/lib/commands/role/create.js +1 -1
  166. package/lib/commands/role/delete.js +1 -1
  167. package/lib/commands/role/detail.js +1 -1
  168. package/lib/commands/role/index.js +1 -1
  169. package/lib/commands/role/list.js +1 -1
  170. package/lib/commands/role/shared.js +1 -1
  171. package/lib/commands/role/update.js +1 -1
  172. package/lib/commands/role/user-add.js +1 -1
  173. package/lib/commands/role/user-remove.js +1 -1
  174. package/lib/commands/role/user-resolve.js +1 -1
  175. package/lib/commands/run/index.js +1 -1
  176. package/lib/commands/schema.js +1 -1
  177. package/lib/commands/sql/create.js +1 -1
  178. package/lib/commands/sql/delete.js +1 -1
  179. package/lib/commands/sql/detail.js +1 -1
  180. package/lib/commands/sql/exec.js +1 -1
  181. package/lib/commands/sql/index.js +1 -1
  182. package/lib/commands/sql/list.js +1 -1
  183. package/lib/commands/sql/pull.js +1 -1
  184. package/lib/commands/sql/push.js +1 -1
  185. package/lib/commands/sql/save.js +1 -1
  186. package/lib/commands/sql/shared.js +1 -1
  187. package/lib/commands/sql/status.js +1 -1
  188. package/lib/commands/sql/validate.js +1 -1
  189. package/lib/commands/task/index.js +1 -1
  190. package/lib/commands/task/status.js +1 -1
  191. package/lib/commands/tenant/index.js +1 -0
  192. package/lib/commands/tenant/members-list.js +1 -0
  193. package/lib/commands/tenant/shared.js +1 -0
  194. package/lib/commands/workspace/add.js +1 -1
  195. package/lib/commands/workspace/index.js +1 -1
  196. package/lib/commands/workspace/remove.js +1 -1
  197. package/lib/config/schema.js +1 -1
  198. package/lib/constant/cdn.js +1 -1
  199. package/lib/constant/cli.js +1 -1
  200. package/lib/constant/defaults.js +1 -1
  201. package/lib/constant/domain.js +1 -1
  202. package/lib/constant/env.js +1 -1
  203. package/lib/constant/output.js +1 -1
  204. package/lib/constant/paths.js +1 -1
  205. package/lib/constant/risk.js +1 -1
  206. package/lib/context/app-resolver.js +1 -1
  207. package/lib/context/auth-resolver.js +1 -1
  208. package/lib/context/config-loader.js +1 -1
  209. package/lib/context.js +1 -1
  210. package/lib/core/alias-resolver.js +1 -1
  211. package/lib/core/api-client.js +1 -1
  212. package/lib/core/bff/config.js +1 -1
  213. package/lib/core/bff/file-system.js +1 -1
  214. package/lib/core/bff/hash.js +1 -1
  215. package/lib/core/bff/lock.js +1 -1
  216. package/lib/core/bff/utils.js +1 -1
  217. package/lib/core/db-resolver.js +1 -1
  218. package/lib/core/page/file-system.js +1 -1
  219. package/lib/core/page/hash.js +1 -1
  220. package/lib/core/page/lock.js +1 -1
  221. package/lib/core/sql-index-auditor.js +1 -1
  222. package/lib/core/sql-sync/config.js +1 -1
  223. package/lib/core/sql-sync/file-system.js +1 -1
  224. package/lib/core/sql-sync/hash.js +1 -1
  225. package/lib/core/sql-sync/lock.js +1 -1
  226. package/lib/core/sql-sync/utils.js +1 -1
  227. package/lib/core/sql-validator.js +1 -1
  228. package/lib/errors.js +1 -1
  229. package/lib/framework/build-all-flags.js +1 -1
  230. package/lib/framework/error-output.js +1 -1
  231. package/lib/framework/explicit-yes.js +1 -1
  232. package/lib/framework/flags.js +1 -1
  233. package/lib/framework/help.js +1 -1
  234. package/lib/framework/index.js +1 -1
  235. package/lib/framework/output.js +1 -1
  236. package/lib/framework/response.js +1 -1
  237. package/lib/framework/runner-alias.js +1 -1
  238. package/lib/framework/runner.js +1 -1
  239. package/lib/framework/schema-export.js +1 -1
  240. package/lib/framework/types.js +1 -1
  241. package/lib/generated/build-info.js +1 -1
  242. package/lib/help.js +1 -1
  243. package/lib/skills/main.js +1 -1
  244. package/lib/skills/npx-skills-add.js +1 -1
  245. package/lib/skills/skill-presence.js +1 -1
  246. package/lib/telemetry/cli-command-trace.js +1 -1
  247. package/lib/telemetry/cli-help-trace.js +1 -1
  248. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  249. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  250. package/lib/telemetry/send-cli-trace-log.js +1 -1
  251. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  252. package/lib/utils/ai_config.js +1 -1
  253. package/lib/utils/apply-jq-filter.js +1 -1
  254. package/lib/utils/cdn-config.js +1 -1
  255. package/lib/utils/check-sdk-version.js +1 -1
  256. package/lib/utils/cli-version-check.js +1 -1
  257. package/lib/utils/cli-version-policy.js +1 -1
  258. package/lib/utils/config.js +1 -1
  259. package/lib/utils/copy-directory.js +1 -1
  260. package/lib/utils/entity-with-id.js +1 -1
  261. package/lib/utils/file-utils.js +1 -1
  262. package/lib/utils/guides-cdn.js +1 -1
  263. package/lib/utils/http-client.js +1 -1
  264. package/lib/utils/is-non-interactive.js +1 -1
  265. package/lib/utils/logger.js +1 -1
  266. package/lib/utils/params.js +1 -1
  267. package/lib/utils/platform.js +1 -1
  268. package/lib/utils/rules-cdn.js +1 -1
  269. package/lib/utils/sleep.js +1 -1
  270. package/lib/utils/template-replacer.js +1 -1
  271. package/lib/utils/update-notice.js +1 -1
  272. package/lib/utils/version.js +1 -1
  273. package/lib/utils/with-active-cookie.js +1 -1
  274. package/lib/utils/write-cli-side-channel.js +1 -1
  275. package/package.json +2 -2
  276. package/lib/commands/app/add.js +0 -1
  277. package/lib/commands/app/remove.js +0 -1
@@ -1 +1 @@
1
- const a170_0x439d91=a170_0x1838;(function(_0x558d09,_0x266755){const _0x58120c=a170_0x1838,_0x3a1fca=_0x558d09();while(!![]){try{const _0xffa7c=parseInt(_0x58120c(0xac))/0x1+parseInt(_0x58120c(0x9e))/0x2+parseInt(_0x58120c(0xcd))/0x3*(parseInt(_0x58120c(0x83))/0x4)+parseInt(_0x58120c(0x8d))/0x5*(-parseInt(_0x58120c(0x94))/0x6)+-parseInt(_0x58120c(0x81))/0x7+-parseInt(_0x58120c(0xc6))/0x8+parseInt(_0x58120c(0x88))/0x9;if(_0xffa7c===_0x266755)break;else _0x3a1fca['push'](_0x3a1fca['shift']());}catch(_0xeedfdb){_0x3a1fca['push'](_0x3a1fca['shift']());}}}(a170_0x19f1,0x90977));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':'number','required':!![],'description':a170_0x439d91(0x85)};function a170_0x19f1(){const _0x51ea43=['Multiple\x20tenant\x20members\x20match\x20\x22','totalCount','name','filter','Disambiguate\x20with\x20--user\x20<id>.','test','dryRun','\x22\x20not\x20found\x20in\x20app\x20','expect-user-count','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','authRequired','Missing\x20role\x20reference.','string','\x20member(s)\x20but\x20role\x20has\x20','join','length','DEV','\x20is\x20already\x20a\x20member\x20of\x20role\x20','username','trim','expectUserCount','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','findIndex','8553528sFzajU','userId','flag','roleName','flagMissing','includes','permitCount','177WxwGou','\x22:\x20','No\x20tenant\x20member\x20matches\x20\x22','8018017bnWslb',';\x20no\x20change.','62844hQhSCV','roleType','Role\x20id\x20(from\x20`role\x20list`)','appCode','Pass\x20--user\x20<id|name>.','9509931GttLPz','find','user','push','User\x20','5KHazsq','POST','ADMIN','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','validation','toLowerCase','2749926gFckwx','\x20is\x20not\x20a\x20member\x20of\x20role\x20','remark','\x22\x20is\x20ambiguous\x20(ids:\x20','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','tenant','\x20not\x20found\x20in\x20the\x20user-role\x20list.','str','map','user-add','523494sRRWyQ','userList','nickname','Pass\x20--role\x20<id|name>.','Disambiguate\x20with\x20--role\x20<id>.','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','Cannot\x20','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','\x20built-in\x20role\x20','number','role','USER','Role\x20name\x20\x22','1019835BBXvky','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'];a170_0x19f1=function(){return _0x51ea43;};return a170_0x19f1();}export const ROLE_REF_FLAG={'name':'role','type':a170_0x439d91(0xba),'required':!![],'description':a170_0x439d91(0xa3)};export const USER_REF_FLAG={'name':a170_0x439d91(0x8a),'type':a170_0x439d91(0xba),'required':!![],'description':'User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'};export const NAME_FLAG={'name':a170_0x439d91(0xb0),'type':a170_0x439d91(0xba),'required':!![],'description':'Role\x20name'};function a170_0x1838(_0x1622ee,_0x12f93d){_0x1622ee=_0x1622ee-0x7f;const _0x19f14b=a170_0x19f1();let _0x183801=_0x19f14b[_0x1622ee];return _0x183801;}export const USER_NAME_FLAG={'name':'name','type':a170_0x439d91(0xba),'required':!![],'description':a170_0x439d91(0xad)};export const REMARK_FLAG={'name':a170_0x439d91(0x96),'type':a170_0x439d91(0xba),'required':![],'description':'Optional\x20role\x20remark/description'};export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a170_0x439d91(0xa8),'required':![],'description':a170_0x439d91(0xa6)};export const BUILTIN_ROLE_TYPES=[a170_0x439d91(0x8f),a170_0x439d91(0xbe),a170_0x439d91(0xaa)];export function isBuiltinRole(_0x1ab113){return BUILTIN_ROLE_TYPES['includes'](_0x1ab113);}export function assertCustomRole(_0x4ef55e,_0x52060e){const _0xb2f676=a170_0x439d91;if(_0x4ef55e['roleType']!=='CUSTOM')throw CliErrors['validation'](_0xb2f676(0xa4)+_0x52060e+_0xb2f676(0xa7)+_0x4ef55e[_0xb2f676(0xc9)]+'\x20('+_0x4ef55e[_0xb2f676(0x84)]+').',_0xb2f676(0x98));}export function assertPermConfigurable(_0x434ca4){const _0x4552c3=a170_0x439d91;if(_0x434ca4['roleType']==='DEV'||_0x434ca4[_0x4552c3(0x84)]===_0x4552c3(0x8f))throw CliErrors['validation']('Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20'+_0x434ca4[_0x4552c3(0xc9)]+'\x20('+_0x434ca4[_0x4552c3(0x84)]+').',_0x4552c3(0xb7));}export function projectRole(_0x73b051){const _0x7a5d5b=a170_0x439d91;return{'id':_0x73b051['id'],'roleName':_0x73b051[_0x7a5d5b(0xc9)],'roleType':_0x73b051[_0x7a5d5b(0x84)],'remark':_0x73b051[_0x7a5d5b(0x96)],'userCount':_0x73b051['userCount'],'permitCount':_0x73b051[_0x7a5d5b(0xcc)],'builtin':isBuiltinRole(_0x73b051['roleType'])};}export async function resolveRoleRef(_0xe83a7,_0x289d7f){const _0x3a5838=a170_0x439d91,_0x54e6f8=_0x289d7f[_0x3a5838(0xc1)]();if(!_0x54e6f8)throw CliErrors[_0x3a5838(0x92)](_0x3a5838(0xb9),_0x3a5838(0xa1));if(/^\d+$/['test'](_0x54e6f8))return getRoleById(_0xe83a7,Number(_0x54e6f8));const _0x56c326=await listAllAppRoles(_0xe83a7),_0x3af88f=_0x56c326['filter'](_0x25ada3=>_0x25ada3[_0x3a5838(0xc9)]===_0x54e6f8);if(_0x3af88f[_0x3a5838(0xbd)]===0x0)throw CliErrors['validation'](_0x3a5838(0xab)+_0x54e6f8+_0x3a5838(0xb5)+_0xe83a7+'.',_0x3a5838(0xc4));if(_0x3af88f['length']>0x1){const _0x31bd69=_0x3af88f[_0x3a5838(0x9c)](_0x257eb8=>_0x257eb8['id'])['join'](',\x20');throw CliErrors[_0x3a5838(0x92)](_0x3a5838(0xab)+_0x54e6f8+_0x3a5838(0x97)+_0x31bd69+').',_0x3a5838(0xa2));}return _0x3af88f[0x0];}export async function getRoleById(_0x454e90,_0x4ae9c5){const _0x101593=a170_0x439d91,_0x1691f0=await getAppRole(_0x4ae9c5);if(!_0x1691f0)throw CliErrors['validation']('Role\x20id\x20'+_0x4ae9c5+'\x20not\x20found\x20in\x20app\x20'+_0x454e90+'.',_0x101593(0x90));return _0x1691f0;}async function listAllAppRoles(_0x38be2e){const _0x3662b4=a170_0x439d91,_0x468320=0x64,_0x4b3c9e=[];for(let _0x4df2f0=0x1;;_0x4df2f0+=0x1){const {items:_0x3d69d,paging:_0x903e4b}=await listAppRoles(_0x38be2e,{'currentPage':_0x4df2f0,'pageSize':_0x468320});_0x4b3c9e['push'](..._0x3d69d);if(_0x3d69d[_0x3662b4(0xbd)]<_0x468320||_0x903e4b&&_0x4b3c9e['length']>=_0x903e4b[_0x3662b4(0xaf)])return _0x4b3c9e;}}export async function resolveTenantCode(){const _0x52cfa3=a170_0x439d91,_0x86734b=await getSessionUserInfo(),_0x29adb3=_0x86734b?.[_0x52cfa3(0x8a)]?.[_0x52cfa3(0x99)]?.['tenant_code'];if(!_0x29adb3)throw CliErrors[_0x52cfa3(0xb8)](_0x52cfa3(0x91));return _0x29adb3;}function matchMember(_0x856d77,_0x2a8ad1){const _0x2a8347=a170_0x439d91,_0x207ee1=_0x2a8ad1['trim']()[_0x2a8347(0x93)]();return(_0x856d77['nickname']??'')[_0x2a8347(0x93)]()===_0x207ee1||(_0x856d77[_0x2a8347(0xc0)]??'')[_0x2a8347(0x93)]()===_0x207ee1;}export async function resolveUserRef(_0x4afce1){const _0x41c752=a170_0x439d91,_0x511710=_0x4afce1[_0x41c752(0xc1)]();if(!_0x511710)throw CliErrors[_0x41c752(0x92)]('Missing\x20user\x20reference.',_0x41c752(0x87));const _0x4b5054=await resolveTenantCode(),_0x4cf4d3=await getTenantMembers(_0x4b5054);if(/^\d+$/[_0x41c752(0xb3)](_0x511710)){const _0x53568=Number(_0x511710),_0x1f50a7=_0x4cf4d3[_0x41c752(0x89)](_0x41300e=>_0x41300e[_0x41c752(0xc7)]===_0x53568);return{'userId':_0x53568,'username':_0x1f50a7?.['username']??String(_0x53568),'nickname':_0x1f50a7?.[_0x41c752(0xa0)],'matchedBy':'id'};}const _0x14e374=_0x4cf4d3[_0x41c752(0xb1)](_0x2a0a49=>matchMember(_0x2a0a49,_0x511710));if(_0x14e374['length']===0x0)throw CliErrors[_0x41c752(0x92)](_0x41c752(0x80)+_0x511710+'\x22.',_0x41c752(0xc3));if(_0x14e374['length']>0x1){const _0x2f9ea9=_0x14e374[_0x41c752(0x9c)](_0x287414=>(_0x287414[_0x41c752(0xa0)]??_0x287414['username']??'?')+'('+_0x287414[_0x41c752(0xc7)]+')')[_0x41c752(0xbc)](',\x20');throw CliErrors[_0x41c752(0x92)](_0x41c752(0xae)+_0x511710+_0x41c752(0x7f)+_0x2f9ea9+'.',_0x41c752(0xb2));}const _0x5d12bd=_0x14e374[0x0];return{'userId':_0x5d12bd['userId'],'username':_0x5d12bd['username']??String(_0x5d12bd[_0x41c752(0xc7)]),'nickname':_0x5d12bd[_0x41c752(0xa0)],'matchedBy':'name'};}export const UPDATE_USER_LIST_PATH='/smartapi/permit/user-role/update-user-list';function userIdsOf(_0x2cde3d){const _0x3ba295=a170_0x439d91;return(_0x2cde3d?.[_0x3ba295(0x9f)]??[])[_0x3ba295(0x9c)](_0x241eb9=>_0x241eb9[_0x3ba295(0xc7)]);}export function computeRoleUserMutation(_0x48be64){const _0xe3c4d3=a170_0x439d91,{operation:_0x348f3a,appCode:_0x537ddc,roleUsers:_0x13f497,targetRoleId:_0x4beed0,user:_0x487d5b}=_0x48be64,_0x16c6c2=_0x13f497[_0xe3c4d3(0x89)](_0x456ee1=>_0x456ee1['id']===_0x4beed0);if(!_0x16c6c2)throw CliErrors[_0xe3c4d3(0x92)]('Role\x20id\x20'+_0x4beed0+_0xe3c4d3(0x9a),_0xe3c4d3(0x90));const _0x1ead00=userIdsOf(_0x16c6c2),_0x2549fe=[];if(_0x48be64[_0xe3c4d3(0xc2)]!==undefined&&_0x48be64[_0xe3c4d3(0xc2)]!==_0x1ead00[_0xe3c4d3(0xbd)])throw CliErrors[_0xe3c4d3(0x92)]('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x48be64['expectUserCount']+_0xe3c4d3(0xbb)+_0x1ead00['length']+'.',_0xe3c4d3(0xa5));const _0x59c4f0=_0x1ead00[_0xe3c4d3(0xcb)](_0x487d5b[_0xe3c4d3(0xc7)]);let _0x21b7b5=![];const _0x16453a=[..._0x16c6c2[_0xe3c4d3(0x9f)]];if(_0x348f3a===_0xe3c4d3(0x9d))_0x59c4f0?_0x2549fe[_0xe3c4d3(0x8b)](_0xe3c4d3(0x8c)+_0x487d5b[_0xe3c4d3(0xc7)]+_0xe3c4d3(0xbf)+_0x16c6c2[_0xe3c4d3(0xc9)]+';\x20no\x20change.'):(_0x16453a[_0xe3c4d3(0x8b)]({'userId':_0x487d5b[_0xe3c4d3(0xc7)],'username':_0x487d5b[_0xe3c4d3(0xc0)],..._0x487d5b[_0xe3c4d3(0xa0)]?{'nickname':_0x487d5b['nickname']}:{}}),_0x21b7b5=!![]);else{if(!_0x59c4f0)_0x2549fe['push'](_0xe3c4d3(0x8c)+_0x487d5b['userId']+_0xe3c4d3(0x95)+_0x16c6c2[_0xe3c4d3(0xc9)]+_0xe3c4d3(0x82));else{const _0x24b3d9=_0x16453a[_0xe3c4d3(0xc5)](_0x22392c=>_0x22392c[_0xe3c4d3(0xc7)]===_0x487d5b[_0xe3c4d3(0xc7)]);if(_0x24b3d9>=0x0)_0x16453a['splice'](_0x24b3d9,0x1);_0x21b7b5=!![];}}const _0x2d350b=_0x13f497[_0xe3c4d3(0x9c)](_0x59870f=>_0x59870f['id']===_0x4beed0?{..._0x59870f,'userList':_0x16453a}:_0x59870f),_0x40e95c=_0x16453a['map'](_0x97cd11=>_0x97cd11[_0xe3c4d3(0xc7)]),_0x17cc43={'operation':_0x348f3a,'selector':{'appCode':_0x537ddc,'roleId':_0x4beed0,'roleName':_0x16c6c2['roleName'],'userId':_0x487d5b['userId']},'before':{'userIds':_0x1ead00},'after':{'userIds':_0x40e95c},'dryRun':_0x48be64[_0xe3c4d3(0xb4)],'backend':{'method':_0xe3c4d3(0x8e),'path':UPDATE_USER_LIST_PATH},'warnings':_0x2549fe};return{'roleList':_0x2d350b,'mutation':_0x17cc43,'changed':_0x21b7b5};}export async function loadRoleUsers(_0x2034c4){return listRoleUsers(_0x2034c4);}export function readRoleRef(_0xc54df2){const _0xe7d514=a170_0x439d91,_0x1f556e=_0xc54df2['str']('role')['trim']();if(!_0x1f556e)throw CliErrors[_0xe7d514(0xca)](_0xe7d514(0xa9),_0xe7d514(0xa1));return _0x1f556e;}export async function prepareUserMutation(_0x58250b,_0x5357f8,_0xeb683f){const _0x105293=a170_0x439d91,_0x265cd5=readRoleRef(_0x58250b),_0x226a15=_0x58250b[_0x105293(0x9b)]('user')[_0x105293(0xc1)]();if(!_0x226a15)throw CliErrors[_0x105293(0xca)](_0x105293(0x8a),_0x105293(0x87));const _0x36145d=_0x58250b[_0x105293(0xc8)](_0x105293(0xb6)),_0x2ab853=_0x36145d===undefined||_0x36145d===null?undefined:Number(_0x36145d),_0x5c25aa=await resolveRoleRef(_0x58250b[_0x105293(0x86)],_0x265cd5),_0x2be00e=await resolveUserRef(_0x226a15),_0x2edb31=await loadRoleUsers(_0x58250b[_0x105293(0x86)]);return computeRoleUserMutation({'operation':_0x5357f8,'appCode':_0x58250b[_0x105293(0x86)],'roleUsers':_0x2edb31,'targetRoleId':_0x5c25aa['id'],'user':{'userId':_0x2be00e['userId'],'username':_0x2be00e['username'],'nickname':_0x2be00e[_0x105293(0xa0)]},'dryRun':_0xeb683f,..._0x2ab853!==undefined?{'expectUserCount':_0x2ab853}:{}});}
1
+ const a169_0xbbf31b=a169_0x344b;(function(_0x424c6c,_0x23e708){const _0xf61bff=a169_0x344b,_0x251d70=_0x424c6c();while(!![]){try{const _0x355717=-parseInt(_0xf61bff(0x21b))/0x1*(parseInt(_0xf61bff(0x1e8))/0x2)+parseInt(_0xf61bff(0x1d0))/0x3*(-parseInt(_0xf61bff(0x1d4))/0x4)+-parseInt(_0xf61bff(0x1e4))/0x5*(-parseInt(_0xf61bff(0x1cd))/0x6)+-parseInt(_0xf61bff(0x1f7))/0x7*(parseInt(_0xf61bff(0x216))/0x8)+-parseInt(_0xf61bff(0x1f5))/0x9*(-parseInt(_0xf61bff(0x1fc))/0xa)+-parseInt(_0xf61bff(0x204))/0xb*(parseInt(_0xf61bff(0x206))/0xc)+-parseInt(_0xf61bff(0x1f8))/0xd*(-parseInt(_0xf61bff(0x1e6))/0xe);if(_0x355717===_0x23e708)break;else _0x251d70['push'](_0x251d70['shift']());}catch(_0x4ffecb){_0x251d70['push'](_0x251d70['shift']());}}}(a169_0x429e,0x28962));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a169_0xbbf31b(0x202),'required':!![],'description':a169_0xbbf31b(0x1d5)};export const ROLE_REF_FLAG={'name':a169_0xbbf31b(0x1ef),'type':a169_0xbbf31b(0x1f6),'required':!![],'description':a169_0xbbf31b(0x20c)};export const USER_REF_FLAG={'name':a169_0xbbf31b(0x1eb),'type':a169_0xbbf31b(0x1f6),'required':!![],'description':a169_0xbbf31b(0x1ee)};export const NAME_FLAG={'name':'name','type':a169_0xbbf31b(0x1f6),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':a169_0xbbf31b(0x1f3),'type':a169_0xbbf31b(0x1f6),'required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':'remark','type':a169_0xbbf31b(0x1f6),'required':![],'description':a169_0xbbf31b(0x207)};function a169_0x344b(_0x5957ed,_0x514316){_0x5957ed=_0x5957ed-0x1cd;const _0x429e03=a169_0x429e();let _0x344b0d=_0x429e03[_0x5957ed];return _0x344b0d;}export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a169_0xbbf31b(0x202),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=['ADMIN',a169_0xbbf31b(0x1fe),a169_0xbbf31b(0x217)];export function isBuiltinRole(_0x4c5c0e){const _0x22af3c=a169_0xbbf31b;return BUILTIN_ROLE_TYPES[_0x22af3c(0x20b)](_0x4c5c0e);}export function assertCustomRole(_0xaa7b04,_0x31f85b){const _0x2ea863=a169_0xbbf31b;if(_0xaa7b04[_0x2ea863(0x219)]!==_0x2ea863(0x21a))throw CliErrors[_0x2ea863(0x1f2)]('Cannot\x20'+_0x31f85b+_0x2ea863(0x1dd)+_0xaa7b04[_0x2ea863(0x1d7)]+'\x20('+_0xaa7b04[_0x2ea863(0x219)]+').',_0x2ea863(0x20a));}export function assertPermConfigurable(_0x3e0df6){const _0x4784fe=a169_0xbbf31b;if(_0x3e0df6['roleType']===_0x4784fe(0x1fe)||_0x3e0df6['roleType']==='ADMIN')throw CliErrors[_0x4784fe(0x1f2)](_0x4784fe(0x208)+_0x3e0df6[_0x4784fe(0x1d7)]+'\x20('+_0x3e0df6[_0x4784fe(0x219)]+').',_0x4784fe(0x1f4));}export function projectRole(_0x214200){const _0x2adf15=a169_0xbbf31b;return{'id':_0x214200['id'],'roleName':_0x214200[_0x2adf15(0x1d7)],'roleType':_0x214200[_0x2adf15(0x219)],'remark':_0x214200['remark'],'userCount':_0x214200[_0x2adf15(0x1d9)],'permitCount':_0x214200[_0x2adf15(0x1e3)],'builtin':isBuiltinRole(_0x214200[_0x2adf15(0x219)])};}export async function resolveRoleRef(_0x346ac6,_0x4071ef){const _0x6f2534=a169_0xbbf31b,_0x1a0c8a=_0x4071ef[_0x6f2534(0x211)]();if(!_0x1a0c8a)throw CliErrors['validation'](_0x6f2534(0x1de),_0x6f2534(0x1d8));if(/^\d+$/[_0x6f2534(0x1e0)](_0x1a0c8a))return getRoleById(_0x346ac6,Number(_0x1a0c8a));const _0x3f4feb=await listAllAppRoles(_0x346ac6),_0x11a3ab=_0x3f4feb[_0x6f2534(0x1db)](_0x4a7b99=>_0x4a7b99[_0x6f2534(0x1d7)]===_0x1a0c8a);if(_0x11a3ab[_0x6f2534(0x1ff)]===0x0)throw CliErrors[_0x6f2534(0x1f2)]('Role\x20name\x20\x22'+_0x1a0c8a+_0x6f2534(0x1cf)+_0x346ac6+'.',_0x6f2534(0x200));if(_0x11a3ab[_0x6f2534(0x1ff)]>0x1){const _0x48b43a=_0x11a3ab[_0x6f2534(0x1e7)](_0x55a154=>_0x55a154['id'])[_0x6f2534(0x1f0)](',\x20');throw CliErrors[_0x6f2534(0x1f2)]('Role\x20name\x20\x22'+_0x1a0c8a+_0x6f2534(0x1dc)+_0x48b43a+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x11a3ab[0x0];}export async function getRoleById(_0x9349fe,_0xbc89ff){const _0x425e1f=a169_0xbbf31b,_0x3d4df7=await getAppRole(_0xbc89ff);if(!_0x3d4df7)throw CliErrors[_0x425e1f(0x1f2)](_0x425e1f(0x1f9)+_0xbc89ff+'\x20not\x20found\x20in\x20app\x20'+_0x9349fe+'.',_0x425e1f(0x20e));return _0x3d4df7;}async function listAllAppRoles(_0x471364){const _0x308bde=a169_0xbbf31b,_0x56882a=0x64,_0x2f386=[];for(let _0x4483e4=0x1;;_0x4483e4+=0x1){const {items:_0x3ffcba,paging:_0x552af8}=await listAppRoles(_0x471364,{'currentPage':_0x4483e4,'pageSize':_0x56882a});_0x2f386[_0x308bde(0x1d6)](..._0x3ffcba);if(_0x3ffcba[_0x308bde(0x1ff)]<_0x56882a||_0x552af8&&_0x2f386[_0x308bde(0x1ff)]>=_0x552af8[_0x308bde(0x203)])return _0x2f386;}}export async function resolveTenantCode(){const _0x330d4f=a169_0xbbf31b,_0x18865e=await getSessionUserInfo(),_0x403e2e=_0x18865e?.['user']?.['tenant']?.[_0x330d4f(0x1d2)];if(!_0x403e2e)throw CliErrors[_0x330d4f(0x1e1)](_0x330d4f(0x1f1));return _0x403e2e;}function matchMember(_0xfd0193,_0x1b0400){const _0x3c5fff=a169_0xbbf31b,_0x2369bc=_0x1b0400[_0x3c5fff(0x211)]()[_0x3c5fff(0x20d)]();return(_0xfd0193[_0x3c5fff(0x213)]??'')['toLowerCase']()===_0x2369bc||(_0xfd0193[_0x3c5fff(0x210)]??'')['toLowerCase']()===_0x2369bc;}export async function resolveUserRef(_0x737e0f){const _0x49430a=a169_0xbbf31b,_0x5bbde4=_0x737e0f[_0x49430a(0x211)]();if(!_0x5bbde4)throw CliErrors[_0x49430a(0x1f2)]('Missing\x20user\x20reference.',_0x49430a(0x1e2));const _0x1a8049=await resolveTenantCode(),_0x2879d2=await getTenantMembers(_0x1a8049);if(/^\d+$/[_0x49430a(0x1e0)](_0x5bbde4)){const _0x48213e=Number(_0x5bbde4),_0x17bd5f=_0x2879d2[_0x49430a(0x1d1)](_0x19b03e=>_0x19b03e[_0x49430a(0x1d3)]===_0x48213e);return{'userId':_0x48213e,'username':_0x17bd5f?.[_0x49430a(0x210)]??String(_0x48213e),'nickname':_0x17bd5f?.[_0x49430a(0x213)],'matchedBy':'id'};}const _0x4fa57f=_0x2879d2['filter'](_0x7030f7=>matchMember(_0x7030f7,_0x5bbde4));if(_0x4fa57f['length']===0x0)throw CliErrors[_0x49430a(0x1f2)]('No\x20tenant\x20member\x20matches\x20\x22'+_0x5bbde4+'\x22.',_0x49430a(0x214));if(_0x4fa57f[_0x49430a(0x1ff)]>0x1){const _0x2c0073=_0x4fa57f[_0x49430a(0x1e7)](_0x4bac24=>(_0x4bac24['nickname']??_0x4bac24['username']??'?')+'('+_0x4bac24['userId']+')')[_0x49430a(0x1f0)](',\x20');throw CliErrors['validation']('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x5bbde4+_0x49430a(0x1da)+_0x2c0073+'.','Disambiguate\x20with\x20--user\x20<id>.');}const _0x41aa50=_0x4fa57f[0x0];return{'userId':_0x41aa50[_0x49430a(0x1d3)],'username':_0x41aa50['username']??String(_0x41aa50[_0x49430a(0x1d3)]),'nickname':_0x41aa50[_0x49430a(0x213)],'matchedBy':'name'};}export const UPDATE_USER_LIST_PATH=a169_0xbbf31b(0x1e9);function userIdsOf(_0x18bdd0){const _0x3d20c5=a169_0xbbf31b;return(_0x18bdd0?.[_0x3d20c5(0x1fb)]??[])['map'](_0x17b0b1=>_0x17b0b1[_0x3d20c5(0x1d3)]);}export function computeRoleUserMutation(_0x3e46da){const _0x1dd247=a169_0xbbf31b,{operation:_0x5b3c8d,appCode:_0xfdf295,roleUsers:_0x497a04,targetRoleId:_0x171c96,user:_0x295e6e}=_0x3e46da,_0x352664=_0x497a04[_0x1dd247(0x1d1)](_0x17639f=>_0x17639f['id']===_0x171c96);if(!_0x352664)throw CliErrors['validation'](_0x1dd247(0x1f9)+_0x171c96+_0x1dd247(0x201),_0x1dd247(0x20e));const _0x3b2508=userIdsOf(_0x352664),_0x5c1574=[];if(_0x3e46da[_0x1dd247(0x1ea)]!==undefined&&_0x3e46da['expectUserCount']!==_0x3b2508[_0x1dd247(0x1ff)])throw CliErrors[_0x1dd247(0x1f2)]('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x3e46da[_0x1dd247(0x1ea)]+_0x1dd247(0x209)+_0x3b2508[_0x1dd247(0x1ff)]+'.',_0x1dd247(0x1fa));const _0x387a91=_0x3b2508['includes'](_0x295e6e['userId']);let _0x1302f8=![];const _0x4267ca=[..._0x352664[_0x1dd247(0x1fb)]];if(_0x5b3c8d===_0x1dd247(0x1fd))_0x387a91?_0x5c1574[_0x1dd247(0x1d6)](_0x1dd247(0x1ce)+_0x295e6e[_0x1dd247(0x1d3)]+_0x1dd247(0x218)+_0x352664[_0x1dd247(0x1d7)]+';\x20no\x20change.'):(_0x4267ca[_0x1dd247(0x1d6)]({'userId':_0x295e6e[_0x1dd247(0x1d3)],'username':_0x295e6e[_0x1dd247(0x210)],..._0x295e6e[_0x1dd247(0x213)]?{'nickname':_0x295e6e[_0x1dd247(0x213)]}:{}}),_0x1302f8=!![]);else{if(!_0x387a91)_0x5c1574['push'](_0x1dd247(0x1ce)+_0x295e6e['userId']+_0x1dd247(0x1df)+_0x352664[_0x1dd247(0x1d7)]+_0x1dd247(0x1ed));else{const _0x529035=_0x4267ca[_0x1dd247(0x215)](_0x417497=>_0x417497[_0x1dd247(0x1d3)]===_0x295e6e['userId']);if(_0x529035>=0x0)_0x4267ca['splice'](_0x529035,0x1);_0x1302f8=!![];}}const _0x2d79ae=_0x497a04['map'](_0x4deafe=>_0x4deafe['id']===_0x171c96?{..._0x4deafe,'userList':_0x4267ca}:_0x4deafe),_0xf69efa=_0x4267ca[_0x1dd247(0x1e7)](_0x3695a5=>_0x3695a5['userId']),_0x334ca4={'operation':_0x5b3c8d,'selector':{'appCode':_0xfdf295,'roleId':_0x171c96,'roleName':_0x352664[_0x1dd247(0x1d7)],'userId':_0x295e6e[_0x1dd247(0x1d3)]},'before':{'userIds':_0x3b2508},'after':{'userIds':_0xf69efa},'dryRun':_0x3e46da[_0x1dd247(0x1ec)],'backend':{'method':_0x1dd247(0x1e5),'path':UPDATE_USER_LIST_PATH},'warnings':_0x5c1574};return{'roleList':_0x2d79ae,'mutation':_0x334ca4,'changed':_0x1302f8};}export async function loadRoleUsers(_0x2ed8c2){return listRoleUsers(_0x2ed8c2);}function a169_0x429e(){const _0x1423c3=['\x20member(s)\x20but\x20role\x20has\x20','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','includes','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','toLowerCase','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','str','username','trim','flagMissing','nickname','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','findIndex','8HolDEL','USER','\x20is\x20already\x20a\x20member\x20of\x20role\x20','roleType','CUSTOM','23590uAQLEd','6UIdANQ','User\x20','\x22\x20not\x20found\x20in\x20app\x20','196161SoPuUG','find','tenant_code','userId','4ANhnWO','Role\x20id\x20(from\x20`role\x20list`)','push','roleName','Pass\x20--role\x20<id|name>.','userCount','\x22:\x20','filter','\x22\x20is\x20ambiguous\x20(ids:\x20','\x20built-in\x20role\x20','Missing\x20role\x20reference.','\x20is\x20not\x20a\x20member\x20of\x20role\x20','test','authRequired','Pass\x20--user\x20<id|name>.','permitCount','1407245UgangT','POST','14GLvqBB','map','6WDbLUS','/smartapi/permit/user-role/update-user-list','expectUserCount','user','dryRun',';\x20no\x20change.','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','role','join','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','validation','name','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','890469AOYfJI','string','1869007MzgywF','4584047kMAiuf','Role\x20id\x20','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','userList','10qcbYcJ','user-add','DEV','length','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','\x20not\x20found\x20in\x20the\x20user-role\x20list.','number','totalCount','22781TBVvXb','appCode','948scTshJ','Optional\x20role\x20remark/description','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20'];a169_0x429e=function(){return _0x1423c3;};return a169_0x429e();}export function readRoleRef(_0x5523f5){const _0x18fb1f=a169_0xbbf31b,_0x5340fc=_0x5523f5[_0x18fb1f(0x20f)](_0x18fb1f(0x1ef))[_0x18fb1f(0x211)]();if(!_0x5340fc)throw CliErrors[_0x18fb1f(0x212)](_0x18fb1f(0x1ef),_0x18fb1f(0x1d8));return _0x5340fc;}export async function prepareUserMutation(_0x525241,_0x1046cf,_0x2a334f){const _0x2bef7e=a169_0xbbf31b,_0x17f71a=readRoleRef(_0x525241),_0xa26c4d=_0x525241[_0x2bef7e(0x20f)]('user')[_0x2bef7e(0x211)]();if(!_0xa26c4d)throw CliErrors[_0x2bef7e(0x212)]('user','Pass\x20--user\x20<id|name>.');const _0x352c54=_0x525241['flag']('expect-user-count'),_0x2fe719=_0x352c54===undefined||_0x352c54===null?undefined:Number(_0x352c54),_0x1ad119=await resolveRoleRef(_0x525241[_0x2bef7e(0x205)],_0x17f71a),_0x5e22ac=await resolveUserRef(_0xa26c4d),_0x6a02e9=await loadRoleUsers(_0x525241[_0x2bef7e(0x205)]);return computeRoleUserMutation({'operation':_0x1046cf,'appCode':_0x525241[_0x2bef7e(0x205)],'roleUsers':_0x6a02e9,'targetRoleId':_0x1ad119['id'],'user':{'userId':_0x5e22ac[_0x2bef7e(0x1d3)],'username':_0x5e22ac[_0x2bef7e(0x210)],'nickname':_0x5e22ac[_0x2bef7e(0x213)]},'dryRun':_0x2a334f,..._0x2fe719!==undefined?{'expectUserCount':_0x2fe719}:{}});}
@@ -1 +1 @@
1
- const a171_0x31d22f=a171_0x309b;(function(_0x4766e8,_0x202a20){const _0x4053c9=a171_0x309b,_0x1a4f65=_0x4766e8();while(!![]){try{const _0x4d4980=-parseInt(_0x4053c9(0x135))/0x1+-parseInt(_0x4053c9(0x140))/0x2+-parseInt(_0x4053c9(0x13d))/0x3+parseInt(_0x4053c9(0x142))/0x4+-parseInt(_0x4053c9(0x130))/0x5+-parseInt(_0x4053c9(0x138))/0x6+-parseInt(_0x4053c9(0x132))/0x7*(-parseInt(_0x4053c9(0x12d))/0x8);if(_0x4d4980===_0x202a20)break;else _0x1a4f65['push'](_0x1a4f65['shift']());}catch(_0x16faae){_0x1a4f65['push'](_0x1a4f65['shift']());}}}(a171_0x1788,0x2c4ed));function a171_0x1788(){const _0xaf53fb=['role','1380876Qaslwv','name','trim','Nothing\x20to\x20update.','appCode','823104ijQCNb','roleName','validation','26070jAazrK','length','1113484ULdVDC','flag','/smartapi/permit/role/update','update','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','POST','\x20(id=','8lKBrdD','remark','num','1182810znwwRw','write','5697412qGWkQD','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','156691araOSm','--name\x20cannot\x20be\x20empty.'];a171_0x1788=function(){return _0xaf53fb;};return a171_0x1788();}import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a171_0x309b(_0x52d6e5,_0x326563){_0x52d6e5=_0x52d6e5-0x129;const _0x1788d9=a171_0x1788();let _0x309bb6=_0x1788d9[_0x52d6e5];return _0x309bb6;}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=a171_0x31d22f(0x144);function readPatch(_0x2fd6a1){const _0x216e8e=a171_0x31d22f,_0x123ccd=_0x2fd6a1[_0x216e8e(0x143)](_0x216e8e(0x139)),_0x8d7c7f=_0x2fd6a1['flag'](_0x216e8e(0x12e)),_0x378af2={};if(_0x123ccd!==undefined&&_0x123ccd!==null){const _0x52fa22=String(_0x123ccd)[_0x216e8e(0x13a)]();if(!_0x52fa22)throw CliErrors[_0x216e8e(0x13f)](_0x216e8e(0x136));if(_0x52fa22[_0x216e8e(0x141)]>0x40)throw CliErrors['validation'](_0x216e8e(0x134));_0x378af2[_0x216e8e(0x13e)]=_0x52fa22;}_0x8d7c7f!==undefined&&_0x8d7c7f!==null&&(_0x378af2[_0x216e8e(0x12e)]=String(_0x8d7c7f));if(_0x378af2[_0x216e8e(0x13e)]===undefined&&_0x378af2[_0x216e8e(0x12e)]===undefined)throw CliErrors['validation'](_0x216e8e(0x13b),_0x216e8e(0x12a));return _0x378af2;}export const roleUpdate={'service':a171_0x31d22f(0x137),'command':a171_0x31d22f(0x129),'description':a171_0x31d22f(0x133),'risk':a171_0x31d22f(0x131),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a171_0x31d22f(0x139),'type':'string','required':![],'description':'New\x20role\x20name'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1245e9){readPatch(_0x1245e9);},async 'dryRun'(_0x513baa){const _0x5840fa=a171_0x31d22f,_0xb7953b=_0x513baa[_0x5840fa(0x12f)]('id'),_0x2e01cb=readPatch(_0x513baa),_0x3bf4c=await getRoleById(_0x513baa[_0x5840fa(0x13c)],_0xb7953b);return assertCustomRole(_0x3bf4c,_0x5840fa(0x129)),asDryRunResult({'operation':_0x5840fa(0x129),'selector':{'appCode':_0x513baa[_0x5840fa(0x13c)],'roleId':_0xb7953b,'roleName':_0x3bf4c[_0x5840fa(0x13e)]},'before':projectRole(_0x3bf4c),'after':projectRole({..._0x3bf4c,..._0x2e01cb[_0x5840fa(0x13e)]!==undefined?{'roleName':_0x2e01cb['roleName']}:{},..._0x2e01cb[_0x5840fa(0x12e)]!==undefined?{'remark':_0x2e01cb[_0x5840fa(0x12e)]}:{}}),'dryRun':!![],'backend':{'method':_0x5840fa(0x12b),'path':UPDATE_PATH},'warnings':[]},{'method':_0x5840fa(0x12b),'url':UPDATE_PATH});},async 'execute'(_0x23133f){const _0xc9663a=a171_0x31d22f,_0x39f86c=_0x23133f['num']('id'),_0x445a9b=readPatch(_0x23133f),_0x7aca94=await getRoleById(_0x23133f[_0xc9663a(0x13c)],_0x39f86c);assertCustomRole(_0x7aca94,_0xc9663a(0x129)),await updateAppRole({'id':_0x39f86c,'appCode':_0x23133f[_0xc9663a(0x13c)],..._0x445a9b[_0xc9663a(0x13e)]!==undefined?{'roleName':_0x445a9b[_0xc9663a(0x13e)]}:{},..._0x445a9b[_0xc9663a(0x12e)]!==undefined?{'remark':_0x445a9b['remark']}:{}});const _0x107ede=await getRoleById(_0x23133f[_0xc9663a(0x13c)],_0x39f86c);return{'ok':!![],'data':{'operation':_0xc9663a(0x129),'selector':{'appCode':_0x23133f[_0xc9663a(0x13c)],'roleId':_0x39f86c,'roleName':_0x107ede['roleName']},'before':projectRole(_0x7aca94),'after':projectRole(_0x107ede),'dryRun':![],'backend':{'method':_0xc9663a(0x12b),'path':UPDATE_PATH},'warnings':[]},'message':'Updated\x20role\x20'+_0x107ede['roleName']+_0xc9663a(0x12c)+_0x39f86c+')'};}};
1
+ const a170_0x534149=a170_0x9f4b;function a170_0x9f4b(_0x380c91,_0xabb20){_0x380c91=_0x380c91-0xcb;const _0x473207=a170_0x4732();let _0x9f4b56=_0x473207[_0x380c91];return _0x9f4b56;}(function(_0x2f4547,_0x3bb337){const _0x145854=a170_0x9f4b,_0x2b246b=_0x2f4547();while(!![]){try{const _0x261da1=-parseInt(_0x145854(0xde))/0x1*(-parseInt(_0x145854(0xd6))/0x2)+-parseInt(_0x145854(0xe9))/0x3*(parseInt(_0x145854(0xe7))/0x4)+parseInt(_0x145854(0xea))/0x5*(-parseInt(_0x145854(0xd8))/0x6)+-parseInt(_0x145854(0xce))/0x7+parseInt(_0x145854(0xe5))/0x8+parseInt(_0x145854(0xd5))/0x9*(-parseInt(_0x145854(0xcb))/0xa)+parseInt(_0x145854(0xd0))/0xb*(parseInt(_0x145854(0xe6))/0xc);if(_0x261da1===_0x3bb337)break;else _0x2b246b['push'](_0x2b246b['shift']());}catch(_0x2131d1){_0x2b246b['push'](_0x2b246b['shift']());}}}(a170_0x4732,0x6c1e2));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='/smartapi/permit/role/update';function readPatch(_0x51d408){const _0x1250dd=a170_0x9f4b,_0x2e1595=_0x51d408[_0x1250dd(0xd7)](_0x1250dd(0xd1)),_0x275b1f=_0x51d408[_0x1250dd(0xd7)](_0x1250dd(0xe1)),_0xe1f435={};if(_0x2e1595!==undefined&&_0x2e1595!==null){const _0x4fc593=String(_0x2e1595)[_0x1250dd(0xd4)]();if(!_0x4fc593)throw CliErrors[_0x1250dd(0xdd)](_0x1250dd(0xd2));if(_0x4fc593[_0x1250dd(0xdb)]>0x40)throw CliErrors[_0x1250dd(0xdd)]('Role\x20name\x20cannot\x20exceed\x2064\x20characters.');_0xe1f435[_0x1250dd(0xdc)]=_0x4fc593;}_0x275b1f!==undefined&&_0x275b1f!==null&&(_0xe1f435[_0x1250dd(0xe1)]=String(_0x275b1f));if(_0xe1f435[_0x1250dd(0xdc)]===undefined&&_0xe1f435[_0x1250dd(0xe1)]===undefined)throw CliErrors[_0x1250dd(0xdd)](_0x1250dd(0xe3),_0x1250dd(0xe2));return _0xe1f435;}export const roleUpdate={'service':a170_0x534149(0xd3),'command':a170_0x534149(0xd9),'description':a170_0x534149(0xcf),'risk':a170_0x534149(0xcc),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':'name','type':a170_0x534149(0xe8),'required':![],'description':a170_0x534149(0xdf)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x4e55b1){readPatch(_0x4e55b1);},async 'dryRun'(_0x50ef41){const _0x32cfa6=a170_0x534149,_0x2b3718=_0x50ef41[_0x32cfa6(0xe0)]('id'),_0x16e3ab=readPatch(_0x50ef41),_0x2b1ecb=await getRoleById(_0x50ef41[_0x32cfa6(0xcd)],_0x2b3718);return assertCustomRole(_0x2b1ecb,_0x32cfa6(0xd9)),asDryRunResult({'operation':_0x32cfa6(0xd9),'selector':{'appCode':_0x50ef41[_0x32cfa6(0xcd)],'roleId':_0x2b3718,'roleName':_0x2b1ecb[_0x32cfa6(0xdc)]},'before':projectRole(_0x2b1ecb),'after':projectRole({..._0x2b1ecb,..._0x16e3ab[_0x32cfa6(0xdc)]!==undefined?{'roleName':_0x16e3ab['roleName']}:{},..._0x16e3ab[_0x32cfa6(0xe1)]!==undefined?{'remark':_0x16e3ab[_0x32cfa6(0xe1)]}:{}}),'dryRun':!![],'backend':{'method':_0x32cfa6(0xda),'path':UPDATE_PATH},'warnings':[]},{'method':_0x32cfa6(0xda),'url':UPDATE_PATH});},async 'execute'(_0x4df792){const _0x482c8f=a170_0x534149,_0x104807=_0x4df792[_0x482c8f(0xe0)]('id'),_0x5526b1=readPatch(_0x4df792),_0xb10b2=await getRoleById(_0x4df792[_0x482c8f(0xcd)],_0x104807);assertCustomRole(_0xb10b2,_0x482c8f(0xd9)),await updateAppRole({'id':_0x104807,'appCode':_0x4df792[_0x482c8f(0xcd)],..._0x5526b1[_0x482c8f(0xdc)]!==undefined?{'roleName':_0x5526b1[_0x482c8f(0xdc)]}:{},..._0x5526b1['remark']!==undefined?{'remark':_0x5526b1[_0x482c8f(0xe1)]}:{}});const _0x41a27a=await getRoleById(_0x4df792[_0x482c8f(0xcd)],_0x104807);return{'ok':!![],'data':{'operation':_0x482c8f(0xd9),'selector':{'appCode':_0x4df792[_0x482c8f(0xcd)],'roleId':_0x104807,'roleName':_0x41a27a[_0x482c8f(0xdc)]},'before':projectRole(_0xb10b2),'after':projectRole(_0x41a27a),'dryRun':![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},'message':'Updated\x20role\x20'+_0x41a27a['roleName']+_0x482c8f(0xe4)+_0x104807+')'};}};function a170_0x4732(){const _0x7b04fb=['852eyTZba','5ssCjIQ','560zNWLWu','write','appCode','2131185jBmtNc','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','1452uLudol','name','--name\x20cannot\x20be\x20empty.','role','trim','119313MmNEef','205586BPWrDc','flag','1853334eUDnkL','update','POST','length','roleName','validation','3oUeTlU','New\x20role\x20name','num','remark','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','Nothing\x20to\x20update.','\x20(id=','4726808jrUWkW','97896XqLIct','2500KocAKl','string'];a170_0x4732=function(){return _0x7b04fb;};return a170_0x4732();}
@@ -1 +1 @@
1
- const a172_0x4474ac=a172_0x3a01;function a172_0x3a01(_0x2ecac8,_0x1ddafb){_0x2ecac8=_0x2ecac8-0x1bc;const _0x5763f2=a172_0x5763();let _0x3a012c=_0x5763f2[_0x2ecac8];return _0x3a012c;}(function(_0x3c7726,_0x54b6ba){const _0x5b1330=a172_0x3a01,_0x3e5972=_0x3c7726();while(!![]){try{const _0x51dc3b=-parseInt(_0x5b1330(0x1c0))/0x1*(parseInt(_0x5b1330(0x1c1))/0x2)+-parseInt(_0x5b1330(0x1bc))/0x3*(parseInt(_0x5b1330(0x1d0))/0x4)+parseInt(_0x5b1330(0x1cc))/0x5+parseInt(_0x5b1330(0x1ca))/0x6*(-parseInt(_0x5b1330(0x1c9))/0x7)+-parseInt(_0x5b1330(0x1c5))/0x8*(-parseInt(_0x5b1330(0x1cd))/0x9)+-parseInt(_0x5b1330(0x1d3))/0xa*(parseInt(_0x5b1330(0x1ce))/0xb)+parseInt(_0x5b1330(0x1c3))/0xc;if(_0x51dc3b===_0x54b6ba)break;else _0x3e5972['push'](_0x3e5972['shift']());}catch(_0x39fb4e){_0x3e5972['push'](_0x3e5972['shift']());}}}(a172_0x5763,0x359e8));import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a172_0x5763(){const _0x3d49bc=['role','Added\x20user\x20','454rcKNEV','26Wdfqqo','user-add','5604108ahUCNy','Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','504wvMZaA','selector','roleName','\x20already\x20in\x20role\x20','56BDERHw','324786SscJHC','appCode','827060vtqELU','44910WcibdV','110Hyucpf','\x20to\x20role\x20','4NaDYoR','userId','high-risk-write','203570UpHkxU','253941FPUPVe','POST'];a172_0x5763=function(){return _0x3d49bc;};return a172_0x5763();}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';export const roleUserAdd={'service':a172_0x4474ac(0x1be),'command':a172_0x4474ac(0x1c2),'description':a172_0x4474ac(0x1c4),'risk':a172_0x4474ac(0x1d2),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x2ac4dc){const _0x24480a=a172_0x4474ac,{mutation:_0x4c3a33}=await prepareUserMutation(_0x2ac4dc,_0x24480a(0x1c2),!![]);return asDryRunResult(_0x4c3a33,{'method':_0x24480a(0x1bd),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x2a4471){const _0x565359=a172_0x4474ac,{roleList:_0x1bb192,mutation:_0x185c5e,changed:_0x34cab7}=await prepareUserMutation(_0x2a4471,_0x565359(0x1c2),![]);return _0x34cab7&&await updateRoleUsers(_0x2a4471[_0x565359(0x1cb)],_0x1bb192),{'ok':!![],'data':_0x185c5e,'message':_0x34cab7?_0x565359(0x1bf)+_0x185c5e[_0x565359(0x1c6)][_0x565359(0x1d1)]+_0x565359(0x1cf)+_0x185c5e[_0x565359(0x1c6)][_0x565359(0x1c7)]:'No\x20change:\x20user\x20'+_0x185c5e['selector']['userId']+_0x565359(0x1c8)+_0x185c5e['selector'][_0x565359(0x1c7)]};}};
1
+ const a171_0x305dea=a171_0xe20b;function a171_0xe20b(_0x3fd3d6,_0x103661){_0x3fd3d6=_0x3fd3d6-0xc8;const _0x501b0d=a171_0x501b();let _0xe20b6f=_0x501b0d[_0x3fd3d6];return _0xe20b6f;}(function(_0x39e57d,_0x483788){const _0x5111a9=a171_0xe20b,_0x21d886=_0x39e57d();while(!![]){try{const _0x2855f4=-parseInt(_0x5111a9(0xd5))/0x1*(-parseInt(_0x5111a9(0xce))/0x2)+parseInt(_0x5111a9(0xd4))/0x3*(-parseInt(_0x5111a9(0xcc))/0x4)+-parseInt(_0x5111a9(0xd1))/0x5*(parseInt(_0x5111a9(0xc8))/0x6)+-parseInt(_0x5111a9(0xda))/0x7*(parseInt(_0x5111a9(0xcb))/0x8)+parseInt(_0x5111a9(0xd9))/0x9+-parseInt(_0x5111a9(0xca))/0xa*(-parseInt(_0x5111a9(0xdd))/0xb)+parseInt(_0x5111a9(0xdb))/0xc;if(_0x2855f4===_0x483788)break;else _0x21d886['push'](_0x21d886['shift']());}catch(_0x557b4a){_0x21d886['push'](_0x21d886['shift']());}}}(a171_0x501b,0xdd112));function a171_0x501b(){const _0xda3991=['high-risk-write','role','6JaZUki','POST','1072310ukBJtk','8040OFkaWZ','7181764DksuPJ','\x20to\x20role\x20','536802QvysHA','user-add','appCode','4508675uOPLDt','Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','roleName','3yUoFAZ','1oVcPLC','userId','selector','Added\x20user\x20','6632415RPyNpR','5089zNYysI','29641404uPlHYi','\x20already\x20in\x20role\x20','88sXjuqZ'];a171_0x501b=function(){return _0xda3991;};return a171_0x501b();}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';export const roleUserAdd={'service':a171_0x305dea(0xdf),'command':a171_0x305dea(0xcf),'description':a171_0x305dea(0xd2),'risk':a171_0x305dea(0xde),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x3606a3){const _0x7f7ceb=a171_0x305dea,{mutation:_0x3a97b7}=await prepareUserMutation(_0x3606a3,'user-add',!![]);return asDryRunResult(_0x3a97b7,{'method':_0x7f7ceb(0xc9),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x16d160){const _0x381210=a171_0x305dea,{roleList:_0x298dc0,mutation:_0x272d16,changed:_0x32b493}=await prepareUserMutation(_0x16d160,_0x381210(0xcf),![]);return _0x32b493&&await updateRoleUsers(_0x16d160[_0x381210(0xd0)],_0x298dc0),{'ok':!![],'data':_0x272d16,'message':_0x32b493?_0x381210(0xd8)+_0x272d16[_0x381210(0xd7)]['userId']+_0x381210(0xcd)+_0x272d16[_0x381210(0xd7)][_0x381210(0xd3)]:'No\x20change:\x20user\x20'+_0x272d16[_0x381210(0xd7)][_0x381210(0xd6)]+_0x381210(0xdc)+_0x272d16[_0x381210(0xd7)][_0x381210(0xd3)]};}};
@@ -1 +1 @@
1
- const a173_0x265a71=a173_0x2cab;(function(_0x4e6131,_0x2c02e1){const _0x27c8cc=a173_0x2cab,_0x195b01=_0x4e6131();while(!![]){try{const _0x35af79=parseInt(_0x27c8cc(0x1e4))/0x1+-parseInt(_0x27c8cc(0x1e1))/0x2*(-parseInt(_0x27c8cc(0x1e0))/0x3)+parseInt(_0x27c8cc(0x1d9))/0x4*(-parseInt(_0x27c8cc(0x1d5))/0x5)+parseInt(_0x27c8cc(0x1e2))/0x6*(parseInt(_0x27c8cc(0x1da))/0x7)+-parseInt(_0x27c8cc(0x1dd))/0x8*(parseInt(_0x27c8cc(0x1e3))/0x9)+-parseInt(_0x27c8cc(0x1e5))/0xa+parseInt(_0x27c8cc(0x1d6))/0xb;if(_0x35af79===_0x2c02e1)break;else _0x195b01['push'](_0x195b01['shift']());}catch(_0x2a4f42){_0x195b01['push'](_0x195b01['shift']());}}}(a173_0x476d,0x74226));import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a173_0x476d(){const _0xeb7795=['91HXwBQK','Removed\x20user\x20','No\x20change:\x20user\x20','1608WohSrR','appCode','POST','3yTUjfc','1214386CAnqCj','295068ikrxUY','38331jrZmCW','576734gfNcoK','2558370TazXOH','role','\x20from\x20role\x20','\x20not\x20in\x20role\x20','selector','roleName','userId','207215ocmAYB','6981084ZwdBmT','user-remove','high-risk-write','84wLRKQf'];a173_0x476d=function(){return _0xeb7795;};return a173_0x476d();}import{asDryRunResult}from'../../commands/common/dry-run.js';function a173_0x2cab(_0x860427,_0x5eb131){_0x860427=_0x860427-0x1d3;const _0x476da8=a173_0x476d();let _0x2cab2e=_0x476da8[_0x860427];return _0x2cab2e;}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':a173_0x265a71(0x1e6),'command':a173_0x265a71(0x1d7),'description':'Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','risk':a173_0x265a71(0x1d8),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x4a1dac){const _0x351bd9=a173_0x265a71,{mutation:_0x5b8de7}=await prepareUserMutation(_0x4a1dac,'user-remove',!![]);return asDryRunResult(_0x5b8de7,{'method':_0x351bd9(0x1df),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x5b51a2){const _0x3e1257=a173_0x265a71,{roleList:_0x44bd4a,mutation:_0x4c58f2,changed:_0x4ea860}=await prepareUserMutation(_0x5b51a2,_0x3e1257(0x1d7),![]);return _0x4ea860&&await updateRoleUsers(_0x5b51a2[_0x3e1257(0x1de)],_0x44bd4a),{'ok':!![],'data':_0x4c58f2,'message':_0x4ea860?_0x3e1257(0x1db)+_0x4c58f2[_0x3e1257(0x1e9)][_0x3e1257(0x1d4)]+_0x3e1257(0x1e7)+_0x4c58f2['selector'][_0x3e1257(0x1d3)]:_0x3e1257(0x1dc)+_0x4c58f2['selector'][_0x3e1257(0x1d4)]+_0x3e1257(0x1e8)+_0x4c58f2[_0x3e1257(0x1e9)][_0x3e1257(0x1d3)]};}};
1
+ function a172_0x54a8(_0x3f3dff,_0x5b339e){_0x3f3dff=_0x3f3dff-0x19a;const _0x22dc66=a172_0x22dc();let _0x54a8b8=_0x22dc66[_0x3f3dff];return _0x54a8b8;}function a172_0x22dc(){const _0x55e18b=['\x20not\x20in\x20role\x20','168558BmoorF','1600299swkjQO','Removed\x20user\x20','128336dyMtWi','6pGSWgB','POST','role','selector','21mOlFBK','3477420aRCBEn','user-remove','628ixJwCy','appCode','roleName','4203Rvqwhm','77149XXexAt','userId','No\x20change:\x20user\x20','5145wTbNFZ'];a172_0x22dc=function(){return _0x55e18b;};return a172_0x22dc();}const a172_0x578a48=a172_0x54a8;(function(_0x205119,_0x28facb){const _0x1d4aa0=a172_0x54a8,_0xebaa87=_0x205119();while(!![]){try{const _0x599341=parseInt(_0x1d4aa0(0x1ad))/0x1+parseInt(_0x1d4aa0(0x1a2))/0x2*(parseInt(_0x1d4aa0(0x1ac))/0x3)+parseInt(_0x1d4aa0(0x1a9))/0x4*(-parseInt(_0x1d4aa0(0x19c))/0x5)+-parseInt(_0x1d4aa0(0x19e))/0x6+parseInt(_0x1d4aa0(0x1a6))/0x7*(parseInt(_0x1d4aa0(0x1a1))/0x8)+-parseInt(_0x1d4aa0(0x19f))/0x9+parseInt(_0x1d4aa0(0x1a7))/0xa;if(_0x599341===_0x28facb)break;else _0xebaa87['push'](_0xebaa87['shift']());}catch(_0x32b5b9){_0xebaa87['push'](_0xebaa87['shift']());}}}(a172_0x22dc,0x1acc3));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';export const roleUserRemove={'service':a172_0x578a48(0x1a4),'command':a172_0x578a48(0x1a8),'description':'Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x128716){const _0x2da7a6=a172_0x578a48,{mutation:_0x35674b}=await prepareUserMutation(_0x128716,_0x2da7a6(0x1a8),!![]);return asDryRunResult(_0x35674b,{'method':_0x2da7a6(0x1a3),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x85987f){const _0x1443ad=a172_0x578a48,{roleList:_0x3e7c0c,mutation:_0xa00298,changed:_0x2ce4b6}=await prepareUserMutation(_0x85987f,_0x1443ad(0x1a8),![]);return _0x2ce4b6&&await updateRoleUsers(_0x85987f[_0x1443ad(0x1aa)],_0x3e7c0c),{'ok':!![],'data':_0xa00298,'message':_0x2ce4b6?_0x1443ad(0x1a0)+_0xa00298[_0x1443ad(0x1a5)][_0x1443ad(0x19a)]+'\x20from\x20role\x20'+_0xa00298[_0x1443ad(0x1a5)][_0x1443ad(0x1ab)]:_0x1443ad(0x19b)+_0xa00298[_0x1443ad(0x1a5)][_0x1443ad(0x19a)]+_0x1443ad(0x19d)+_0xa00298[_0x1443ad(0x1a5)][_0x1443ad(0x1ab)]};}};
@@ -1 +1 @@
1
- function a174_0x43c3(){const _0x379f6c=['\x22\x20→\x20userId\x20','4684YrOMOV','trim','username','37PekUhm','663ZnwgYt','3298122tmnlgV','6355555vGXZPN','userId','Pass\x20--name\x20<nickname|username>.','nickname','5371281WsXvTf','35254uiwqAy','flagMissing','read','8118891fGjicD','20fhvkJh','16ieKFmN','user-resolve','name','str','7931287rzkolR','role'];a174_0x43c3=function(){return _0x379f6c;};return a174_0x43c3();}const a174_0x231e72=a174_0x4f04;(function(_0x4c8186,_0x1f25fe){const _0x3c9059=a174_0x4f04,_0x5163bf=_0x4c8186();while(!![]){try{const _0x7f0162=parseInt(_0x3c9059(0x1ff))/0x1*(parseInt(_0x3c9059(0x1f0))/0x2)+-parseInt(_0x3c9059(0x200))/0x3*(parseInt(_0x3c9059(0x1fc))/0x4)+parseInt(_0x3c9059(0x202))/0x5+parseInt(_0x3c9059(0x201))/0x6+parseInt(_0x3c9059(0x1f9))/0x7+-parseInt(_0x3c9059(0x1f5))/0x8*(parseInt(_0x3c9059(0x1ef))/0x9)+parseInt(_0x3c9059(0x1f4))/0xa*(-parseInt(_0x3c9059(0x1f3))/0xb);if(_0x7f0162===_0x1f25fe)break;else _0x5163bf['push'](_0x5163bf['shift']());}catch(_0x49735a){_0x5163bf['push'](_0x5163bf['shift']());}}}(a174_0x43c3,0xa565b));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 a174_0x4f04(_0x56da8a,_0x5e2a27){_0x56da8a=_0x56da8a-0x1ef;const _0x43c31a=a174_0x43c3();let _0x4f042b=_0x43c31a[_0x56da8a];return _0x4f042b;}export const roleUserResolve={'service':a174_0x231e72(0x1fa),'command':a174_0x231e72(0x1f6),'description':'Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','risk':a174_0x231e72(0x1f2),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x597663){const _0x528d00=a174_0x231e72;if(!_0x597663[_0x528d00(0x1f8)](_0x528d00(0x1f7))[_0x528d00(0x1fd)]())throw CliErrors[_0x528d00(0x1f1)]('name',_0x528d00(0x204));},async 'execute'(_0x1fb7c9){const _0x55d635=a174_0x231e72,_0x4aa570=_0x1fb7c9[_0x55d635(0x1f8)](_0x55d635(0x1f7))[_0x55d635(0x1fd)](),_0x4926b2=await resolveUserRef(_0x4aa570);return{'ok':!![],'data':{'user':{'userId':_0x4926b2['userId'],'username':_0x4926b2[_0x55d635(0x1fe)],'nickname':_0x4926b2[_0x55d635(0x205)],'matchedBy':_0x4926b2['matchedBy']}},'message':'Resolved\x20\x22'+_0x4aa570+_0x55d635(0x1fb)+_0x4926b2[_0x55d635(0x203)]};}};
1
+ const a173_0x3fbba1=a173_0x34cc;(function(_0xcbc972,_0x5919ae){const _0x5d5da9=a173_0x34cc,_0x4b4c2f=_0xcbc972();while(!![]){try{const _0x482036=parseInt(_0x5d5da9(0x10e))/0x1+parseInt(_0x5d5da9(0x101))/0x2+-parseInt(_0x5d5da9(0x108))/0x3+parseInt(_0x5d5da9(0x100))/0x4+parseInt(_0x5d5da9(0xff))/0x5*(parseInt(_0x5d5da9(0x114))/0x6)+-parseInt(_0x5d5da9(0x103))/0x7+parseInt(_0x5d5da9(0x10f))/0x8*(-parseInt(_0x5d5da9(0x109))/0x9);if(_0x482036===_0x5919ae)break;else _0x4b4c2f['push'](_0x4b4c2f['shift']());}catch(_0x2de0ea){_0x4b4c2f['push'](_0x4b4c2f['shift']());}}}(a173_0x46bc,0xc37cf));import{CliErrors}from'../../errors.js';function a173_0x34cc(_0x230661,_0x549e22){_0x230661=_0x230661-0xff;const _0x46bcf8=a173_0x46bc();let _0x34cc74=_0x46bcf8[_0x230661];return _0x34cc74;}function a173_0x46bc(){const _0x20b176=['nickname','\x22\x20→\x20userId\x20','userId','name','3368025WmtqFj','55719ejNFyp','user-resolve','Resolved\x20\x22','trim','Pass\x20--name\x20<nickname|username>.','654943RZLHzT','320KktqxB','username','matchedBy','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','str','1104NxvazO','12990lpHpeC','5294768zenPqH','92730aDZGKr','read','2323986ZaZBmP'];a173_0x46bc=function(){return _0x20b176;};return a173_0x46bc();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':'role','command':a173_0x3fbba1(0x10a),'description':a173_0x3fbba1(0x112),'risk':a173_0x3fbba1(0x102),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x44ee56){const _0x22b405=a173_0x3fbba1;if(!_0x44ee56[_0x22b405(0x113)](_0x22b405(0x107))[_0x22b405(0x10c)]())throw CliErrors['flagMissing'](_0x22b405(0x107),_0x22b405(0x10d));},async 'execute'(_0x480d3a){const _0x5cb836=a173_0x3fbba1,_0x3b53f5=_0x480d3a[_0x5cb836(0x113)](_0x5cb836(0x107))[_0x5cb836(0x10c)](),_0x382132=await resolveUserRef(_0x3b53f5);return{'ok':!![],'data':{'user':{'userId':_0x382132[_0x5cb836(0x106)],'username':_0x382132[_0x5cb836(0x110)],'nickname':_0x382132[_0x5cb836(0x104)],'matchedBy':_0x382132[_0x5cb836(0x111)]}},'message':_0x5cb836(0x10b)+_0x3b53f5+_0x5cb836(0x105)+_0x382132[_0x5cb836(0x106)]};}};
@@ -1 +1 @@
1
- const a175_0x5617d9=a175_0x5cae;(function(_0xa49d87,_0x171ff7){const _0x85ea6=a175_0x5cae,_0x402e12=_0xa49d87();while(!![]){try{const _0x328226=parseInt(_0x85ea6(0x18f))/0x1+-parseInt(_0x85ea6(0x18d))/0x2*(parseInt(_0x85ea6(0x192))/0x3)+-parseInt(_0x85ea6(0x1b1))/0x4*(parseInt(_0x85ea6(0x1c4))/0x5)+-parseInt(_0x85ea6(0x1b0))/0x6*(-parseInt(_0x85ea6(0x1b7))/0x7)+-parseInt(_0x85ea6(0x18c))/0x8*(-parseInt(_0x85ea6(0x1a5))/0x9)+parseInt(_0x85ea6(0x1ab))/0xa*(-parseInt(_0x85ea6(0x188))/0xb)+-parseInt(_0x85ea6(0x1c1))/0xc*(-parseInt(_0x85ea6(0x1bf))/0xd);if(_0x328226===_0x171ff7)break;else _0x402e12['push'](_0x402e12['shift']());}catch(_0x1612e5){_0x402e12['push'](_0x402e12['shift']());}}}(a175_0x5c3e,0xc955b));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';function a175_0x5c3e(){const _0x5847ba=['419871Ntqwax','needsUpgrade','\x20run\x20preview\x20--watch','15QhQGBw','validation','vite\x20preview\x20exited\x20with\x20code\x20','length','push','\x20\x20\x20\x20','Available:\x20','has','error','boolean','\x20run\x20<script>\x0a','yarn.lock','bool','bun','pnpm','args','Script\x20name\x20defined\x20in\x20package.json','\x20run\x20','log','9FaQRVS','slice','No\x20scripts\x20defined\x20in\x20package.json.','npm','--watch','.bin','10cmwSdJ','belowMinimum','keys','Enable\x20watch\x20mode\x20for\x20preview','No\x20package.json\x20found\x20in\x20current\x20directory.','614892hvcknK','35676JmQeAu','inherit','join','package.json','\x20exited\x20with\x20code\x20','run','105RktyXa','build','Run\x20a\x20package.json\x20script','bun.lockb','\x22\x20not\x20found\x20in\x20package.json.','Script\x20\x22','\x0a\x20\x20Usage:\x20','start','8727862YmnLKI','watch','12HEXiWL','script','node_modules','835urMWXV','\x0a\x20\x20Available\x20scripts:\x0a','scripts','\x20run\x20preview','utf-8','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','vite','\x20\x20EXAMPLES','(none)','13283831Ohgrnt','all','\x20run\x20build','close','12832088mPeYug','284290tivvLT','preview'];a175_0x5c3e=function(){return _0x5847ba;};return a175_0x5c3e();}import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';function a175_0x5cae(_0x3806cd,_0x651c26){_0x3806cd=_0x3806cd-0x183;const _0x5c3eb9=a175_0x5c3e();let _0x5cae59=_0x5c3eb9[_0x3806cd];return _0x5cae59;}const VERSION_CHECK_SCRIPTS=new Set([a175_0x5617d9(0x1be),'dev']);function readPackageScripts(_0x295514){const _0xf6f9ac=a175_0x5617d9,_0x5c3a30=resolve(_0x295514,_0xf6f9ac(0x1b4));if(!existsSync(_0x5c3a30))return null;try{const _0x1b4f98=JSON['parse'](readFileSync(_0x5c3a30,_0xf6f9ac(0x183)));return _0x1b4f98[_0xf6f9ac(0x1c6)]??{};}catch{return null;}}function detectPackageManager(_0x52a1f9){const _0x155add=a175_0x5617d9;if(existsSync(resolve(_0x52a1f9,_0x155add(0x1ba)))||existsSync(resolve(_0x52a1f9,'bun.lock')))return _0x155add(0x19f);if(existsSync(resolve(_0x52a1f9,'pnpm-lock.yaml')))return _0x155add(0x1a0);if(existsSync(resolve(_0x52a1f9,_0x155add(0x19d))))return'yarn';return _0x155add(0x1a8);}async function versionCheck(_0x3ca0ad){const _0xd577ed=a175_0x5617d9,_0x4c81db=await checkCliVersion();(_0x4c81db['needsUpgrade']||_0x4c81db[_0xd577ed(0x1ac)])&&(printCliUpgradeWarning(_0x4c81db),assertCliVersionSupported(_0x4c81db));const _0x28dc79=await checkSdkVersion(_0x3ca0ad);if(_0x28dc79[_0xd577ed(0x190)])printSdkUpgradeWarning(_0x28dc79);}function spawnScript(_0x38a2cd,_0x216f7,_0x4b4b39,_0x5d0abb){return new Promise((_0x19429e,_0x25d7aa)=>{const _0xac3a42=a175_0x5cae,_0x307ad4=[_0xac3a42(0x1b6),_0x216f7,..._0x4b4b39],_0x26d320=spawn(_0x38a2cd,_0x307ad4,{'cwd':_0x5d0abb,'stdio':_0xac3a42(0x1b2),'shell':!![],'env':{...process.env,'PATH':''+join(_0x5d0abb,'node_modules',_0xac3a42(0x1aa))+delimiter+process.env.PATH}});_0x26d320['on']('close',_0x525591=>{const _0x3b26f1=_0xac3a42;if(_0x525591===0x0||_0x525591===null)_0x19429e();else _0x25d7aa(new Error(_0x38a2cd+_0x3b26f1(0x1a3)+_0x216f7+_0x3b26f1(0x1b5)+_0x525591));}),_0x26d320['on'](_0xac3a42(0x19a),_0x25d7aa);});}function spawnViteBuildWatch(_0x83f4f2){return new Promise((_0x2e082d,_0x1249df)=>{const _0x22ae18=a175_0x5cae,_0x31ffa5=spawn('vite',[_0x22ae18(0x1b8),_0x22ae18(0x1a9)],{'cwd':_0x83f4f2,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x83f4f2,_0x22ae18(0x1c3),'.bin')+delimiter+process.env.PATH}});_0x31ffa5['on']('close',_0x3120b9=>{const _0x19c1f6=_0x22ae18;if(_0x3120b9===0x0||_0x3120b9===null)_0x2e082d();else _0x1249df(new Error(_0x19c1f6(0x184)+_0x3120b9));}),_0x31ffa5['on'](_0x22ae18(0x19a),_0x1249df);});}function spawnVitePreview(_0x49a6e3){return new Promise((_0xb554b9,_0x1f0eaf)=>{const _0x396084=a175_0x5cae,_0x1b7c6c=spawn(_0x396084(0x185),['preview'],{'cwd':_0x49a6e3,'stdio':_0x396084(0x1b2),'shell':!![],'env':{...process.env,'PATH':''+join(_0x49a6e3,_0x396084(0x1c3),_0x396084(0x1aa))+delimiter+process.env.PATH}});_0x1b7c6c['on'](_0x396084(0x18b),_0x57794c=>{const _0x460628=_0x396084;if(_0x57794c===0x0||_0x57794c===null)_0xb554b9();else _0x1f0eaf(new Error(_0x460628(0x194)+_0x57794c));}),_0x1b7c6c['on'](_0x396084(0x19a),_0x1f0eaf);});}const runFlags=[{'name':a175_0x5617d9(0x1c0),'type':a175_0x5617d9(0x19b),'description':a175_0x5617d9(0x1ae),'default':![]}];export const runDefinition={'service':a175_0x5617d9(0x1b6),'command':a175_0x5617d9(0x1b6),'description':a175_0x5617d9(0x1b9),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a175_0x5617d9(0x1c2),'description':a175_0x5617d9(0x1a2),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x3a53c5=a175_0x5617d9,_0x375a64=[];return _0x375a64[_0x3a53c5(0x196)](_0x3a53c5(0x186)),_0x375a64[_0x3a53c5(0x196)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20start'),_0x375a64[_0x3a53c5(0x196)](_0x3a53c5(0x197)+CLI_BIN_NAME+_0x3a53c5(0x18a)),_0x375a64[_0x3a53c5(0x196)](_0x3a53c5(0x197)+CLI_BIN_NAME+_0x3a53c5(0x1c7)),_0x375a64[_0x3a53c5(0x196)](_0x3a53c5(0x197)+CLI_BIN_NAME+_0x3a53c5(0x191)),_0x375a64[_0x3a53c5(0x1b3)]('\x0a');},async 'execute'(_0x28a4e5){const _0x56fbd6=a175_0x5617d9,_0x4ef46e=process['cwd'](),_0x107994=_0x28a4e5[_0x56fbd6(0x1a1)][0x0],_0x2464ca=_0x28a4e5[_0x56fbd6(0x1a1)][_0x56fbd6(0x1a6)](0x1),_0x1ee2e5=readPackageScripts(_0x4ef46e);if(!_0x1ee2e5)throw CliErrors['validation'](_0x56fbd6(0x1af));if(!_0x107994){const _0x37d010=Object[_0x56fbd6(0x1ad)](_0x1ee2e5);if(_0x37d010[_0x56fbd6(0x195)]===0x0)console[_0x56fbd6(0x1a4)](_0x56fbd6(0x1a7));else{console[_0x56fbd6(0x1a4)](_0x56fbd6(0x1c5));for(const _0x1469ba of _0x37d010){console[_0x56fbd6(0x1a4)](_0x56fbd6(0x197)+_0x1469ba);}console[_0x56fbd6(0x1a4)](_0x56fbd6(0x1bd)+CLI_BIN_NAME+_0x56fbd6(0x19c));}return{'ok':!![]};}if(!_0x1ee2e5[_0x107994])throw CliErrors[_0x56fbd6(0x193)](_0x56fbd6(0x1bc)+_0x107994+_0x56fbd6(0x1bb),_0x56fbd6(0x198)+(Object[_0x56fbd6(0x1ad)](_0x1ee2e5)[_0x56fbd6(0x1b3)](',\x20')||_0x56fbd6(0x187)));const _0x4acdb7=detectPackageManager(_0x4ef46e);VERSION_CHECK_SCRIPTS[_0x56fbd6(0x199)](_0x107994)&&await versionCheck(_0x4ef46e);if(_0x107994===_0x56fbd6(0x18e)&&_0x28a4e5[_0x56fbd6(0x19e)](_0x56fbd6(0x1c0)))return await Promise[_0x56fbd6(0x189)]([spawnViteBuildWatch(_0x4ef46e),spawnVitePreview(_0x4ef46e)]),{'ok':!![]};return await spawnScript(_0x4acdb7,_0x107994,_0x2464ca,_0x4ef46e),{'ok':!![]};}};
1
+ const a174_0x3b7545=a174_0x1125;(function(_0x3a9d8b,_0x2444f1){const _0x4209a7=a174_0x1125,_0x4cbf86=_0x3a9d8b();while(!![]){try{const _0x129b3f=parseInt(_0x4209a7(0x126))/0x1+parseInt(_0x4209a7(0x104))/0x2+parseInt(_0x4209a7(0x125))/0x3+parseInt(_0x4209a7(0x138))/0x4+parseInt(_0x4209a7(0x105))/0x5*(parseInt(_0x4209a7(0x10c))/0x6)+parseInt(_0x4209a7(0x12b))/0x7*(-parseInt(_0x4209a7(0x11f))/0x8)+-parseInt(_0x4209a7(0x129))/0x9*(parseInt(_0x4209a7(0x107))/0xa);if(_0x129b3f===_0x2444f1)break;else _0x4cbf86['push'](_0x4cbf86['shift']());}catch(_0x36a6b9){_0x4cbf86['push'](_0x4cbf86['shift']());}}}(a174_0x4c05,0x1901f));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a174_0x3b7545(0x10e),a174_0x3b7545(0x127)]);function readPackageScripts(_0xfb4d7a){const _0x8b9a11=a174_0x3b7545,_0x40b07c=resolve(_0xfb4d7a,_0x8b9a11(0x10d));if(!existsSync(_0x40b07c))return null;try{const _0x36c3eb=JSON[_0x8b9a11(0x119)](readFileSync(_0x40b07c,_0x8b9a11(0x114)));return _0x36c3eb['scripts']??{};}catch{return null;}}function detectPackageManager(_0x4b82d4){const _0x95adfa=a174_0x3b7545;if(existsSync(resolve(_0x4b82d4,_0x95adfa(0x132)))||existsSync(resolve(_0x4b82d4,'bun.lock')))return'bun';if(existsSync(resolve(_0x4b82d4,_0x95adfa(0x111))))return'pnpm';if(existsSync(resolve(_0x4b82d4,'yarn.lock')))return _0x95adfa(0x10b);return _0x95adfa(0x106);}async function versionCheck(_0x2a7f44){const _0xac2d76=a174_0x3b7545,_0x57caa3=await checkCliVersion();(_0x57caa3['needsUpgrade']||_0x57caa3[_0xac2d76(0x11d)])&&(printCliUpgradeWarning(_0x57caa3),assertCliVersionSupported(_0x57caa3));const _0x5df83c=await checkSdkVersion(_0x2a7f44);if(_0x5df83c[_0xac2d76(0x121)])printSdkUpgradeWarning(_0x5df83c);}function spawnScript(_0x1b766b,_0x341f06,_0x5ea19f,_0x263804){return new Promise((_0x48ef19,_0x4994ba)=>{const _0x51c891=a174_0x1125,_0x82a34e=[_0x51c891(0x10a),_0x341f06,..._0x5ea19f],_0x388f2f=spawn(_0x1b766b,_0x82a34e,{'cwd':_0x263804,'stdio':_0x51c891(0x11b),'shell':!![],'env':{...process.env,'PATH':''+join(_0x263804,_0x51c891(0x116),_0x51c891(0x135))+delimiter+process.env.PATH}});_0x388f2f['on'](_0x51c891(0x136),_0x55426a=>{const _0x3ca4b8=_0x51c891;if(_0x55426a===0x0||_0x55426a===null)_0x48ef19();else _0x4994ba(new Error(_0x1b766b+_0x3ca4b8(0x112)+_0x341f06+_0x3ca4b8(0x117)+_0x55426a));}),_0x388f2f['on']('error',_0x4994ba);});}function spawnViteBuildWatch(_0x33a984){return new Promise((_0x399429,_0xa90142)=>{const _0x429c7a=a174_0x1125,_0x547b5f=spawn('vite',['build',_0x429c7a(0x11e)],{'cwd':_0x33a984,'stdio':_0x429c7a(0x11b),'shell':!![],'env':{...process.env,'PATH':''+join(_0x33a984,_0x429c7a(0x116),_0x429c7a(0x135))+delimiter+process.env.PATH}});_0x547b5f['on'](_0x429c7a(0x136),_0x2eab86=>{if(_0x2eab86===0x0||_0x2eab86===null)_0x399429();else _0xa90142(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x2eab86));}),_0x547b5f['on'](_0x429c7a(0x139),_0xa90142);});}function spawnVitePreview(_0x20899b){return new Promise((_0x56ce72,_0xd0dfa0)=>{const _0xa9be7b=a174_0x1125,_0x51dd73=spawn(_0xa9be7b(0x13d),[_0xa9be7b(0x109)],{'cwd':_0x20899b,'stdio':_0xa9be7b(0x11b),'shell':!![],'env':{...process.env,'PATH':''+join(_0x20899b,'node_modules',_0xa9be7b(0x135))+delimiter+process.env.PATH}});_0x51dd73['on'](_0xa9be7b(0x136),_0x59d447=>{const _0x545af0=_0xa9be7b;if(_0x59d447===0x0||_0x59d447===null)_0x56ce72();else _0xd0dfa0(new Error(_0x545af0(0x12f)+_0x59d447));}),_0x51dd73['on']('error',_0xd0dfa0);});}function a174_0x4c05(){const _0x474a15=['needsUpgrade','\x20run\x20preview','\x20run\x20start','\x20\x20\x20\x20','92721yqhAuW','24174DxdEtR','dev','No\x20package.json\x20found\x20in\x20current\x20directory.','11862uzFUxv','has','1393553XwszXv','log','push','Run\x20a\x20package.json\x20script','vite\x20preview\x20exited\x20with\x20code\x20','read','No\x20scripts\x20defined\x20in\x20package.json.','bun.lockb','watch','\x22\x20not\x20found\x20in\x20package.json.','.bin','close','all','736452BhEQmG','error','Available:\x20','validation','\x20run\x20<script>\x0a','vite','228834cPuSbJ','205MSqvHc','npm','940uYMsji','join','preview','run','yarn','10506DhbsdQ','package.json','start','args','script','pnpm-lock.yaml','\x20run\x20','Enable\x20watch\x20mode\x20for\x20preview','utf-8','\x20\x20EXAMPLES','node_modules','\x20exited\x20with\x20code\x20','boolean','parse','keys','inherit','\x0a\x20\x20Usage:\x20','belowMinimum','--watch','8LPeDmU','\x20run\x20build'];a174_0x4c05=function(){return _0x474a15;};return a174_0x4c05();}const runFlags=[{'name':a174_0x3b7545(0x133),'type':a174_0x3b7545(0x118),'description':a174_0x3b7545(0x113),'default':![]}];function a174_0x1125(_0x469241,_0x17128b){_0x469241=_0x469241-0x104;const _0x4c05aa=a174_0x4c05();let _0x112508=_0x4c05aa[_0x469241];return _0x112508;}export const runDefinition={'service':a174_0x3b7545(0x10a),'command':a174_0x3b7545(0x10a),'description':a174_0x3b7545(0x12e),'risk':a174_0x3b7545(0x130),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a174_0x3b7545(0x110),'description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x5961ea=a174_0x3b7545,_0x4afa9c=[];return _0x4afa9c[_0x5961ea(0x12d)](_0x5961ea(0x115)),_0x4afa9c[_0x5961ea(0x12d)](_0x5961ea(0x124)+CLI_BIN_NAME+_0x5961ea(0x123)),_0x4afa9c[_0x5961ea(0x12d)](_0x5961ea(0x124)+CLI_BIN_NAME+_0x5961ea(0x120)),_0x4afa9c['push'](_0x5961ea(0x124)+CLI_BIN_NAME+_0x5961ea(0x122)),_0x4afa9c[_0x5961ea(0x12d)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x4afa9c['join']('\x0a');},async 'execute'(_0x85caa9){const _0x2299fe=a174_0x3b7545,_0x4ad380=process['cwd'](),_0x541a93=_0x85caa9[_0x2299fe(0x10f)][0x0],_0x5d0366=_0x85caa9[_0x2299fe(0x10f)]['slice'](0x1),_0x474220=readPackageScripts(_0x4ad380);if(!_0x474220)throw CliErrors[_0x2299fe(0x13b)](_0x2299fe(0x128));if(!_0x541a93){const _0x5bb4c2=Object['keys'](_0x474220);if(_0x5bb4c2['length']===0x0)console[_0x2299fe(0x12c)](_0x2299fe(0x131));else{console['log']('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x116d72 of _0x5bb4c2){console['log'](_0x2299fe(0x124)+_0x116d72);}console[_0x2299fe(0x12c)](_0x2299fe(0x11c)+CLI_BIN_NAME+_0x2299fe(0x13c));}return{'ok':!![]};}if(!_0x474220[_0x541a93])throw CliErrors[_0x2299fe(0x13b)]('Script\x20\x22'+_0x541a93+_0x2299fe(0x134),_0x2299fe(0x13a)+(Object[_0x2299fe(0x11a)](_0x474220)[_0x2299fe(0x108)](',\x20')||'(none)'));const _0x53b698=detectPackageManager(_0x4ad380);VERSION_CHECK_SCRIPTS[_0x2299fe(0x12a)](_0x541a93)&&await versionCheck(_0x4ad380);if(_0x541a93==='preview'&&_0x85caa9['bool'](_0x2299fe(0x133)))return await Promise[_0x2299fe(0x137)]([spawnViteBuildWatch(_0x4ad380),spawnVitePreview(_0x4ad380)]),{'ok':!![]};return await spawnScript(_0x53b698,_0x541a93,_0x5d0366,_0x4ad380),{'ok':!![]};}};
@@ -1 +1 @@
1
- const a176_0x50b5cc=a176_0x2301;function a176_0x2301(_0x1b5161,_0x46db69){_0x1b5161=_0x1b5161-0x1ee;const _0x1489d8=a176_0x1489();let _0x23018d=_0x1489d8[_0x1b5161];return _0x23018d;}(function(_0x3e4cde,_0x4c2782){const _0x225e8f=a176_0x2301,_0x452d08=_0x3e4cde();while(!![]){try{const _0xf73bfd=parseInt(_0x225e8f(0x1fb))/0x1+-parseInt(_0x225e8f(0x1f9))/0x2+parseInt(_0x225e8f(0x1ef))/0x3*(-parseInt(_0x225e8f(0x1f1))/0x4)+parseInt(_0x225e8f(0x1f3))/0x5+-parseInt(_0x225e8f(0x1f5))/0x6*(-parseInt(_0x225e8f(0x1f2))/0x7)+-parseInt(_0x225e8f(0x1ee))/0x8+-parseInt(_0x225e8f(0x1f0))/0x9*(parseInt(_0x225e8f(0x1fa))/0xa);if(_0xf73bfd===_0x4c2782)break;else _0x452d08['push'](_0x452d08['shift']());}catch(_0x14880a){_0x452d08['push'](_0x452d08['shift']());}}}(a176_0x1489,0xc0d2a));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x589247){const _0x1d1559=await buildSchemaPayload();return{'ok':!![],'data':_0x1d1559};}function a176_0x1489(){const _0x594a85=['11864272ahIJfj','125049WqMtRo','64413iVyjLf','4WqPieU','168nYyRGv','5340395YdYptA','read','320184XjZNac','schema','Export\x20machine-readable\x20command\x20schema\x20(JSON)','json','265968Ncbuat','1220UrcKZZ','971842mRvaag'];a176_0x1489=function(){return _0x594a85;};return a176_0x1489();}export const schemaDefinition={'service':a176_0x50b5cc(0x1f6),'command':'export','description':a176_0x50b5cc(0x1f7),'risk':a176_0x50b5cc(0x1f4),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a176_0x50b5cc(0x1f8),'flags':[],'execute':execute};
1
+ const a175_0x8f7ac7=a175_0x1d05;function a175_0x1973(){const _0x10ce1c=['json','schema','1915827jsJuPd','read','1084DJKZdK','export','Export\x20machine-readable\x20command\x20schema\x20(JSON)','911028LRBXuC','4711294lctXhr','2159208yDXUxx','18230mskUnP','1194348VeWrSP','189907oDJExK'];a175_0x1973=function(){return _0x10ce1c;};return a175_0x1973();}(function(_0x8fcbcb,_0x4503db){const _0x2c638f=a175_0x1d05,_0x476ff5=_0x8fcbcb();while(!![]){try{const _0x27de1f=parseInt(_0x2c638f(0x142))/0x1+parseInt(_0x2c638f(0x14a))/0x2+parseInt(_0x2c638f(0x145))/0x3+-parseInt(_0x2c638f(0x147))/0x4*(parseInt(_0x2c638f(0x140))/0x5)+-parseInt(_0x2c638f(0x141))/0x6+parseInt(_0x2c638f(0x14b))/0x7+-parseInt(_0x2c638f(0x14c))/0x8;if(_0x27de1f===_0x4503db)break;else _0x476ff5['push'](_0x476ff5['shift']());}catch(_0x2ced38){_0x476ff5['push'](_0x476ff5['shift']());}}}(a175_0x1973,0x7a14f));function a175_0x1d05(_0x448f6a,_0x288fad){_0x448f6a=_0x448f6a-0x140;const _0x197393=a175_0x1973();let _0x1d05e2=_0x197393[_0x448f6a];return _0x1d05e2;}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x4916a3){const _0xbf4287=await buildSchemaPayload();return{'ok':!![],'data':_0xbf4287};}export const schemaDefinition={'service':a175_0x8f7ac7(0x144),'command':a175_0x8f7ac7(0x148),'description':a175_0x8f7ac7(0x149),'risk':a175_0x8f7ac7(0x146),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a175_0x8f7ac7(0x143),'flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a177_0x29b9fc=a177_0x1efd;(function(_0x3f988a,_0x129c78){const _0x17b313=a177_0x1efd,_0x348ae5=_0x3f988a();while(!![]){try{const _0x855f8d=parseInt(_0x17b313(0xfa))/0x1*(parseInt(_0x17b313(0xe3))/0x2)+parseInt(_0x17b313(0x11d))/0x3*(parseInt(_0x17b313(0xe4))/0x4)+parseInt(_0x17b313(0xee))/0x5+-parseInt(_0x17b313(0xe6))/0x6+-parseInt(_0x17b313(0xec))/0x7+-parseInt(_0x17b313(0x104))/0x8+-parseInt(_0x17b313(0x10d))/0x9*(-parseInt(_0x17b313(0xfe))/0xa);if(_0x855f8d===_0x129c78)break;else _0x348ae5['push'](_0x348ae5['shift']());}catch(_0x542d0e){_0x348ae5['push'](_0x348ae5['shift']());}}}(a177_0xb593,0xdbd50));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';function a177_0xb593(){const _0x22b83d=['lastSync','sqlCode','number','toISOString','validation','isInteger','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','create','appCode','dbName','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','sql','nonInteractive','/smartapi/custom/saveUserCustomSql','3ZegmpU','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','Created\x20SQL\x20query\x20','trim','length','20jcLiNQ','2885752tqQvRN','sqlRoot','8966742sidyuv','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','catch','请输入\x20SQL\x20名称:','flagMissing','dbId\x20不能为空','11464467hSRKQk','sqlName','3304550QNSzqK','lockFilePath','str','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','name','mode','File\x20already\x20exists:\x20','sqls','mybatisXml','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','isFinite','SQL\x20名称不能为空','31114RvhcjE','Invalid\x20database\x20selection\x20payload:\x20','db-id','dbId','10850HYWslV','Target\x20database\x20ID','join','适合带动态标签的\x20MyBatis\x20XML\x20SQL','SQL\x20query\x20display\x20name','flag','9505224ZGIpjU','sqlRootDir','__manual__','<server-generated-sqlCode>','parse','utf8','MyBatis\x20XML(mybatisXml)','Local\x20SQL\x20file\x20mode','请选择目标数据库:','29259kELiPh','</select>'];a177_0xb593=function(){return _0x22b83d;};return a177_0xb593();}import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x2d5420){const _0x8b085c=a177_0x1efd;if(_0x2d5420==='mybatisXml')return[_0x8b085c(0xf1),'\x20\x20SELECT\x201\x20AS\x20id',_0x8b085c(0x10e),''][_0x8b085c(0x100)]('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x8b085c(0x100)]('\x0a');}export const sqlCreate={'service':a177_0x29b9fc(0x11a),'command':a177_0x29b9fc(0x116),'description':a177_0x29b9fc(0xf7),'risk':'high-risk-write','flags':[{'name':a177_0x29b9fc(0xf2),'type':'string','description':a177_0x29b9fc(0x102)},{'name':a177_0x29b9fc(0xfc),'type':a177_0x29b9fc(0x111),'description':a177_0x29b9fc(0xff)},{'name':a177_0x29b9fc(0xf3),'type':'string','enum':[a177_0x29b9fc(0x11a),a177_0x29b9fc(0xf6)],'description':a177_0x29b9fc(0x10b)}],async 'validate'(_0x2339ab){const _0x221311=a177_0x29b9fc;if(!_0x2339ab[_0x221311(0x11b)])return;if(!_0x2339ab['str'](_0x221311(0xf2))[_0x221311(0xe1)]())throw CliErrors[_0x221311(0xea)](_0x221311(0xf2),_0x221311(0x11e));const _0x287614=resolveProvidedDbId(_0x2339ab);if(typeof _0x287614!==_0x221311(0x111)||!Number[_0x221311(0xf8)](_0x287614)||_0x287614<=0x0)throw CliErrors['flagMissing']('db-id',_0x221311(0xe7));if(!_0x2339ab[_0x221311(0xf0)]('mode')['trim']())throw CliErrors[_0x221311(0xea)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x39a193){const _0x4f9f17=a177_0x29b9fc,_0x178122=loadSqlProjectConfig(_0x39a193['appCode']),{sqlName:_0x2eefeb,dbId:_0x4a4019,dbName:_0x2fdc3a,mode:_0x396ebe}=await resolveSqlNewInputs(_0x39a193),_0xd15e9a=buildSqlRelativePath(_0x4f9f17(0x107),_0x2eefeb,_0x2fdc3a,_0x396ebe,_0x4a4019),_0x3430d2=_0x178122[_0x4f9f17(0x105)]+'/'+_0xd15e9a;return{'method':'POST','url':_0x4f9f17(0x11c),'body':{'appCode':_0x39a193[_0x4f9f17(0x117)],'sqlName':_0x2eefeb,'dbId':_0x4a4019,'mode':_0x396ebe,'localPath':_0x3430d2},'description':_0x4f9f17(0x119)+_0x178122[_0x4f9f17(0x105)]};},async 'execute'(_0xaf8054){const _0x2809b4=a177_0x29b9fc,_0x34f561=loadSqlProjectConfig(_0xaf8054[_0x2809b4(0x117)]),{sqlName:_0x4a1ea1,dbId:_0x577895,dbName:_0x224bb7,mode:_0x5b88ba}=await resolveSqlNewInputs(_0xaf8054),_0x24f741=generateSqlTemplate(_0x5b88ba),_0x41e15c=await createSqlQuery({'appCode':_0xaf8054[_0x2809b4(0x117)],'sqlName':_0x4a1ea1,'dbId':_0x577895,'sqlContent':_0x24f741}),_0x14ecb5=ensureRemoteSqlContent(_0x41e15c),_0x4b485b=_0x224bb7||await getDbName(_0xaf8054[_0x2809b4(0x117)],_0x577895)[_0x2809b4(0xe8)](()=>undefined),_0x3cbcfd=buildSqlRelativePath(_0x41e15c[_0x2809b4(0x110)],_0x41e15c[_0x2809b4(0xed)],_0x4b485b,_0x5b88ba,_0x577895),_0x2f9969=_0x34f561[_0x2809b4(0x105)]+'/'+_0x3cbcfd,_0x39ce95=buildLocalSqlFileContent({'sqlCode':_0x41e15c[_0x2809b4(0x110)],'sqlName':_0x41e15c[_0x2809b4(0xed)],'dbId':_0x41e15c[_0x2809b4(0xfd)]},_0x14ecb5,{'dbName':_0x4b485b,'mode':_0x5b88ba,'syncedAt':new Date()[_0x2809b4(0x112)](),'description':_0x41e15c['description']});if(await fileExists(_0x2f9969))throw CliErrors[_0x2809b4(0x113)](_0x2809b4(0xf4)+_0x2f9969);await ensureParentDirectory(_0x2f9969),await writeFile(_0x2f9969,_0x39ce95,_0x2809b4(0x109));const _0x19836a=await readSqlLockFile(_0x34f561['lockFilePath']),{lockData:_0x56294e,appLock:_0x26e5b6}=ensureSqlLockScope(_0x19836a??createEmptySqlLock(),_0x34f561[_0x2809b4(0x117)],_0x34f561[_0x2809b4(0xe5)],'new');return _0x26e5b6[_0x2809b4(0xf5)][_0x41e15c[_0x2809b4(0x110)]]={...buildSqlLockEntry(_0x41e15c,_0x14ecb5,computeSqlContentHash(_0x39ce95),{'dbName':_0x4b485b}),'path':_0x3cbcfd,'mode':_0x5b88ba},_0x26e5b6[_0x2809b4(0x10f)]=new Date()[_0x2809b4(0x112)](),await writeSqlLockFile(_0x34f561[_0x2809b4(0xef)],_0x56294e),{'ok':!![],'data':{'id':_0x41e15c['id'],'sqlCode':_0x41e15c[_0x2809b4(0x110)],'sqlName':_0x41e15c[_0x2809b4(0xed)],'dbId':_0x41e15c[_0x2809b4(0xfd)],'path':_0x2f9969,'mode':_0x5b88ba},'message':_0x2809b4(0xe0)+_0x41e15c[_0x2809b4(0x110)]};}};async function resolveSqlNewInputs(_0x49bac3){const _0x495af1=await resolveSqlNameInput(_0x49bac3),{dbId:_0x434df3,dbName:_0x212937}=await resolveDbSelection(_0x49bac3),_0x454c80=await resolveSqlModeInput(_0x49bac3);return{'sqlName':_0x495af1,'dbId':_0x434df3,'dbName':_0x212937,'mode':_0x454c80};}function a177_0x1efd(_0xa919e8,_0x528a56){_0xa919e8=_0xa919e8-0xe0;const _0xb59340=a177_0xb593();let _0x1efdba=_0xb59340[_0xa919e8];return _0x1efdba;}async function resolveSqlNameInput(_0x1632d7){const _0x5f54c5=a177_0x29b9fc,_0x9d6284=_0x1632d7[_0x5f54c5(0xf0)]('name')[_0x5f54c5(0xe1)]();if(_0x9d6284)return _0x9d6284;if(_0x1632d7['nonInteractive'])throw CliErrors[_0x5f54c5(0xea)]('name',_0x5f54c5(0x11e));return(await input({'message':_0x5f54c5(0xe9),'validate':_0x7bd9bc=>_0x7bd9bc['trim']()?!![]:_0x5f54c5(0xf9)}))[_0x5f54c5(0xe1)]();}async function resolveDbSelection(_0x59bdc3){const _0x3cebc5=a177_0x29b9fc,_0x2e638e=resolveProvidedDbId(_0x59bdc3);if(typeof _0x2e638e==='number'&&Number['isFinite'](_0x2e638e)&&_0x2e638e>0x0)return{'dbId':_0x2e638e,'dbName':await getDbName(_0x59bdc3[_0x3cebc5(0x117)],_0x2e638e)[_0x3cebc5(0xe8)](()=>undefined)};if(_0x59bdc3['nonInteractive'])throw CliErrors[_0x3cebc5(0xea)](_0x3cebc5(0xfc),_0x3cebc5(0xe7));const _0x3de581=await listDatabases(_0x59bdc3[_0x3cebc5(0x117)])['catch'](()=>[]);if(_0x3de581[_0x3cebc5(0xe2)]===0x1)return{'dbId':_0x3de581[0x0][_0x3cebc5(0xfd)],'dbName':_0x3de581[0x0]['dbName']};if(_0x3de581[_0x3cebc5(0xe2)]>0x1){const _0x67a454=await select({'message':_0x3cebc5(0x10c),'choices':[..._0x3de581['map'](_0x53024d=>({'name':_0x53024d['dbName']+'\x20('+_0x53024d[_0x3cebc5(0xfd)]+')','value':serializeDbSelection(_0x53024d)})),{'name':'✎\x20手动输入\x20dbId','value':_0x3cebc5(0x106)}]});if(_0x67a454!==_0x3cebc5(0x106))return deserializeDbSelection(_0x67a454);}const _0x106e1e=await input({'message':'请输入目标数据库\x20dbId:','validate':_0x2d3ca1=>{const _0x279822=_0x3cebc5,_0x44c4fd=_0x2d3ca1[_0x279822(0xe1)]();if(!_0x44c4fd)return _0x279822(0xeb);const _0x10298e=Number(_0x44c4fd);if(!Number[_0x279822(0x114)](_0x10298e)||_0x10298e<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x106e1e[_0x3cebc5(0xe1)]())};}async function resolveSqlModeInput(_0x4a3f16){const _0xeda318=a177_0x29b9fc,_0xfde804=_0x4a3f16[_0xeda318(0xf0)](_0xeda318(0xf3))[_0xeda318(0xe1)]();if(_0xfde804===_0xeda318(0x11a)||_0xfde804===_0xeda318(0xf6))return _0xfde804;if(_0x4a3f16[_0xeda318(0x11b)])throw CliErrors[_0xeda318(0xea)](_0xeda318(0xf3),_0xeda318(0x115));return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':'普通\x20SQL(sql)','value':_0xeda318(0x11a),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0xeda318(0x10a),'value':_0xeda318(0xf6),'description':_0xeda318(0x101)}]});}function serializeDbSelection(_0x3123bf){const _0x4b60f7=a177_0x29b9fc;return JSON['stringify']({'dbId':_0x3123bf[_0x4b60f7(0xfd)],'dbName':_0x3123bf[_0x4b60f7(0x118)]});}function deserializeDbSelection(_0x2691af){const _0x5d0030=a177_0x29b9fc;try{const _0x326e1e=JSON[_0x5d0030(0x108)](_0x2691af);if(typeof _0x326e1e[_0x5d0030(0xfd)]==='number'&&Number[_0x5d0030(0xf8)](_0x326e1e[_0x5d0030(0xfd)]))return{'dbId':_0x326e1e['dbId'],'dbName':_0x326e1e['dbName']};}catch{}throw CliErrors['validation'](_0x5d0030(0xfb)+_0x2691af);}function resolveProvidedDbId(_0x69e85a){const _0x1f0705=a177_0x29b9fc,_0x4a3184=_0x69e85a[_0x1f0705(0x103)](_0x1f0705(0xfc));if(typeof _0x4a3184===_0x1f0705(0x111)&&Number['isFinite'](_0x4a3184))return _0x4a3184;return undefined;}
1
+ const a176_0xb697b2=a176_0xf1a1;(function(_0x9b77c7,_0x34e3d7){const _0x58ab31=a176_0xf1a1,_0x281983=_0x9b77c7();while(!![]){try{const _0x450c71=parseInt(_0x58ab31(0x193))/0x1+-parseInt(_0x58ab31(0x194))/0x2+parseInt(_0x58ab31(0x18c))/0x3+-parseInt(_0x58ab31(0x199))/0x4+parseInt(_0x58ab31(0x1a6))/0x5*(-parseInt(_0x58ab31(0x192))/0x6)+-parseInt(_0x58ab31(0x1be))/0x7+parseInt(_0x58ab31(0x1ca))/0x8;if(_0x450c71===_0x34e3d7)break;else _0x281983['push'](_0x281983['shift']());}catch(_0x2219b8){_0x281983['push'](_0x281983['shift']());}}}(a176_0x52b5,0x7ee0f));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';function a176_0xf1a1(_0x1a6c45,_0x254739){_0x1a6c45=_0x1a6c45-0x186;const _0x52b535=a176_0x52b5();let _0xf1a134=_0x52b535[_0x1a6c45];return _0xf1a134;}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(_0x15f9b0){const _0x2b8f54=a176_0xf1a1;if(_0x15f9b0===_0x2b8f54(0x18b))return[_0x2b8f54(0x1c2),'\x20\x20SELECT\x201\x20AS\x20id',_0x2b8f54(0x19c),''][_0x2b8f54(0x190)]('\x0a');return[_0x2b8f54(0x197),'']['join']('\x0a');}export const sqlCreate={'service':a176_0xb697b2(0x19a),'command':a176_0xb697b2(0x1c1),'description':a176_0xb697b2(0x198),'risk':a176_0xb697b2(0x18a),'flags':[{'name':a176_0xb697b2(0x188),'type':a176_0xb697b2(0x1a0),'description':a176_0xb697b2(0x1b8)},{'name':a176_0xb697b2(0x19d),'type':a176_0xb697b2(0x1b3),'description':a176_0xb697b2(0x1af)},{'name':a176_0xb697b2(0x1c5),'type':a176_0xb697b2(0x1a0),'enum':['sql',a176_0xb697b2(0x18b)],'description':a176_0xb697b2(0x186)}],async 'validate'(_0x120c46){const _0x17a877=a176_0xb697b2;if(!_0x120c46[_0x17a877(0x1c3)])return;if(!_0x120c46['str']('name')['trim']())throw CliErrors[_0x17a877(0x1a3)](_0x17a877(0x188),_0x17a877(0x1b7));const _0x1c8e20=resolveProvidedDbId(_0x120c46);if(typeof _0x1c8e20!==_0x17a877(0x1b3)||!Number[_0x17a877(0x1bb)](_0x1c8e20)||_0x1c8e20<=0x0)throw CliErrors[_0x17a877(0x1a3)](_0x17a877(0x19d),_0x17a877(0x1c8));if(!_0x120c46[_0x17a877(0x1a4)](_0x17a877(0x1c5))[_0x17a877(0x191)]())throw CliErrors[_0x17a877(0x1a3)](_0x17a877(0x1c5),_0x17a877(0x1a5));},async 'dryRun'(_0x3db762){const _0x3a3cf2=a176_0xb697b2,_0x3a9ca7=loadSqlProjectConfig(_0x3db762[_0x3a3cf2(0x19f)]),{sqlName:_0x49d839,dbId:_0x297502,dbName:_0x8c66ef,mode:_0x1d50e8}=await resolveSqlNewInputs(_0x3db762),_0x45581a=buildSqlRelativePath(_0x3a3cf2(0x18f),_0x49d839,_0x8c66ef,_0x1d50e8,_0x297502),_0x163405=_0x3a9ca7[_0x3a3cf2(0x189)]+'/'+_0x45581a;return{'method':'POST','url':_0x3a3cf2(0x1b9),'body':{'appCode':_0x3db762[_0x3a3cf2(0x19f)],'sqlName':_0x49d839,'dbId':_0x297502,'mode':_0x1d50e8,'localPath':_0x163405},'description':_0x3a3cf2(0x195)+_0x3a9ca7[_0x3a3cf2(0x189)]};},async 'execute'(_0x2e154b){const _0x1ac0c9=a176_0xb697b2,_0x1dc73f=loadSqlProjectConfig(_0x2e154b[_0x1ac0c9(0x19f)]),{sqlName:_0x3bf90a,dbId:_0x38a7c5,dbName:_0xeb1c7c,mode:_0x370ea9}=await resolveSqlNewInputs(_0x2e154b),_0x1f8a91=generateSqlTemplate(_0x370ea9),_0x40cfc0=await createSqlQuery({'appCode':_0x2e154b['appCode'],'sqlName':_0x3bf90a,'dbId':_0x38a7c5,'sqlContent':_0x1f8a91}),_0x325f09=ensureRemoteSqlContent(_0x40cfc0),_0x3b6413=_0xeb1c7c||await getDbName(_0x2e154b['appCode'],_0x38a7c5)['catch'](()=>undefined),_0x1a8596=buildSqlRelativePath(_0x40cfc0[_0x1ac0c9(0x187)],_0x40cfc0[_0x1ac0c9(0x1c9)],_0x3b6413,_0x370ea9,_0x38a7c5),_0x527b2d=_0x1dc73f[_0x1ac0c9(0x189)]+'/'+_0x1a8596,_0x5dee16=buildLocalSqlFileContent({'sqlCode':_0x40cfc0[_0x1ac0c9(0x187)],'sqlName':_0x40cfc0[_0x1ac0c9(0x1c9)],'dbId':_0x40cfc0[_0x1ac0c9(0x1b2)]},_0x325f09,{'dbName':_0x3b6413,'mode':_0x370ea9,'syncedAt':new Date()[_0x1ac0c9(0x1c4)](),'description':_0x40cfc0[_0x1ac0c9(0x1cb)]});if(await fileExists(_0x527b2d))throw CliErrors[_0x1ac0c9(0x1c6)](_0x1ac0c9(0x1a1)+_0x527b2d);await ensureParentDirectory(_0x527b2d),await writeFile(_0x527b2d,_0x5dee16,_0x1ac0c9(0x1b6));const _0x52a6a2=await readSqlLockFile(_0x1dc73f['lockFilePath']),{lockData:_0x1f01b7,appLock:_0x54993b}=ensureSqlLockScope(_0x52a6a2??createEmptySqlLock(),_0x1dc73f[_0x1ac0c9(0x19f)],_0x1dc73f[_0x1ac0c9(0x18e)],_0x1ac0c9(0x1b4));return _0x54993b[_0x1ac0c9(0x1aa)][_0x40cfc0[_0x1ac0c9(0x187)]]={...buildSqlLockEntry(_0x40cfc0,_0x325f09,computeSqlContentHash(_0x5dee16),{'dbName':_0x3b6413}),'path':_0x1a8596,'mode':_0x370ea9},_0x54993b[_0x1ac0c9(0x19b)]=new Date()[_0x1ac0c9(0x1c4)](),await writeSqlLockFile(_0x1dc73f['lockFilePath'],_0x1f01b7),{'ok':!![],'data':{'id':_0x40cfc0['id'],'sqlCode':_0x40cfc0[_0x1ac0c9(0x187)],'sqlName':_0x40cfc0[_0x1ac0c9(0x1c9)],'dbId':_0x40cfc0[_0x1ac0c9(0x1b2)],'path':_0x527b2d,'mode':_0x370ea9},'message':'Created\x20SQL\x20query\x20'+_0x40cfc0[_0x1ac0c9(0x187)]};}};async function resolveSqlNewInputs(_0x22e6fa){const _0x14f04d=await resolveSqlNameInput(_0x22e6fa),{dbId:_0x14780c,dbName:_0x17b447}=await resolveDbSelection(_0x22e6fa),_0x256307=await resolveSqlModeInput(_0x22e6fa);return{'sqlName':_0x14f04d,'dbId':_0x14780c,'dbName':_0x17b447,'mode':_0x256307};}function a176_0x52b5(){const _0x2ea6ef=['普通\x20SQL(sql)','SELECT\x201\x20AS\x20id;','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','3009376AHasvo','sql','lastSync','</select>','db-id','length','appCode','string','File\x20already\x20exists:\x20','isInteger','flagMissing','str','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','5yaOZHi','stringify','SQL\x20名称不能为空','flag','sqls','parse','请输入\x20SQL\x20名称:','适合带动态标签的\x20MyBatis\x20XML\x20SQL','MyBatis\x20XML(mybatisXml)','Target\x20database\x20ID','dbName','Invalid\x20database\x20selection\x20payload:\x20','dbId','number','new','dbId\x20必须为正整数','utf8','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20query\x20display\x20name','/smartapi/custom/saveUserCustomSql','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','isFinite','请输入目标数据库\x20dbId:','✎\x20手动输入\x20dbId','1266384aGszpK','请选择目标数据库:','map','create','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','nonInteractive','toISOString','mode','validation','catch','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlName','16002368oXblru','description','Local\x20SQL\x20file\x20mode','sqlCode','name','sqlRootDir','high-risk-write','mybatisXml','1594032HguBff','请选择本地\x20SQL\x20模式:','sqlRoot','<server-generated-sqlCode>','join','trim','5183778vWsXHb','818614tmbygO','2066680EoZWeM','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'];a176_0x52b5=function(){return _0x2ea6ef;};return a176_0x52b5();}async function resolveSqlNameInput(_0x10a0cf){const _0x16ec75=a176_0xb697b2,_0x53391e=_0x10a0cf[_0x16ec75(0x1a4)](_0x16ec75(0x188))['trim']();if(_0x53391e)return _0x53391e;if(_0x10a0cf[_0x16ec75(0x1c3)])throw CliErrors[_0x16ec75(0x1a3)](_0x16ec75(0x188),_0x16ec75(0x1b7));return(await input({'message':_0x16ec75(0x1ac),'validate':_0x2ab96f=>_0x2ab96f['trim']()?!![]:_0x16ec75(0x1a8)}))[_0x16ec75(0x191)]();}async function resolveDbSelection(_0x2cee87){const _0x370d2e=a176_0xb697b2,_0x17868f=resolveProvidedDbId(_0x2cee87);if(typeof _0x17868f==='number'&&Number[_0x370d2e(0x1bb)](_0x17868f)&&_0x17868f>0x0)return{'dbId':_0x17868f,'dbName':await getDbName(_0x2cee87[_0x370d2e(0x19f)],_0x17868f)[_0x370d2e(0x1c7)](()=>undefined)};if(_0x2cee87['nonInteractive'])throw CliErrors[_0x370d2e(0x1a3)]('db-id',_0x370d2e(0x1c8));const _0x3475c7=await listDatabases(_0x2cee87['appCode'])[_0x370d2e(0x1c7)](()=>[]);if(_0x3475c7['length']===0x1)return{'dbId':_0x3475c7[0x0][_0x370d2e(0x1b2)],'dbName':_0x3475c7[0x0][_0x370d2e(0x1b0)]};if(_0x3475c7[_0x370d2e(0x19e)]>0x1){const _0x943d1b=await select({'message':_0x370d2e(0x1bf),'choices':[..._0x3475c7[_0x370d2e(0x1c0)](_0x29e296=>({'name':_0x29e296[_0x370d2e(0x1b0)]+'\x20('+_0x29e296[_0x370d2e(0x1b2)]+')','value':serializeDbSelection(_0x29e296)})),{'name':_0x370d2e(0x1bd),'value':'__manual__'}]});if(_0x943d1b!=='__manual__')return deserializeDbSelection(_0x943d1b);}const _0x543494=await input({'message':_0x370d2e(0x1bc),'validate':_0x4c4a9d=>{const _0x168425=_0x370d2e,_0x1e3600=_0x4c4a9d[_0x168425(0x191)]();if(!_0x1e3600)return'dbId\x20不能为空';const _0x485fe0=Number(_0x1e3600);if(!Number[_0x168425(0x1a2)](_0x485fe0)||_0x485fe0<=0x0)return _0x168425(0x1b5);return!![];}});return{'dbId':Number(_0x543494[_0x370d2e(0x191)]())};}async function resolveSqlModeInput(_0x278ab5){const _0x2340f4=a176_0xb697b2,_0x15cd34=_0x278ab5[_0x2340f4(0x1a4)](_0x2340f4(0x1c5))[_0x2340f4(0x191)]();if(_0x15cd34==='sql'||_0x15cd34===_0x2340f4(0x18b))return _0x15cd34;if(_0x278ab5[_0x2340f4(0x1c3)])throw CliErrors[_0x2340f4(0x1a3)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x2340f4(0x18d),'choices':[{'name':_0x2340f4(0x196),'value':_0x2340f4(0x19a),'description':_0x2340f4(0x1ba)},{'name':_0x2340f4(0x1ae),'value':_0x2340f4(0x18b),'description':_0x2340f4(0x1ad)}]});}function serializeDbSelection(_0x2f01e5){const _0x3954d0=a176_0xb697b2;return JSON[_0x3954d0(0x1a7)]({'dbId':_0x2f01e5['dbId'],'dbName':_0x2f01e5[_0x3954d0(0x1b0)]});}function deserializeDbSelection(_0x55b186){const _0xb01455=a176_0xb697b2;try{const _0x4ef6e6=JSON[_0xb01455(0x1ab)](_0x55b186);if(typeof _0x4ef6e6[_0xb01455(0x1b2)]===_0xb01455(0x1b3)&&Number[_0xb01455(0x1bb)](_0x4ef6e6[_0xb01455(0x1b2)]))return{'dbId':_0x4ef6e6[_0xb01455(0x1b2)],'dbName':_0x4ef6e6[_0xb01455(0x1b0)]};}catch{}throw CliErrors[_0xb01455(0x1c6)](_0xb01455(0x1b1)+_0x55b186);}function resolveProvidedDbId(_0x21a341){const _0x681269=a176_0xb697b2,_0x3e650f=_0x21a341[_0x681269(0x1a9)](_0x681269(0x19d));if(typeof _0x3e650f===_0x681269(0x1b3)&&Number[_0x681269(0x1bb)](_0x3e650f))return _0x3e650f;return undefined;}
@@ -1 +1 @@
1
- const a178_0x1df11f=a178_0x4c3f;function a178_0x427a(){const _0x1203c0=['POST','high-risk-write','SQL\x20lock\x20file\x20not\x20found.','str','replace','1891040NPZidr','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','5McPSBq','lastSync','fromEntries','validation','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','projectRoot','delete','1872717SvRBUp','remoteId','Would\x20delete\x20SQL\x20','5262363HdDRRo','10TdtEQu','sqls','appCode','91JSVXnO','\x20(local\x20file\x20moved\x20to\x20trash)','252730iCEcTv','1626216Fbfxlp','lockFilePath','filter','/smartapi/custom/deleteUserCustomSql','70352xrbknt','3516348rnMvKc','sqlRootDir','startsWith','trashDir','trashedTo','Deleted\x20','toISOString'];a178_0x427a=function(){return _0x1203c0;};return a178_0x427a();}(function(_0x3d510c,_0x176b66){const _0x7a8ade=a178_0x4c3f,_0x175bec=_0x3d510c();while(!![]){try{const _0xefd776=parseInt(_0x7a8ade(0x19c))/0x1+parseInt(_0x7a8ade(0x18a))/0x2+-parseInt(_0x7a8ade(0x193))/0x3+-parseInt(_0x7a8ade(0x17e))/0x4*(parseInt(_0x7a8ade(0x18c))/0x5)+parseInt(_0x7a8ade(0x19d))/0x6+parseInt(_0x7a8ade(0x19a))/0x7*(parseInt(_0x7a8ade(0x17d))/0x8)+parseInt(_0x7a8ade(0x196))/0x9*(parseInt(_0x7a8ade(0x197))/0xa);if(_0xefd776===_0x176b66)break;else _0x175bec['push'](_0x175bec['shift']());}catch(_0x1ba0ba){_0x175bec['push'](_0x175bec['shift']());}}}(a178_0x427a,0xa259d));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';function a178_0x4c3f(_0x3b6ee0,_0x3afd1c){_0x3b6ee0=_0x3b6ee0-0x17a;const _0x427ad8=a178_0x427a();let _0x4c3f77=_0x427ad8[_0x3b6ee0];return _0x4c3f77;}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':a178_0x1df11f(0x192),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a178_0x1df11f(0x186),'flags':[SQLCODE_FLAG],async 'validate'(_0x23d69b){const _0x178903=a178_0x1df11f,_0x3903fb=loadSqlProjectConfig(_0x23d69b[_0x178903(0x199)]),_0x15dbe1=await readSqlLockFile(_0x3903fb[_0x178903(0x17a)]);if(!_0x15dbe1)throw CliErrors['validation'](_0x178903(0x190));},async 'dryRun'(_0x37f2cd){const _0x2ee747=a178_0x1df11f,_0xbedcc1=loadSqlProjectConfig(_0x37f2cd[_0x2ee747(0x199)]),_0x5b2550=await readSqlLockFile(_0xbedcc1[_0x2ee747(0x17a)]);if(!_0x5b2550)throw CliErrors[_0x2ee747(0x18f)](_0x2ee747(0x190));const {appLock:_0x44d32e}=ensureSqlLockScope(_0x5b2550,_0x37f2cd[_0x2ee747(0x199)],_0xbedcc1['sqlRoot'],'delete'),_0x40687f=_0x37f2cd[_0x2ee747(0x188)]('sqlcode'),_0x1ce2ce=_0x44d32e['sqls'][_0x40687f];if(!_0x1ce2ce)throw CliErrors[_0x2ee747(0x18f)](_0x2ee747(0x18b)+_0x40687f+'\x22.');return{'method':_0x2ee747(0x185),'url':_0x2ee747(0x17c),'body':{'sqlCode':_0x40687f,'id':_0x1ce2ce[_0x2ee747(0x194)],'localPath':resolveLocalSqlFilePath(_0xbedcc1,_0x40687f,_0x1ce2ce)},'description':_0x2ee747(0x195)+_0x40687f+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0xbedcc1[_0x2ee747(0x181)]};},async 'execute'(_0x22f596){const _0x5f3c9f=a178_0x1df11f,_0x39f8ed=loadSqlProjectConfig(_0x22f596[_0x5f3c9f(0x199)]),_0x471598=await readSqlLockFile(_0x39f8ed['lockFilePath']);if(!_0x471598)throw CliErrors[_0x5f3c9f(0x18f)](_0x5f3c9f(0x187));const {lockData:_0x207259,appLock:_0x549e06}=ensureSqlLockScope(_0x471598,_0x22f596[_0x5f3c9f(0x199)],_0x39f8ed['sqlRoot'],_0x5f3c9f(0x192)),_0x359b24=_0x22f596[_0x5f3c9f(0x188)]('sqlcode'),_0x2e5429=_0x549e06['sqls'][_0x359b24];if(!_0x2e5429)throw CliErrors[_0x5f3c9f(0x18f)](_0x5f3c9f(0x18b)+_0x359b24+'\x22.');await deleteSqlQuery({'id':_0x2e5429[_0x5f3c9f(0x194)],'sqlCode':_0x359b24}),_0x549e06[_0x5f3c9f(0x198)]=Object[_0x5f3c9f(0x18e)](Object['entries'](_0x549e06[_0x5f3c9f(0x198)])[_0x5f3c9f(0x17b)](([_0x6eaa4e])=>_0x6eaa4e!==_0x359b24)),_0x549e06[_0x5f3c9f(0x18d)]=new Date()[_0x5f3c9f(0x184)](),await writeSqlLockFile(_0x39f8ed[_0x5f3c9f(0x17a)],_0x207259);const _0x4d473c=resolveLocalSqlFilePath(_0x39f8ed,_0x359b24,_0x2e5429);let _0x4e6817;await fileExists(_0x4d473c)&&(_0x4e6817=await moveToTrash(_0x39f8ed[_0x5f3c9f(0x191)],_0x39f8ed[_0x5f3c9f(0x181)],_0x4d473c),await cleanupEmptyDirectories(dirname(_0x4d473c),_0x39f8ed[_0x5f3c9f(0x17f)]));const _0x19f5eb={'deleted':_0x359b24,'remoteId':_0x2e5429['remoteId']};if(_0x4e6817)_0x19f5eb[_0x5f3c9f(0x182)]=_0x4e6817;return{'ok':!![],'data':_0x19f5eb,'message':_0x5f3c9f(0x183)+_0x359b24+(_0x4e6817?_0x5f3c9f(0x19b):'')};}};async function moveToTrash(_0x718c06,_0x4ffe94,_0x176650){const _0x809bc6=a178_0x1df11f,_0x577b49=new Date()[_0x809bc6(0x184)]()[_0x809bc6(0x189)](/[:.]/g,'-'),_0x5e875c=relative(_0x718c06,_0x176650),_0x5a4279=join(_0x4ffe94,_0x577b49,_0x5e875c);return await mkdir(dirname(_0x5a4279),{'recursive':!![]}),await rename(_0x176650,_0x5a4279),_0x5a4279;}async function cleanupEmptyDirectories(_0x78b0f2,_0x2acf9d){const _0x18016a=a178_0x1df11f;let _0x5e14c5=resolve(_0x78b0f2);const _0x18367c=resolve(_0x2acf9d);while(_0x5e14c5[_0x18016a(0x180)](''+_0x18367c+sep)||_0x5e14c5===_0x18367c){if(_0x5e14c5===_0x18367c)return;try{const _0x11fd47=await readdir(_0x5e14c5);if(_0x11fd47['length']>0x0)return;await rmdir(_0x5e14c5);}catch{return;}_0x5e14c5=dirname(_0x5e14c5);}}
1
+ const a177_0x3fc80c=a177_0x3138;(function(_0x36fb71,_0xf921f1){const _0x305eaa=a177_0x3138,_0x28b6b7=_0x36fb71();while(!![]){try{const _0x541671=-parseInt(_0x305eaa(0xbb))/0x1*(parseInt(_0x305eaa(0x97))/0x2)+parseInt(_0x305eaa(0xb6))/0x3*(-parseInt(_0x305eaa(0xad))/0x4)+parseInt(_0x305eaa(0x96))/0x5*(-parseInt(_0x305eaa(0xa4))/0x6)+parseInt(_0x305eaa(0x9e))/0x7+-parseInt(_0x305eaa(0xbc))/0x8+parseInt(_0x305eaa(0xb5))/0x9*(-parseInt(_0x305eaa(0xab))/0xa)+parseInt(_0x305eaa(0xb9))/0xb*(parseInt(_0x305eaa(0xb0))/0xc);if(_0x541671===_0xf921f1)break;else _0x28b6b7['push'](_0x28b6b7['shift']());}catch(_0x24762f){_0x28b6b7['push'](_0x28b6b7['shift']());}}}(a177_0x5b76,0x24875));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':a177_0x3fc80c(0x99),'command':'delete','description':a177_0x3fc80c(0xb3),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x8fea1){const _0x1412e9=a177_0x3fc80c,_0x2ed10e=loadSqlProjectConfig(_0x8fea1[_0x1412e9(0xae)]),_0x25b9ff=await readSqlLockFile(_0x2ed10e[_0x1412e9(0xac)]);if(!_0x25b9ff)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x1282c6){const _0x32c278=a177_0x3fc80c,_0x5556d0=loadSqlProjectConfig(_0x1282c6[_0x32c278(0xae)]),_0xfe1ef9=await readSqlLockFile(_0x5556d0[_0x32c278(0xac)]);if(!_0xfe1ef9)throw CliErrors['validation'](_0x32c278(0xaf));const {appLock:_0x2af492}=ensureSqlLockScope(_0xfe1ef9,_0x1282c6['appCode'],_0x5556d0[_0x32c278(0x9f)],_0x32c278(0xba)),_0x3b22df=_0x1282c6[_0x32c278(0xa3)](_0x32c278(0xa0)),_0x2f79ab=_0x2af492[_0x32c278(0x9d)][_0x3b22df];if(!_0x2f79ab)throw CliErrors[_0x32c278(0xbf)](_0x32c278(0xa1)+_0x3b22df+'\x22.');return{'method':_0x32c278(0x98),'url':_0x32c278(0xa2),'body':{'sqlCode':_0x3b22df,'id':_0x2f79ab[_0x32c278(0xb1)],'localPath':resolveLocalSqlFilePath(_0x5556d0,_0x3b22df,_0x2f79ab)},'description':_0x32c278(0xb2)+_0x3b22df+_0x32c278(0xa7)+_0x5556d0[_0x32c278(0xbe)]};},async 'execute'(_0x1432a7){const _0x1cee3d=a177_0x3fc80c,_0x347919=loadSqlProjectConfig(_0x1432a7[_0x1cee3d(0xae)]),_0x48ebc7=await readSqlLockFile(_0x347919[_0x1cee3d(0xac)]);if(!_0x48ebc7)throw CliErrors[_0x1cee3d(0xbf)](_0x1cee3d(0xb8));const {lockData:_0xd6ad86,appLock:_0x4c7b3e}=ensureSqlLockScope(_0x48ebc7,_0x1432a7['appCode'],_0x347919[_0x1cee3d(0x9f)],_0x1cee3d(0xba)),_0x4712b2=_0x1432a7[_0x1cee3d(0xa3)](_0x1cee3d(0xa0)),_0x1b943f=_0x4c7b3e[_0x1cee3d(0x9d)][_0x4712b2];if(!_0x1b943f)throw CliErrors[_0x1cee3d(0xbf)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x4712b2+'\x22.');await deleteSqlQuery({'id':_0x1b943f[_0x1cee3d(0xb1)],'sqlCode':_0x4712b2}),_0x4c7b3e[_0x1cee3d(0x9d)]=Object[_0x1cee3d(0x9c)](Object[_0x1cee3d(0xa5)](_0x4c7b3e['sqls'])[_0x1cee3d(0xa8)](([_0x54c8a9])=>_0x54c8a9!==_0x4712b2)),_0x4c7b3e[_0x1cee3d(0xa6)]=new Date()['toISOString'](),await writeSqlLockFile(_0x347919[_0x1cee3d(0xac)],_0xd6ad86);const _0x514118=resolveLocalSqlFilePath(_0x347919,_0x4712b2,_0x1b943f);let _0x30b0a0;await fileExists(_0x514118)&&(_0x30b0a0=await moveToTrash(_0x347919['projectRoot'],_0x347919[_0x1cee3d(0xbe)],_0x514118),await cleanupEmptyDirectories(dirname(_0x514118),_0x347919[_0x1cee3d(0xaa)]));const _0x18004c={'deleted':_0x4712b2,'remoteId':_0x1b943f[_0x1cee3d(0xb1)]};if(_0x30b0a0)_0x18004c[_0x1cee3d(0xbd)]=_0x30b0a0;return{'ok':!![],'data':_0x18004c,'message':_0x1cee3d(0xb4)+_0x4712b2+(_0x30b0a0?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function a177_0x5b76(){const _0x57c1ae=['entries','lastSync','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','filter','toISOString','sqlRootDir','1430JVcLMt','lockFilePath','7468GVDJDa','appCode','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','16392GkqxCv','remoteId','Would\x20delete\x20SQL\x20','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','Deleted\x20','387QPJjgt','69vvfQuV','startsWith','SQL\x20lock\x20file\x20not\x20found.','5753bjlahP','delete','1909qrgBqM','2020544wnMtLz','trashedTo','trashDir','validation','1375AVYuez','142fhBiyN','POST','sql','replace','length','fromEntries','sqls','933625DmQeMP','sqlRoot','sqlcode','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','/smartapi/custom/deleteUserCustomSql','str','5694YEQHZX'];a177_0x5b76=function(){return _0x57c1ae;};return a177_0x5b76();}async function moveToTrash(_0x34bc6b,_0x32928d,_0x469306){const _0x20ef04=a177_0x3fc80c,_0x322dc7=new Date()[_0x20ef04(0xa9)]()[_0x20ef04(0x9a)](/[:.]/g,'-'),_0x7a298=relative(_0x34bc6b,_0x469306),_0x3b15a7=join(_0x32928d,_0x322dc7,_0x7a298);return await mkdir(dirname(_0x3b15a7),{'recursive':!![]}),await rename(_0x469306,_0x3b15a7),_0x3b15a7;}function a177_0x3138(_0x234e41,_0x2773c8){_0x234e41=_0x234e41-0x96;const _0x5b760a=a177_0x5b76();let _0x313832=_0x5b760a[_0x234e41];return _0x313832;}async function cleanupEmptyDirectories(_0x109634,_0x279db6){const _0x5c15bb=a177_0x3fc80c;let _0x3e86e4=resolve(_0x109634);const _0x57e11b=resolve(_0x279db6);while(_0x3e86e4[_0x5c15bb(0xb7)](''+_0x57e11b+sep)||_0x3e86e4===_0x57e11b){if(_0x3e86e4===_0x57e11b)return;try{const _0x2cef73=await readdir(_0x3e86e4);if(_0x2cef73[_0x5c15bb(0x9b)]>0x0)return;await rmdir(_0x3e86e4);}catch{return;}_0x3e86e4=dirname(_0x3e86e4);}}
@@ -1 +1 @@
1
- function a179_0x4bd2(){const _0x4c219a=['1009464LOyUIO','description','7HjTlSD','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','1764OAvxcB','detail','44vitEFx','907470dJeNdE','appCode','verbose','7928HVJKnm','78IAxBAA','420504XroEFy','str','1590570HmsJkO','sqlcode','sqlCode','Return\x20full\x20raw\x20SQL\x20query\x20object','dbId','10rTeuKn','82398chXVlO','18746UgDusD'];a179_0x4bd2=function(){return _0x4c219a;};return a179_0x4bd2();}const a179_0x4921c3=a179_0x4d21;(function(_0x36561f,_0x4b7900){const _0x1cab27=a179_0x4d21,_0x1f5169=_0x36561f();while(!![]){try{const _0x5b38aa=-parseInt(_0x1cab27(0x1aa))/0x1+-parseInt(_0x1cab27(0x1ab))/0x2*(parseInt(_0x1cab27(0x1b7))/0x3)+parseInt(_0x1cab27(0x1b8))/0x4*(parseInt(_0x1cab27(0x1a9))/0x5)+-parseInt(_0x1cab27(0x1a4))/0x6*(parseInt(_0x1cab27(0x1ae))/0x7)+-parseInt(_0x1cab27(0x1b6))/0x8*(-parseInt(_0x1cab27(0x1b0))/0x9)+parseInt(_0x1cab27(0x1b3))/0xa+-parseInt(_0x1cab27(0x1b2))/0xb*(-parseInt(_0x1cab27(0x1ac))/0xc);if(_0x5b38aa===_0x4b7900)break;else _0x1f5169['push'](_0x1f5169['shift']());}catch(_0x4728d2){_0x1f5169['push'](_0x1f5169['shift']());}}}(a179_0x4bd2,0x3ab94));import{getSqlQueryInfo}from'../../core/api-client.js';function a179_0x4d21(_0x30cd8f,_0x529176){_0x30cd8f=_0x30cd8f-0x1a3;const _0x4bd2ed=a179_0x4bd2();let _0x4d213b=_0x4bd2ed[_0x30cd8f];return _0x4d213b;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':a179_0x4921c3(0x1b1),'description':a179_0x4921c3(0x1af),'risk':'read','flags':[SQLCODE_FLAG,{'name':a179_0x4921c3(0x1b5),'type':'boolean','description':a179_0x4921c3(0x1a7)}],async 'execute'(_0x205510){const _0x14c593=a179_0x4921c3,_0x1e9b07=await getSqlQueryInfo(_0x205510['appCode'],_0x205510[_0x14c593(0x1a3)](_0x14c593(0x1a5))),_0xd156=_0x205510['bool']('verbose');if(_0xd156)return{'ok':!![],'data':_0x1e9b07};const _0x13d5df=_0x1e9b07['dbId']?await getDbName(_0x205510[_0x14c593(0x1b4)],_0x1e9b07[_0x14c593(0x1a8)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x1e9b07[_0x14c593(0x1a6)],'sqlName':_0x1e9b07['sqlName'],'db':_0x13d5df?_0x13d5df+'\x20('+_0x1e9b07[_0x14c593(0x1a8)]+')':_0x1e9b07['dbId']??'','description':_0x1e9b07[_0x14c593(0x1ad)]??'','sqlContent':_0x1e9b07['sqlContent']??''}};}};
1
+ function a178_0x1b5b(){const _0x2db443=['dbId','description','sqlCode','65104yaaYsN','13825nNLmsK','22627544pXQVwd','1111209lncEfx','4071670WOGRLN','2909960ZEsziG','appCode','str','9WcOtlh','bool','1812AYguQc','verbose','read','Return\x20full\x20raw\x20SQL\x20query\x20object','489173pJRwyW','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode'];a178_0x1b5b=function(){return _0x2db443;};return a178_0x1b5b();}const a178_0x44d9c4=a178_0x17b2;(function(_0x10fa68,_0x13c524){const _0x41a1e6=a178_0x17b2,_0x1e36e2=_0x10fa68();while(!![]){try{const _0x47a5c9=-parseInt(_0x41a1e6(0x84))/0x1+-parseInt(_0x41a1e6(0x76))/0x2+parseInt(_0x41a1e6(0x79))/0x3+-parseInt(_0x41a1e6(0x7b))/0x4+-parseInt(_0x41a1e6(0x7a))/0x5+-parseInt(_0x41a1e6(0x80))/0x6*(parseInt(_0x41a1e6(0x77))/0x7)+parseInt(_0x41a1e6(0x78))/0x8*(parseInt(_0x41a1e6(0x7e))/0x9);if(_0x47a5c9===_0x13c524)break;else _0x1e36e2['push'](_0x1e36e2['shift']());}catch(_0x426d4b){_0x1e36e2['push'](_0x1e36e2['shift']());}}}(a178_0x1b5b,0x838df));function a178_0x17b2(_0x9fb1fb,_0x22afe5){_0x9fb1fb=_0x9fb1fb-0x73;const _0x1b5bd8=a178_0x1b5b();let _0x17b284=_0x1b5bd8[_0x9fb1fb];return _0x17b284;}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':'detail','description':a178_0x44d9c4(0x85),'risk':a178_0x44d9c4(0x82),'flags':[SQLCODE_FLAG,{'name':'verbose','type':'boolean','description':a178_0x44d9c4(0x83)}],async 'execute'(_0x34d404){const _0x47982d=a178_0x44d9c4,_0x3a604b=await getSqlQueryInfo(_0x34d404[_0x47982d(0x7c)],_0x34d404[_0x47982d(0x7d)]('sqlcode')),_0x30737e=_0x34d404[_0x47982d(0x7f)](_0x47982d(0x81));if(_0x30737e)return{'ok':!![],'data':_0x3a604b};const _0x3cd1f2=_0x3a604b[_0x47982d(0x73)]?await getDbName(_0x34d404[_0x47982d(0x7c)],_0x3a604b[_0x47982d(0x73)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x3a604b[_0x47982d(0x75)],'sqlName':_0x3a604b['sqlName'],'db':_0x3cd1f2?_0x3cd1f2+'\x20('+_0x3a604b[_0x47982d(0x73)]+')':_0x3a604b[_0x47982d(0x73)]??'','description':_0x3a604b[_0x47982d(0x74)]??'','sqlContent':_0x3a604b['sqlContent']??''}};}};
@@ -1 +1 @@
1
- function a180_0x2b71(_0x17fb82,_0x53da71){_0x17fb82=_0x17fb82-0x119;const _0x274464=a180_0x2744();let _0x2b71d9=_0x274464[_0x17fb82];return _0x2b71d9;}const a180_0x5aa633=a180_0x2b71;(function(_0x4e7b51,_0x39a9fc){const _0x118766=a180_0x2b71,_0x1605b2=_0x4e7b51();while(!![]){try{const _0x3fd7c0=parseInt(_0x118766(0x11d))/0x1+-parseInt(_0x118766(0x11e))/0x2*(parseInt(_0x118766(0x12b))/0x3)+parseInt(_0x118766(0x128))/0x4*(-parseInt(_0x118766(0x11f))/0x5)+-parseInt(_0x118766(0x132))/0x6*(-parseInt(_0x118766(0x119))/0x7)+-parseInt(_0x118766(0x12e))/0x8+parseInt(_0x118766(0x121))/0x9*(parseInt(_0x118766(0x130))/0xa)+-parseInt(_0x118766(0x11c))/0xb*(-parseInt(_0x118766(0x12a))/0xc);if(_0x3fd7c0===_0x39a9fc)break;else _0x1605b2['push'](_0x1605b2['shift']());}catch(_0x35f736){_0x1605b2['push'](_0x1605b2['shift']());}}}(a180_0x2744,0x8dcc1));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':'sql','command':a180_0x5aa633(0x12f),'description':a180_0x5aa633(0x12c),'risk':a180_0x5aa633(0x11b),'flags':[SQLCODE_FLAG,{'name':a180_0x5aa633(0x120),'type':a180_0x5aa633(0x131),'description':a180_0x5aa633(0x125)}],async 'execute'(_0x1efbc1){const _0x466445=a180_0x5aa633,_0x3f8c51=parseJsonParams(_0x1efbc1[_0x466445(0x126)](_0x466445(0x120))),_0x19ce99=Date['now'](),_0xd4f1bb=await executeSql(_0x1efbc1['appCode'],_0x1efbc1[_0x466445(0x126)]('sqlcode'),_0x3f8c51),_0x42b1d3=Date[_0x466445(0x12d)]()-_0x19ce99,_0x10355c=_0xd4f1bb?.[_0x466445(0x123)]??_0xd4f1bb,_0x4e3b4e=_0xd4f1bb?.[_0x466445(0x127)]??!![];if(!_0x4e3b4e)return{'ok':![],'data':{'error':_0xd4f1bb?.[_0x466445(0x129)]||_0x466445(0x11a),'elapsed':_0x42b1d3},'message':'SQL\x20execution\x20failed'};const _0x1c90fd=Array[_0x466445(0x122)](_0x10355c)?_0x10355c:[];return{'ok':!![],'data':{'rows':_0x1c90fd,'rowCount':_0x1c90fd[_0x466445(0x124)],'elapsed':_0x42b1d3},'message':'Returned\x20'+_0x1c90fd['length']+'\x20row(s)\x20in\x20'+_0x42b1d3+'ms'};}};function a180_0x2744(){const _0x5ae0ce=['2paNVtd','3180msiYcz','params','9stCZcc','isArray','execResult','length','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','str','execSuccess','5588dGpsoe','execError','12924UAIlAY','405837eyFOCw','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','now','7411184iCyBLO','exec','3834170fvtSoW','string','3896154bUzMdv','7moBVba','SQL\x20execution\x20failed','read','12793HdtNnw','245643uVHLJv'];a180_0x2744=function(){return _0x5ae0ce;};return a180_0x2744();}
1
+ const a179_0x2a64be=a179_0x4d1d;function a179_0x4d1d(_0x48ce0d,_0x3fb132){_0x48ce0d=_0x48ce0d-0x149;const _0x2fa33a=a179_0x2fa3();let _0x4d1d28=_0x2fa33a[_0x48ce0d];return _0x4d1d28;}(function(_0x1dba34,_0xa736e2){const _0x434409=a179_0x4d1d,_0x5cb378=_0x1dba34();while(!![]){try{const _0x317064=-parseInt(_0x434409(0x14e))/0x1+parseInt(_0x434409(0x157))/0x2+-parseInt(_0x434409(0x161))/0x3*(-parseInt(_0x434409(0x14c))/0x4)+-parseInt(_0x434409(0x156))/0x5+parseInt(_0x434409(0x15b))/0x6*(-parseInt(_0x434409(0x14d))/0x7)+parseInt(_0x434409(0x160))/0x8*(-parseInt(_0x434409(0x15a))/0x9)+-parseInt(_0x434409(0x14b))/0xa*(-parseInt(_0x434409(0x14f))/0xb);if(_0x317064===_0xa736e2)break;else _0x5cb378['push'](_0x5cb378['shift']());}catch(_0x58c781){_0x5cb378['push'](_0x5cb378['shift']());}}}(a179_0x2fa3,0x8ef67));function a179_0x2fa3(){const _0x3703ee=['SQL\x20execution\x20failed','22529590duTiVm','8cANxBl','6251psmaZl','711846dikfQd','11JohPEI','appCode','exec','now','params','execResult','execSuccess','4464770cGRcqL','2226250xHNsmZ','read','string','2334447EdYLRi','6894UPbmDr','length','isArray','sqlcode','sql','16uoDhqB','553671qDnNkl','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'];a179_0x2fa3=function(){return _0x3703ee;};return a179_0x2fa3();}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a179_0x2a64be(0x15f),'command':a179_0x2a64be(0x151),'description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a179_0x2a64be(0x158),'flags':[SQLCODE_FLAG,{'name':a179_0x2a64be(0x153),'type':a179_0x2a64be(0x159),'description':a179_0x2a64be(0x149)}],async 'execute'(_0x55f4a4){const _0x18a546=a179_0x2a64be,_0x4ed29a=parseJsonParams(_0x55f4a4['str'](_0x18a546(0x153))),_0x4927fc=Date['now'](),_0x2997bc=await executeSql(_0x55f4a4[_0x18a546(0x150)],_0x55f4a4['str'](_0x18a546(0x15e)),_0x4ed29a),_0x2e5d92=Date[_0x18a546(0x152)]()-_0x4927fc,_0x1b997c=_0x2997bc?.[_0x18a546(0x154)]??_0x2997bc,_0x27588d=_0x2997bc?.[_0x18a546(0x155)]??!![];if(!_0x27588d)return{'ok':![],'data':{'error':_0x2997bc?.['execError']||_0x18a546(0x14a),'elapsed':_0x2e5d92},'message':'SQL\x20execution\x20failed'};const _0x1005d4=Array[_0x18a546(0x15d)](_0x1b997c)?_0x1b997c:[];return{'ok':!![],'data':{'rows':_0x1005d4,'rowCount':_0x1005d4[_0x18a546(0x15c)],'elapsed':_0x2e5d92},'message':'Returned\x20'+_0x1005d4[_0x18a546(0x15c)]+'\x20row(s)\x20in\x20'+_0x2e5d92+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x356864,_0x36b210){const _0x24397c=a181_0x5c2c,_0x2334b1=_0x356864();while(!![]){try{const _0x3a98d5=-parseInt(_0x24397c(0x89))/0x1*(-parseInt(_0x24397c(0x8d))/0x2)+-parseInt(_0x24397c(0x8f))/0x3*(-parseInt(_0x24397c(0x8c))/0x4)+parseInt(_0x24397c(0x8b))/0x5*(-parseInt(_0x24397c(0x90))/0x6)+parseInt(_0x24397c(0x91))/0x7*(-parseInt(_0x24397c(0x94))/0x8)+parseInt(_0x24397c(0x95))/0x9*(parseInt(_0x24397c(0x8e))/0xa)+parseInt(_0x24397c(0x8a))/0xb+-parseInt(_0x24397c(0x93))/0xc*(parseInt(_0x24397c(0x92))/0xd);if(_0x3a98d5===_0x36b210)break;else _0x2334b1['push'](_0x2334b1['shift']());}catch(_0x283441){_0x2334b1['push'](_0x2334b1['shift']());}}}(a181_0x5970,0xd8479));function a181_0x5970(){const _0x265431=['612828zhGnEI','9txzukl','18925819gtMXry','1930ZuXZoD','4134908nIoPKX','291602IgHEGj','90hLQTet','3jmhJzM','10794zcJvVE','418663kXIEXp','416CHEjEM','668700OSuoug','176EGnUlJ'];a181_0x5970=function(){return _0x265431;};return a181_0x5970();}import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';function a181_0x5c2c(_0x5b1e32,_0x3cb90d){_0x5b1e32=_0x5b1e32-0x89;const _0x5970b8=a181_0x5970();let _0x5c2cb5=_0x5970b8[_0x5b1e32];return _0x5c2cb5;}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,sqlSave,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x176eca,_0x56c752){const _0x493dcf=a180_0x4c09,_0x57eb5e=_0x176eca();while(!![]){try{const _0x23134e=-parseInt(_0x493dcf(0x182))/0x1*(-parseInt(_0x493dcf(0x17a))/0x2)+-parseInt(_0x493dcf(0x180))/0x3*(parseInt(_0x493dcf(0x17e))/0x4)+parseInt(_0x493dcf(0x179))/0x5+parseInt(_0x493dcf(0x17f))/0x6+parseInt(_0x493dcf(0x17d))/0x7+parseInt(_0x493dcf(0x181))/0x8*(parseInt(_0x493dcf(0x178))/0x9)+parseInt(_0x493dcf(0x17c))/0xa*(-parseInt(_0x493dcf(0x17b))/0xb);if(_0x23134e===_0x56c752)break;else _0x57eb5e['push'](_0x57eb5e['shift']());}catch(_0x949372){_0x57eb5e['push'](_0x57eb5e['shift']());}}}(a180_0x2207,0x30380));function a180_0x2207(){const _0x3babbf=['436300yLQyPR','767542KTMCur','13002NScuYm','6070VYzvlP','1942990wdKVvq','286548DrDTpk','108954qNMauG','9ysovJz','104YVjoGF','1mRXBgU','251397sTekAe'];a180_0x2207=function(){return _0x3babbf;};return a180_0x2207();}import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';function a180_0x4c09(_0x6d8865,_0x29f6e3){_0x6d8865=_0x6d8865-0x178;const _0x220751=a180_0x2207();let _0x4c0916=_0x220751[_0x6d8865];return _0x4c0916;}import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- function a182_0x582b(){const _0x4c188a=['string','2341420dKWdxy','List\x20custom\x20SQL\x20queries','page','Found\x20','4146376hVImcv','name','read','number','Page\x20number','verbose','16qnnzeA','10SVzlHW','1047483NbfTTu','16705678NNhOuw','sqlCode','dbId','sqlName','\x20SQL\x20queries\x20(total:\x20','pagesize','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','appCode','all','list','map','paging','91899iHoaUK','5268sLCJPu','sql','22SsueUf','146176QEBIVB','532NuJlXG','boolean','num','length','str'];a182_0x582b=function(){return _0x4c188a;};return a182_0x582b();}function a182_0x4c3f(_0x169afa,_0x2a233b){_0x169afa=_0x169afa-0x92;const _0x582b01=a182_0x582b();let _0x4c3fd3=_0x582b01[_0x169afa];return _0x4c3fd3;}const a182_0x9b7291=a182_0x4c3f;(function(_0x272f5d,_0x194634){const _0xc24598=a182_0x4c3f,_0x21c38c=_0x272f5d();while(!![]){try{const _0x163697=parseInt(_0xc24598(0xac))/0x1+-parseInt(_0xc24598(0xab))/0x2*(-parseInt(_0xc24598(0xa8))/0x3)+-parseInt(_0xc24598(0x93))/0x4+-parseInt(_0xc24598(0xb3))/0x5+-parseInt(_0xc24598(0xa9))/0x6*(-parseInt(_0xc24598(0xad))/0x7)+parseInt(_0xc24598(0x99))/0x8*(parseInt(_0xc24598(0x9b))/0x9)+parseInt(_0xc24598(0x9a))/0xa*(parseInt(_0xc24598(0x9c))/0xb);if(_0x163697===_0x194634)break;else _0x21c38c['push'](_0x21c38c['shift']());}catch(_0x1b49df){_0x21c38c['push'](_0x21c38c['shift']());}}}(a182_0x582b,0xc272d));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a182_0x9b7291(0xaa),'command':a182_0x9b7291(0xa5),'description':a182_0x9b7291(0xb4),'risk':a182_0x9b7291(0x95),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a182_0x9b7291(0x94),'type':a182_0x9b7291(0xb2),'description':'Filter\x20by\x20SQL\x20name'},{'name':a182_0x9b7291(0xb5),'type':a182_0x9b7291(0x96),'description':a182_0x9b7291(0x97),'default':0x1},{'name':'pagesize','type':a182_0x9b7291(0x96),'description':'Page\x20size'},{'name':a182_0x9b7291(0x98),'type':a182_0x9b7291(0xae),'description':a182_0x9b7291(0xa2)}],async 'execute'(_0x82c7e9){const _0x5089b7=a182_0x9b7291,_0x19307c=await listSqlQueries(_0x82c7e9['appCode'],{'sqlCode':_0x82c7e9[_0x5089b7(0xb1)]('sqlcode')||undefined,'sqlName':_0x82c7e9['str'](_0x5089b7(0x94))||undefined,'currentPage':_0x82c7e9['num'](_0x5089b7(0xb5)),'pageSize':_0x82c7e9[_0x5089b7(0xaf)](_0x5089b7(0xa1),0x32)}),_0x45d1cd=_0x82c7e9['bool'](_0x5089b7(0x98)),_0x2ea766=_0x19307c['tableData']??[],_0xd79a7d=_0x19307c[_0x5089b7(0xa7)]?.['totalCount']??_0x2ea766['length'];let _0xd21a92;return _0x45d1cd?_0xd21a92=_0x2ea766:_0xd21a92=await Promise[_0x5089b7(0xa4)](_0x2ea766[_0x5089b7(0xa6)](async _0x3ee66a=>{const _0x134b86=_0x5089b7;let _0x5371e3;try{_0x5371e3=_0x3ee66a[_0x134b86(0x9e)]?await getDbName(_0x82c7e9[_0x134b86(0xa3)],_0x3ee66a['dbId']):undefined;}catch{}return{'sqlCode':_0x3ee66a[_0x134b86(0x9d)],'sqlName':_0x3ee66a[_0x134b86(0x9f)],'description':_0x3ee66a['description']??'','db':_0x5371e3?_0x5371e3+'\x20('+_0x3ee66a[_0x134b86(0x9e)]+')':_0x3ee66a[_0x134b86(0x9e)]??''};})),{'ok':!![],'data':_0xd21a92,'message':_0x2ea766[_0x5089b7(0xb0)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x5089b7(0x92)+_0x2ea766['length']+_0x5089b7(0xa0)+_0xd79a7d+').'};}};
1
+ const a181_0x166d2b=a181_0x4e8c;(function(_0x579cbe,_0x50be78){const _0x9d8983=a181_0x4e8c,_0x5e65d7=_0x579cbe();while(!![]){try{const _0x378125=parseInt(_0x9d8983(0x77))/0x1+-parseInt(_0x9d8983(0x82))/0x2+-parseInt(_0x9d8983(0x7b))/0x3+-parseInt(_0x9d8983(0x80))/0x4*(-parseInt(_0x9d8983(0x7c))/0x5)+parseInt(_0x9d8983(0x6f))/0x6+-parseInt(_0x9d8983(0x79))/0x7+parseInt(_0x9d8983(0x73))/0x8;if(_0x378125===_0x50be78)break;else _0x5e65d7['push'](_0x5e65d7['shift']());}catch(_0x513132){_0x5e65d7['push'](_0x5e65d7['shift']());}}}(a181_0x28a8,0xcf1a3));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a181_0x4e8c(_0x2eaea6,_0x5200be){_0x2eaea6=_0x2eaea6-0x66;const _0x28a87f=a181_0x28a8();let _0x4e8c0a=_0x28a87f[_0x2eaea6];return _0x4e8c0a;}function a181_0x28a8(){const _0x355ad1=['Page\x20size','all','verbose','172RLsGOe','sqlcode','2383050DCjZqN','List\x20custom\x20SQL\x20queries','pagesize','appCode','Page\x20number','page','list','name','Filter\x20by\x20SQL\x20name','bool','num','str','paging','5578662fMQRZp','description','sql','length','13156360ekzVnX','sqlName','map','dbId','1432837scKCPk','sqlCode','9893317GdxkMz','totalCount','2538333VHwuvd','33965sSIfed'];a181_0x28a8=function(){return _0x355ad1;};return a181_0x28a8();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a181_0x166d2b(0x71),'command':a181_0x166d2b(0x68),'description':a181_0x166d2b(0x83),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':'string','description':a181_0x166d2b(0x6a)},{'name':a181_0x166d2b(0x67),'type':'number','description':a181_0x166d2b(0x66),'default':0x1},{'name':a181_0x166d2b(0x84),'type':'number','description':a181_0x166d2b(0x7d)},{'name':'verbose','type':'boolean','description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x34155c){const _0x7a0f72=a181_0x166d2b,_0x163ee1=await listSqlQueries(_0x34155c[_0x7a0f72(0x85)],{'sqlCode':_0x34155c['str'](_0x7a0f72(0x81))||undefined,'sqlName':_0x34155c[_0x7a0f72(0x6d)](_0x7a0f72(0x69))||undefined,'currentPage':_0x34155c[_0x7a0f72(0x6c)](_0x7a0f72(0x67)),'pageSize':_0x34155c[_0x7a0f72(0x6c)](_0x7a0f72(0x84),0x32)}),_0x26ff24=_0x34155c[_0x7a0f72(0x6b)](_0x7a0f72(0x7f)),_0x275976=_0x163ee1['tableData']??[],_0x1e4988=_0x163ee1[_0x7a0f72(0x6e)]?.[_0x7a0f72(0x7a)]??_0x275976[_0x7a0f72(0x72)];let _0x13ed84;return _0x26ff24?_0x13ed84=_0x275976:_0x13ed84=await Promise[_0x7a0f72(0x7e)](_0x275976[_0x7a0f72(0x75)](async _0x897b15=>{const _0x521fcd=_0x7a0f72;let _0x533261;try{_0x533261=_0x897b15[_0x521fcd(0x76)]?await getDbName(_0x34155c['appCode'],_0x897b15[_0x521fcd(0x76)]):undefined;}catch{}return{'sqlCode':_0x897b15[_0x521fcd(0x78)],'sqlName':_0x897b15[_0x521fcd(0x74)],'description':_0x897b15[_0x521fcd(0x70)]??'','db':_0x533261?_0x533261+'\x20('+_0x897b15[_0x521fcd(0x76)]+')':_0x897b15[_0x521fcd(0x76)]??''};})),{'ok':!![],'data':_0x13ed84,'message':_0x275976[_0x7a0f72(0x72)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':'Found\x20'+_0x275976['length']+'\x20SQL\x20queries\x20(total:\x20'+_0x1e4988+').'};}};
@@ -1 +1 @@
1
- const a183_0x336927=a183_0x2e58;(function(_0x568b2d,_0x210547){const _0x1af825=a183_0x2e58,_0x36d633=_0x568b2d();while(!![]){try{const _0x281e2f=parseInt(_0x1af825(0x121))/0x1*(-parseInt(_0x1af825(0xfe))/0x2)+-parseInt(_0x1af825(0x10c))/0x3*(parseInt(_0x1af825(0x10d))/0x4)+-parseInt(_0x1af825(0x102))/0x5*(parseInt(_0x1af825(0xfd))/0x6)+parseInt(_0x1af825(0xee))/0x7+-parseInt(_0x1af825(0x10a))/0x8*(parseInt(_0x1af825(0xf9))/0x9)+-parseInt(_0x1af825(0xf1))/0xa*(parseInt(_0x1af825(0xfa))/0xb)+parseInt(_0x1af825(0x10e))/0xc*(parseInt(_0x1af825(0x10b))/0xd);if(_0x281e2f===_0x210547)break;else _0x36d633['push'](_0x36d633['shift']());}catch(_0x51b8f9){_0x36d633['push'](_0x36d633['shift']());}}}(a183_0x1540,0x7b041));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(_0x1781ea,_0x528655){const _0x229f80=a183_0x2e58,_0x38a735=[];let _0x50ae7b=0x1;while(!![]){const _0x5ba5e2=await listSqlQueries(_0x1781ea,{'currentPage':_0x50ae7b,'pageSize':PAGE_SIZE,'sqlCode':_0x528655[_0x229f80(0x119)],'sqlName':_0x528655['sqlName']}),_0x2670c1=_0x5ba5e2['tableData']??[];_0x38a735['push'](..._0x2670c1);if(_0x2670c1[_0x229f80(0xfc)]===0x0)break;const _0x453a8f=_0x5ba5e2[_0x229f80(0x118)]?.[_0x229f80(0x124)];if(_0x453a8f!=null?_0x38a735[_0x229f80(0xfc)]>=_0x453a8f:_0x2670c1[_0x229f80(0xfc)]<PAGE_SIZE)break;_0x50ae7b++;}return _0x38a735;}async function ensureSqlContent(_0x172cec){const _0x42a692=a183_0x2e58;if(_0x172cec['sqlContent']!=null&&String(_0x172cec[_0x42a692(0xed)])[_0x42a692(0xfc)]>0x0)return _0x172cec;return getSqlQueryDetail(_0x172cec['sqlCode']);}export const sqlPull={'service':a183_0x336927(0x11c),'command':a183_0x336927(0x103),'description':a183_0x336927(0x126),'risk':a183_0x336927(0x123),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a183_0x336927(0x100),'description':a183_0x336927(0x113)},{'name':'force','type':a183_0x336927(0xec),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x319493){const _0x1af55f=a183_0x336927,_0x40d2de=loadSqlProjectConfig(_0x319493[_0x1af55f(0xf6)]),_0x2162d0=await readSqlLockFile(_0x40d2de[_0x1af55f(0xf7)]),{appLock:_0x3f4d3e}=ensureSqlLockScope(_0x2162d0??createEmptySqlLock(),_0x40d2de[_0x1af55f(0xf6)],_0x40d2de[_0x1af55f(0xf2)],_0x1af55f(0x103)),_0x596a0b=await fetchAllSqlQueries(_0x319493['appCode'],{'sqlCode':_0x319493[_0x1af55f(0x116)](_0x1af55f(0x11b))||undefined,'sqlName':_0x319493[_0x1af55f(0x116)](_0x1af55f(0x101))||undefined}),_0x12e5b5=[];for(const _0x3b9294 of _0x596a0b){const _0x2ea9e4=await ensureSqlContent(_0x3b9294),_0x300feb=ensureRemoteSqlContent(_0x2ea9e4),_0x3d2913=detectModeFromSql(_0x2ea9e4),_0x29ba51=_0x2ea9e4[_0x1af55f(0x106)]?await getDbName(_0x319493[_0x1af55f(0xf6)],Number(_0x2ea9e4[_0x1af55f(0x106)]))[_0x1af55f(0x114)](()=>undefined):undefined,_0x1e8f6c=buildLocalSqlFileContent({'sqlCode':_0x2ea9e4[_0x1af55f(0x119)],'sqlName':_0x2ea9e4[_0x1af55f(0xff)],'dbId':_0x2ea9e4[_0x1af55f(0x106)]},_0x300feb,{'dbName':_0x29ba51,'mode':_0x3d2913,'syncedAt':new Date()[_0x1af55f(0x11f)](),'description':_0x2ea9e4[_0x1af55f(0x11d)]}),_0x41fa97=buildSqlLockEntry(_0x2ea9e4,_0x300feb,'',{'dbName':_0x29ba51}),_0x3af40b=resolveLocalSqlFilePath(_0x40d2de,_0x2ea9e4[_0x1af55f(0x119)],_0x41fa97);let _0xf899be='would_pull',_0xd9230f;if(await fileExists(_0x3af40b)){const _0x6cedb4=await readFile(_0x3af40b,_0x1af55f(0xf3));isEquivalentPulledSqlFile(_0x6cedb4,_0x1e8f6c,_0x3d2913)?(_0xf899be='skipped',_0xd9230f=_0x1af55f(0x10f)):(_0xf899be='conflict',_0xd9230f='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x12e5b5[_0x1af55f(0xf8)]({'sqlCode':_0x2ea9e4[_0x1af55f(0x119)],'sqlName':_0x2ea9e4['sqlName'],'filePath':_0x3af40b,'status':_0xf899be,'reason':_0xd9230f});}return{'method':_0x1af55f(0x117),'url':_0x1af55f(0x122),'body':{'appCode':_0x319493[_0x1af55f(0xf6)],'sqlCode':_0x319493['str'](_0x1af55f(0x11b))||null,'sqlName':_0x319493[_0x1af55f(0x116)](_0x1af55f(0x101))||null,'files':_0x12e5b5},'description':'Would\x20pull\x20'+_0x12e5b5[_0x1af55f(0xfc)]+_0x1af55f(0x128)+_0x40d2de['sqlRootDir']};},async 'execute'(_0x1992d6){const _0x52a091=a183_0x336927,_0x4be2e3=loadSqlProjectConfig(_0x1992d6[_0x52a091(0xf6)]),_0xb4f2aa=await readSqlLockFile(_0x4be2e3[_0x52a091(0xf7)]),{lockData:_0x37884a,appLock:_0x395d4f}=ensureSqlLockScope(_0xb4f2aa??createEmptySqlLock(),_0x4be2e3[_0x52a091(0xf6)],_0x4be2e3['sqlRoot'],_0x52a091(0x103)),_0x32bf4f=_0x1992d6[_0x52a091(0x127)](_0x52a091(0x112)),_0x409cd0=await fetchAllSqlQueries(_0x1992d6[_0x52a091(0xf6)],{'sqlCode':_0x1992d6['str'](_0x52a091(0x11b))||undefined,'sqlName':_0x1992d6[_0x52a091(0x116)](_0x52a091(0x101))||undefined});if(_0x409cd0[_0x52a091(0xfc)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0xf76ebb=[],_0x4afeb2=[];for(const _0x569751 of _0x409cd0){try{_0xf76ebb['push'](await ensureSqlContent(_0x569751));}catch(_0x2cec8c){_0x4afeb2[_0x52a091(0xf8)]({'sqlCode':_0x569751[_0x52a091(0x119)],'error':_0x2cec8c instanceof Error?_0x2cec8c[_0x52a091(0xf0)]:String(_0x2cec8c)});}}if(_0x32bf4f&&!_0x1992d6[_0x52a091(0x108)]){let _0x2fc256=![];for(const _0x2a04dc of _0xf76ebb){const _0x6c833a=detectModeFromSql(_0x2a04dc),_0x384fb6=_0x2a04dc[_0x52a091(0x106)]?await getDbName(_0x1992d6[_0x52a091(0xf6)],Number(_0x2a04dc[_0x52a091(0x106)]))[_0x52a091(0x114)](()=>undefined):undefined,_0x2ac128=buildLocalSqlFileContent({'sqlCode':_0x2a04dc['sqlCode'],'sqlName':_0x2a04dc[_0x52a091(0xff)],'dbId':_0x2a04dc['dbId']},ensureRemoteSqlContent(_0x2a04dc),{'dbName':_0x384fb6,'mode':_0x6c833a,'syncedAt':new Date()[_0x52a091(0x11f)](),'description':_0x2a04dc[_0x52a091(0x11d)]}),_0x319f2e=resolveLocalSqlFilePath(_0x4be2e3,_0x2a04dc[_0x52a091(0x119)],buildSqlLockEntry(_0x2a04dc,ensureRemoteSqlContent(_0x2a04dc),'',{'dbName':_0x384fb6}));if(await fileExists(_0x319f2e)){const _0x112b00=await readFile(_0x319f2e,_0x52a091(0xf3));if(!isEquivalentPulledSqlFile(_0x112b00,_0x2ac128,_0x6c833a)){_0x2fc256=!![];break;}}}if(_0x2fc256){const _0x42a761=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x42a761)throw CliErrors[_0x52a091(0xef)](_0x52a091(0x110));}}const _0x2f87f3=cloneSqlLockData(_0x37884a),_0x35aa1f=_0x2f87f3[_0x52a091(0x105)][_0x4be2e3[_0x52a091(0xf6)]],_0x372bca=[],_0x54f85e=[];for(const _0x146435 of _0xf76ebb){const _0x31e7e8=_0x35aa1f[_0x52a091(0x109)][_0x146435[_0x52a091(0x119)]],_0x1119cd=ensureRemoteSqlContent(_0x146435),_0x182f3c=detectModeFromSql(_0x146435),_0x1f7e7a=_0x146435[_0x52a091(0x106)]?await getDbName(_0x1992d6[_0x52a091(0xf6)],Number(_0x146435[_0x52a091(0x106)]))[_0x52a091(0x114)](()=>undefined):undefined,_0x21ed88=buildLocalSqlFileContent({'sqlCode':_0x146435[_0x52a091(0x119)],'sqlName':_0x146435[_0x52a091(0xff)],'dbId':_0x146435[_0x52a091(0x106)]},_0x1119cd,{'dbName':_0x1f7e7a,'mode':_0x182f3c,'syncedAt':new Date()['toISOString'](),'description':_0x146435[_0x52a091(0x11d)]}),_0xf91bd=buildSqlLockEntry(_0x146435,_0x1119cd,computeSqlContentHash(_0x21ed88),{'dbName':_0x1f7e7a}),_0x463459=_0xf91bd[_0x52a091(0x104)],_0x361f58=join(_0x4be2e3[_0x52a091(0x115)],_0x463459);try{if(await fileExists(_0x361f58)){const _0x5558c4=await readFile(_0x361f58,_0x52a091(0xf3));if(isEquivalentPulledSqlFile(_0x5558c4,_0x21ed88,_0x182f3c)){_0x54f85e[_0x52a091(0xf8)]({'sqlCode':_0x146435['sqlCode'],'reason':_0x52a091(0x10f)}),_0x35aa1f[_0x52a091(0x109)][_0x146435[_0x52a091(0x119)]]={..._0xf91bd,'hash':computeSqlContentHash(_0x5558c4),'path':_0x463459};continue;}if(!_0x32bf4f){_0x54f85e[_0x52a091(0xf8)]({'sqlCode':_0x146435[_0x52a091(0x119)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0xbdd1e2=_0x31e7e8?.[_0x52a091(0x104)]?join(_0x4be2e3['sqlRootDir'],_0x31e7e8[_0x52a091(0x104)]):undefined;_0xbdd1e2&&_0xbdd1e2!==_0x361f58&&await fileExists(_0xbdd1e2)&&await rm(_0xbdd1e2,{'force':!![]}),await ensureParentDirectory(_0x361f58),await writeFile(_0x361f58,_0x21ed88,'utf8'),_0x35aa1f[_0x52a091(0x109)][_0x146435[_0x52a091(0x119)]]={..._0xf91bd,'path':_0x463459},_0x372bca['push']({'sqlCode':_0x146435[_0x52a091(0x119)],'filePath':_0x361f58});}catch(_0x2a917a){_0x4afeb2[_0x52a091(0xf8)]({'sqlCode':_0x146435['sqlCode'],'error':_0x2a917a instanceof Error?_0x2a917a[_0x52a091(0xf0)]:String(_0x2a917a)});}}return _0x35aa1f[_0x52a091(0x111)]=new Date()[_0x52a091(0x11f)](),await writeSqlLockFile(_0x4be2e3[_0x52a091(0xf7)],_0x2f87f3),{'ok':_0x4afeb2[_0x52a091(0xfc)]===0x0,'data':{'pulled':_0x372bca,'skipped':_0x54f85e,'failed':_0x4afeb2},'message':_0x52a091(0x11a)+_0x372bca[_0x52a091(0xfc)]+_0x52a091(0x125)+_0x54f85e[_0x52a091(0xfc)]+'\x20skipped,\x20'+_0x4afeb2[_0x52a091(0xfc)]+'\x20failed'};}};function detectModeFromSql(_0x5ca4d7){const _0x2159d0=a183_0x336927,_0x1f6428=ensureRemoteSqlContent(_0x5ca4d7),_0x10ad8b=stripLocalSqlMetadata(_0x1f6428,'mybatisXml')[_0x2159d0(0xf4)]();if(/^<(select|insert|update|delete)\b/i[_0x2159d0(0x120)](_0x10ad8b))return _0x2159d0(0x107);return'sql';}function isEquivalentPulledSqlFile(_0x36d7c7,_0x2b388a,_0x3e8f82){return normalizePullComparableContent(_0x36d7c7,_0x3e8f82)===normalizePullComparableContent(_0x2b388a,_0x3e8f82);}function a183_0x1540(){const _0x2ffd1a=['lastSync','force','Filter\x20by\x20SQL\x20display\x20name','catch','sqlRootDir','str','POST','paging','sqlCode','Pull\x20complete:\x20','sqlcode','sql','description','split','toISOString','test','27325DzAEmj','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','write','totalCount','\x20written,\x20','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','bool','\x20SQL\x20file(s)\x20into\x20','boolean','sqlContent','2207254MuMCxw','cancelled','message','170tnHUCW','sqlRoot','utf8','trimStart','replace','appCode','lockFilePath','push','9ZawdMn','18271RFqHAE','join','length','1716WdGSff','14bBdVul','sqlName','string','name','4705ctGHzH','pull','path','apps','dbId','mybatisXml','nonInteractive','sqls','3012056CMaaPN','156ncUuVW','627fqqybv','3504BspVBf','1236780iTcNQi','unchanged','Force\x20pull\x20cancelled.'];a183_0x1540=function(){return _0x2ffd1a;};return a183_0x1540();}function normalizePullComparableContent(_0x34ed21,_0x11f3d6){const _0x585643=a183_0x336927,_0x35efac=_0x34ed21[_0x585643(0xf5)](/\r\n/g,'\x0a')[_0x585643(0x11e)]('\x0a'),_0x401066=_0x35efac['filter'](_0x4555d6=>!isSyncedAtMetadataLine(_0x4555d6,_0x11f3d6));return _0x401066[_0x585643(0xfb)]('\x0a');}function a183_0x2e58(_0x419b79,_0x11da6b){_0x419b79=_0x419b79-0xec;const _0x15401c=a183_0x1540();let _0x2e5839=_0x15401c[_0x419b79];return _0x2e5839;}function isSyncedAtMetadataLine(_0x221698,_0xaeab59){const _0x500756=a183_0x336927;if(_0xaeab59===_0x500756(0x107))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x500756(0x120)](_0x221698);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x221698);}
1
+ const a182_0x2e485a=a182_0x403e;(function(_0xbd71d5,_0x1e9b94){const _0x393065=a182_0x403e,_0x227bbc=_0xbd71d5();while(!![]){try{const _0x1a76d7=parseInt(_0x393065(0x7c))/0x1+parseInt(_0x393065(0xa4))/0x2+-parseInt(_0x393065(0x6f))/0x3+-parseInt(_0x393065(0x8e))/0x4+-parseInt(_0x393065(0x72))/0x5*(parseInt(_0x393065(0x9c))/0x6)+-parseInt(_0x393065(0x93))/0x7*(parseInt(_0x393065(0x7f))/0x8)+parseInt(_0x393065(0x70))/0x9;if(_0x1a76d7===_0x1e9b94)break;else _0x227bbc['push'](_0x227bbc['shift']());}catch(_0x3caafd){_0x227bbc['push'](_0x227bbc['shift']());}}}(a182_0x14ee,0x8c272));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';function a182_0x403e(_0x10f54e,_0xc7ac3c){_0x10f54e=_0x10f54e-0x6f;const _0x14eebe=a182_0x14ee();let _0x403e5d=_0x14eebe[_0x10f54e];return _0x403e5d;}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(_0x272168,_0x3391e1){const _0x2005b5=a182_0x403e,_0x27d3fd=[];let _0x2ddf56=0x1;while(!![]){const _0x49fa27=await listSqlQueries(_0x272168,{'currentPage':_0x2ddf56,'pageSize':PAGE_SIZE,'sqlCode':_0x3391e1[_0x2005b5(0xa0)],'sqlName':_0x3391e1[_0x2005b5(0x97)]}),_0x90ef51=_0x49fa27['tableData']??[];_0x27d3fd[_0x2005b5(0x75)](..._0x90ef51);if(_0x90ef51['length']===0x0)break;const _0x5c5aaf=_0x49fa27[_0x2005b5(0x87)]?.[_0x2005b5(0x83)];if(_0x5c5aaf!=null?_0x27d3fd[_0x2005b5(0xa5)]>=_0x5c5aaf:_0x90ef51[_0x2005b5(0xa5)]<PAGE_SIZE)break;_0x2ddf56++;}return _0x27d3fd;}async function ensureSqlContent(_0x2d2011){const _0x34557b=a182_0x403e;if(_0x2d2011['sqlContent']!=null&&String(_0x2d2011[_0x34557b(0x9f)])[_0x34557b(0xa5)]>0x0)return _0x2d2011;return getSqlQueryDetail(_0x2d2011['sqlCode']);}export const sqlPull={'service':'sql','command':'pull','description':a182_0x2e485a(0x82),'risk':a182_0x2e485a(0x96),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a182_0x2e485a(0x8d),'type':a182_0x2e485a(0x80),'description':a182_0x2e485a(0xa3)},{'name':'force','type':a182_0x2e485a(0xa2),'description':a182_0x2e485a(0x98)}],async 'dryRun'(_0x2f675b){const _0x334a7c=a182_0x2e485a,_0x2ad7e5=loadSqlProjectConfig(_0x2f675b['appCode']),_0x583d08=await readSqlLockFile(_0x2ad7e5[_0x334a7c(0xa9)]),{appLock:_0x52004e}=ensureSqlLockScope(_0x583d08??createEmptySqlLock(),_0x2ad7e5[_0x334a7c(0x7a)],_0x2ad7e5[_0x334a7c(0x89)],_0x334a7c(0x9e)),_0x130213=await fetchAllSqlQueries(_0x2f675b[_0x334a7c(0x7a)],{'sqlCode':_0x2f675b[_0x334a7c(0xa8)](_0x334a7c(0x8f))||undefined,'sqlName':_0x2f675b['str'](_0x334a7c(0x8d))||undefined}),_0x2525ff=[];for(const _0x161825 of _0x130213){const _0x24af3b=await ensureSqlContent(_0x161825),_0x168c19=ensureRemoteSqlContent(_0x24af3b),_0x44d256=detectModeFromSql(_0x24af3b),_0x2c7892=_0x24af3b['dbId']?await getDbName(_0x2f675b['appCode'],Number(_0x24af3b[_0x334a7c(0x76)]))['catch'](()=>undefined):undefined,_0x500b8d=buildLocalSqlFileContent({'sqlCode':_0x24af3b[_0x334a7c(0xa0)],'sqlName':_0x24af3b['sqlName'],'dbId':_0x24af3b[_0x334a7c(0x76)]},_0x168c19,{'dbName':_0x2c7892,'mode':_0x44d256,'syncedAt':new Date()[_0x334a7c(0x90)](),'description':_0x24af3b[_0x334a7c(0x79)]}),_0x4d17e0=buildSqlLockEntry(_0x24af3b,_0x168c19,'',{'dbName':_0x2c7892}),_0x1d7fb4=resolveLocalSqlFilePath(_0x2ad7e5,_0x24af3b[_0x334a7c(0xa0)],_0x4d17e0);let _0x3ea18a=_0x334a7c(0x94),_0x1c990d;if(await fileExists(_0x1d7fb4)){const _0x409aff=await readFile(_0x1d7fb4,'utf8');isEquivalentPulledSqlFile(_0x409aff,_0x500b8d,_0x44d256)?(_0x3ea18a='skipped',_0x1c990d=_0x334a7c(0x85)):(_0x3ea18a=_0x334a7c(0x78),_0x1c990d='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x2525ff[_0x334a7c(0x75)]({'sqlCode':_0x24af3b[_0x334a7c(0xa0)],'sqlName':_0x24af3b[_0x334a7c(0x97)],'filePath':_0x1d7fb4,'status':_0x3ea18a,'reason':_0x1c990d});}return{'method':_0x334a7c(0x71),'url':_0x334a7c(0x91),'body':{'appCode':_0x2f675b['appCode'],'sqlCode':_0x2f675b[_0x334a7c(0xa8)](_0x334a7c(0x8f))||null,'sqlName':_0x2f675b[_0x334a7c(0xa8)]('name')||null,'files':_0x2525ff},'description':_0x334a7c(0xa1)+_0x2525ff['length']+_0x334a7c(0x7b)+_0x2ad7e5[_0x334a7c(0x9d)]};},async 'execute'(_0x3f0d51){const _0x3d9f88=a182_0x2e485a,_0x8a1055=loadSqlProjectConfig(_0x3f0d51[_0x3d9f88(0x7a)]),_0x5e1c9b=await readSqlLockFile(_0x8a1055['lockFilePath']),{lockData:_0x51d927,appLock:_0x5f2e7c}=ensureSqlLockScope(_0x5e1c9b??createEmptySqlLock(),_0x8a1055['appCode'],_0x8a1055['sqlRoot'],_0x3d9f88(0x9e)),_0x12bc53=_0x3f0d51[_0x3d9f88(0x8a)](_0x3d9f88(0xa7)),_0x2748dd=await fetchAllSqlQueries(_0x3f0d51['appCode'],{'sqlCode':_0x3f0d51[_0x3d9f88(0xa8)](_0x3d9f88(0x8f))||undefined,'sqlName':_0x3f0d51[_0x3d9f88(0xa8)](_0x3d9f88(0x8d))||undefined});if(_0x2748dd['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x3d9f88(0x88)};const _0x29da81=[],_0xd6f846=[];for(const _0x153e1e of _0x2748dd){try{_0x29da81[_0x3d9f88(0x75)](await ensureSqlContent(_0x153e1e));}catch(_0x42f8df){_0xd6f846[_0x3d9f88(0x75)]({'sqlCode':_0x153e1e['sqlCode'],'error':_0x42f8df instanceof Error?_0x42f8df[_0x3d9f88(0x92)]:String(_0x42f8df)});}}if(_0x12bc53&&!_0x3f0d51[_0x3d9f88(0x86)]){let _0x49ee55=![];for(const _0x3481d9 of _0x29da81){const _0x51f803=detectModeFromSql(_0x3481d9),_0x548a71=_0x3481d9['dbId']?await getDbName(_0x3f0d51[_0x3d9f88(0x7a)],Number(_0x3481d9['dbId']))[_0x3d9f88(0x7e)](()=>undefined):undefined,_0xa92b25=buildLocalSqlFileContent({'sqlCode':_0x3481d9[_0x3d9f88(0xa0)],'sqlName':_0x3481d9['sqlName'],'dbId':_0x3481d9[_0x3d9f88(0x76)]},ensureRemoteSqlContent(_0x3481d9),{'dbName':_0x548a71,'mode':_0x51f803,'syncedAt':new Date()[_0x3d9f88(0x90)](),'description':_0x3481d9[_0x3d9f88(0x79)]}),_0x1ff8b0=resolveLocalSqlFilePath(_0x8a1055,_0x3481d9['sqlCode'],buildSqlLockEntry(_0x3481d9,ensureRemoteSqlContent(_0x3481d9),'',{'dbName':_0x548a71}));if(await fileExists(_0x1ff8b0)){const _0x47c9e3=await readFile(_0x1ff8b0,_0x3d9f88(0xaa));if(!isEquivalentPulledSqlFile(_0x47c9e3,_0xa92b25,_0x51f803)){_0x49ee55=!![];break;}}}if(_0x49ee55){const _0x250d62=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x250d62)throw CliErrors[_0x3d9f88(0x8b)](_0x3d9f88(0xab));}}const _0x48610e=cloneSqlLockData(_0x51d927),_0x4e4101=_0x48610e[_0x3d9f88(0x74)][_0x8a1055[_0x3d9f88(0x7a)]],_0x40f982=[],_0x535070=[];for(const _0x57ccb6 of _0x29da81){const _0x3b3dc9=_0x4e4101[_0x3d9f88(0x73)][_0x57ccb6[_0x3d9f88(0xa0)]],_0x81c6b0=ensureRemoteSqlContent(_0x57ccb6),_0x2f09d4=detectModeFromSql(_0x57ccb6),_0x530e16=_0x57ccb6[_0x3d9f88(0x76)]?await getDbName(_0x3f0d51[_0x3d9f88(0x7a)],Number(_0x57ccb6['dbId']))[_0x3d9f88(0x7e)](()=>undefined):undefined,_0x50a06a=buildLocalSqlFileContent({'sqlCode':_0x57ccb6[_0x3d9f88(0xa0)],'sqlName':_0x57ccb6[_0x3d9f88(0x97)],'dbId':_0x57ccb6[_0x3d9f88(0x76)]},_0x81c6b0,{'dbName':_0x530e16,'mode':_0x2f09d4,'syncedAt':new Date()[_0x3d9f88(0x90)](),'description':_0x57ccb6[_0x3d9f88(0x79)]}),_0x3f94cc=buildSqlLockEntry(_0x57ccb6,_0x81c6b0,computeSqlContentHash(_0x50a06a),{'dbName':_0x530e16}),_0x4db23b=_0x3f94cc[_0x3d9f88(0x84)],_0x23cc94=join(_0x8a1055[_0x3d9f88(0x9d)],_0x4db23b);try{if(await fileExists(_0x23cc94)){const _0x48f609=await readFile(_0x23cc94,_0x3d9f88(0xaa));if(isEquivalentPulledSqlFile(_0x48f609,_0x50a06a,_0x2f09d4)){_0x535070['push']({'sqlCode':_0x57ccb6['sqlCode'],'reason':_0x3d9f88(0x85)}),_0x4e4101[_0x3d9f88(0x73)][_0x57ccb6[_0x3d9f88(0xa0)]]={..._0x3f94cc,'hash':computeSqlContentHash(_0x48f609),'path':_0x4db23b};continue;}if(!_0x12bc53){_0x535070[_0x3d9f88(0x75)]({'sqlCode':_0x57ccb6[_0x3d9f88(0xa0)],'reason':_0x3d9f88(0x9a)});continue;}}const _0x5e5cc6=_0x3b3dc9?.[_0x3d9f88(0x84)]?join(_0x8a1055[_0x3d9f88(0x9d)],_0x3b3dc9[_0x3d9f88(0x84)]):undefined;_0x5e5cc6&&_0x5e5cc6!==_0x23cc94&&await fileExists(_0x5e5cc6)&&await rm(_0x5e5cc6,{'force':!![]}),await ensureParentDirectory(_0x23cc94),await writeFile(_0x23cc94,_0x50a06a,_0x3d9f88(0xaa)),_0x4e4101['sqls'][_0x57ccb6[_0x3d9f88(0xa0)]]={..._0x3f94cc,'path':_0x4db23b},_0x40f982[_0x3d9f88(0x75)]({'sqlCode':_0x57ccb6[_0x3d9f88(0xa0)],'filePath':_0x23cc94});}catch(_0x187cf0){_0xd6f846[_0x3d9f88(0x75)]({'sqlCode':_0x57ccb6['sqlCode'],'error':_0x187cf0 instanceof Error?_0x187cf0['message']:String(_0x187cf0)});}}return _0x4e4101[_0x3d9f88(0x81)]=new Date()[_0x3d9f88(0x90)](),await writeSqlLockFile(_0x8a1055[_0x3d9f88(0xa9)],_0x48610e),{'ok':_0xd6f846[_0x3d9f88(0xa5)]===0x0,'data':{'pulled':_0x40f982,'skipped':_0x535070,'failed':_0xd6f846},'message':_0x3d9f88(0x99)+_0x40f982['length']+'\x20written,\x20'+_0x535070[_0x3d9f88(0xa5)]+_0x3d9f88(0x7d)+_0xd6f846[_0x3d9f88(0xa5)]+'\x20failed'};}};function detectModeFromSql(_0x4c166c){const _0x4a604b=a182_0x2e485a,_0x24d8c7=ensureRemoteSqlContent(_0x4c166c),_0x4cc8d7=stripLocalSqlMetadata(_0x24d8c7,_0x4a604b(0x9b))['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x4a604b(0x77)](_0x4cc8d7))return _0x4a604b(0x9b);return'sql';}function isEquivalentPulledSqlFile(_0x3d44c8,_0x34966d,_0x7b008){return normalizePullComparableContent(_0x3d44c8,_0x7b008)===normalizePullComparableContent(_0x34966d,_0x7b008);}function normalizePullComparableContent(_0xf5ca09,_0x23b983){const _0x5b2e1a=a182_0x2e485a,_0x471f0b=_0xf5ca09[_0x5b2e1a(0xa6)](/\r\n/g,'\x0a')[_0x5b2e1a(0x8c)]('\x0a'),_0x4d4183=_0x471f0b['filter'](_0x6795e1=>!isSyncedAtMetadataLine(_0x6795e1,_0x23b983));return _0x4d4183[_0x5b2e1a(0x95)]('\x0a');}function a182_0x14ee(){const _0x315d3a=['utf8','Force\x20pull\x20cancelled.','2696736QhsMrE','21969234GdlXOp','POST','2155Icipbx','sqls','apps','push','dbId','test','conflict','description','appCode','\x20SQL\x20file(s)\x20into\x20','14833YrXEZm','\x20skipped,\x20','catch','24mbBjAK','string','lastSync','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','totalCount','path','unchanged','nonInteractive','paging','No\x20remote\x20SQL\x20queries\x20matched.','sqlRoot','bool','cancelled','split','name','3950172qFcVGn','sqlcode','toISOString','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','message','345562bccJgb','would_pull','join','write','sqlName','Force\x20overwrite\x20local\x20unsynced\x20changes','Pull\x20complete:\x20','local\x20differs\x20from\x20remote','mybatisXml','8958tESFBq','sqlRootDir','pull','sqlContent','sqlCode','Would\x20pull\x20','boolean','Filter\x20by\x20SQL\x20display\x20name','1592486RawrxV','length','replace','force','str','lockFilePath'];a182_0x14ee=function(){return _0x315d3a;};return a182_0x14ee();}function isSyncedAtMetadataLine(_0x524318,_0xb6045e){const _0x12890e=a182_0x2e485a;if(_0xb6045e===_0x12890e(0x9b))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x12890e(0x77)](_0x524318);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x524318);}