@lovrabet/rabetbase-cli 2.3.13 → 2.3.14

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 (263) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/fetch-model-list.js +1 -1
  3. package/lib/api/generate-api-file.js +1 -1
  4. package/lib/auth/auth-server-ui.js +1 -1
  5. package/lib/auth/auth-server.js +1 -1
  6. package/lib/auth/constant.js +1 -1
  7. package/lib/auth/get-cookie.js +1 -1
  8. package/lib/auth/get-session-user.js +1 -1
  9. package/lib/auth/is-session-valid.js +1 -1
  10. package/lib/auth/login-success-html.js +1 -1
  11. package/lib/auth/logout.js +1 -1
  12. package/lib/cli-flags.js +1 -1
  13. package/lib/cli.js +1 -1
  14. package/lib/commands/api/generate.js +1 -1
  15. package/lib/commands/api/index.js +1 -1
  16. package/lib/commands/api/list.js +1 -1
  17. package/lib/commands/api/pull.js +1 -1
  18. package/lib/commands/api/shared.js +1 -1
  19. package/lib/commands/app/add.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/remote-directory.js +1 -1
  23. package/lib/commands/app/remove.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/logs/index.js +1 -1
  102. package/lib/commands/menu/asset-update.js +1 -1
  103. package/lib/commands/menu/delete.js +1 -1
  104. package/lib/commands/menu/external-link-create.js +1 -1
  105. package/lib/commands/menu/external-link-update.js +1 -1
  106. package/lib/commands/menu/group-create.js +1 -1
  107. package/lib/commands/menu/group-update.js +1 -1
  108. package/lib/commands/menu/index.js +1 -1
  109. package/lib/commands/menu/list.js +1 -1
  110. package/lib/commands/menu/move.js +1 -1
  111. package/lib/commands/menu/regroup-start.js +1 -1
  112. package/lib/commands/menu/shared/compare-table.js +1 -1
  113. package/lib/commands/menu/shared/delete-plan.js +1 -1
  114. package/lib/commands/menu/shared/facts.js +1 -1
  115. package/lib/commands/menu/shared/index.js +1 -1
  116. package/lib/commands/menu/shared/inquirer.js +1 -1
  117. package/lib/commands/menu/shared/local-pages.js +1 -1
  118. package/lib/commands/menu/shared/logic.js +1 -1
  119. package/lib/commands/menu/shared/mutations.js +1 -1
  120. package/lib/commands/menu/shared/service.js +1 -1
  121. package/lib/commands/menu/shared/sync-core.js +1 -1
  122. package/lib/commands/menu/shared/update-core.js +1 -1
  123. package/lib/commands/menu/shared/valid-url.js +1 -1
  124. package/lib/commands/menu/sync.js +1 -1
  125. package/lib/commands/notification/config-list.js +1 -1
  126. package/lib/commands/notification/index.js +1 -1
  127. package/lib/commands/ocr/index.js +1 -0
  128. package/lib/commands/page/generate-start.js +1 -1
  129. package/lib/commands/page/generate-status.js +1 -1
  130. package/lib/commands/page/index.js +1 -1
  131. package/lib/commands/page/pull.js +1 -1
  132. package/lib/commands/page/push.js +1 -1
  133. package/lib/commands/page/relation-audit.js +1 -1
  134. package/lib/commands/page/restore.js +1 -0
  135. package/lib/commands/page/shared.js +1 -1
  136. package/lib/commands/page/standard-page-status.js +1 -1
  137. package/lib/commands/page/sync.js +1 -1
  138. package/lib/commands/permit/index.js +1 -1
  139. package/lib/commands/permit/page-get.js +1 -1
  140. package/lib/commands/permit/page-set.js +1 -1
  141. package/lib/commands/permit/role-apis-set.js +1 -1
  142. package/lib/commands/permit/role-menus-set.js +1 -1
  143. package/lib/commands/permit/role-menus.js +1 -1
  144. package/lib/commands/permit/shared.js +1 -1
  145. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  146. package/lib/commands/project/create/format-elapsed.js +1 -1
  147. package/lib/commands/project/create/main.js +1 -1
  148. package/lib/commands/project/create/non-interactive.js +1 -1
  149. package/lib/commands/project/create/project-template-path.js +1 -1
  150. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  151. package/lib/commands/project/create/use-format-code.js +1 -1
  152. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  153. package/lib/commands/project/index.js +1 -1
  154. package/lib/commands/project/init.js +1 -1
  155. package/lib/commands/project/upgrade.js +1 -1
  156. package/lib/commands/registry.js +1 -1
  157. package/lib/commands/role/create.js +1 -1
  158. package/lib/commands/role/delete.js +1 -1
  159. package/lib/commands/role/detail.js +1 -1
  160. package/lib/commands/role/index.js +1 -1
  161. package/lib/commands/role/list.js +1 -1
  162. package/lib/commands/role/shared.js +1 -1
  163. package/lib/commands/role/update.js +1 -1
  164. package/lib/commands/role/user-add.js +1 -1
  165. package/lib/commands/role/user-remove.js +1 -1
  166. package/lib/commands/role/user-resolve.js +1 -1
  167. package/lib/commands/run/index.js +1 -1
  168. package/lib/commands/schema.js +1 -1
  169. package/lib/commands/sql/create.js +1 -1
  170. package/lib/commands/sql/delete.js +1 -1
  171. package/lib/commands/sql/detail.js +1 -1
  172. package/lib/commands/sql/exec.js +1 -1
  173. package/lib/commands/sql/index.js +1 -1
  174. package/lib/commands/sql/list.js +1 -1
  175. package/lib/commands/sql/pull.js +1 -1
  176. package/lib/commands/sql/push.js +1 -1
  177. package/lib/commands/sql/save.js +1 -1
  178. package/lib/commands/sql/shared.js +1 -1
  179. package/lib/commands/sql/status.js +1 -1
  180. package/lib/commands/sql/validate.js +1 -1
  181. package/lib/commands/task/index.js +1 -1
  182. package/lib/commands/task/status.js +1 -1
  183. package/lib/commands/workspace/add.js +1 -1
  184. package/lib/commands/workspace/index.js +1 -1
  185. package/lib/commands/workspace/remove.js +1 -1
  186. package/lib/config/schema.js +1 -1
  187. package/lib/constant/cdn.js +1 -1
  188. package/lib/constant/cli.js +1 -1
  189. package/lib/constant/defaults.js +1 -1
  190. package/lib/constant/domain.js +1 -1
  191. package/lib/constant/env.js +1 -1
  192. package/lib/constant/output.js +1 -1
  193. package/lib/constant/paths.js +1 -1
  194. package/lib/constant/risk.js +1 -1
  195. package/lib/context/app-resolver.js +1 -1
  196. package/lib/context/auth-resolver.js +1 -1
  197. package/lib/context/config-loader.js +1 -1
  198. package/lib/context.js +1 -1
  199. package/lib/core/alias-resolver.js +1 -1
  200. package/lib/core/api-client.js +1 -1
  201. package/lib/core/bff/config.js +1 -1
  202. package/lib/core/bff/file-system.js +1 -1
  203. package/lib/core/bff/hash.js +1 -1
  204. package/lib/core/bff/lock.js +1 -1
  205. package/lib/core/bff/utils.js +1 -1
  206. package/lib/core/db-resolver.js +1 -1
  207. package/lib/core/page/file-system.js +1 -1
  208. package/lib/core/page/hash.js +1 -1
  209. package/lib/core/page/lock.js +1 -1
  210. package/lib/core/sql-index-auditor.js +1 -1
  211. package/lib/core/sql-sync/config.js +1 -1
  212. package/lib/core/sql-sync/file-system.js +1 -1
  213. package/lib/core/sql-sync/hash.js +1 -1
  214. package/lib/core/sql-sync/lock.js +1 -1
  215. package/lib/core/sql-sync/utils.js +1 -1
  216. package/lib/core/sql-validator.js +1 -1
  217. package/lib/errors.js +1 -1
  218. package/lib/framework/build-all-flags.js +1 -1
  219. package/lib/framework/error-output.js +1 -1
  220. package/lib/framework/explicit-yes.js +1 -1
  221. package/lib/framework/flags.js +1 -1
  222. package/lib/framework/help.js +1 -1
  223. package/lib/framework/index.js +1 -1
  224. package/lib/framework/output.js +1 -1
  225. package/lib/framework/response.js +1 -1
  226. package/lib/framework/runner-alias.js +1 -1
  227. package/lib/framework/runner.js +1 -1
  228. package/lib/framework/schema-export.js +1 -1
  229. package/lib/framework/types.js +1 -1
  230. package/lib/generated/build-info.js +1 -1
  231. package/lib/help.js +1 -1
  232. package/lib/skills/main.js +1 -1
  233. package/lib/skills/npx-skills-add.js +1 -1
  234. package/lib/telemetry/cli-command-trace.js +1 -1
  235. package/lib/telemetry/cli-help-trace.js +1 -1
  236. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  237. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  238. package/lib/telemetry/send-cli-trace-log.js +1 -1
  239. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  240. package/lib/utils/ai_config.js +1 -1
  241. package/lib/utils/apply-jq-filter.js +1 -1
  242. package/lib/utils/cdn-config.js +1 -1
  243. package/lib/utils/check-sdk-version.js +1 -1
  244. package/lib/utils/cli-version-check.js +1 -1
  245. package/lib/utils/cli-version-policy.js +1 -1
  246. package/lib/utils/config.js +1 -1
  247. package/lib/utils/copy-directory.js +1 -1
  248. package/lib/utils/entity-with-id.js +1 -1
  249. package/lib/utils/file-utils.js +1 -1
  250. package/lib/utils/guides-cdn.js +1 -1
  251. package/lib/utils/http-client.js +1 -1
  252. package/lib/utils/is-non-interactive.js +1 -1
  253. package/lib/utils/logger.js +1 -1
  254. package/lib/utils/params.js +1 -1
  255. package/lib/utils/platform.js +1 -1
  256. package/lib/utils/rules-cdn.js +1 -1
  257. package/lib/utils/sleep.js +1 -1
  258. package/lib/utils/template-replacer.js +1 -1
  259. package/lib/utils/update-notice.js +1 -1
  260. package/lib/utils/version.js +1 -1
  261. package/lib/utils/with-active-cookie.js +1 -1
  262. package/lib/utils/write-cli-side-channel.js +1 -1
  263. package/package.json +1 -1
