@lovrabet/rabetbase-cli 2.3.13-beta.2 → 2.3.13-beta.3

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/README.md +1 -1
  2. package/lib/api/api-doc.js +1 -1
  3. package/lib/api/fetch-model-list.js +1 -1
  4. package/lib/api/generate-api-file.js +1 -1
  5. package/lib/auth/auth-server-ui.js +1 -1
  6. package/lib/auth/auth-server.js +1 -1
  7. package/lib/auth/constant.js +1 -1
  8. package/lib/auth/get-cookie.js +1 -1
  9. package/lib/auth/get-session-user.js +1 -1
  10. package/lib/auth/is-session-valid.js +1 -1
  11. package/lib/auth/login-success-html.js +1 -1
  12. package/lib/auth/logout.js +1 -1
  13. package/lib/cli-flags.js +1 -1
  14. package/lib/cli.js +1 -1
  15. package/lib/commands/api/generate.js +1 -1
  16. package/lib/commands/api/index.js +1 -1
  17. package/lib/commands/api/list.js +1 -1
  18. package/lib/commands/api/pull.js +1 -1
  19. package/lib/commands/api/shared.js +1 -1
  20. package/lib/commands/app/add.js +1 -1
  21. package/lib/commands/app/index.js +1 -1
  22. package/lib/commands/app/list.js +1 -1
  23. package/lib/commands/app/remote-directory.js +1 -1
  24. package/lib/commands/app/remove.js +1 -1
  25. package/lib/commands/app/shared.js +1 -1
  26. package/lib/commands/app-config/delete.js +1 -1
  27. package/lib/commands/app-config/get.js +1 -1
  28. package/lib/commands/app-config/index.js +1 -1
  29. package/lib/commands/app-config/list.js +1 -1
  30. package/lib/commands/app-config/set.js +1 -1
  31. package/lib/commands/app-config/shared.js +1 -1
  32. package/lib/commands/auth/index.js +1 -1
  33. package/lib/commands/bff/create.js +1 -1
  34. package/lib/commands/bff/delete.js +1 -1
  35. package/lib/commands/bff/detail.js +1 -1
  36. package/lib/commands/bff/index.js +1 -1
  37. package/lib/commands/bff/list.js +1 -1
  38. package/lib/commands/bff/pull.js +1 -1
  39. package/lib/commands/bff/push.js +1 -1
  40. package/lib/commands/bff/status.js +1 -1
  41. package/lib/commands/cli-skill/index.js +1 -1
  42. package/lib/commands/cli-update.js +1 -1
  43. package/lib/commands/codegen/index.js +1 -1
  44. package/lib/commands/codegen/sdk.js +1 -1
  45. package/lib/commands/codegen/sql.js +1 -1
  46. package/lib/commands/common/app-registry.js +1 -1
  47. package/lib/commands/common/app-selector.js +1 -1
  48. package/lib/commands/common/async-task.js +1 -1
  49. package/lib/commands/common/dry-run.js +1 -1
  50. package/lib/commands/common/flags.js +1 -1
  51. package/lib/commands/common/local-file.js +1 -1
  52. package/lib/commands/common/validate.js +1 -1
  53. package/lib/commands/config/get.js +1 -1
  54. package/lib/commands/config/index.js +1 -1
  55. package/lib/commands/config/list.js +1 -1
  56. package/lib/commands/config/set.js +1 -1
  57. package/lib/commands/config/shared.js +1 -1
  58. package/lib/commands/data/filter.js +1 -1
  59. package/lib/commands/data/getOne.js +1 -1
  60. package/lib/commands/data/index.js +1 -1
  61. package/lib/commands/data/shared.js +1 -1
  62. package/lib/commands/dataset/business-group-update.js +1 -1
  63. package/lib/commands/dataset/capability.js +1 -1
  64. package/lib/commands/dataset/delete.js +1 -1
  65. package/lib/commands/dataset/detail.js +1 -1
  66. package/lib/commands/dataset/extend-update.js +1 -1
  67. package/lib/commands/dataset/field-update.js +1 -1
  68. package/lib/commands/dataset/generate.js +1 -1
  69. package/lib/commands/dataset/index.js +1 -1
  70. package/lib/commands/dataset/list.js +1 -1
  71. package/lib/commands/dataset/operations.js +1 -1
  72. package/lib/commands/dataset/relation-audit.js +1 -1
  73. package/lib/commands/dataset/relation-create.js +1 -1
  74. package/lib/commands/dataset/relation-delete.js +1 -1
  75. package/lib/commands/dataset/relation-shared.js +1 -1
  76. package/lib/commands/dataset/relation-update.js +1 -1
  77. package/lib/commands/dataset/relations.js +1 -1
  78. package/lib/commands/dataset/rename.js +1 -1
  79. package/lib/commands/dataset/restore.js +1 -1
  80. package/lib/commands/db/analysis-batching.js +1 -1
  81. package/lib/commands/db/analyze-batch-plan.js +1 -1
  82. package/lib/commands/db/analyze-cancel.js +1 -1
  83. package/lib/commands/db/analyze-start.js +1 -1
  84. package/lib/commands/db/analyze-status.js +1 -1
  85. package/lib/commands/db/create.js +1 -1
  86. package/lib/commands/db/delete.js +1 -1
  87. package/lib/commands/db/detail.js +1 -1
  88. package/lib/commands/db/diff.js +1 -1
  89. package/lib/commands/db/index.js +1 -1
  90. package/lib/commands/db/list.js +1 -1
  91. package/lib/commands/db/shared.js +1 -1
  92. package/lib/commands/db/tables.js +1 -1
  93. package/lib/commands/db/test.js +1 -1
  94. package/lib/commands/db/update.js +1 -1
  95. package/lib/commands/doctor.js +1 -1
  96. package/lib/commands/file/index.js +1 -1
  97. package/lib/commands/init/index.js +1 -1
  98. package/lib/commands/issue/index.js +1 -1
  99. package/lib/commands/issue/nudge.js +1 -1
  100. package/lib/commands/issue/report.js +1 -1
  101. package/lib/commands/issue/shared.js +1 -1
  102. package/lib/commands/logs/index.js +1 -1
  103. package/lib/commands/menu/asset-update.js +1 -0
  104. package/lib/commands/menu/delete.js +1 -1
  105. package/lib/commands/menu/external-link-create.js +1 -1
  106. package/lib/commands/menu/external-link-update.js +1 -0
  107. package/lib/commands/menu/group-create.js +1 -1
  108. package/lib/commands/menu/group-update.js +1 -1
  109. package/lib/commands/menu/index.js +1 -1
  110. package/lib/commands/menu/list.js +1 -1
  111. package/lib/commands/menu/move.js +1 -1
  112. package/lib/commands/menu/regroup-start.js +1 -1
  113. package/lib/commands/menu/shared/compare-table.js +1 -1
  114. package/lib/commands/menu/shared/delete-plan.js +1 -1
  115. package/lib/commands/menu/shared/facts.js +1 -1
  116. package/lib/commands/menu/shared/index.js +1 -1
  117. package/lib/commands/menu/shared/inquirer.js +1 -1
  118. package/lib/commands/menu/shared/local-pages.js +1 -1
  119. package/lib/commands/menu/shared/logic.js +1 -1
  120. package/lib/commands/menu/shared/mutations.js +1 -1
  121. package/lib/commands/menu/shared/service.js +1 -1
  122. package/lib/commands/menu/shared/sync-core.js +1 -1
  123. package/lib/commands/menu/shared/update-core.js +1 -1
  124. package/lib/commands/menu/shared/valid-url.js +1 -1
  125. package/lib/commands/menu/sync.js +1 -1
  126. package/lib/commands/notification/config-list.js +1 -1
  127. package/lib/commands/notification/index.js +1 -1
  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/shared.js +1 -1
  135. package/lib/commands/page/standard-page-status.js +1 -1
  136. package/lib/commands/page/sync.js +1 -1
  137. package/lib/commands/permit/index.js +1 -1
  138. package/lib/commands/permit/page-get.js +1 -1
  139. package/lib/commands/permit/page-set.js +1 -1
  140. package/lib/commands/permit/role-apis-set.js +1 -1
  141. package/lib/commands/permit/role-menus-set.js +1 -1
  142. package/lib/commands/permit/role-menus.js +1 -1
  143. package/lib/commands/permit/shared.js +1 -1
  144. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  145. package/lib/commands/project/create/format-elapsed.js +1 -1
  146. package/lib/commands/project/create/main.js +1 -1
  147. package/lib/commands/project/create/non-interactive.js +1 -1
  148. package/lib/commands/project/create/project-template-path.js +1 -1
  149. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  150. package/lib/commands/project/create/use-format-code.js +1 -1
  151. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  152. package/lib/commands/project/index.js +1 -1
  153. package/lib/commands/project/init.js +1 -1
  154. package/lib/commands/project/upgrade.js +1 -1
  155. package/lib/commands/registry.js +1 -1
  156. package/lib/commands/role/create.js +1 -1
  157. package/lib/commands/role/delete.js +1 -1
  158. package/lib/commands/role/detail.js +1 -1
  159. package/lib/commands/role/index.js +1 -1
  160. package/lib/commands/role/list.js +1 -1
  161. package/lib/commands/role/shared.js +1 -1
  162. package/lib/commands/role/update.js +1 -1
  163. package/lib/commands/role/user-add.js +1 -1
  164. package/lib/commands/role/user-remove.js +1 -1
  165. package/lib/commands/role/user-resolve.js +1 -1
  166. package/lib/commands/run/index.js +1 -1
  167. package/lib/commands/schema.js +1 -1
  168. package/lib/commands/sql/create.js +1 -1
  169. package/lib/commands/sql/delete.js +1 -1
  170. package/lib/commands/sql/detail.js +1 -1
  171. package/lib/commands/sql/exec.js +1 -1
  172. package/lib/commands/sql/index.js +1 -1
  173. package/lib/commands/sql/list.js +1 -1
  174. package/lib/commands/sql/pull.js +1 -1
  175. package/lib/commands/sql/push.js +1 -1
  176. package/lib/commands/sql/save.js +1 -1
  177. package/lib/commands/sql/shared.js +1 -1
  178. package/lib/commands/sql/status.js +1 -1
  179. package/lib/commands/sql/validate.js +1 -1
  180. package/lib/commands/task/index.js +1 -1
  181. package/lib/commands/task/status.js +1 -1
  182. package/lib/commands/workspace/add.js +1 -1
  183. package/lib/commands/workspace/index.js +1 -1
  184. package/lib/commands/workspace/remove.js +1 -1
  185. package/lib/config/schema.js +1 -1
  186. package/lib/constant/cdn.js +1 -1
  187. package/lib/constant/cli.js +1 -1
  188. package/lib/constant/defaults.js +1 -1
  189. package/lib/constant/domain.js +1 -1
  190. package/lib/constant/env.js +1 -1
  191. package/lib/constant/output.js +1 -1
  192. package/lib/constant/paths.js +1 -1
  193. package/lib/constant/risk.js +1 -1
  194. package/lib/context/app-resolver.js +1 -1
  195. package/lib/context/auth-resolver.js +1 -1
  196. package/lib/context/config-loader.js +1 -1
  197. package/lib/context.js +1 -1
  198. package/lib/core/alias-resolver.js +1 -1
  199. package/lib/core/api-client.js +1 -1
  200. package/lib/core/bff/config.js +1 -1
  201. package/lib/core/bff/file-system.js +1 -1
  202. package/lib/core/bff/hash.js +1 -1
  203. package/lib/core/bff/lock.js +1 -1
  204. package/lib/core/bff/utils.js +1 -1
  205. package/lib/core/db-resolver.js +1 -1
  206. package/lib/core/page/file-system.js +1 -1
  207. package/lib/core/page/hash.js +1 -1
  208. package/lib/core/page/lock.js +1 -1
  209. package/lib/core/sql-index-auditor.js +1 -1
  210. package/lib/core/sql-sync/config.js +1 -1
  211. package/lib/core/sql-sync/file-system.js +1 -1
  212. package/lib/core/sql-sync/hash.js +1 -1
  213. package/lib/core/sql-sync/lock.js +1 -1
  214. package/lib/core/sql-sync/utils.js +1 -1
  215. package/lib/core/sql-validator.js +1 -1
  216. package/lib/errors.js +1 -1
  217. package/lib/framework/build-all-flags.js +1 -1
  218. package/lib/framework/error-output.js +1 -1
  219. package/lib/framework/explicit-yes.js +1 -1
  220. package/lib/framework/flags.js +1 -1
  221. package/lib/framework/help.js +1 -1
  222. package/lib/framework/index.js +1 -1
  223. package/lib/framework/output.js +1 -1
  224. package/lib/framework/response.js +1 -1
  225. package/lib/framework/runner-alias.js +1 -1
  226. package/lib/framework/runner.js +1 -1
  227. package/lib/framework/schema-export.js +1 -1
  228. package/lib/framework/types.js +1 -1
  229. package/lib/generated/build-info.js +1 -1
  230. package/lib/help.js +1 -1
  231. package/lib/skills/main.js +1 -1
  232. package/lib/skills/npx-skills-add.js +1 -1
  233. package/lib/telemetry/cli-command-trace.js +1 -1
  234. package/lib/telemetry/cli-help-trace.js +1 -1
  235. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  236. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  237. package/lib/telemetry/send-cli-trace-log.js +1 -1
  238. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  239. package/lib/utils/ai_config.js +1 -1
  240. package/lib/utils/apply-jq-filter.js +1 -1
  241. package/lib/utils/cdn-config.js +1 -1
  242. package/lib/utils/check-sdk-version.js +1 -1
  243. package/lib/utils/cli-version-check.js +1 -1
  244. package/lib/utils/cli-version-policy.js +1 -1
  245. package/lib/utils/config.js +1 -1
  246. package/lib/utils/copy-directory.js +1 -1
  247. package/lib/utils/entity-with-id.js +1 -1
  248. package/lib/utils/file-utils.js +1 -1
  249. package/lib/utils/guides-cdn.js +1 -1
  250. package/lib/utils/http-client.js +1 -1
  251. package/lib/utils/is-non-interactive.js +1 -1
  252. package/lib/utils/logger.js +1 -1
  253. package/lib/utils/params.js +1 -1
  254. package/lib/utils/platform.js +1 -1
  255. package/lib/utils/rules-cdn.js +1 -1
  256. package/lib/utils/sleep.js +1 -1
  257. package/lib/utils/template-replacer.js +1 -1
  258. package/lib/utils/update-notice.js +1 -1
  259. package/lib/utils/version.js +1 -1
  260. package/lib/utils/with-active-cookie.js +1 -1
  261. package/lib/utils/write-cli-side-channel.js +1 -1
  262. package/package.json +1 -1
  263. package/lib/commands/menu/update.js +0 -1