@@ -1 +1 @@
1
- const a160_0x435d4d=a160_0x5602;(function(_0x122b7d,_0x485c83){const _0x8d2907=a160_0x5602,_0x4cc9ef=_0x122b7d();while(!![]){try{const _0x3da389=-parseInt(_0x8d2907(0x1b9))/0x1+-parseInt(_0x8d2907(0x1c0))/0x2*(parseInt(_0x8d2907(0x17d))/0x3)+parseInt(_0x8d2907(0x17c))/0x4+-parseInt(_0x8d2907(0x1a7))/0x5*(parseInt(_0x8d2907(0x19f))/0x6)+-parseInt(_0x8d2907(0x192))/0x7*(-parseInt(_0x8d2907(0x1be))/0x8)+parseInt(_0x8d2907(0x1b1))/0x9+-parseInt(_0x8d2907(0x19b))/0xa;if(_0x3da389===_0x485c83)break;else _0x4cc9ef['push'](_0x4cc9ef['shift']());}catch(_0x1f19d){_0x4cc9ef['push'](_0x4cc9ef['shift']());}}}(a160_0x3888,0xa2f12));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':a160_0x435d4d(0x183)};export const ROLE_REF_FLAG={'name':a160_0x435d4d(0x18a),'type':a160_0x435d4d(0x1c1),'required':!![],'description':'Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)'};export const USER_REF_FLAG={'name':a160_0x435d4d(0x18f),'type':a160_0x435d4d(0x1c1),'required':!![],'description':a160_0x435d4d(0x1a0)};export const NAME_FLAG={'name':a160_0x435d4d(0x172),'type':a160_0x435d4d(0x1c1),'required':!![],'description':a160_0x435d4d(0x1b7)};export const USER_NAME_FLAG={'name':a160_0x435d4d(0x172),'type':'string','required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':a160_0x435d4d(0x195),'type':a160_0x435d4d(0x1c1),'required':![],'description':a160_0x435d4d(0x1ad)};export const EXPECT_USER_COUNT_FLAG={'name':a160_0x435d4d(0x1aa),'type':a160_0x435d4d(0x191),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=[a160_0x435d4d(0x19c),a160_0x435d4d(0x1ba),'USER'];export function isBuiltinRole(_0x49fd98){const _0x10a594=a160_0x435d4d;return BUILTIN_ROLE_TYPES[_0x10a594(0x1bf)](_0x49fd98);}export function assertCustomRole(_0x4359ca,_0x268387){const _0x43d031=a160_0x435d4d;if(_0x4359ca[_0x43d031(0x173)]!=='CUSTOM')throw CliErrors[_0x43d031(0x1a8)](_0x43d031(0x18d)+_0x268387+_0x43d031(0x19e)+_0x4359ca[_0x43d031(0x1a3)]+'\x20('+_0x4359ca[_0x43d031(0x173)]+').',_0x43d031(0x1a4));}export function assertPermConfigurable(_0x1ccadf){const _0x3c124c=a160_0x435d4d;if(_0x1ccadf[_0x3c124c(0x173)]===_0x3c124c(0x1ba)||_0x1ccadf['roleType']==='ADMIN')throw CliErrors[_0x3c124c(0x1a8)]('Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20'+_0x1ccadf[_0x3c124c(0x1a3)]+'\x20('+_0x1ccadf['roleType']+').',_0x3c124c(0x181));}function a160_0x5602(_0x5528d8,_0x51b873){_0x5528d8=_0x5528d8-0x172;const _0x3888bb=a160_0x3888();let _0x560288=_0x3888bb[_0x5528d8];return _0x560288;}export function projectRole(_0x4fcfc0){const _0x5ae911=a160_0x435d4d;return{'id':_0x4fcfc0['id'],'roleName':_0x4fcfc0[_0x5ae911(0x1a3)],'roleType':_0x4fcfc0[_0x5ae911(0x173)],'remark':_0x4fcfc0['remark'],'userCount':_0x4fcfc0[_0x5ae911(0x18c)],'permitCount':_0x4fcfc0[_0x5ae911(0x193)],'builtin':isBuiltinRole(_0x4fcfc0[_0x5ae911(0x173)])};}export async function resolveRoleRef(_0x40ef20,_0x4e60c8){const _0x857b4d=a160_0x435d4d,_0x2a4631=_0x4e60c8[_0x857b4d(0x176)]();if(!_0x2a4631)throw CliErrors[_0x857b4d(0x1a8)]('Missing\x20role\x20reference.',_0x857b4d(0x18b));if(/^\d+$/[_0x857b4d(0x1bb)](_0x2a4631))return getRoleById(_0x40ef20,Number(_0x2a4631));const _0x330c27=await listAllAppRoles(_0x40ef20),_0x3be0d6=_0x330c27['filter'](_0x6551f8=>_0x6551f8[_0x857b4d(0x1a3)]===_0x2a4631);if(_0x3be0d6[_0x857b4d(0x184)]===0x0)throw CliErrors[_0x857b4d(0x1a8)](_0x857b4d(0x194)+_0x2a4631+_0x857b4d(0x1ab)+_0x40ef20+'.',_0x857b4d(0x19d));if(_0x3be0d6['length']>0x1){const _0x572c99=_0x3be0d6[_0x857b4d(0x1a1)](_0x1ad3d9=>_0x1ad3d9['id'])[_0x857b4d(0x1a2)](',\x20');throw CliErrors[_0x857b4d(0x1a8)]('Role\x20name\x20\x22'+_0x2a4631+_0x857b4d(0x199)+_0x572c99+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x3be0d6[0x0];}export async function getRoleById(_0x146510,_0x4610c6){const _0x1ed7c3=a160_0x435d4d,_0x1cbe49=await getAppRole(_0x4610c6);if(!_0x1cbe49)throw CliErrors[_0x1ed7c3(0x1a8)](_0x1ed7c3(0x17f)+_0x4610c6+_0x1ed7c3(0x1bd)+_0x146510+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');return _0x1cbe49;}async function listAllAppRoles(_0x164e75){const _0x51acbf=a160_0x435d4d,_0x242a5a=0x64,_0x1e2f19=[];for(let _0x3a47c0=0x1;;_0x3a47c0+=0x1){const {items:_0x1a5d47,paging:_0x25917f}=await listAppRoles(_0x164e75,{'currentPage':_0x3a47c0,'pageSize':_0x242a5a});_0x1e2f19['push'](..._0x1a5d47);if(_0x1a5d47['length']<_0x242a5a||_0x25917f&&_0x1e2f19[_0x51acbf(0x184)]>=_0x25917f[_0x51acbf(0x1a5)])return _0x1e2f19;}}export async function resolveTenantCode(){const _0x34bb8c=a160_0x435d4d,_0x413048=await getSessionUserInfo(),_0x16bb18=_0x413048?.[_0x34bb8c(0x18f)]?.[_0x34bb8c(0x18e)]?.[_0x34bb8c(0x175)];if(!_0x16bb18)throw CliErrors[_0x34bb8c(0x17a)](_0x34bb8c(0x177));return _0x16bb18;}function matchMember(_0x10c088,_0x35f288){const _0x318607=a160_0x435d4d,_0x5d7beb=_0x35f288['trim']()[_0x318607(0x197)]();return(_0x10c088[_0x318607(0x1b4)]??'')[_0x318607(0x197)]()===_0x5d7beb||(_0x10c088[_0x318607(0x182)]??'')['toLowerCase']()===_0x5d7beb;}export async function resolveUserRef(_0x1a9f9e){const _0x2bf0c7=a160_0x435d4d,_0x8d3b42=_0x1a9f9e['trim']();if(!_0x8d3b42)throw CliErrors['validation'](_0x2bf0c7(0x1a6),'Pass\x20--user\x20<id|name>.');const _0x4ab9fe=await resolveTenantCode(),_0x19148b=await getTenantMembers(_0x4ab9fe);if(/^\d+$/['test'](_0x8d3b42)){const _0x4aef99=Number(_0x8d3b42),_0x59429a=_0x19148b['find'](_0x33b483=>_0x33b483[_0x2bf0c7(0x198)]===_0x4aef99);return{'userId':_0x4aef99,'username':_0x59429a?.[_0x2bf0c7(0x182)]??String(_0x4aef99),'nickname':_0x59429a?.['nickname'],'matchedBy':'id'};}const _0x5c799a=_0x19148b[_0x2bf0c7(0x1b5)](_0xb7df0=>matchMember(_0xb7df0,_0x8d3b42));if(_0x5c799a[_0x2bf0c7(0x184)]===0x0)throw CliErrors['validation'](_0x2bf0c7(0x179)+_0x8d3b42+'\x22.',_0x2bf0c7(0x1bc));if(_0x5c799a[_0x2bf0c7(0x184)]>0x1){const _0xf7915d=_0x5c799a['map'](_0x386773=>(_0x386773[_0x2bf0c7(0x1b4)]??_0x386773[_0x2bf0c7(0x182)]??'?')+'('+_0x386773[_0x2bf0c7(0x198)]+')')[_0x2bf0c7(0x1a2)](',\x20');throw CliErrors[_0x2bf0c7(0x1a8)](_0x2bf0c7(0x1b8)+_0x8d3b42+_0x2bf0c7(0x1ac)+_0xf7915d+'.',_0x2bf0c7(0x1b3));}const _0x2b6d67=_0x5c799a[0x0];return{'userId':_0x2b6d67[_0x2bf0c7(0x198)],'username':_0x2b6d67[_0x2bf0c7(0x182)]??String(_0x2b6d67[_0x2bf0c7(0x198)]),'nickname':_0x2b6d67[_0x2bf0c7(0x1b4)],'matchedBy':_0x2bf0c7(0x172)};}function a160_0x3888(){const _0x2b12e2=['DEV','test','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','\x20not\x20found\x20in\x20app\x20','4190440yvjFAJ','includes','45542wLVthh','string','name','roleType','Pass\x20--user\x20<id|name>.','tenant_code','trim','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','\x20member(s)\x20but\x20role\x20has\x20','No\x20tenant\x20member\x20matches\x20\x22','authRequired','\x20is\x20not\x20a\x20member\x20of\x20role\x20','2396524aNFcED','171PxitPU','userList','Role\x20id\x20','expectUserCount','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','username','Role\x20id\x20(from\x20`role\x20list`)','length','str',';\x20no\x20change.','dryRun','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','appCode','role','Pass\x20--role\x20<id|name>.','userCount','Cannot\x20','tenant','user','push','number','14McYYsI','permitCount','Role\x20name\x20\x22','remark','splice','toLowerCase','userId','\x22\x20is\x20ambiguous\x20(ids:\x20','Anti-drift\x20check\x20failed:\x20expected\x20','3575170dMmkvw','ADMIN','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','\x20built-in\x20role\x20','156mTnQNz','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','map','join','roleName','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','totalCount','Missing\x20user\x20reference.','11395mmemMH','validation','flagMissing','expect-user-count','\x22\x20not\x20found\x20in\x20app\x20','\x22:\x20','Optional\x20role\x20remark/description','user-add','/smartapi/permit/user-role/update-user-list','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','9569772qIXSdh','\x20is\x20already\x20a\x20member\x20of\x20role\x20','Disambiguate\x20with\x20--user\x20<id>.','nickname','filter','User\x20','Role\x20name','Multiple\x20tenant\x20members\x20match\x20\x22','327921JFZZNu'];a160_0x3888=function(){return _0x2b12e2;};return a160_0x3888();}export const UPDATE_USER_LIST_PATH=a160_0x435d4d(0x1af);function userIdsOf(_0x5e01d6){const _0x3ff344=a160_0x435d4d;return(_0x5e01d6?.[_0x3ff344(0x17e)]??[])[_0x3ff344(0x1a1)](_0x5b052a=>_0x5b052a['userId']);}export function computeRoleUserMutation(_0x5e272e){const _0x3a975a=a160_0x435d4d,{operation:_0x5ea7c8,appCode:_0x5a1ede,roleUsers:_0xa96052,targetRoleId:_0xb0090,user:_0x18a318}=_0x5e272e,_0x555eb1=_0xa96052['find'](_0x299b7e=>_0x299b7e['id']===_0xb0090);if(!_0x555eb1)throw CliErrors[_0x3a975a(0x1a8)](_0x3a975a(0x17f)+_0xb0090+'\x20not\x20found\x20in\x20the\x20user-role\x20list.',_0x3a975a(0x1b0));const _0x4e45f0=userIdsOf(_0x555eb1),_0x21e7d0=[];if(_0x5e272e[_0x3a975a(0x180)]!==undefined&&_0x5e272e[_0x3a975a(0x180)]!==_0x4e45f0[_0x3a975a(0x184)])throw CliErrors[_0x3a975a(0x1a8)](_0x3a975a(0x19a)+_0x5e272e[_0x3a975a(0x180)]+_0x3a975a(0x178)+_0x4e45f0['length']+'.',_0x3a975a(0x188));const _0x1d2bcd=_0x4e45f0['includes'](_0x18a318['userId']);let _0x46de3b=![];const _0xa52398=[..._0x555eb1[_0x3a975a(0x17e)]];if(_0x5ea7c8===_0x3a975a(0x1ae))_0x1d2bcd?_0x21e7d0[_0x3a975a(0x190)](_0x3a975a(0x1b6)+_0x18a318[_0x3a975a(0x198)]+_0x3a975a(0x1b2)+_0x555eb1[_0x3a975a(0x1a3)]+_0x3a975a(0x186)):(_0xa52398[_0x3a975a(0x190)]({'userId':_0x18a318[_0x3a975a(0x198)],'username':_0x18a318[_0x3a975a(0x182)],..._0x18a318[_0x3a975a(0x1b4)]?{'nickname':_0x18a318['nickname']}:{}}),_0x46de3b=!![]);else{if(!_0x1d2bcd)_0x21e7d0['push'](_0x3a975a(0x1b6)+_0x18a318[_0x3a975a(0x198)]+_0x3a975a(0x17b)+_0x555eb1[_0x3a975a(0x1a3)]+_0x3a975a(0x186));else{const _0x3297bc=_0xa52398['findIndex'](_0x20949c=>_0x20949c[_0x3a975a(0x198)]===_0x18a318[_0x3a975a(0x198)]);if(_0x3297bc>=0x0)_0xa52398[_0x3a975a(0x196)](_0x3297bc,0x1);_0x46de3b=!![];}}const _0x5ef457=_0xa96052[_0x3a975a(0x1a1)](_0x683fbd=>_0x683fbd['id']===_0xb0090?{..._0x683fbd,'userList':_0xa52398}:_0x683fbd),_0x5e7abd=_0xa52398[_0x3a975a(0x1a1)](_0x1d88ee=>_0x1d88ee[_0x3a975a(0x198)]),_0x41d03a={'operation':_0x5ea7c8,'selector':{'appCode':_0x5a1ede,'roleId':_0xb0090,'roleName':_0x555eb1[_0x3a975a(0x1a3)],'userId':_0x18a318[_0x3a975a(0x198)]},'before':{'userIds':_0x4e45f0},'after':{'userIds':_0x5e7abd},'dryRun':_0x5e272e[_0x3a975a(0x187)],'backend':{'method':'POST','path':UPDATE_USER_LIST_PATH},'warnings':_0x21e7d0};return{'roleList':_0x5ef457,'mutation':_0x41d03a,'changed':_0x46de3b};}export async function loadRoleUsers(_0xdbcacd){return listRoleUsers(_0xdbcacd);}export function readRoleRef(_0x333f1c){const _0x267ef6=a160_0x435d4d,_0x233746=_0x333f1c[_0x267ef6(0x185)](_0x267ef6(0x18a))[_0x267ef6(0x176)]();if(!_0x233746)throw CliErrors[_0x267ef6(0x1a9)](_0x267ef6(0x18a),_0x267ef6(0x18b));return _0x233746;}export async function prepareUserMutation(_0x1525e1,_0x49f64b,_0x1142c0){const _0x20f6f0=a160_0x435d4d,_0x16e472=readRoleRef(_0x1525e1),_0x558b44=_0x1525e1[_0x20f6f0(0x185)]('user')[_0x20f6f0(0x176)]();if(!_0x558b44)throw CliErrors['flagMissing'](_0x20f6f0(0x18f),_0x20f6f0(0x174));const _0x520f83=_0x1525e1['flag'](_0x20f6f0(0x1aa)),_0x35e8ee=_0x520f83===undefined||_0x520f83===null?undefined:Number(_0x520f83),_0x31562a=await resolveRoleRef(_0x1525e1[_0x20f6f0(0x189)],_0x16e472),_0x534022=await resolveUserRef(_0x558b44),_0x62808a=await loadRoleUsers(_0x1525e1[_0x20f6f0(0x189)]);return computeRoleUserMutation({'operation':_0x49f64b,'appCode':_0x1525e1[_0x20f6f0(0x189)],'roleUsers':_0x62808a,'targetRoleId':_0x31562a['id'],'user':{'userId':_0x534022['userId'],'username':_0x534022[_0x20f6f0(0x182)],'nickname':_0x534022[_0x20f6f0(0x1b4)]},'dryRun':_0x1142c0,..._0x35e8ee!==undefined?{'expectUserCount':_0x35e8ee}:{}});}
1
+ const a162_0x4c2c2c=a162_0x5da9;(function(_0x262741,_0x42914c){const _0x12aa88=a162_0x5da9,_0x1a357d=_0x262741();while(!![]){try{const _0x131ff1=-parseInt(_0x12aa88(0xa9))/0x1+-parseInt(_0x12aa88(0x7e))/0x2*(-parseInt(_0x12aa88(0x84))/0x3)+parseInt(_0x12aa88(0x91))/0x4*(-parseInt(_0x12aa88(0xa6))/0x5)+parseInt(_0x12aa88(0xa5))/0x6*(-parseInt(_0x12aa88(0xba))/0x7)+-parseInt(_0x12aa88(0xac))/0x8+parseInt(_0x12aa88(0xa1))/0x9+-parseInt(_0x12aa88(0x95))/0xa*(-parseInt(_0x12aa88(0xb6))/0xb);if(_0x131ff1===_0x42914c)break;else _0x1a357d['push'](_0x1a357d['shift']());}catch(_0x51ff50){_0x1a357d['push'](_0x1a357d['shift']());}}}(a162_0x50e1,0x9e5cd));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';function a162_0x5da9(_0x15db39,_0x13c01f){_0x15db39=_0x15db39-0x7b;const _0x50e151=a162_0x50e1();let _0x5da999=_0x50e151[_0x15db39];return _0x5da999;}import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a162_0x4c2c2c(0x8d),'required':!![],'description':a162_0x4c2c2c(0x9b)};export const ROLE_REF_FLAG={'name':a162_0x4c2c2c(0xb9),'type':a162_0x4c2c2c(0x92),'required':!![],'description':a162_0x4c2c2c(0x9c)};export const USER_REF_FLAG={'name':a162_0x4c2c2c(0xc2),'type':a162_0x4c2c2c(0x92),'required':!![],'description':'User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'};export const NAME_FLAG={'name':a162_0x4c2c2c(0x88),'type':'string','required':!![],'description':a162_0x4c2c2c(0x7c)};export const USER_NAME_FLAG={'name':a162_0x4c2c2c(0x88),'type':a162_0x4c2c2c(0x92),'required':!![],'description':a162_0x4c2c2c(0xc6)};export const REMARK_FLAG={'name':a162_0x4c2c2c(0x9f),'type':a162_0x4c2c2c(0x92),'required':![],'description':a162_0x4c2c2c(0x7d)};export const EXPECT_USER_COUNT_FLAG={'name':a162_0x4c2c2c(0xb4),'type':a162_0x4c2c2c(0x8d),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=[a162_0x4c2c2c(0x89),a162_0x4c2c2c(0xa7),'USER'];export function isBuiltinRole(_0x359df0){const _0x1f4e5e=a162_0x4c2c2c;return BUILTIN_ROLE_TYPES[_0x1f4e5e(0xc4)](_0x359df0);}export function assertCustomRole(_0x592255,_0x46bb49){const _0x9328dc=a162_0x4c2c2c;if(_0x592255[_0x9328dc(0x99)]!=='CUSTOM')throw CliErrors['validation'](_0x9328dc(0x9d)+_0x46bb49+'\x20built-in\x20role\x20'+_0x592255[_0x9328dc(0x9e)]+'\x20('+_0x592255[_0x9328dc(0x99)]+').',_0x9328dc(0xbd));}export function assertPermConfigurable(_0x4ebc4c){const _0x4e10ac=a162_0x4c2c2c;if(_0x4ebc4c['roleType']==='DEV'||_0x4ebc4c['roleType']===_0x4e10ac(0x89))throw CliErrors[_0x4e10ac(0x82)]('Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20'+_0x4ebc4c[_0x4e10ac(0x9e)]+'\x20('+_0x4ebc4c[_0x4e10ac(0x99)]+').','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.');}export function projectRole(_0x4d516b){const _0x1e4676=a162_0x4c2c2c;return{'id':_0x4d516b['id'],'roleName':_0x4d516b['roleName'],'roleType':_0x4d516b[_0x1e4676(0x99)],'remark':_0x4d516b[_0x1e4676(0x9f)],'userCount':_0x4d516b['userCount'],'permitCount':_0x4d516b[_0x1e4676(0xa3)],'builtin':isBuiltinRole(_0x4d516b[_0x1e4676(0x99)])};}export async function resolveRoleRef(_0x524f66,_0x19156a){const _0x21557f=a162_0x4c2c2c,_0x1e3b75=_0x19156a[_0x21557f(0xbc)]();if(!_0x1e3b75)throw CliErrors[_0x21557f(0x82)](_0x21557f(0x8a),_0x21557f(0x8b));if(/^\d+$/[_0x21557f(0x83)](_0x1e3b75))return getRoleById(_0x524f66,Number(_0x1e3b75));const _0x3ce3f6=await listAllAppRoles(_0x524f66),_0x5ed3f0=_0x3ce3f6[_0x21557f(0x9a)](_0x4cc7ef=>_0x4cc7ef[_0x21557f(0x9e)]===_0x1e3b75);if(_0x5ed3f0[_0x21557f(0xa4)]===0x0)throw CliErrors[_0x21557f(0x82)](_0x21557f(0xb5)+_0x1e3b75+'\x22\x20not\x20found\x20in\x20app\x20'+_0x524f66+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.');if(_0x5ed3f0[_0x21557f(0xa4)]>0x1){const _0x3ee3b0=_0x5ed3f0[_0x21557f(0xa0)](_0x4b1399=>_0x4b1399['id'])[_0x21557f(0xc3)](',\x20');throw CliErrors['validation']('Role\x20name\x20\x22'+_0x1e3b75+_0x21557f(0x8f)+_0x3ee3b0+').',_0x21557f(0xc5));}return _0x5ed3f0[0x0];}export async function getRoleById(_0x2b17d1,_0x13e731){const _0x5ef0fd=a162_0x4c2c2c,_0x151620=await getAppRole(_0x13e731);if(!_0x151620)throw CliErrors['validation'](_0x5ef0fd(0x8c)+_0x13e731+_0x5ef0fd(0xaf)+_0x2b17d1+'.',_0x5ef0fd(0xa8));return _0x151620;}async function listAllAppRoles(_0x167b6b){const _0x3821ee=a162_0x4c2c2c,_0x5502c3=0x64,_0x505d13=[];for(let _0x49f72d=0x1;;_0x49f72d+=0x1){const {items:_0x8dc50f,paging:_0x5d9dfb}=await listAppRoles(_0x167b6b,{'currentPage':_0x49f72d,'pageSize':_0x5502c3});_0x505d13[_0x3821ee(0x94)](..._0x8dc50f);if(_0x8dc50f[_0x3821ee(0xa4)]<_0x5502c3||_0x5d9dfb&&_0x505d13[_0x3821ee(0xa4)]>=_0x5d9dfb[_0x3821ee(0xab)])return _0x505d13;}}export async function resolveTenantCode(){const _0x213140=a162_0x4c2c2c,_0xd40d0b=await getSessionUserInfo(),_0x432046=_0xd40d0b?.[_0x213140(0xc2)]?.['tenant']?.[_0x213140(0xa2)];if(!_0x432046)throw CliErrors['authRequired'](_0x213140(0x96));return _0x432046;}function matchMember(_0x2f96b8,_0x82ecdd){const _0x356b4d=a162_0x4c2c2c,_0x4b067b=_0x82ecdd[_0x356b4d(0xbc)]()[_0x356b4d(0xb1)]();return(_0x2f96b8[_0x356b4d(0x86)]??'')['toLowerCase']()===_0x4b067b||(_0x2f96b8[_0x356b4d(0xb7)]??'')['toLowerCase']()===_0x4b067b;}export async function resolveUserRef(_0x5502a6){const _0x5a5a6e=a162_0x4c2c2c,_0x16daf2=_0x5502a6[_0x5a5a6e(0xbc)]();if(!_0x16daf2)throw CliErrors[_0x5a5a6e(0x82)](_0x5a5a6e(0x90),'Pass\x20--user\x20<id|name>.');const _0x5e75ca=await resolveTenantCode(),_0x168cff=await getTenantMembers(_0x5e75ca);if(/^\d+$/[_0x5a5a6e(0x83)](_0x16daf2)){const _0x5db51c=Number(_0x16daf2),_0x2a46b5=_0x168cff['find'](_0x5c23bf=>_0x5c23bf[_0x5a5a6e(0xaa)]===_0x5db51c);return{'userId':_0x5db51c,'username':_0x2a46b5?.[_0x5a5a6e(0xb7)]??String(_0x5db51c),'nickname':_0x2a46b5?.[_0x5a5a6e(0x86)],'matchedBy':'id'};}const _0x26dd26=_0x168cff[_0x5a5a6e(0x9a)](_0xb63de=>matchMember(_0xb63de,_0x16daf2));if(_0x26dd26['length']===0x0)throw CliErrors['validation'](_0x5a5a6e(0x85)+_0x16daf2+'\x22.',_0x5a5a6e(0xbb));if(_0x26dd26[_0x5a5a6e(0xa4)]>0x1){const _0xf97df8=_0x26dd26[_0x5a5a6e(0xa0)](_0x4f033e=>(_0x4f033e[_0x5a5a6e(0x86)]??_0x4f033e[_0x5a5a6e(0xb7)]??'?')+'('+_0x4f033e['userId']+')')[_0x5a5a6e(0xc3)](',\x20');throw CliErrors[_0x5a5a6e(0x82)](_0x5a5a6e(0x8e)+_0x16daf2+_0x5a5a6e(0xc7)+_0xf97df8+'.',_0x5a5a6e(0xb2));}const _0x45d382=_0x26dd26[0x0];return{'userId':_0x45d382[_0x5a5a6e(0xaa)],'username':_0x45d382['username']??String(_0x45d382[_0x5a5a6e(0xaa)]),'nickname':_0x45d382['nickname'],'matchedBy':_0x5a5a6e(0x88)};}export const UPDATE_USER_LIST_PATH=a162_0x4c2c2c(0x97);function userIdsOf(_0x1b3727){const _0x16c4c1=a162_0x4c2c2c;return(_0x1b3727?.[_0x16c4c1(0xb0)]??[])['map'](_0x5225f3=>_0x5225f3[_0x16c4c1(0xaa)]);}export function computeRoleUserMutation(_0x523d06){const _0x2cdeb2=a162_0x4c2c2c,{operation:_0x4eca12,appCode:_0x42f973,roleUsers:_0x35de4a,targetRoleId:_0x1d8d3c,user:_0x3fe58d}=_0x523d06,_0x3a489a=_0x35de4a['find'](_0x2d2cdc=>_0x2d2cdc['id']===_0x1d8d3c);if(!_0x3a489a)throw CliErrors['validation'](_0x2cdeb2(0x8c)+_0x1d8d3c+_0x2cdeb2(0x7b),'Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');const _0x47197b=userIdsOf(_0x3a489a),_0x31830e=[];if(_0x523d06[_0x2cdeb2(0x7f)]!==undefined&&_0x523d06[_0x2cdeb2(0x7f)]!==_0x47197b['length'])throw CliErrors[_0x2cdeb2(0x82)]('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x523d06['expectUserCount']+_0x2cdeb2(0xc1)+_0x47197b[_0x2cdeb2(0xa4)]+'.',_0x2cdeb2(0x98));const _0x38ce7b=_0x47197b[_0x2cdeb2(0xc4)](_0x3fe58d[_0x2cdeb2(0xaa)]);let _0x46a3e6=![];const _0x2a418d=[..._0x3a489a[_0x2cdeb2(0xb0)]];if(_0x4eca12==='user-add')_0x38ce7b?_0x31830e[_0x2cdeb2(0x94)](_0x2cdeb2(0xae)+_0x3fe58d[_0x2cdeb2(0xaa)]+_0x2cdeb2(0x87)+_0x3a489a[_0x2cdeb2(0x9e)]+_0x2cdeb2(0xb3)):(_0x2a418d['push']({'userId':_0x3fe58d['userId'],'username':_0x3fe58d[_0x2cdeb2(0xb7)],..._0x3fe58d[_0x2cdeb2(0x86)]?{'nickname':_0x3fe58d['nickname']}:{}}),_0x46a3e6=!![]);else{if(!_0x38ce7b)_0x31830e[_0x2cdeb2(0x94)](_0x2cdeb2(0xae)+_0x3fe58d[_0x2cdeb2(0xaa)]+_0x2cdeb2(0xbf)+_0x3a489a[_0x2cdeb2(0x9e)]+';\x20no\x20change.');else{const _0x48d710=_0x2a418d[_0x2cdeb2(0xad)](_0x1decdb=>_0x1decdb[_0x2cdeb2(0xaa)]===_0x3fe58d[_0x2cdeb2(0xaa)]);if(_0x48d710>=0x0)_0x2a418d[_0x2cdeb2(0xc0)](_0x48d710,0x1);_0x46a3e6=!![];}}const _0x54ce03=_0x35de4a['map'](_0x1936df=>_0x1936df['id']===_0x1d8d3c?{..._0x1936df,'userList':_0x2a418d}:_0x1936df),_0x3705cc=_0x2a418d[_0x2cdeb2(0xa0)](_0x2bd851=>_0x2bd851['userId']),_0x211839={'operation':_0x4eca12,'selector':{'appCode':_0x42f973,'roleId':_0x1d8d3c,'roleName':_0x3a489a[_0x2cdeb2(0x9e)],'userId':_0x3fe58d['userId']},'before':{'userIds':_0x47197b},'after':{'userIds':_0x3705cc},'dryRun':_0x523d06[_0x2cdeb2(0xb8)],'backend':{'method':'POST','path':UPDATE_USER_LIST_PATH},'warnings':_0x31830e};return{'roleList':_0x54ce03,'mutation':_0x211839,'changed':_0x46a3e6};}export async function loadRoleUsers(_0x2f8482){return listRoleUsers(_0x2f8482);}export function readRoleRef(_0x3ac224){const _0x547412=a162_0x4c2c2c,_0x40f671=_0x3ac224[_0x547412(0x80)]('role')['trim']();if(!_0x40f671)throw CliErrors['flagMissing']('role','Pass\x20--role\x20<id|name>.');return _0x40f671;}export async function prepareUserMutation(_0x5c26b8,_0x5b8627,_0x509bbb){const _0x117d17=a162_0x4c2c2c,_0x4e1e3a=readRoleRef(_0x5c26b8),_0x356f36=_0x5c26b8['str']('user')[_0x117d17(0xbc)]();if(!_0x356f36)throw CliErrors[_0x117d17(0x81)](_0x117d17(0xc2),_0x117d17(0xbe));const _0x7f2bcf=_0x5c26b8[_0x117d17(0x93)](_0x117d17(0xb4)),_0x55762a=_0x7f2bcf===undefined||_0x7f2bcf===null?undefined:Number(_0x7f2bcf),_0x4e4a73=await resolveRoleRef(_0x5c26b8[_0x117d17(0xc8)],_0x4e1e3a),_0x150a49=await resolveUserRef(_0x356f36),_0x1b7407=await loadRoleUsers(_0x5c26b8[_0x117d17(0xc8)]);return computeRoleUserMutation({'operation':_0x5b8627,'appCode':_0x5c26b8[_0x117d17(0xc8)],'roleUsers':_0x1b7407,'targetRoleId':_0x4e4a73['id'],'user':{'userId':_0x150a49[_0x117d17(0xaa)],'username':_0x150a49[_0x117d17(0xb7)],'nickname':_0x150a49[_0x117d17(0x86)]},'dryRun':_0x509bbb,..._0x55762a!==undefined?{'expectUserCount':_0x55762a}:{}});}function a162_0x50e1(){const _0x41c1fe=['trim','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','Pass\x20--user\x20<id|name>.','\x20is\x20not\x20a\x20member\x20of\x20role\x20','splice','\x20member(s)\x20but\x20role\x20has\x20','user','join','includes','Disambiguate\x20with\x20--role\x20<id>.','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','\x22:\x20','appCode','\x20not\x20found\x20in\x20the\x20user-role\x20list.','Role\x20name','Optional\x20role\x20remark/description','274996zMsRjL','expectUserCount','str','flagMissing','validation','test','21bGFBoJ','No\x20tenant\x20member\x20matches\x20\x22','nickname','\x20is\x20already\x20a\x20member\x20of\x20role\x20','name','ADMIN','Missing\x20role\x20reference.','Pass\x20--role\x20<id|name>.','Role\x20id\x20','number','Multiple\x20tenant\x20members\x20match\x20\x22','\x22\x20is\x20ambiguous\x20(ids:\x20','Missing\x20user\x20reference.','99296jSFQmK','string','flag','push','7760fKVfZl','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','/smartapi/permit/user-role/update-user-list','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','roleType','filter','Role\x20id\x20(from\x20`role\x20list`)','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','Cannot\x20','roleName','remark','map','7237827ehIatv','tenant_code','permitCount','length','438krrlpY','160YoNzlO','DEV','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','411990UlEqHT','userId','totalCount','8826360OudYFI','findIndex','User\x20','\x20not\x20found\x20in\x20app\x20','userList','toLowerCase','Disambiguate\x20with\x20--user\x20<id>.',';\x20no\x20change.','expect-user-count','Role\x20name\x20\x22','34573IzrQGH','username','dryRun','role','119609GUTBjg','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.'];a162_0x50e1=function(){return _0x41c1fe;};return a162_0x50e1();}
@@ -1 +1 @@
1
- const a161_0x32b476=a161_0x3e7d;(function(_0x20a914,_0xd071ec){const _0x23d6b9=a161_0x3e7d,_0x456c5b=_0x20a914();while(!![]){try{const _0x5e89aa=-parseInt(_0x23d6b9(0x118))/0x1+-parseInt(_0x23d6b9(0x11c))/0x2*(parseInt(_0x23d6b9(0x119))/0x3)+-parseInt(_0x23d6b9(0x123))/0x4+-parseInt(_0x23d6b9(0x121))/0x5+-parseInt(_0x23d6b9(0x10a))/0x6*(-parseInt(_0x23d6b9(0x114))/0x7)+parseInt(_0x23d6b9(0x11f))/0x8*(parseInt(_0x23d6b9(0x10f))/0x9)+-parseInt(_0x23d6b9(0x10c))/0xa*(-parseInt(_0x23d6b9(0x11e))/0xb);if(_0x5e89aa===_0xd071ec)break;else _0x456c5b['push'](_0x456c5b['shift']());}catch(_0x1a9e65){_0x456c5b['push'](_0x456c5b['shift']());}}}(a161_0x4f2a,0xa9bc1));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a161_0x4f2a(){const _0x5ea743=['16304180uQQBDi','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','/smartapi/permit/role/update','9AxiNdt','New\x20role\x20name','num','role','POST','7Scrpeb','appCode','--name\x20cannot\x20be\x20empty.','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','1381234gzCDQF','36330pLzYWa','\x20(id=','trim','16ttDlHv','write','11lPLgxW','160408IKDkEz','string','1083495NrbSbL','update','2259588XvXqnz','remark','flag','roleName','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','validation','7826844edYHoy','name'];a161_0x4f2a=function(){return _0x5ea743;};return a161_0x4f2a();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a161_0x3e7d(_0x3c1441,_0x4364f6){_0x3c1441=_0x3c1441-0x105;const _0x4f2a18=a161_0x4f2a();let _0x3e7d4a=_0x4f2a18[_0x3c1441];return _0x3e7d4a;}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=a161_0x32b476(0x10e);function readPatch(_0x44d2bb){const _0x1953a9=a161_0x32b476,_0x333d4d=_0x44d2bb[_0x1953a9(0x106)](_0x1953a9(0x10b)),_0x555752=_0x44d2bb['flag'](_0x1953a9(0x105)),_0x4b181b={};if(_0x333d4d!==undefined&&_0x333d4d!==null){const _0x32b0d0=String(_0x333d4d)[_0x1953a9(0x11b)]();if(!_0x32b0d0)throw CliErrors[_0x1953a9(0x109)](_0x1953a9(0x116));if(_0x32b0d0['length']>0x40)throw CliErrors[_0x1953a9(0x109)](_0x1953a9(0x117));_0x4b181b[_0x1953a9(0x107)]=_0x32b0d0;}_0x555752!==undefined&&_0x555752!==null&&(_0x4b181b[_0x1953a9(0x105)]=String(_0x555752));if(_0x4b181b['roleName']===undefined&&_0x4b181b[_0x1953a9(0x105)]===undefined)throw CliErrors[_0x1953a9(0x109)]('Nothing\x20to\x20update.',_0x1953a9(0x10d));return _0x4b181b;}export const roleUpdate={'service':a161_0x32b476(0x112),'command':a161_0x32b476(0x122),'description':a161_0x32b476(0x108),'risk':a161_0x32b476(0x11d),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':'name','type':a161_0x32b476(0x120),'required':![],'description':a161_0x32b476(0x110)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x52882f){readPatch(_0x52882f);},async 'dryRun'(_0x1a6d66){const _0x3223f7=a161_0x32b476,_0x27fd64=_0x1a6d66[_0x3223f7(0x111)]('id'),_0x4a7f41=readPatch(_0x1a6d66),_0x35f8b6=await getRoleById(_0x1a6d66[_0x3223f7(0x115)],_0x27fd64);return assertCustomRole(_0x35f8b6,_0x3223f7(0x122)),asDryRunResult({'operation':_0x3223f7(0x122),'selector':{'appCode':_0x1a6d66[_0x3223f7(0x115)],'roleId':_0x27fd64,'roleName':_0x35f8b6['roleName']},'before':projectRole(_0x35f8b6),'after':projectRole({..._0x35f8b6,..._0x4a7f41['roleName']!==undefined?{'roleName':_0x4a7f41[_0x3223f7(0x107)]}:{},..._0x4a7f41[_0x3223f7(0x105)]!==undefined?{'remark':_0x4a7f41[_0x3223f7(0x105)]}:{}}),'dryRun':!![],'backend':{'method':_0x3223f7(0x113),'path':UPDATE_PATH},'warnings':[]},{'method':_0x3223f7(0x113),'url':UPDATE_PATH});},async 'execute'(_0x5922da){const _0x57093a=a161_0x32b476,_0x44c501=_0x5922da[_0x57093a(0x111)]('id'),_0x11ccdc=readPatch(_0x5922da),_0x2c990b=await getRoleById(_0x5922da['appCode'],_0x44c501);assertCustomRole(_0x2c990b,_0x57093a(0x122)),await updateAppRole({'id':_0x44c501,'appCode':_0x5922da[_0x57093a(0x115)],..._0x11ccdc[_0x57093a(0x107)]!==undefined?{'roleName':_0x11ccdc['roleName']}:{},..._0x11ccdc[_0x57093a(0x105)]!==undefined?{'remark':_0x11ccdc[_0x57093a(0x105)]}:{}});const _0x442c7b=await getRoleById(_0x5922da[_0x57093a(0x115)],_0x44c501);return{'ok':!![],'data':{'operation':_0x57093a(0x122),'selector':{'appCode':_0x5922da[_0x57093a(0x115)],'roleId':_0x44c501,'roleName':_0x442c7b['roleName']},'before':projectRole(_0x2c990b),'after':projectRole(_0x442c7b),'dryRun':![],'backend':{'method':_0x57093a(0x113),'path':UPDATE_PATH},'warnings':[]},'message':'Updated\x20role\x20'+_0x442c7b['roleName']+_0x57093a(0x11a)+_0x44c501+')'};}};
1
+ const a163_0x4f2279=a163_0x1f22;function a163_0x1f22(_0x1dcc01,_0x4e044e){_0x1dcc01=_0x1dcc01-0x83;const _0x16afef=a163_0x16af();let _0x1f228c=_0x16afef[_0x1dcc01];return _0x1f228c;}function a163_0x16af(){const _0x57ef76=['New\x20role\x20name','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','update','roleName','56ezoOgR','4926018FwKDGh','POST','5WuuYNl','/smartapi/permit/role/update','length','635117dxjEik','--name\x20cannot\x20be\x20empty.','217900HFIeIJ','10MyKykU','130143hKcTrf','143DZyoYb','flag','write','appCode','validation','Updated\x20role\x20','27TrIilI','5061468BNOVDI','1958HSgQzA','11ppyaFK','Nothing\x20to\x20update.','num','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','remark','966xzfpID','13066236wKpFKr','name'];a163_0x16af=function(){return _0x57ef76;};return a163_0x16af();}(function(_0x42ee09,_0x437168){const _0x3506e6=a163_0x1f22,_0x1b2c5d=_0x42ee09();while(!![]){try{const _0xe10028=-parseInt(_0x3506e6(0x8f))/0x1*(-parseInt(_0x3506e6(0x97))/0x2)+parseInt(_0x3506e6(0x95))/0x3*(-parseInt(_0x3506e6(0x8c))/0x4)+-parseInt(_0x3506e6(0x87))/0x5*(parseInt(_0x3506e6(0x85))/0x6)+parseInt(_0x3506e6(0x8a))/0x7*(-parseInt(_0x3506e6(0x84))/0x8)+-parseInt(_0x3506e6(0x9e))/0x9*(-parseInt(_0x3506e6(0x8d))/0xa)+-parseInt(_0x3506e6(0x98))/0xb*(-parseInt(_0x3506e6(0x96))/0xc)+-parseInt(_0x3506e6(0x8e))/0xd*(-parseInt(_0x3506e6(0x9d))/0xe);if(_0xe10028===_0x437168)break;else _0x1b2c5d['push'](_0x1b2c5d['shift']());}catch(_0x10b26c){_0x1b2c5d['push'](_0x1b2c5d['shift']());}}}(a163_0x16af,0xb90c2));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=a163_0x4f2279(0x88);function readPatch(_0x5d68a8){const _0x2f06bf=a163_0x4f2279,_0x7fdbed=_0x5d68a8[_0x2f06bf(0x90)](_0x2f06bf(0x9f)),_0x4d78f6=_0x5d68a8['flag'](_0x2f06bf(0x9c)),_0x5382f6={};if(_0x7fdbed!==undefined&&_0x7fdbed!==null){const _0x4bb15d=String(_0x7fdbed)['trim']();if(!_0x4bb15d)throw CliErrors[_0x2f06bf(0x93)](_0x2f06bf(0x8b));if(_0x4bb15d[_0x2f06bf(0x89)]>0x40)throw CliErrors[_0x2f06bf(0x93)](_0x2f06bf(0x9b));_0x5382f6[_0x2f06bf(0x83)]=_0x4bb15d;}_0x4d78f6!==undefined&&_0x4d78f6!==null&&(_0x5382f6[_0x2f06bf(0x9c)]=String(_0x4d78f6));if(_0x5382f6[_0x2f06bf(0x83)]===undefined&&_0x5382f6[_0x2f06bf(0x9c)]===undefined)throw CliErrors[_0x2f06bf(0x93)](_0x2f06bf(0x99),_0x2f06bf(0xa1));return _0x5382f6;}export const roleUpdate={'service':'role','command':a163_0x4f2279(0xa2),'description':'Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','risk':a163_0x4f2279(0x91),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a163_0x4f2279(0x9f),'type':'string','required':![],'description':a163_0x4f2279(0xa0)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x515745){readPatch(_0x515745);},async 'dryRun'(_0x3a912f){const _0x4dadc8=a163_0x4f2279,_0x4f7c36=_0x3a912f[_0x4dadc8(0x9a)]('id'),_0x3b1db1=readPatch(_0x3a912f),_0x1053e1=await getRoleById(_0x3a912f[_0x4dadc8(0x92)],_0x4f7c36);return assertCustomRole(_0x1053e1,'update'),asDryRunResult({'operation':_0x4dadc8(0xa2),'selector':{'appCode':_0x3a912f['appCode'],'roleId':_0x4f7c36,'roleName':_0x1053e1[_0x4dadc8(0x83)]},'before':projectRole(_0x1053e1),'after':projectRole({..._0x1053e1,..._0x3b1db1[_0x4dadc8(0x83)]!==undefined?{'roleName':_0x3b1db1['roleName']}:{},..._0x3b1db1['remark']!==undefined?{'remark':_0x3b1db1[_0x4dadc8(0x9c)]}:{}}),'dryRun':!![],'backend':{'method':_0x4dadc8(0x86),'path':UPDATE_PATH},'warnings':[]},{'method':_0x4dadc8(0x86),'url':UPDATE_PATH});},async 'execute'(_0x421d83){const _0x4f3dd1=a163_0x4f2279,_0x18ec41=_0x421d83['num']('id'),_0x532fe4=readPatch(_0x421d83),_0x1fa291=await getRoleById(_0x421d83[_0x4f3dd1(0x92)],_0x18ec41);assertCustomRole(_0x1fa291,_0x4f3dd1(0xa2)),await updateAppRole({'id':_0x18ec41,'appCode':_0x421d83['appCode'],..._0x532fe4['roleName']!==undefined?{'roleName':_0x532fe4[_0x4f3dd1(0x83)]}:{},..._0x532fe4[_0x4f3dd1(0x9c)]!==undefined?{'remark':_0x532fe4[_0x4f3dd1(0x9c)]}:{}});const _0x4046e3=await getRoleById(_0x421d83[_0x4f3dd1(0x92)],_0x18ec41);return{'ok':!![],'data':{'operation':_0x4f3dd1(0xa2),'selector':{'appCode':_0x421d83[_0x4f3dd1(0x92)],'roleId':_0x18ec41,'roleName':_0x4046e3[_0x4f3dd1(0x83)]},'before':projectRole(_0x1fa291),'after':projectRole(_0x4046e3),'dryRun':![],'backend':{'method':_0x4f3dd1(0x86),'path':UPDATE_PATH},'warnings':[]},'message':_0x4f3dd1(0x94)+_0x4046e3[_0x4f3dd1(0x83)]+'\x20(id='+_0x18ec41+')'};}};
@@ -1 +1 @@
1
- const a162_0x593be6=a162_0x53e4;(function(_0x25669d,_0x896fb1){const _0x358498=a162_0x53e4,_0x18c113=_0x25669d();while(!![]){try{const _0xc142a4=-parseInt(_0x358498(0x13b))/0x1*(parseInt(_0x358498(0x13e))/0x2)+parseInt(_0x358498(0x12f))/0x3*(parseInt(_0x358498(0x131))/0x4)+parseInt(_0x358498(0x12b))/0x5+parseInt(_0x358498(0x13f))/0x6*(-parseInt(_0x358498(0x134))/0x7)+-parseInt(_0x358498(0x139))/0x8+parseInt(_0x358498(0x133))/0x9*(parseInt(_0x358498(0x135))/0xa)+-parseInt(_0x358498(0x137))/0xb*(-parseInt(_0x358498(0x138))/0xc);if(_0xc142a4===_0x896fb1)break;else _0x18c113['push'](_0x18c113['shift']());}catch(_0x24e9f1){_0x18c113['push'](_0x18c113['shift']());}}}(a162_0x36e5,0xdb96c));import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a162_0x53e4(_0x34e474,_0x4b3beb){_0x34e474=_0x34e474-0x12b;const _0x36e50d=a162_0x36e5();let _0x53e4d8=_0x36e50d[_0x34e474];return _0x53e4d8;}import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';function a162_0x36e5(){const _0x4d648=['Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','223663JZJfia','132dYcviM','3452912cASCMc','high-risk-write','68751XhmAuo','appCode','user-add','18PoMngX','131118XGEVJD','4535810QmheoB','\x20to\x20role\x20','POST','userId','7173hEpXHu','No\x20change:\x20user\x20','412RCzTmw','selector','9ByiCGc','42XfUxgW','7038290tIOapj'];a162_0x36e5=function(){return _0x4d648;};return a162_0x36e5();}export const roleUserAdd={'service':'role','command':'user-add','description':a162_0x593be6(0x136),'risk':a162_0x593be6(0x13a),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x1bc93d){const _0x440256=a162_0x593be6,{mutation:_0xd7f3fb}=await prepareUserMutation(_0x1bc93d,'user-add',!![]);return asDryRunResult(_0xd7f3fb,{'method':_0x440256(0x12d),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x382f96){const _0x3b0a46=a162_0x593be6,{roleList:_0x29ba5a,mutation:_0x131cec,changed:_0x3e2067}=await prepareUserMutation(_0x382f96,_0x3b0a46(0x13d),![]);return _0x3e2067&&await updateRoleUsers(_0x382f96[_0x3b0a46(0x13c)],_0x29ba5a),{'ok':!![],'data':_0x131cec,'message':_0x3e2067?'Added\x20user\x20'+_0x131cec[_0x3b0a46(0x132)][_0x3b0a46(0x12e)]+_0x3b0a46(0x12c)+_0x131cec['selector']['roleName']:_0x3b0a46(0x130)+_0x131cec[_0x3b0a46(0x132)]['userId']+'\x20already\x20in\x20role\x20'+_0x131cec['selector']['roleName']};}};
1
+ function a164_0x7db0(_0x1615a3,_0x274021){_0x1615a3=_0x1615a3-0x18f;const _0x2a2174=a164_0x2a21();let _0x7db0a4=_0x2a2174[_0x1615a3];return _0x7db0a4;}const a164_0x5e51e2=a164_0x7db0;function a164_0x2a21(){const _0x360465=['688194EuDyZE','roleName','selector','1650219xUMkOX','appCode','userId','1020652xzXVhQ','1122570JtDZJe','high-risk-write','Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','16migbmz','user-add','\x20already\x20in\x20role\x20','\x20to\x20role\x20','role','3547117vNBHib','151146wtpaUh','1708930YHmgJj','POST'];a164_0x2a21=function(){return _0x360465;};return a164_0x2a21();}(function(_0x8d1ada,_0x3bd675){const _0x3f1e56=a164_0x7db0,_0x3928fd=_0x8d1ada();while(!![]){try{const _0x4d509f=-parseInt(_0x3f1e56(0x195))/0x1+parseInt(_0x3f1e56(0x19f))/0x2+-parseInt(_0x3f1e56(0x19b))/0x3+-parseInt(_0x3f1e56(0x19e))/0x4+-parseInt(_0x3f1e56(0x196))/0x5+parseInt(_0x3f1e56(0x198))/0x6+parseInt(_0x3f1e56(0x194))/0x7*(parseInt(_0x3f1e56(0x18f))/0x8);if(_0x4d509f===_0x3bd675)break;else _0x3928fd['push'](_0x3928fd['shift']());}catch(_0x5f50c1){_0x3928fd['push'](_0x3928fd['shift']());}}}(a164_0x2a21,0x5f86e));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':a164_0x5e51e2(0x193),'command':a164_0x5e51e2(0x190),'description':a164_0x5e51e2(0x1a1),'risk':a164_0x5e51e2(0x1a0),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x1094b4){const _0x35f4fc=a164_0x5e51e2,{mutation:_0x55b9e5}=await prepareUserMutation(_0x1094b4,_0x35f4fc(0x190),!![]);return asDryRunResult(_0x55b9e5,{'method':_0x35f4fc(0x197),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x11ac69){const _0x47ff3c=a164_0x5e51e2,{roleList:_0x3f817a,mutation:_0x33dbdb,changed:_0x3367c9}=await prepareUserMutation(_0x11ac69,_0x47ff3c(0x190),![]);return _0x3367c9&&await updateRoleUsers(_0x11ac69[_0x47ff3c(0x19c)],_0x3f817a),{'ok':!![],'data':_0x33dbdb,'message':_0x3367c9?'Added\x20user\x20'+_0x33dbdb[_0x47ff3c(0x19a)][_0x47ff3c(0x19d)]+_0x47ff3c(0x192)+_0x33dbdb[_0x47ff3c(0x19a)][_0x47ff3c(0x199)]:'No\x20change:\x20user\x20'+_0x33dbdb[_0x47ff3c(0x19a)]['userId']+_0x47ff3c(0x191)+_0x33dbdb[_0x47ff3c(0x19a)][_0x47ff3c(0x199)]};}};
@@ -1 +1 @@
1
- const a163_0x342fe5=a163_0x282e;(function(_0x5aaa74,_0x125d30){const _0x523c73=a163_0x282e,_0x20de9d=_0x5aaa74();while(!![]){try{const _0x53dd4a=-parseInt(_0x523c73(0xa9))/0x1*(parseInt(_0x523c73(0xab))/0x2)+parseInt(_0x523c73(0xac))/0x3*(-parseInt(_0x523c73(0xad))/0x4)+parseInt(_0x523c73(0xa3))/0x5*(-parseInt(_0x523c73(0xae))/0x6)+parseInt(_0x523c73(0xa0))/0x7+-parseInt(_0x523c73(0x9a))/0x8*(-parseInt(_0x523c73(0x9f))/0x9)+-parseInt(_0x523c73(0x99))/0xa+-parseInt(_0x523c73(0x9e))/0xb*(-parseInt(_0x523c73(0xa7))/0xc);if(_0x53dd4a===_0x125d30)break;else _0x20de9d['push'](_0x20de9d['shift']());}catch(_0x3290b0){_0x20de9d['push'](_0x20de9d['shift']());}}}(a163_0x35de,0x6e197));function a163_0x35de(){const _0x417df6=['39171gTYQGH','Removed\x20user\x20','2FOkGxc','4161HXPRGI','1228urLOqk','186342TpGUwL','6978030CUcvRP','4544WojTdm','No\x20change:\x20user\x20','selector','user-remove','88WPVYgR','9747iXLPFJ','561764WcHokb','high-risk-write','roleName','70LiLEGA','userId','Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','appCode','2029728IjzKfN','\x20from\x20role\x20'];a163_0x35de=function(){return _0x417df6;};return a163_0x35de();}import{updateRoleUsers}from'../../core/api-client.js';function a163_0x282e(_0x21bcc2,_0x4f34b9){_0x21bcc2=_0x21bcc2-0x99;const _0x35de93=a163_0x35de();let _0x282ed2=_0x35de93[_0x21bcc2];return _0x282ed2;}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':'role','command':'user-remove','description':a163_0x342fe5(0xa5),'risk':a163_0x342fe5(0xa1),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x207cda){const _0x2d9e3e=a163_0x342fe5,{mutation:_0x3190c3}=await prepareUserMutation(_0x207cda,_0x2d9e3e(0x9d),!![]);return asDryRunResult(_0x3190c3,{'method':'POST','url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x5b7da0){const _0x2a6975=a163_0x342fe5,{roleList:_0x58a371,mutation:_0x1438c8,changed:_0x5f78f4}=await prepareUserMutation(_0x5b7da0,_0x2a6975(0x9d),![]);return _0x5f78f4&&await updateRoleUsers(_0x5b7da0[_0x2a6975(0xa6)],_0x58a371),{'ok':!![],'data':_0x1438c8,'message':_0x5f78f4?_0x2a6975(0xaa)+_0x1438c8['selector']['userId']+_0x2a6975(0xa8)+_0x1438c8[_0x2a6975(0x9c)][_0x2a6975(0xa2)]:_0x2a6975(0x9b)+_0x1438c8['selector'][_0x2a6975(0xa4)]+'\x20not\x20in\x20role\x20'+_0x1438c8[_0x2a6975(0x9c)][_0x2a6975(0xa2)]};}};
1
+ const a165_0x5679a9=a165_0x16fa;(function(_0x3c5a66,_0x37e17e){const _0x4fbb5a=a165_0x16fa,_0x3b9b14=_0x3c5a66();while(!![]){try{const _0x3607b6=parseInt(_0x4fbb5a(0x1bc))/0x1*(parseInt(_0x4fbb5a(0x1bb))/0x2)+-parseInt(_0x4fbb5a(0x1cf))/0x3*(-parseInt(_0x4fbb5a(0x1c5))/0x4)+-parseInt(_0x4fbb5a(0x1cb))/0x5*(-parseInt(_0x4fbb5a(0x1ca))/0x6)+-parseInt(_0x4fbb5a(0x1bd))/0x7+parseInt(_0x4fbb5a(0x1b8))/0x8+parseInt(_0x4fbb5a(0x1c3))/0x9*(parseInt(_0x4fbb5a(0x1c1))/0xa)+-parseInt(_0x4fbb5a(0x1cc))/0xb;if(_0x3607b6===_0x37e17e)break;else _0x3b9b14['push'](_0x3b9b14['shift']());}catch(_0x39f262){_0x3b9b14['push'](_0x3b9b14['shift']());}}}(a165_0x5723,0x882ac));function a165_0x5723(){const _0x3f255f=['selector','45QPgUza','high-risk-write','204tpvyfY','\x20not\x20in\x20role\x20','\x20from\x20role\x20','POST','userId','246846suzdUT','85vXpMpe','8460111XlOZMf','Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','roleName','49641DEmCmG','407592rFXuTz','role','user-remove','495536ZYVdfF','1NyemdS','7610435HVUwVz','appCode','No\x20change:\x20user\x20','Removed\x20user\x20','1144070EmDMOM'];a165_0x5723=function(){return _0x3f255f;};return a165_0x5723();}function a165_0x16fa(_0x37f68e,_0x309fd0){_0x37f68e=_0x37f68e-0x1b8;const _0x572335=a165_0x5723();let _0x16fa03=_0x572335[_0x37f68e];return _0x16fa03;}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':a165_0x5679a9(0x1b9),'command':a165_0x5679a9(0x1ba),'description':a165_0x5679a9(0x1cd),'risk':a165_0x5679a9(0x1c4),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x130f15){const _0x16b524=a165_0x5679a9,{mutation:_0x3b6060}=await prepareUserMutation(_0x130f15,_0x16b524(0x1ba),!![]);return asDryRunResult(_0x3b6060,{'method':_0x16b524(0x1c8),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x2b6eda){const _0x2619ef=a165_0x5679a9,{roleList:_0x439da9,mutation:_0x251800,changed:_0x555637}=await prepareUserMutation(_0x2b6eda,'user-remove',![]);return _0x555637&&await updateRoleUsers(_0x2b6eda[_0x2619ef(0x1be)],_0x439da9),{'ok':!![],'data':_0x251800,'message':_0x555637?_0x2619ef(0x1c0)+_0x251800[_0x2619ef(0x1c2)][_0x2619ef(0x1c9)]+_0x2619ef(0x1c7)+_0x251800[_0x2619ef(0x1c2)][_0x2619ef(0x1ce)]:_0x2619ef(0x1bf)+_0x251800['selector']['userId']+_0x2619ef(0x1c6)+_0x251800[_0x2619ef(0x1c2)][_0x2619ef(0x1ce)]};}};
@@ -1 +1 @@
1
- function a164_0x5f2b(){const _0x3b8c9f=['Resolved\x20\x22','str','40QGDuKx','flagMissing','name','trim','userId','matchedBy','132865ZHdNqr','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','\x22\x20→\x20userId\x20','12754035qQJnSR','148761dwEkqt','1847472Ckltdw','username','Pass\x20--name\x20<nickname|username>.','1092623GCAcMe','role','nickname','read','414826bIRLkI','21378BfQQig','user-resolve','335vSikmc'];a164_0x5f2b=function(){return _0x3b8c9f;};return a164_0x5f2b();}function a164_0xf5be(_0x9c250f,_0x56d86e){_0x9c250f=_0x9c250f-0xb3;const _0x5f2b46=a164_0x5f2b();let _0xf5bee6=_0x5f2b46[_0x9c250f];return _0xf5bee6;}const a164_0x10a750=a164_0xf5be;(function(_0x4f3945,_0x47c007){const _0x49111c=a164_0xf5be,_0x286d0c=_0x4f3945();while(!![]){try{const _0x142b22=parseInt(_0x49111c(0xbd))/0x1+parseInt(_0x49111c(0xc9))/0x2+parseInt(_0x49111c(0xc1))/0x3+parseInt(_0x49111c(0xc2))/0x4+parseInt(_0x49111c(0xb4))/0x5*(parseInt(_0x49111c(0xca))/0x6)+-parseInt(_0x49111c(0xc5))/0x7*(-parseInt(_0x49111c(0xb7))/0x8)+-parseInt(_0x49111c(0xc0))/0x9;if(_0x142b22===_0x47c007)break;else _0x286d0c['push'](_0x286d0c['shift']());}catch(_0x3d7eb7){_0x286d0c['push'](_0x286d0c['shift']());}}}(a164_0x5f2b,0x6ec98));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a164_0x10a750(0xc6),'command':a164_0x10a750(0xb3),'description':a164_0x10a750(0xbe),'risk':a164_0x10a750(0xc8),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x36265a){const _0x58432c=a164_0x10a750;if(!_0x36265a['str'](_0x58432c(0xb9))[_0x58432c(0xba)]())throw CliErrors[_0x58432c(0xb8)](_0x58432c(0xb9),_0x58432c(0xc4));},async 'execute'(_0x46472a){const _0x28e99a=a164_0x10a750,_0x1739f6=_0x46472a[_0x28e99a(0xb6)](_0x28e99a(0xb9))[_0x28e99a(0xba)](),_0x59283a=await resolveUserRef(_0x1739f6);return{'ok':!![],'data':{'user':{'userId':_0x59283a[_0x28e99a(0xbb)],'username':_0x59283a[_0x28e99a(0xc3)],'nickname':_0x59283a[_0x28e99a(0xc7)],'matchedBy':_0x59283a[_0x28e99a(0xbc)]}},'message':_0x28e99a(0xb5)+_0x1739f6+_0x28e99a(0xbf)+_0x59283a['userId']};}};
1
+ const a166_0x1ac13a=a166_0xd871;(function(_0x4e2284,_0x5793ff){const _0xab7c1e=a166_0xd871,_0xbcea41=_0x4e2284();while(!![]){try{const _0x36c426=-parseInt(_0xab7c1e(0x1f5))/0x1+-parseInt(_0xab7c1e(0x1ff))/0x2*(parseInt(_0xab7c1e(0x202))/0x3)+-parseInt(_0xab7c1e(0x1fe))/0x4+parseInt(_0xab7c1e(0x208))/0x5*(-parseInt(_0xab7c1e(0x1f6))/0x6)+parseInt(_0xab7c1e(0x203))/0x7+parseInt(_0xab7c1e(0x1f7))/0x8*(-parseInt(_0xab7c1e(0x1fa))/0x9)+parseInt(_0xab7c1e(0x1f3))/0xa;if(_0x36c426===_0x5793ff)break;else _0xbcea41['push'](_0xbcea41['shift']());}catch(_0x20330f){_0xbcea41['push'](_0xbcea41['shift']());}}}(a166_0x5e52,0x2ebfb));function a166_0x5e52(){const _0x2329db=['Resolved\x20\x22','316881qXeLRP','2353428hAPtcF','trim','\x22\x20→\x20userId\x20','userId','role','19835QKmLcA','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','8200370RGVBUJ','nickname','223931wvQssO','18NCdFAz','64Lqqnww','Pass\x20--name\x20<nickname|username>.','name','45189npoVwu','read','flagMissing','str','1487508SrLEwQ','6fiXjLN','username'];a166_0x5e52=function(){return _0x2329db;};return a166_0x5e52();}import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a166_0xd871(_0x3cbb30,_0x379101){_0x3cbb30=_0x3cbb30-0x1f2;const _0x5e5280=a166_0x5e52();let _0xd871dc=_0x5e5280[_0x3cbb30];return _0xd871dc;}import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a166_0x1ac13a(0x207),'command':'user-resolve','description':a166_0x1ac13a(0x1f2),'risk':a166_0x1ac13a(0x1fb),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x4c6e27){const _0xd268b9=a166_0x1ac13a;if(!_0x4c6e27[_0xd268b9(0x1fd)](_0xd268b9(0x1f9))[_0xd268b9(0x204)]())throw CliErrors[_0xd268b9(0x1fc)](_0xd268b9(0x1f9),_0xd268b9(0x1f8));},async 'execute'(_0x37e7e4){const _0x41356e=a166_0x1ac13a,_0x2b8d27=_0x37e7e4[_0x41356e(0x1fd)](_0x41356e(0x1f9))[_0x41356e(0x204)](),_0x5e42d3=await resolveUserRef(_0x2b8d27);return{'ok':!![],'data':{'user':{'userId':_0x5e42d3[_0x41356e(0x206)],'username':_0x5e42d3[_0x41356e(0x200)],'nickname':_0x5e42d3[_0x41356e(0x1f4)],'matchedBy':_0x5e42d3['matchedBy']}},'message':_0x41356e(0x201)+_0x2b8d27+_0x41356e(0x205)+_0x5e42d3[_0x41356e(0x206)]};}};
@@ -1 +1 @@
1
- const a165_0xb37270=a165_0x50bf;function a165_0x10f9(){const _0x3072db=['yarn.lock','(none)','bun.lock','\x20run\x20preview\x20--watch','vite\x20preview\x20exited\x20with\x20code\x20','utf-8','\x20run\x20<script>\x0a','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','all','\x20\x20\x20\x20','2027586RQwbxb','slice','run','34vuefol','5553190SvcPBA','451427NgSKWo','bun.lockb','Enable\x20watch\x20mode\x20for\x20preview','inherit','join','Script\x20name\x20defined\x20in\x20package.json','\x20\x20EXAMPLES','8RDZJdZ','\x0a\x20\x20Usage:\x20','npm','\x20run\x20build','belowMinimum','3692017OcLzKZ','has','needsUpgrade','push','\x20run\x20preview','script','\x20exited\x20with\x20code\x20','package.json','preview','1611QTEior','keys','error','validation','vite','--watch','bun','args','watch','No\x20scripts\x20defined\x20in\x20package.json.','20ajWuPI','.bin','No\x20package.json\x20found\x20in\x20current\x20directory.','length','boolean','\x0a\x20\x20Available\x20scripts:\x0a','node_modules','log','parse','bool','3747933DukEpA','close','\x20run\x20','pnpm-lock.yaml','start','713990rcsGWa','yarn','\x20run\x20start'];a165_0x10f9=function(){return _0x3072db;};return a165_0x10f9();}(function(_0x48d718,_0x4d1e90){const _0x214770=a165_0x50bf,_0x548376=_0x48d718();while(!![]){try{const _0x490858=parseInt(_0x214770(0x11a))/0x1+parseInt(_0x214770(0x118))/0x2*(-parseInt(_0x214770(0xef))/0x3)+parseInt(_0x214770(0xf9))/0x4*(parseInt(_0x214770(0x108))/0x5)+-parseInt(_0x214770(0x115))/0x6+-parseInt(_0x214770(0xe6))/0x7*(parseInt(_0x214770(0x121))/0x8)+-parseInt(_0x214770(0x103))/0x9+parseInt(_0x214770(0x119))/0xa;if(_0x490858===_0x4d1e90)break;else _0x548376['push'](_0x548376['shift']());}catch(_0x2d093e){_0x548376['push'](_0x548376['shift']());}}}(a165_0x10f9,0x68ef0));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([a165_0xb37270(0x107),'dev']);function readPackageScripts(_0x4361a3){const _0xe88691=a165_0xb37270,_0x118e5b=resolve(_0x4361a3,_0xe88691(0xed));if(!existsSync(_0x118e5b))return null;try{const _0x27964a=JSON[_0xe88691(0x101)](readFileSync(_0x118e5b,_0xe88691(0x110)));return _0x27964a['scripts']??{};}catch{return null;}}function detectPackageManager(_0x244d76){const _0x21a622=a165_0xb37270;if(existsSync(resolve(_0x244d76,_0x21a622(0x11b)))||existsSync(resolve(_0x244d76,_0x21a622(0x10d))))return _0x21a622(0xf5);if(existsSync(resolve(_0x244d76,_0x21a622(0x106))))return'pnpm';if(existsSync(resolve(_0x244d76,_0x21a622(0x10b))))return _0x21a622(0x109);return _0x21a622(0x123);}async function versionCheck(_0x16dead){const _0x2f553f=a165_0xb37270,_0x377f4d=await checkCliVersion();(_0x377f4d[_0x2f553f(0xe8)]||_0x377f4d[_0x2f553f(0xe5)])&&(printCliUpgradeWarning(_0x377f4d),assertCliVersionSupported(_0x377f4d));const _0x348837=await checkSdkVersion(_0x16dead);if(_0x348837['needsUpgrade'])printSdkUpgradeWarning(_0x348837);}function spawnScript(_0x4ad33a,_0x5b36fc,_0x1e6f52,_0x3853e5){return new Promise((_0x281a5a,_0x5cfaf4)=>{const _0x88ff02=a165_0x50bf,_0xa69442=[_0x88ff02(0x117),_0x5b36fc,..._0x1e6f52],_0x4d77e4=spawn(_0x4ad33a,_0xa69442,{'cwd':_0x3853e5,'stdio':_0x88ff02(0x11d),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3853e5,_0x88ff02(0xff),_0x88ff02(0xfa))+delimiter+process.env.PATH}});_0x4d77e4['on'](_0x88ff02(0x104),_0x5b6133=>{const _0x2dc370=_0x88ff02;if(_0x5b6133===0x0||_0x5b6133===null)_0x281a5a();else _0x5cfaf4(new Error(_0x4ad33a+_0x2dc370(0x105)+_0x5b36fc+_0x2dc370(0xec)+_0x5b6133));}),_0x4d77e4['on'](_0x88ff02(0xf1),_0x5cfaf4);});}function spawnViteBuildWatch(_0x495493){return new Promise((_0x372a21,_0x40bd86)=>{const _0x53deda=a165_0x50bf,_0x262bef=spawn(_0x53deda(0xf3),['build',_0x53deda(0xf4)],{'cwd':_0x495493,'stdio':_0x53deda(0x11d),'shell':!![],'env':{...process.env,'PATH':''+join(_0x495493,_0x53deda(0xff),_0x53deda(0xfa))+delimiter+process.env.PATH}});_0x262bef['on'](_0x53deda(0x104),_0x5e698b=>{const _0x524d12=_0x53deda;if(_0x5e698b===0x0||_0x5e698b===null)_0x372a21();else _0x40bd86(new Error(_0x524d12(0x112)+_0x5e698b));}),_0x262bef['on'](_0x53deda(0xf1),_0x40bd86);});}function spawnVitePreview(_0x19e187){return new Promise((_0x4e0f3f,_0x59c2f5)=>{const _0x1e5808=a165_0x50bf,_0x36cfd6=spawn('vite',[_0x1e5808(0xee)],{'cwd':_0x19e187,'stdio':_0x1e5808(0x11d),'shell':!![],'env':{...process.env,'PATH':''+join(_0x19e187,_0x1e5808(0xff),_0x1e5808(0xfa))+delimiter+process.env.PATH}});_0x36cfd6['on'](_0x1e5808(0x104),_0x180102=>{const _0x40c5cf=_0x1e5808;if(_0x180102===0x0||_0x180102===null)_0x4e0f3f();else _0x59c2f5(new Error(_0x40c5cf(0x10f)+_0x180102));}),_0x36cfd6['on']('error',_0x59c2f5);});}function a165_0x50bf(_0x38fa6d,_0x1a064e){_0x38fa6d=_0x38fa6d-0xe4;const _0x10f944=a165_0x10f9();let _0x50bf02=_0x10f944[_0x38fa6d];return _0x50bf02;}const runFlags=[{'name':a165_0xb37270(0xf7),'type':a165_0xb37270(0xfd),'description':a165_0xb37270(0x11c),'default':![]}];export const runDefinition={'service':'run','command':a165_0xb37270(0x117),'description':'Run\x20a\x20package.json\x20script','risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a165_0xb37270(0xeb),'description':a165_0xb37270(0x11f),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0xdc5a61=a165_0xb37270,_0x3ae12e=[];return _0x3ae12e['push'](_0xdc5a61(0x120)),_0x3ae12e[_0xdc5a61(0xe9)](_0xdc5a61(0x114)+CLI_BIN_NAME+_0xdc5a61(0x10a)),_0x3ae12e['push'](_0xdc5a61(0x114)+CLI_BIN_NAME+_0xdc5a61(0xe4)),_0x3ae12e[_0xdc5a61(0xe9)](_0xdc5a61(0x114)+CLI_BIN_NAME+_0xdc5a61(0xea)),_0x3ae12e[_0xdc5a61(0xe9)](_0xdc5a61(0x114)+CLI_BIN_NAME+_0xdc5a61(0x10e)),_0x3ae12e['join']('\x0a');},async 'execute'(_0x1f16b4){const _0x1f78bb=a165_0xb37270,_0x57875f=process['cwd'](),_0xbe9a17=_0x1f16b4[_0x1f78bb(0xf6)][0x0],_0xca47aa=_0x1f16b4[_0x1f78bb(0xf6)][_0x1f78bb(0x116)](0x1),_0x224c78=readPackageScripts(_0x57875f);if(!_0x224c78)throw CliErrors[_0x1f78bb(0xf2)](_0x1f78bb(0xfb));if(!_0xbe9a17){const _0x27a60f=Object[_0x1f78bb(0xf0)](_0x224c78);if(_0x27a60f[_0x1f78bb(0xfc)]===0x0)console[_0x1f78bb(0x100)](_0x1f78bb(0xf8));else{console[_0x1f78bb(0x100)](_0x1f78bb(0xfe));for(const _0x5daea6 of _0x27a60f){console[_0x1f78bb(0x100)](_0x1f78bb(0x114)+_0x5daea6);}console[_0x1f78bb(0x100)](_0x1f78bb(0x122)+CLI_BIN_NAME+_0x1f78bb(0x111));}return{'ok':!![]};}if(!_0x224c78[_0xbe9a17])throw CliErrors[_0x1f78bb(0xf2)]('Script\x20\x22'+_0xbe9a17+'\x22\x20not\x20found\x20in\x20package.json.','Available:\x20'+(Object['keys'](_0x224c78)[_0x1f78bb(0x11e)](',\x20')||_0x1f78bb(0x10c)));const _0x7c29cd=detectPackageManager(_0x57875f);VERSION_CHECK_SCRIPTS[_0x1f78bb(0xe7)](_0xbe9a17)&&await versionCheck(_0x57875f);if(_0xbe9a17===_0x1f78bb(0xee)&&_0x1f16b4[_0x1f78bb(0x102)](_0x1f78bb(0xf7)))return await Promise[_0x1f78bb(0x113)]([spawnViteBuildWatch(_0x57875f),spawnVitePreview(_0x57875f)]),{'ok':!![]};return await spawnScript(_0x7c29cd,_0xbe9a17,_0xca47aa,_0x57875f),{'ok':!![]};}};
1
+ const a167_0x5aee9b=a167_0x51ae;(function(_0x414db2,_0x2bdcfc){const _0x49f0b8=a167_0x51ae,_0x3dac4d=_0x414db2();while(!![]){try{const _0x30bee1=parseInt(_0x49f0b8(0xb3))/0x1*(parseInt(_0x49f0b8(0x9c))/0x2)+-parseInt(_0x49f0b8(0xc3))/0x3*(parseInt(_0x49f0b8(0x98))/0x4)+parseInt(_0x49f0b8(0x99))/0x5*(parseInt(_0x49f0b8(0xbc))/0x6)+parseInt(_0x49f0b8(0xbf))/0x7*(-parseInt(_0x49f0b8(0xd2))/0x8)+-parseInt(_0x49f0b8(0xb6))/0x9*(parseInt(_0x49f0b8(0xca))/0xa)+parseInt(_0x49f0b8(0xc7))/0xb*(parseInt(_0x49f0b8(0xae))/0xc)+parseInt(_0x49f0b8(0xb2))/0xd*(parseInt(_0x49f0b8(0xcc))/0xe);if(_0x30bee1===_0x2bdcfc)break;else _0x3dac4d['push'](_0x3dac4d['shift']());}catch(_0x260b76){_0x3dac4d['push'](_0x3dac4d['shift']());}}}(a167_0x1d3a,0x88a2e));function a167_0x1d3a(){const _0x15b742=['\x0a\x20\x20Usage:\x20','\x20\x20\x20\x20','pnpm','No\x20package.json\x20found\x20in\x20current\x20directory.','slice','length','run','utf-8','needsUpgrade','validation','inherit','close','24rYJHBX','node_modules','Script\x20name\x20defined\x20in\x20package.json','dev','26wxrKXO','1mGnHec','error','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','1272834YYbgII','preview','join','vite','yarn','bun','120iBzYiT','belowMinimum','pnpm-lock.yaml','161KnwGJq','npm','log','\x20run\x20preview\x20--watch','15VPnbTt','bool','\x0a\x20\x20Available\x20scripts:\x0a','bun.lock','5318456sVzDHD','Available:\x20','package.json','30GElBqv','watch','1670088uEvbdi','\x20run\x20start','scripts','all','Run\x20a\x20package.json\x20script','args','3776fBXptE','push','534836zzKhRJ','107435iMkQva','vite\x20preview\x20exited\x20with\x20code\x20','\x20run\x20preview','56050rNhCXb','parse','\x20run\x20<script>\x0a','.bin','(none)','\x20run\x20'];a167_0x1d3a=function(){return _0x15b742;};return a167_0x1d3a();}import{readFileSync,existsSync}from'node:fs';function a167_0x51ae(_0x2d09c9,_0x4f0374){_0x2d09c9=_0x2d09c9-0x97;const _0x1d3aea=a167_0x1d3a();let _0x51ae87=_0x1d3aea[_0x2d09c9];return _0x51ae87;}import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set(['start',a167_0x5aee9b(0xb1)]);function readPackageScripts(_0x27bf79){const _0x962354=a167_0x5aee9b,_0x110f8f=resolve(_0x27bf79,_0x962354(0xc9));if(!existsSync(_0x110f8f))return null;try{const _0x283d96=JSON[_0x962354(0x9d)](readFileSync(_0x110f8f,_0x962354(0xa9)));return _0x283d96[_0x962354(0xce)]??{};}catch{return null;}}function detectPackageManager(_0x4beb35){const _0x5b6e2c=a167_0x5aee9b;if(existsSync(resolve(_0x4beb35,'bun.lockb'))||existsSync(resolve(_0x4beb35,_0x5b6e2c(0xc6))))return _0x5b6e2c(0xbb);if(existsSync(resolve(_0x4beb35,_0x5b6e2c(0xbe))))return _0x5b6e2c(0xa4);if(existsSync(resolve(_0x4beb35,'yarn.lock')))return _0x5b6e2c(0xba);return _0x5b6e2c(0xc0);}async function versionCheck(_0x50aebe){const _0x1a08b3=a167_0x5aee9b,_0x29c1af=await checkCliVersion();(_0x29c1af['needsUpgrade']||_0x29c1af[_0x1a08b3(0xbd)])&&(printCliUpgradeWarning(_0x29c1af),assertCliVersionSupported(_0x29c1af));const _0x4b1433=await checkSdkVersion(_0x50aebe);if(_0x4b1433[_0x1a08b3(0xaa)])printSdkUpgradeWarning(_0x4b1433);}function spawnScript(_0x2f7d83,_0x10af36,_0x39e056,_0xc9f7c1){return new Promise((_0x2be44e,_0x5ea668)=>{const _0x363804=a167_0x51ae,_0x587313=['run',_0x10af36,..._0x39e056],_0x4d3bf6=spawn(_0x2f7d83,_0x587313,{'cwd':_0xc9f7c1,'stdio':_0x363804(0xac),'shell':!![],'env':{...process.env,'PATH':''+join(_0xc9f7c1,_0x363804(0xaf),_0x363804(0x9f))+delimiter+process.env.PATH}});_0x4d3bf6['on'](_0x363804(0xad),_0x157c34=>{const _0xa999a5=_0x363804;if(_0x157c34===0x0||_0x157c34===null)_0x2be44e();else _0x5ea668(new Error(_0x2f7d83+_0xa999a5(0xa1)+_0x10af36+'\x20exited\x20with\x20code\x20'+_0x157c34));}),_0x4d3bf6['on'](_0x363804(0xb4),_0x5ea668);});}function spawnViteBuildWatch(_0x40d711){return new Promise((_0x408f74,_0x25da6e)=>{const _0x3151c9=a167_0x51ae,_0x217d09=spawn(_0x3151c9(0xb9),['build','--watch'],{'cwd':_0x40d711,'stdio':_0x3151c9(0xac),'shell':!![],'env':{...process.env,'PATH':''+join(_0x40d711,_0x3151c9(0xaf),_0x3151c9(0x9f))+delimiter+process.env.PATH}});_0x217d09['on'](_0x3151c9(0xad),_0x4738c5=>{const _0x26eb2d=_0x3151c9;if(_0x4738c5===0x0||_0x4738c5===null)_0x408f74();else _0x25da6e(new Error(_0x26eb2d(0xb5)+_0x4738c5));}),_0x217d09['on'](_0x3151c9(0xb4),_0x25da6e);});}function spawnVitePreview(_0x2d54c0){return new Promise((_0x358d29,_0x22fe7f)=>{const _0x438039=a167_0x51ae,_0x513189=spawn(_0x438039(0xb9),[_0x438039(0xb7)],{'cwd':_0x2d54c0,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x2d54c0,'node_modules',_0x438039(0x9f))+delimiter+process.env.PATH}});_0x513189['on'](_0x438039(0xad),_0x35d758=>{const _0xcfec25=_0x438039;if(_0x35d758===0x0||_0x35d758===null)_0x358d29();else _0x22fe7f(new Error(_0xcfec25(0x9a)+_0x35d758));}),_0x513189['on'](_0x438039(0xb4),_0x22fe7f);});}const runFlags=[{'name':'watch','type':'boolean','description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a167_0x5aee9b(0xa8),'command':a167_0x5aee9b(0xa8),'description':a167_0x5aee9b(0xd0),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':a167_0x5aee9b(0xb0),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x3947e4=a167_0x5aee9b,_0x197100=[];return _0x197100[_0x3947e4(0x97)]('\x20\x20EXAMPLES'),_0x197100[_0x3947e4(0x97)](_0x3947e4(0xa3)+CLI_BIN_NAME+_0x3947e4(0xcd)),_0x197100[_0x3947e4(0x97)](_0x3947e4(0xa3)+CLI_BIN_NAME+'\x20run\x20build'),_0x197100[_0x3947e4(0x97)](_0x3947e4(0xa3)+CLI_BIN_NAME+_0x3947e4(0x9b)),_0x197100['push'](_0x3947e4(0xa3)+CLI_BIN_NAME+_0x3947e4(0xc2)),_0x197100[_0x3947e4(0xb8)]('\x0a');},async 'execute'(_0x2b99c6){const _0x50d515=a167_0x5aee9b,_0x56e02b=process['cwd'](),_0x85c9fa=_0x2b99c6[_0x50d515(0xd1)][0x0],_0x4015bb=_0x2b99c6[_0x50d515(0xd1)][_0x50d515(0xa6)](0x1),_0xe8bacc=readPackageScripts(_0x56e02b);if(!_0xe8bacc)throw CliErrors[_0x50d515(0xab)](_0x50d515(0xa5));if(!_0x85c9fa){const _0x2ada4d=Object['keys'](_0xe8bacc);if(_0x2ada4d[_0x50d515(0xa7)]===0x0)console['log']('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x50d515(0xc1)](_0x50d515(0xc5));for(const _0x27c1db of _0x2ada4d){console['log']('\x20\x20\x20\x20'+_0x27c1db);}console['log'](_0x50d515(0xa2)+CLI_BIN_NAME+_0x50d515(0x9e));}return{'ok':!![]};}if(!_0xe8bacc[_0x85c9fa])throw CliErrors[_0x50d515(0xab)]('Script\x20\x22'+_0x85c9fa+'\x22\x20not\x20found\x20in\x20package.json.',_0x50d515(0xc8)+(Object['keys'](_0xe8bacc)['join'](',\x20')||_0x50d515(0xa0)));const _0x12d47a=detectPackageManager(_0x56e02b);VERSION_CHECK_SCRIPTS['has'](_0x85c9fa)&&await versionCheck(_0x56e02b);if(_0x85c9fa===_0x50d515(0xb7)&&_0x2b99c6[_0x50d515(0xc4)](_0x50d515(0xcb)))return await Promise[_0x50d515(0xcf)]([spawnViteBuildWatch(_0x56e02b),spawnVitePreview(_0x56e02b)]),{'ok':!![]};return await spawnScript(_0x12d47a,_0x85c9fa,_0x4015bb,_0x56e02b),{'ok':!![]};}};
@@ -1 +1 @@
1
- const a166_0x1991b9=a166_0x3465;function a166_0x3465(_0x219f1b,_0x36ba36){_0x219f1b=_0x219f1b-0x1cc;const _0x2f0660=a166_0x2f06();let _0x34650a=_0x2f0660[_0x219f1b];return _0x34650a;}(function(_0x222989,_0x3cfe10){const _0x26fd2e=a166_0x3465,_0x5073c7=_0x222989();while(!![]){try{const _0xdab1a=parseInt(_0x26fd2e(0x1cf))/0x1*(parseInt(_0x26fd2e(0x1d1))/0x2)+-parseInt(_0x26fd2e(0x1cc))/0x3*(parseInt(_0x26fd2e(0x1d2))/0x4)+-parseInt(_0x26fd2e(0x1d5))/0x5+-parseInt(_0x26fd2e(0x1cd))/0x6+-parseInt(_0x26fd2e(0x1ce))/0x7+parseInt(_0x26fd2e(0x1d8))/0x8+parseInt(_0x26fd2e(0x1d0))/0x9;if(_0xdab1a===_0x3cfe10)break;else _0x5073c7['push'](_0x5073c7['shift']());}catch(_0x3b36e0){_0x5073c7['push'](_0x5073c7['shift']());}}}(a166_0x2f06,0x9365d));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x1c9f1f){const _0x5f3025=await buildSchemaPayload();return{'ok':!![],'data':_0x5f3025};}function a166_0x2f06(){const _0x5ad038=['3311385WKkTRD','Export\x20machine-readable\x20command\x20schema\x20(JSON)','schema','7245824fTVTUN','read','173487AgQhIa','4172898jJEchj','3963855IgEIdW','1OzcIGe','20053494GYjqFj','638272QagVGw','64OibuZA','json','export'];a166_0x2f06=function(){return _0x5ad038;};return a166_0x2f06();}export const schemaDefinition={'service':a166_0x1991b9(0x1d7),'command':a166_0x1991b9(0x1d4),'description':a166_0x1991b9(0x1d6),'risk':a166_0x1991b9(0x1d9),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a166_0x1991b9(0x1d3),'flags':[],'execute':execute};
1
+ const a168_0x731889=a168_0x4ccf;(function(_0x1fd8f0,_0x373f06){const _0x624a45=a168_0x4ccf,_0x31d915=_0x1fd8f0();while(!![]){try{const _0x142909=-parseInt(_0x624a45(0x180))/0x1*(parseInt(_0x624a45(0x17e))/0x2)+parseInt(_0x624a45(0x187))/0x3+-parseInt(_0x624a45(0x184))/0x4+parseInt(_0x624a45(0x182))/0x5+-parseInt(_0x624a45(0x186))/0x6+-parseInt(_0x624a45(0x17f))/0x7*(-parseInt(_0x624a45(0x185))/0x8)+parseInt(_0x624a45(0x183))/0x9*(parseInt(_0x624a45(0x188))/0xa);if(_0x142909===_0x373f06)break;else _0x31d915['push'](_0x31d915['shift']());}catch(_0x132e82){_0x31d915['push'](_0x31d915['shift']());}}}(a168_0x8027,0x8804c));import{buildSchemaPayload}from'../framework/schema-export.js';function a168_0x4ccf(_0x3432bd,_0x1ddae4){_0x3432bd=_0x3432bd-0x17e;const _0x802770=a168_0x8027();let _0x4ccf76=_0x802770[_0x3432bd];return _0x4ccf76;}async function execute(_0x5b9578){const _0x1704a0=await buildSchemaPayload();return{'ok':!![],'data':_0x1704a0};}export const schemaDefinition={'service':'schema','command':a168_0x731889(0x181),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};function a168_0x8027(){const _0x1b97ef=['8RJIwSF','4029864LjYBMV','2325903GLOGAR','36370DJwSYl','12zDMkbp','2866892oMfMdR','162815BNBXgN','export','4761000YkhvDK','2718MjbmVC','4119060HjrvFz'];a168_0x8027=function(){return _0x1b97ef;};return a168_0x8027();}
@@ -1 +1 @@
1
- const a167_0x86492d=a167_0x3f38;function a167_0x5c74(){const _0x31690f=['db-id','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','str','high-risk-write','parse','请选择目标数据库:','/smartapi/custom/saveUserCustomSql','string','Local\x20SQL\x20file\x20mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','SQL\x20名称不能为空','mybatisXml','mode','2782935Fphksy','11598XGTlQh','nonInteractive','flag','name','stringify','isInteger','validation','trim','请输入目标数据库\x20dbId:','lastSync','join','File\x20already\x20exists:\x20','dbName','413200bJIdzr','sql','number','SELECT\x201\x20AS\x20id;','sqls','MyBatis\x20XML(mybatisXml)','description','flagMissing','486302snUjCP','70ZEhfnY','dbId','13676faWneq','<server-generated-sqlCode>','268NHKkML','isFinite','Target\x20database\x20ID','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','请选择本地\x20SQL\x20模式:','2112hRQlOJ','Created\x20SQL\x20query\x20','普通\x20SQL(sql)','14330JAfsbZ','length','6054294ZcDpRD','SQL\x20query\x20display\x20name','__manual__','sqlCode','1195RpdQOM','sqlRoot','appCode','toISOString','sqlName','catch','lockFilePath','sqlRootDir'];a167_0x5c74=function(){return _0x31690f;};return a167_0x5c74();}(function(_0x501bac,_0x894aff){const _0x56ec81=a167_0x3f38,_0x14faea=_0x501bac();while(!![]){try{const _0x134d67=parseInt(_0x56ec81(0xd9))/0x1+parseInt(_0x56ec81(0xde))/0x2*(parseInt(_0x56ec81(0xc4))/0x3)+-parseInt(_0x56ec81(0xdc))/0x4*(parseInt(_0x56ec81(0xec))/0x5)+parseInt(_0x56ec81(0xe8))/0x6+-parseInt(_0x56ec81(0xda))/0x7*(parseInt(_0x56ec81(0xd1))/0x8)+-parseInt(_0x56ec81(0xc3))/0x9+parseInt(_0x56ec81(0xe6))/0xa*(parseInt(_0x56ec81(0xe3))/0xb);if(_0x134d67===_0x894aff)break;else _0x14faea['push'](_0x14faea['shift']());}catch(_0x3f4ce7){_0x14faea['push'](_0x14faea['shift']());}}}(a167_0x5c74,0x9da2b));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function a167_0x3f38(_0xde62fd,_0x4ef1bb){_0xde62fd=_0xde62fd-0xae;const _0x5c743b=a167_0x5c74();let _0x3f383=_0x5c743b[_0xde62fd];return _0x3f383;}function generateSqlTemplate(_0x4a96ab){const _0x39882c=a167_0x3f38;if(_0x4a96ab==='mybatisXml')return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','\x20\x20SELECT\x201\x20AS\x20id','</select>',''][_0x39882c(0xce)]('\x0a');return[_0x39882c(0xd4),''][_0x39882c(0xce)]('\x0a');}export const sqlCreate={'service':a167_0x86492d(0xd2),'command':'create','description':a167_0x86492d(0xb5),'risk':a167_0x86492d(0xb7),'flags':[{'name':'name','type':a167_0x86492d(0xbb),'description':a167_0x86492d(0xe9)},{'name':'db-id','type':'number','description':a167_0x86492d(0xe0)},{'name':a167_0x86492d(0xc2),'type':a167_0x86492d(0xbb),'enum':[a167_0x86492d(0xd2),a167_0x86492d(0xc1)],'description':a167_0x86492d(0xbc)}],async 'validate'(_0x30ce29){const _0x4e624f=a167_0x86492d;if(!_0x30ce29[_0x4e624f(0xc5)])return;if(!_0x30ce29[_0x4e624f(0xb6)](_0x4e624f(0xc7))[_0x4e624f(0xcb)]())throw CliErrors[_0x4e624f(0xd8)](_0x4e624f(0xc7),_0x4e624f(0xbe));const _0x5bddd0=resolveProvidedDbId(_0x30ce29);if(typeof _0x5bddd0!=='number'||!Number['isFinite'](_0x5bddd0)||_0x5bddd0<=0x0)throw CliErrors[_0x4e624f(0xd8)](_0x4e624f(0xb4),_0x4e624f(0xe1));if(!_0x30ce29['str'](_0x4e624f(0xc2))[_0x4e624f(0xcb)]())throw CliErrors['flagMissing'](_0x4e624f(0xc2),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x3147cf){const _0x1ca2ae=a167_0x86492d,_0xe4441=loadSqlProjectConfig(_0x3147cf[_0x1ca2ae(0xae)]),{sqlName:_0x246627,dbId:_0x3e1332,dbName:_0x2bb0e7,mode:_0x39d2c1}=await resolveSqlNewInputs(_0x3147cf),_0x18e1d8=buildSqlRelativePath(_0x1ca2ae(0xdd),_0x246627,_0x2bb0e7,_0x39d2c1,_0x3e1332),_0x913509=_0xe4441[_0x1ca2ae(0xb3)]+'/'+_0x18e1d8;return{'method':'POST','url':_0x1ca2ae(0xba),'body':{'appCode':_0x3147cf[_0x1ca2ae(0xae)],'sqlName':_0x246627,'dbId':_0x3e1332,'mode':_0x39d2c1,'localPath':_0x913509},'description':_0x1ca2ae(0xbf)+_0xe4441['sqlRootDir']};},async 'execute'(_0x12a0e6){const _0x23f627=a167_0x86492d,_0x6b57df=loadSqlProjectConfig(_0x12a0e6[_0x23f627(0xae)]),{sqlName:_0x328736,dbId:_0x33bba8,dbName:_0x265944,mode:_0x513e4d}=await resolveSqlNewInputs(_0x12a0e6),_0x28d32c=generateSqlTemplate(_0x513e4d),_0x9cb1b7=await createSqlQuery({'appCode':_0x12a0e6[_0x23f627(0xae)],'sqlName':_0x328736,'dbId':_0x33bba8,'sqlContent':_0x28d32c}),_0x4a7290=ensureRemoteSqlContent(_0x9cb1b7),_0x2d26b1=_0x265944||await getDbName(_0x12a0e6[_0x23f627(0xae)],_0x33bba8)[_0x23f627(0xb1)](()=>undefined),_0x1db040=buildSqlRelativePath(_0x9cb1b7[_0x23f627(0xeb)],_0x9cb1b7[_0x23f627(0xb0)],_0x2d26b1,_0x513e4d,_0x33bba8),_0x17f28c=_0x6b57df[_0x23f627(0xb3)]+'/'+_0x1db040,_0x415553=buildLocalSqlFileContent({'sqlCode':_0x9cb1b7[_0x23f627(0xeb)],'sqlName':_0x9cb1b7[_0x23f627(0xb0)],'dbId':_0x9cb1b7['dbId']},_0x4a7290,{'dbName':_0x2d26b1,'mode':_0x513e4d,'syncedAt':new Date()[_0x23f627(0xaf)](),'description':_0x9cb1b7[_0x23f627(0xd7)]});if(await fileExists(_0x17f28c))throw CliErrors[_0x23f627(0xca)](_0x23f627(0xcf)+_0x17f28c);await ensureParentDirectory(_0x17f28c),await writeFile(_0x17f28c,_0x415553,'utf8');const _0x17af42=await readSqlLockFile(_0x6b57df[_0x23f627(0xb2)]),{lockData:_0x1bb759,appLock:_0x398741}=ensureSqlLockScope(_0x17af42??createEmptySqlLock(),_0x6b57df[_0x23f627(0xae)],_0x6b57df[_0x23f627(0xed)],'new');return _0x398741[_0x23f627(0xd5)][_0x9cb1b7[_0x23f627(0xeb)]]={...buildSqlLockEntry(_0x9cb1b7,_0x4a7290,computeSqlContentHash(_0x415553),{'dbName':_0x2d26b1}),'path':_0x1db040,'mode':_0x513e4d},_0x398741[_0x23f627(0xcd)]=new Date()[_0x23f627(0xaf)](),await writeSqlLockFile(_0x6b57df[_0x23f627(0xb2)],_0x1bb759),{'ok':!![],'data':{'id':_0x9cb1b7['id'],'sqlCode':_0x9cb1b7[_0x23f627(0xeb)],'sqlName':_0x9cb1b7[_0x23f627(0xb0)],'dbId':_0x9cb1b7[_0x23f627(0xdb)],'path':_0x17f28c,'mode':_0x513e4d},'message':_0x23f627(0xe4)+_0x9cb1b7['sqlCode']};}};async function resolveSqlNewInputs(_0x21b861){const _0x3ec5d3=await resolveSqlNameInput(_0x21b861),{dbId:_0x1ad300,dbName:_0x4ab4e5}=await resolveDbSelection(_0x21b861),_0x536cc3=await resolveSqlModeInput(_0x21b861);return{'sqlName':_0x3ec5d3,'dbId':_0x1ad300,'dbName':_0x4ab4e5,'mode':_0x536cc3};}async function resolveSqlNameInput(_0x3099d5){const _0x39a9ee=a167_0x86492d,_0x363949=_0x3099d5[_0x39a9ee(0xb6)](_0x39a9ee(0xc7))[_0x39a9ee(0xcb)]();if(_0x363949)return _0x363949;if(_0x3099d5['nonInteractive'])throw CliErrors[_0x39a9ee(0xd8)](_0x39a9ee(0xc7),_0x39a9ee(0xbe));return(await input({'message':'请输入\x20SQL\x20名称:','validate':_0x287ba2=>_0x287ba2[_0x39a9ee(0xcb)]()?!![]:_0x39a9ee(0xc0)}))['trim']();}async function resolveDbSelection(_0x10cbe9){const _0x20226a=a167_0x86492d,_0x382302=resolveProvidedDbId(_0x10cbe9);if(typeof _0x382302===_0x20226a(0xd3)&&Number[_0x20226a(0xdf)](_0x382302)&&_0x382302>0x0)return{'dbId':_0x382302,'dbName':await getDbName(_0x10cbe9[_0x20226a(0xae)],_0x382302)[_0x20226a(0xb1)](()=>undefined)};if(_0x10cbe9[_0x20226a(0xc5)])throw CliErrors[_0x20226a(0xd8)]('db-id','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x55a5ef=await listDatabases(_0x10cbe9[_0x20226a(0xae)])['catch'](()=>[]);if(_0x55a5ef['length']===0x1)return{'dbId':_0x55a5ef[0x0][_0x20226a(0xdb)],'dbName':_0x55a5ef[0x0][_0x20226a(0xd0)]};if(_0x55a5ef[_0x20226a(0xe7)]>0x1){const _0x19866a=await select({'message':_0x20226a(0xb9),'choices':[..._0x55a5ef['map'](_0xd37a8b=>({'name':_0xd37a8b['dbName']+'\x20('+_0xd37a8b[_0x20226a(0xdb)]+')','value':serializeDbSelection(_0xd37a8b)})),{'name':'✎\x20手动输入\x20dbId','value':_0x20226a(0xea)}]});if(_0x19866a!==_0x20226a(0xea))return deserializeDbSelection(_0x19866a);}const _0x119f1d=await input({'message':_0x20226a(0xcc),'validate':_0x40cf02=>{const _0x44c10a=_0x20226a,_0x298a8f=_0x40cf02[_0x44c10a(0xcb)]();if(!_0x298a8f)return'dbId\x20不能为空';const _0x4b8437=Number(_0x298a8f);if(!Number[_0x44c10a(0xc9)](_0x4b8437)||_0x4b8437<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x119f1d[_0x20226a(0xcb)]())};}async function resolveSqlModeInput(_0xd000c8){const _0x7579da=a167_0x86492d,_0x2fab02=_0xd000c8[_0x7579da(0xb6)](_0x7579da(0xc2))[_0x7579da(0xcb)]();if(_0x2fab02===_0x7579da(0xd2)||_0x2fab02===_0x7579da(0xc1))return _0x2fab02;if(_0xd000c8['nonInteractive'])throw CliErrors['flagMissing'](_0x7579da(0xc2),_0x7579da(0xbd));return await select({'message':_0x7579da(0xe2),'choices':[{'name':_0x7579da(0xe5),'value':_0x7579da(0xd2),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0x7579da(0xd6),'value':_0x7579da(0xc1),'description':'适合带动态标签的\x20MyBatis\x20XML\x20SQL'}]});}function serializeDbSelection(_0x3a7d91){const _0x3f69dc=a167_0x86492d;return JSON[_0x3f69dc(0xc8)]({'dbId':_0x3a7d91[_0x3f69dc(0xdb)],'dbName':_0x3a7d91[_0x3f69dc(0xd0)]});}function deserializeDbSelection(_0x1866d5){const _0x1f19cb=a167_0x86492d;try{const _0x528efd=JSON[_0x1f19cb(0xb8)](_0x1866d5);if(typeof _0x528efd['dbId']===_0x1f19cb(0xd3)&&Number[_0x1f19cb(0xdf)](_0x528efd[_0x1f19cb(0xdb)]))return{'dbId':_0x528efd[_0x1f19cb(0xdb)],'dbName':_0x528efd[_0x1f19cb(0xd0)]};}catch{}throw CliErrors[_0x1f19cb(0xca)]('Invalid\x20database\x20selection\x20payload:\x20'+_0x1866d5);}function resolveProvidedDbId(_0x20027e){const _0x42943f=a167_0x86492d,_0x3392ee=_0x20027e[_0x42943f(0xc6)](_0x42943f(0xb4));if(typeof _0x3392ee===_0x42943f(0xd3)&&Number[_0x42943f(0xdf)](_0x3392ee))return _0x3392ee;return undefined;}
1
+ const a169_0x16da62=a169_0x2ae2;(function(_0x36baea,_0x2b2741){const _0x378091=a169_0x2ae2,_0x4bac8e=_0x36baea();while(!![]){try{const _0x2ede99=-parseInt(_0x378091(0x166))/0x1*(parseInt(_0x378091(0x15e))/0x2)+-parseInt(_0x378091(0x150))/0x3+parseInt(_0x378091(0x138))/0x4*(-parseInt(_0x378091(0x14d))/0x5)+-parseInt(_0x378091(0x164))/0x6+parseInt(_0x378091(0x130))/0x7+-parseInt(_0x378091(0x13b))/0x8+-parseInt(_0x378091(0x13a))/0x9*(-parseInt(_0x378091(0x13f))/0xa);if(_0x2ede99===_0x2b2741)break;else _0x4bac8e['push'](_0x4bac8e['shift']());}catch(_0x51ed8c){_0x4bac8e['push'](_0x4bac8e['shift']());}}}(a169_0x4bb9,0x9ee93));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';function a169_0x4bb9(){const _0x2b8a2a=['--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','Invalid\x20database\x20selection\x20payload:\x20','map','sqlRootDir','256056JYHOOg','dbId','60071IHGPMX','sqlName','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','create','sqlCode','appCode','stringify','validation','</select>','适合带动态标签的\x20MyBatis\x20XML\x20SQL','str','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','5428710VKPSBA','new','flagMissing','SQL\x20名称不能为空','MyBatis\x20XML(mybatisXml)','name','catch','Target\x20database\x20ID','8SPqaSh','mybatisXml','22887cgeQcq','3659472NWfLZn','isInteger','普通\x20SQL(sql)','lockFilePath','3510bSpXGz','string','nonInteractive','__manual__','isFinite','utf8','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','请选择目标数据库:','\x20\x20SELECT\x201\x20AS\x20id','join','Created\x20SQL\x20query\x20','✎\x20手动输入\x20dbId','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','sqlRoot','157715zihFHl','db-id','trim','1181871RTtTOl','number','sql','toISOString','/smartapi/custom/saveUserCustomSql','POST','parse','mode','请选择本地\x20SQL\x20模式:','description','dbId\x20不能为空','<server-generated-sqlCode>','lastSync','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','2WnxrTK','File\x20already\x20exists:\x20'];a169_0x4bb9=function(){return _0x2b8a2a;};return a169_0x4bb9();}function a169_0x2ae2(_0x294d34,_0x1540a9){_0x294d34=_0x294d34-0x12f;const _0x4bb9c1=a169_0x4bb9();let _0x2ae2c9=_0x4bb9c1[_0x294d34];return _0x2ae2c9;}import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x2ae7a4){const _0x32f89f=a169_0x2ae2;if(_0x2ae7a4===_0x32f89f(0x139))return[_0x32f89f(0x12f),_0x32f89f(0x147),_0x32f89f(0x16e),''][_0x32f89f(0x148)]('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x32f89f(0x148)]('\x0a');}export const sqlCreate={'service':a169_0x16da62(0x152),'command':a169_0x16da62(0x169),'description':a169_0x16da62(0x145),'risk':'high-risk-write','flags':[{'name':a169_0x16da62(0x135),'type':'string','description':'SQL\x20query\x20display\x20name'},{'name':a169_0x16da62(0x14e),'type':a169_0x16da62(0x151),'description':a169_0x16da62(0x137)},{'name':'mode','type':a169_0x16da62(0x140),'enum':[a169_0x16da62(0x152),a169_0x16da62(0x139)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x12fd5c){const _0x2cfd07=a169_0x16da62;if(!_0x12fd5c[_0x2cfd07(0x141)])return;if(!_0x12fd5c[_0x2cfd07(0x170)](_0x2cfd07(0x135))['trim']())throw CliErrors[_0x2cfd07(0x132)](_0x2cfd07(0x135),_0x2cfd07(0x15d));const _0x16c098=resolveProvidedDbId(_0x12fd5c);if(typeof _0x16c098!=='number'||!Number[_0x2cfd07(0x143)](_0x16c098)||_0x16c098<=0x0)throw CliErrors[_0x2cfd07(0x132)](_0x2cfd07(0x14e),_0x2cfd07(0x160));if(!_0x12fd5c[_0x2cfd07(0x170)](_0x2cfd07(0x157))['trim']())throw CliErrors['flagMissing'](_0x2cfd07(0x157),_0x2cfd07(0x168));},async 'dryRun'(_0x404985){const _0x2ce1fb=a169_0x16da62,_0x5e096e=loadSqlProjectConfig(_0x404985[_0x2ce1fb(0x16b)]),{sqlName:_0x4200c2,dbId:_0x2779c1,dbName:_0x47cbc4,mode:_0x115270}=await resolveSqlNewInputs(_0x404985),_0x3fbd39=buildSqlRelativePath(_0x2ce1fb(0x15b),_0x4200c2,_0x47cbc4,_0x115270,_0x2779c1),_0x4bb7c8=_0x5e096e[_0x2ce1fb(0x163)]+'/'+_0x3fbd39;return{'method':_0x2ce1fb(0x155),'url':_0x2ce1fb(0x154),'body':{'appCode':_0x404985['appCode'],'sqlName':_0x4200c2,'dbId':_0x2779c1,'mode':_0x115270,'localPath':_0x4bb7c8},'description':_0x2ce1fb(0x14b)+_0x5e096e[_0x2ce1fb(0x163)]};},async 'execute'(_0x15a29d){const _0x5399d=a169_0x16da62,_0x33d7fa=loadSqlProjectConfig(_0x15a29d['appCode']),{sqlName:_0x34db18,dbId:_0x4aabf9,dbName:_0x59ae14,mode:_0xf8b4bc}=await resolveSqlNewInputs(_0x15a29d),_0x2ea9de=generateSqlTemplate(_0xf8b4bc),_0x4b970f=await createSqlQuery({'appCode':_0x15a29d['appCode'],'sqlName':_0x34db18,'dbId':_0x4aabf9,'sqlContent':_0x2ea9de}),_0x3fbce3=ensureRemoteSqlContent(_0x4b970f),_0x17ea4e=_0x59ae14||await getDbName(_0x15a29d[_0x5399d(0x16b)],_0x4aabf9)['catch'](()=>undefined),_0x45daaf=buildSqlRelativePath(_0x4b970f[_0x5399d(0x16a)],_0x4b970f[_0x5399d(0x167)],_0x17ea4e,_0xf8b4bc,_0x4aabf9),_0x2dab96=_0x33d7fa[_0x5399d(0x163)]+'/'+_0x45daaf,_0x5f088c=buildLocalSqlFileContent({'sqlCode':_0x4b970f[_0x5399d(0x16a)],'sqlName':_0x4b970f[_0x5399d(0x167)],'dbId':_0x4b970f[_0x5399d(0x165)]},_0x3fbce3,{'dbName':_0x17ea4e,'mode':_0xf8b4bc,'syncedAt':new Date()[_0x5399d(0x153)](),'description':_0x4b970f[_0x5399d(0x159)]});if(await fileExists(_0x2dab96))throw CliErrors[_0x5399d(0x16d)](_0x5399d(0x15f)+_0x2dab96);await ensureParentDirectory(_0x2dab96),await writeFile(_0x2dab96,_0x5f088c,_0x5399d(0x144));const _0x403a34=await readSqlLockFile(_0x33d7fa[_0x5399d(0x13e)]),{lockData:_0x205ac6,appLock:_0x4ca5f5}=ensureSqlLockScope(_0x403a34??createEmptySqlLock(),_0x33d7fa['appCode'],_0x33d7fa[_0x5399d(0x14c)],_0x5399d(0x131));return _0x4ca5f5['sqls'][_0x4b970f[_0x5399d(0x16a)]]={...buildSqlLockEntry(_0x4b970f,_0x3fbce3,computeSqlContentHash(_0x5f088c),{'dbName':_0x17ea4e}),'path':_0x45daaf,'mode':_0xf8b4bc},_0x4ca5f5[_0x5399d(0x15c)]=new Date()[_0x5399d(0x153)](),await writeSqlLockFile(_0x33d7fa[_0x5399d(0x13e)],_0x205ac6),{'ok':!![],'data':{'id':_0x4b970f['id'],'sqlCode':_0x4b970f[_0x5399d(0x16a)],'sqlName':_0x4b970f['sqlName'],'dbId':_0x4b970f[_0x5399d(0x165)],'path':_0x2dab96,'mode':_0xf8b4bc},'message':_0x5399d(0x149)+_0x4b970f['sqlCode']};}};async function resolveSqlNewInputs(_0x776f12){const _0x4a53d2=await resolveSqlNameInput(_0x776f12),{dbId:_0x29f1fe,dbName:_0xce2fc3}=await resolveDbSelection(_0x776f12),_0x3be3da=await resolveSqlModeInput(_0x776f12);return{'sqlName':_0x4a53d2,'dbId':_0x29f1fe,'dbName':_0xce2fc3,'mode':_0x3be3da};}async function resolveSqlNameInput(_0x1ed63d){const _0x19eae8=a169_0x16da62,_0x24bcc7=_0x1ed63d['str'](_0x19eae8(0x135))['trim']();if(_0x24bcc7)return _0x24bcc7;if(_0x1ed63d[_0x19eae8(0x141)])throw CliErrors['flagMissing']('name',_0x19eae8(0x15d));return(await input({'message':'请输入\x20SQL\x20名称:','validate':_0x22e57d=>_0x22e57d[_0x19eae8(0x14f)]()?!![]:_0x19eae8(0x133)}))[_0x19eae8(0x14f)]();}async function resolveDbSelection(_0x52801c){const _0x11a318=a169_0x16da62,_0x18bb5c=resolveProvidedDbId(_0x52801c);if(typeof _0x18bb5c===_0x11a318(0x151)&&Number['isFinite'](_0x18bb5c)&&_0x18bb5c>0x0)return{'dbId':_0x18bb5c,'dbName':await getDbName(_0x52801c[_0x11a318(0x16b)],_0x18bb5c)[_0x11a318(0x136)](()=>undefined)};if(_0x52801c[_0x11a318(0x141)])throw CliErrors[_0x11a318(0x132)]('db-id',_0x11a318(0x160));const _0x571c29=await listDatabases(_0x52801c[_0x11a318(0x16b)])[_0x11a318(0x136)](()=>[]);if(_0x571c29['length']===0x1)return{'dbId':_0x571c29[0x0][_0x11a318(0x165)],'dbName':_0x571c29[0x0]['dbName']};if(_0x571c29['length']>0x1){const _0x566cf7=await select({'message':_0x11a318(0x146),'choices':[..._0x571c29[_0x11a318(0x162)](_0x5f4e69=>({'name':_0x5f4e69['dbName']+'\x20('+_0x5f4e69['dbId']+')','value':serializeDbSelection(_0x5f4e69)})),{'name':_0x11a318(0x14a),'value':_0x11a318(0x142)}]});if(_0x566cf7!==_0x11a318(0x142))return deserializeDbSelection(_0x566cf7);}const _0x906d46=await input({'message':'请输入目标数据库\x20dbId:','validate':_0xbb9e9c=>{const _0x22f9c2=_0x11a318,_0x88fd70=_0xbb9e9c[_0x22f9c2(0x14f)]();if(!_0x88fd70)return _0x22f9c2(0x15a);const _0x3d2b47=Number(_0x88fd70);if(!Number[_0x22f9c2(0x13c)](_0x3d2b47)||_0x3d2b47<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x906d46[_0x11a318(0x14f)]())};}async function resolveSqlModeInput(_0x2a80b4){const _0x4d1bf9=a169_0x16da62,_0x3fc7d8=_0x2a80b4[_0x4d1bf9(0x170)](_0x4d1bf9(0x157))['trim']();if(_0x3fc7d8==='sql'||_0x3fc7d8===_0x4d1bf9(0x139))return _0x3fc7d8;if(_0x2a80b4[_0x4d1bf9(0x141)])throw CliErrors[_0x4d1bf9(0x132)]('mode',_0x4d1bf9(0x168));return await select({'message':_0x4d1bf9(0x158),'choices':[{'name':_0x4d1bf9(0x13d),'value':_0x4d1bf9(0x152),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0x4d1bf9(0x134),'value':_0x4d1bf9(0x139),'description':_0x4d1bf9(0x16f)}]});}function serializeDbSelection(_0x18d747){const _0x3239cb=a169_0x16da62;return JSON[_0x3239cb(0x16c)]({'dbId':_0x18d747[_0x3239cb(0x165)],'dbName':_0x18d747['dbName']});}function deserializeDbSelection(_0x19d581){const _0x191be4=a169_0x16da62;try{const _0x4979d8=JSON[_0x191be4(0x156)](_0x19d581);if(typeof _0x4979d8[_0x191be4(0x165)]===_0x191be4(0x151)&&Number[_0x191be4(0x143)](_0x4979d8[_0x191be4(0x165)]))return{'dbId':_0x4979d8[_0x191be4(0x165)],'dbName':_0x4979d8['dbName']};}catch{}throw CliErrors['validation'](_0x191be4(0x161)+_0x19d581);}function resolveProvidedDbId(_0x31ab73){const _0x3690ae=a169_0x16da62,_0x58f293=_0x31ab73['flag'](_0x3690ae(0x14e));if(typeof _0x58f293===_0x3690ae(0x151)&&Number[_0x3690ae(0x143)](_0x58f293))return _0x58f293;return undefined;}
@@ -1 +1 @@
1
- const a168_0x3dd5b1=a168_0x2367;(function(_0x1301f6,_0x53f0a7){const _0x33adad=a168_0x2367,_0x11c3c8=_0x1301f6();while(!![]){try{const _0x58794c=-parseInt(_0x33adad(0xf6))/0x1+parseInt(_0x33adad(0x106))/0x2+-parseInt(_0x33adad(0x10d))/0x3*(-parseInt(_0x33adad(0x107))/0x4)+parseInt(_0x33adad(0x100))/0x5+-parseInt(_0x33adad(0x103))/0x6+-parseInt(_0x33adad(0x115))/0x7*(parseInt(_0x33adad(0xfa))/0x8)+parseInt(_0x33adad(0x110))/0x9*(parseInt(_0x33adad(0x10e))/0xa);if(_0x58794c===_0x53f0a7)break;else _0x11c3c8['push'](_0x11c3c8['shift']());}catch(_0x4438ba){_0x11c3c8['push'](_0x11c3c8['shift']());}}}(a168_0x14e7,0x34904));function a168_0x2367(_0x258e25,_0x3f78d1){_0x258e25=_0x258e25-0xf4;const _0x14e702=a168_0x14e7();let _0x2367c3=_0x14e702[_0x258e25];return _0x2367c3;}import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a168_0x14e7(){const _0x43aaaf=['SQL\x20lock\x20file\x20not\x20found.','trashedTo','delete','106127zMXZDc','sqlRootDir','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','229724frwGvZ','filter','sql','sqlRoot','144gSEZpY','\x20(local\x20file\x20moved\x20to\x20trash)','remoteId','high-risk-write','Would\x20delete\x20SQL\x20','sqlcode','1236850QBGYSW','length','appCode','1834506hMYFHL','trashDir','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','413904sffxzh','4xmkIqn','entries','lockFilePath','fromEntries','lastSync','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','67899xVPoct','10arssKA','str','4920462vzDtPj','validation'];a168_0x14e7=function(){return _0x43aaaf;};return a168_0x14e7();}export const sqlDelete={'service':a168_0x3dd5b1(0xf8),'command':'delete','description':a168_0x3dd5b1(0x10c),'risk':a168_0x3dd5b1(0xfd),'flags':[SQLCODE_FLAG],async 'validate'(_0x483c4b){const _0x3ae1c5=a168_0x3dd5b1,_0x50f2fb=loadSqlProjectConfig(_0x483c4b[_0x3ae1c5(0x102)]),_0x2e2a14=await readSqlLockFile(_0x50f2fb[_0x3ae1c5(0x109)]);if(!_0x2e2a14)throw CliErrors[_0x3ae1c5(0x111)](_0x3ae1c5(0x105));},async 'dryRun'(_0x4b1814){const _0x2e3d4b=a168_0x3dd5b1,_0x55feeb=loadSqlProjectConfig(_0x4b1814[_0x2e3d4b(0x102)]),_0x458806=await readSqlLockFile(_0x55feeb[_0x2e3d4b(0x109)]);if(!_0x458806)throw CliErrors[_0x2e3d4b(0x111)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x1d9f57}=ensureSqlLockScope(_0x458806,_0x4b1814[_0x2e3d4b(0x102)],_0x55feeb[_0x2e3d4b(0xf9)],_0x2e3d4b(0x114)),_0x27c9f5=_0x4b1814[_0x2e3d4b(0x10f)]('sqlcode'),_0x58a1a1=_0x1d9f57['sqls'][_0x27c9f5];if(!_0x58a1a1)throw CliErrors[_0x2e3d4b(0x111)](_0x2e3d4b(0xf5)+_0x27c9f5+'\x22.');return{'method':'POST','url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x27c9f5,'id':_0x58a1a1[_0x2e3d4b(0xfc)],'localPath':resolveLocalSqlFilePath(_0x55feeb,_0x27c9f5,_0x58a1a1)},'description':_0x2e3d4b(0xfe)+_0x27c9f5+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x55feeb[_0x2e3d4b(0x104)]};},async 'execute'(_0x2f79aa){const _0x5a586d=a168_0x3dd5b1,_0x4a38fa=loadSqlProjectConfig(_0x2f79aa['appCode']),_0x4a1d3f=await readSqlLockFile(_0x4a38fa[_0x5a586d(0x109)]);if(!_0x4a1d3f)throw CliErrors['validation'](_0x5a586d(0x112));const {lockData:_0x57bdc8,appLock:_0x32f5c9}=ensureSqlLockScope(_0x4a1d3f,_0x2f79aa[_0x5a586d(0x102)],_0x4a38fa[_0x5a586d(0xf9)],_0x5a586d(0x114)),_0x5b7897=_0x2f79aa['str'](_0x5a586d(0xff)),_0x3ac35a=_0x32f5c9['sqls'][_0x5b7897];if(!_0x3ac35a)throw CliErrors[_0x5a586d(0x111)](_0x5a586d(0xf5)+_0x5b7897+'\x22.');await deleteSqlQuery({'id':_0x3ac35a[_0x5a586d(0xfc)],'sqlCode':_0x5b7897}),_0x32f5c9['sqls']=Object[_0x5a586d(0x10a)](Object[_0x5a586d(0x108)](_0x32f5c9['sqls'])[_0x5a586d(0xf7)](([_0x49af5e])=>_0x49af5e!==_0x5b7897)),_0x32f5c9[_0x5a586d(0x10b)]=new Date()['toISOString'](),await writeSqlLockFile(_0x4a38fa[_0x5a586d(0x109)],_0x57bdc8);const _0x54481a=resolveLocalSqlFilePath(_0x4a38fa,_0x5b7897,_0x3ac35a);let _0x242f00;await fileExists(_0x54481a)&&(_0x242f00=await moveToTrash(_0x4a38fa['projectRoot'],_0x4a38fa[_0x5a586d(0x104)],_0x54481a),await cleanupEmptyDirectories(dirname(_0x54481a),_0x4a38fa[_0x5a586d(0xf4)]));const _0x5e829d={'deleted':_0x5b7897,'remoteId':_0x3ac35a[_0x5a586d(0xfc)]};if(_0x242f00)_0x5e829d[_0x5a586d(0x113)]=_0x242f00;return{'ok':!![],'data':_0x5e829d,'message':'Deleted\x20'+_0x5b7897+(_0x242f00?_0x5a586d(0xfb):'')};}};async function moveToTrash(_0x1baff7,_0x1e8289,_0x334bef){const _0x3370b8=new Date()['toISOString']()['replace'](/[:.]/g,'-'),_0x13f20c=relative(_0x1baff7,_0x334bef),_0x5745fb=join(_0x1e8289,_0x3370b8,_0x13f20c);return await mkdir(dirname(_0x5745fb),{'recursive':!![]}),await rename(_0x334bef,_0x5745fb),_0x5745fb;}async function cleanupEmptyDirectories(_0xd9cddc,_0x1f2e45){const _0x374303=a168_0x3dd5b1;let _0x58d3bd=resolve(_0xd9cddc);const _0x351b18=resolve(_0x1f2e45);while(_0x58d3bd['startsWith'](''+_0x351b18+sep)||_0x58d3bd===_0x351b18){if(_0x58d3bd===_0x351b18)return;try{const _0x2392c1=await readdir(_0x58d3bd);if(_0x2392c1[_0x374303(0x101)]>0x0)return;await rmdir(_0x58d3bd);}catch{return;}_0x58d3bd=dirname(_0x58d3bd);}}
1
+ const a170_0x3b9a2c=a170_0x292b;(function(_0x2b3bc5,_0x23e2e6){const _0x170015=a170_0x292b,_0x4e1719=_0x2b3bc5();while(!![]){try{const _0x45a399=-parseInt(_0x170015(0x180))/0x1*(parseInt(_0x170015(0x15f))/0x2)+parseInt(_0x170015(0x164))/0x3+parseInt(_0x170015(0x161))/0x4+parseInt(_0x170015(0x165))/0x5*(-parseInt(_0x170015(0x170))/0x6)+parseInt(_0x170015(0x16c))/0x7+-parseInt(_0x170015(0x162))/0x8*(parseInt(_0x170015(0x181))/0x9)+parseInt(_0x170015(0x16d))/0xa*(parseInt(_0x170015(0x15d))/0xb);if(_0x45a399===_0x23e2e6)break;else _0x4e1719['push'](_0x4e1719['shift']());}catch(_0x791098){_0x4e1719['push'](_0x4e1719['shift']());}}}(a170_0x3951,0x230a5));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a170_0x292b(_0x460aaa,_0x5123ac){_0x460aaa=_0x460aaa-0x15a;const _0x395111=a170_0x3951();let _0x292b6f=_0x395111[_0x460aaa];return _0x292b6f;}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':a170_0x3b9a2c(0x17e),'command':'delete','description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a170_0x3b9a2c(0x17b),'flags':[SQLCODE_FLAG],async 'validate'(_0x3c2790){const _0xd0221d=a170_0x3b9a2c,_0x3b5cf0=loadSqlProjectConfig(_0x3c2790[_0xd0221d(0x178)]),_0x381a60=await readSqlLockFile(_0x3b5cf0[_0xd0221d(0x179)]);if(!_0x381a60)throw CliErrors[_0xd0221d(0x15c)](_0xd0221d(0x17f));},async 'dryRun'(_0x8248f){const _0x3d1cbd=a170_0x3b9a2c,_0x57b4b4=loadSqlProjectConfig(_0x8248f['appCode']),_0x27c4d4=await readSqlLockFile(_0x57b4b4[_0x3d1cbd(0x179)]);if(!_0x27c4d4)throw CliErrors[_0x3d1cbd(0x15c)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x316fd4}=ensureSqlLockScope(_0x27c4d4,_0x8248f['appCode'],_0x57b4b4['sqlRoot'],_0x3d1cbd(0x171)),_0x3b9a5a=_0x8248f[_0x3d1cbd(0x16f)]('sqlcode'),_0x1080c3=_0x316fd4[_0x3d1cbd(0x163)][_0x3b9a5a];if(!_0x1080c3)throw CliErrors[_0x3d1cbd(0x15c)](_0x3d1cbd(0x168)+_0x3b9a5a+'\x22.');return{'method':_0x3d1cbd(0x173),'url':_0x3d1cbd(0x176),'body':{'sqlCode':_0x3b9a5a,'id':_0x1080c3[_0x3d1cbd(0x17a)],'localPath':resolveLocalSqlFilePath(_0x57b4b4,_0x3b9a5a,_0x1080c3)},'description':_0x3d1cbd(0x15b)+_0x3b9a5a+_0x3d1cbd(0x174)+_0x57b4b4['trashDir']};},async 'execute'(_0x55bc0d){const _0x26f087=a170_0x3b9a2c,_0x570488=loadSqlProjectConfig(_0x55bc0d[_0x26f087(0x178)]),_0x4641df=await readSqlLockFile(_0x570488[_0x26f087(0x179)]);if(!_0x4641df)throw CliErrors[_0x26f087(0x15c)](_0x26f087(0x15e));const {lockData:_0x45e7eb,appLock:_0x28bed3}=ensureSqlLockScope(_0x4641df,_0x55bc0d[_0x26f087(0x178)],_0x570488[_0x26f087(0x15a)],_0x26f087(0x171)),_0x5d9a45=_0x55bc0d[_0x26f087(0x16f)](_0x26f087(0x166)),_0x589c0b=_0x28bed3[_0x26f087(0x163)][_0x5d9a45];if(!_0x589c0b)throw CliErrors['validation'](_0x26f087(0x168)+_0x5d9a45+'\x22.');await deleteSqlQuery({'id':_0x589c0b['remoteId'],'sqlCode':_0x5d9a45}),_0x28bed3[_0x26f087(0x163)]=Object[_0x26f087(0x172)](Object[_0x26f087(0x160)](_0x28bed3[_0x26f087(0x163)])[_0x26f087(0x169)](([_0x15cef4])=>_0x15cef4!==_0x5d9a45)),_0x28bed3[_0x26f087(0x16b)]=new Date()[_0x26f087(0x17d)](),await writeSqlLockFile(_0x570488[_0x26f087(0x179)],_0x45e7eb);const _0x4b1cc1=resolveLocalSqlFilePath(_0x570488,_0x5d9a45,_0x589c0b);let _0x4ef220;await fileExists(_0x4b1cc1)&&(_0x4ef220=await moveToTrash(_0x570488[_0x26f087(0x17c)],_0x570488['trashDir'],_0x4b1cc1),await cleanupEmptyDirectories(dirname(_0x4b1cc1),_0x570488[_0x26f087(0x177)]));const _0x53b023={'deleted':_0x5d9a45,'remoteId':_0x589c0b[_0x26f087(0x17a)]};if(_0x4ef220)_0x53b023[_0x26f087(0x16a)]=_0x4ef220;return{'ok':!![],'data':_0x53b023,'message':_0x26f087(0x16e)+_0x5d9a45+(_0x4ef220?_0x26f087(0x175):'')};}};async function moveToTrash(_0xa18c08,_0x1905a2,_0x4c9dd6){const _0x140fec=a170_0x3b9a2c,_0x1df598=new Date()[_0x140fec(0x17d)]()[_0x140fec(0x167)](/[:.]/g,'-'),_0x39eb9c=relative(_0xa18c08,_0x4c9dd6),_0x5b180a=join(_0x1905a2,_0x1df598,_0x39eb9c);return await mkdir(dirname(_0x5b180a),{'recursive':!![]}),await rename(_0x4c9dd6,_0x5b180a),_0x5b180a;}async function cleanupEmptyDirectories(_0x44fdcc,_0x38fc0d){let _0x3dea07=resolve(_0x44fdcc);const _0x295208=resolve(_0x38fc0d);while(_0x3dea07['startsWith'](''+_0x295208+sep)||_0x3dea07===_0x295208){if(_0x3dea07===_0x295208)return;try{const _0x5ecf1f=await readdir(_0x3dea07);if(_0x5ecf1f['length']>0x0)return;await rmdir(_0x3dea07);}catch{return;}_0x3dea07=dirname(_0x3dea07);}}function a170_0x3951(){const _0x3eaa51=['SQL\x20lock\x20file\x20not\x20found.','3934nuEENM','entries','230596ZYOZhx','16056tbFrRR','sqls','119793ajJJRN','527585ufmCjK','sqlcode','replace','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','filter','trashedTo','lastSync','1940876oSKvMX','3408790ivNuAL','Deleted\x20','str','6IheaeR','delete','fromEntries','POST','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','\x20(local\x20file\x20moved\x20to\x20trash)','/smartapi/custom/deleteUserCustomSql','sqlRootDir','appCode','lockFilePath','remoteId','high-risk-write','projectRoot','toISOString','sql','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','124sqzCDy','999VilElj','sqlRoot','Would\x20delete\x20SQL\x20','validation','11RnADct'];a170_0x3951=function(){return _0x3eaa51;};return a170_0x3951();}
@@ -1 +1 @@
1
- const a169_0x683743=a169_0x59be;function a169_0x59be(_0x242dba,_0x137612){_0x242dba=_0x242dba-0x127;const _0xee7c52=a169_0xee7c();let _0x59be64=_0xee7c52[_0x242dba];return _0x59be64;}(function(_0x5d82a1,_0xe311a1){const _0x1c1240=a169_0x59be,_0x2642be=_0x5d82a1();while(!![]){try{const _0x46d2e6=-parseInt(_0x1c1240(0x12c))/0x1*(-parseInt(_0x1c1240(0x133))/0x2)+-parseInt(_0x1c1240(0x12a))/0x3*(parseInt(_0x1c1240(0x12d))/0x4)+-parseInt(_0x1c1240(0x135))/0x5*(-parseInt(_0x1c1240(0x137))/0x6)+-parseInt(_0x1c1240(0x128))/0x7*(-parseInt(_0x1c1240(0x12b))/0x8)+-parseInt(_0x1c1240(0x139))/0x9*(parseInt(_0x1c1240(0x12f))/0xa)+-parseInt(_0x1c1240(0x132))/0xb+parseInt(_0x1c1240(0x13a))/0xc;if(_0x46d2e6===_0xe311a1)break;else _0x2642be['push'](_0x2642be['shift']());}catch(_0x9e5cbd){_0x2642be['push'](_0x2642be['shift']());}}}(a169_0xee7c,0x3720c));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a169_0xee7c(){const _0x839b4=['2588LBlQXw','dbId','2697070WWkgFf','sqlName','sqlcode','4017442fFQPyN','8348RegEbU','detail','11885TUDCXf','bool','828itzClD','appCode','9dbAOyj','5436300bUyERP','verbose','sqlContent','5131IVuIjU','boolean','891nmUAQf','2648Sodfyu','7thiDia'];a169_0xee7c=function(){return _0x839b4;};return a169_0xee7c();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':a169_0x683743(0x134),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':'read','flags':[SQLCODE_FLAG,{'name':a169_0x683743(0x13b),'type':a169_0x683743(0x129),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0xec1988){const _0x9fcb18=a169_0x683743,_0x3df3f7=await getSqlQueryInfo(_0xec1988[_0x9fcb18(0x138)],_0xec1988['str'](_0x9fcb18(0x131))),_0x323d20=_0xec1988[_0x9fcb18(0x136)](_0x9fcb18(0x13b));if(_0x323d20)return{'ok':!![],'data':_0x3df3f7};const _0x44477b=_0x3df3f7[_0x9fcb18(0x12e)]?await getDbName(_0xec1988['appCode'],_0x3df3f7[_0x9fcb18(0x12e)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x3df3f7['sqlCode'],'sqlName':_0x3df3f7[_0x9fcb18(0x130)],'db':_0x44477b?_0x44477b+'\x20('+_0x3df3f7[_0x9fcb18(0x12e)]+')':_0x3df3f7[_0x9fcb18(0x12e)]??'','description':_0x3df3f7['description']??'','sqlContent':_0x3df3f7[_0x9fcb18(0x127)]??''}};}};
1
+ const a171_0x1805f0=a171_0x3313;(function(_0x2f11c4,_0x50fa77){const _0x3b50e3=a171_0x3313,_0x4e0f23=_0x2f11c4();while(!![]){try{const _0x71a572=parseInt(_0x3b50e3(0x1c7))/0x1*(parseInt(_0x3b50e3(0x1c4))/0x2)+parseInt(_0x3b50e3(0x1bf))/0x3+parseInt(_0x3b50e3(0x1c3))/0x4+-parseInt(_0x3b50e3(0x1c1))/0x5*(-parseInt(_0x3b50e3(0x1ba))/0x6)+parseInt(_0x3b50e3(0x1bc))/0x7+parseInt(_0x3b50e3(0x1c2))/0x8+-parseInt(_0x3b50e3(0x1c5))/0x9;if(_0x71a572===_0x50fa77)break;else _0x4e0f23['push'](_0x4e0f23['shift']());}catch(_0x2f1174){_0x4e0f23['push'](_0x4e0f23['shift']());}}}(a171_0x590d,0xe68ad));function a171_0x590d(){const _0x447549=['appCode','Return\x20full\x20raw\x20SQL\x20query\x20object','452574oyyydJ','sql','2514099xwkpdp','verbose','str','4085337ZzAntq','read','5mdKtgy','5131312cDTeot','6357572Xtobhn','56plEfoT','40080987eBmeBg','sqlCode','48949PWJeLT','description','sqlContent','dbId','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','sqlName','bool'];a171_0x590d=function(){return _0x447549;};return a171_0x590d();}import{getSqlQueryInfo}from'../../core/api-client.js';function a171_0x3313(_0x31fd8a,_0x3544db){_0x31fd8a=_0x31fd8a-0x1b5;const _0x590df8=a171_0x590d();let _0x331369=_0x590df8[_0x31fd8a];return _0x331369;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a171_0x1805f0(0x1bb),'command':'detail','description':a171_0x1805f0(0x1b5),'risk':a171_0x1805f0(0x1c0),'flags':[SQLCODE_FLAG,{'name':a171_0x1805f0(0x1bd),'type':'boolean','description':a171_0x1805f0(0x1b9)}],async 'execute'(_0xab9d45){const _0x109598=a171_0x1805f0,_0x42c117=await getSqlQueryInfo(_0xab9d45[_0x109598(0x1b8)],_0xab9d45[_0x109598(0x1be)]('sqlcode')),_0x298bf4=_0xab9d45[_0x109598(0x1b7)](_0x109598(0x1bd));if(_0x298bf4)return{'ok':!![],'data':_0x42c117};const _0x387a04=_0x42c117[_0x109598(0x1ca)]?await getDbName(_0xab9d45['appCode'],_0x42c117[_0x109598(0x1ca)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x42c117[_0x109598(0x1c6)],'sqlName':_0x42c117[_0x109598(0x1b6)],'db':_0x387a04?_0x387a04+'\x20('+_0x42c117[_0x109598(0x1ca)]+')':_0x42c117['dbId']??'','description':_0x42c117[_0x109598(0x1c8)]??'','sqlContent':_0x42c117[_0x109598(0x1c9)]??''}};}};
@@ -1 +1 @@
1
- function a170_0x3ebb(){const _0x57e794=['read','14176eYseVJ','9567921TiwRVr','\x20row(s)\x20in\x20','execSuccess','235787OrMIad','42iDTPEK','str','9zEthWn','7233232cGAmSc','2097465zzvsbu','string','Returned\x20','145NCAnIg','18630720TRbrHw','SQL\x20execution\x20failed','sql','sqlcode','10qIkqvB','2afQdiK','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','length','now','330701UrFOdV','appCode'];a170_0x3ebb=function(){return _0x57e794;};return a170_0x3ebb();}const a170_0x2a5aa9=a170_0x2d61;(function(_0x4c1725,_0x139a90){const _0x4d37fc=a170_0x2d61,_0x1317a9=_0x4c1725();while(!![]){try{const _0x25f537=-parseInt(_0x4d37fc(0x1b2))/0x1*(parseInt(_0x4d37fc(0x1c0))/0x2)+parseInt(_0x4d37fc(0x1b7))/0x3+parseInt(_0x4d37fc(0x1ae))/0x4*(-parseInt(_0x4d37fc(0x1ba))/0x5)+parseInt(_0x4d37fc(0x1b3))/0x6*(parseInt(_0x4d37fc(0x1ab))/0x7)+-parseInt(_0x4d37fc(0x1b6))/0x8*(parseInt(_0x4d37fc(0x1b5))/0x9)+-parseInt(_0x4d37fc(0x1bf))/0xa*(parseInt(_0x4d37fc(0x1af))/0xb)+parseInt(_0x4d37fc(0x1bb))/0xc;if(_0x25f537===_0x139a90)break;else _0x1317a9['push'](_0x1317a9['shift']());}catch(_0x5df7b1){_0x1317a9['push'](_0x1317a9['shift']());}}}(a170_0x3ebb,0x72b80));import{executeSql}from'../../core/api-client.js';function a170_0x2d61(_0x3fc880,_0x16b54f){_0x3fc880=_0x3fc880-0x1a9;const _0x3ebb17=a170_0x3ebb();let _0x2d61c9=_0x3ebb17[_0x3fc880];return _0x2d61c9;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a170_0x2a5aa9(0x1bd),'command':'exec','description':a170_0x2a5aa9(0x1c1),'risk':a170_0x2a5aa9(0x1ad),'flags':[SQLCODE_FLAG,{'name':'params','type':a170_0x2a5aa9(0x1b8),'description':'SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'}],async 'execute'(_0x33918e){const _0x4c1348=a170_0x2a5aa9,_0x5988f4=parseJsonParams(_0x33918e[_0x4c1348(0x1b4)]('params')),_0x5551ce=Date[_0x4c1348(0x1aa)](),_0x129078=await executeSql(_0x33918e[_0x4c1348(0x1ac)],_0x33918e[_0x4c1348(0x1b4)](_0x4c1348(0x1be)),_0x5988f4),_0x3bdbee=Date['now']()-_0x5551ce,_0x29f927=_0x129078?.['execResult']??_0x129078,_0x45ff0b=_0x129078?.[_0x4c1348(0x1b1)]??!![];if(!_0x45ff0b)return{'ok':![],'data':{'error':_0x129078?.['execError']||_0x4c1348(0x1bc),'elapsed':_0x3bdbee},'message':'SQL\x20execution\x20failed'};const _0x6a1aab=Array['isArray'](_0x29f927)?_0x29f927:[];return{'ok':!![],'data':{'rows':_0x6a1aab,'rowCount':_0x6a1aab[_0x4c1348(0x1a9)],'elapsed':_0x3bdbee},'message':_0x4c1348(0x1b9)+_0x6a1aab['length']+_0x4c1348(0x1b0)+_0x3bdbee+'ms'};}};
1
+ const a172_0x38c5fb=a172_0x4b7a;(function(_0x30f750,_0x18c848){const _0xd3eed=a172_0x4b7a,_0xc2a186=_0x30f750();while(!![]){try{const _0x48bd50=-parseInt(_0xd3eed(0x135))/0x1+-parseInt(_0xd3eed(0x136))/0x2+-parseInt(_0xd3eed(0x139))/0x3*(parseInt(_0xd3eed(0x147))/0x4)+parseInt(_0xd3eed(0x149))/0x5*(parseInt(_0xd3eed(0x13b))/0x6)+-parseInt(_0xd3eed(0x148))/0x7+-parseInt(_0xd3eed(0x144))/0x8*(-parseInt(_0xd3eed(0x14b))/0x9)+parseInt(_0xd3eed(0x13d))/0xa*(parseInt(_0xd3eed(0x134))/0xb);if(_0x48bd50===_0x18c848)break;else _0xc2a186['push'](_0xc2a186['shift']());}catch(_0x39da58){_0xc2a186['push'](_0xc2a186['shift']());}}}(a172_0x4f4f,0xc1d9e));import{executeSql}from'../../core/api-client.js';function a172_0x4b7a(_0x2b201c,_0x307c0e){_0x2b201c=_0x2b201c-0x132;const _0x4f4f3b=a172_0x4f4f();let _0x4b7a7f=_0x4f4f3b[_0x2b201c];return _0x4b7a7f;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a172_0x4f4f(){const _0x5d80a2=['26644519oPTDbp','899805MCJLHQ','1596556TFXyVv','execError','sql','95022mHqSBY','SQL\x20execution\x20failed','6zlQNSf','read','10UmJKXk','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','str','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','now','execSuccess','string','3433448FRnxjo','sqlcode','\x20row(s)\x20in\x20','72xYGFSB','9442048GDqzPl','7798415ZlbyqU','length','9LSoAbT','appCode','execResult','params','Returned\x20'];a172_0x4f4f=function(){return _0x5d80a2;};return a172_0x4f4f();}export const sqlExec={'service':a172_0x38c5fb(0x138),'command':'exec','description':a172_0x38c5fb(0x13e),'risk':a172_0x38c5fb(0x13c),'flags':[SQLCODE_FLAG,{'name':a172_0x38c5fb(0x132),'type':a172_0x38c5fb(0x143),'description':a172_0x38c5fb(0x140)}],async 'execute'(_0x231c47){const _0x1e2284=a172_0x38c5fb,_0x1ae8e4=parseJsonParams(_0x231c47[_0x1e2284(0x13f)](_0x1e2284(0x132))),_0x5c56e7=Date[_0x1e2284(0x141)](),_0x3e42b6=await executeSql(_0x231c47[_0x1e2284(0x14c)],_0x231c47['str'](_0x1e2284(0x145)),_0x1ae8e4),_0x3fbd6e=Date[_0x1e2284(0x141)]()-_0x5c56e7,_0x520521=_0x3e42b6?.[_0x1e2284(0x14d)]??_0x3e42b6,_0x208dcf=_0x3e42b6?.[_0x1e2284(0x142)]??!![];if(!_0x208dcf)return{'ok':![],'data':{'error':_0x3e42b6?.[_0x1e2284(0x137)]||'SQL\x20execution\x20failed','elapsed':_0x3fbd6e},'message':_0x1e2284(0x13a)};const _0x45e733=Array['isArray'](_0x520521)?_0x520521:[];return{'ok':!![],'data':{'rows':_0x45e733,'rowCount':_0x45e733[_0x1e2284(0x14a)],'elapsed':_0x3fbd6e},'message':_0x1e2284(0x133)+_0x45e733[_0x1e2284(0x14a)]+_0x1e2284(0x146)+_0x3fbd6e+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x3afebd,_0x1968f6){const _0x31253d=a171_0x5c2c,_0x5f7fd9=_0x3afebd();while(!![]){try{const _0x527dd6=parseInt(_0x31253d(0x10b))/0x1+-parseInt(_0x31253d(0x105))/0x2+parseInt(_0x31253d(0x10a))/0x3*(parseInt(_0x31253d(0x107))/0x4)+-parseInt(_0x31253d(0x109))/0x5*(-parseInt(_0x31253d(0x108))/0x6)+parseInt(_0x31253d(0x106))/0x7*(parseInt(_0x31253d(0x103))/0x8)+-parseInt(_0x31253d(0x10c))/0x9+-parseInt(_0x31253d(0x104))/0xa;if(_0x527dd6===_0x1968f6)break;else _0x5f7fd9['push'](_0x5f7fd9['shift']());}catch(_0x285002){_0x5f7fd9['push'](_0x5f7fd9['shift']());}}}(a171_0x13ce,0xc4139));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';function a171_0x5c2c(_0x35e794,_0x3e1004){_0x35e794=_0x35e794-0x103;const _0x13ce2f=a171_0x13ce();let _0x5c2c72=_0x13ce2f[_0x35e794];return _0x5c2c72;}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 a171_0x13ce(){const _0x5b0f9c=['65ZMEzvj','4371897Rhtamq','494724FcmnDZ','7958511lJdREf','8eMYsOE','808280KxTtRu','2352276uCbiCF','3940909upicxV','4xAZGMT','198168TjWsZO'];a171_0x13ce=function(){return _0x5b0f9c;};return a171_0x13ce();}import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x48f89b,_0x215389){const _0x3fe1b3=a173_0x457c,_0x5c3e09=_0x48f89b();while(!![]){try{const _0x39ae03=-parseInt(_0x3fe1b3(0x17f))/0x1*(-parseInt(_0x3fe1b3(0x17d))/0x2)+parseInt(_0x3fe1b3(0x17b))/0x3*(-parseInt(_0x3fe1b3(0x17e))/0x4)+parseInt(_0x3fe1b3(0x179))/0x5+parseInt(_0x3fe1b3(0x180))/0x6+parseInt(_0x3fe1b3(0x17c))/0x7*(parseInt(_0x3fe1b3(0x182))/0x8)+-parseInt(_0x3fe1b3(0x17a))/0x9+-parseInt(_0x3fe1b3(0x181))/0xa;if(_0x39ae03===_0x215389)break;else _0x5c3e09['push'](_0x5c3e09['shift']());}catch(_0x13f3f8){_0x5c3e09['push'](_0x5c3e09['shift']());}}}(a173_0x3781,0xd3582));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a173_0x3781(){const _0x17bf20=['6769953lMAvpQ','4038gTVvxQ','2758TIqGfI','9412vqxnYR','1244fZnIsr','305NqrOTb','76494nmelHz','8675020eogwjh','6592EcQobM','5656280dMYFVN'];a173_0x3781=function(){return _0x17bf20;};return a173_0x3781();}function a173_0x457c(_0x1bbf00,_0x4e7e09){_0x1bbf00=_0x1bbf00-0x179;const _0x378147=a173_0x3781();let _0x457cff=_0x378147[_0x1bbf00];return _0x457cff;}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';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a172_0x189c49=a172_0x1b06;(function(_0x19ddcf,_0x46ad1b){const _0xe08909=a172_0x1b06,_0x19ef9d=_0x19ddcf();while(!![]){try{const _0x5c35ab=parseInt(_0xe08909(0x1b1))/0x1*(parseInt(_0xe08909(0x1a7))/0x2)+-parseInt(_0xe08909(0x1a0))/0x3*(parseInt(_0xe08909(0x192))/0x4)+parseInt(_0xe08909(0x19e))/0x5+parseInt(_0xe08909(0x18f))/0x6*(-parseInt(_0xe08909(0x1b0))/0x7)+-parseInt(_0xe08909(0x1a2))/0x8*(parseInt(_0xe08909(0x19d))/0x9)+-parseInt(_0xe08909(0x1ad))/0xa*(-parseInt(_0xe08909(0x1ae))/0xb)+parseInt(_0xe08909(0x1a8))/0xc*(parseInt(_0xe08909(0x19b))/0xd);if(_0x5c35ab===_0x46ad1b)break;else _0x19ef9d['push'](_0x19ef9d['shift']());}catch(_0x25c8ed){_0x19ef9d['push'](_0x19ef9d['shift']());}}}(a172_0x4ba9,0x557e4));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a172_0x1b06(_0x3e9084,_0x229c61){_0x3e9084=_0x3e9084-0x18e;const _0x4ba91f=a172_0x4ba9();let _0x1b060b=_0x4ba91f[_0x3e9084];return _0x1b060b;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a172_0x189c49(0x1b3),'command':a172_0x189c49(0x1b4),'description':a172_0x189c49(0x193),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a172_0x189c49(0x191),'type':'string','description':a172_0x189c49(0x195)},{'name':'page','type':a172_0x189c49(0x1a9),'description':a172_0x189c49(0x1a3),'default':0x1},{'name':a172_0x189c49(0x194),'type':a172_0x189c49(0x1a9),'description':'Page\x20size'},{'name':a172_0x189c49(0x196),'type':a172_0x189c49(0x1ac),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x990cb1){const _0x40511b=a172_0x189c49,_0x2d695f=await listSqlQueries(_0x990cb1[_0x40511b(0x1a4)],{'sqlCode':_0x990cb1['str'](_0x40511b(0x1aa))||undefined,'sqlName':_0x990cb1[_0x40511b(0x1af)](_0x40511b(0x191))||undefined,'currentPage':_0x990cb1['num'](_0x40511b(0x197)),'pageSize':_0x990cb1[_0x40511b(0x18e)](_0x40511b(0x194),0x32)}),_0x4db54e=_0x990cb1[_0x40511b(0x19c)](_0x40511b(0x196)),_0xb63f89=_0x2d695f[_0x40511b(0x19f)]??[],_0x59855c=_0x2d695f[_0x40511b(0x19a)]?.[_0x40511b(0x199)]??_0xb63f89['length'];let _0x147e76;return _0x4db54e?_0x147e76=_0xb63f89:_0x147e76=await Promise['all'](_0xb63f89['map'](async _0xefebaf=>{const _0x1ac942=_0x40511b;let _0x1d3fe6;try{_0x1d3fe6=_0xefebaf[_0x1ac942(0x190)]?await getDbName(_0x990cb1['appCode'],_0xefebaf['dbId']):undefined;}catch{}return{'sqlCode':_0xefebaf[_0x1ac942(0x1a1)],'sqlName':_0xefebaf[_0x1ac942(0x198)],'description':_0xefebaf[_0x1ac942(0x1a6)]??'','db':_0x1d3fe6?_0x1d3fe6+'\x20('+_0xefebaf[_0x1ac942(0x190)]+')':_0xefebaf[_0x1ac942(0x190)]??''};})),{'ok':!![],'data':_0x147e76,'message':_0xb63f89[_0x40511b(0x1b2)]===0x0?_0x40511b(0x1a5):'Found\x20'+_0xb63f89[_0x40511b(0x1b2)]+_0x40511b(0x1ab)+_0x59855c+').'};}};function a172_0x4ba9(){const _0x2e86c6=['sqlCode','4362488erYWFA','Page\x20number','appCode','No\x20custom\x20SQL\x20queries\x20found.','description','58150Tdwxaq','1596cPPtWv','number','sqlcode','\x20SQL\x20queries\x20(total:\x20','boolean','10ZayePZ','182083JZUXuE','str','406lmGLLe','21xbLcOi','length','sql','list','num','9426fgmqqP','dbId','name','652wnRgEp','List\x20custom\x20SQL\x20queries','pagesize','Filter\x20by\x20SQL\x20name','verbose','page','sqlName','totalCount','paging','34437FYzjLl','bool','9ZbDJQM','387085CvPRhP','tableData','1293SfQVnt'];a172_0x4ba9=function(){return _0x2e86c6;};return a172_0x4ba9();}
1
+ function a174_0x1022(){const _0x1fb5c1=['tableData','606677smepBE','appCode','745998NjLGaz','read','length','page','2051608tqtdya','boolean','4817029ZYQQsc','975955uhMLHh','string','2GLfjAk','bool','sqlName','num','description','dbId','sqlCode','paging','15279870nNrwZI','12GajyUX','str','4219956mehkTG','pagesize','List\x20custom\x20SQL\x20queries','all','sql','totalCount','Page\x20size','sqlcode','number','Filter\x20by\x20SQL\x20name','Page\x20number','6hBdpuq','name'];a174_0x1022=function(){return _0x1fb5c1;};return a174_0x1022();}const a174_0x301e5c=a174_0x32ba;function a174_0x32ba(_0x45aa9a,_0x1e0e1d){_0x45aa9a=_0x45aa9a-0x186;const _0x10226f=a174_0x1022();let _0x32baf8=_0x10226f[_0x45aa9a];return _0x32baf8;}(function(_0x1b9c3f,_0x451f60){const _0x993cd2=a174_0x32ba,_0x506b94=_0x1b9c3f();while(!![]){try{const _0x381900=-parseInt(_0x993cd2(0x186))/0x1+parseInt(_0x993cd2(0x191))/0x2*(-parseInt(_0x993cd2(0x188))/0x3)+-parseInt(_0x993cd2(0x19a))/0x4*(-parseInt(_0x993cd2(0x18f))/0x5)+parseInt(_0x993cd2(0x1a7))/0x6*(-parseInt(_0x993cd2(0x18e))/0x7)+parseInt(_0x993cd2(0x18c))/0x8+-parseInt(_0x993cd2(0x19c))/0x9+parseInt(_0x993cd2(0x199))/0xa;if(_0x381900===_0x451f60)break;else _0x506b94['push'](_0x506b94['shift']());}catch(_0x10a2fd){_0x506b94['push'](_0x506b94['shift']());}}}(a174_0x1022,0x57505));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':a174_0x301e5c(0x1a0),'command':'list','description':a174_0x301e5c(0x19e),'risk':a174_0x301e5c(0x189),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a174_0x301e5c(0x1a8),'type':a174_0x301e5c(0x190),'description':a174_0x301e5c(0x1a5)},{'name':a174_0x301e5c(0x18b),'type':a174_0x301e5c(0x1a4),'description':a174_0x301e5c(0x1a6),'default':0x1},{'name':a174_0x301e5c(0x19d),'type':a174_0x301e5c(0x1a4),'description':a174_0x301e5c(0x1a2)},{'name':'verbose','type':a174_0x301e5c(0x18d),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x3f95fa){const _0x67e7a2=a174_0x301e5c,_0x25a3f8=await listSqlQueries(_0x3f95fa[_0x67e7a2(0x187)],{'sqlCode':_0x3f95fa[_0x67e7a2(0x19b)](_0x67e7a2(0x1a3))||undefined,'sqlName':_0x3f95fa['str']('name')||undefined,'currentPage':_0x3f95fa[_0x67e7a2(0x194)](_0x67e7a2(0x18b)),'pageSize':_0x3f95fa['num'](_0x67e7a2(0x19d),0x32)}),_0x2a741a=_0x3f95fa[_0x67e7a2(0x192)]('verbose'),_0x5d6e2c=_0x25a3f8[_0x67e7a2(0x1a9)]??[],_0x4ec37e=_0x25a3f8[_0x67e7a2(0x198)]?.[_0x67e7a2(0x1a1)]??_0x5d6e2c[_0x67e7a2(0x18a)];let _0x1fde1a;return _0x2a741a?_0x1fde1a=_0x5d6e2c:_0x1fde1a=await Promise[_0x67e7a2(0x19f)](_0x5d6e2c['map'](async _0x170f57=>{const _0x4c74b0=_0x67e7a2;let _0x2151fb;try{_0x2151fb=_0x170f57[_0x4c74b0(0x196)]?await getDbName(_0x3f95fa[_0x4c74b0(0x187)],_0x170f57[_0x4c74b0(0x196)]):undefined;}catch{}return{'sqlCode':_0x170f57[_0x4c74b0(0x197)],'sqlName':_0x170f57[_0x4c74b0(0x193)],'description':_0x170f57[_0x4c74b0(0x195)]??'','db':_0x2151fb?_0x2151fb+'\x20('+_0x170f57[_0x4c74b0(0x196)]+')':_0x170f57['dbId']??''};})),{'ok':!![],'data':_0x1fde1a,'message':_0x5d6e2c[_0x67e7a2(0x18a)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':'Found\x20'+_0x5d6e2c[_0x67e7a2(0x18a)]+'\x20SQL\x20queries\x20(total:\x20'+_0x4ec37e+').'};}};
@@ -1 +1 @@
1
- const a173_0x54d893=a173_0x9e74;(function(_0x5ae218,_0x39c93e){const _0x17f031=a173_0x9e74,_0x12d82f=_0x5ae218();while(!![]){try{const _0x273006=parseInt(_0x17f031(0x1cb))/0x1*(-parseInt(_0x17f031(0x1d5))/0x2)+parseInt(_0x17f031(0x1ce))/0x3+-parseInt(_0x17f031(0x1e1))/0x4*(parseInt(_0x17f031(0x1af))/0x5)+parseInt(_0x17f031(0x1d9))/0x6*(parseInt(_0x17f031(0x1b5))/0x7)+parseInt(_0x17f031(0x1db))/0x8+-parseInt(_0x17f031(0x1d4))/0x9*(-parseInt(_0x17f031(0x1d2))/0xa)+-parseInt(_0x17f031(0x1de))/0xb;if(_0x273006===_0x39c93e)break;else _0x12d82f['push'](_0x12d82f['shift']());}catch(_0x21403b){_0x12d82f['push'](_0x12d82f['shift']());}}}(a173_0x1b3a,0xc695a));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';function a173_0x9e74(_0x547e8f,_0x322674){_0x547e8f=_0x547e8f-0x1aa;const _0x1b3a11=a173_0x1b3a();let _0x9e74c5=_0x1b3a11[_0x547e8f];return _0x9e74c5;}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(_0x3cadc8,_0x5c0dcc){const _0x334f19=a173_0x9e74,_0x3b67ae=[];let _0x14d0f8=0x1;while(!![]){const _0x35f5a6=await listSqlQueries(_0x3cadc8,{'currentPage':_0x14d0f8,'pageSize':PAGE_SIZE,'sqlCode':_0x5c0dcc['sqlCode'],'sqlName':_0x5c0dcc['sqlName']}),_0x3c2d38=_0x35f5a6[_0x334f19(0x1d3)]??[];_0x3b67ae['push'](..._0x3c2d38);if(_0x3c2d38[_0x334f19(0x1c6)]===0x0)break;const _0x3151cf=_0x35f5a6[_0x334f19(0x1d8)]?.[_0x334f19(0x1ad)];if(_0x3151cf!=null?_0x3b67ae[_0x334f19(0x1c6)]>=_0x3151cf:_0x3c2d38[_0x334f19(0x1c6)]<PAGE_SIZE)break;_0x14d0f8++;}return _0x3b67ae;}async function ensureSqlContent(_0x429013){const _0x17ae53=a173_0x9e74;if(_0x429013[_0x17ae53(0x1c7)]!=null&&String(_0x429013['sqlContent'])[_0x17ae53(0x1c6)]>0x0)return _0x429013;return getSqlQueryDetail(_0x429013[_0x17ae53(0x1dc)]);}export const sqlPull={'service':a173_0x54d893(0x1b1),'command':a173_0x54d893(0x1bd),'description':a173_0x54d893(0x1ab),'risk':a173_0x54d893(0x1c9),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':'string','description':a173_0x54d893(0x1df)},{'name':a173_0x54d893(0x1d0),'type':'boolean','description':a173_0x54d893(0x1be)}],async 'dryRun'(_0x4924c1){const _0x240f61=a173_0x54d893,_0x235e92=loadSqlProjectConfig(_0x4924c1[_0x240f61(0x1d1)]),_0x171d7a=await readSqlLockFile(_0x235e92[_0x240f61(0x1cf)]),{appLock:_0x56f9c7}=ensureSqlLockScope(_0x171d7a??createEmptySqlLock(),_0x235e92['appCode'],_0x235e92[_0x240f61(0x1c5)],_0x240f61(0x1bd)),_0x11fe2e=await fetchAllSqlQueries(_0x4924c1['appCode'],{'sqlCode':_0x4924c1['str'](_0x240f61(0x1bc))||undefined,'sqlName':_0x4924c1[_0x240f61(0x1dd)](_0x240f61(0x1b4))||undefined}),_0x1cb0c4=[];for(const _0x29055d of _0x11fe2e){const _0x111016=await ensureSqlContent(_0x29055d),_0x14875c=ensureRemoteSqlContent(_0x111016),_0x36eee1=detectModeFromSql(_0x111016),_0x2fcf25=_0x111016['dbId']?await getDbName(_0x4924c1['appCode'],Number(_0x111016[_0x240f61(0x1cd)]))[_0x240f61(0x1c2)](()=>undefined):undefined,_0x1f6544=buildLocalSqlFileContent({'sqlCode':_0x111016[_0x240f61(0x1dc)],'sqlName':_0x111016[_0x240f61(0x1aa)],'dbId':_0x111016['dbId']},_0x14875c,{'dbName':_0x2fcf25,'mode':_0x36eee1,'syncedAt':new Date()[_0x240f61(0x1c4)](),'description':_0x111016['description']}),_0xbe7da5=buildSqlLockEntry(_0x111016,_0x14875c,'',{'dbName':_0x2fcf25}),_0x5629ef=resolveLocalSqlFilePath(_0x235e92,_0x111016[_0x240f61(0x1dc)],_0xbe7da5);let _0x5af5d0=_0x240f61(0x1da),_0x3332f6;if(await fileExists(_0x5629ef)){const _0x2c4470=await readFile(_0x5629ef,'utf8');isEquivalentPulledSqlFile(_0x2c4470,_0x1f6544,_0x36eee1)?(_0x5af5d0='skipped',_0x3332f6=_0x240f61(0x1ca)):(_0x5af5d0='conflict',_0x3332f6=_0x240f61(0x1ba));}_0x1cb0c4['push']({'sqlCode':_0x111016[_0x240f61(0x1dc)],'sqlName':_0x111016[_0x240f61(0x1aa)],'filePath':_0x5629ef,'status':_0x5af5d0,'reason':_0x3332f6});}return{'method':'POST','url':_0x240f61(0x1e0),'body':{'appCode':_0x4924c1[_0x240f61(0x1d1)],'sqlCode':_0x4924c1[_0x240f61(0x1dd)]('sqlcode')||null,'sqlName':_0x4924c1[_0x240f61(0x1dd)]('name')||null,'files':_0x1cb0c4},'description':_0x240f61(0x1c0)+_0x1cb0c4['length']+_0x240f61(0x1cc)+_0x235e92['sqlRootDir']};},async 'execute'(_0x563eb4){const _0x1abd21=a173_0x54d893,_0x1f94e3=loadSqlProjectConfig(_0x563eb4['appCode']),_0x5efbb0=await readSqlLockFile(_0x1f94e3['lockFilePath']),{lockData:_0x4f9000,appLock:_0xf1b447}=ensureSqlLockScope(_0x5efbb0??createEmptySqlLock(),_0x1f94e3['appCode'],_0x1f94e3[_0x1abd21(0x1c5)],'pull'),_0x4d0372=_0x563eb4[_0x1abd21(0x1c8)](_0x1abd21(0x1d0)),_0x1f6bdb=await fetchAllSqlQueries(_0x563eb4['appCode'],{'sqlCode':_0x563eb4[_0x1abd21(0x1dd)](_0x1abd21(0x1bc))||undefined,'sqlName':_0x563eb4['str']('name')||undefined});if(_0x1f6bdb[_0x1abd21(0x1c6)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x1abd21(0x1b9)};const _0x2b7cfc=[],_0x1d630c=[];for(const _0x124d8d of _0x1f6bdb){try{_0x2b7cfc[_0x1abd21(0x1b7)](await ensureSqlContent(_0x124d8d));}catch(_0x3d1646){_0x1d630c[_0x1abd21(0x1b7)]({'sqlCode':_0x124d8d[_0x1abd21(0x1dc)],'error':_0x3d1646 instanceof Error?_0x3d1646['message']:String(_0x3d1646)});}}if(_0x4d0372&&!_0x563eb4[_0x1abd21(0x1e2)]){let _0x1f8f8b=![];for(const _0x1dca5e of _0x2b7cfc){const _0x43283b=detectModeFromSql(_0x1dca5e),_0x33ba01=_0x1dca5e[_0x1abd21(0x1cd)]?await getDbName(_0x563eb4['appCode'],Number(_0x1dca5e[_0x1abd21(0x1cd)]))['catch'](()=>undefined):undefined,_0x3e478c=buildLocalSqlFileContent({'sqlCode':_0x1dca5e['sqlCode'],'sqlName':_0x1dca5e[_0x1abd21(0x1aa)],'dbId':_0x1dca5e['dbId']},ensureRemoteSqlContent(_0x1dca5e),{'dbName':_0x33ba01,'mode':_0x43283b,'syncedAt':new Date()['toISOString'](),'description':_0x1dca5e[_0x1abd21(0x1b6)]}),_0x26ed75=resolveLocalSqlFilePath(_0x1f94e3,_0x1dca5e[_0x1abd21(0x1dc)],buildSqlLockEntry(_0x1dca5e,ensureRemoteSqlContent(_0x1dca5e),'',{'dbName':_0x33ba01}));if(await fileExists(_0x26ed75)){const _0x420b76=await readFile(_0x26ed75,_0x1abd21(0x1d6));if(!isEquivalentPulledSqlFile(_0x420b76,_0x3e478c,_0x43283b)){_0x1f8f8b=!![];break;}}}if(_0x1f8f8b){const _0x3c9c0b=await confirmForceOverwrite(_0x1abd21(0x1bf));if(!_0x3c9c0b)throw CliErrors['cancelled']('Force\x20pull\x20cancelled.');}}const _0x2a5aaf=cloneSqlLockData(_0x4f9000),_0x2618cd=_0x2a5aaf[_0x1abd21(0x1ac)][_0x1f94e3[_0x1abd21(0x1d1)]],_0x201edf=[],_0x306dd9=[];for(const _0x33bbb1 of _0x2b7cfc){const _0x9f8828=_0x2618cd[_0x1abd21(0x1ae)][_0x33bbb1[_0x1abd21(0x1dc)]],_0x24bc77=ensureRemoteSqlContent(_0x33bbb1),_0x2ed319=detectModeFromSql(_0x33bbb1),_0x54a104=_0x33bbb1[_0x1abd21(0x1cd)]?await getDbName(_0x563eb4[_0x1abd21(0x1d1)],Number(_0x33bbb1[_0x1abd21(0x1cd)]))[_0x1abd21(0x1c2)](()=>undefined):undefined,_0x3acecc=buildLocalSqlFileContent({'sqlCode':_0x33bbb1['sqlCode'],'sqlName':_0x33bbb1[_0x1abd21(0x1aa)],'dbId':_0x33bbb1[_0x1abd21(0x1cd)]},_0x24bc77,{'dbName':_0x54a104,'mode':_0x2ed319,'syncedAt':new Date()[_0x1abd21(0x1c4)](),'description':_0x33bbb1['description']}),_0x50a6fe=buildSqlLockEntry(_0x33bbb1,_0x24bc77,computeSqlContentHash(_0x3acecc),{'dbName':_0x54a104}),_0x318600=_0x50a6fe['path'],_0x442e57=join(_0x1f94e3['sqlRootDir'],_0x318600);try{if(await fileExists(_0x442e57)){const _0x3cc63c=await readFile(_0x442e57,'utf8');if(isEquivalentPulledSqlFile(_0x3cc63c,_0x3acecc,_0x2ed319)){_0x306dd9['push']({'sqlCode':_0x33bbb1[_0x1abd21(0x1dc)],'reason':_0x1abd21(0x1ca)}),_0x2618cd[_0x1abd21(0x1ae)][_0x33bbb1['sqlCode']]={..._0x50a6fe,'hash':computeSqlContentHash(_0x3cc63c),'path':_0x318600};continue;}if(!_0x4d0372){_0x306dd9[_0x1abd21(0x1b7)]({'sqlCode':_0x33bbb1[_0x1abd21(0x1dc)],'reason':_0x1abd21(0x1b3)});continue;}}const _0x4f425d=_0x9f8828?.[_0x1abd21(0x1b0)]?join(_0x1f94e3[_0x1abd21(0x1b2)],_0x9f8828[_0x1abd21(0x1b0)]):undefined;_0x4f425d&&_0x4f425d!==_0x442e57&&await fileExists(_0x4f425d)&&await rm(_0x4f425d,{'force':!![]}),await ensureParentDirectory(_0x442e57),await writeFile(_0x442e57,_0x3acecc,'utf8'),_0x2618cd[_0x1abd21(0x1ae)][_0x33bbb1['sqlCode']]={..._0x50a6fe,'path':_0x318600},_0x201edf[_0x1abd21(0x1b7)]({'sqlCode':_0x33bbb1['sqlCode'],'filePath':_0x442e57});}catch(_0x3d798f){_0x1d630c['push']({'sqlCode':_0x33bbb1[_0x1abd21(0x1dc)],'error':_0x3d798f instanceof Error?_0x3d798f['message']:String(_0x3d798f)});}}return _0x2618cd['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x1f94e3[_0x1abd21(0x1cf)],_0x2a5aaf),{'ok':_0x1d630c[_0x1abd21(0x1c6)]===0x0,'data':{'pulled':_0x201edf,'skipped':_0x306dd9,'failed':_0x1d630c},'message':'Pull\x20complete:\x20'+_0x201edf[_0x1abd21(0x1c6)]+'\x20written,\x20'+_0x306dd9['length']+_0x1abd21(0x1d7)+_0x1d630c[_0x1abd21(0x1c6)]+'\x20failed'};}};function a173_0x1b3a(){const _0x54e0e0=['5610848xAipFl','sqlCode','str','5829241DfOUYD','Filter\x20by\x20SQL\x20display\x20name','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','1373024YEcnKT','nonInteractive','mybatisXml','sqlName','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','apps','totalCount','sqls','10RdzyIs','path','sql','sqlRootDir','local\x20differs\x20from\x20remote','name','8939zkERwF','description','push','test','No\x20remote\x20SQL\x20queries\x20matched.','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','join','sqlcode','pull','Force\x20overwrite\x20local\x20unsynced\x20changes','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','Would\x20pull\x20','split','catch','trimStart','toISOString','sqlRoot','length','sqlContent','bool','write','unchanged','2oiprOA','\x20SQL\x20file(s)\x20into\x20','dbId','2054655HHlQGa','lockFilePath','force','appCode','32770PnctCY','tableData','1017MLLtST','540146vSzdjp','utf8','\x20skipped,\x20','paging','3822jCaFyv','would_pull'];a173_0x1b3a=function(){return _0x54e0e0;};return a173_0x1b3a();}function detectModeFromSql(_0x5c3e85){const _0x1eadbf=a173_0x54d893,_0xf67f4c=ensureRemoteSqlContent(_0x5c3e85),_0x421451=stripLocalSqlMetadata(_0xf67f4c,_0x1eadbf(0x1e3))[_0x1eadbf(0x1c3)]();if(/^<(select|insert|update|delete)\b/i[_0x1eadbf(0x1b8)](_0x421451))return'mybatisXml';return'sql';}function isEquivalentPulledSqlFile(_0x16c8b4,_0x57d01c,_0x496716){return normalizePullComparableContent(_0x16c8b4,_0x496716)===normalizePullComparableContent(_0x57d01c,_0x496716);}function normalizePullComparableContent(_0x295345,_0x556328){const _0xf1503b=a173_0x54d893,_0x43d56b=_0x295345['replace'](/\r\n/g,'\x0a')[_0xf1503b(0x1c1)]('\x0a'),_0x5572ff=_0x43d56b['filter'](_0x4631f3=>!isSyncedAtMetadataLine(_0x4631f3,_0x556328));return _0x5572ff[_0xf1503b(0x1bb)]('\x0a');}function isSyncedAtMetadataLine(_0x3d08ad,_0x556fa4){const _0x4b6e32=a173_0x54d893;if(_0x556fa4===_0x4b6e32(0x1e3))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x4b6e32(0x1b8)](_0x3d08ad);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x4b6e32(0x1b8)](_0x3d08ad);}
1
+ const a175_0x5c0b10=a175_0x1283;(function(_0x5532e7,_0x84a1cd){const _0x526418=a175_0x1283,_0x324f7e=_0x5532e7();while(!![]){try{const _0x3df6e4=parseInt(_0x526418(0xf3))/0x1*(-parseInt(_0x526418(0x112))/0x2)+-parseInt(_0x526418(0xf7))/0x3+-parseInt(_0x526418(0x127))/0x4*(parseInt(_0x526418(0xeb))/0x5)+parseInt(_0x526418(0xf6))/0x6+parseInt(_0x526418(0x128))/0x7*(parseInt(_0x526418(0x122))/0x8)+parseInt(_0x526418(0x120))/0x9*(-parseInt(_0x526418(0xfd))/0xa)+parseInt(_0x526418(0x104))/0xb;if(_0x3df6e4===_0x84a1cd)break;else _0x324f7e['push'](_0x324f7e['shift']());}catch(_0x4719ca){_0x324f7e['push'](_0x324f7e['shift']());}}}(a175_0x338a,0x7bac1));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';function a175_0x1283(_0x20a4cb,_0xcab31b){_0x20a4cb=_0x20a4cb-0xeb;const _0x338a73=a175_0x338a();let _0x128365=_0x338a73[_0x20a4cb];return _0x128365;}function a175_0x338a(){const _0xb6d3cc=['description','length','Pull\x20complete:\x20','split','local\x20differs\x20from\x20remote','appCode','Filter\x20by\x20SQL\x20display\x20name','703146UzcyBD','boolean','paging','\x20SQL\x20file(s)\x20into\x20','apps','totalCount','conflict','sqls','filter','mybatisXml','force','sqlCode','sqlContent','utf8','99YBIwDl','test','8CdsCPj','str','No\x20remote\x20SQL\x20queries\x20matched.','nonInteractive','lastSync','320hkktEJ','2103423dfaRbw','28010WZWKRJ','skipped','dbId','Would\x20pull\x20','sqlRootDir','cancelled','\x20skipped,\x20','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','2boEOdt','message','toISOString','2132910tfTPzg','2552235uyqlxo','unchanged','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','\x20written,\x20','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','sql','255160zVkJrC','join','lockFilePath','push','catch','sqlcode','name','23466454oBdmbT','string','Force\x20pull\x20cancelled.','path','bool','tableData','sqlName'];a175_0x338a=function(){return _0xb6d3cc;};return a175_0x338a();}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(_0x4db385,_0x4ef990){const _0xd73da2=a175_0x1283,_0x3e0e6e=[];let _0x44f58a=0x1;while(!![]){const _0x5291b1=await listSqlQueries(_0x4db385,{'currentPage':_0x44f58a,'pageSize':PAGE_SIZE,'sqlCode':_0x4ef990[_0xd73da2(0x11d)],'sqlName':_0x4ef990[_0xd73da2(0x10a)]}),_0x2cddf3=_0x5291b1[_0xd73da2(0x109)]??[];_0x3e0e6e['push'](..._0x2cddf3);if(_0x2cddf3[_0xd73da2(0x10c)]===0x0)break;const _0x10ae12=_0x5291b1[_0xd73da2(0x114)]?.[_0xd73da2(0x117)];if(_0x10ae12!=null?_0x3e0e6e['length']>=_0x10ae12:_0x2cddf3[_0xd73da2(0x10c)]<PAGE_SIZE)break;_0x44f58a++;}return _0x3e0e6e;}async function ensureSqlContent(_0xe32b0b){const _0x162b70=a175_0x1283;if(_0xe32b0b[_0x162b70(0x11e)]!=null&&String(_0xe32b0b['sqlContent'])[_0x162b70(0x10c)]>0x0)return _0xe32b0b;return getSqlQueryDetail(_0xe32b0b[_0x162b70(0x11d)]);}export const sqlPull={'service':a175_0x5c0b10(0xfc),'command':'pull','description':a175_0x5c0b10(0xf2),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a175_0x5c0b10(0x103),'type':a175_0x5c0b10(0x105),'description':a175_0x5c0b10(0x111)},{'name':a175_0x5c0b10(0x11c),'type':a175_0x5c0b10(0x113),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0xeec843){const _0x40feed=a175_0x5c0b10,_0x1082d0=loadSqlProjectConfig(_0xeec843[_0x40feed(0x110)]),_0x19b0fe=await readSqlLockFile(_0x1082d0[_0x40feed(0xff)]),{appLock:_0x4312b3}=ensureSqlLockScope(_0x19b0fe??createEmptySqlLock(),_0x1082d0['appCode'],_0x1082d0['sqlRoot'],'pull'),_0x1183a1=await fetchAllSqlQueries(_0xeec843[_0x40feed(0x110)],{'sqlCode':_0xeec843[_0x40feed(0x123)](_0x40feed(0x102))||undefined,'sqlName':_0xeec843['str'](_0x40feed(0x103))||undefined}),_0x44887c=[];for(const _0x24dc82 of _0x1183a1){const _0x51a2f1=await ensureSqlContent(_0x24dc82),_0x44a1e4=ensureRemoteSqlContent(_0x51a2f1),_0x91f493=detectModeFromSql(_0x51a2f1),_0x793a7=_0x51a2f1[_0x40feed(0xed)]?await getDbName(_0xeec843[_0x40feed(0x110)],Number(_0x51a2f1[_0x40feed(0xed)]))[_0x40feed(0x101)](()=>undefined):undefined,_0x583803=buildLocalSqlFileContent({'sqlCode':_0x51a2f1['sqlCode'],'sqlName':_0x51a2f1[_0x40feed(0x10a)],'dbId':_0x51a2f1[_0x40feed(0xed)]},_0x44a1e4,{'dbName':_0x793a7,'mode':_0x91f493,'syncedAt':new Date()[_0x40feed(0xf5)](),'description':_0x51a2f1[_0x40feed(0x10b)]}),_0x281501=buildSqlLockEntry(_0x51a2f1,_0x44a1e4,'',{'dbName':_0x793a7}),_0x5be078=resolveLocalSqlFilePath(_0x1082d0,_0x51a2f1[_0x40feed(0x11d)],_0x281501);let _0x4c4a56='would_pull',_0x56bda4;if(await fileExists(_0x5be078)){const _0x1e8b44=await readFile(_0x5be078,'utf8');isEquivalentPulledSqlFile(_0x1e8b44,_0x583803,_0x91f493)?(_0x4c4a56=_0x40feed(0xec),_0x56bda4=_0x40feed(0xf8)):(_0x4c4a56=_0x40feed(0x118),_0x56bda4=_0x40feed(0xf9));}_0x44887c[_0x40feed(0x100)]({'sqlCode':_0x51a2f1['sqlCode'],'sqlName':_0x51a2f1[_0x40feed(0x10a)],'filePath':_0x5be078,'status':_0x4c4a56,'reason':_0x56bda4});}return{'method':'POST','url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0xeec843[_0x40feed(0x110)],'sqlCode':_0xeec843[_0x40feed(0x123)](_0x40feed(0x102))||null,'sqlName':_0xeec843[_0x40feed(0x123)](_0x40feed(0x103))||null,'files':_0x44887c},'description':_0x40feed(0xee)+_0x44887c['length']+_0x40feed(0x115)+_0x1082d0['sqlRootDir']};},async 'execute'(_0x1ff1d0){const _0x1bdd0c=a175_0x5c0b10,_0x15784c=loadSqlProjectConfig(_0x1ff1d0[_0x1bdd0c(0x110)]),_0x44c1af=await readSqlLockFile(_0x15784c[_0x1bdd0c(0xff)]),{lockData:_0x5b7790,appLock:_0x472984}=ensureSqlLockScope(_0x44c1af??createEmptySqlLock(),_0x15784c[_0x1bdd0c(0x110)],_0x15784c['sqlRoot'],'pull'),_0x23e534=_0x1ff1d0[_0x1bdd0c(0x108)](_0x1bdd0c(0x11c)),_0x2a3e28=await fetchAllSqlQueries(_0x1ff1d0[_0x1bdd0c(0x110)],{'sqlCode':_0x1ff1d0[_0x1bdd0c(0x123)](_0x1bdd0c(0x102))||undefined,'sqlName':_0x1ff1d0[_0x1bdd0c(0x123)](_0x1bdd0c(0x103))||undefined});if(_0x2a3e28[_0x1bdd0c(0x10c)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x1bdd0c(0x124)};const _0x3eec4e=[],_0xd5f6aa=[];for(const _0x3d5958 of _0x2a3e28){try{_0x3eec4e[_0x1bdd0c(0x100)](await ensureSqlContent(_0x3d5958));}catch(_0x106153){_0xd5f6aa[_0x1bdd0c(0x100)]({'sqlCode':_0x3d5958[_0x1bdd0c(0x11d)],'error':_0x106153 instanceof Error?_0x106153['message']:String(_0x106153)});}}if(_0x23e534&&!_0x1ff1d0[_0x1bdd0c(0x125)]){let _0x2fc35c=![];for(const _0x3db350 of _0x3eec4e){const _0x4a9449=detectModeFromSql(_0x3db350),_0x44c01c=_0x3db350[_0x1bdd0c(0xed)]?await getDbName(_0x1ff1d0[_0x1bdd0c(0x110)],Number(_0x3db350[_0x1bdd0c(0xed)]))[_0x1bdd0c(0x101)](()=>undefined):undefined,_0x23a0b7=buildLocalSqlFileContent({'sqlCode':_0x3db350[_0x1bdd0c(0x11d)],'sqlName':_0x3db350[_0x1bdd0c(0x10a)],'dbId':_0x3db350['dbId']},ensureRemoteSqlContent(_0x3db350),{'dbName':_0x44c01c,'mode':_0x4a9449,'syncedAt':new Date()[_0x1bdd0c(0xf5)](),'description':_0x3db350['description']}),_0x68e232=resolveLocalSqlFilePath(_0x15784c,_0x3db350['sqlCode'],buildSqlLockEntry(_0x3db350,ensureRemoteSqlContent(_0x3db350),'',{'dbName':_0x44c01c}));if(await fileExists(_0x68e232)){const _0x8810ec=await readFile(_0x68e232,_0x1bdd0c(0x11f));if(!isEquivalentPulledSqlFile(_0x8810ec,_0x23a0b7,_0x4a9449)){_0x2fc35c=!![];break;}}}if(_0x2fc35c){const _0x480994=await confirmForceOverwrite(_0x1bdd0c(0xfb));if(!_0x480994)throw CliErrors[_0x1bdd0c(0xf0)](_0x1bdd0c(0x106));}}const _0x5e83d2=cloneSqlLockData(_0x5b7790),_0x1be192=_0x5e83d2[_0x1bdd0c(0x116)][_0x15784c['appCode']],_0x2e35a8=[],_0x4842a1=[];for(const _0x51668a of _0x3eec4e){const _0x56701b=_0x1be192['sqls'][_0x51668a[_0x1bdd0c(0x11d)]],_0x26d4b8=ensureRemoteSqlContent(_0x51668a),_0x31439f=detectModeFromSql(_0x51668a),_0x4aa7a7=_0x51668a['dbId']?await getDbName(_0x1ff1d0[_0x1bdd0c(0x110)],Number(_0x51668a[_0x1bdd0c(0xed)]))[_0x1bdd0c(0x101)](()=>undefined):undefined,_0x5b8f83=buildLocalSqlFileContent({'sqlCode':_0x51668a[_0x1bdd0c(0x11d)],'sqlName':_0x51668a[_0x1bdd0c(0x10a)],'dbId':_0x51668a['dbId']},_0x26d4b8,{'dbName':_0x4aa7a7,'mode':_0x31439f,'syncedAt':new Date()['toISOString'](),'description':_0x51668a['description']}),_0x19a3da=buildSqlLockEntry(_0x51668a,_0x26d4b8,computeSqlContentHash(_0x5b8f83),{'dbName':_0x4aa7a7}),_0xa14dfe=_0x19a3da[_0x1bdd0c(0x107)],_0x21f153=join(_0x15784c[_0x1bdd0c(0xef)],_0xa14dfe);try{if(await fileExists(_0x21f153)){const _0x3a1e2d=await readFile(_0x21f153,'utf8');if(isEquivalentPulledSqlFile(_0x3a1e2d,_0x5b8f83,_0x31439f)){_0x4842a1[_0x1bdd0c(0x100)]({'sqlCode':_0x51668a['sqlCode'],'reason':'unchanged'}),_0x1be192[_0x1bdd0c(0x119)][_0x51668a[_0x1bdd0c(0x11d)]]={..._0x19a3da,'hash':computeSqlContentHash(_0x3a1e2d),'path':_0xa14dfe};continue;}if(!_0x23e534){_0x4842a1[_0x1bdd0c(0x100)]({'sqlCode':_0x51668a[_0x1bdd0c(0x11d)],'reason':_0x1bdd0c(0x10f)});continue;}}const _0x22adaa=_0x56701b?.[_0x1bdd0c(0x107)]?join(_0x15784c[_0x1bdd0c(0xef)],_0x56701b[_0x1bdd0c(0x107)]):undefined;_0x22adaa&&_0x22adaa!==_0x21f153&&await fileExists(_0x22adaa)&&await rm(_0x22adaa,{'force':!![]}),await ensureParentDirectory(_0x21f153),await writeFile(_0x21f153,_0x5b8f83,_0x1bdd0c(0x11f)),_0x1be192[_0x1bdd0c(0x119)][_0x51668a[_0x1bdd0c(0x11d)]]={..._0x19a3da,'path':_0xa14dfe},_0x2e35a8['push']({'sqlCode':_0x51668a['sqlCode'],'filePath':_0x21f153});}catch(_0x36d9de){_0xd5f6aa[_0x1bdd0c(0x100)]({'sqlCode':_0x51668a['sqlCode'],'error':_0x36d9de instanceof Error?_0x36d9de[_0x1bdd0c(0xf4)]:String(_0x36d9de)});}}return _0x1be192[_0x1bdd0c(0x126)]=new Date()['toISOString'](),await writeSqlLockFile(_0x15784c['lockFilePath'],_0x5e83d2),{'ok':_0xd5f6aa[_0x1bdd0c(0x10c)]===0x0,'data':{'pulled':_0x2e35a8,'skipped':_0x4842a1,'failed':_0xd5f6aa},'message':_0x1bdd0c(0x10d)+_0x2e35a8[_0x1bdd0c(0x10c)]+_0x1bdd0c(0xfa)+_0x4842a1[_0x1bdd0c(0x10c)]+_0x1bdd0c(0xf1)+_0xd5f6aa[_0x1bdd0c(0x10c)]+'\x20failed'};}};function detectModeFromSql(_0x2d0ffd){const _0x3dbc9f=a175_0x5c0b10,_0x136cbf=ensureRemoteSqlContent(_0x2d0ffd),_0x56fe60=stripLocalSqlMetadata(_0x136cbf,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x3dbc9f(0x121)](_0x56fe60))return _0x3dbc9f(0x11b);return _0x3dbc9f(0xfc);}function isEquivalentPulledSqlFile(_0x27bb11,_0x1ffcea,_0x47b95e){return normalizePullComparableContent(_0x27bb11,_0x47b95e)===normalizePullComparableContent(_0x1ffcea,_0x47b95e);}function normalizePullComparableContent(_0x27a438,_0x51de48){const _0x5eea73=a175_0x5c0b10,_0x125674=_0x27a438['replace'](/\r\n/g,'\x0a')[_0x5eea73(0x10e)]('\x0a'),_0x326207=_0x125674[_0x5eea73(0x11a)](_0x3b67dc=>!isSyncedAtMetadataLine(_0x3b67dc,_0x51de48));return _0x326207[_0x5eea73(0xfe)]('\x0a');}function isSyncedAtMetadataLine(_0x304878,_0xf38e1a){const _0x51e5a9=a175_0x5c0b10;if(_0xf38e1a===_0x51e5a9(0x11b))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x51e5a9(0x121)](_0x304878);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x51e5a9(0x121)](_0x304878);}