@@ -1 +1 @@
1
- const a159_0x5982d2=a159_0x9419;(function(_0x2300f1,_0x1f5af2){const _0x4ae676=a159_0x9419,_0x50eeb7=_0x2300f1();while(!![]){try{const _0x5879df=-parseInt(_0x4ae676(0xe8))/0x1+parseInt(_0x4ae676(0x10a))/0x2*(-parseInt(_0x4ae676(0xf3))/0x3)+-parseInt(_0x4ae676(0x101))/0x4+parseInt(_0x4ae676(0xf1))/0x5*(parseInt(_0x4ae676(0x112))/0x6)+-parseInt(_0x4ae676(0xed))/0x7*(parseInt(_0x4ae676(0xf8))/0x8)+-parseInt(_0x4ae676(0xf5))/0x9*(parseInt(_0x4ae676(0xdf))/0xa)+parseInt(_0x4ae676(0x111))/0xb;if(_0x5879df===_0x1f5af2)break;else _0x50eeb7['push'](_0x50eeb7['shift']());}catch(_0x698c56){_0x50eeb7['push'](_0x50eeb7['shift']());}}}(a159_0x5b76,0x596fc));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':a159_0x5982d2(0xef)};export const ROLE_REF_FLAG={'name':a159_0x5982d2(0xe9),'type':a159_0x5982d2(0x108),'required':!![],'description':a159_0x5982d2(0x10b)};export const USER_REF_FLAG={'name':'user','type':a159_0x5982d2(0x108),'required':!![],'description':a159_0x5982d2(0xd8)};export const NAME_FLAG={'name':a159_0x5982d2(0x113),'type':a159_0x5982d2(0x108),'required':!![],'description':a159_0x5982d2(0x10d)};export const USER_NAME_FLAG={'name':'name','type':'string','required':!![],'description':a159_0x5982d2(0xe1)};export const REMARK_FLAG={'name':a159_0x5982d2(0x11a),'type':a159_0x5982d2(0x108),'required':![],'description':a159_0x5982d2(0xfb)};export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':'number','required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=['ADMIN',a159_0x5982d2(0xee),a159_0x5982d2(0x10f)];export function isBuiltinRole(_0x25ecf5){const _0x3131d7=a159_0x5982d2;return BUILTIN_ROLE_TYPES[_0x3131d7(0x100)](_0x25ecf5);}export function assertCustomRole(_0x1e8df0,_0x4fff87){const _0x14cc8d=a159_0x5982d2;if(_0x1e8df0['roleType']!==_0x14cc8d(0x11b))throw CliErrors['validation'](_0x14cc8d(0x10e)+_0x4fff87+_0x14cc8d(0xf7)+_0x1e8df0[_0x14cc8d(0x104)]+'\x20('+_0x1e8df0['roleType']+').',_0x14cc8d(0x120));}export function assertPermConfigurable(_0x5bbc4b){const _0x7425b4=a159_0x5982d2;if(_0x5bbc4b[_0x7425b4(0xde)]===_0x7425b4(0xee)||_0x5bbc4b[_0x7425b4(0xde)]===_0x7425b4(0xfd))throw CliErrors[_0x7425b4(0xf6)](_0x7425b4(0x121)+_0x5bbc4b[_0x7425b4(0x104)]+'\x20('+_0x5bbc4b['roleType']+').',_0x7425b4(0xdb));}export function projectRole(_0x9afa1b){const _0x483cff=a159_0x5982d2;return{'id':_0x9afa1b['id'],'roleName':_0x9afa1b[_0x483cff(0x104)],'roleType':_0x9afa1b[_0x483cff(0xde)],'remark':_0x9afa1b[_0x483cff(0x11a)],'userCount':_0x9afa1b['userCount'],'permitCount':_0x9afa1b[_0x483cff(0xdd)],'builtin':isBuiltinRole(_0x9afa1b['roleType'])};}export async function resolveRoleRef(_0xd9571f,_0x42173b){const _0x298a24=a159_0x5982d2,_0x127e1c=_0x42173b[_0x298a24(0x109)]();if(!_0x127e1c)throw CliErrors[_0x298a24(0xf6)](_0x298a24(0x117),_0x298a24(0xe6));if(/^\d+$/[_0x298a24(0xff)](_0x127e1c))return getRoleById(_0xd9571f,Number(_0x127e1c));const _0xa2dafe=await listAllAppRoles(_0xd9571f),_0x2aff54=_0xa2dafe[_0x298a24(0xdc)](_0x231a38=>_0x231a38[_0x298a24(0x104)]===_0x127e1c);if(_0x2aff54[_0x298a24(0x11c)]===0x0)throw CliErrors[_0x298a24(0xf6)](_0x298a24(0xe7)+_0x127e1c+'\x22\x20not\x20found\x20in\x20app\x20'+_0xd9571f+'.',_0x298a24(0xe3));if(_0x2aff54[_0x298a24(0x11c)]>0x1){const _0x1a8271=_0x2aff54[_0x298a24(0x110)](_0x4d475c=>_0x4d475c['id'])[_0x298a24(0x11d)](',\x20');throw CliErrors[_0x298a24(0xf6)](_0x298a24(0xe7)+_0x127e1c+_0x298a24(0x115)+_0x1a8271+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x2aff54[0x0];}export async function getRoleById(_0x2492ef,_0x52e499){const _0x278864=a159_0x5982d2,_0x33570a=await getAppRole(_0x52e499);if(!_0x33570a)throw CliErrors[_0x278864(0xf6)](_0x278864(0xd7)+_0x52e499+'\x20not\x20found\x20in\x20app\x20'+_0x2492ef+'.',_0x278864(0x114));return _0x33570a;}async function listAllAppRoles(_0x372362){const _0x4c7bf4=a159_0x5982d2,_0x43fb68=0x64,_0x24116d=[];for(let _0x2b210c=0x1;;_0x2b210c+=0x1){const {items:_0x102863,paging:_0x498591}=await listAppRoles(_0x372362,{'currentPage':_0x2b210c,'pageSize':_0x43fb68});_0x24116d[_0x4c7bf4(0xf0)](..._0x102863);if(_0x102863[_0x4c7bf4(0x11c)]<_0x43fb68||_0x498591&&_0x24116d[_0x4c7bf4(0x11c)]>=_0x498591['totalCount'])return _0x24116d;}}export async function resolveTenantCode(){const _0x18c19d=a159_0x5982d2,_0x566e45=await getSessionUserInfo(),_0xc292f6=_0x566e45?.[_0x18c19d(0x118)]?.['tenant']?.[_0x18c19d(0xec)];if(!_0xc292f6)throw CliErrors['authRequired'](_0x18c19d(0x10c));return _0xc292f6;}function matchMember(_0x3c95f8,_0x1c60e9){const _0x5d8c28=a159_0x5982d2,_0x559287=_0x1c60e9[_0x5d8c28(0x109)]()[_0x5d8c28(0x107)]();return(_0x3c95f8[_0x5d8c28(0x122)]??'')[_0x5d8c28(0x107)]()===_0x559287||(_0x3c95f8[_0x5d8c28(0x116)]??'')['toLowerCase']()===_0x559287;}export async function resolveUserRef(_0x1c1ab2){const _0x3b3c57=a159_0x5982d2,_0x373ad9=_0x1c1ab2['trim']();if(!_0x373ad9)throw CliErrors[_0x3b3c57(0xf6)]('Missing\x20user\x20reference.',_0x3b3c57(0xfe));const _0x4e07fc=await resolveTenantCode(),_0x125091=await getTenantMembers(_0x4e07fc);if(/^\d+$/['test'](_0x373ad9)){const _0x5e18cf=Number(_0x373ad9),_0x5bc0e8=_0x125091[_0x3b3c57(0x102)](_0x278631=>_0x278631[_0x3b3c57(0x11f)]===_0x5e18cf);return{'userId':_0x5e18cf,'username':_0x5bc0e8?.['username']??String(_0x5e18cf),'nickname':_0x5bc0e8?.[_0x3b3c57(0x122)],'matchedBy':'id'};}const _0x46d8f9=_0x125091[_0x3b3c57(0xdc)](_0x1a68d3=>matchMember(_0x1a68d3,_0x373ad9));if(_0x46d8f9[_0x3b3c57(0x11c)]===0x0)throw CliErrors[_0x3b3c57(0xf6)](_0x3b3c57(0xeb)+_0x373ad9+'\x22.',_0x3b3c57(0x119));if(_0x46d8f9['length']>0x1){const _0x3c06cb=_0x46d8f9[_0x3b3c57(0x110)](_0x13e65b=>(_0x13e65b[_0x3b3c57(0x122)]??_0x13e65b[_0x3b3c57(0x116)]??'?')+'('+_0x13e65b[_0x3b3c57(0x11f)]+')')[_0x3b3c57(0x11d)](',\x20');throw CliErrors[_0x3b3c57(0xf6)](_0x3b3c57(0xe2)+_0x373ad9+_0x3b3c57(0xd6)+_0x3c06cb+'.','Disambiguate\x20with\x20--user\x20<id>.');}const _0x4d0b9b=_0x46d8f9[0x0];return{'userId':_0x4d0b9b[_0x3b3c57(0x11f)],'username':_0x4d0b9b[_0x3b3c57(0x116)]??String(_0x4d0b9b[_0x3b3c57(0x11f)]),'nickname':_0x4d0b9b[_0x3b3c57(0x122)],'matchedBy':_0x3b3c57(0x113)};}export const UPDATE_USER_LIST_PATH='/smartapi/permit/user-role/update-user-list';function userIdsOf(_0x24f3a5){const _0x5eab94=a159_0x5982d2;return(_0x24f3a5?.[_0x5eab94(0xf9)]??[])[_0x5eab94(0x110)](_0x469bbb=>_0x469bbb[_0x5eab94(0x11f)]);}export function computeRoleUserMutation(_0x43234d){const _0x25c9fb=a159_0x5982d2,{operation:_0x3a09d1,appCode:_0x5afb2e,roleUsers:_0x40a9eb,targetRoleId:_0x3f341a,user:_0xf7d95}=_0x43234d,_0x2eb5ca=_0x40a9eb[_0x25c9fb(0x102)](_0x454aad=>_0x454aad['id']===_0x3f341a);if(!_0x2eb5ca)throw CliErrors[_0x25c9fb(0xf6)](_0x25c9fb(0xd7)+_0x3f341a+'\x20not\x20found\x20in\x20the\x20user-role\x20list.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');const _0x5df2bb=userIdsOf(_0x2eb5ca),_0x4e7818=[];if(_0x43234d[_0x25c9fb(0xf4)]!==undefined&&_0x43234d[_0x25c9fb(0xf4)]!==_0x5df2bb[_0x25c9fb(0x11c)])throw CliErrors['validation'](_0x25c9fb(0xd9)+_0x43234d[_0x25c9fb(0xf4)]+_0x25c9fb(0x105)+_0x5df2bb[_0x25c9fb(0x11c)]+'.',_0x25c9fb(0xe0));const _0x198ab4=_0x5df2bb['includes'](_0xf7d95[_0x25c9fb(0x11f)]);let _0x1a7739=![];const _0x31e010=[..._0x2eb5ca[_0x25c9fb(0xf9)]];if(_0x3a09d1===_0x25c9fb(0xf2))_0x198ab4?_0x4e7818[_0x25c9fb(0xf0)](_0x25c9fb(0xfc)+_0xf7d95[_0x25c9fb(0x11f)]+_0x25c9fb(0x106)+_0x2eb5ca[_0x25c9fb(0x104)]+';\x20no\x20change.'):(_0x31e010['push']({'userId':_0xf7d95[_0x25c9fb(0x11f)],'username':_0xf7d95[_0x25c9fb(0x116)],..._0xf7d95[_0x25c9fb(0x122)]?{'nickname':_0xf7d95['nickname']}:{}}),_0x1a7739=!![]);else{if(!_0x198ab4)_0x4e7818[_0x25c9fb(0xf0)](_0x25c9fb(0xfc)+_0xf7d95['userId']+_0x25c9fb(0x11e)+_0x2eb5ca[_0x25c9fb(0x104)]+';\x20no\x20change.');else{const _0x40de2a=_0x31e010['findIndex'](_0x1d9af4=>_0x1d9af4['userId']===_0xf7d95['userId']);if(_0x40de2a>=0x0)_0x31e010[_0x25c9fb(0x103)](_0x40de2a,0x1);_0x1a7739=!![];}}const _0x90781=_0x40a9eb['map'](_0x4fdf74=>_0x4fdf74['id']===_0x3f341a?{..._0x4fdf74,'userList':_0x31e010}:_0x4fdf74),_0x5204ce=_0x31e010[_0x25c9fb(0x110)](_0x28b01b=>_0x28b01b['userId']),_0x222024={'operation':_0x3a09d1,'selector':{'appCode':_0x5afb2e,'roleId':_0x3f341a,'roleName':_0x2eb5ca[_0x25c9fb(0x104)],'userId':_0xf7d95['userId']},'before':{'userIds':_0x5df2bb},'after':{'userIds':_0x5204ce},'dryRun':_0x43234d[_0x25c9fb(0xe5)],'backend':{'method':'POST','path':UPDATE_USER_LIST_PATH},'warnings':_0x4e7818};return{'roleList':_0x90781,'mutation':_0x222024,'changed':_0x1a7739};}function a159_0x9419(_0x425dba,_0x4ab4cf){_0x425dba=_0x425dba-0xd6;const _0x5b76f8=a159_0x5b76();let _0x94193c=_0x5b76f8[_0x425dba];return _0x94193c;}function a159_0x5b76(){const _0x5c874=['dryRun','Pass\x20--role\x20<id|name>.','Role\x20name\x20\x22','342818btYmTc','role','flag','No\x20tenant\x20member\x20matches\x20\x22','tenant_code','45024yKyqFR','DEV','Role\x20id\x20(from\x20`role\x20list`)','push','10uEwmFH','user-add','14613pOFISv','expectUserCount','1746FSIZPP','validation','\x20built-in\x20role\x20','304zLZwuw','userList','flagMissing','Optional\x20role\x20remark/description','User\x20','ADMIN','Pass\x20--user\x20<id|name>.','test','includes','2413704ASooVK','find','splice','roleName','\x20member(s)\x20but\x20role\x20has\x20','\x20is\x20already\x20a\x20member\x20of\x20role\x20','toLowerCase','string','trim','214gINDad','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','Role\x20name','Cannot\x20','USER','map','19586127Sztdim','2033034xBfuQn','name','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','\x22\x20is\x20ambiguous\x20(ids:\x20','username','Missing\x20role\x20reference.','user','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','remark','CUSTOM','length','join','\x20is\x20not\x20a\x20member\x20of\x20role\x20','userId','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20','nickname','expect-user-count','\x22:\x20','Role\x20id\x20','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','Anti-drift\x20check\x20failed:\x20expected\x20','str','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','filter','permitCount','roleType','19590piOZqt','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','Multiple\x20tenant\x20members\x20match\x20\x22','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','appCode'];a159_0x5b76=function(){return _0x5c874;};return a159_0x5b76();}export async function loadRoleUsers(_0x11d8f5){return listRoleUsers(_0x11d8f5);}export function readRoleRef(_0x28ad9a){const _0x2b9311=a159_0x5982d2,_0x55dec7=_0x28ad9a[_0x2b9311(0xda)](_0x2b9311(0xe9))[_0x2b9311(0x109)]();if(!_0x55dec7)throw CliErrors['flagMissing']('role',_0x2b9311(0xe6));return _0x55dec7;}export async function prepareUserMutation(_0x435a77,_0x448015,_0x595f76){const _0x427c3c=a159_0x5982d2,_0x1c20e6=readRoleRef(_0x435a77),_0xbfc475=_0x435a77[_0x427c3c(0xda)](_0x427c3c(0x118))['trim']();if(!_0xbfc475)throw CliErrors[_0x427c3c(0xfa)](_0x427c3c(0x118),_0x427c3c(0xfe));const _0x4fe010=_0x435a77[_0x427c3c(0xea)](_0x427c3c(0x123)),_0x58b12f=_0x4fe010===undefined||_0x4fe010===null?undefined:Number(_0x4fe010),_0x470851=await resolveRoleRef(_0x435a77[_0x427c3c(0xe4)],_0x1c20e6),_0x38add3=await resolveUserRef(_0xbfc475),_0x25ea5e=await loadRoleUsers(_0x435a77['appCode']);return computeRoleUserMutation({'operation':_0x448015,'appCode':_0x435a77[_0x427c3c(0xe4)],'roleUsers':_0x25ea5e,'targetRoleId':_0x470851['id'],'user':{'userId':_0x38add3['userId'],'username':_0x38add3['username'],'nickname':_0x38add3[_0x427c3c(0x122)]},'dryRun':_0x595f76,..._0x58b12f!==undefined?{'expectUserCount':_0x58b12f}:{}});}
1
+ const a160_0xb268fd=a160_0x38c3;(function(_0x474452,_0x5ab439){const _0x1a3c54=a160_0x38c3,_0x47c74b=_0x474452();while(!![]){try{const _0x3baa18=parseInt(_0x1a3c54(0xa9))/0x1*(-parseInt(_0x1a3c54(0xa7))/0x2)+-parseInt(_0x1a3c54(0xc6))/0x3+parseInt(_0x1a3c54(0xb8))/0x4*(-parseInt(_0x1a3c54(0xcc))/0x5)+-parseInt(_0x1a3c54(0xbe))/0x6+-parseInt(_0x1a3c54(0xb1))/0x7*(parseInt(_0x1a3c54(0xc8))/0x8)+-parseInt(_0x1a3c54(0xb0))/0x9*(-parseInt(_0x1a3c54(0xcf))/0xa)+parseInt(_0x1a3c54(0xaa))/0xb;if(_0x3baa18===_0x5ab439)break;else _0x47c74b['push'](_0x47c74b['shift']());}catch(_0x25b3cb){_0x47c74b['push'](_0x47c74b['shift']());}}}(a160_0x5ea9,0x4547a));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':a160_0xb268fd(0xcd),'required':!![],'description':'Role\x20id\x20(from\x20`role\x20list`)'};export const ROLE_REF_FLAG={'name':a160_0xb268fd(0xbb),'type':'string','required':!![],'description':'Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)'};function a160_0x5ea9(){const _0x5a73d9=['splice','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','No\x20tenant\x20member\x20matches\x20\x22','3241773zQMICf','173418lDkvty','map','expectUserCount','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','flagMissing','Cannot\x20','roleType','4QBsOUS','push','nickname','role','dryRun','flag','1396140mOeUsB','userList','Pass\x20--user\x20<id|name>.','validation','userCount','includes','username',';\x20no\x20change.','1646484eGzRlK','\x20member(s)\x20but\x20role\x20has\x20','136YxVtUs','\x20is\x20not\x20a\x20member\x20of\x20role\x20','DEV','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','2636495KgcJHd','number','trim','10wvOsyr','appCode','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20','roleName','string','filter','Disambiguate\x20with\x20--role\x20<id>.','\x20built-in\x20role\x20','USER','findIndex','Role\x20id\x20','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','Missing\x20user\x20reference.','Disambiguate\x20with\x20--user\x20<id>.','Role\x20name\x20\x22','CUSTOM','User\x20','tenant','userId','\x20not\x20found\x20in\x20app\x20','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','permitCount','Pass\x20--role\x20<id|name>.','test','\x22\x20not\x20found\x20in\x20app\x20','authRequired','user','toLowerCase','/smartapi/permit/user-role/update-user-list','tenant_code','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','str','Optional\x20role\x20remark/description','expect-user-count','length','join','name','118GOooFC','remark','7757KwZUMv','23223321GpSDxG','\x22:\x20'];a160_0x5ea9=function(){return _0x5a73d9;};return a160_0x5ea9();}export const USER_REF_FLAG={'name':a160_0xb268fd(0x9c),'type':a160_0xb268fd(0xd3),'required':!![],'description':a160_0xb268fd(0xad)};export const NAME_FLAG={'name':a160_0xb268fd(0xa6),'type':a160_0xb268fd(0xd3),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':a160_0xb268fd(0xa6),'type':'string','required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':a160_0xb268fd(0xa8),'type':a160_0xb268fd(0xd3),'required':![],'description':a160_0xb268fd(0xa2)};export const EXPECT_USER_COUNT_FLAG={'name':a160_0xb268fd(0xa3),'type':a160_0xb268fd(0xcd),'required':![],'description':a160_0xb268fd(0xcb)};export const BUILTIN_ROLE_TYPES=['ADMIN',a160_0xb268fd(0xca),a160_0xb268fd(0xd7)];export function isBuiltinRole(_0x2fc15f){const _0x41784b=a160_0xb268fd;return BUILTIN_ROLE_TYPES[_0x41784b(0xc3)](_0x2fc15f);}export function assertCustomRole(_0x87756b,_0x5b72ce){const _0x256c95=a160_0xb268fd;if(_0x87756b[_0x256c95(0xb7)]!==_0x256c95(0x90))throw CliErrors[_0x256c95(0xc1)](_0x256c95(0xb6)+_0x5b72ce+_0x256c95(0xd6)+_0x87756b[_0x256c95(0xd2)]+'\x20('+_0x87756b[_0x256c95(0xb7)]+').',_0x256c95(0xae));}export function assertPermConfigurable(_0x29ba50){const _0x11906c=a160_0xb268fd;if(_0x29ba50[_0x11906c(0xb7)]===_0x11906c(0xca)||_0x29ba50[_0x11906c(0xb7)]==='ADMIN')throw CliErrors['validation'](_0x11906c(0xd1)+_0x29ba50[_0x11906c(0xd2)]+'\x20('+_0x29ba50['roleType']+').',_0x11906c(0x8c));}export function projectRole(_0xdbf3a1){const _0xf34f52=a160_0xb268fd;return{'id':_0xdbf3a1['id'],'roleName':_0xdbf3a1[_0xf34f52(0xd2)],'roleType':_0xdbf3a1[_0xf34f52(0xb7)],'remark':_0xdbf3a1[_0xf34f52(0xa8)],'userCount':_0xdbf3a1[_0xf34f52(0xc2)],'permitCount':_0xdbf3a1[_0xf34f52(0x97)],'builtin':isBuiltinRole(_0xdbf3a1[_0xf34f52(0xb7)])};}export async function resolveRoleRef(_0x473d28,_0x8402ec){const _0x58a190=a160_0xb268fd,_0x3f5de7=_0x8402ec[_0x58a190(0xce)]();if(!_0x3f5de7)throw CliErrors['validation']('Missing\x20role\x20reference.',_0x58a190(0x98));if(/^\d+$/[_0x58a190(0x99)](_0x3f5de7))return getRoleById(_0x473d28,Number(_0x3f5de7));const _0x14354c=await listAllAppRoles(_0x473d28),_0x1cdd8c=_0x14354c[_0x58a190(0xd4)](_0x3a7bce=>_0x3a7bce[_0x58a190(0xd2)]===_0x3f5de7);if(_0x1cdd8c[_0x58a190(0xa4)]===0x0)throw CliErrors['validation'](_0x58a190(0x8f)+_0x3f5de7+_0x58a190(0x9a)+_0x473d28+'.',_0x58a190(0x95));if(_0x1cdd8c[_0x58a190(0xa4)]>0x1){const _0x46240a=_0x1cdd8c[_0x58a190(0xb2)](_0x4713c5=>_0x4713c5['id'])[_0x58a190(0xa5)](',\x20');throw CliErrors['validation'](_0x58a190(0x8f)+_0x3f5de7+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x46240a+').',_0x58a190(0xd5));}return _0x1cdd8c[0x0];}export async function getRoleById(_0x3be381,_0x9c974e){const _0xa4245e=a160_0xb268fd,_0x1b86d4=await getAppRole(_0x9c974e);if(!_0x1b86d4)throw CliErrors['validation'](_0xa4245e(0xd9)+_0x9c974e+_0xa4245e(0x94)+_0x3be381+'.',_0xa4245e(0x96));return _0x1b86d4;}async function listAllAppRoles(_0x3e6d92){const _0x6131ba=a160_0xb268fd,_0xfebe19=0x64,_0x53ee3d=[];for(let _0x218375=0x1;;_0x218375+=0x1){const {items:_0xf16aba,paging:_0x39c791}=await listAppRoles(_0x3e6d92,{'currentPage':_0x218375,'pageSize':_0xfebe19});_0x53ee3d[_0x6131ba(0xb9)](..._0xf16aba);if(_0xf16aba[_0x6131ba(0xa4)]<_0xfebe19||_0x39c791&&_0x53ee3d[_0x6131ba(0xa4)]>=_0x39c791['totalCount'])return _0x53ee3d;}}export async function resolveTenantCode(){const _0xd66a56=a160_0xb268fd,_0x4db146=await getSessionUserInfo(),_0x18f252=_0x4db146?.[_0xd66a56(0x9c)]?.[_0xd66a56(0x92)]?.[_0xd66a56(0x9f)];if(!_0x18f252)throw CliErrors[_0xd66a56(0x9b)](_0xd66a56(0xb4));return _0x18f252;}function matchMember(_0x22a901,_0x3d25fe){const _0x49148e=a160_0xb268fd,_0xca66da=_0x3d25fe[_0x49148e(0xce)]()[_0x49148e(0x9d)]();return(_0x22a901[_0x49148e(0xba)]??'')['toLowerCase']()===_0xca66da||(_0x22a901[_0x49148e(0xc4)]??'')['toLowerCase']()===_0xca66da;}export async function resolveUserRef(_0x43181d){const _0x1df27e=a160_0xb268fd,_0x382acf=_0x43181d[_0x1df27e(0xce)]();if(!_0x382acf)throw CliErrors['validation'](_0x1df27e(0x8d),_0x1df27e(0xc0));const _0x21b6ff=await resolveTenantCode(),_0x4210b0=await getTenantMembers(_0x21b6ff);if(/^\d+$/[_0x1df27e(0x99)](_0x382acf)){const _0x8c620d=Number(_0x382acf),_0x386680=_0x4210b0['find'](_0x2e550a=>_0x2e550a[_0x1df27e(0x93)]===_0x8c620d);return{'userId':_0x8c620d,'username':_0x386680?.['username']??String(_0x8c620d),'nickname':_0x386680?.['nickname'],'matchedBy':'id'};}const _0x53e46b=_0x4210b0[_0x1df27e(0xd4)](_0x2469c4=>matchMember(_0x2469c4,_0x382acf));if(_0x53e46b['length']===0x0)throw CliErrors[_0x1df27e(0xc1)](_0x1df27e(0xaf)+_0x382acf+'\x22.','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.');if(_0x53e46b[_0x1df27e(0xa4)]>0x1){const _0x35edd6=_0x53e46b[_0x1df27e(0xb2)](_0x54cf79=>(_0x54cf79[_0x1df27e(0xba)]??_0x54cf79['username']??'?')+'('+_0x54cf79[_0x1df27e(0x93)]+')')[_0x1df27e(0xa5)](',\x20');throw CliErrors[_0x1df27e(0xc1)]('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x382acf+_0x1df27e(0xab)+_0x35edd6+'.',_0x1df27e(0x8e));}const _0x226e33=_0x53e46b[0x0];return{'userId':_0x226e33[_0x1df27e(0x93)],'username':_0x226e33['username']??String(_0x226e33['userId']),'nickname':_0x226e33[_0x1df27e(0xba)],'matchedBy':'name'};}export const UPDATE_USER_LIST_PATH=a160_0xb268fd(0x9e);function userIdsOf(_0xd5c9ab){const _0x2e2a1c=a160_0xb268fd;return(_0xd5c9ab?.[_0x2e2a1c(0xbf)]??[])[_0x2e2a1c(0xb2)](_0x6a41ec=>_0x6a41ec[_0x2e2a1c(0x93)]);}export function computeRoleUserMutation(_0x33426b){const _0x3de930=a160_0xb268fd,{operation:_0x47317e,appCode:_0x3f71f9,roleUsers:_0x1a3222,targetRoleId:_0x275f07,user:_0xa73c5}=_0x33426b,_0x45a901=_0x1a3222['find'](_0x3e9420=>_0x3e9420['id']===_0x275f07);if(!_0x45a901)throw CliErrors[_0x3de930(0xc1)](_0x3de930(0xd9)+_0x275f07+'\x20not\x20found\x20in\x20the\x20user-role\x20list.',_0x3de930(0x96));const _0x48b3de=userIdsOf(_0x45a901),_0x3beddc=[];if(_0x33426b[_0x3de930(0xb3)]!==undefined&&_0x33426b[_0x3de930(0xb3)]!==_0x48b3de['length'])throw CliErrors['validation']('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x33426b[_0x3de930(0xb3)]+_0x3de930(0xc7)+_0x48b3de[_0x3de930(0xa4)]+'.',_0x3de930(0xa0));const _0x161326=_0x48b3de[_0x3de930(0xc3)](_0xa73c5[_0x3de930(0x93)]);let _0x431014=![];const _0x2e74a8=[..._0x45a901[_0x3de930(0xbf)]];if(_0x47317e==='user-add')_0x161326?_0x3beddc['push']('User\x20'+_0xa73c5[_0x3de930(0x93)]+'\x20is\x20already\x20a\x20member\x20of\x20role\x20'+_0x45a901[_0x3de930(0xd2)]+_0x3de930(0xc5)):(_0x2e74a8[_0x3de930(0xb9)]({'userId':_0xa73c5[_0x3de930(0x93)],'username':_0xa73c5[_0x3de930(0xc4)],..._0xa73c5['nickname']?{'nickname':_0xa73c5[_0x3de930(0xba)]}:{}}),_0x431014=!![]);else{if(!_0x161326)_0x3beddc[_0x3de930(0xb9)](_0x3de930(0x91)+_0xa73c5['userId']+_0x3de930(0xc9)+_0x45a901[_0x3de930(0xd2)]+_0x3de930(0xc5));else{const _0x32f899=_0x2e74a8[_0x3de930(0xd8)](_0x2a3722=>_0x2a3722[_0x3de930(0x93)]===_0xa73c5[_0x3de930(0x93)]);if(_0x32f899>=0x0)_0x2e74a8[_0x3de930(0xac)](_0x32f899,0x1);_0x431014=!![];}}const _0x3f86d5=_0x1a3222[_0x3de930(0xb2)](_0x472685=>_0x472685['id']===_0x275f07?{..._0x472685,'userList':_0x2e74a8}:_0x472685),_0x573115=_0x2e74a8[_0x3de930(0xb2)](_0x483c2a=>_0x483c2a[_0x3de930(0x93)]),_0x247cdf={'operation':_0x47317e,'selector':{'appCode':_0x3f71f9,'roleId':_0x275f07,'roleName':_0x45a901[_0x3de930(0xd2)],'userId':_0xa73c5[_0x3de930(0x93)]},'before':{'userIds':_0x48b3de},'after':{'userIds':_0x573115},'dryRun':_0x33426b[_0x3de930(0xbc)],'backend':{'method':'POST','path':UPDATE_USER_LIST_PATH},'warnings':_0x3beddc};return{'roleList':_0x3f86d5,'mutation':_0x247cdf,'changed':_0x431014};}export async function loadRoleUsers(_0x3cb2dd){return listRoleUsers(_0x3cb2dd);}function a160_0x38c3(_0x3ac20d,_0x35addb){_0x3ac20d=_0x3ac20d-0x8c;const _0x5ea909=a160_0x5ea9();let _0x38c36d=_0x5ea909[_0x3ac20d];return _0x38c36d;}export function readRoleRef(_0x4b1d2d){const _0x2c261f=a160_0xb268fd,_0x5402a2=_0x4b1d2d['str'](_0x2c261f(0xbb))[_0x2c261f(0xce)]();if(!_0x5402a2)throw CliErrors[_0x2c261f(0xb5)]('role','Pass\x20--role\x20<id|name>.');return _0x5402a2;}export async function prepareUserMutation(_0x2d5747,_0x2ade25,_0x424536){const _0x5445c8=a160_0xb268fd,_0x23192d=readRoleRef(_0x2d5747),_0x47b81c=_0x2d5747[_0x5445c8(0xa1)](_0x5445c8(0x9c))[_0x5445c8(0xce)]();if(!_0x47b81c)throw CliErrors['flagMissing'](_0x5445c8(0x9c),_0x5445c8(0xc0));const _0x13e052=_0x2d5747[_0x5445c8(0xbd)](_0x5445c8(0xa3)),_0x185951=_0x13e052===undefined||_0x13e052===null?undefined:Number(_0x13e052),_0x2748b0=await resolveRoleRef(_0x2d5747['appCode'],_0x23192d),_0xadc40b=await resolveUserRef(_0x47b81c),_0x97567c=await loadRoleUsers(_0x2d5747[_0x5445c8(0xd0)]);return computeRoleUserMutation({'operation':_0x2ade25,'appCode':_0x2d5747[_0x5445c8(0xd0)],'roleUsers':_0x97567c,'targetRoleId':_0x2748b0['id'],'user':{'userId':_0xadc40b[_0x5445c8(0x93)],'username':_0xadc40b['username'],'nickname':_0xadc40b[_0x5445c8(0xba)]},'dryRun':_0x424536,..._0x185951!==undefined?{'expectUserCount':_0x185951}:{}});}
@@ -1 +1 @@
1
- const a160_0x54e229=a160_0x208a;(function(_0xd92db6,_0x4edf84){const _0x10b687=a160_0x208a,_0x54e5bf=_0xd92db6();while(!![]){try{const _0x4f7764=-parseInt(_0x10b687(0xdb))/0x1+-parseInt(_0x10b687(0xda))/0x2*(parseInt(_0x10b687(0xd0))/0x3)+-parseInt(_0x10b687(0xcf))/0x4*(-parseInt(_0x10b687(0xdc))/0x5)+-parseInt(_0x10b687(0xc9))/0x6+-parseInt(_0x10b687(0xd1))/0x7*(parseInt(_0x10b687(0xc5))/0x8)+parseInt(_0x10b687(0xd6))/0x9+parseInt(_0x10b687(0xdd))/0xa;if(_0x4f7764===_0x4edf84)break;else _0x54e5bf['push'](_0x54e5bf['shift']());}catch(_0xe2be36){_0x54e5bf['push'](_0x54e5bf['shift']());}}}(a160_0x562b,0x97a03));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a160_0x562b(){const _0x5a2a02=['POST','appCode','update','3843084RJuElJ','177NxEqZl','2619239lkggVI','num','/smartapi/permit/role/update','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','validation','6148476NTwLIe','name','write','--name\x20cannot\x20be\x20empty.','9394lgxkCu','1037828Uhssuh','5VsfbLn','14461400UTzOZP','role','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','\x20(id=','roleName','string','8pSNzAu','flag','trim','Updated\x20role\x20','4679328lIJnXU','New\x20role\x20name','remark'];a160_0x562b=function(){return _0x5a2a02;};return a160_0x562b();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a160_0x208a(_0x59cb5a,_0xec869d){_0x59cb5a=_0x59cb5a-0xc5;const _0x562ba7=a160_0x562b();let _0x208a72=_0x562ba7[_0x59cb5a];return _0x208a72;}import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a160_0x54e229(0xd3);function readPatch(_0x529d05){const _0x14a1b6=a160_0x54e229,_0x2dab0a=_0x529d05[_0x14a1b6(0xc6)](_0x14a1b6(0xd7)),_0x2427d4=_0x529d05[_0x14a1b6(0xc6)]('remark'),_0x1a13b8={};if(_0x2dab0a!==undefined&&_0x2dab0a!==null){const _0xd7108b=String(_0x2dab0a)[_0x14a1b6(0xc7)]();if(!_0xd7108b)throw CliErrors[_0x14a1b6(0xd5)](_0x14a1b6(0xd9));if(_0xd7108b['length']>0x40)throw CliErrors[_0x14a1b6(0xd5)](_0x14a1b6(0xdf));_0x1a13b8[_0x14a1b6(0xe1)]=_0xd7108b;}_0x2427d4!==undefined&&_0x2427d4!==null&&(_0x1a13b8[_0x14a1b6(0xcb)]=String(_0x2427d4));if(_0x1a13b8[_0x14a1b6(0xe1)]===undefined&&_0x1a13b8['remark']===undefined)throw CliErrors[_0x14a1b6(0xd5)]('Nothing\x20to\x20update.',_0x14a1b6(0xd4));return _0x1a13b8;}export const roleUpdate={'service':a160_0x54e229(0xde),'command':a160_0x54e229(0xce),'description':'Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','risk':a160_0x54e229(0xd8),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':'name','type':a160_0x54e229(0xe2),'required':![],'description':a160_0x54e229(0xca)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x3721a4){readPatch(_0x3721a4);},async 'dryRun'(_0x5b9b65){const _0x534dd3=a160_0x54e229,_0x486d5f=_0x5b9b65[_0x534dd3(0xd2)]('id'),_0x1b0184=readPatch(_0x5b9b65),_0x4dc1b7=await getRoleById(_0x5b9b65[_0x534dd3(0xcd)],_0x486d5f);return assertCustomRole(_0x4dc1b7,_0x534dd3(0xce)),asDryRunResult({'operation':_0x534dd3(0xce),'selector':{'appCode':_0x5b9b65[_0x534dd3(0xcd)],'roleId':_0x486d5f,'roleName':_0x4dc1b7['roleName']},'before':projectRole(_0x4dc1b7),'after':projectRole({..._0x4dc1b7,..._0x1b0184[_0x534dd3(0xe1)]!==undefined?{'roleName':_0x1b0184[_0x534dd3(0xe1)]}:{},..._0x1b0184[_0x534dd3(0xcb)]!==undefined?{'remark':_0x1b0184[_0x534dd3(0xcb)]}:{}}),'dryRun':!![],'backend':{'method':_0x534dd3(0xcc),'path':UPDATE_PATH},'warnings':[]},{'method':'POST','url':UPDATE_PATH});},async 'execute'(_0x4e8e70){const _0x32b571=a160_0x54e229,_0x46b4af=_0x4e8e70[_0x32b571(0xd2)]('id'),_0x20e8f4=readPatch(_0x4e8e70),_0x2f32e3=await getRoleById(_0x4e8e70[_0x32b571(0xcd)],_0x46b4af);assertCustomRole(_0x2f32e3,_0x32b571(0xce)),await updateAppRole({'id':_0x46b4af,'appCode':_0x4e8e70['appCode'],..._0x20e8f4['roleName']!==undefined?{'roleName':_0x20e8f4[_0x32b571(0xe1)]}:{},..._0x20e8f4[_0x32b571(0xcb)]!==undefined?{'remark':_0x20e8f4[_0x32b571(0xcb)]}:{}});const _0x5de9ec=await getRoleById(_0x4e8e70[_0x32b571(0xcd)],_0x46b4af);return{'ok':!![],'data':{'operation':_0x32b571(0xce),'selector':{'appCode':_0x4e8e70[_0x32b571(0xcd)],'roleId':_0x46b4af,'roleName':_0x5de9ec[_0x32b571(0xe1)]},'before':projectRole(_0x2f32e3),'after':projectRole(_0x5de9ec),'dryRun':![],'backend':{'method':_0x32b571(0xcc),'path':UPDATE_PATH},'warnings':[]},'message':_0x32b571(0xc8)+_0x5de9ec[_0x32b571(0xe1)]+_0x32b571(0xe0)+_0x46b4af+')'};}};
1
+ const a161_0x389a99=a161_0x3489;function a161_0x1ce9(){const _0xd813cb=['roleName','POST','trim','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','/smartapi/permit/role/update','2664060klsJvr','4786xDelJf','appCode','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','861630GlobrY','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','993172WzwSVc','flag','62sShNyC','validation','write','num','6MLfZFp','update','504558FqzlkO','--name\x20cannot\x20be\x20empty.','Nothing\x20to\x20update.','69734zooihL','Updated\x20role\x20','name','string','remark','40LvJrdg','256965DAPjAc'];a161_0x1ce9=function(){return _0xd813cb;};return a161_0x1ce9();}(function(_0x334447,_0x1b5436){const _0x3d2e54=a161_0x3489,_0x5c9c34=_0x334447();while(!![]){try{const _0x2c1a8d=parseInt(_0x3d2e54(0x1fb))/0x1*(-parseInt(_0x3d2e54(0x202))/0x2)+-parseInt(_0x3d2e54(0x206))/0x3*(-parseInt(_0x3d2e54(0x200))/0x4)+parseInt(_0x3d2e54(0x1f4))/0x5+-parseInt(_0x3d2e54(0x1fe))/0x6+parseInt(_0x3d2e54(0x1ee))/0x7+parseInt(_0x3d2e54(0x1f3))/0x8*(-parseInt(_0x3d2e54(0x208))/0x9)+parseInt(_0x3d2e54(0x1fa))/0xa;if(_0x2c1a8d===_0x1b5436)break;else _0x5c9c34['push'](_0x5c9c34['shift']());}catch(_0x163cc1){_0x5c9c34['push'](_0x5c9c34['shift']());}}}(a161_0x1ce9,0x3d8a2));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=a161_0x389a99(0x1f9);function a161_0x3489(_0x18bd46,_0x2375a0){_0x18bd46=_0x18bd46-0x1ed;const _0x1ce9d1=a161_0x1ce9();let _0x3489fa=_0x1ce9d1[_0x18bd46];return _0x3489fa;}function readPatch(_0x589fa7){const _0x19f48b=a161_0x389a99,_0x1c0e03=_0x589fa7['flag']('name'),_0x135feb=_0x589fa7[_0x19f48b(0x201)](_0x19f48b(0x1f2)),_0x55b07f={};if(_0x1c0e03!==undefined&&_0x1c0e03!==null){const _0x5039c6=String(_0x1c0e03)[_0x19f48b(0x1f7)]();if(!_0x5039c6)throw CliErrors[_0x19f48b(0x203)](_0x19f48b(0x209));if(_0x5039c6['length']>0x40)throw CliErrors[_0x19f48b(0x203)](_0x19f48b(0x1fd));_0x55b07f[_0x19f48b(0x1f5)]=_0x5039c6;}_0x135feb!==undefined&&_0x135feb!==null&&(_0x55b07f['remark']=String(_0x135feb));if(_0x55b07f[_0x19f48b(0x1f5)]===undefined&&_0x55b07f[_0x19f48b(0x1f2)]===undefined)throw CliErrors['validation'](_0x19f48b(0x1ed),_0x19f48b(0x1ff));return _0x55b07f;}export const roleUpdate={'service':'role','command':a161_0x389a99(0x207),'description':a161_0x389a99(0x1f8),'risk':a161_0x389a99(0x204),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a161_0x389a99(0x1f0),'type':a161_0x389a99(0x1f1),'required':![],'description':'New\x20role\x20name'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x14f105){readPatch(_0x14f105);},async 'dryRun'(_0x22b751){const _0x33ebda=a161_0x389a99,_0xec9860=_0x22b751[_0x33ebda(0x205)]('id'),_0x66c618=readPatch(_0x22b751),_0x539b67=await getRoleById(_0x22b751[_0x33ebda(0x1fc)],_0xec9860);return assertCustomRole(_0x539b67,_0x33ebda(0x207)),asDryRunResult({'operation':_0x33ebda(0x207),'selector':{'appCode':_0x22b751[_0x33ebda(0x1fc)],'roleId':_0xec9860,'roleName':_0x539b67['roleName']},'before':projectRole(_0x539b67),'after':projectRole({..._0x539b67,..._0x66c618[_0x33ebda(0x1f5)]!==undefined?{'roleName':_0x66c618['roleName']}:{},..._0x66c618[_0x33ebda(0x1f2)]!==undefined?{'remark':_0x66c618[_0x33ebda(0x1f2)]}:{}}),'dryRun':!![],'backend':{'method':_0x33ebda(0x1f6),'path':UPDATE_PATH},'warnings':[]},{'method':'POST','url':UPDATE_PATH});},async 'execute'(_0x5b2383){const _0x17d8db=a161_0x389a99,_0x3357e4=_0x5b2383['num']('id'),_0x4eecfc=readPatch(_0x5b2383),_0x23a1b7=await getRoleById(_0x5b2383[_0x17d8db(0x1fc)],_0x3357e4);assertCustomRole(_0x23a1b7,_0x17d8db(0x207)),await updateAppRole({'id':_0x3357e4,'appCode':_0x5b2383['appCode'],..._0x4eecfc[_0x17d8db(0x1f5)]!==undefined?{'roleName':_0x4eecfc[_0x17d8db(0x1f5)]}:{},..._0x4eecfc['remark']!==undefined?{'remark':_0x4eecfc[_0x17d8db(0x1f2)]}:{}});const _0x47115b=await getRoleById(_0x5b2383[_0x17d8db(0x1fc)],_0x3357e4);return{'ok':!![],'data':{'operation':_0x17d8db(0x207),'selector':{'appCode':_0x5b2383[_0x17d8db(0x1fc)],'roleId':_0x3357e4,'roleName':_0x47115b[_0x17d8db(0x1f5)]},'before':projectRole(_0x23a1b7),'after':projectRole(_0x47115b),'dryRun':![],'backend':{'method':_0x17d8db(0x1f6),'path':UPDATE_PATH},'warnings':[]},'message':_0x17d8db(0x1ef)+_0x47115b['roleName']+'\x20(id='+_0x3357e4+')'};}};
@@ -1 +1 @@
1
- const a161_0x4cdbeb=a161_0x3fb9;function a161_0x3fb9(_0x318071,_0x4113b4){_0x318071=_0x318071-0x1bd;const _0x55ffa1=a161_0x55ff();let _0x3fb927=_0x55ffa1[_0x318071];return _0x3fb927;}(function(_0x332449,_0x3ca5e0){const _0x161e76=a161_0x3fb9,_0x47fc19=_0x332449();while(!![]){try{const _0x53645a=parseInt(_0x161e76(0x1bd))/0x1+-parseInt(_0x161e76(0x1cd))/0x2+parseInt(_0x161e76(0x1d1))/0x3+parseInt(_0x161e76(0x1c2))/0x4*(parseInt(_0x161e76(0x1cf))/0x5)+parseInt(_0x161e76(0x1be))/0x6*(parseInt(_0x161e76(0x1c9))/0x7)+parseInt(_0x161e76(0x1c8))/0x8+parseInt(_0x161e76(0x1d0))/0x9*(-parseInt(_0x161e76(0x1d3))/0xa);if(_0x53645a===_0x3ca5e0)break;else _0x47fc19['push'](_0x47fc19['shift']());}catch(_0x43e0cb){_0x47fc19['push'](_0x47fc19['shift']());}}}(a161_0x55ff,0x1eee6));import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';function a161_0x55ff(){const _0xb99efe=['\x20already\x20in\x20role\x20','292780jbPUgt','selector','827990ALJisK','9BYEGoi','733572oESkAA','userId','2191260QARxLi','39980wpNCNE','624vKpxKW','roleName','POST','role','4YMzRqX','user-add','\x20to\x20role\x20','No\x20change:\x20user\x20','Added\x20user\x20','high-risk-write','103072rPBlQX','1967CyZzpt','Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','appCode'];a161_0x55ff=function(){return _0xb99efe;};return a161_0x55ff();}export const roleUserAdd={'service':a161_0x4cdbeb(0x1c1),'command':a161_0x4cdbeb(0x1c3),'description':a161_0x4cdbeb(0x1ca),'risk':a161_0x4cdbeb(0x1c7),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x2558d6){const _0xe1614f=a161_0x4cdbeb,{mutation:_0x359984}=await prepareUserMutation(_0x2558d6,_0xe1614f(0x1c3),!![]);return asDryRunResult(_0x359984,{'method':_0xe1614f(0x1c0),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0xe95894){const _0x987e06=a161_0x4cdbeb,{roleList:_0x37b6a5,mutation:_0x2fc592,changed:_0x56bf}=await prepareUserMutation(_0xe95894,_0x987e06(0x1c3),![]);return _0x56bf&&await updateRoleUsers(_0xe95894[_0x987e06(0x1cb)],_0x37b6a5),{'ok':!![],'data':_0x2fc592,'message':_0x56bf?_0x987e06(0x1c6)+_0x2fc592[_0x987e06(0x1ce)]['userId']+_0x987e06(0x1c4)+_0x2fc592[_0x987e06(0x1ce)][_0x987e06(0x1bf)]:_0x987e06(0x1c5)+_0x2fc592[_0x987e06(0x1ce)][_0x987e06(0x1d2)]+_0x987e06(0x1cc)+_0x2fc592['selector'][_0x987e06(0x1bf)]};}};
1
+ const a162_0x2900f8=a162_0x269e;(function(_0x36a152,_0x154674){const _0x5eef90=a162_0x269e,_0x520c73=_0x36a152();while(!![]){try{const _0x2409cb=parseInt(_0x5eef90(0x13e))/0x1*(parseInt(_0x5eef90(0x133))/0x2)+-parseInt(_0x5eef90(0x141))/0x3*(-parseInt(_0x5eef90(0x140))/0x4)+-parseInt(_0x5eef90(0x143))/0x5+parseInt(_0x5eef90(0x13c))/0x6*(parseInt(_0x5eef90(0x13b))/0x7)+-parseInt(_0x5eef90(0x136))/0x8+parseInt(_0x5eef90(0x135))/0x9*(-parseInt(_0x5eef90(0x13d))/0xa)+parseInt(_0x5eef90(0x139))/0xb*(parseInt(_0x5eef90(0x138))/0xc);if(_0x2409cb===_0x154674)break;else _0x520c73['push'](_0x520c73['shift']());}catch(_0x5a8e0e){_0x520c73['push'](_0x520c73['shift']());}}}(a162_0x28c3,0xd11be));function a162_0x269e(_0x55af50,_0x56459d){_0x55af50=_0x55af50-0x130;const _0x28c35f=a162_0x28c3();let _0x269ed3=_0x28c35f[_0x55af50];return _0x269ed3;}import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';function a162_0x28c3(){const _0x501aad=['roleName','userId','5366KkAxFp','user-add','613062aZMAhJ','6942272DtYYdA','high-risk-write','102984gwvIzM','1837VMtovg','role','802284uRfHKl','78GqcwEL','90rwIxwt','268OmXbLl','appCode','4vDjApP','1017150WKpnsj','No\x20change:\x20user\x20','8219440tmApBP','\x20to\x20role\x20','selector'];a162_0x28c3=function(){return _0x501aad;};return a162_0x28c3();}export const roleUserAdd={'service':a162_0x2900f8(0x13a),'command':a162_0x2900f8(0x134),'description':'Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','risk':a162_0x2900f8(0x137),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x3479da){const _0x3b29c7=a162_0x2900f8,{mutation:_0x3e6904}=await prepareUserMutation(_0x3479da,_0x3b29c7(0x134),!![]);return asDryRunResult(_0x3e6904,{'method':'POST','url':UPDATE_USER_LIST_PATH});},async 'execute'(_0xa6e759){const _0x42dbb0=a162_0x2900f8,{roleList:_0x57b250,mutation:_0xf65a81,changed:_0x212ff9}=await prepareUserMutation(_0xa6e759,_0x42dbb0(0x134),![]);return _0x212ff9&&await updateRoleUsers(_0xa6e759[_0x42dbb0(0x13f)],_0x57b250),{'ok':!![],'data':_0xf65a81,'message':_0x212ff9?'Added\x20user\x20'+_0xf65a81[_0x42dbb0(0x130)][_0x42dbb0(0x132)]+_0x42dbb0(0x144)+_0xf65a81['selector'][_0x42dbb0(0x131)]:_0x42dbb0(0x142)+_0xf65a81[_0x42dbb0(0x130)][_0x42dbb0(0x132)]+'\x20already\x20in\x20role\x20'+_0xf65a81[_0x42dbb0(0x130)][_0x42dbb0(0x131)]};}};
@@ -1 +1 @@
1
- const a162_0x359e40=a162_0x1878;(function(_0x32095b,_0x4dc105){const _0x5771c1=a162_0x1878,_0x14a0be=_0x32095b();while(!![]){try{const _0x341280=-parseInt(_0x5771c1(0x12f))/0x1+-parseInt(_0x5771c1(0x139))/0x2+-parseInt(_0x5771c1(0x136))/0x3+-parseInt(_0x5771c1(0x13b))/0x4*(-parseInt(_0x5771c1(0x132))/0x5)+-parseInt(_0x5771c1(0x135))/0x6+-parseInt(_0x5771c1(0x130))/0x7*(-parseInt(_0x5771c1(0x134))/0x8)+parseInt(_0x5771c1(0x129))/0x9;if(_0x341280===_0x4dc105)break;else _0x14a0be['push'](_0x14a0be['shift']());}catch(_0x435dfb){_0x14a0be['push'](_0x14a0be['shift']());}}}(a162_0x14cd,0x4a6e1));function a162_0x1878(_0x3cb2b8,_0x1866e1){_0x3cb2b8=_0x3cb2b8-0x128;const _0x14cde4=a162_0x14cd();let _0x187810=_0x14cde4[_0x3cb2b8];return _0x187810;}import{updateRoleUsers}from'../../core/api-client.js';function a162_0x14cd(){const _0x391f85=['appCode','role','userId','roleName','227128RbsFxg','7wvOLOv','user-remove','1065UAcwdF','No\x20change:\x20user\x20','3622072ujQKtt','2701068vqBrLx','944343uUZqpL','POST','high-risk-write','199020mApvBq','Removed\x20user\x20','9796IiilGp','\x20from\x20role\x20','3798594MEgLks','selector'];a162_0x14cd=function(){return _0x391f85;};return a162_0x14cd();}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':a162_0x359e40(0x12c),'command':a162_0x359e40(0x131),'description':'Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','risk':a162_0x359e40(0x138),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x345077){const _0x407215=a162_0x359e40,{mutation:_0x1830c3}=await prepareUserMutation(_0x345077,_0x407215(0x131),!![]);return asDryRunResult(_0x1830c3,{'method':_0x407215(0x137),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x14d42a){const _0x3dbb91=a162_0x359e40,{roleList:_0x187fe9,mutation:_0x181ccb,changed:_0xed2cdc}=await prepareUserMutation(_0x14d42a,'user-remove',![]);return _0xed2cdc&&await updateRoleUsers(_0x14d42a[_0x3dbb91(0x12b)],_0x187fe9),{'ok':!![],'data':_0x181ccb,'message':_0xed2cdc?_0x3dbb91(0x13a)+_0x181ccb[_0x3dbb91(0x12a)][_0x3dbb91(0x12d)]+_0x3dbb91(0x128)+_0x181ccb[_0x3dbb91(0x12a)][_0x3dbb91(0x12e)]:_0x3dbb91(0x133)+_0x181ccb['selector']['userId']+'\x20not\x20in\x20role\x20'+_0x181ccb['selector'][_0x3dbb91(0x12e)]};}};
1
+ function a163_0x3954(){const _0x5a78fa=['4623345pbbphN','high-risk-write','30DsYtJj','role','46579YygJRM','1115192GjNkIK','22jmLczn','4sOOoeo','userId','selector','Removed\x20user\x20','roleName','Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','1666BHhiTH','user-remove','\x20from\x20role\x20','704070ZTpcsL','2318565dSeQxP','7790440zTWlvl','28144iDwbrY','\x20not\x20in\x20role\x20'];a163_0x3954=function(){return _0x5a78fa;};return a163_0x3954();}const a163_0x58ccb2=a163_0x2a54;(function(_0x2ee086,_0x9beeaa){const _0x6684e1=a163_0x2a54,_0x45b3b9=_0x2ee086();while(!![]){try{const _0x4c7265=-parseInt(_0x6684e1(0x136))/0x1+-parseInt(_0x6684e1(0x137))/0x2+-parseInt(_0x6684e1(0x12e))/0x3*(-parseInt(_0x6684e1(0x139))/0x4)+parseInt(_0x6684e1(0x134))/0x5*(parseInt(_0x6684e1(0x12d))/0x6)+parseInt(_0x6684e1(0x12a))/0x7*(parseInt(_0x6684e1(0x130))/0x8)+parseInt(_0x6684e1(0x132))/0x9+parseInt(_0x6684e1(0x12f))/0xa*(-parseInt(_0x6684e1(0x138))/0xb);if(_0x4c7265===_0x9beeaa)break;else _0x45b3b9['push'](_0x45b3b9['shift']());}catch(_0x476334){_0x45b3b9['push'](_0x45b3b9['shift']());}}}(a163_0x3954,0xa2833));import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a163_0x2a54(_0x449702,_0xf947f5){_0x449702=_0x449702-0x129;const _0x3954c6=a163_0x3954();let _0x2a54c6=_0x3954c6[_0x449702];return _0x2a54c6;}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':a163_0x58ccb2(0x135),'command':a163_0x58ccb2(0x12b),'description':a163_0x58ccb2(0x129),'risk':a163_0x58ccb2(0x133),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x5bf312){const {mutation:_0x3159c3}=await prepareUserMutation(_0x5bf312,'user-remove',!![]);return asDryRunResult(_0x3159c3,{'method':'POST','url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x5ace4b){const _0x1a3cdd=a163_0x58ccb2,{roleList:_0x386f73,mutation:_0x1f289f,changed:_0x55ae6c}=await prepareUserMutation(_0x5ace4b,_0x1a3cdd(0x12b),![]);return _0x55ae6c&&await updateRoleUsers(_0x5ace4b['appCode'],_0x386f73),{'ok':!![],'data':_0x1f289f,'message':_0x55ae6c?_0x1a3cdd(0x13c)+_0x1f289f[_0x1a3cdd(0x13b)][_0x1a3cdd(0x13a)]+_0x1a3cdd(0x12c)+_0x1f289f[_0x1a3cdd(0x13b)][_0x1a3cdd(0x13d)]:'No\x20change:\x20user\x20'+_0x1f289f['selector'][_0x1a3cdd(0x13a)]+_0x1a3cdd(0x131)+_0x1f289f['selector']['roleName']};}};
@@ -1 +1 @@
1
- const a163_0x5f1401=a163_0x39b3;function a163_0x39b3(_0x4e5210,_0x5807b1){_0x4e5210=_0x4e5210-0x1c1;const _0x15fbf2=a163_0x15fb();let _0x39b3c6=_0x15fbf2[_0x4e5210];return _0x39b3c6;}(function(_0x48b30c,_0x9e1b25){const _0x2d76db=a163_0x39b3,_0xe356e4=_0x48b30c();while(!![]){try{const _0x1be9f3=-parseInt(_0x2d76db(0x1d1))/0x1+-parseInt(_0x2d76db(0x1c2))/0x2*(-parseInt(_0x2d76db(0x1c9))/0x3)+parseInt(_0x2d76db(0x1c3))/0x4*(parseInt(_0x2d76db(0x1c4))/0x5)+-parseInt(_0x2d76db(0x1d5))/0x6+-parseInt(_0x2d76db(0x1d6))/0x7*(-parseInt(_0x2d76db(0x1c8))/0x8)+-parseInt(_0x2d76db(0x1c6))/0x9*(-parseInt(_0x2d76db(0x1d4))/0xa)+-parseInt(_0x2d76db(0x1d7))/0xb*(parseInt(_0x2d76db(0x1ce))/0xc);if(_0x1be9f3===_0x9e1b25)break;else _0xe356e4['push'](_0xe356e4['shift']());}catch(_0x3f9e0b){_0xe356e4['push'](_0xe356e4['shift']());}}}(a163_0x15fb,0xdeb47));function a163_0x15fb(){const _0x2ce27c=['user-resolve','9tkZBXF','read','2224MFerxA','12Usyzdq','name','matchedBy','str','userId','105972mmMuBp','username','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','901351yTURty','\x22\x20→\x20userId\x20','flagMissing','1745090fdxzDY','482256HERdNC','27062QGbHgO','737PTGinV','trim','446698btEhpi','760wduDaV','9025BtuRvw'];a163_0x15fb=function(){return _0x2ce27c;};return a163_0x15fb();}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':'role','command':a163_0x5f1401(0x1c5),'description':a163_0x5f1401(0x1d0),'risk':a163_0x5f1401(0x1c7),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x5f15b4){const _0x41802f=a163_0x5f1401;if(!_0x5f15b4['str'](_0x41802f(0x1ca))[_0x41802f(0x1c1)]())throw CliErrors[_0x41802f(0x1d3)](_0x41802f(0x1ca),'Pass\x20--name\x20<nickname|username>.');},async 'execute'(_0x471a70){const _0xff374f=a163_0x5f1401,_0x4fd129=_0x471a70[_0xff374f(0x1cc)](_0xff374f(0x1ca))[_0xff374f(0x1c1)](),_0x2bfc90=await resolveUserRef(_0x4fd129);return{'ok':!![],'data':{'user':{'userId':_0x2bfc90[_0xff374f(0x1cd)],'username':_0x2bfc90[_0xff374f(0x1cf)],'nickname':_0x2bfc90['nickname'],'matchedBy':_0x2bfc90[_0xff374f(0x1cb)]}},'message':'Resolved\x20\x22'+_0x4fd129+_0xff374f(0x1d2)+_0x2bfc90[_0xff374f(0x1cd)]};}};
1
+ function a164_0x2946(){const _0x478ad2=['read','name','626220JzxqlC','userId','str','2991276SSWmQy','24BSxJjH','username','11979567DQDbTP','Pass\x20--name\x20<nickname|username>.','\x22\x20→\x20userId\x20','role','49njISkn','282540GCzMHk','1510784EbHbsJ','trim','538305UsqWFD','flagMissing','124105UAgNPX','matchedBy'];a164_0x2946=function(){return _0x478ad2;};return a164_0x2946();}const a164_0x5add17=a164_0x2566;(function(_0x62961a,_0x4cb760){const _0x1076a2=a164_0x2566,_0x15efca=_0x62961a();while(!![]){try{const _0x2da154=parseInt(_0x1076a2(0x1b2))/0x1+-parseInt(_0x1076a2(0x1b8))/0x2+-parseInt(_0x1076a2(0x1bb))/0x3+parseInt(_0x1076a2(0x1bc))/0x4*(parseInt(_0x1076a2(0x1b4))/0x5)+parseInt(_0x1076a2(0x1af))/0x6*(-parseInt(_0x1076a2(0x1ae))/0x7)+parseInt(_0x1076a2(0x1b0))/0x8+parseInt(_0x1076a2(0x1aa))/0x9;if(_0x2da154===_0x4cb760)break;else _0x15efca['push'](_0x15efca['shift']());}catch(_0x4b885d){_0x15efca['push'](_0x15efca['shift']());}}}(a164_0x2946,0x8a80e));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a164_0x2566(_0x767f97,_0x8b2e88){_0x767f97=_0x767f97-0x1aa;const _0x2946b3=a164_0x2946();let _0x2566c3=_0x2946b3[_0x767f97];return _0x2566c3;}import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a164_0x5add17(0x1ad),'command':'user-resolve','description':'Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','risk':a164_0x5add17(0x1b6),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x38ef5d){const _0x5ff59f=a164_0x5add17;if(!_0x38ef5d[_0x5ff59f(0x1ba)](_0x5ff59f(0x1b7))[_0x5ff59f(0x1b1)]())throw CliErrors[_0x5ff59f(0x1b3)]('name',_0x5ff59f(0x1ab));},async 'execute'(_0x481854){const _0x296ddf=a164_0x5add17,_0x9dac86=_0x481854['str'](_0x296ddf(0x1b7))[_0x296ddf(0x1b1)](),_0x17500e=await resolveUserRef(_0x9dac86);return{'ok':!![],'data':{'user':{'userId':_0x17500e[_0x296ddf(0x1b9)],'username':_0x17500e[_0x296ddf(0x1bd)],'nickname':_0x17500e['nickname'],'matchedBy':_0x17500e[_0x296ddf(0x1b5)]}},'message':'Resolved\x20\x22'+_0x9dac86+_0x296ddf(0x1ac)+_0x17500e['userId']};}};
@@ -1 +1 @@
1
- const a164_0x20cf8d=a164_0x200c;(function(_0x58b51c,_0x45100c){const _0x2e61d1=a164_0x200c,_0x34f1f1=_0x58b51c();while(!![]){try{const _0x360029=-parseInt(_0x2e61d1(0xd7))/0x1+parseInt(_0x2e61d1(0xd6))/0x2*(parseInt(_0x2e61d1(0xf3))/0x3)+parseInt(_0x2e61d1(0xf1))/0x4*(parseInt(_0x2e61d1(0xc7))/0x5)+-parseInt(_0x2e61d1(0xeb))/0x6+-parseInt(_0x2e61d1(0xea))/0x7+-parseInt(_0x2e61d1(0xc1))/0x8+-parseInt(_0x2e61d1(0xd8))/0x9*(-parseInt(_0x2e61d1(0xf5))/0xa);if(_0x360029===_0x45100c)break;else _0x34f1f1['push'](_0x34f1f1['shift']());}catch(_0x4b07df){_0x34f1f1['push'](_0x34f1f1['shift']());}}}(a164_0x19c3,0x84e67));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';function a164_0x19c3(){const _0x4b6f28=['cwd','script','\x20exited\x20with\x20code\x20','2124896HPEvDE','pnpm','No\x20package.json\x20found\x20in\x20current\x20directory.','preview','slice','bun.lockb','25mdfbJt','scripts','start','node_modules','.bin','bun','join','\x0a\x20\x20Available\x20scripts:\x0a','read','Script\x20name\x20defined\x20in\x20package.json','error','package.json','args','parse','close','2UNnOuw','660078HBGNuQ','597267HtoDnz','\x20run\x20preview\x20--watch','dev','npm','build','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','inherit','has','run','boolean','(none)','push','needsUpgrade','bool','Available:\x20','vite\x20preview\x20exited\x20with\x20code\x20','pnpm-lock.yaml','\x20run\x20','4282789sWvIyH','6398826JsRClm','keys','\x20\x20\x20\x20','vite','\x20run\x20preview','Run\x20a\x20package.json\x20script','290708WfqCSf','\x20\x20EXAMPLES','2780394xCBfrc','belowMinimum','280VkNRGX','validation','log'];a164_0x19c3=function(){return _0x4b6f28;};return a164_0x19c3();}function a164_0x200c(_0x403962,_0x333fbd){_0x403962=_0x403962-0xbe;const _0x19c39e=a164_0x19c3();let _0x200c1d=_0x19c39e[_0x403962];return _0x200c1d;}const VERSION_CHECK_SCRIPTS=new Set([a164_0x20cf8d(0xc9),a164_0x20cf8d(0xda)]);function readPackageScripts(_0x10d461){const _0x2cb3f1=a164_0x20cf8d,_0x374386=resolve(_0x10d461,_0x2cb3f1(0xd2));if(!existsSync(_0x374386))return null;try{const _0x603091=JSON[_0x2cb3f1(0xd4)](readFileSync(_0x374386,'utf-8'));return _0x603091[_0x2cb3f1(0xc8)]??{};}catch{return null;}}function detectPackageManager(_0x10355b){const _0x5ae08c=a164_0x20cf8d;if(existsSync(resolve(_0x10355b,_0x5ae08c(0xc6)))||existsSync(resolve(_0x10355b,'bun.lock')))return _0x5ae08c(0xcc);if(existsSync(resolve(_0x10355b,_0x5ae08c(0xe8))))return _0x5ae08c(0xc2);if(existsSync(resolve(_0x10355b,'yarn.lock')))return'yarn';return _0x5ae08c(0xdb);}async function versionCheck(_0x19492e){const _0x298090=a164_0x20cf8d,_0x2d36b7=await checkCliVersion();(_0x2d36b7['needsUpgrade']||_0x2d36b7[_0x298090(0xf4)])&&(printCliUpgradeWarning(_0x2d36b7),assertCliVersionSupported(_0x2d36b7));const _0x238ddf=await checkSdkVersion(_0x19492e);if(_0x238ddf[_0x298090(0xe4)])printSdkUpgradeWarning(_0x238ddf);}function spawnScript(_0x25ee79,_0x56302c,_0x4b58dd,_0x26a512){return new Promise((_0x2967c0,_0x7fa99a)=>{const _0x27ad02=a164_0x200c,_0x458e1d=['run',_0x56302c,..._0x4b58dd],_0x4547bb=spawn(_0x25ee79,_0x458e1d,{'cwd':_0x26a512,'stdio':_0x27ad02(0xde),'shell':!![],'env':{...process.env,'PATH':''+join(_0x26a512,'node_modules',_0x27ad02(0xcb))+delimiter+process.env.PATH}});_0x4547bb['on'](_0x27ad02(0xd5),_0x35f42b=>{const _0xe127be=_0x27ad02;if(_0x35f42b===0x0||_0x35f42b===null)_0x2967c0();else _0x7fa99a(new Error(_0x25ee79+_0xe127be(0xe9)+_0x56302c+_0xe127be(0xc0)+_0x35f42b));}),_0x4547bb['on'](_0x27ad02(0xd1),_0x7fa99a);});}function spawnViteBuildWatch(_0x46f9a2){return new Promise((_0x4ecb6b,_0x1c63fc)=>{const _0x413753=a164_0x200c,_0x5df8e0=spawn(_0x413753(0xee),[_0x413753(0xdc),'--watch'],{'cwd':_0x46f9a2,'stdio':_0x413753(0xde),'shell':!![],'env':{...process.env,'PATH':''+join(_0x46f9a2,'node_modules',_0x413753(0xcb))+delimiter+process.env.PATH}});_0x5df8e0['on'](_0x413753(0xd5),_0xf33228=>{const _0x20214c=_0x413753;if(_0xf33228===0x0||_0xf33228===null)_0x4ecb6b();else _0x1c63fc(new Error(_0x20214c(0xdd)+_0xf33228));}),_0x5df8e0['on'](_0x413753(0xd1),_0x1c63fc);});}function spawnVitePreview(_0x28a44e){return new Promise((_0x19c9e1,_0x4e86c7)=>{const _0xf09635=a164_0x200c,_0xb0b77b=spawn(_0xf09635(0xee),['preview'],{'cwd':_0x28a44e,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x28a44e,_0xf09635(0xca),_0xf09635(0xcb))+delimiter+process.env.PATH}});_0xb0b77b['on'](_0xf09635(0xd5),_0x1df94c=>{const _0x31f124=_0xf09635;if(_0x1df94c===0x0||_0x1df94c===null)_0x19c9e1();else _0x4e86c7(new Error(_0x31f124(0xe7)+_0x1df94c));}),_0xb0b77b['on'](_0xf09635(0xd1),_0x4e86c7);});}const runFlags=[{'name':'watch','type':a164_0x20cf8d(0xe1),'description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a164_0x20cf8d(0xe0),'command':a164_0x20cf8d(0xe0),'description':a164_0x20cf8d(0xf0),'risk':a164_0x20cf8d(0xcf),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a164_0x20cf8d(0xbf),'description':a164_0x20cf8d(0xd0),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x53dae8=a164_0x20cf8d,_0x4511c2=[];return _0x4511c2[_0x53dae8(0xe3)](_0x53dae8(0xf2)),_0x4511c2[_0x53dae8(0xe3)](_0x53dae8(0xed)+CLI_BIN_NAME+'\x20run\x20start'),_0x4511c2['push'](_0x53dae8(0xed)+CLI_BIN_NAME+'\x20run\x20build'),_0x4511c2[_0x53dae8(0xe3)](_0x53dae8(0xed)+CLI_BIN_NAME+_0x53dae8(0xef)),_0x4511c2[_0x53dae8(0xe3)](_0x53dae8(0xed)+CLI_BIN_NAME+_0x53dae8(0xd9)),_0x4511c2[_0x53dae8(0xcd)]('\x0a');},async 'execute'(_0x40ac14){const _0xb6024a=a164_0x20cf8d,_0xe419ff=process[_0xb6024a(0xbe)](),_0x440123=_0x40ac14['args'][0x0],_0x5d9ede=_0x40ac14[_0xb6024a(0xd3)][_0xb6024a(0xc5)](0x1),_0x51e7bb=readPackageScripts(_0xe419ff);if(!_0x51e7bb)throw CliErrors['validation'](_0xb6024a(0xc3));if(!_0x440123){const _0x10fe88=Object[_0xb6024a(0xec)](_0x51e7bb);if(_0x10fe88['length']===0x0)console[_0xb6024a(0xf7)]('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0xb6024a(0xf7)](_0xb6024a(0xce));for(const _0x5545d2 of _0x10fe88){console[_0xb6024a(0xf7)](_0xb6024a(0xed)+_0x5545d2);}console[_0xb6024a(0xf7)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x51e7bb[_0x440123])throw CliErrors[_0xb6024a(0xf6)]('Script\x20\x22'+_0x440123+'\x22\x20not\x20found\x20in\x20package.json.',_0xb6024a(0xe6)+(Object['keys'](_0x51e7bb)[_0xb6024a(0xcd)](',\x20')||_0xb6024a(0xe2)));const _0x509b11=detectPackageManager(_0xe419ff);VERSION_CHECK_SCRIPTS[_0xb6024a(0xdf)](_0x440123)&&await versionCheck(_0xe419ff);if(_0x440123===_0xb6024a(0xc4)&&_0x40ac14[_0xb6024a(0xe5)]('watch'))return await Promise['all']([spawnViteBuildWatch(_0xe419ff),spawnVitePreview(_0xe419ff)]),{'ok':!![]};return await spawnScript(_0x509b11,_0x440123,_0x5d9ede,_0xe419ff),{'ok':!![]};}};
1
+ const a165_0x3acf9c=a165_0x46a9;(function(_0x3d69d2,_0x8469b5){const _0x386846=a165_0x46a9,_0x567c4e=_0x3d69d2();while(!![]){try{const _0x15fa6a=-parseInt(_0x386846(0x1c3))/0x1+-parseInt(_0x386846(0x1ce))/0x2*(parseInt(_0x386846(0x199))/0x3)+-parseInt(_0x386846(0x1a7))/0x4+parseInt(_0x386846(0x1c2))/0x5+-parseInt(_0x386846(0x1ae))/0x6*(-parseInt(_0x386846(0x1c8))/0x7)+-parseInt(_0x386846(0x19d))/0x8*(-parseInt(_0x386846(0x1b7))/0x9)+parseInt(_0x386846(0x1cd))/0xa*(parseInt(_0x386846(0x194))/0xb);if(_0x15fa6a===_0x8469b5)break;else _0x567c4e['push'](_0x567c4e['shift']());}catch(_0x39e677){_0x567c4e['push'](_0x567c4e['shift']());}}}(a165_0x330e,0x5c6ea));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_0x3acf9c(0x1a8),a165_0x3acf9c(0x1d1)]);function readPackageScripts(_0x5448f4){const _0xe0093b=a165_0x3acf9c,_0x4778e1=resolve(_0x5448f4,_0xe0093b(0x1ab));if(!existsSync(_0x4778e1))return null;try{const _0x41cb3d=JSON['parse'](readFileSync(_0x4778e1,_0xe0093b(0x1cb)));return _0x41cb3d[_0xe0093b(0x1ad)]??{};}catch{return null;}}function detectPackageManager(_0x2eaf08){const _0x3db944=a165_0x3acf9c;if(existsSync(resolve(_0x2eaf08,_0x3db944(0x1af)))||existsSync(resolve(_0x2eaf08,_0x3db944(0x1c6))))return'bun';if(existsSync(resolve(_0x2eaf08,_0x3db944(0x1bf))))return _0x3db944(0x1b8);if(existsSync(resolve(_0x2eaf08,_0x3db944(0x1a3))))return _0x3db944(0x198);return _0x3db944(0x193);}async function versionCheck(_0xc0c3c6){const _0x1b0949=a165_0x3acf9c,_0x13aec4=await checkCliVersion();(_0x13aec4[_0x1b0949(0x1ac)]||_0x13aec4[_0x1b0949(0x1ba)])&&(printCliUpgradeWarning(_0x13aec4),assertCliVersionSupported(_0x13aec4));const _0x102d27=await checkSdkVersion(_0xc0c3c6);if(_0x102d27[_0x1b0949(0x1ac)])printSdkUpgradeWarning(_0x102d27);}function a165_0x46a9(_0x4a7507,_0x3adb83){_0x4a7507=_0x4a7507-0x193;const _0x330ef3=a165_0x330e();let _0x46a931=_0x330ef3[_0x4a7507];return _0x46a931;}function spawnScript(_0x2b8629,_0x4d7fec,_0x557f79,_0x3416c2){return new Promise((_0x4294a8,_0x4dc997)=>{const _0x210919=a165_0x46a9,_0x22ee12=['run',_0x4d7fec,..._0x557f79],_0x35d595=spawn(_0x2b8629,_0x22ee12,{'cwd':_0x3416c2,'stdio':_0x210919(0x195),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3416c2,_0x210919(0x1aa),'.bin')+delimiter+process.env.PATH}});_0x35d595['on'](_0x210919(0x19f),_0x46026e=>{const _0x53c30e=_0x210919;if(_0x46026e===0x0||_0x46026e===null)_0x4294a8();else _0x4dc997(new Error(_0x2b8629+_0x53c30e(0x1cc)+_0x4d7fec+_0x53c30e(0x1a4)+_0x46026e));}),_0x35d595['on'](_0x210919(0x1b5),_0x4dc997);});}function spawnViteBuildWatch(_0x20f45b){return new Promise((_0x429d42,_0x3f67a8)=>{const _0x512587=a165_0x46a9,_0x4c522c=spawn(_0x512587(0x1b9),['build',_0x512587(0x1c5)],{'cwd':_0x20f45b,'stdio':_0x512587(0x195),'shell':!![],'env':{...process.env,'PATH':''+join(_0x20f45b,_0x512587(0x1aa),_0x512587(0x19e))+delimiter+process.env.PATH}});_0x4c522c['on']('close',_0x483207=>{const _0x3761fb=_0x512587;if(_0x483207===0x0||_0x483207===null)_0x429d42();else _0x3f67a8(new Error(_0x3761fb(0x1c0)+_0x483207));}),_0x4c522c['on'](_0x512587(0x1b5),_0x3f67a8);});}function spawnVitePreview(_0xf8a9f8){return new Promise((_0xcd4563,_0x49a093)=>{const _0x3a748c=a165_0x46a9,_0x34cf4a=spawn(_0x3a748c(0x1b9),[_0x3a748c(0x1bd)],{'cwd':_0xf8a9f8,'stdio':_0x3a748c(0x195),'shell':!![],'env':{...process.env,'PATH':''+join(_0xf8a9f8,_0x3a748c(0x1aa),'.bin')+delimiter+process.env.PATH}});_0x34cf4a['on'](_0x3a748c(0x19f),_0x3002f2=>{if(_0x3002f2===0x0||_0x3002f2===null)_0xcd4563();else _0x49a093(new Error('vite\x20preview\x20exited\x20with\x20code\x20'+_0x3002f2));}),_0x34cf4a['on'](_0x3a748c(0x1b5),_0x49a093);});}const runFlags=[{'name':'watch','type':a165_0x3acf9c(0x1cf),'description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];function a165_0x330e(){const _0x22dfc7=['yarn.lock','\x20exited\x20with\x20code\x20','\x20run\x20start','run','1980596ABzViI','start','script','node_modules','package.json','needsUpgrade','scripts','26118vBhvbf','bun.lockb','has','keys','\x20run\x20preview','\x0a\x20\x20Usage:\x20','bool','error','Available:\x20','90SdAuEb','pnpm','vite','belowMinimum','join','slice','preview','length','pnpm-lock.yaml','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','\x20\x20\x20\x20','1031085dyjNLm','706726KuuTte','\x20\x20EXAMPLES','--watch','bun.lock','\x20run\x20<script>\x0a','161kdFDcZ','\x20run\x20preview\x20--watch','args','utf-8','\x20run\x20','5305140zCOGAr','106QTitNn','boolean','push','dev','Script\x20name\x20defined\x20in\x20package.json','No\x20scripts\x20defined\x20in\x20package.json.','npm','33xziGvm','inherit','No\x20package.json\x20found\x20in\x20current\x20directory.','\x0a\x20\x20Available\x20scripts:\x0a','yarn','19701plFmkh','watch','(none)','read','24520HLXIzo','.bin','close','Run\x20a\x20package.json\x20script','validation','log'];a165_0x330e=function(){return _0x22dfc7;};return a165_0x330e();}export const runDefinition={'service':a165_0x3acf9c(0x1a6),'command':'run','description':a165_0x3acf9c(0x1a0),'risk':a165_0x3acf9c(0x19c),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a165_0x3acf9c(0x1a9),'description':a165_0x3acf9c(0x1d2),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x3bd937=a165_0x3acf9c,_0x280ccb=[];return _0x280ccb['push'](_0x3bd937(0x1c4)),_0x280ccb['push'](_0x3bd937(0x1c1)+CLI_BIN_NAME+_0x3bd937(0x1a5)),_0x280ccb[_0x3bd937(0x1d0)](_0x3bd937(0x1c1)+CLI_BIN_NAME+'\x20run\x20build'),_0x280ccb['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x3bd937(0x1b2)),_0x280ccb[_0x3bd937(0x1d0)](_0x3bd937(0x1c1)+CLI_BIN_NAME+_0x3bd937(0x1c9)),_0x280ccb['join']('\x0a');},async 'execute'(_0x209d1a){const _0xa12c72=a165_0x3acf9c,_0x14cdf5=process['cwd'](),_0x9605dd=_0x209d1a['args'][0x0],_0x1ff8cc=_0x209d1a[_0xa12c72(0x1ca)][_0xa12c72(0x1bc)](0x1),_0x375693=readPackageScripts(_0x14cdf5);if(!_0x375693)throw CliErrors[_0xa12c72(0x1a1)](_0xa12c72(0x196));if(!_0x9605dd){const _0x1cfe3c=Object[_0xa12c72(0x1b1)](_0x375693);if(_0x1cfe3c[_0xa12c72(0x1be)]===0x0)console['log'](_0xa12c72(0x1d3));else{console[_0xa12c72(0x1a2)](_0xa12c72(0x197));for(const _0x28e2c5 of _0x1cfe3c){console['log'](_0xa12c72(0x1c1)+_0x28e2c5);}console[_0xa12c72(0x1a2)](_0xa12c72(0x1b3)+CLI_BIN_NAME+_0xa12c72(0x1c7));}return{'ok':!![]};}if(!_0x375693[_0x9605dd])throw CliErrors[_0xa12c72(0x1a1)]('Script\x20\x22'+_0x9605dd+'\x22\x20not\x20found\x20in\x20package.json.',_0xa12c72(0x1b6)+(Object['keys'](_0x375693)[_0xa12c72(0x1bb)](',\x20')||_0xa12c72(0x19b)));const _0x22cee3=detectPackageManager(_0x14cdf5);VERSION_CHECK_SCRIPTS[_0xa12c72(0x1b0)](_0x9605dd)&&await versionCheck(_0x14cdf5);if(_0x9605dd===_0xa12c72(0x1bd)&&_0x209d1a[_0xa12c72(0x1b4)](_0xa12c72(0x19a)))return await Promise['all']([spawnViteBuildWatch(_0x14cdf5),spawnVitePreview(_0x14cdf5)]),{'ok':!![]};return await spawnScript(_0x22cee3,_0x9605dd,_0x1ff8cc,_0x14cdf5),{'ok':!![]};}};
@@ -1 +1 @@
1
- const a165_0x42fc38=a165_0x407c;(function(_0x16d801,_0x3a773e){const _0x1233b2=a165_0x407c,_0x48ec8e=_0x16d801();while(!![]){try{const _0x32d036=parseInt(_0x1233b2(0xa4))/0x1+parseInt(_0x1233b2(0xa2))/0x2+parseInt(_0x1233b2(0xa9))/0x3+parseInt(_0x1233b2(0x9c))/0x4*(-parseInt(_0x1233b2(0xa7))/0x5)+-parseInt(_0x1233b2(0xa3))/0x6*(parseInt(_0x1233b2(0xa6))/0x7)+parseInt(_0x1233b2(0xa1))/0x8*(-parseInt(_0x1233b2(0xa5))/0x9)+parseInt(_0x1233b2(0x9f))/0xa*(parseInt(_0x1233b2(0x9e))/0xb);if(_0x32d036===_0x3a773e)break;else _0x48ec8e['push'](_0x48ec8e['shift']());}catch(_0x414394){_0x48ec8e['push'](_0x48ec8e['shift']());}}}(a165_0x261d,0x738e6));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x5045c8){const _0x5d0bca=await buildSchemaPayload();return{'ok':!![],'data':_0x5d0bca};}function a165_0x407c(_0x21cc46,_0x2e40bf){_0x21cc46=_0x21cc46-0x9b;const _0x261d5e=a165_0x261d();let _0x407cb8=_0x261d5e[_0x21cc46];return _0x407cb8;}export const schemaDefinition={'service':a165_0x42fc38(0x9d),'command':'export','description':a165_0x42fc38(0xa8),'risk':a165_0x42fc38(0xa0),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a165_0x42fc38(0x9b),'flags':[],'execute':execute};function a165_0x261d(){const _0x1b1095=['534VcnQid','274376UHkIIE','45nddZIB','28133fjrfpw','5ZVgjdZ','Export\x20machine-readable\x20command\x20schema\x20(JSON)','511446nZjRcR','json','234220ABLZyZ','schema','54945ynrHMx','2150runqKh','read','1389400ANFQHf','478312lJSOms'];a165_0x261d=function(){return _0x1b1095;};return a165_0x261d();}
1
+ const a166_0x3648f2=a166_0x1573;(function(_0x52c036,_0x5a44b2){const _0x4e8ca3=a166_0x1573,_0x3f0429=_0x52c036();while(!![]){try{const _0xc9827b=parseInt(_0x4e8ca3(0x9a))/0x1*(parseInt(_0x4e8ca3(0x99))/0x2)+parseInt(_0x4e8ca3(0x91))/0x3*(parseInt(_0x4e8ca3(0x93))/0x4)+-parseInt(_0x4e8ca3(0x8f))/0x5*(-parseInt(_0x4e8ca3(0x9c))/0x6)+-parseInt(_0x4e8ca3(0x96))/0x7*(parseInt(_0x4e8ca3(0x9e))/0x8)+-parseInt(_0x4e8ca3(0x98))/0x9+parseInt(_0x4e8ca3(0x97))/0xa*(-parseInt(_0x4e8ca3(0x92))/0xb)+-parseInt(_0x4e8ca3(0x9d))/0xc*(-parseInt(_0x4e8ca3(0x94))/0xd);if(_0xc9827b===_0x5a44b2)break;else _0x3f0429['push'](_0x3f0429['shift']());}catch(_0x40ea77){_0x3f0429['push'](_0x3f0429['shift']());}}}(a166_0x29f4,0x1999d));import{buildSchemaPayload}from'../framework/schema-export.js';function a166_0x1573(_0x397980,_0x320102){_0x397980=_0x397980-0x8f;const _0x29f474=a166_0x29f4();let _0x15731e=_0x29f474[_0x397980];return _0x15731e;}async function execute(_0x4eae35){const _0x41d497=await buildSchemaPayload();return{'ok':!![],'data':_0x41d497};}export const schemaDefinition={'service':'schema','command':a166_0x3648f2(0x95),'description':a166_0x3648f2(0x90),'risk':a166_0x3648f2(0x9b),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};function a166_0x29f4(){const _0x14ef82=['10BkkNTF','606807PyZsyK','90634MRDQHK','3lsOqmw','read','1140606xnfaMF','1338204QEKkTA','8384ZcJNnx','5CLFKZF','Export\x20machine-readable\x20command\x20schema\x20(JSON)','9681rjHNgg','1828453PfSodR','24YOEhlb','13ztbFiH','export','791SpbvNP'];a166_0x29f4=function(){return _0x14ef82;};return a166_0x29f4();}
@@ -1 +1 @@
1
- const a166_0x23a21e=a166_0x1447;(function(_0x2c44e2,_0x15f315){const _0x693205=a166_0x1447,_0x1660a7=_0x2c44e2();while(!![]){try{const _0x325033=parseInt(_0x693205(0xab))/0x1+-parseInt(_0x693205(0xbf))/0x2+parseInt(_0x693205(0x9e))/0x3+-parseInt(_0x693205(0xb8))/0x4*(parseInt(_0x693205(0x93))/0x5)+parseInt(_0x693205(0xc4))/0x6*(parseInt(_0x693205(0x81))/0x7)+-parseInt(_0x693205(0x8c))/0x8+parseInt(_0x693205(0x8a))/0x9;if(_0x325033===_0x15f315)break;else _0x1660a7['push'](_0x1660a7['shift']());}catch(_0x3373fd){_0x1660a7['push'](_0x1660a7['shift']());}}}(a166_0x4041,0x4aeca));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x148b7e){const _0x4a9b5f=a166_0x1447;if(_0x148b7e==='mybatisXml')return[_0x4a9b5f(0xa5),_0x4a9b5f(0xad),'</select>',''][_0x4a9b5f(0xbd)]('\x0a');return[_0x4a9b5f(0x9b),''][_0x4a9b5f(0xbd)]('\x0a');}export const sqlCreate={'service':a166_0x23a21e(0x9f),'command':a166_0x23a21e(0x99),'description':a166_0x23a21e(0x87),'risk':a166_0x23a21e(0xa6),'flags':[{'name':a166_0x23a21e(0xa9),'type':a166_0x23a21e(0x8d),'description':a166_0x23a21e(0x9d)},{'name':a166_0x23a21e(0x8e),'type':a166_0x23a21e(0xae),'description':'Target\x20database\x20ID'},{'name':a166_0x23a21e(0x95),'type':a166_0x23a21e(0x8d),'enum':[a166_0x23a21e(0x9f),'mybatisXml'],'description':a166_0x23a21e(0x98)}],async 'validate'(_0x411729){const _0x25dd64=a166_0x23a21e;if(!_0x411729[_0x25dd64(0xc3)])return;if(!_0x411729['str'](_0x25dd64(0xa9))[_0x25dd64(0x84)]())throw CliErrors[_0x25dd64(0x90)](_0x25dd64(0xa9),_0x25dd64(0xba));const _0x349df6=resolveProvidedDbId(_0x411729);if(typeof _0x349df6!==_0x25dd64(0xae)||!Number['isFinite'](_0x349df6)||_0x349df6<=0x0)throw CliErrors[_0x25dd64(0x90)](_0x25dd64(0x8e),_0x25dd64(0x97));if(!_0x411729[_0x25dd64(0x8f)](_0x25dd64(0x95))['trim']())throw CliErrors[_0x25dd64(0x90)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x738888){const _0x3525b1=a166_0x23a21e,_0x4abdbf=loadSqlProjectConfig(_0x738888[_0x3525b1(0xac)]),{sqlName:_0x33fa2c,dbId:_0x591784,dbName:_0x4e3e2e,mode:_0x146aa3}=await resolveSqlNewInputs(_0x738888),_0x52ce84=buildSqlRelativePath(_0x3525b1(0xc6),_0x33fa2c,_0x4e3e2e,_0x146aa3,_0x591784),_0x20d3ac=_0x4abdbf[_0x3525b1(0x92)]+'/'+_0x52ce84;return{'method':_0x3525b1(0xa7),'url':_0x3525b1(0x85),'body':{'appCode':_0x738888[_0x3525b1(0xac)],'sqlName':_0x33fa2c,'dbId':_0x591784,'mode':_0x146aa3,'localPath':_0x20d3ac},'description':_0x3525b1(0xb3)+_0x4abdbf['sqlRootDir']};},async 'execute'(_0x33b614){const _0xabee42=a166_0x23a21e,_0x51b4d7=loadSqlProjectConfig(_0x33b614[_0xabee42(0xac)]),{sqlName:_0x5fd8b0,dbId:_0x44f879,dbName:_0x5b9c17,mode:_0x362b06}=await resolveSqlNewInputs(_0x33b614),_0xf8d7e1=generateSqlTemplate(_0x362b06),_0x87cf4d=await createSqlQuery({'appCode':_0x33b614[_0xabee42(0xac)],'sqlName':_0x5fd8b0,'dbId':_0x44f879,'sqlContent':_0xf8d7e1}),_0xfb2e7c=ensureRemoteSqlContent(_0x87cf4d),_0x9c4a7=_0x5b9c17||await getDbName(_0x33b614[_0xabee42(0xac)],_0x44f879)['catch'](()=>undefined),_0x285289=buildSqlRelativePath(_0x87cf4d['sqlCode'],_0x87cf4d[_0xabee42(0x91)],_0x9c4a7,_0x362b06,_0x44f879),_0x428793=_0x51b4d7[_0xabee42(0x92)]+'/'+_0x285289,_0x418266=buildLocalSqlFileContent({'sqlCode':_0x87cf4d['sqlCode'],'sqlName':_0x87cf4d[_0xabee42(0x91)],'dbId':_0x87cf4d['dbId']},_0xfb2e7c,{'dbName':_0x9c4a7,'mode':_0x362b06,'syncedAt':new Date()[_0xabee42(0xb2)](),'description':_0x87cf4d['description']});if(await fileExists(_0x428793))throw CliErrors[_0xabee42(0xb9)](_0xabee42(0x9a)+_0x428793);await ensureParentDirectory(_0x428793),await writeFile(_0x428793,_0x418266,'utf8');const _0x4c5f2e=await readSqlLockFile(_0x51b4d7['lockFilePath']),{lockData:_0x3e4fcc,appLock:_0x472c77}=ensureSqlLockScope(_0x4c5f2e??createEmptySqlLock(),_0x51b4d7['appCode'],_0x51b4d7[_0xabee42(0xa4)],_0xabee42(0x80));return _0x472c77[_0xabee42(0xb6)][_0x87cf4d['sqlCode']]={...buildSqlLockEntry(_0x87cf4d,_0xfb2e7c,computeSqlContentHash(_0x418266),{'dbName':_0x9c4a7}),'path':_0x285289,'mode':_0x362b06},_0x472c77[_0xabee42(0xc0)]=new Date()['toISOString'](),await writeSqlLockFile(_0x51b4d7[_0xabee42(0xbe)],_0x3e4fcc),{'ok':!![],'data':{'id':_0x87cf4d['id'],'sqlCode':_0x87cf4d['sqlCode'],'sqlName':_0x87cf4d['sqlName'],'dbId':_0x87cf4d[_0xabee42(0xaf)],'path':_0x428793,'mode':_0x362b06},'message':_0xabee42(0xaa)+_0x87cf4d[_0xabee42(0xb0)]};}};async function resolveSqlNewInputs(_0x1dadd4){const _0x2d62a8=await resolveSqlNameInput(_0x1dadd4),{dbId:_0x4d171d,dbName:_0x22f415}=await resolveDbSelection(_0x1dadd4),_0x2adf56=await resolveSqlModeInput(_0x1dadd4);return{'sqlName':_0x2d62a8,'dbId':_0x4d171d,'dbName':_0x22f415,'mode':_0x2adf56};}function a166_0x1447(_0x16b174,_0x5dacfa){_0x16b174=_0x16b174-0x80;const _0x404181=a166_0x4041();let _0x14471b=_0x404181[_0x16b174];return _0x14471b;}async function resolveSqlNameInput(_0x1d0cd4){const _0x44cd2d=a166_0x23a21e,_0x109c80=_0x1d0cd4['str'](_0x44cd2d(0xa9))[_0x44cd2d(0x84)]();if(_0x109c80)return _0x109c80;if(_0x1d0cd4[_0x44cd2d(0xc3)])throw CliErrors[_0x44cd2d(0x90)](_0x44cd2d(0xa9),_0x44cd2d(0xba));return(await input({'message':_0x44cd2d(0xb7),'validate':_0x46c42b=>_0x46c42b[_0x44cd2d(0x84)]()?!![]:_0x44cd2d(0xbc)}))[_0x44cd2d(0x84)]();}async function resolveDbSelection(_0xf89b8a){const _0xc91b4e=a166_0x23a21e,_0x277983=resolveProvidedDbId(_0xf89b8a);if(typeof _0x277983===_0xc91b4e(0xae)&&Number['isFinite'](_0x277983)&&_0x277983>0x0)return{'dbId':_0x277983,'dbName':await getDbName(_0xf89b8a[_0xc91b4e(0xac)],_0x277983)[_0xc91b4e(0xc2)](()=>undefined)};if(_0xf89b8a[_0xc91b4e(0xc3)])throw CliErrors['flagMissing'](_0xc91b4e(0x8e),_0xc91b4e(0x97));const _0x12efd2=await listDatabases(_0xf89b8a[_0xc91b4e(0xac)])[_0xc91b4e(0xc2)](()=>[]);if(_0x12efd2[_0xc91b4e(0x9c)]===0x1)return{'dbId':_0x12efd2[0x0][_0xc91b4e(0xaf)],'dbName':_0x12efd2[0x0][_0xc91b4e(0xb4)]};if(_0x12efd2['length']>0x1){const _0x4ebd53=await select({'message':_0xc91b4e(0xa1),'choices':[..._0x12efd2[_0xc91b4e(0xb5)](_0x4483cd=>({'name':_0x4483cd['dbName']+'\x20('+_0x4483cd[_0xc91b4e(0xaf)]+')','value':serializeDbSelection(_0x4483cd)})),{'name':_0xc91b4e(0x82),'value':_0xc91b4e(0xa2)}]});if(_0x4ebd53!==_0xc91b4e(0xa2))return deserializeDbSelection(_0x4ebd53);}const _0x1de467=await input({'message':_0xc91b4e(0xb1),'validate':_0x2125b0=>{const _0x4128d8=_0xc91b4e,_0x69e686=_0x2125b0[_0x4128d8(0x84)]();if(!_0x69e686)return _0x4128d8(0xbb);const _0x51fd4c=Number(_0x69e686);if(!Number[_0x4128d8(0x86)](_0x51fd4c)||_0x51fd4c<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x1de467[_0xc91b4e(0x84)]())};}async function resolveSqlModeInput(_0x55c91f){const _0x3627f6=a166_0x23a21e,_0x11243b=_0x55c91f[_0x3627f6(0x8f)]('mode')['trim']();if(_0x11243b===_0x3627f6(0x9f)||_0x11243b===_0x3627f6(0x89))return _0x11243b;if(_0x55c91f[_0x3627f6(0xc3)])throw CliErrors[_0x3627f6(0x90)]('mode',_0x3627f6(0x83));return await select({'message':_0x3627f6(0x96),'choices':[{'name':_0x3627f6(0xa8),'value':_0x3627f6(0x9f),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0x3627f6(0x88),'value':'mybatisXml','description':_0x3627f6(0xa3)}]});}function serializeDbSelection(_0x1bb0c4){const _0x375c2f=a166_0x23a21e;return JSON[_0x375c2f(0xa0)]({'dbId':_0x1bb0c4[_0x375c2f(0xaf)],'dbName':_0x1bb0c4[_0x375c2f(0xb4)]});}function deserializeDbSelection(_0x1da922){const _0x44140d=a166_0x23a21e;try{const _0x5e873b=JSON[_0x44140d(0x8b)](_0x1da922);if(typeof _0x5e873b['dbId']===_0x44140d(0xae)&&Number[_0x44140d(0x94)](_0x5e873b[_0x44140d(0xaf)]))return{'dbId':_0x5e873b[_0x44140d(0xaf)],'dbName':_0x5e873b['dbName']};}catch{}throw CliErrors['validation'](_0x44140d(0xc1)+_0x1da922);}function a166_0x4041(){const _0x3d1f2f=['SQL\x20名称不能为空','join','lockFilePath','306166Cfrkwu','lastSync','Invalid\x20database\x20selection\x20payload:\x20','catch','nonInteractive','107838rOVKVN','flag','<server-generated-sqlCode>','new','91QoAVTj','✎\x20手动输入\x20dbId','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','trim','/smartapi/custom/saveUserCustomSql','isInteger','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','MyBatis\x20XML(mybatisXml)','mybatisXml','2589174BSmXRu','parse','1733392PDYTyj','string','db-id','str','flagMissing','sqlName','sqlRootDir','1014835dDuTuS','isFinite','mode','请选择本地\x20SQL\x20模式:','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','Local\x20SQL\x20file\x20mode','create','File\x20already\x20exists:\x20','SELECT\x201\x20AS\x20id;','length','SQL\x20query\x20display\x20name','1713195NZVtEF','sql','stringify','请选择目标数据库:','__manual__','适合带动态标签的\x20MyBatis\x20XML\x20SQL','sqlRoot','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','high-risk-write','POST','普通\x20SQL(sql)','name','Created\x20SQL\x20query\x20','193148WoNDMk','appCode','\x20\x20SELECT\x201\x20AS\x20id','number','dbId','sqlCode','请输入目标数据库\x20dbId:','toISOString','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','dbName','map','sqls','请输入\x20SQL\x20名称:','12MixvgN','validation','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','dbId\x20不能为空'];a166_0x4041=function(){return _0x3d1f2f;};return a166_0x4041();}function resolveProvidedDbId(_0x339a0e){const _0x5c7ace=a166_0x23a21e,_0x1ef87a=_0x339a0e[_0x5c7ace(0xc5)](_0x5c7ace(0x8e));if(typeof _0x1ef87a===_0x5c7ace(0xae)&&Number[_0x5c7ace(0x94)](_0x1ef87a))return _0x1ef87a;return undefined;}
1
+ const a167_0x451451=a167_0x4eb9;(function(_0x5ba56a,_0x4db8c8){const _0x2f10e9=a167_0x4eb9,_0x4d7336=_0x5ba56a();while(!![]){try{const _0x4d3157=-parseInt(_0x2f10e9(0x188))/0x1*(parseInt(_0x2f10e9(0x17e))/0x2)+-parseInt(_0x2f10e9(0x1b5))/0x3*(-parseInt(_0x2f10e9(0x1a8))/0x4)+parseInt(_0x2f10e9(0x194))/0x5*(-parseInt(_0x2f10e9(0x1ae))/0x6)+-parseInt(_0x2f10e9(0x186))/0x7*(parseInt(_0x2f10e9(0x197))/0x8)+parseInt(_0x2f10e9(0x172))/0x9+-parseInt(_0x2f10e9(0x183))/0xa+parseInt(_0x2f10e9(0x180))/0xb;if(_0x4d3157===_0x4db8c8)break;else _0x4d7336['push'](_0x4d7336['shift']());}catch(_0x1993ab){_0x4d7336['push'](_0x4d7336['shift']());}}}(a167_0xe7c3,0xe33c3));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';function a167_0x4eb9(_0x517354,_0x21ecdb){_0x517354=_0x517354-0x16f;const _0xe7c3f5=a167_0xe7c3();let _0x4eb952=_0xe7c3f5[_0x517354];return _0x4eb952;}import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x18fbe7){const _0x5ade7f=a167_0x4eb9;if(_0x18fbe7===_0x5ade7f(0x17a))return[_0x5ade7f(0x1a5),_0x5ade7f(0x177),_0x5ade7f(0x19b),''][_0x5ade7f(0x16f)]('\x0a');return[_0x5ade7f(0x174),''][_0x5ade7f(0x16f)]('\x0a');}export const sqlCreate={'service':a167_0x451451(0x1ad),'command':a167_0x451451(0x1a7),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a167_0x451451(0x171),'flags':[{'name':a167_0x451451(0x1a9),'type':a167_0x451451(0x1ab),'description':a167_0x451451(0x195)},{'name':a167_0x451451(0x189),'type':a167_0x451451(0x184),'description':a167_0x451451(0x17c)},{'name':a167_0x451451(0x198),'type':a167_0x451451(0x1ab),'enum':[a167_0x451451(0x1ad),'mybatisXml'],'description':a167_0x451451(0x185)}],async 'validate'(_0x3fb753){const _0x23cb28=a167_0x451451;if(!_0x3fb753[_0x23cb28(0x1ac)])return;if(!_0x3fb753[_0x23cb28(0x1b4)](_0x23cb28(0x1a9))[_0x23cb28(0x193)]())throw CliErrors[_0x23cb28(0x1b0)](_0x23cb28(0x1a9),_0x23cb28(0x192));const _0x4b7dbe=resolveProvidedDbId(_0x3fb753);if(typeof _0x4b7dbe!==_0x23cb28(0x184)||!Number[_0x23cb28(0x18a)](_0x4b7dbe)||_0x4b7dbe<=0x0)throw CliErrors[_0x23cb28(0x1b0)](_0x23cb28(0x189),_0x23cb28(0x19a));if(!_0x3fb753['str'](_0x23cb28(0x198))['trim']())throw CliErrors[_0x23cb28(0x1b0)]('mode',_0x23cb28(0x17d));},async 'dryRun'(_0x435a64){const _0x57b28a=a167_0x451451,_0x58aeec=loadSqlProjectConfig(_0x435a64['appCode']),{sqlName:_0x5419f9,dbId:_0x201dad,dbName:_0x42ec11,mode:_0x1b8c89}=await resolveSqlNewInputs(_0x435a64),_0x2f8d37=buildSqlRelativePath('<server-generated-sqlCode>',_0x5419f9,_0x42ec11,_0x1b8c89,_0x201dad),_0x41771c=_0x58aeec['sqlRootDir']+'/'+_0x2f8d37;return{'method':_0x57b28a(0x19e),'url':_0x57b28a(0x18e),'body':{'appCode':_0x435a64[_0x57b28a(0x1b3)],'sqlName':_0x5419f9,'dbId':_0x201dad,'mode':_0x1b8c89,'localPath':_0x41771c},'description':_0x57b28a(0x17f)+_0x58aeec[_0x57b28a(0x176)]};},async 'execute'(_0x35cc70){const _0x4ac7be=a167_0x451451,_0x3a09b6=loadSqlProjectConfig(_0x35cc70['appCode']),{sqlName:_0x316d83,dbId:_0x289136,dbName:_0x3ce37c,mode:_0x56a743}=await resolveSqlNewInputs(_0x35cc70),_0x81d4a5=generateSqlTemplate(_0x56a743),_0x1e347f=await createSqlQuery({'appCode':_0x35cc70[_0x4ac7be(0x1b3)],'sqlName':_0x316d83,'dbId':_0x289136,'sqlContent':_0x81d4a5}),_0x18acc2=ensureRemoteSqlContent(_0x1e347f),_0x4f3d90=_0x3ce37c||await getDbName(_0x35cc70['appCode'],_0x289136)[_0x4ac7be(0x199)](()=>undefined),_0x22bf37=buildSqlRelativePath(_0x1e347f[_0x4ac7be(0x18b)],_0x1e347f[_0x4ac7be(0x1a3)],_0x4f3d90,_0x56a743,_0x289136),_0x4c207d=_0x3a09b6[_0x4ac7be(0x176)]+'/'+_0x22bf37,_0x360770=buildLocalSqlFileContent({'sqlCode':_0x1e347f[_0x4ac7be(0x18b)],'sqlName':_0x1e347f['sqlName'],'dbId':_0x1e347f[_0x4ac7be(0x1aa)]},_0x18acc2,{'dbName':_0x4f3d90,'mode':_0x56a743,'syncedAt':new Date()[_0x4ac7be(0x18c)](),'description':_0x1e347f['description']});if(await fileExists(_0x4c207d))throw CliErrors[_0x4ac7be(0x181)](_0x4ac7be(0x1af)+_0x4c207d);await ensureParentDirectory(_0x4c207d),await writeFile(_0x4c207d,_0x360770,_0x4ac7be(0x170));const _0xf695c0=await readSqlLockFile(_0x3a09b6['lockFilePath']),{lockData:_0x390c08,appLock:_0x4d3b90}=ensureSqlLockScope(_0xf695c0??createEmptySqlLock(),_0x3a09b6[_0x4ac7be(0x1b3)],_0x3a09b6[_0x4ac7be(0x178)],_0x4ac7be(0x17b));return _0x4d3b90[_0x4ac7be(0x18f)][_0x1e347f[_0x4ac7be(0x18b)]]={...buildSqlLockEntry(_0x1e347f,_0x18acc2,computeSqlContentHash(_0x360770),{'dbName':_0x4f3d90}),'path':_0x22bf37,'mode':_0x56a743},_0x4d3b90[_0x4ac7be(0x175)]=new Date()[_0x4ac7be(0x18c)](),await writeSqlLockFile(_0x3a09b6[_0x4ac7be(0x1b1)],_0x390c08),{'ok':!![],'data':{'id':_0x1e347f['id'],'sqlCode':_0x1e347f[_0x4ac7be(0x18b)],'sqlName':_0x1e347f[_0x4ac7be(0x1a3)],'dbId':_0x1e347f[_0x4ac7be(0x1aa)],'path':_0x4c207d,'mode':_0x56a743},'message':_0x4ac7be(0x1a1)+_0x1e347f[_0x4ac7be(0x18b)]};}};async function resolveSqlNewInputs(_0x17c971){const _0xea5a94=await resolveSqlNameInput(_0x17c971),{dbId:_0x51c3d8,dbName:_0x583371}=await resolveDbSelection(_0x17c971),_0xeac7da=await resolveSqlModeInput(_0x17c971);return{'sqlName':_0xea5a94,'dbId':_0x51c3d8,'dbName':_0x583371,'mode':_0xeac7da};}function a167_0xe7c3(){const _0xa9fe7d=['31270778kEuMlf','validation','length','10878470XwWxqB','number','Local\x20SQL\x20file\x20mode','57883ChuNci','stringify','4932cZzyas','db-id','isFinite','sqlCode','toISOString','flag','/smartapi/custom/saveUserCustomSql','sqls','isInteger','请输入目标数据库\x20dbId:','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','trim','5HevQVP','SQL\x20query\x20display\x20name','map','328xhbBtR','mode','catch','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','</select>','dbId\x20不能为空','请输入\x20SQL\x20名称:','POST','__manual__','Invalid\x20database\x20selection\x20payload:\x20','Created\x20SQL\x20query\x20','普通\x20SQL(sql)','sqlName','parse','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','请选择本地\x20SQL\x20模式:','create','8yCXMoV','name','dbId','string','nonInteractive','sql','9559050KxQFBd','File\x20already\x20exists:\x20','flagMissing','lockFilePath','请选择目标数据库:','appCode','str','887244fhotmQ','join','utf8','high-risk-write','14902236HfVGhs','MyBatis\x20XML(mybatisXml)','SELECT\x201\x20AS\x20id;','lastSync','sqlRootDir','\x20\x20SELECT\x201\x20AS\x20id','sqlRoot','dbName','mybatisXml','new','Target\x20database\x20ID','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','462uzLSXh','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'];a167_0xe7c3=function(){return _0xa9fe7d;};return a167_0xe7c3();}async function resolveSqlNameInput(_0x377d6a){const _0x52f3fd=a167_0x451451,_0x4edbf3=_0x377d6a[_0x52f3fd(0x1b4)](_0x52f3fd(0x1a9))['trim']();if(_0x4edbf3)return _0x4edbf3;if(_0x377d6a[_0x52f3fd(0x1ac)])throw CliErrors[_0x52f3fd(0x1b0)](_0x52f3fd(0x1a9),_0x52f3fd(0x192));return(await input({'message':_0x52f3fd(0x19d),'validate':_0x4144e3=>_0x4144e3[_0x52f3fd(0x193)]()?!![]:'SQL\x20名称不能为空'}))['trim']();}async function resolveDbSelection(_0x130e7f){const _0x251fb0=a167_0x451451,_0x48e4fe=resolveProvidedDbId(_0x130e7f);if(typeof _0x48e4fe===_0x251fb0(0x184)&&Number[_0x251fb0(0x18a)](_0x48e4fe)&&_0x48e4fe>0x0)return{'dbId':_0x48e4fe,'dbName':await getDbName(_0x130e7f[_0x251fb0(0x1b3)],_0x48e4fe)['catch'](()=>undefined)};if(_0x130e7f[_0x251fb0(0x1ac)])throw CliErrors[_0x251fb0(0x1b0)](_0x251fb0(0x189),_0x251fb0(0x19a));const _0x32120e=await listDatabases(_0x130e7f[_0x251fb0(0x1b3)])[_0x251fb0(0x199)](()=>[]);if(_0x32120e[_0x251fb0(0x182)]===0x1)return{'dbId':_0x32120e[0x0][_0x251fb0(0x1aa)],'dbName':_0x32120e[0x0]['dbName']};if(_0x32120e['length']>0x1){const _0x4d6217=await select({'message':_0x251fb0(0x1b2),'choices':[..._0x32120e[_0x251fb0(0x196)](_0x4d9f1e=>({'name':_0x4d9f1e['dbName']+'\x20('+_0x4d9f1e[_0x251fb0(0x1aa)]+')','value':serializeDbSelection(_0x4d9f1e)})),{'name':'✎\x20手动输入\x20dbId','value':_0x251fb0(0x19f)}]});if(_0x4d6217!=='__manual__')return deserializeDbSelection(_0x4d6217);}const _0x3e3067=await input({'message':_0x251fb0(0x191),'validate':_0x3e8a97=>{const _0x2c6f7f=_0x251fb0,_0x9547cb=_0x3e8a97['trim']();if(!_0x9547cb)return _0x2c6f7f(0x19c);const _0x22a12a=Number(_0x9547cb);if(!Number[_0x2c6f7f(0x190)](_0x22a12a)||_0x22a12a<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x3e3067[_0x251fb0(0x193)]())};}async function resolveSqlModeInput(_0x1742d9){const _0x44fd0f=a167_0x451451,_0xa42fa1=_0x1742d9[_0x44fd0f(0x1b4)](_0x44fd0f(0x198))[_0x44fd0f(0x193)]();if(_0xa42fa1===_0x44fd0f(0x1ad)||_0xa42fa1==='mybatisXml')return _0xa42fa1;if(_0x1742d9[_0x44fd0f(0x1ac)])throw CliErrors[_0x44fd0f(0x1b0)]('mode',_0x44fd0f(0x17d));return await select({'message':_0x44fd0f(0x1a6),'choices':[{'name':_0x44fd0f(0x1a2),'value':_0x44fd0f(0x1ad),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0x44fd0f(0x173),'value':'mybatisXml','description':'适合带动态标签的\x20MyBatis\x20XML\x20SQL'}]});}function serializeDbSelection(_0x2c6f34){const _0x354d39=a167_0x451451;return JSON[_0x354d39(0x187)]({'dbId':_0x2c6f34[_0x354d39(0x1aa)],'dbName':_0x2c6f34['dbName']});}function deserializeDbSelection(_0x285007){const _0x433963=a167_0x451451;try{const _0x36be6a=JSON[_0x433963(0x1a4)](_0x285007);if(typeof _0x36be6a[_0x433963(0x1aa)]===_0x433963(0x184)&&Number[_0x433963(0x18a)](_0x36be6a[_0x433963(0x1aa)]))return{'dbId':_0x36be6a[_0x433963(0x1aa)],'dbName':_0x36be6a[_0x433963(0x179)]};}catch{}throw CliErrors[_0x433963(0x181)](_0x433963(0x1a0)+_0x285007);}function resolveProvidedDbId(_0x130eea){const _0x3335a7=a167_0x451451,_0x199361=_0x130eea[_0x3335a7(0x18d)](_0x3335a7(0x189));if(typeof _0x199361===_0x3335a7(0x184)&&Number[_0x3335a7(0x18a)](_0x199361))return _0x199361;return undefined;}
@@ -1 +1 @@
1
- const a167_0x25af45=a167_0x27e6;(function(_0x2a29fb,_0x464055){const _0x8ad3af=a167_0x27e6,_0x22598d=_0x2a29fb();while(!![]){try{const _0x2b5193=parseInt(_0x8ad3af(0x12c))/0x1*(-parseInt(_0x8ad3af(0x132))/0x2)+parseInt(_0x8ad3af(0x12d))/0x3*(-parseInt(_0x8ad3af(0x14a))/0x4)+-parseInt(_0x8ad3af(0x148))/0x5+parseInt(_0x8ad3af(0x13a))/0x6+parseInt(_0x8ad3af(0x134))/0x7+-parseInt(_0x8ad3af(0x126))/0x8+-parseInt(_0x8ad3af(0x13f))/0x9*(-parseInt(_0x8ad3af(0x127))/0xa);if(_0x2b5193===_0x464055)break;else _0x22598d['push'](_0x22598d['shift']());}catch(_0x109617){_0x22598d['push'](_0x22598d['shift']());}}}(a167_0x2a0d,0xd218d));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a167_0x2a0d(){const _0x3b32c8=['92olKszu','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','8752872JkKkcR','6573030UxDAhL','Deleted\x20','entries','lockFilePath','filter','5LFcsmO','43473VgLzdT','SQL\x20lock\x20file\x20not\x20found.','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','startsWith','sqlRoot','86582qmGNMT','sqlRootDir','1383781sGhrBI','delete','fromEntries','appCode','str','sqlcode','1713654UlGsIH','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','projectRoot','toISOString','validation','36DKqnec','Would\x20delete\x20SQL\x20','lastSync','sql','length','replace','remoteId','\x20(local\x20file\x20moved\x20to\x20trash)','sqls','3040450pZaUqJ','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.'];a167_0x2a0d=function(){return _0x3b32c8;};return a167_0x2a0d();}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';function a167_0x27e6(_0x174d6b,_0x1650eb){_0x174d6b=_0x174d6b-0x126;const _0x2a0d11=a167_0x2a0d();let _0x27e63f=_0x2a0d11[_0x174d6b];return _0x27e63f;}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a167_0x25af45(0x142),'command':'delete','description':a167_0x25af45(0x14b),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x5e5592){const _0x2820a9=a167_0x25af45,_0x4b6158=loadSqlProjectConfig(_0x5e5592[_0x2820a9(0x137)]),_0xa7da8c=await readSqlLockFile(_0x4b6158['lockFilePath']);if(!_0xa7da8c)throw CliErrors[_0x2820a9(0x13e)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x2e1b8b){const _0x22abbd=a167_0x25af45,_0x5b4f67=loadSqlProjectConfig(_0x2e1b8b['appCode']),_0x1cdf40=await readSqlLockFile(_0x5b4f67[_0x22abbd(0x12a)]);if(!_0x1cdf40)throw CliErrors[_0x22abbd(0x13e)](_0x22abbd(0x149));const {appLock:_0x49ec92}=ensureSqlLockScope(_0x1cdf40,_0x2e1b8b[_0x22abbd(0x137)],_0x5b4f67[_0x22abbd(0x131)],_0x22abbd(0x135)),_0x2f5ca2=_0x2e1b8b[_0x22abbd(0x138)]('sqlcode'),_0x4cf386=_0x49ec92[_0x22abbd(0x147)][_0x2f5ca2];if(!_0x4cf386)throw CliErrors[_0x22abbd(0x13e)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x2f5ca2+'\x22.');return{'method':'POST','url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x2f5ca2,'id':_0x4cf386['remoteId'],'localPath':resolveLocalSqlFilePath(_0x5b4f67,_0x2f5ca2,_0x4cf386)},'description':_0x22abbd(0x140)+_0x2f5ca2+_0x22abbd(0x13b)+_0x5b4f67['trashDir']};},async 'execute'(_0x27791c){const _0x23e3c3=a167_0x25af45,_0x20b1fc=loadSqlProjectConfig(_0x27791c[_0x23e3c3(0x137)]),_0x269b03=await readSqlLockFile(_0x20b1fc[_0x23e3c3(0x12a)]);if(!_0x269b03)throw CliErrors['validation'](_0x23e3c3(0x12e));const {lockData:_0x1fa83c,appLock:_0x592b42}=ensureSqlLockScope(_0x269b03,_0x27791c[_0x23e3c3(0x137)],_0x20b1fc[_0x23e3c3(0x131)],_0x23e3c3(0x135)),_0x304e15=_0x27791c[_0x23e3c3(0x138)](_0x23e3c3(0x139)),_0x48e7fe=_0x592b42['sqls'][_0x304e15];if(!_0x48e7fe)throw CliErrors[_0x23e3c3(0x13e)](_0x23e3c3(0x12f)+_0x304e15+'\x22.');await deleteSqlQuery({'id':_0x48e7fe[_0x23e3c3(0x145)],'sqlCode':_0x304e15}),_0x592b42[_0x23e3c3(0x147)]=Object[_0x23e3c3(0x136)](Object[_0x23e3c3(0x129)](_0x592b42['sqls'])[_0x23e3c3(0x12b)](([_0x99571d])=>_0x99571d!==_0x304e15)),_0x592b42[_0x23e3c3(0x141)]=new Date()[_0x23e3c3(0x13d)](),await writeSqlLockFile(_0x20b1fc['lockFilePath'],_0x1fa83c);const _0x2bf8c9=resolveLocalSqlFilePath(_0x20b1fc,_0x304e15,_0x48e7fe);let _0x515e00;await fileExists(_0x2bf8c9)&&(_0x515e00=await moveToTrash(_0x20b1fc[_0x23e3c3(0x13c)],_0x20b1fc['trashDir'],_0x2bf8c9),await cleanupEmptyDirectories(dirname(_0x2bf8c9),_0x20b1fc[_0x23e3c3(0x133)]));const _0x340da6={'deleted':_0x304e15,'remoteId':_0x48e7fe[_0x23e3c3(0x145)]};if(_0x515e00)_0x340da6['trashedTo']=_0x515e00;return{'ok':!![],'data':_0x340da6,'message':_0x23e3c3(0x128)+_0x304e15+(_0x515e00?_0x23e3c3(0x146):'')};}};async function moveToTrash(_0x1e0936,_0x40d838,_0xed4bab){const _0x507f63=a167_0x25af45,_0xc93bc8=new Date()[_0x507f63(0x13d)]()[_0x507f63(0x144)](/[:.]/g,'-'),_0x2d0d61=relative(_0x1e0936,_0xed4bab),_0x10796d=join(_0x40d838,_0xc93bc8,_0x2d0d61);return await mkdir(dirname(_0x10796d),{'recursive':!![]}),await rename(_0xed4bab,_0x10796d),_0x10796d;}async function cleanupEmptyDirectories(_0x5281c3,_0x2aadc7){const _0x438973=a167_0x25af45;let _0x399ddd=resolve(_0x5281c3);const _0xf12f4b=resolve(_0x2aadc7);while(_0x399ddd[_0x438973(0x130)](''+_0xf12f4b+sep)||_0x399ddd===_0xf12f4b){if(_0x399ddd===_0xf12f4b)return;try{const _0x1bfdfb=await readdir(_0x399ddd);if(_0x1bfdfb[_0x438973(0x143)]>0x0)return;await rmdir(_0x399ddd);}catch{return;}_0x399ddd=dirname(_0x399ddd);}}
1
+ const a168_0x332e4f=a168_0x38b8;(function(_0x4ebae0,_0xa3c0f2){const _0x547b51=a168_0x38b8,_0x36fe23=_0x4ebae0();while(!![]){try{const _0x15a3b7=parseInt(_0x547b51(0x149))/0x1*(parseInt(_0x547b51(0x157))/0x2)+-parseInt(_0x547b51(0x136))/0x3*(-parseInt(_0x547b51(0x144))/0x4)+-parseInt(_0x547b51(0x155))/0x5+-parseInt(_0x547b51(0x13c))/0x6+-parseInt(_0x547b51(0x148))/0x7*(-parseInt(_0x547b51(0x137))/0x8)+parseInt(_0x547b51(0x14d))/0x9+parseInt(_0x547b51(0x141))/0xa*(-parseInt(_0x547b51(0x13f))/0xb);if(_0x15a3b7===_0xa3c0f2)break;else _0x36fe23['push'](_0x36fe23['shift']());}catch(_0x4784ef){_0x36fe23['push'](_0x36fe23['shift']());}}}(a168_0x3146,0x365c3));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';function a168_0x3146(){const _0x614b42=['384560yocdPh','lockFilePath','231484llpZFG','delete','Would\x20delete\x20SQL\x20','SQL\x20lock\x20file\x20not\x20found.','projectRoot','sqlcode','entries','sqlRoot','trashDir','82773uSHcfq','1892120hcKHyZ','lastSync','filter','high-risk-write','sqls','2524038LlIuus','remoteId','appCode','3113XgsUvQ','POST','11470aaJCSN','length','fromEntries','44jSbmEq','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','validation','replace','7yZACOP','2eIrWQN','\x20(local\x20file\x20moved\x20to\x20trash)','startsWith','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','2460105VqLSxX','str','sql','/smartapi/custom/deleteUserCustomSql','trashedTo','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','toISOString','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local'];a168_0x3146=function(){return _0x614b42;};return a168_0x3146();}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_0x38b8(_0x30dec9,_0x329f64){_0x30dec9=_0x30dec9-0x136;const _0x3146eb=a168_0x3146();let _0x38b8fa=_0x3146eb[_0x30dec9];return _0x38b8fa;}export const sqlDelete={'service':a168_0x332e4f(0x14f),'command':a168_0x332e4f(0x158),'description':a168_0x332e4f(0x154),'risk':a168_0x332e4f(0x13a),'flags':[SQLCODE_FLAG],async 'validate'(_0x5819f3){const _0xdd61ea=a168_0x332e4f,_0x30bdc1=loadSqlProjectConfig(_0x5819f3[_0xdd61ea(0x13e)]),_0x45aeae=await readSqlLockFile(_0x30bdc1['lockFilePath']);if(!_0x45aeae)throw CliErrors[_0xdd61ea(0x146)](_0xdd61ea(0x152));},async 'dryRun'(_0x5b694f){const _0x46b8df=a168_0x332e4f,_0x3ddf08=loadSqlProjectConfig(_0x5b694f[_0x46b8df(0x13e)]),_0x49f7aa=await readSqlLockFile(_0x3ddf08['lockFilePath']);if(!_0x49f7aa)throw CliErrors[_0x46b8df(0x146)](_0x46b8df(0x152));const {appLock:_0x1b2f62}=ensureSqlLockScope(_0x49f7aa,_0x5b694f[_0x46b8df(0x13e)],_0x3ddf08['sqlRoot'],_0x46b8df(0x158)),_0x2c8043=_0x5b694f[_0x46b8df(0x14e)]('sqlcode'),_0x187c1d=_0x1b2f62[_0x46b8df(0x13b)][_0x2c8043];if(!_0x187c1d)throw CliErrors['validation'](_0x46b8df(0x145)+_0x2c8043+'\x22.');return{'method':_0x46b8df(0x140),'url':_0x46b8df(0x150),'body':{'sqlCode':_0x2c8043,'id':_0x187c1d['remoteId'],'localPath':resolveLocalSqlFilePath(_0x3ddf08,_0x2c8043,_0x187c1d)},'description':_0x46b8df(0x159)+_0x2c8043+_0x46b8df(0x14c)+_0x3ddf08[_0x46b8df(0x15f)]};},async 'execute'(_0x266fc){const _0x1cba8e=a168_0x332e4f,_0x16ed58=loadSqlProjectConfig(_0x266fc[_0x1cba8e(0x13e)]),_0x4263ea=await readSqlLockFile(_0x16ed58[_0x1cba8e(0x156)]);if(!_0x4263ea)throw CliErrors[_0x1cba8e(0x146)](_0x1cba8e(0x15a));const {lockData:_0x18291f,appLock:_0x5a5cce}=ensureSqlLockScope(_0x4263ea,_0x266fc['appCode'],_0x16ed58[_0x1cba8e(0x15e)],_0x1cba8e(0x158)),_0x1bcb35=_0x266fc['str'](_0x1cba8e(0x15c)),_0x6f6396=_0x5a5cce[_0x1cba8e(0x13b)][_0x1bcb35];if(!_0x6f6396)throw CliErrors[_0x1cba8e(0x146)](_0x1cba8e(0x145)+_0x1bcb35+'\x22.');await deleteSqlQuery({'id':_0x6f6396[_0x1cba8e(0x13d)],'sqlCode':_0x1bcb35}),_0x5a5cce[_0x1cba8e(0x13b)]=Object[_0x1cba8e(0x143)](Object[_0x1cba8e(0x15d)](_0x5a5cce[_0x1cba8e(0x13b)])[_0x1cba8e(0x139)](([_0x7c73])=>_0x7c73!==_0x1bcb35)),_0x5a5cce[_0x1cba8e(0x138)]=new Date()['toISOString'](),await writeSqlLockFile(_0x16ed58[_0x1cba8e(0x156)],_0x18291f);const _0x4c1195=resolveLocalSqlFilePath(_0x16ed58,_0x1bcb35,_0x6f6396);let _0x5525ed;await fileExists(_0x4c1195)&&(_0x5525ed=await moveToTrash(_0x16ed58[_0x1cba8e(0x15b)],_0x16ed58['trashDir'],_0x4c1195),await cleanupEmptyDirectories(dirname(_0x4c1195),_0x16ed58['sqlRootDir']));const _0x7168bd={'deleted':_0x1bcb35,'remoteId':_0x6f6396['remoteId']};if(_0x5525ed)_0x7168bd[_0x1cba8e(0x151)]=_0x5525ed;return{'ok':!![],'data':_0x7168bd,'message':'Deleted\x20'+_0x1bcb35+(_0x5525ed?_0x1cba8e(0x14a):'')};}};async function moveToTrash(_0x3c8f43,_0x100696,_0x24baa2){const _0x446dc5=a168_0x332e4f,_0x9e8b24=new Date()[_0x446dc5(0x153)]()[_0x446dc5(0x147)](/[:.]/g,'-'),_0x56022a=relative(_0x3c8f43,_0x24baa2),_0x402a4d=join(_0x100696,_0x9e8b24,_0x56022a);return await mkdir(dirname(_0x402a4d),{'recursive':!![]}),await rename(_0x24baa2,_0x402a4d),_0x402a4d;}async function cleanupEmptyDirectories(_0x1b5513,_0x1f35fb){const _0x40b1cb=a168_0x332e4f;let _0x2a860b=resolve(_0x1b5513);const _0x52aa7e=resolve(_0x1f35fb);while(_0x2a860b[_0x40b1cb(0x14b)](''+_0x52aa7e+sep)||_0x2a860b===_0x52aa7e){if(_0x2a860b===_0x52aa7e)return;try{const _0x3d2d0c=await readdir(_0x2a860b);if(_0x3d2d0c[_0x40b1cb(0x142)]>0x0)return;await rmdir(_0x2a860b);}catch{return;}_0x2a860b=dirname(_0x2a860b);}}
@@ -1 +1 @@
1
- function a168_0x3174(_0x3b9cf2,_0x5dfede){_0x3b9cf2=_0x3b9cf2-0xe3;const _0x2563d2=a168_0x2563();let _0x3174d7=_0x2563d2[_0x3b9cf2];return _0x3174d7;}function a168_0x2563(){const _0x1ec165=['sqlcode','verbose','sql','sqlName','1317411CVomuf','28NKzCEs','sqlContent','166745FzlyXi','3vCEsNk','7145730tGvXVc','appCode','414144JiAuXQ','27145900LlCQKm','str','2277486LkAoSI','38278smPHaX','Return\x20full\x20raw\x20SQL\x20query\x20object','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','dbId','boolean','bool','detail','28KtbaSR'];a168_0x2563=function(){return _0x1ec165;};return a168_0x2563();}const a168_0x1821eb=a168_0x3174;(function(_0x309fdb,_0x2f8162){const _0x5a6150=a168_0x3174,_0x12f50e=_0x309fdb();while(!![]){try{const _0x28221a=-parseInt(_0x5a6150(0xed))/0x1+parseInt(_0x5a6150(0xf8))/0x2*(parseInt(_0x5a6150(0xf1))/0x3)+parseInt(_0x5a6150(0xee))/0x4*(parseInt(_0x5a6150(0xf0))/0x5)+-parseInt(_0x5a6150(0xf7))/0x6+parseInt(_0x5a6150(0xe8))/0x7*(parseInt(_0x5a6150(0xf4))/0x8)+-parseInt(_0x5a6150(0xf2))/0x9+parseInt(_0x5a6150(0xf5))/0xa;if(_0x28221a===_0x2f8162)break;else _0x12f50e['push'](_0x12f50e['shift']());}catch(_0x19c2c2){_0x12f50e['push'](_0x12f50e['shift']());}}}(a168_0x2563,0xa6d12));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a168_0x1821eb(0xeb),'command':a168_0x1821eb(0xe7),'description':a168_0x1821eb(0xe3),'risk':'read','flags':[SQLCODE_FLAG,{'name':a168_0x1821eb(0xea),'type':a168_0x1821eb(0xe5),'description':a168_0x1821eb(0xf9)}],async 'execute'(_0x4fb901){const _0x4a29ee=a168_0x1821eb,_0x68cc7b=await getSqlQueryInfo(_0x4fb901['appCode'],_0x4fb901[_0x4a29ee(0xf6)](_0x4a29ee(0xe9))),_0x147f0e=_0x4fb901[_0x4a29ee(0xe6)](_0x4a29ee(0xea));if(_0x147f0e)return{'ok':!![],'data':_0x68cc7b};const _0x1b4570=_0x68cc7b['dbId']?await getDbName(_0x4fb901[_0x4a29ee(0xf3)],_0x68cc7b[_0x4a29ee(0xe4)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x68cc7b['sqlCode'],'sqlName':_0x68cc7b[_0x4a29ee(0xec)],'db':_0x1b4570?_0x1b4570+'\x20('+_0x68cc7b[_0x4a29ee(0xe4)]+')':_0x68cc7b[_0x4a29ee(0xe4)]??'','description':_0x68cc7b['description']??'','sqlContent':_0x68cc7b[_0x4a29ee(0xef)]??''}};}};
1
+ const a169_0x2801a3=a169_0x4469;(function(_0x389311,_0x38939b){const _0x1ba09d=a169_0x4469,_0xd20a18=_0x389311();while(!![]){try{const _0x20ada1=-parseInt(_0x1ba09d(0x17c))/0x1+-parseInt(_0x1ba09d(0x18c))/0x2*(parseInt(_0x1ba09d(0x179))/0x3)+-parseInt(_0x1ba09d(0x18a))/0x4*(-parseInt(_0x1ba09d(0x18e))/0x5)+parseInt(_0x1ba09d(0x17b))/0x6*(parseInt(_0x1ba09d(0x180))/0x7)+parseInt(_0x1ba09d(0x188))/0x8*(-parseInt(_0x1ba09d(0x17f))/0x9)+parseInt(_0x1ba09d(0x17e))/0xa+parseInt(_0x1ba09d(0x18f))/0xb;if(_0x20ada1===_0x38939b)break;else _0xd20a18['push'](_0xd20a18['shift']());}catch(_0x31f633){_0xd20a18['push'](_0xd20a18['shift']());}}}(a169_0x25b3,0x1f1cf));function a169_0x25b3(){const _0x431083=['verbose','6GeGieP','234416uixOQO','boolean','1237660WggjaQ','9zlTvzt','164339dQsIQl','sqlCode','appCode','dbId','read','str','sql','description','819536xggDxM','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','52iQiowE','sqlName','6122LkkUFI','sqlcode','92635MbnBKs','1511653PavcXQ','bool','60GHkBjA'];a169_0x25b3=function(){return _0x431083;};return a169_0x25b3();}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a169_0x4469(_0x291d32,_0x5440fd){_0x291d32=_0x291d32-0x179;const _0x25b38d=a169_0x25b3();let _0x4469ed=_0x25b38d[_0x291d32];return _0x4469ed;}export const sqlDetail={'service':a169_0x2801a3(0x186),'command':'detail','description':a169_0x2801a3(0x189),'risk':a169_0x2801a3(0x184),'flags':[SQLCODE_FLAG,{'name':a169_0x2801a3(0x17a),'type':a169_0x2801a3(0x17d),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x5f42fb){const _0x1524d4=a169_0x2801a3,_0x31581a=await getSqlQueryInfo(_0x5f42fb['appCode'],_0x5f42fb[_0x1524d4(0x185)](_0x1524d4(0x18d))),_0x3d6bbc=_0x5f42fb[_0x1524d4(0x190)](_0x1524d4(0x17a));if(_0x3d6bbc)return{'ok':!![],'data':_0x31581a};const _0x116371=_0x31581a[_0x1524d4(0x183)]?await getDbName(_0x5f42fb[_0x1524d4(0x182)],_0x31581a['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x31581a[_0x1524d4(0x181)],'sqlName':_0x31581a[_0x1524d4(0x18b)],'db':_0x116371?_0x116371+'\x20('+_0x31581a['dbId']+')':_0x31581a[_0x1524d4(0x183)]??'','description':_0x31581a[_0x1524d4(0x187)]??'','sqlContent':_0x31581a['sqlContent']??''}};}};
@@ -1 +1 @@
1
- const a169_0x4cbc70=a169_0x1079;(function(_0x218212,_0xa0f34d){const _0x2ce25b=a169_0x1079,_0x32bf02=_0x218212();while(!![]){try{const _0x50e590=-parseInt(_0x2ce25b(0xe4))/0x1+parseInt(_0x2ce25b(0xe3))/0x2*(-parseInt(_0x2ce25b(0xe0))/0x3)+parseInt(_0x2ce25b(0xdb))/0x4*(-parseInt(_0x2ce25b(0xd1))/0x5)+parseInt(_0x2ce25b(0xdd))/0x6+parseInt(_0x2ce25b(0xda))/0x7+parseInt(_0x2ce25b(0xd3))/0x8*(parseInt(_0x2ce25b(0xd0))/0x9)+parseInt(_0x2ce25b(0xd9))/0xa;if(_0x50e590===_0xa0f34d)break;else _0x32bf02['push'](_0x32bf02['shift']());}catch(_0x177bd3){_0x32bf02['push'](_0x32bf02['shift']());}}}(a169_0x4597,0xb4012));function a169_0x1079(_0x3a4924,_0x2e1e48){_0x3a4924=_0x3a4924-0xcb;const _0x459719=a169_0x4597();let _0x107914=_0x459719[_0x3a4924];return _0x107914;}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a169_0x4597(){const _0x405e0a=['\x20row(s)\x20in\x20','params','appCode','now','24234640XEKMWJ','5051921HdFaHR','2080060utIuVT','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','599370pUntsh','length','isArray','2962887rzNOQo','execResult','read','2wlAncK','1391165OkmpcF','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','str','exec','sql','Returned\x20','3573Udtlra','5NvubFX','SQL\x20execution\x20failed','7880filxCX','string'];a169_0x4597=function(){return _0x405e0a;};return a169_0x4597();}export const sqlExec={'service':a169_0x4cbc70(0xce),'command':a169_0x4cbc70(0xcd),'description':a169_0x4cbc70(0xcb),'risk':a169_0x4cbc70(0xe2),'flags':[SQLCODE_FLAG,{'name':a169_0x4cbc70(0xd6),'type':a169_0x4cbc70(0xd4),'description':a169_0x4cbc70(0xdc)}],async 'execute'(_0x1197b5){const _0x2c67eb=a169_0x4cbc70,_0x11d2e8=parseJsonParams(_0x1197b5[_0x2c67eb(0xcc)](_0x2c67eb(0xd6))),_0x3b15e1=Date['now'](),_0x5335d3=await executeSql(_0x1197b5[_0x2c67eb(0xd7)],_0x1197b5[_0x2c67eb(0xcc)]('sqlcode'),_0x11d2e8),_0x38320e=Date[_0x2c67eb(0xd8)]()-_0x3b15e1,_0x3e55df=_0x5335d3?.[_0x2c67eb(0xe1)]??_0x5335d3,_0x3e83f7=_0x5335d3?.['execSuccess']??!![];if(!_0x3e83f7)return{'ok':![],'data':{'error':_0x5335d3?.['execError']||_0x2c67eb(0xd2),'elapsed':_0x38320e},'message':_0x2c67eb(0xd2)};const _0x492a66=Array[_0x2c67eb(0xdf)](_0x3e55df)?_0x3e55df:[];return{'ok':!![],'data':{'rows':_0x492a66,'rowCount':_0x492a66['length'],'elapsed':_0x38320e},'message':_0x2c67eb(0xcf)+_0x492a66[_0x2c67eb(0xde)]+_0x2c67eb(0xd5)+_0x38320e+'ms'};}};
1
+ function a170_0x2684(_0x167c9b,_0x2d0f12){_0x167c9b=_0x167c9b-0x164;const _0x68f18e=a170_0x68f1();let _0x2684ac=_0x68f18e[_0x167c9b];return _0x2684ac;}const a170_0x544b74=a170_0x2684;(function(_0x2058f5,_0x21aeeb){const _0x4b607b=a170_0x2684,_0xd51805=_0x2058f5();while(!![]){try{const _0x2145d8=-parseInt(_0x4b607b(0x177))/0x1+-parseInt(_0x4b607b(0x176))/0x2+-parseInt(_0x4b607b(0x165))/0x3+-parseInt(_0x4b607b(0x16e))/0x4+parseInt(_0x4b607b(0x16a))/0x5+-parseInt(_0x4b607b(0x164))/0x6+-parseInt(_0x4b607b(0x167))/0x7*(-parseInt(_0x4b607b(0x16f))/0x8);if(_0x2145d8===_0x21aeeb)break;else _0xd51805['push'](_0xd51805['shift']());}catch(_0x2c22ed){_0xd51805['push'](_0xd51805['shift']());}}}(a170_0x68f1,0x7494f));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a170_0x68f1(){const _0x66cd8b=['28qoXUBA','SQL\x20execution\x20failed','Returned\x20','4206785KaDDMj','now','sql','sqlcode','3723808sekyiZ','4191024jiOyHx','params','\x20row(s)\x20in\x20','string','str','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','execError','1174530blSDJp','261594RHxJll','execResult','length','1783806YVCDhk','1146714HbfWRE','appCode'];a170_0x68f1=function(){return _0x66cd8b;};return a170_0x68f1();}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a170_0x544b74(0x16c),'command':'exec','description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':'read','flags':[SQLCODE_FLAG,{'name':a170_0x544b74(0x170),'type':a170_0x544b74(0x172),'description':a170_0x544b74(0x174)}],async 'execute'(_0x51c5d4){const _0xeb178d=a170_0x544b74,_0x2f7a6c=parseJsonParams(_0x51c5d4[_0xeb178d(0x173)]('params')),_0x22427=Date[_0xeb178d(0x16b)](),_0x32b553=await executeSql(_0x51c5d4[_0xeb178d(0x166)],_0x51c5d4[_0xeb178d(0x173)](_0xeb178d(0x16d)),_0x2f7a6c),_0x58b948=Date[_0xeb178d(0x16b)]()-_0x22427,_0x48cd83=_0x32b553?.[_0xeb178d(0x178)]??_0x32b553,_0x5c14b5=_0x32b553?.['execSuccess']??!![];if(!_0x5c14b5)return{'ok':![],'data':{'error':_0x32b553?.[_0xeb178d(0x175)]||_0xeb178d(0x168),'elapsed':_0x58b948},'message':_0xeb178d(0x168)};const _0x1abb1e=Array['isArray'](_0x48cd83)?_0x48cd83:[];return{'ok':!![],'data':{'rows':_0x1abb1e,'rowCount':_0x1abb1e[_0xeb178d(0x179)],'elapsed':_0x58b948},'message':_0xeb178d(0x169)+_0x1abb1e[_0xeb178d(0x179)]+_0xeb178d(0x171)+_0x58b948+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x337afa,_0x35f2f0){const _0x1f5cbb=a170_0x2820,_0x16d2ef=_0x337afa();while(!![]){try{const _0x50ff2d=-parseInt(_0x1f5cbb(0x93))/0x1+-parseInt(_0x1f5cbb(0x8e))/0x2*(-parseInt(_0x1f5cbb(0x8d))/0x3)+parseInt(_0x1f5cbb(0x8f))/0x4*(-parseInt(_0x1f5cbb(0x8a))/0x5)+parseInt(_0x1f5cbb(0x92))/0x6*(-parseInt(_0x1f5cbb(0x90))/0x7)+parseInt(_0x1f5cbb(0x8c))/0x8+-parseInt(_0x1f5cbb(0x91))/0x9+parseInt(_0x1f5cbb(0x8b))/0xa;if(_0x50ff2d===_0x35f2f0)break;else _0x16d2ef['push'](_0x16d2ef['shift']());}catch(_0x5e6e7d){_0x16d2ef['push'](_0x16d2ef['shift']());}}}(a170_0x4fc5,0x5884a));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';function a170_0x4fc5(){const _0x10c92e=['35kfQdqQ','11996280etAeYs','3779064XsyKDX','156306dAOjRW','4xNnUWd','183184GOUxBd','77GQAXnC','2548116kMGBZE','193092xCYYbh','455947gZSXxT'];a170_0x4fc5=function(){return _0x10c92e;};return a170_0x4fc5();}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';function a170_0x2820(_0x3bb88a,_0x46cea5){_0x3bb88a=_0x3bb88a-0x8a;const _0x4fc582=a170_0x4fc5();let _0x282083=_0x4fc582[_0x3bb88a];return _0x282083;}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
+ (function(_0x44a937,_0xb07195){const _0x50e4c3=a171_0x377e,_0x1bbf1a=_0x44a937();while(!![]){try{const _0x801d45=-parseInt(_0x50e4c3(0x132))/0x1+parseInt(_0x50e4c3(0x137))/0x2+-parseInt(_0x50e4c3(0x134))/0x3+-parseInt(_0x50e4c3(0x139))/0x4+parseInt(_0x50e4c3(0x138))/0x5+-parseInt(_0x50e4c3(0x136))/0x6+parseInt(_0x50e4c3(0x135))/0x7*(parseInt(_0x50e4c3(0x133))/0x8);if(_0x801d45===_0xb07195)break;else _0x1bbf1a['push'](_0x1bbf1a['shift']());}catch(_0x5e77ed){_0x1bbf1a['push'](_0x1bbf1a['shift']());}}}(a171_0x44b9,0x511b0));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a171_0x377e(_0x148a41,_0x5c5e2c){_0x148a41=_0x148a41-0x132;const _0x44b9b8=a171_0x44b9();let _0x377ee2=_0x44b9b8[_0x148a41];return _0x377ee2;}import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';function a171_0x44b9(){const _0x1a0608=['226482fCbOSs','5234qZsBru','3265265csQFqO','652740AxQxQx','205526WPnMAm','8LaOzLE','1165071xrWRRB','3299471mCmtbt'];a171_0x44b9=function(){return _0x1a0608;};return a171_0x44b9();}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 a171_0x454035=a171_0x5092;(function(_0x3b7dea,_0x5cb2cb){const _0x5f5d0c=a171_0x5092,_0xf77215=_0x3b7dea();while(!![]){try{const _0x209579=-parseInt(_0x5f5d0c(0x167))/0x1*(parseInt(_0x5f5d0c(0x16d))/0x2)+-parseInt(_0x5f5d0c(0x16f))/0x3+-parseInt(_0x5f5d0c(0x171))/0x4*(-parseInt(_0x5f5d0c(0x160))/0x5)+-parseInt(_0x5f5d0c(0x177))/0x6+-parseInt(_0x5f5d0c(0x16a))/0x7*(parseInt(_0x5f5d0c(0x16e))/0x8)+parseInt(_0x5f5d0c(0x166))/0x9+parseInt(_0x5f5d0c(0x170))/0xa;if(_0x209579===_0x5cb2cb)break;else _0xf77215['push'](_0xf77215['shift']());}catch(_0x293501){_0xf77215['push'](_0xf77215['shift']());}}}(a171_0x45f6,0x87ac0));import{listSqlQueries}from'../../core/api-client.js';function a171_0x45f6(){const _0x1e5e1d=['19035070PRbqlF','74956XElukA','tableData','dbId','string','Filter\x20by\x20SQL\x20name','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','4156980lzbSxc','Page\x20size','Found\x20','\x20SQL\x20queries\x20(total:\x20','str','sqlCode','length','sqlName','number','45PmQPzY','verbose','boolean','sql','name','bool','9221724HJyaCP','3xlpAuj','No\x20custom\x20SQL\x20queries\x20found.','appCode','1475159eJIniV','read','page','686130HRDNxn','16fBFHcb','1192749zSHXHK'];a171_0x45f6=function(){return _0x1e5e1d;};return a171_0x45f6();}function a171_0x5092(_0x54aa9b,_0x596d46){_0x54aa9b=_0x54aa9b-0x15c;const _0x45f656=a171_0x45f6();let _0x509260=_0x45f656[_0x54aa9b];return _0x509260;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a171_0x454035(0x163),'command':'list','description':'List\x20custom\x20SQL\x20queries','risk':a171_0x454035(0x16b),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a171_0x454035(0x164),'type':a171_0x454035(0x174),'description':a171_0x454035(0x175)},{'name':a171_0x454035(0x16c),'type':a171_0x454035(0x15f),'description':'Page\x20number','default':0x1},{'name':'pagesize','type':a171_0x454035(0x15f),'description':a171_0x454035(0x178)},{'name':a171_0x454035(0x161),'type':a171_0x454035(0x162),'description':a171_0x454035(0x176)}],async 'execute'(_0x38736d){const _0x205fa7=a171_0x454035,_0x40567c=await listSqlQueries(_0x38736d[_0x205fa7(0x169)],{'sqlCode':_0x38736d[_0x205fa7(0x17b)]('sqlcode')||undefined,'sqlName':_0x38736d[_0x205fa7(0x17b)](_0x205fa7(0x164))||undefined,'currentPage':_0x38736d['num']('page'),'pageSize':_0x38736d['num']('pagesize',0x32)}),_0x3eb8a0=_0x38736d[_0x205fa7(0x165)](_0x205fa7(0x161)),_0x23dfe3=_0x40567c[_0x205fa7(0x172)]??[],_0x52d688=_0x40567c['paging']?.['totalCount']??_0x23dfe3['length'];let _0x6386f2;return _0x3eb8a0?_0x6386f2=_0x23dfe3:_0x6386f2=await Promise['all'](_0x23dfe3['map'](async _0x3dbb56=>{const _0x287199=_0x205fa7;let _0x43dd4b;try{_0x43dd4b=_0x3dbb56[_0x287199(0x173)]?await getDbName(_0x38736d['appCode'],_0x3dbb56[_0x287199(0x173)]):undefined;}catch{}return{'sqlCode':_0x3dbb56[_0x287199(0x15c)],'sqlName':_0x3dbb56[_0x287199(0x15e)],'description':_0x3dbb56['description']??'','db':_0x43dd4b?_0x43dd4b+'\x20('+_0x3dbb56[_0x287199(0x173)]+')':_0x3dbb56[_0x287199(0x173)]??''};})),{'ok':!![],'data':_0x6386f2,'message':_0x23dfe3['length']===0x0?_0x205fa7(0x168):_0x205fa7(0x179)+_0x23dfe3[_0x205fa7(0x15d)]+_0x205fa7(0x17a)+_0x52d688+').'};}};
1
+ const a172_0x50aaaa=a172_0x30bf;(function(_0x283277,_0x1bec65){const _0x11d575=a172_0x30bf,_0x4f9166=_0x283277();while(!![]){try{const _0x37790e=-parseInt(_0x11d575(0x14a))/0x1*(parseInt(_0x11d575(0x13b))/0x2)+-parseInt(_0x11d575(0x158))/0x3*(-parseInt(_0x11d575(0x156))/0x4)+parseInt(_0x11d575(0x136))/0x5*(-parseInt(_0x11d575(0x154))/0x6)+-parseInt(_0x11d575(0x13d))/0x7+parseInt(_0x11d575(0x153))/0x8*(parseInt(_0x11d575(0x138))/0x9)+parseInt(_0x11d575(0x145))/0xa*(parseInt(_0x11d575(0x144))/0xb)+parseInt(_0x11d575(0x140))/0xc;if(_0x37790e===_0x1bec65)break;else _0x4f9166['push'](_0x4f9166['shift']());}catch(_0x33f011){_0x4f9166['push'](_0x4f9166['shift']());}}}(a172_0x10fd,0x31a58));function a172_0x30bf(_0xf3435,_0x4f3476){_0xf3435=_0xf3435-0x136;const _0x10fd46=a172_0x10fd();let _0x30bf17=_0x10fd46[_0xf3435];return _0x30bf17;}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a172_0x10fd(){const _0x47ccac=['dbId','12rApwGp','string','339348BJBEzm','5wjLRGR','pagesize','11673ysEYgy','sqlName','List\x20custom\x20SQL\x20queries','2764gOBPhV','appCode','2281083XDPqbT','length','sqlCode','4203816KOstaz','Page\x20number','\x20SQL\x20queries\x20(total:\x20','Found\x20','28083VWiGKM','470dyjpNT','name','Page\x20size','boolean','num','97CaSBqm','read','bool','Filter\x20by\x20SQL\x20name','all','No\x20custom\x20SQL\x20queries\x20found.','sql','sqlcode','page','1304JozPiF','2146758Qdnvee'];a172_0x10fd=function(){return _0x47ccac;};return a172_0x10fd();}export const sqlList={'service':a172_0x50aaaa(0x150),'command':'list','description':a172_0x50aaaa(0x13a),'risk':a172_0x50aaaa(0x14b),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a172_0x50aaaa(0x146),'type':a172_0x50aaaa(0x157),'description':a172_0x50aaaa(0x14d)},{'name':a172_0x50aaaa(0x152),'type':'number','description':a172_0x50aaaa(0x141),'default':0x1},{'name':'pagesize','type':'number','description':a172_0x50aaaa(0x147)},{'name':'verbose','type':a172_0x50aaaa(0x148),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x63dfe8){const _0x189dce=a172_0x50aaaa,_0x49308d=await listSqlQueries(_0x63dfe8[_0x189dce(0x13c)],{'sqlCode':_0x63dfe8['str'](_0x189dce(0x151))||undefined,'sqlName':_0x63dfe8['str'](_0x189dce(0x146))||undefined,'currentPage':_0x63dfe8['num'](_0x189dce(0x152)),'pageSize':_0x63dfe8[_0x189dce(0x149)](_0x189dce(0x137),0x32)}),_0x164308=_0x63dfe8[_0x189dce(0x14c)]('verbose'),_0x711d17=_0x49308d['tableData']??[],_0x2ce5d7=_0x49308d['paging']?.['totalCount']??_0x711d17[_0x189dce(0x13e)];let _0x2573e1;return _0x164308?_0x2573e1=_0x711d17:_0x2573e1=await Promise[_0x189dce(0x14e)](_0x711d17['map'](async _0x142504=>{const _0x6c7b5c=_0x189dce;let _0x1410b5;try{_0x1410b5=_0x142504['dbId']?await getDbName(_0x63dfe8[_0x6c7b5c(0x13c)],_0x142504[_0x6c7b5c(0x155)]):undefined;}catch{}return{'sqlCode':_0x142504[_0x6c7b5c(0x13f)],'sqlName':_0x142504[_0x6c7b5c(0x139)],'description':_0x142504['description']??'','db':_0x1410b5?_0x1410b5+'\x20('+_0x142504[_0x6c7b5c(0x155)]+')':_0x142504[_0x6c7b5c(0x155)]??''};})),{'ok':!![],'data':_0x2573e1,'message':_0x711d17[_0x189dce(0x13e)]===0x0?_0x189dce(0x14f):_0x189dce(0x143)+_0x711d17[_0x189dce(0x13e)]+_0x189dce(0x142)+_0x2ce5d7+').'};}};
@@ -1 +1 @@
1
- const a172_0x198c14=a172_0x17af;function a172_0x17af(_0x47e8e4,_0x3bbc27){_0x47e8e4=_0x47e8e4-0x105;const _0x4762ca=a172_0x4762();let _0x17af51=_0x4762ca[_0x47e8e4];return _0x17af51;}(function(_0x5a673e,_0xa925fe){const _0x241e32=a172_0x17af,_0x5c421b=_0x5a673e();while(!![]){try{const _0x11de17=-parseInt(_0x241e32(0x10a))/0x1*(-parseInt(_0x241e32(0x115))/0x2)+parseInt(_0x241e32(0x110))/0x3*(-parseInt(_0x241e32(0x138))/0x4)+-parseInt(_0x241e32(0x12f))/0x5*(-parseInt(_0x241e32(0x12a))/0x6)+-parseInt(_0x241e32(0x144))/0x7+-parseInt(_0x241e32(0x13e))/0x8+parseInt(_0x241e32(0x112))/0x9*(-parseInt(_0x241e32(0x13f))/0xa)+-parseInt(_0x241e32(0x137))/0xb*(-parseInt(_0x241e32(0x11c))/0xc);if(_0x11de17===_0xa925fe)break;else _0x5c421b['push'](_0x5c421b['shift']());}catch(_0x26fc48){_0x5c421b['push'](_0x5c421b['shift']());}}}(a172_0x4762,0xe108c));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x13e1c1,_0x1fed43){const _0x40015f=a172_0x17af,_0xc77ffa=[];let _0x5cb7f8=0x1;while(!![]){const _0xe1b409=await listSqlQueries(_0x13e1c1,{'currentPage':_0x5cb7f8,'pageSize':PAGE_SIZE,'sqlCode':_0x1fed43[_0x40015f(0x118)],'sqlName':_0x1fed43[_0x40015f(0x111)]}),_0x17309f=_0xe1b409[_0x40015f(0x13b)]??[];_0xc77ffa[_0x40015f(0x119)](..._0x17309f);if(_0x17309f[_0x40015f(0x107)]===0x0)break;const _0x44165a=_0xe1b409[_0x40015f(0x120)]?.[_0x40015f(0x12d)];if(_0x44165a!=null?_0xc77ffa[_0x40015f(0x107)]>=_0x44165a:_0x17309f['length']<PAGE_SIZE)break;_0x5cb7f8++;}return _0xc77ffa;}async function ensureSqlContent(_0x387a85){const _0x9aac6e=a172_0x17af;if(_0x387a85[_0x9aac6e(0x117)]!=null&&String(_0x387a85[_0x9aac6e(0x117)])['length']>0x0)return _0x387a85;return getSqlQueryDetail(_0x387a85[_0x9aac6e(0x118)]);}export const sqlPull={'service':a172_0x198c14(0x141),'command':a172_0x198c14(0x11a),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a172_0x198c14(0x11b),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a172_0x198c14(0x126),'type':a172_0x198c14(0x134),'description':a172_0x198c14(0x108)},{'name':a172_0x198c14(0x132),'type':a172_0x198c14(0x13c),'description':a172_0x198c14(0x10f)}],async 'dryRun'(_0xd2eee1){const _0x442026=a172_0x198c14,_0x140b69=loadSqlProjectConfig(_0xd2eee1['appCode']),_0x3e0c27=await readSqlLockFile(_0x140b69['lockFilePath']),{appLock:_0x30fa7f}=ensureSqlLockScope(_0x3e0c27??createEmptySqlLock(),_0x140b69['appCode'],_0x140b69[_0x442026(0x142)],_0x442026(0x11a)),_0x507865=await fetchAllSqlQueries(_0xd2eee1['appCode'],{'sqlCode':_0xd2eee1[_0x442026(0x109)](_0x442026(0x127))||undefined,'sqlName':_0xd2eee1[_0x442026(0x109)](_0x442026(0x126))||undefined}),_0xc563eb=[];for(const _0x4e03c2 of _0x507865){const _0x1e4de0=await ensureSqlContent(_0x4e03c2),_0x3297a3=ensureRemoteSqlContent(_0x1e4de0),_0x5c2344=detectModeFromSql(_0x1e4de0),_0x4967bd=_0x1e4de0['dbId']?await getDbName(_0xd2eee1[_0x442026(0x11e)],Number(_0x1e4de0[_0x442026(0x116)]))[_0x442026(0x11f)](()=>undefined):undefined,_0xeed0db=buildLocalSqlFileContent({'sqlCode':_0x1e4de0['sqlCode'],'sqlName':_0x1e4de0[_0x442026(0x111)],'dbId':_0x1e4de0[_0x442026(0x116)]},_0x3297a3,{'dbName':_0x4967bd,'mode':_0x5c2344,'syncedAt':new Date()['toISOString'](),'description':_0x1e4de0[_0x442026(0x13d)]}),_0x50acdf=buildSqlLockEntry(_0x1e4de0,_0x3297a3,'',{'dbName':_0x4967bd}),_0x320bc5=resolveLocalSqlFilePath(_0x140b69,_0x1e4de0['sqlCode'],_0x50acdf);let _0x438718=_0x442026(0x10c),_0x43478c;if(await fileExists(_0x320bc5)){const _0x4fe838=await readFile(_0x320bc5,'utf8');isEquivalentPulledSqlFile(_0x4fe838,_0xeed0db,_0x5c2344)?(_0x438718=_0x442026(0x130),_0x43478c=_0x442026(0x106)):(_0x438718='conflict',_0x43478c=_0x442026(0x140));}_0xc563eb[_0x442026(0x119)]({'sqlCode':_0x1e4de0[_0x442026(0x118)],'sqlName':_0x1e4de0[_0x442026(0x111)],'filePath':_0x320bc5,'status':_0x438718,'reason':_0x43478c});}return{'method':_0x442026(0x10d),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0xd2eee1[_0x442026(0x11e)],'sqlCode':_0xd2eee1[_0x442026(0x109)]('sqlcode')||null,'sqlName':_0xd2eee1['str']('name')||null,'files':_0xc563eb},'description':_0x442026(0x10e)+_0xc563eb[_0x442026(0x107)]+_0x442026(0x145)+_0x140b69['sqlRootDir']};},async 'execute'(_0x139a0b){const _0x271d68=a172_0x198c14,_0x5bcaed=loadSqlProjectConfig(_0x139a0b[_0x271d68(0x11e)]),_0x264e51=await readSqlLockFile(_0x5bcaed[_0x271d68(0x121)]),{lockData:_0x1c7cbd,appLock:_0x28bd1f}=ensureSqlLockScope(_0x264e51??createEmptySqlLock(),_0x5bcaed[_0x271d68(0x11e)],_0x5bcaed[_0x271d68(0x142)],_0x271d68(0x11a)),_0x2afb0b=_0x139a0b['bool'](_0x271d68(0x132)),_0x5363d0=await fetchAllSqlQueries(_0x139a0b[_0x271d68(0x11e)],{'sqlCode':_0x139a0b[_0x271d68(0x109)](_0x271d68(0x127))||undefined,'sqlName':_0x139a0b['str'](_0x271d68(0x126))||undefined});if(_0x5363d0[_0x271d68(0x107)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x271d68(0x128)};const _0x5dc5e9=[],_0x10d60c=[];for(const _0x35f9a4 of _0x5363d0){try{_0x5dc5e9[_0x271d68(0x119)](await ensureSqlContent(_0x35f9a4));}catch(_0x2ee05e){_0x10d60c[_0x271d68(0x119)]({'sqlCode':_0x35f9a4[_0x271d68(0x118)],'error':_0x2ee05e instanceof Error?_0x2ee05e['message']:String(_0x2ee05e)});}}if(_0x2afb0b&&!_0x139a0b[_0x271d68(0x12c)]){let _0x296790=![];for(const _0x119797 of _0x5dc5e9){const _0x19758d=detectModeFromSql(_0x119797),_0x47893b=_0x119797[_0x271d68(0x116)]?await getDbName(_0x139a0b['appCode'],Number(_0x119797[_0x271d68(0x116)]))[_0x271d68(0x11f)](()=>undefined):undefined,_0x229a22=buildLocalSqlFileContent({'sqlCode':_0x119797[_0x271d68(0x118)],'sqlName':_0x119797[_0x271d68(0x111)],'dbId':_0x119797[_0x271d68(0x116)]},ensureRemoteSqlContent(_0x119797),{'dbName':_0x47893b,'mode':_0x19758d,'syncedAt':new Date()[_0x271d68(0x114)](),'description':_0x119797['description']}),_0x3f86b0=resolveLocalSqlFilePath(_0x5bcaed,_0x119797[_0x271d68(0x118)],buildSqlLockEntry(_0x119797,ensureRemoteSqlContent(_0x119797),'',{'dbName':_0x47893b}));if(await fileExists(_0x3f86b0)){const _0x28ed9f=await readFile(_0x3f86b0,_0x271d68(0x131));if(!isEquivalentPulledSqlFile(_0x28ed9f,_0x229a22,_0x19758d)){_0x296790=!![];break;}}}if(_0x296790){const _0x3a3aa4=await confirmForceOverwrite(_0x271d68(0x13a));if(!_0x3a3aa4)throw CliErrors[_0x271d68(0x129)]('Force\x20pull\x20cancelled.');}}const _0x173da6=cloneSqlLockData(_0x1c7cbd),_0x33da70=_0x173da6[_0x271d68(0x124)][_0x5bcaed[_0x271d68(0x11e)]],_0x247d79=[],_0x2bbe05=[];for(const _0xb52b01 of _0x5dc5e9){const _0x55b60d=_0x33da70[_0x271d68(0x143)][_0xb52b01[_0x271d68(0x118)]],_0x54e71b=ensureRemoteSqlContent(_0xb52b01),_0x19cf5f=detectModeFromSql(_0xb52b01),_0x4209df=_0xb52b01[_0x271d68(0x116)]?await getDbName(_0x139a0b[_0x271d68(0x11e)],Number(_0xb52b01[_0x271d68(0x116)]))[_0x271d68(0x11f)](()=>undefined):undefined,_0x30425b=buildLocalSqlFileContent({'sqlCode':_0xb52b01[_0x271d68(0x118)],'sqlName':_0xb52b01[_0x271d68(0x111)],'dbId':_0xb52b01[_0x271d68(0x116)]},_0x54e71b,{'dbName':_0x4209df,'mode':_0x19cf5f,'syncedAt':new Date()[_0x271d68(0x114)](),'description':_0xb52b01[_0x271d68(0x13d)]}),_0x4bff0f=buildSqlLockEntry(_0xb52b01,_0x54e71b,computeSqlContentHash(_0x30425b),{'dbName':_0x4209df}),_0x53eb11=_0x4bff0f[_0x271d68(0x12e)],_0x5a8a94=join(_0x5bcaed[_0x271d68(0x133)],_0x53eb11);try{if(await fileExists(_0x5a8a94)){const _0x49e9d2=await readFile(_0x5a8a94,_0x271d68(0x131));if(isEquivalentPulledSqlFile(_0x49e9d2,_0x30425b,_0x19cf5f)){_0x2bbe05[_0x271d68(0x119)]({'sqlCode':_0xb52b01[_0x271d68(0x118)],'reason':'unchanged'}),_0x33da70[_0x271d68(0x143)][_0xb52b01[_0x271d68(0x118)]]={..._0x4bff0f,'hash':computeSqlContentHash(_0x49e9d2),'path':_0x53eb11};continue;}if(!_0x2afb0b){_0x2bbe05['push']({'sqlCode':_0xb52b01['sqlCode'],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x588e20=_0x55b60d?.[_0x271d68(0x12e)]?join(_0x5bcaed[_0x271d68(0x133)],_0x55b60d['path']):undefined;_0x588e20&&_0x588e20!==_0x5a8a94&&await fileExists(_0x588e20)&&await rm(_0x588e20,{'force':!![]}),await ensureParentDirectory(_0x5a8a94),await writeFile(_0x5a8a94,_0x30425b,_0x271d68(0x131)),_0x33da70[_0x271d68(0x143)][_0xb52b01[_0x271d68(0x118)]]={..._0x4bff0f,'path':_0x53eb11},_0x247d79[_0x271d68(0x119)]({'sqlCode':_0xb52b01[_0x271d68(0x118)],'filePath':_0x5a8a94});}catch(_0x1612f6){_0x10d60c[_0x271d68(0x119)]({'sqlCode':_0xb52b01[_0x271d68(0x118)],'error':_0x1612f6 instanceof Error?_0x1612f6[_0x271d68(0x123)]:String(_0x1612f6)});}}return _0x33da70[_0x271d68(0x122)]=new Date()[_0x271d68(0x114)](),await writeSqlLockFile(_0x5bcaed[_0x271d68(0x121)],_0x173da6),{'ok':_0x10d60c[_0x271d68(0x107)]===0x0,'data':{'pulled':_0x247d79,'skipped':_0x2bbe05,'failed':_0x10d60c},'message':_0x271d68(0x136)+_0x247d79[_0x271d68(0x107)]+_0x271d68(0x105)+_0x2bbe05[_0x271d68(0x107)]+_0x271d68(0x139)+_0x10d60c[_0x271d68(0x107)]+_0x271d68(0x10b)};}};function detectModeFromSql(_0x4f07ea){const _0x3c13e7=a172_0x198c14,_0x5d28b9=ensureRemoteSqlContent(_0x4f07ea),_0x337f85=stripLocalSqlMetadata(_0x5d28b9,_0x3c13e7(0x135))['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x3c13e7(0x125)](_0x337f85))return _0x3c13e7(0x135);return _0x3c13e7(0x141);}function isEquivalentPulledSqlFile(_0x1cd122,_0x427c66,_0x37b588){return normalizePullComparableContent(_0x1cd122,_0x37b588)===normalizePullComparableContent(_0x427c66,_0x37b588);}function normalizePullComparableContent(_0x15f3c3,_0x344ac5){const _0x44c08e=a172_0x198c14,_0x4fc601=_0x15f3c3['replace'](/\r\n/g,'\x0a')[_0x44c08e(0x113)]('\x0a'),_0x50fc38=_0x4fc601[_0x44c08e(0x11d)](_0x527b7b=>!isSyncedAtMetadataLine(_0x527b7b,_0x344ac5));return _0x50fc38[_0x44c08e(0x12b)]('\x0a');}function a172_0x4762(){const _0x27442a=['split','toISOString','10mJnXNL','dbId','sqlContent','sqlCode','push','pull','write','12gLCmYZ','filter','appCode','catch','paging','lockFilePath','lastSync','message','apps','test','name','sqlcode','No\x20remote\x20SQL\x20queries\x20matched.','cancelled','4029708ECbpPa','join','nonInteractive','totalCount','path','10ExVJkP','skipped','utf8','force','sqlRootDir','string','mybatisXml','Pull\x20complete:\x20','44506330GdMwBD','2012352XEPETh','\x20skipped,\x20','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','tableData','boolean','description','7752888kayXqW','3160900ZwckFN','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sql','sqlRoot','sqls','10595137niOFuO','\x20SQL\x20file(s)\x20into\x20','\x20written,\x20','unchanged','length','Filter\x20by\x20SQL\x20display\x20name','str','31324DibiSq','\x20failed','would_pull','POST','Would\x20pull\x20','Force\x20overwrite\x20local\x20unsynced\x20changes','9abqzIX','sqlName','18abJYpZ'];a172_0x4762=function(){return _0x27442a;};return a172_0x4762();}function isSyncedAtMetadataLine(_0x37867e,_0x37c40a){const _0x27b94a=a172_0x198c14;if(_0x37c40a===_0x27b94a(0x135))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x27b94a(0x125)](_0x37867e);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x37867e);}
1
+ const a173_0x10c41d=a173_0x258e;function a173_0x258e(_0x234a14,_0x52dfa1){_0x234a14=_0x234a14-0x94;const _0x3a0608=a173_0x3a06();let _0x258e61=_0x3a0608[_0x234a14];return _0x258e61;}(function(_0x35ae67,_0x4e46ef){const _0x1ce396=a173_0x258e,_0x18a08d=_0x35ae67();while(!![]){try{const _0x24f981=parseInt(_0x1ce396(0xcd))/0x1*(-parseInt(_0x1ce396(0x95))/0x2)+parseInt(_0x1ce396(0x94))/0x3+parseInt(_0x1ce396(0x98))/0x4*(-parseInt(_0x1ce396(0xab))/0x5)+-parseInt(_0x1ce396(0xd1))/0x6*(-parseInt(_0x1ce396(0xa5))/0x7)+parseInt(_0x1ce396(0xc6))/0x8*(-parseInt(_0x1ce396(0x9c))/0x9)+-parseInt(_0x1ce396(0xb6))/0xa+parseInt(_0x1ce396(0xa0))/0xb;if(_0x24f981===_0x4e46ef)break;else _0x18a08d['push'](_0x18a08d['shift']());}catch(_0x1433b2){_0x18a08d['push'](_0x18a08d['shift']());}}}(a173_0x3a06,0x9aeba));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';function a173_0x3a06(){const _0x3dd4da=['str','1232cJlCnZ','sqlName','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','message','sqlContent','sqls','1136495zLohxe','Would\x20pull\x20','sqlRootDir','description','utf8','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','Force\x20pull\x20cancelled.','catch','toISOString','sql','skipped','11961200qULwrg','paging','unchanged','sqlRoot','length','test','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','Force\x20overwrite\x20local\x20unsynced\x20changes','\x20SQL\x20file(s)\x20into\x20','\x20skipped,\x20','Pull\x20complete:\x20','sqlCode','nonInteractive','No\x20remote\x20SQL\x20queries\x20matched.','local\x20differs\x20from\x20remote','conflict','288qIMBkh','dbId','boolean','filter','lockFilePath','Filter\x20by\x20SQL\x20display\x20name','sqlcode','3557BdtCGI','bool','mybatisXml','write','3498TMkgmc','2845446eWpvDa','136QRHGrn','path','name','8XPBIOc','lastSync','pull','appCode','257067CTprFg','join','string','trimStart','27547586vSnSit','tableData','force','push'];a173_0x3a06=function(){return _0x3dd4da;};return a173_0x3a06();}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(_0x276e58,_0xbe03a1){const _0x1183fe=a173_0x258e,_0x258365=[];let _0x193cef=0x1;while(!![]){const _0x8a83ba=await listSqlQueries(_0x276e58,{'currentPage':_0x193cef,'pageSize':PAGE_SIZE,'sqlCode':_0xbe03a1[_0x1183fe(0xc1)],'sqlName':_0xbe03a1[_0x1183fe(0xa6)]}),_0x54e9f8=_0x8a83ba[_0x1183fe(0xa1)]??[];_0x258365[_0x1183fe(0xa3)](..._0x54e9f8);if(_0x54e9f8[_0x1183fe(0xba)]===0x0)break;const _0x14cea5=_0x8a83ba[_0x1183fe(0xb7)]?.['totalCount'];if(_0x14cea5!=null?_0x258365[_0x1183fe(0xba)]>=_0x14cea5:_0x54e9f8[_0x1183fe(0xba)]<PAGE_SIZE)break;_0x193cef++;}return _0x258365;}async function ensureSqlContent(_0x30394e){const _0x162028=a173_0x258e;if(_0x30394e['sqlContent']!=null&&String(_0x30394e[_0x162028(0xa9)])[_0x162028(0xba)]>0x0)return _0x30394e;return getSqlQueryDetail(_0x30394e['sqlCode']);}export const sqlPull={'service':a173_0x10c41d(0xb4),'command':a173_0x10c41d(0x9a),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a173_0x10c41d(0xd0),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a173_0x10c41d(0x9e),'description':a173_0x10c41d(0xcb)},{'name':'force','type':a173_0x10c41d(0xc8),'description':a173_0x10c41d(0xbd)}],async 'dryRun'(_0x4ebba1){const _0x1010bc=a173_0x10c41d,_0x35ae97=loadSqlProjectConfig(_0x4ebba1['appCode']),_0xf97b52=await readSqlLockFile(_0x35ae97[_0x1010bc(0xca)]),{appLock:_0x293f82}=ensureSqlLockScope(_0xf97b52??createEmptySqlLock(),_0x35ae97[_0x1010bc(0x9b)],_0x35ae97[_0x1010bc(0xb9)],_0x1010bc(0x9a)),_0x55475f=await fetchAllSqlQueries(_0x4ebba1[_0x1010bc(0x9b)],{'sqlCode':_0x4ebba1[_0x1010bc(0xa4)](_0x1010bc(0xcc))||undefined,'sqlName':_0x4ebba1['str']('name')||undefined}),_0x1f259f=[];for(const _0x55f200 of _0x55475f){const _0x54ee57=await ensureSqlContent(_0x55f200),_0x2bec37=ensureRemoteSqlContent(_0x54ee57),_0x5a06aa=detectModeFromSql(_0x54ee57),_0x81ffdc=_0x54ee57[_0x1010bc(0xc7)]?await getDbName(_0x4ebba1['appCode'],Number(_0x54ee57[_0x1010bc(0xc7)]))[_0x1010bc(0xb2)](()=>undefined):undefined,_0x5420dc=buildLocalSqlFileContent({'sqlCode':_0x54ee57['sqlCode'],'sqlName':_0x54ee57['sqlName'],'dbId':_0x54ee57[_0x1010bc(0xc7)]},_0x2bec37,{'dbName':_0x81ffdc,'mode':_0x5a06aa,'syncedAt':new Date()[_0x1010bc(0xb3)](),'description':_0x54ee57[_0x1010bc(0xae)]}),_0x29ba4a=buildSqlLockEntry(_0x54ee57,_0x2bec37,'',{'dbName':_0x81ffdc}),_0x1881f1=resolveLocalSqlFilePath(_0x35ae97,_0x54ee57[_0x1010bc(0xc1)],_0x29ba4a);let _0x2df6c7='would_pull',_0x1fc25e;if(await fileExists(_0x1881f1)){const _0x32d1fb=await readFile(_0x1881f1,'utf8');isEquivalentPulledSqlFile(_0x32d1fb,_0x5420dc,_0x5a06aa)?(_0x2df6c7=_0x1010bc(0xb5),_0x1fc25e=_0x1010bc(0xb8)):(_0x2df6c7=_0x1010bc(0xc5),_0x1fc25e=_0x1010bc(0xa7));}_0x1f259f['push']({'sqlCode':_0x54ee57['sqlCode'],'sqlName':_0x54ee57[_0x1010bc(0xa6)],'filePath':_0x1881f1,'status':_0x2df6c7,'reason':_0x1fc25e});}return{'method':'POST','url':_0x1010bc(0xbc),'body':{'appCode':_0x4ebba1[_0x1010bc(0x9b)],'sqlCode':_0x4ebba1[_0x1010bc(0xa4)](_0x1010bc(0xcc))||null,'sqlName':_0x4ebba1[_0x1010bc(0xa4)](_0x1010bc(0x97))||null,'files':_0x1f259f},'description':_0x1010bc(0xac)+_0x1f259f[_0x1010bc(0xba)]+_0x1010bc(0xbe)+_0x35ae97[_0x1010bc(0xad)]};},async 'execute'(_0x5a54c4){const _0x4b7661=a173_0x10c41d,_0x3da1aa=loadSqlProjectConfig(_0x5a54c4[_0x4b7661(0x9b)]),_0x3c41dc=await readSqlLockFile(_0x3da1aa[_0x4b7661(0xca)]),{lockData:_0xd5879f,appLock:_0x40e856}=ensureSqlLockScope(_0x3c41dc??createEmptySqlLock(),_0x3da1aa[_0x4b7661(0x9b)],_0x3da1aa[_0x4b7661(0xb9)],_0x4b7661(0x9a)),_0x3567dd=_0x5a54c4[_0x4b7661(0xce)](_0x4b7661(0xa2)),_0x40d435=await fetchAllSqlQueries(_0x5a54c4[_0x4b7661(0x9b)],{'sqlCode':_0x5a54c4[_0x4b7661(0xa4)](_0x4b7661(0xcc))||undefined,'sqlName':_0x5a54c4[_0x4b7661(0xa4)](_0x4b7661(0x97))||undefined});if(_0x40d435[_0x4b7661(0xba)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4b7661(0xc3)};const _0x531efc=[],_0x1d68ed=[];for(const _0x1a5efc of _0x40d435){try{_0x531efc[_0x4b7661(0xa3)](await ensureSqlContent(_0x1a5efc));}catch(_0x1610bf){_0x1d68ed[_0x4b7661(0xa3)]({'sqlCode':_0x1a5efc['sqlCode'],'error':_0x1610bf instanceof Error?_0x1610bf[_0x4b7661(0xa8)]:String(_0x1610bf)});}}if(_0x3567dd&&!_0x5a54c4[_0x4b7661(0xc2)]){let _0x1c549e=![];for(const _0x30bdaa of _0x531efc){const _0xf5db11=detectModeFromSql(_0x30bdaa),_0x460507=_0x30bdaa[_0x4b7661(0xc7)]?await getDbName(_0x5a54c4[_0x4b7661(0x9b)],Number(_0x30bdaa[_0x4b7661(0xc7)]))[_0x4b7661(0xb2)](()=>undefined):undefined,_0x59b93c=buildLocalSqlFileContent({'sqlCode':_0x30bdaa[_0x4b7661(0xc1)],'sqlName':_0x30bdaa['sqlName'],'dbId':_0x30bdaa[_0x4b7661(0xc7)]},ensureRemoteSqlContent(_0x30bdaa),{'dbName':_0x460507,'mode':_0xf5db11,'syncedAt':new Date()[_0x4b7661(0xb3)](),'description':_0x30bdaa[_0x4b7661(0xae)]}),_0x5eb53d=resolveLocalSqlFilePath(_0x3da1aa,_0x30bdaa[_0x4b7661(0xc1)],buildSqlLockEntry(_0x30bdaa,ensureRemoteSqlContent(_0x30bdaa),'',{'dbName':_0x460507}));if(await fileExists(_0x5eb53d)){const _0x18646d=await readFile(_0x5eb53d,_0x4b7661(0xaf));if(!isEquivalentPulledSqlFile(_0x18646d,_0x59b93c,_0xf5db11)){_0x1c549e=!![];break;}}}if(_0x1c549e){const _0x59ccdb=await confirmForceOverwrite(_0x4b7661(0xb0));if(!_0x59ccdb)throw CliErrors['cancelled'](_0x4b7661(0xb1));}}const _0x5cafce=cloneSqlLockData(_0xd5879f),_0x1cff1c=_0x5cafce['apps'][_0x3da1aa['appCode']],_0x2db5f2=[],_0x13c062=[];for(const _0x3900d0 of _0x531efc){const _0x3ed5c9=_0x1cff1c[_0x4b7661(0xaa)][_0x3900d0['sqlCode']],_0x2c2390=ensureRemoteSqlContent(_0x3900d0),_0x47de37=detectModeFromSql(_0x3900d0),_0x347741=_0x3900d0[_0x4b7661(0xc7)]?await getDbName(_0x5a54c4['appCode'],Number(_0x3900d0['dbId']))['catch'](()=>undefined):undefined,_0x3b5d7b=buildLocalSqlFileContent({'sqlCode':_0x3900d0[_0x4b7661(0xc1)],'sqlName':_0x3900d0[_0x4b7661(0xa6)],'dbId':_0x3900d0[_0x4b7661(0xc7)]},_0x2c2390,{'dbName':_0x347741,'mode':_0x47de37,'syncedAt':new Date()[_0x4b7661(0xb3)](),'description':_0x3900d0[_0x4b7661(0xae)]}),_0x2a97a4=buildSqlLockEntry(_0x3900d0,_0x2c2390,computeSqlContentHash(_0x3b5d7b),{'dbName':_0x347741}),_0x1820b2=_0x2a97a4['path'],_0x2f7593=join(_0x3da1aa[_0x4b7661(0xad)],_0x1820b2);try{if(await fileExists(_0x2f7593)){const _0x46f66b=await readFile(_0x2f7593,_0x4b7661(0xaf));if(isEquivalentPulledSqlFile(_0x46f66b,_0x3b5d7b,_0x47de37)){_0x13c062[_0x4b7661(0xa3)]({'sqlCode':_0x3900d0[_0x4b7661(0xc1)],'reason':_0x4b7661(0xb8)}),_0x1cff1c[_0x4b7661(0xaa)][_0x3900d0['sqlCode']]={..._0x2a97a4,'hash':computeSqlContentHash(_0x46f66b),'path':_0x1820b2};continue;}if(!_0x3567dd){_0x13c062[_0x4b7661(0xa3)]({'sqlCode':_0x3900d0[_0x4b7661(0xc1)],'reason':_0x4b7661(0xc4)});continue;}}const _0xf2a503=_0x3ed5c9?.[_0x4b7661(0x96)]?join(_0x3da1aa[_0x4b7661(0xad)],_0x3ed5c9[_0x4b7661(0x96)]):undefined;_0xf2a503&&_0xf2a503!==_0x2f7593&&await fileExists(_0xf2a503)&&await rm(_0xf2a503,{'force':!![]}),await ensureParentDirectory(_0x2f7593),await writeFile(_0x2f7593,_0x3b5d7b,'utf8'),_0x1cff1c[_0x4b7661(0xaa)][_0x3900d0[_0x4b7661(0xc1)]]={..._0x2a97a4,'path':_0x1820b2},_0x2db5f2[_0x4b7661(0xa3)]({'sqlCode':_0x3900d0['sqlCode'],'filePath':_0x2f7593});}catch(_0x452cb4){_0x1d68ed['push']({'sqlCode':_0x3900d0[_0x4b7661(0xc1)],'error':_0x452cb4 instanceof Error?_0x452cb4['message']:String(_0x452cb4)});}}return _0x1cff1c[_0x4b7661(0x99)]=new Date()[_0x4b7661(0xb3)](),await writeSqlLockFile(_0x3da1aa['lockFilePath'],_0x5cafce),{'ok':_0x1d68ed[_0x4b7661(0xba)]===0x0,'data':{'pulled':_0x2db5f2,'skipped':_0x13c062,'failed':_0x1d68ed},'message':_0x4b7661(0xc0)+_0x2db5f2[_0x4b7661(0xba)]+'\x20written,\x20'+_0x13c062[_0x4b7661(0xba)]+_0x4b7661(0xbf)+_0x1d68ed['length']+'\x20failed'};}};function detectModeFromSql(_0x534bb9){const _0x254cbe=a173_0x10c41d,_0x8d2ba9=ensureRemoteSqlContent(_0x534bb9),_0x54a67c=stripLocalSqlMetadata(_0x8d2ba9,_0x254cbe(0xcf))[_0x254cbe(0x9f)]();if(/^<(select|insert|update|delete)\b/i[_0x254cbe(0xbb)](_0x54a67c))return _0x254cbe(0xcf);return _0x254cbe(0xb4);}function isEquivalentPulledSqlFile(_0x28f633,_0x4e0507,_0x4813f){return normalizePullComparableContent(_0x28f633,_0x4813f)===normalizePullComparableContent(_0x4e0507,_0x4813f);}function normalizePullComparableContent(_0x3c7ed7,_0x42275d){const _0x469ec7=a173_0x10c41d,_0x43a2ee=_0x3c7ed7['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x388097=_0x43a2ee[_0x469ec7(0xc9)](_0x7fbde4=>!isSyncedAtMetadataLine(_0x7fbde4,_0x42275d));return _0x388097[_0x469ec7(0x9d)]('\x0a');}function isSyncedAtMetadataLine(_0x41a1e2,_0x5f4fcd){const _0x16a4a4=a173_0x10c41d;if(_0x5f4fcd===_0x16a4a4(0xcf))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x41a1e2);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x16a4a4(0xbb)](_0x41a1e2);}