@lovrabet/rabetbase-cli 2.3.16-beta.2 → 2.3.16-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 (287) hide show
  1. package/README.md +1 -1
  2. package/lib/api/api-doc.js +1 -1
  3. package/lib/api/fetch-model-list.js +1 -1
  4. package/lib/api/generate-api-file.js +1 -1
  5. package/lib/auth/auth-server-ui.js +1 -1
  6. package/lib/auth/auth-server.js +1 -1
  7. package/lib/auth/constant.js +1 -1
  8. package/lib/auth/get-cookie.js +1 -1
  9. package/lib/auth/get-session-user.js +1 -1
  10. package/lib/auth/is-session-valid.js +1 -1
  11. package/lib/auth/login-success-html.js +1 -1
  12. package/lib/auth/logout.js +1 -1
  13. package/lib/cli-flags.js +1 -1
  14. package/lib/cli.js +1 -1
  15. package/lib/commands/api/generate.js +1 -1
  16. package/lib/commands/api/index.js +1 -1
  17. package/lib/commands/api/list.js +1 -1
  18. package/lib/commands/api/pull.js +1 -1
  19. package/lib/commands/api/shared.js +1 -1
  20. package/lib/commands/app/index.js +1 -1
  21. package/lib/commands/app/list.js +1 -1
  22. package/lib/commands/app/members-list.js +1 -1
  23. package/lib/commands/app/remote-directory.js +1 -1
  24. package/lib/commands/app/shared.js +1 -1
  25. package/lib/commands/app-config/delete.js +1 -1
  26. package/lib/commands/app-config/get.js +1 -1
  27. package/lib/commands/app-config/index.js +1 -1
  28. package/lib/commands/app-config/list.js +1 -1
  29. package/lib/commands/app-config/set.js +1 -1
  30. package/lib/commands/app-config/shared.js +1 -1
  31. package/lib/commands/auth/index.js +1 -1
  32. package/lib/commands/bff/create.js +1 -1
  33. package/lib/commands/bff/delete.js +1 -1
  34. package/lib/commands/bff/detail.js +1 -1
  35. package/lib/commands/bff/index.js +1 -1
  36. package/lib/commands/bff/list.js +1 -1
  37. package/lib/commands/bff/pull.js +1 -1
  38. package/lib/commands/bff/push.js +1 -1
  39. package/lib/commands/bff/status.js +1 -1
  40. package/lib/commands/cli-skill/index.js +1 -1
  41. package/lib/commands/cli-update.js +1 -1
  42. package/lib/commands/codegen/index.js +1 -1
  43. package/lib/commands/codegen/sdk.js +1 -1
  44. package/lib/commands/codegen/sql.js +1 -1
  45. package/lib/commands/common/app-registry.js +1 -1
  46. package/lib/commands/common/app-selector.js +1 -1
  47. package/lib/commands/common/async-task.js +1 -1
  48. package/lib/commands/common/dry-run.js +1 -1
  49. package/lib/commands/common/flags.js +1 -1
  50. package/lib/commands/common/local-file.js +1 -1
  51. package/lib/commands/common/validate.js +1 -1
  52. package/lib/commands/config/get.js +1 -1
  53. package/lib/commands/config/index.js +1 -1
  54. package/lib/commands/config/list.js +1 -1
  55. package/lib/commands/config/set.js +1 -1
  56. package/lib/commands/config/shared.js +1 -1
  57. package/lib/commands/data/filter.js +1 -1
  58. package/lib/commands/data/getOne.js +1 -1
  59. package/lib/commands/data/index.js +1 -1
  60. package/lib/commands/data/shared.js +1 -1
  61. package/lib/commands/dataset/business-group-update.js +1 -1
  62. package/lib/commands/dataset/capability.js +1 -1
  63. package/lib/commands/dataset/delete.js +1 -1
  64. package/lib/commands/dataset/detail.js +1 -1
  65. package/lib/commands/dataset/extend-update.js +1 -1
  66. package/lib/commands/dataset/field-update.js +1 -1
  67. package/lib/commands/dataset/generate.js +1 -1
  68. package/lib/commands/dataset/index.js +1 -1
  69. package/lib/commands/dataset/list.js +1 -1
  70. package/lib/commands/dataset/operations.js +1 -1
  71. package/lib/commands/dataset/relation-audit.js +1 -1
  72. package/lib/commands/dataset/relation-create.js +1 -1
  73. package/lib/commands/dataset/relation-delete.js +1 -1
  74. package/lib/commands/dataset/relation-shared.js +1 -1
  75. package/lib/commands/dataset/relation-update.js +1 -1
  76. package/lib/commands/dataset/relations.js +1 -1
  77. package/lib/commands/dataset/rename.js +1 -1
  78. package/lib/commands/dataset/restore.js +1 -1
  79. package/lib/commands/db/analysis-batching.js +1 -1
  80. package/lib/commands/db/analyze-batch-plan.js +1 -1
  81. package/lib/commands/db/analyze-cancel.js +1 -1
  82. package/lib/commands/db/analyze-start.js +1 -1
  83. package/lib/commands/db/analyze-status.js +1 -1
  84. package/lib/commands/db/create.js +1 -1
  85. package/lib/commands/db/delete.js +1 -1
  86. package/lib/commands/db/detail.js +1 -1
  87. package/lib/commands/db/diff.js +1 -1
  88. package/lib/commands/db/index.js +1 -1
  89. package/lib/commands/db/list.js +1 -1
  90. package/lib/commands/db/shared.js +1 -1
  91. package/lib/commands/db/tables.js +1 -1
  92. package/lib/commands/db/test.js +1 -1
  93. package/lib/commands/db/update.js +1 -1
  94. package/lib/commands/doctor.js +1 -1
  95. package/lib/commands/file/index.js +1 -1
  96. package/lib/commands/init/index.js +1 -1
  97. package/lib/commands/issue/index.js +1 -1
  98. package/lib/commands/issue/nudge.js +1 -1
  99. package/lib/commands/issue/report.js +1 -1
  100. package/lib/commands/issue/shared.js +1 -1
  101. package/lib/commands/kb/create.js +1 -1
  102. package/lib/commands/kb/delete.js +1 -1
  103. package/lib/commands/kb/detail.js +1 -1
  104. package/lib/commands/kb/index.js +1 -1
  105. package/lib/commands/kb/list.js +1 -1
  106. package/lib/commands/kb/shared.js +1 -1
  107. package/lib/commands/kb/update.js +1 -1
  108. package/lib/commands/logs/index.js +1 -1
  109. package/lib/commands/menu/asset-update.js +1 -1
  110. package/lib/commands/menu/delete.js +1 -1
  111. package/lib/commands/menu/external-link-create.js +1 -1
  112. package/lib/commands/menu/external-link-update.js +1 -1
  113. package/lib/commands/menu/group-create.js +1 -1
  114. package/lib/commands/menu/group-update.js +1 -1
  115. package/lib/commands/menu/index.js +1 -1
  116. package/lib/commands/menu/list.js +1 -1
  117. package/lib/commands/menu/move.js +1 -1
  118. package/lib/commands/menu/regroup-start.js +1 -1
  119. package/lib/commands/menu/rename.js +1 -1
  120. package/lib/commands/menu/shared/compare-table.js +1 -1
  121. package/lib/commands/menu/shared/delete-plan.js +1 -1
  122. package/lib/commands/menu/shared/facts.js +1 -1
  123. package/lib/commands/menu/shared/index.js +1 -1
  124. package/lib/commands/menu/shared/inquirer.js +1 -1
  125. package/lib/commands/menu/shared/local-pages.js +1 -1
  126. package/lib/commands/menu/shared/logic.js +1 -1
  127. package/lib/commands/menu/shared/mutations.js +1 -1
  128. package/lib/commands/menu/shared/service.js +1 -1
  129. package/lib/commands/menu/shared/sync-core.js +1 -1
  130. package/lib/commands/menu/shared/update-core.js +1 -1
  131. package/lib/commands/menu/shared/valid-url.js +1 -1
  132. package/lib/commands/menu/sync.js +1 -1
  133. package/lib/commands/notification/config-list.js +1 -1
  134. package/lib/commands/notification/index.js +1 -1
  135. package/lib/commands/ocr/index.js +1 -1
  136. package/lib/commands/page/generate-start.js +1 -1
  137. package/lib/commands/page/generate-status.js +1 -1
  138. package/lib/commands/page/index.js +1 -1
  139. package/lib/commands/page/pull.js +1 -1
  140. package/lib/commands/page/push.js +1 -1
  141. package/lib/commands/page/react/create.js +1 -0
  142. package/lib/commands/page/react/detail.js +1 -0
  143. package/lib/commands/page/react/list.js +1 -0
  144. package/lib/commands/page/react/publish.js +1 -0
  145. package/lib/commands/page/react/shared.js +1 -0
  146. package/lib/commands/page/react/syntax.js +1 -0
  147. package/lib/commands/page/react/template.js +1 -0
  148. package/lib/commands/page/react/update.js +1 -0
  149. package/lib/commands/page/relation-audit.js +1 -1
  150. package/lib/commands/page/restore.js +1 -1
  151. package/lib/commands/page/shared.js +1 -1
  152. package/lib/commands/page/standard-page-status.js +1 -1
  153. package/lib/commands/page/sync.js +1 -1
  154. package/lib/commands/permit/index.js +1 -1
  155. package/lib/commands/permit/page-get.js +1 -1
  156. package/lib/commands/permit/page-set.js +1 -1
  157. package/lib/commands/permit/role-apis-set.js +1 -1
  158. package/lib/commands/permit/role-menus-set.js +1 -1
  159. package/lib/commands/permit/role-menus.js +1 -1
  160. package/lib/commands/permit/shared.js +1 -1
  161. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  162. package/lib/commands/project/create/format-elapsed.js +1 -1
  163. package/lib/commands/project/create/main.js +1 -1
  164. package/lib/commands/project/create/non-interactive.js +1 -1
  165. package/lib/commands/project/create/project-template-path.js +1 -1
  166. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  167. package/lib/commands/project/create/use-format-code.js +1 -1
  168. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  169. package/lib/commands/project/index.js +1 -1
  170. package/lib/commands/project/upgrade.js +1 -1
  171. package/lib/commands/registry.js +1 -1
  172. package/lib/commands/role/create.js +1 -1
  173. package/lib/commands/role/delete.js +1 -1
  174. package/lib/commands/role/detail.js +1 -1
  175. package/lib/commands/role/index.js +1 -1
  176. package/lib/commands/role/list.js +1 -1
  177. package/lib/commands/role/shared.js +1 -1
  178. package/lib/commands/role/update.js +1 -1
  179. package/lib/commands/role/user-add.js +1 -1
  180. package/lib/commands/role/user-remove.js +1 -1
  181. package/lib/commands/role/user-resolve.js +1 -1
  182. package/lib/commands/run/index.js +1 -1
  183. package/lib/commands/schema.js +1 -1
  184. package/lib/commands/sql/create.js +1 -1
  185. package/lib/commands/sql/delete.js +1 -1
  186. package/lib/commands/sql/detail.js +1 -1
  187. package/lib/commands/sql/exec.js +1 -1
  188. package/lib/commands/sql/index.js +1 -1
  189. package/lib/commands/sql/list.js +1 -1
  190. package/lib/commands/sql/pull.js +1 -1
  191. package/lib/commands/sql/push.js +1 -1
  192. package/lib/commands/sql/shared.js +1 -1
  193. package/lib/commands/sql/status.js +1 -1
  194. package/lib/commands/sql/validate.js +1 -1
  195. package/lib/commands/task/index.js +1 -1
  196. package/lib/commands/task/status.js +1 -1
  197. package/lib/commands/tenant/index.js +1 -1
  198. package/lib/commands/tenant/members-list.js +1 -1
  199. package/lib/commands/tenant/shared.js +1 -1
  200. package/lib/commands/workspace/add.js +1 -1
  201. package/lib/commands/workspace/index.js +1 -1
  202. package/lib/commands/workspace/remove.js +1 -1
  203. package/lib/config/schema.js +1 -1
  204. package/lib/constant/cdn.js +1 -1
  205. package/lib/constant/cli.js +1 -1
  206. package/lib/constant/defaults.js +1 -1
  207. package/lib/constant/domain.js +1 -1
  208. package/lib/constant/env.js +1 -1
  209. package/lib/constant/output.js +1 -1
  210. package/lib/constant/paths.js +1 -1
  211. package/lib/constant/risk.js +1 -1
  212. package/lib/context/app-resolver.js +1 -1
  213. package/lib/context/auth-resolver.js +1 -1
  214. package/lib/context/config-loader.js +1 -1
  215. package/lib/context.js +1 -1
  216. package/lib/core/alias-resolver.js +1 -1
  217. package/lib/core/api-client.js +1 -1
  218. package/lib/core/bff/config.js +1 -1
  219. package/lib/core/bff/file-system.js +1 -1
  220. package/lib/core/bff/hash.js +1 -1
  221. package/lib/core/bff/lock.js +1 -1
  222. package/lib/core/bff/utils.js +1 -1
  223. package/lib/core/db-resolver.js +1 -1
  224. package/lib/core/page/file-system.js +1 -1
  225. package/lib/core/page/hash.js +1 -1
  226. package/lib/core/page/lock.js +1 -1
  227. package/lib/core/sql-index-auditor.js +1 -1
  228. package/lib/core/sql-sync/config.js +1 -1
  229. package/lib/core/sql-sync/file-system.js +1 -1
  230. package/lib/core/sql-sync/hash.js +1 -1
  231. package/lib/core/sql-sync/lock.js +1 -1
  232. package/lib/core/sql-sync/utils.js +1 -1
  233. package/lib/core/sql-validator.js +1 -1
  234. package/lib/errors.js +1 -1
  235. package/lib/framework/build-all-flags.js +1 -1
  236. package/lib/framework/error-output.js +1 -1
  237. package/lib/framework/explicit-yes.js +1 -1
  238. package/lib/framework/flags.js +1 -1
  239. package/lib/framework/help.js +1 -1
  240. package/lib/framework/index.js +1 -1
  241. package/lib/framework/output.js +1 -1
  242. package/lib/framework/response.js +1 -1
  243. package/lib/framework/runner-alias.js +1 -1
  244. package/lib/framework/runner.js +1 -1
  245. package/lib/framework/schema-export.js +1 -1
  246. package/lib/framework/types.js +1 -1
  247. package/lib/generated/build-info.js +1 -1
  248. package/lib/help.js +1 -1
  249. package/lib/skills/main.js +1 -1
  250. package/lib/skills/npx-skills-add.js +1 -1
  251. package/lib/skills/skill-presence.js +1 -1
  252. package/lib/telemetry/cli-command-trace.js +1 -1
  253. package/lib/telemetry/cli-help-trace.js +1 -1
  254. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  255. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  256. package/lib/telemetry/send-cli-trace-log.js +1 -1
  257. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  258. package/lib/utils/ai_config.js +1 -1
  259. package/lib/utils/apply-jq-filter.js +1 -1
  260. package/lib/utils/cdn-config.js +1 -1
  261. package/lib/utils/check-sdk-version.js +1 -1
  262. package/lib/utils/cli-version-check.js +1 -1
  263. package/lib/utils/cli-version-policy.js +1 -1
  264. package/lib/utils/config.js +1 -1
  265. package/lib/utils/copy-directory.js +1 -1
  266. package/lib/utils/entity-with-id.js +1 -1
  267. package/lib/utils/file-utils.js +1 -1
  268. package/lib/utils/guides-cdn.js +1 -1
  269. package/lib/utils/http-client.js +1 -1
  270. package/lib/utils/is-non-interactive.js +1 -1
  271. package/lib/utils/logger.js +1 -1
  272. package/lib/utils/params.js +1 -1
  273. package/lib/utils/platform.js +1 -1
  274. package/lib/utils/rules-cdn.js +1 -1
  275. package/lib/utils/sleep.js +1 -1
  276. package/lib/utils/template-replacer.js +1 -1
  277. package/lib/utils/update-notice.js +1 -1
  278. package/lib/utils/version.js +1 -1
  279. package/lib/utils/with-active-cookie.js +1 -1
  280. package/lib/utils/write-cli-side-channel.js +1 -1
  281. package/package.json +1 -1
  282. package/templates/projects/sub-app-react-demo/CHANGELOG.md +1 -1
  283. package/templates/projects/sub-app-react-demo/README.md +1 -1
  284. package/templates/projects/sub-app-react-demo/docs/quick-start.md +1 -1
  285. package/templates/projects/sub-app-react-demo/src/pages/index.tsx +1 -1
  286. package/lib/commands/project/init.js +0 -1
  287. package/lib/commands/sql/save.js +0 -1
@@ -1 +1 @@
1
- const a169_0xbbf31b=a169_0x344b;(function(_0x424c6c,_0x23e708){const _0xf61bff=a169_0x344b,_0x251d70=_0x424c6c();while(!![]){try{const _0x355717=-parseInt(_0xf61bff(0x21b))/0x1*(parseInt(_0xf61bff(0x1e8))/0x2)+parseInt(_0xf61bff(0x1d0))/0x3*(-parseInt(_0xf61bff(0x1d4))/0x4)+-parseInt(_0xf61bff(0x1e4))/0x5*(-parseInt(_0xf61bff(0x1cd))/0x6)+-parseInt(_0xf61bff(0x1f7))/0x7*(parseInt(_0xf61bff(0x216))/0x8)+-parseInt(_0xf61bff(0x1f5))/0x9*(-parseInt(_0xf61bff(0x1fc))/0xa)+-parseInt(_0xf61bff(0x204))/0xb*(parseInt(_0xf61bff(0x206))/0xc)+-parseInt(_0xf61bff(0x1f8))/0xd*(-parseInt(_0xf61bff(0x1e6))/0xe);if(_0x355717===_0x23e708)break;else _0x251d70['push'](_0x251d70['shift']());}catch(_0x4ffecb){_0x251d70['push'](_0x251d70['shift']());}}}(a169_0x429e,0x28962));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a169_0xbbf31b(0x202),'required':!![],'description':a169_0xbbf31b(0x1d5)};export const ROLE_REF_FLAG={'name':a169_0xbbf31b(0x1ef),'type':a169_0xbbf31b(0x1f6),'required':!![],'description':a169_0xbbf31b(0x20c)};export const USER_REF_FLAG={'name':a169_0xbbf31b(0x1eb),'type':a169_0xbbf31b(0x1f6),'required':!![],'description':a169_0xbbf31b(0x1ee)};export const NAME_FLAG={'name':'name','type':a169_0xbbf31b(0x1f6),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':a169_0xbbf31b(0x1f3),'type':a169_0xbbf31b(0x1f6),'required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':'remark','type':a169_0xbbf31b(0x1f6),'required':![],'description':a169_0xbbf31b(0x207)};function a169_0x344b(_0x5957ed,_0x514316){_0x5957ed=_0x5957ed-0x1cd;const _0x429e03=a169_0x429e();let _0x344b0d=_0x429e03[_0x5957ed];return _0x344b0d;}export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a169_0xbbf31b(0x202),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=['ADMIN',a169_0xbbf31b(0x1fe),a169_0xbbf31b(0x217)];export function isBuiltinRole(_0x4c5c0e){const _0x22af3c=a169_0xbbf31b;return BUILTIN_ROLE_TYPES[_0x22af3c(0x20b)](_0x4c5c0e);}export function assertCustomRole(_0xaa7b04,_0x31f85b){const _0x2ea863=a169_0xbbf31b;if(_0xaa7b04[_0x2ea863(0x219)]!==_0x2ea863(0x21a))throw CliErrors[_0x2ea863(0x1f2)]('Cannot\x20'+_0x31f85b+_0x2ea863(0x1dd)+_0xaa7b04[_0x2ea863(0x1d7)]+'\x20('+_0xaa7b04[_0x2ea863(0x219)]+').',_0x2ea863(0x20a));}export function assertPermConfigurable(_0x3e0df6){const _0x4784fe=a169_0xbbf31b;if(_0x3e0df6['roleType']===_0x4784fe(0x1fe)||_0x3e0df6['roleType']==='ADMIN')throw CliErrors[_0x4784fe(0x1f2)](_0x4784fe(0x208)+_0x3e0df6[_0x4784fe(0x1d7)]+'\x20('+_0x3e0df6[_0x4784fe(0x219)]+').',_0x4784fe(0x1f4));}export function projectRole(_0x214200){const _0x2adf15=a169_0xbbf31b;return{'id':_0x214200['id'],'roleName':_0x214200[_0x2adf15(0x1d7)],'roleType':_0x214200[_0x2adf15(0x219)],'remark':_0x214200['remark'],'userCount':_0x214200[_0x2adf15(0x1d9)],'permitCount':_0x214200[_0x2adf15(0x1e3)],'builtin':isBuiltinRole(_0x214200[_0x2adf15(0x219)])};}export async function resolveRoleRef(_0x346ac6,_0x4071ef){const _0x6f2534=a169_0xbbf31b,_0x1a0c8a=_0x4071ef[_0x6f2534(0x211)]();if(!_0x1a0c8a)throw CliErrors['validation'](_0x6f2534(0x1de),_0x6f2534(0x1d8));if(/^\d+$/[_0x6f2534(0x1e0)](_0x1a0c8a))return getRoleById(_0x346ac6,Number(_0x1a0c8a));const _0x3f4feb=await listAllAppRoles(_0x346ac6),_0x11a3ab=_0x3f4feb[_0x6f2534(0x1db)](_0x4a7b99=>_0x4a7b99[_0x6f2534(0x1d7)]===_0x1a0c8a);if(_0x11a3ab[_0x6f2534(0x1ff)]===0x0)throw CliErrors[_0x6f2534(0x1f2)]('Role\x20name\x20\x22'+_0x1a0c8a+_0x6f2534(0x1cf)+_0x346ac6+'.',_0x6f2534(0x200));if(_0x11a3ab[_0x6f2534(0x1ff)]>0x1){const _0x48b43a=_0x11a3ab[_0x6f2534(0x1e7)](_0x55a154=>_0x55a154['id'])[_0x6f2534(0x1f0)](',\x20');throw CliErrors[_0x6f2534(0x1f2)]('Role\x20name\x20\x22'+_0x1a0c8a+_0x6f2534(0x1dc)+_0x48b43a+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x11a3ab[0x0];}export async function getRoleById(_0x9349fe,_0xbc89ff){const _0x425e1f=a169_0xbbf31b,_0x3d4df7=await getAppRole(_0xbc89ff);if(!_0x3d4df7)throw CliErrors[_0x425e1f(0x1f2)](_0x425e1f(0x1f9)+_0xbc89ff+'\x20not\x20found\x20in\x20app\x20'+_0x9349fe+'.',_0x425e1f(0x20e));return _0x3d4df7;}async function listAllAppRoles(_0x471364){const _0x308bde=a169_0xbbf31b,_0x56882a=0x64,_0x2f386=[];for(let _0x4483e4=0x1;;_0x4483e4+=0x1){const {items:_0x3ffcba,paging:_0x552af8}=await listAppRoles(_0x471364,{'currentPage':_0x4483e4,'pageSize':_0x56882a});_0x2f386[_0x308bde(0x1d6)](..._0x3ffcba);if(_0x3ffcba[_0x308bde(0x1ff)]<_0x56882a||_0x552af8&&_0x2f386[_0x308bde(0x1ff)]>=_0x552af8[_0x308bde(0x203)])return _0x2f386;}}export async function resolveTenantCode(){const _0x330d4f=a169_0xbbf31b,_0x18865e=await getSessionUserInfo(),_0x403e2e=_0x18865e?.['user']?.['tenant']?.[_0x330d4f(0x1d2)];if(!_0x403e2e)throw CliErrors[_0x330d4f(0x1e1)](_0x330d4f(0x1f1));return _0x403e2e;}function matchMember(_0xfd0193,_0x1b0400){const _0x3c5fff=a169_0xbbf31b,_0x2369bc=_0x1b0400[_0x3c5fff(0x211)]()[_0x3c5fff(0x20d)]();return(_0xfd0193[_0x3c5fff(0x213)]??'')['toLowerCase']()===_0x2369bc||(_0xfd0193[_0x3c5fff(0x210)]??'')['toLowerCase']()===_0x2369bc;}export async function resolveUserRef(_0x737e0f){const _0x49430a=a169_0xbbf31b,_0x5bbde4=_0x737e0f[_0x49430a(0x211)]();if(!_0x5bbde4)throw CliErrors[_0x49430a(0x1f2)]('Missing\x20user\x20reference.',_0x49430a(0x1e2));const _0x1a8049=await resolveTenantCode(),_0x2879d2=await getTenantMembers(_0x1a8049);if(/^\d+$/[_0x49430a(0x1e0)](_0x5bbde4)){const _0x48213e=Number(_0x5bbde4),_0x17bd5f=_0x2879d2[_0x49430a(0x1d1)](_0x19b03e=>_0x19b03e[_0x49430a(0x1d3)]===_0x48213e);return{'userId':_0x48213e,'username':_0x17bd5f?.[_0x49430a(0x210)]??String(_0x48213e),'nickname':_0x17bd5f?.[_0x49430a(0x213)],'matchedBy':'id'};}const _0x4fa57f=_0x2879d2['filter'](_0x7030f7=>matchMember(_0x7030f7,_0x5bbde4));if(_0x4fa57f['length']===0x0)throw CliErrors[_0x49430a(0x1f2)]('No\x20tenant\x20member\x20matches\x20\x22'+_0x5bbde4+'\x22.',_0x49430a(0x214));if(_0x4fa57f[_0x49430a(0x1ff)]>0x1){const _0x2c0073=_0x4fa57f[_0x49430a(0x1e7)](_0x4bac24=>(_0x4bac24['nickname']??_0x4bac24['username']??'?')+'('+_0x4bac24['userId']+')')[_0x49430a(0x1f0)](',\x20');throw CliErrors['validation']('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x5bbde4+_0x49430a(0x1da)+_0x2c0073+'.','Disambiguate\x20with\x20--user\x20<id>.');}const _0x41aa50=_0x4fa57f[0x0];return{'userId':_0x41aa50[_0x49430a(0x1d3)],'username':_0x41aa50['username']??String(_0x41aa50[_0x49430a(0x1d3)]),'nickname':_0x41aa50[_0x49430a(0x213)],'matchedBy':'name'};}export const UPDATE_USER_LIST_PATH=a169_0xbbf31b(0x1e9);function userIdsOf(_0x18bdd0){const _0x3d20c5=a169_0xbbf31b;return(_0x18bdd0?.[_0x3d20c5(0x1fb)]??[])['map'](_0x17b0b1=>_0x17b0b1[_0x3d20c5(0x1d3)]);}export function computeRoleUserMutation(_0x3e46da){const _0x1dd247=a169_0xbbf31b,{operation:_0x5b3c8d,appCode:_0xfdf295,roleUsers:_0x497a04,targetRoleId:_0x171c96,user:_0x295e6e}=_0x3e46da,_0x352664=_0x497a04[_0x1dd247(0x1d1)](_0x17639f=>_0x17639f['id']===_0x171c96);if(!_0x352664)throw CliErrors['validation'](_0x1dd247(0x1f9)+_0x171c96+_0x1dd247(0x201),_0x1dd247(0x20e));const _0x3b2508=userIdsOf(_0x352664),_0x5c1574=[];if(_0x3e46da[_0x1dd247(0x1ea)]!==undefined&&_0x3e46da['expectUserCount']!==_0x3b2508[_0x1dd247(0x1ff)])throw CliErrors[_0x1dd247(0x1f2)]('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x3e46da[_0x1dd247(0x1ea)]+_0x1dd247(0x209)+_0x3b2508[_0x1dd247(0x1ff)]+'.',_0x1dd247(0x1fa));const _0x387a91=_0x3b2508['includes'](_0x295e6e['userId']);let _0x1302f8=![];const _0x4267ca=[..._0x352664[_0x1dd247(0x1fb)]];if(_0x5b3c8d===_0x1dd247(0x1fd))_0x387a91?_0x5c1574[_0x1dd247(0x1d6)](_0x1dd247(0x1ce)+_0x295e6e[_0x1dd247(0x1d3)]+_0x1dd247(0x218)+_0x352664[_0x1dd247(0x1d7)]+';\x20no\x20change.'):(_0x4267ca[_0x1dd247(0x1d6)]({'userId':_0x295e6e[_0x1dd247(0x1d3)],'username':_0x295e6e[_0x1dd247(0x210)],..._0x295e6e[_0x1dd247(0x213)]?{'nickname':_0x295e6e[_0x1dd247(0x213)]}:{}}),_0x1302f8=!![]);else{if(!_0x387a91)_0x5c1574['push'](_0x1dd247(0x1ce)+_0x295e6e['userId']+_0x1dd247(0x1df)+_0x352664[_0x1dd247(0x1d7)]+_0x1dd247(0x1ed));else{const _0x529035=_0x4267ca[_0x1dd247(0x215)](_0x417497=>_0x417497[_0x1dd247(0x1d3)]===_0x295e6e['userId']);if(_0x529035>=0x0)_0x4267ca['splice'](_0x529035,0x1);_0x1302f8=!![];}}const _0x2d79ae=_0x497a04['map'](_0x4deafe=>_0x4deafe['id']===_0x171c96?{..._0x4deafe,'userList':_0x4267ca}:_0x4deafe),_0xf69efa=_0x4267ca[_0x1dd247(0x1e7)](_0x3695a5=>_0x3695a5['userId']),_0x334ca4={'operation':_0x5b3c8d,'selector':{'appCode':_0xfdf295,'roleId':_0x171c96,'roleName':_0x352664[_0x1dd247(0x1d7)],'userId':_0x295e6e[_0x1dd247(0x1d3)]},'before':{'userIds':_0x3b2508},'after':{'userIds':_0xf69efa},'dryRun':_0x3e46da[_0x1dd247(0x1ec)],'backend':{'method':_0x1dd247(0x1e5),'path':UPDATE_USER_LIST_PATH},'warnings':_0x5c1574};return{'roleList':_0x2d79ae,'mutation':_0x334ca4,'changed':_0x1302f8};}export async function loadRoleUsers(_0x2ed8c2){return listRoleUsers(_0x2ed8c2);}function a169_0x429e(){const _0x1423c3=['\x20member(s)\x20but\x20role\x20has\x20','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','includes','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','toLowerCase','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','str','username','trim','flagMissing','nickname','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','findIndex','8HolDEL','USER','\x20is\x20already\x20a\x20member\x20of\x20role\x20','roleType','CUSTOM','23590uAQLEd','6UIdANQ','User\x20','\x22\x20not\x20found\x20in\x20app\x20','196161SoPuUG','find','tenant_code','userId','4ANhnWO','Role\x20id\x20(from\x20`role\x20list`)','push','roleName','Pass\x20--role\x20<id|name>.','userCount','\x22:\x20','filter','\x22\x20is\x20ambiguous\x20(ids:\x20','\x20built-in\x20role\x20','Missing\x20role\x20reference.','\x20is\x20not\x20a\x20member\x20of\x20role\x20','test','authRequired','Pass\x20--user\x20<id|name>.','permitCount','1407245UgangT','POST','14GLvqBB','map','6WDbLUS','/smartapi/permit/user-role/update-user-list','expectUserCount','user','dryRun',';\x20no\x20change.','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','role','join','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','validation','name','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','890469AOYfJI','string','1869007MzgywF','4584047kMAiuf','Role\x20id\x20','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','userList','10qcbYcJ','user-add','DEV','length','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','\x20not\x20found\x20in\x20the\x20user-role\x20list.','number','totalCount','22781TBVvXb','appCode','948scTshJ','Optional\x20role\x20remark/description','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20'];a169_0x429e=function(){return _0x1423c3;};return a169_0x429e();}export function readRoleRef(_0x5523f5){const _0x18fb1f=a169_0xbbf31b,_0x5340fc=_0x5523f5[_0x18fb1f(0x20f)](_0x18fb1f(0x1ef))[_0x18fb1f(0x211)]();if(!_0x5340fc)throw CliErrors[_0x18fb1f(0x212)](_0x18fb1f(0x1ef),_0x18fb1f(0x1d8));return _0x5340fc;}export async function prepareUserMutation(_0x525241,_0x1046cf,_0x2a334f){const _0x2bef7e=a169_0xbbf31b,_0x17f71a=readRoleRef(_0x525241),_0xa26c4d=_0x525241[_0x2bef7e(0x20f)]('user')[_0x2bef7e(0x211)]();if(!_0xa26c4d)throw CliErrors[_0x2bef7e(0x212)]('user','Pass\x20--user\x20<id|name>.');const _0x352c54=_0x525241['flag']('expect-user-count'),_0x2fe719=_0x352c54===undefined||_0x352c54===null?undefined:Number(_0x352c54),_0x1ad119=await resolveRoleRef(_0x525241[_0x2bef7e(0x205)],_0x17f71a),_0x5e22ac=await resolveUserRef(_0xa26c4d),_0x6a02e9=await loadRoleUsers(_0x525241[_0x2bef7e(0x205)]);return computeRoleUserMutation({'operation':_0x1046cf,'appCode':_0x525241[_0x2bef7e(0x205)],'roleUsers':_0x6a02e9,'targetRoleId':_0x1ad119['id'],'user':{'userId':_0x5e22ac[_0x2bef7e(0x1d3)],'username':_0x5e22ac[_0x2bef7e(0x210)],'nickname':_0x5e22ac[_0x2bef7e(0x213)]},'dryRun':_0x2a334f,..._0x2fe719!==undefined?{'expectUserCount':_0x2fe719}:{}});}
1
+ const a176_0x28f530=a176_0xbb3d;(function(_0x1e6096,_0x10cb0b){const _0x501083=a176_0xbb3d,_0x4a7bfd=_0x1e6096();while(!![]){try{const _0x16b8ea=-parseInt(_0x501083(0xcb))/0x1+parseInt(_0x501083(0xa4))/0x2+-parseInt(_0x501083(0xaa))/0x3+parseInt(_0x501083(0xc0))/0x4+parseInt(_0x501083(0xa6))/0x5*(-parseInt(_0x501083(0xa2))/0x6)+parseInt(_0x501083(0xb7))/0x7*(-parseInt(_0x501083(0xb9))/0x8)+-parseInt(_0x501083(0x87))/0x9*(parseInt(_0x501083(0xc1))/0xa);if(_0x16b8ea===_0x10cb0b)break;else _0x4a7bfd['push'](_0x4a7bfd['shift']());}catch(_0x5e47f9){_0x4a7bfd['push'](_0x4a7bfd['shift']());}}}(a176_0x3910,0x41f2d));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':a176_0x28f530(0xba),'required':!![],'description':'Role\x20id\x20(from\x20`role\x20list`)'};function a176_0x3910(){const _0x4f9423=['push','tenant_code','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','authRequired','roleName','userCount','POST','\x20is\x20already\x20a\x20member\x20of\x20role\x20','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20','154aZgJbw','expect-user-count','96792fudyDW','number','userId','filter','Missing\x20user\x20reference.','CUSTOM','/smartapi/permit/user-role/update-user-list','2104488QLZFzG','110300rUPAnh','name','tenant','totalCount','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','dryRun','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','user-add','Disambiguate\x20with\x20--role\x20<id>.','Anti-drift\x20check\x20failed:\x20expected\x20','13763ZehOfC','user','appCode','\x22:\x20','str','splice','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','map','DEV','Cannot\x20','toLowerCase','Optional\x20role\x20remark/description','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','string','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','Disambiguate\x20with\x20--user\x20<id>.','Pass\x20--role\x20<id|name>.','No\x20tenant\x20member\x20matches\x20\x22','135tbPxwM','includes','trim','Role\x20name\x20\x22','remark','test','userList','role','permitCount','\x22\x20is\x20ambiguous\x20(ids:\x20','\x20member(s)\x20but\x20role\x20has\x20','\x20not\x20found\x20in\x20app\x20','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs',';\x20no\x20change.','Role\x20id\x20','\x22\x20not\x20found\x20in\x20app\x20','\x20is\x20not\x20a\x20member\x20of\x20role\x20','\x20built-in\x20role\x20','expectUserCount','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','nickname','validation','length','flagMissing','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','\x20not\x20found\x20in\x20the\x20user-role\x20list.','username','8334WaYgkB','roleType','876802UNtiLY','Role\x20name','715OqFLKm','join','User\x20','ADMIN','151140SgzEbq','find','Multiple\x20tenant\x20members\x20match\x20\x22'];a176_0x3910=function(){return _0x4f9423;};return a176_0x3910();}export const ROLE_REF_FLAG={'name':a176_0x28f530(0x8e),'type':a176_0x28f530(0xd8),'required':!![],'description':a176_0x28f530(0xd7)};export const USER_REF_FLAG={'name':a176_0x28f530(0xcc),'type':a176_0x28f530(0xd8),'required':!![],'description':a176_0x28f530(0xaf)};export const NAME_FLAG={'name':a176_0x28f530(0xc2),'type':'string','required':!![],'description':a176_0x28f530(0xa5)};export const USER_NAME_FLAG={'name':'name','type':a176_0x28f530(0xd8),'required':!![],'description':a176_0x28f530(0x9f)};export const REMARK_FLAG={'name':a176_0x28f530(0x8b),'type':a176_0x28f530(0xd8),'required':![],'description':a176_0x28f530(0xd6)};export const EXPECT_USER_COUNT_FLAG={'name':a176_0x28f530(0xb8),'type':'number','required':![],'description':a176_0x28f530(0x93)};export const BUILTIN_ROLE_TYPES=['ADMIN',a176_0x28f530(0xd3),'USER'];export function isBuiltinRole(_0x448c1b){const _0x2a0199=a176_0x28f530;return BUILTIN_ROLE_TYPES[_0x2a0199(0x88)](_0x448c1b);}export function assertCustomRole(_0x5c7e82,_0x44dbe3){const _0x9eada6=a176_0x28f530;if(_0x5c7e82[_0x9eada6(0xa3)]!==_0x9eada6(0xbe))throw CliErrors[_0x9eada6(0x9c)](_0x9eada6(0xd4)+_0x44dbe3+_0x9eada6(0x98)+_0x5c7e82[_0x9eada6(0xb2)]+'\x20('+_0x5c7e82['roleType']+').',_0x9eada6(0xc7));}export function assertPermConfigurable(_0x5cfa9f){const _0x3961e5=a176_0x28f530;if(_0x5cfa9f['roleType']===_0x3961e5(0xd3)||_0x5cfa9f[_0x3961e5(0xa3)]===_0x3961e5(0xa9))throw CliErrors[_0x3961e5(0x9c)](_0x3961e5(0xb6)+_0x5cfa9f[_0x3961e5(0xb2)]+'\x20('+_0x5cfa9f[_0x3961e5(0xa3)]+').',_0x3961e5(0xd9));}export function projectRole(_0x44d7ad){const _0x1b93f8=a176_0x28f530;return{'id':_0x44d7ad['id'],'roleName':_0x44d7ad['roleName'],'roleType':_0x44d7ad[_0x1b93f8(0xa3)],'remark':_0x44d7ad[_0x1b93f8(0x8b)],'userCount':_0x44d7ad[_0x1b93f8(0xb3)],'permitCount':_0x44d7ad[_0x1b93f8(0x8f)],'builtin':isBuiltinRole(_0x44d7ad[_0x1b93f8(0xa3)])};}export async function resolveRoleRef(_0x11f145,_0x2fa639){const _0x393d16=a176_0x28f530,_0x1995e9=_0x2fa639[_0x393d16(0x89)]();if(!_0x1995e9)throw CliErrors[_0x393d16(0x9c)]('Missing\x20role\x20reference.',_0x393d16(0xdb));if(/^\d+$/[_0x393d16(0x8c)](_0x1995e9))return getRoleById(_0x11f145,Number(_0x1995e9));const _0x20f6b3=await listAllAppRoles(_0x11f145),_0x2d7bbc=_0x20f6b3['filter'](_0x451a14=>_0x451a14[_0x393d16(0xb2)]===_0x1995e9);if(_0x2d7bbc[_0x393d16(0x9d)]===0x0)throw CliErrors[_0x393d16(0x9c)](_0x393d16(0x8a)+_0x1995e9+_0x393d16(0x96)+_0x11f145+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.');if(_0x2d7bbc['length']>0x1){const _0x53f96d=_0x2d7bbc[_0x393d16(0xd2)](_0x3e92ce=>_0x3e92ce['id'])[_0x393d16(0xa7)](',\x20');throw CliErrors[_0x393d16(0x9c)]('Role\x20name\x20\x22'+_0x1995e9+_0x393d16(0x90)+_0x53f96d+').',_0x393d16(0xc9));}return _0x2d7bbc[0x0];}export async function getRoleById(_0x335c0c,_0x2dbc4c){const _0x22992d=a176_0x28f530,_0x84f0a8=await getAppRole(_0x2dbc4c);if(!_0x84f0a8)throw CliErrors[_0x22992d(0x9c)](_0x22992d(0x95)+_0x2dbc4c+_0x22992d(0x92)+_0x335c0c+'.',_0x22992d(0xb0));return _0x84f0a8;}async function listAllAppRoles(_0x4b90c2){const _0x59f748=a176_0x28f530,_0x150820=0x64,_0x3c04fa=[];for(let _0x478b54=0x1;;_0x478b54+=0x1){const {items:_0x5b508c,paging:_0x26e43f}=await listAppRoles(_0x4b90c2,{'currentPage':_0x478b54,'pageSize':_0x150820});_0x3c04fa[_0x59f748(0xad)](..._0x5b508c);if(_0x5b508c[_0x59f748(0x9d)]<_0x150820||_0x26e43f&&_0x3c04fa[_0x59f748(0x9d)]>=_0x26e43f[_0x59f748(0xc4)])return _0x3c04fa;}}export async function resolveTenantCode(){const _0x583dde=a176_0x28f530,_0x12aaa5=await getSessionUserInfo(),_0x589fe3=_0x12aaa5?.[_0x583dde(0xcc)]?.[_0x583dde(0xc3)]?.[_0x583dde(0xae)];if(!_0x589fe3)throw CliErrors[_0x583dde(0xb1)](_0x583dde(0xd1));return _0x589fe3;}function matchMember(_0x1e3da8,_0x2200bf){const _0x216cfd=a176_0x28f530,_0x1f4f05=_0x2200bf[_0x216cfd(0x89)]()[_0x216cfd(0xd5)]();return(_0x1e3da8['nickname']??'')[_0x216cfd(0xd5)]()===_0x1f4f05||(_0x1e3da8[_0x216cfd(0xa1)]??'')[_0x216cfd(0xd5)]()===_0x1f4f05;}export async function resolveUserRef(_0x39b57c){const _0x3393bc=a176_0x28f530,_0x2159e4=_0x39b57c[_0x3393bc(0x89)]();if(!_0x2159e4)throw CliErrors[_0x3393bc(0x9c)](_0x3393bc(0xbd),'Pass\x20--user\x20<id|name>.');const _0x1ff08e=await resolveTenantCode(),_0x428d80=await getTenantMembers(_0x1ff08e);if(/^\d+$/[_0x3393bc(0x8c)](_0x2159e4)){const _0x126b26=Number(_0x2159e4),_0x179be1=_0x428d80['find'](_0x4a1f8e=>_0x4a1f8e['userId']===_0x126b26);return{'userId':_0x126b26,'username':_0x179be1?.['username']??String(_0x126b26),'nickname':_0x179be1?.[_0x3393bc(0x9b)],'matchedBy':'id'};}const _0x36fd20=_0x428d80[_0x3393bc(0xbc)](_0x366318=>matchMember(_0x366318,_0x2159e4));if(_0x36fd20[_0x3393bc(0x9d)]===0x0)throw CliErrors[_0x3393bc(0x9c)](_0x3393bc(0x86)+_0x2159e4+'\x22.',_0x3393bc(0x9a));if(_0x36fd20[_0x3393bc(0x9d)]>0x1){const _0x32d261=_0x36fd20[_0x3393bc(0xd2)](_0x33a722=>(_0x33a722[_0x3393bc(0x9b)]??_0x33a722[_0x3393bc(0xa1)]??'?')+'('+_0x33a722['userId']+')')['join'](',\x20');throw CliErrors[_0x3393bc(0x9c)](_0x3393bc(0xac)+_0x2159e4+_0x3393bc(0xce)+_0x32d261+'.',_0x3393bc(0xda));}const _0x459a75=_0x36fd20[0x0];return{'userId':_0x459a75[_0x3393bc(0xbb)],'username':_0x459a75[_0x3393bc(0xa1)]??String(_0x459a75['userId']),'nickname':_0x459a75[_0x3393bc(0x9b)],'matchedBy':'name'};}export const UPDATE_USER_LIST_PATH=a176_0x28f530(0xbf);function userIdsOf(_0x3a70e3){const _0x2c25b7=a176_0x28f530;return(_0x3a70e3?.['userList']??[])[_0x2c25b7(0xd2)](_0x4ff66c=>_0x4ff66c[_0x2c25b7(0xbb)]);}export function computeRoleUserMutation(_0x34340a){const _0x48a93c=a176_0x28f530,{operation:_0x3f1570,appCode:_0x205b21,roleUsers:_0x9e9521,targetRoleId:_0xf98ac8,user:_0x367a33}=_0x34340a,_0x2e9c3f=_0x9e9521[_0x48a93c(0xab)](_0x1d10d4=>_0x1d10d4['id']===_0xf98ac8);if(!_0x2e9c3f)throw CliErrors['validation'](_0x48a93c(0x95)+_0xf98ac8+_0x48a93c(0xa0),_0x48a93c(0xb0));const _0x4a3a9f=userIdsOf(_0x2e9c3f),_0x36050a=[];if(_0x34340a[_0x48a93c(0x99)]!==undefined&&_0x34340a[_0x48a93c(0x99)]!==_0x4a3a9f['length'])throw CliErrors[_0x48a93c(0x9c)](_0x48a93c(0xca)+_0x34340a[_0x48a93c(0x99)]+_0x48a93c(0x91)+_0x4a3a9f[_0x48a93c(0x9d)]+'.',_0x48a93c(0xc5));const _0x1314a8=_0x4a3a9f[_0x48a93c(0x88)](_0x367a33[_0x48a93c(0xbb)]);let _0x1de91a=![];const _0x214c51=[..._0x2e9c3f[_0x48a93c(0x8d)]];if(_0x3f1570===_0x48a93c(0xc8))_0x1314a8?_0x36050a[_0x48a93c(0xad)](_0x48a93c(0xa8)+_0x367a33[_0x48a93c(0xbb)]+_0x48a93c(0xb5)+_0x2e9c3f[_0x48a93c(0xb2)]+_0x48a93c(0x94)):(_0x214c51[_0x48a93c(0xad)]({'userId':_0x367a33['userId'],'username':_0x367a33[_0x48a93c(0xa1)],..._0x367a33[_0x48a93c(0x9b)]?{'nickname':_0x367a33['nickname']}:{}}),_0x1de91a=!![]);else{if(!_0x1314a8)_0x36050a[_0x48a93c(0xad)](_0x48a93c(0xa8)+_0x367a33['userId']+_0x48a93c(0x97)+_0x2e9c3f[_0x48a93c(0xb2)]+_0x48a93c(0x94));else{const _0x36fb19=_0x214c51['findIndex'](_0x5c240b=>_0x5c240b[_0x48a93c(0xbb)]===_0x367a33['userId']);if(_0x36fb19>=0x0)_0x214c51[_0x48a93c(0xd0)](_0x36fb19,0x1);_0x1de91a=!![];}}const _0x574e91=_0x9e9521[_0x48a93c(0xd2)](_0x474882=>_0x474882['id']===_0xf98ac8?{..._0x474882,'userList':_0x214c51}:_0x474882),_0x590281=_0x214c51[_0x48a93c(0xd2)](_0xcf32af=>_0xcf32af[_0x48a93c(0xbb)]),_0x540c6b={'operation':_0x3f1570,'selector':{'appCode':_0x205b21,'roleId':_0xf98ac8,'roleName':_0x2e9c3f[_0x48a93c(0xb2)],'userId':_0x367a33[_0x48a93c(0xbb)]},'before':{'userIds':_0x4a3a9f},'after':{'userIds':_0x590281},'dryRun':_0x34340a[_0x48a93c(0xc6)],'backend':{'method':_0x48a93c(0xb4),'path':UPDATE_USER_LIST_PATH},'warnings':_0x36050a};return{'roleList':_0x574e91,'mutation':_0x540c6b,'changed':_0x1de91a};}export async function loadRoleUsers(_0x409df3){return listRoleUsers(_0x409df3);}function a176_0xbb3d(_0x5da565,_0x39ef96){_0x5da565=_0x5da565-0x86;const _0x391069=a176_0x3910();let _0xbb3dc8=_0x391069[_0x5da565];return _0xbb3dc8;}export function readRoleRef(_0xa202b7){const _0x490fa2=a176_0x28f530,_0x357096=_0xa202b7[_0x490fa2(0xcf)](_0x490fa2(0x8e))[_0x490fa2(0x89)]();if(!_0x357096)throw CliErrors[_0x490fa2(0x9e)](_0x490fa2(0x8e),_0x490fa2(0xdb));return _0x357096;}export async function prepareUserMutation(_0x150124,_0x26d96b,_0x59d488){const _0x423173=a176_0x28f530,_0x30f5a4=readRoleRef(_0x150124),_0x292b9e=_0x150124[_0x423173(0xcf)]('user')[_0x423173(0x89)]();if(!_0x292b9e)throw CliErrors[_0x423173(0x9e)](_0x423173(0xcc),'Pass\x20--user\x20<id|name>.');const _0x55a13b=_0x150124['flag']('expect-user-count'),_0x4bea67=_0x55a13b===undefined||_0x55a13b===null?undefined:Number(_0x55a13b),_0x565e0d=await resolveRoleRef(_0x150124[_0x423173(0xcd)],_0x30f5a4),_0x2b944f=await resolveUserRef(_0x292b9e),_0x271aea=await loadRoleUsers(_0x150124['appCode']);return computeRoleUserMutation({'operation':_0x26d96b,'appCode':_0x150124[_0x423173(0xcd)],'roleUsers':_0x271aea,'targetRoleId':_0x565e0d['id'],'user':{'userId':_0x2b944f[_0x423173(0xbb)],'username':_0x2b944f['username'],'nickname':_0x2b944f[_0x423173(0x9b)]},'dryRun':_0x59d488,..._0x4bea67!==undefined?{'expectUserCount':_0x4bea67}:{}});}
@@ -1 +1 @@
1
- const a170_0x534149=a170_0x9f4b;function a170_0x9f4b(_0x380c91,_0xabb20){_0x380c91=_0x380c91-0xcb;const _0x473207=a170_0x4732();let _0x9f4b56=_0x473207[_0x380c91];return _0x9f4b56;}(function(_0x2f4547,_0x3bb337){const _0x145854=a170_0x9f4b,_0x2b246b=_0x2f4547();while(!![]){try{const _0x261da1=-parseInt(_0x145854(0xde))/0x1*(-parseInt(_0x145854(0xd6))/0x2)+-parseInt(_0x145854(0xe9))/0x3*(parseInt(_0x145854(0xe7))/0x4)+parseInt(_0x145854(0xea))/0x5*(-parseInt(_0x145854(0xd8))/0x6)+-parseInt(_0x145854(0xce))/0x7+parseInt(_0x145854(0xe5))/0x8+parseInt(_0x145854(0xd5))/0x9*(-parseInt(_0x145854(0xcb))/0xa)+parseInt(_0x145854(0xd0))/0xb*(parseInt(_0x145854(0xe6))/0xc);if(_0x261da1===_0x3bb337)break;else _0x2b246b['push'](_0x2b246b['shift']());}catch(_0x2131d1){_0x2b246b['push'](_0x2b246b['shift']());}}}(a170_0x4732,0x6c1e2));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH='/smartapi/permit/role/update';function readPatch(_0x51d408){const _0x1250dd=a170_0x9f4b,_0x2e1595=_0x51d408[_0x1250dd(0xd7)](_0x1250dd(0xd1)),_0x275b1f=_0x51d408[_0x1250dd(0xd7)](_0x1250dd(0xe1)),_0xe1f435={};if(_0x2e1595!==undefined&&_0x2e1595!==null){const _0x4fc593=String(_0x2e1595)[_0x1250dd(0xd4)]();if(!_0x4fc593)throw CliErrors[_0x1250dd(0xdd)](_0x1250dd(0xd2));if(_0x4fc593[_0x1250dd(0xdb)]>0x40)throw CliErrors[_0x1250dd(0xdd)]('Role\x20name\x20cannot\x20exceed\x2064\x20characters.');_0xe1f435[_0x1250dd(0xdc)]=_0x4fc593;}_0x275b1f!==undefined&&_0x275b1f!==null&&(_0xe1f435[_0x1250dd(0xe1)]=String(_0x275b1f));if(_0xe1f435[_0x1250dd(0xdc)]===undefined&&_0xe1f435[_0x1250dd(0xe1)]===undefined)throw CliErrors[_0x1250dd(0xdd)](_0x1250dd(0xe3),_0x1250dd(0xe2));return _0xe1f435;}export const roleUpdate={'service':a170_0x534149(0xd3),'command':a170_0x534149(0xd9),'description':a170_0x534149(0xcf),'risk':a170_0x534149(0xcc),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':'name','type':a170_0x534149(0xe8),'required':![],'description':a170_0x534149(0xdf)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x4e55b1){readPatch(_0x4e55b1);},async 'dryRun'(_0x50ef41){const _0x32cfa6=a170_0x534149,_0x2b3718=_0x50ef41[_0x32cfa6(0xe0)]('id'),_0x16e3ab=readPatch(_0x50ef41),_0x2b1ecb=await getRoleById(_0x50ef41[_0x32cfa6(0xcd)],_0x2b3718);return assertCustomRole(_0x2b1ecb,_0x32cfa6(0xd9)),asDryRunResult({'operation':_0x32cfa6(0xd9),'selector':{'appCode':_0x50ef41[_0x32cfa6(0xcd)],'roleId':_0x2b3718,'roleName':_0x2b1ecb[_0x32cfa6(0xdc)]},'before':projectRole(_0x2b1ecb),'after':projectRole({..._0x2b1ecb,..._0x16e3ab[_0x32cfa6(0xdc)]!==undefined?{'roleName':_0x16e3ab['roleName']}:{},..._0x16e3ab[_0x32cfa6(0xe1)]!==undefined?{'remark':_0x16e3ab[_0x32cfa6(0xe1)]}:{}}),'dryRun':!![],'backend':{'method':_0x32cfa6(0xda),'path':UPDATE_PATH},'warnings':[]},{'method':_0x32cfa6(0xda),'url':UPDATE_PATH});},async 'execute'(_0x4df792){const _0x482c8f=a170_0x534149,_0x104807=_0x4df792[_0x482c8f(0xe0)]('id'),_0x5526b1=readPatch(_0x4df792),_0xb10b2=await getRoleById(_0x4df792[_0x482c8f(0xcd)],_0x104807);assertCustomRole(_0xb10b2,_0x482c8f(0xd9)),await updateAppRole({'id':_0x104807,'appCode':_0x4df792[_0x482c8f(0xcd)],..._0x5526b1[_0x482c8f(0xdc)]!==undefined?{'roleName':_0x5526b1[_0x482c8f(0xdc)]}:{},..._0x5526b1['remark']!==undefined?{'remark':_0x5526b1[_0x482c8f(0xe1)]}:{}});const _0x41a27a=await getRoleById(_0x4df792[_0x482c8f(0xcd)],_0x104807);return{'ok':!![],'data':{'operation':_0x482c8f(0xd9),'selector':{'appCode':_0x4df792[_0x482c8f(0xcd)],'roleId':_0x104807,'roleName':_0x41a27a[_0x482c8f(0xdc)]},'before':projectRole(_0xb10b2),'after':projectRole(_0x41a27a),'dryRun':![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},'message':'Updated\x20role\x20'+_0x41a27a['roleName']+_0x482c8f(0xe4)+_0x104807+')'};}};function a170_0x4732(){const _0x7b04fb=['852eyTZba','5ssCjIQ','560zNWLWu','write','appCode','2131185jBmtNc','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','1452uLudol','name','--name\x20cannot\x20be\x20empty.','role','trim','119313MmNEef','205586BPWrDc','flag','1853334eUDnkL','update','POST','length','roleName','validation','3oUeTlU','New\x20role\x20name','num','remark','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','Nothing\x20to\x20update.','\x20(id=','4726808jrUWkW','97896XqLIct','2500KocAKl','string'];a170_0x4732=function(){return _0x7b04fb;};return a170_0x4732();}
1
+ const a177_0x5b4098=a177_0x4959;function a177_0x2552(){const _0x7f53eb=['5IuAaEF','\x20(id=','Updated\x20role\x20','192380bYNRfQ','remark','flag','appCode','name','1106680smvsyB','POST','176vzfZfi','Nothing\x20to\x20update.','trim','3012102LVJGDm','/smartapi/permit/role/update','num','1317939ywWFtr','700Hgpsjn','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','update','2948106nLCcIL','1OqZoQK','New\x20role\x20name','roleName','validation','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','--name\x20cannot\x20be\x20empty.','21960agpEgd','189386qkjsVL'];a177_0x2552=function(){return _0x7f53eb;};return a177_0x2552();}(function(_0x5ceaa4,_0x45b7ea){const _0x1e7bd4=a177_0x4959,_0x5e3fba=_0x5ceaa4();while(!![]){try{const _0x9fb8b7=-parseInt(_0x1e7bd4(0x148))/0x1*(parseInt(_0x1e7bd4(0x132))/0x2)+parseInt(_0x1e7bd4(0x143))/0x3+-parseInt(_0x1e7bd4(0x13b))/0x4+parseInt(_0x1e7bd4(0x133))/0x5*(parseInt(_0x1e7bd4(0x147))/0x6)+-parseInt(_0x1e7bd4(0x144))/0x7*(parseInt(_0x1e7bd4(0x131))/0x8)+parseInt(_0x1e7bd4(0x140))/0x9+parseInt(_0x1e7bd4(0x136))/0xa*(-parseInt(_0x1e7bd4(0x13d))/0xb);if(_0x9fb8b7===_0x45b7ea)break;else _0x5e3fba['push'](_0x5e3fba['shift']());}catch(_0x45e492){_0x5e3fba['push'](_0x5e3fba['shift']());}}}(a177_0x2552,0x4c177));function a177_0x4959(_0x5d475e,_0x3d756f){_0x5d475e=_0x5d475e-0x12d;const _0x255282=a177_0x2552();let _0x49596c=_0x255282[_0x5d475e];return _0x49596c;}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=a177_0x5b4098(0x141);function readPatch(_0x3579fa){const _0x303ec8=a177_0x5b4098,_0x4a24d3=_0x3579fa[_0x303ec8(0x138)](_0x303ec8(0x13a)),_0x551493=_0x3579fa[_0x303ec8(0x138)](_0x303ec8(0x137)),_0x3ce7f0={};if(_0x4a24d3!==undefined&&_0x4a24d3!==null){const _0x72f923=String(_0x4a24d3)[_0x303ec8(0x13f)]();if(!_0x72f923)throw CliErrors[_0x303ec8(0x12e)](_0x303ec8(0x130));if(_0x72f923['length']>0x40)throw CliErrors[_0x303ec8(0x12e)]('Role\x20name\x20cannot\x20exceed\x2064\x20characters.');_0x3ce7f0[_0x303ec8(0x12d)]=_0x72f923;}_0x551493!==undefined&&_0x551493!==null&&(_0x3ce7f0[_0x303ec8(0x137)]=String(_0x551493));if(_0x3ce7f0[_0x303ec8(0x12d)]===undefined&&_0x3ce7f0[_0x303ec8(0x137)]===undefined)throw CliErrors['validation'](_0x303ec8(0x13e),_0x303ec8(0x145));return _0x3ce7f0;}export const roleUpdate={'service':'role','command':a177_0x5b4098(0x146),'description':a177_0x5b4098(0x12f),'risk':'write','flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a177_0x5b4098(0x13a),'type':'string','required':![],'description':a177_0x5b4098(0x149)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x109ee3){readPatch(_0x109ee3);},async 'dryRun'(_0x43ea50){const _0x5688ff=a177_0x5b4098,_0x470489=_0x43ea50[_0x5688ff(0x142)]('id'),_0x325905=readPatch(_0x43ea50),_0x457753=await getRoleById(_0x43ea50[_0x5688ff(0x139)],_0x470489);return assertCustomRole(_0x457753,'update'),asDryRunResult({'operation':_0x5688ff(0x146),'selector':{'appCode':_0x43ea50[_0x5688ff(0x139)],'roleId':_0x470489,'roleName':_0x457753[_0x5688ff(0x12d)]},'before':projectRole(_0x457753),'after':projectRole({..._0x457753,..._0x325905['roleName']!==undefined?{'roleName':_0x325905[_0x5688ff(0x12d)]}:{},..._0x325905['remark']!==undefined?{'remark':_0x325905['remark']}:{}}),'dryRun':!![],'backend':{'method':_0x5688ff(0x13c),'path':UPDATE_PATH},'warnings':[]},{'method':_0x5688ff(0x13c),'url':UPDATE_PATH});},async 'execute'(_0x677ecf){const _0x1f4ed5=a177_0x5b4098,_0x563792=_0x677ecf[_0x1f4ed5(0x142)]('id'),_0x1ebfbe=readPatch(_0x677ecf),_0x384e4a=await getRoleById(_0x677ecf[_0x1f4ed5(0x139)],_0x563792);assertCustomRole(_0x384e4a,_0x1f4ed5(0x146)),await updateAppRole({'id':_0x563792,'appCode':_0x677ecf['appCode'],..._0x1ebfbe['roleName']!==undefined?{'roleName':_0x1ebfbe[_0x1f4ed5(0x12d)]}:{},..._0x1ebfbe[_0x1f4ed5(0x137)]!==undefined?{'remark':_0x1ebfbe['remark']}:{}});const _0x37f4e2=await getRoleById(_0x677ecf['appCode'],_0x563792);return{'ok':!![],'data':{'operation':'update','selector':{'appCode':_0x677ecf[_0x1f4ed5(0x139)],'roleId':_0x563792,'roleName':_0x37f4e2['roleName']},'before':projectRole(_0x384e4a),'after':projectRole(_0x37f4e2),'dryRun':![],'backend':{'method':_0x1f4ed5(0x13c),'path':UPDATE_PATH},'warnings':[]},'message':_0x1f4ed5(0x135)+_0x37f4e2['roleName']+_0x1f4ed5(0x134)+_0x563792+')'};}};
@@ -1 +1 @@
1
- const a171_0x305dea=a171_0xe20b;function a171_0xe20b(_0x3fd3d6,_0x103661){_0x3fd3d6=_0x3fd3d6-0xc8;const _0x501b0d=a171_0x501b();let _0xe20b6f=_0x501b0d[_0x3fd3d6];return _0xe20b6f;}(function(_0x39e57d,_0x483788){const _0x5111a9=a171_0xe20b,_0x21d886=_0x39e57d();while(!![]){try{const _0x2855f4=-parseInt(_0x5111a9(0xd5))/0x1*(-parseInt(_0x5111a9(0xce))/0x2)+parseInt(_0x5111a9(0xd4))/0x3*(-parseInt(_0x5111a9(0xcc))/0x4)+-parseInt(_0x5111a9(0xd1))/0x5*(parseInt(_0x5111a9(0xc8))/0x6)+-parseInt(_0x5111a9(0xda))/0x7*(parseInt(_0x5111a9(0xcb))/0x8)+parseInt(_0x5111a9(0xd9))/0x9+-parseInt(_0x5111a9(0xca))/0xa*(-parseInt(_0x5111a9(0xdd))/0xb)+parseInt(_0x5111a9(0xdb))/0xc;if(_0x2855f4===_0x483788)break;else _0x21d886['push'](_0x21d886['shift']());}catch(_0x557b4a){_0x21d886['push'](_0x21d886['shift']());}}}(a171_0x501b,0xdd112));function a171_0x501b(){const _0xda3991=['high-risk-write','role','6JaZUki','POST','1072310ukBJtk','8040OFkaWZ','7181764DksuPJ','\x20to\x20role\x20','536802QvysHA','user-add','appCode','4508675uOPLDt','Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','roleName','3yUoFAZ','1oVcPLC','userId','selector','Added\x20user\x20','6632415RPyNpR','5089zNYysI','29641404uPlHYi','\x20already\x20in\x20role\x20','88sXjuqZ'];a171_0x501b=function(){return _0xda3991;};return a171_0x501b();}import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a171_0x305dea(0xdf),'command':a171_0x305dea(0xcf),'description':a171_0x305dea(0xd2),'risk':a171_0x305dea(0xde),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x3606a3){const _0x7f7ceb=a171_0x305dea,{mutation:_0x3a97b7}=await prepareUserMutation(_0x3606a3,'user-add',!![]);return asDryRunResult(_0x3a97b7,{'method':_0x7f7ceb(0xc9),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x16d160){const _0x381210=a171_0x305dea,{roleList:_0x298dc0,mutation:_0x272d16,changed:_0x32b493}=await prepareUserMutation(_0x16d160,_0x381210(0xcf),![]);return _0x32b493&&await updateRoleUsers(_0x16d160[_0x381210(0xd0)],_0x298dc0),{'ok':!![],'data':_0x272d16,'message':_0x32b493?_0x381210(0xd8)+_0x272d16[_0x381210(0xd7)]['userId']+_0x381210(0xcd)+_0x272d16[_0x381210(0xd7)][_0x381210(0xd3)]:'No\x20change:\x20user\x20'+_0x272d16[_0x381210(0xd7)][_0x381210(0xd6)]+_0x381210(0xdc)+_0x272d16[_0x381210(0xd7)][_0x381210(0xd3)]};}};
1
+ function a178_0x3d4f(_0x477883,_0x4eb3e1){_0x477883=_0x477883-0x18a;const _0x2651a3=a178_0x2651();let _0x3d4f41=_0x2651a3[_0x477883];return _0x3d4f41;}const a178_0x1eca78=a178_0x3d4f;(function(_0x105ccd,_0x4ba7a8){const _0x248869=a178_0x3d4f,_0x6218f8=_0x105ccd();while(!![]){try{const _0x2f362e=-parseInt(_0x248869(0x19b))/0x1*(parseInt(_0x248869(0x196))/0x2)+parseInt(_0x248869(0x18c))/0x3*(-parseInt(_0x248869(0x197))/0x4)+parseInt(_0x248869(0x18b))/0x5+-parseInt(_0x248869(0x198))/0x6*(-parseInt(_0x248869(0x19c))/0x7)+parseInt(_0x248869(0x192))/0x8*(-parseInt(_0x248869(0x194))/0x9)+parseInt(_0x248869(0x193))/0xa+parseInt(_0x248869(0x19d))/0xb;if(_0x2f362e===_0x4ba7a8)break;else _0x6218f8['push'](_0x6218f8['shift']());}catch(_0xc1d724){_0x6218f8['push'](_0x6218f8['shift']());}}}(a178_0x2651,0x21684));function a178_0x2651(){const _0x4ed5fc=['377707FEsiKj','user-add','1040635dLXMtT','681MpJtTB','roleName','appCode','userId','\x20already\x20in\x20role\x20','\x20to\x20role\x20','287816hXSChp','37840PXBfDk','9YYUEAy','Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','259848xLqHVD','3356MUbQCv','82314nVJUyj','role','selector','1rFhsAu','126oSssTm'];a178_0x2651=function(){return _0x4ed5fc;};return a178_0x2651();}import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a178_0x1eca78(0x199),'command':a178_0x1eca78(0x18a),'description':a178_0x1eca78(0x195),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x52b839){const _0x1d44f5=a178_0x1eca78,{mutation:_0x232546}=await prepareUserMutation(_0x52b839,_0x1d44f5(0x18a),!![]);return asDryRunResult(_0x232546,{'method':'POST','url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x2130c3){const _0x594667=a178_0x1eca78,{roleList:_0x2b7770,mutation:_0x5b3838,changed:_0x4c67a3}=await prepareUserMutation(_0x2130c3,_0x594667(0x18a),![]);return _0x4c67a3&&await updateRoleUsers(_0x2130c3[_0x594667(0x18e)],_0x2b7770),{'ok':!![],'data':_0x5b3838,'message':_0x4c67a3?'Added\x20user\x20'+_0x5b3838[_0x594667(0x19a)][_0x594667(0x18f)]+_0x594667(0x191)+_0x5b3838[_0x594667(0x19a)][_0x594667(0x18d)]:'No\x20change:\x20user\x20'+_0x5b3838[_0x594667(0x19a)]['userId']+_0x594667(0x190)+_0x5b3838[_0x594667(0x19a)][_0x594667(0x18d)]};}};
@@ -1 +1 @@
1
- function a172_0x54a8(_0x3f3dff,_0x5b339e){_0x3f3dff=_0x3f3dff-0x19a;const _0x22dc66=a172_0x22dc();let _0x54a8b8=_0x22dc66[_0x3f3dff];return _0x54a8b8;}function a172_0x22dc(){const _0x55e18b=['\x20not\x20in\x20role\x20','168558BmoorF','1600299swkjQO','Removed\x20user\x20','128336dyMtWi','6pGSWgB','POST','role','selector','21mOlFBK','3477420aRCBEn','user-remove','628ixJwCy','appCode','roleName','4203Rvqwhm','77149XXexAt','userId','No\x20change:\x20user\x20','5145wTbNFZ'];a172_0x22dc=function(){return _0x55e18b;};return a172_0x22dc();}const a172_0x578a48=a172_0x54a8;(function(_0x205119,_0x28facb){const _0x1d4aa0=a172_0x54a8,_0xebaa87=_0x205119();while(!![]){try{const _0x599341=parseInt(_0x1d4aa0(0x1ad))/0x1+parseInt(_0x1d4aa0(0x1a2))/0x2*(parseInt(_0x1d4aa0(0x1ac))/0x3)+parseInt(_0x1d4aa0(0x1a9))/0x4*(-parseInt(_0x1d4aa0(0x19c))/0x5)+-parseInt(_0x1d4aa0(0x19e))/0x6+parseInt(_0x1d4aa0(0x1a6))/0x7*(parseInt(_0x1d4aa0(0x1a1))/0x8)+-parseInt(_0x1d4aa0(0x19f))/0x9+parseInt(_0x1d4aa0(0x1a7))/0xa;if(_0x599341===_0x28facb)break;else _0xebaa87['push'](_0xebaa87['shift']());}catch(_0x32b5b9){_0xebaa87['push'](_0xebaa87['shift']());}}}(a172_0x22dc,0x1acc3));import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':a172_0x578a48(0x1a4),'command':a172_0x578a48(0x1a8),'description':'Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x128716){const _0x2da7a6=a172_0x578a48,{mutation:_0x35674b}=await prepareUserMutation(_0x128716,_0x2da7a6(0x1a8),!![]);return asDryRunResult(_0x35674b,{'method':_0x2da7a6(0x1a3),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x85987f){const _0x1443ad=a172_0x578a48,{roleList:_0x3e7c0c,mutation:_0xa00298,changed:_0x2ce4b6}=await prepareUserMutation(_0x85987f,_0x1443ad(0x1a8),![]);return _0x2ce4b6&&await updateRoleUsers(_0x85987f[_0x1443ad(0x1aa)],_0x3e7c0c),{'ok':!![],'data':_0xa00298,'message':_0x2ce4b6?_0x1443ad(0x1a0)+_0xa00298[_0x1443ad(0x1a5)][_0x1443ad(0x19a)]+'\x20from\x20role\x20'+_0xa00298[_0x1443ad(0x1a5)][_0x1443ad(0x1ab)]:_0x1443ad(0x19b)+_0xa00298[_0x1443ad(0x1a5)][_0x1443ad(0x19a)]+_0x1443ad(0x19d)+_0xa00298[_0x1443ad(0x1a5)][_0x1443ad(0x1ab)]};}};
1
+ function a179_0x5e4f(_0x3bd098,_0x29a7f2){_0x3bd098=_0x3bd098-0x1d1;const _0x2bf27e=a179_0x2bf2();let _0x5e4f06=_0x2bf27e[_0x3bd098];return _0x5e4f06;}function a179_0x2bf2(){const _0x5342b5=['\x20from\x20role\x20','POST','selector','19CSDqdv','33AyqYdp','appCode','4112976MkMXnF','669326nddFFq','38902PTRrWp','Removed\x20user\x20','796365unOLbX','1773288kEBsnG','No\x20change:\x20user\x20','role','18qSUkZL','\x20not\x20in\x20role\x20','high-risk-write','8295190lOLmnJ','roleName','48yLsLyT','943350ZkTDVu','user-remove','userId'];a179_0x2bf2=function(){return _0x5342b5;};return a179_0x2bf2();}const a179_0x2c5644=a179_0x5e4f;(function(_0x5f5e79,_0x4d9084){const _0x591e9c=a179_0x5e4f,_0x19824f=_0x5f5e79();while(!![]){try{const _0x2c6655=-parseInt(_0x591e9c(0x1e2))/0x1*(parseInt(_0x591e9c(0x1e7))/0x2)+parseInt(_0x591e9c(0x1dc))/0x3+-parseInt(_0x591e9c(0x1e5))/0x4+parseInt(_0x591e9c(0x1d2))/0x5+-parseInt(_0x591e9c(0x1d6))/0x6*(-parseInt(_0x591e9c(0x1e6))/0x7)+-parseInt(_0x591e9c(0x1db))/0x8*(parseInt(_0x591e9c(0x1d3))/0x9)+parseInt(_0x591e9c(0x1d9))/0xa*(parseInt(_0x591e9c(0x1e3))/0xb);if(_0x2c6655===_0x4d9084)break;else _0x19824f['push'](_0x19824f['shift']());}catch(_0x52938e){_0x19824f['push'](_0x19824f['shift']());}}}(a179_0x2bf2,0xa35c9));import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':a179_0x2c5644(0x1d5),'command':a179_0x2c5644(0x1dd),'description':'Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','risk':a179_0x2c5644(0x1d8),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x4094df){const _0x9d5094=a179_0x2c5644,{mutation:_0x3ebe6f}=await prepareUserMutation(_0x4094df,_0x9d5094(0x1dd),!![]);return asDryRunResult(_0x3ebe6f,{'method':_0x9d5094(0x1e0),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x4ed33b){const _0x53c40b=a179_0x2c5644,{roleList:_0x192856,mutation:_0x3b0b25,changed:_0x40b98d}=await prepareUserMutation(_0x4ed33b,_0x53c40b(0x1dd),![]);return _0x40b98d&&await updateRoleUsers(_0x4ed33b[_0x53c40b(0x1e4)],_0x192856),{'ok':!![],'data':_0x3b0b25,'message':_0x40b98d?_0x53c40b(0x1d1)+_0x3b0b25[_0x53c40b(0x1e1)]['userId']+_0x53c40b(0x1df)+_0x3b0b25['selector'][_0x53c40b(0x1da)]:_0x53c40b(0x1d4)+_0x3b0b25[_0x53c40b(0x1e1)][_0x53c40b(0x1de)]+_0x53c40b(0x1d7)+_0x3b0b25[_0x53c40b(0x1e1)][_0x53c40b(0x1da)]};}};
@@ -1 +1 @@
1
- const a173_0x3fbba1=a173_0x34cc;(function(_0xcbc972,_0x5919ae){const _0x5d5da9=a173_0x34cc,_0x4b4c2f=_0xcbc972();while(!![]){try{const _0x482036=parseInt(_0x5d5da9(0x10e))/0x1+parseInt(_0x5d5da9(0x101))/0x2+-parseInt(_0x5d5da9(0x108))/0x3+parseInt(_0x5d5da9(0x100))/0x4+parseInt(_0x5d5da9(0xff))/0x5*(parseInt(_0x5d5da9(0x114))/0x6)+-parseInt(_0x5d5da9(0x103))/0x7+parseInt(_0x5d5da9(0x10f))/0x8*(-parseInt(_0x5d5da9(0x109))/0x9);if(_0x482036===_0x5919ae)break;else _0x4b4c2f['push'](_0x4b4c2f['shift']());}catch(_0x2de0ea){_0x4b4c2f['push'](_0x4b4c2f['shift']());}}}(a173_0x46bc,0xc37cf));import{CliErrors}from'../../errors.js';function a173_0x34cc(_0x230661,_0x549e22){_0x230661=_0x230661-0xff;const _0x46bcf8=a173_0x46bc();let _0x34cc74=_0x46bcf8[_0x230661];return _0x34cc74;}function a173_0x46bc(){const _0x20b176=['nickname','\x22\x20→\x20userId\x20','userId','name','3368025WmtqFj','55719ejNFyp','user-resolve','Resolved\x20\x22','trim','Pass\x20--name\x20<nickname|username>.','654943RZLHzT','320KktqxB','username','matchedBy','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','str','1104NxvazO','12990lpHpeC','5294768zenPqH','92730aDZGKr','read','2323986ZaZBmP'];a173_0x46bc=function(){return _0x20b176;};return a173_0x46bc();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':'role','command':a173_0x3fbba1(0x10a),'description':a173_0x3fbba1(0x112),'risk':a173_0x3fbba1(0x102),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x44ee56){const _0x22b405=a173_0x3fbba1;if(!_0x44ee56[_0x22b405(0x113)](_0x22b405(0x107))[_0x22b405(0x10c)]())throw CliErrors['flagMissing'](_0x22b405(0x107),_0x22b405(0x10d));},async 'execute'(_0x480d3a){const _0x5cb836=a173_0x3fbba1,_0x3b53f5=_0x480d3a[_0x5cb836(0x113)](_0x5cb836(0x107))[_0x5cb836(0x10c)](),_0x382132=await resolveUserRef(_0x3b53f5);return{'ok':!![],'data':{'user':{'userId':_0x382132[_0x5cb836(0x106)],'username':_0x382132[_0x5cb836(0x110)],'nickname':_0x382132[_0x5cb836(0x104)],'matchedBy':_0x382132[_0x5cb836(0x111)]}},'message':_0x5cb836(0x10b)+_0x3b53f5+_0x5cb836(0x105)+_0x382132[_0x5cb836(0x106)]};}};
1
+ const a180_0x31ae93=a180_0x36fc;function a180_0x1c18(){const _0x5bcc67=['user-resolve','1211355EGteZz','username','Pass\x20--name\x20<nickname|username>.','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','368547wUlKAo','1297780exOvpb','flagMissing','nickname','404303JbiLZn','str','16mtMOVm','name','16JJcnfh','trim','1846182jqHgiS','120Bmiqlk','role','userId','307130yFieXS','\x22\x20→\x20userId\x20','397691GiItBY'];a180_0x1c18=function(){return _0x5bcc67;};return a180_0x1c18();}function a180_0x36fc(_0x4983a6,_0xf8c312){_0x4983a6=_0x4983a6-0x165;const _0x1c189e=a180_0x1c18();let _0x36fcc2=_0x1c189e[_0x4983a6];return _0x36fcc2;}(function(_0x5fdc26,_0x5da2a1){const _0x47ff94=a180_0x36fc,_0xe3eaca=_0x5fdc26();while(!![]){try{const _0x56b63f=parseInt(_0x47ff94(0x167))/0x1+parseInt(_0x47ff94(0x16d))/0x2+parseInt(_0x47ff94(0x179))/0x3*(parseInt(_0x47ff94(0x16b))/0x4)+parseInt(_0x47ff94(0x171))/0x5*(-parseInt(_0x47ff94(0x16e))/0x6)+-parseInt(_0x47ff94(0x173))/0x7*(-parseInt(_0x47ff94(0x169))/0x8)+-parseInt(_0x47ff94(0x175))/0x9+parseInt(_0x47ff94(0x17a))/0xa;if(_0x56b63f===_0x5da2a1)break;else _0xe3eaca['push'](_0xe3eaca['shift']());}catch(_0x33d213){_0xe3eaca['push'](_0xe3eaca['shift']());}}}(a180_0x1c18,0xaaac7));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':a180_0x31ae93(0x16f),'command':a180_0x31ae93(0x174),'description':a180_0x31ae93(0x178),'risk':'read','flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2d21f8){const _0x19760f=a180_0x31ae93;if(!_0x2d21f8[_0x19760f(0x168)](_0x19760f(0x16a))[_0x19760f(0x16c)]())throw CliErrors[_0x19760f(0x165)](_0x19760f(0x16a),_0x19760f(0x177));},async 'execute'(_0x370ff2){const _0x5b1ff5=a180_0x31ae93,_0x387d8e=_0x370ff2['str']('name')['trim'](),_0x5e6294=await resolveUserRef(_0x387d8e);return{'ok':!![],'data':{'user':{'userId':_0x5e6294[_0x5b1ff5(0x170)],'username':_0x5e6294[_0x5b1ff5(0x176)],'nickname':_0x5e6294[_0x5b1ff5(0x166)],'matchedBy':_0x5e6294['matchedBy']}},'message':'Resolved\x20\x22'+_0x387d8e+_0x5b1ff5(0x172)+_0x5e6294['userId']};}};
@@ -1 +1 @@
1
- const a174_0x3b7545=a174_0x1125;(function(_0x3a9d8b,_0x2444f1){const _0x4209a7=a174_0x1125,_0x4cbf86=_0x3a9d8b();while(!![]){try{const _0x129b3f=parseInt(_0x4209a7(0x126))/0x1+parseInt(_0x4209a7(0x104))/0x2+parseInt(_0x4209a7(0x125))/0x3+parseInt(_0x4209a7(0x138))/0x4+parseInt(_0x4209a7(0x105))/0x5*(parseInt(_0x4209a7(0x10c))/0x6)+parseInt(_0x4209a7(0x12b))/0x7*(-parseInt(_0x4209a7(0x11f))/0x8)+-parseInt(_0x4209a7(0x129))/0x9*(parseInt(_0x4209a7(0x107))/0xa);if(_0x129b3f===_0x2444f1)break;else _0x4cbf86['push'](_0x4cbf86['shift']());}catch(_0x36a6b9){_0x4cbf86['push'](_0x4cbf86['shift']());}}}(a174_0x4c05,0x1901f));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a174_0x3b7545(0x10e),a174_0x3b7545(0x127)]);function readPackageScripts(_0xfb4d7a){const _0x8b9a11=a174_0x3b7545,_0x40b07c=resolve(_0xfb4d7a,_0x8b9a11(0x10d));if(!existsSync(_0x40b07c))return null;try{const _0x36c3eb=JSON[_0x8b9a11(0x119)](readFileSync(_0x40b07c,_0x8b9a11(0x114)));return _0x36c3eb['scripts']??{};}catch{return null;}}function detectPackageManager(_0x4b82d4){const _0x95adfa=a174_0x3b7545;if(existsSync(resolve(_0x4b82d4,_0x95adfa(0x132)))||existsSync(resolve(_0x4b82d4,'bun.lock')))return'bun';if(existsSync(resolve(_0x4b82d4,_0x95adfa(0x111))))return'pnpm';if(existsSync(resolve(_0x4b82d4,'yarn.lock')))return _0x95adfa(0x10b);return _0x95adfa(0x106);}async function versionCheck(_0x2a7f44){const _0xac2d76=a174_0x3b7545,_0x57caa3=await checkCliVersion();(_0x57caa3['needsUpgrade']||_0x57caa3[_0xac2d76(0x11d)])&&(printCliUpgradeWarning(_0x57caa3),assertCliVersionSupported(_0x57caa3));const _0x5df83c=await checkSdkVersion(_0x2a7f44);if(_0x5df83c[_0xac2d76(0x121)])printSdkUpgradeWarning(_0x5df83c);}function spawnScript(_0x1b766b,_0x341f06,_0x5ea19f,_0x263804){return new Promise((_0x48ef19,_0x4994ba)=>{const _0x51c891=a174_0x1125,_0x82a34e=[_0x51c891(0x10a),_0x341f06,..._0x5ea19f],_0x388f2f=spawn(_0x1b766b,_0x82a34e,{'cwd':_0x263804,'stdio':_0x51c891(0x11b),'shell':!![],'env':{...process.env,'PATH':''+join(_0x263804,_0x51c891(0x116),_0x51c891(0x135))+delimiter+process.env.PATH}});_0x388f2f['on'](_0x51c891(0x136),_0x55426a=>{const _0x3ca4b8=_0x51c891;if(_0x55426a===0x0||_0x55426a===null)_0x48ef19();else _0x4994ba(new Error(_0x1b766b+_0x3ca4b8(0x112)+_0x341f06+_0x3ca4b8(0x117)+_0x55426a));}),_0x388f2f['on']('error',_0x4994ba);});}function spawnViteBuildWatch(_0x33a984){return new Promise((_0x399429,_0xa90142)=>{const _0x429c7a=a174_0x1125,_0x547b5f=spawn('vite',['build',_0x429c7a(0x11e)],{'cwd':_0x33a984,'stdio':_0x429c7a(0x11b),'shell':!![],'env':{...process.env,'PATH':''+join(_0x33a984,_0x429c7a(0x116),_0x429c7a(0x135))+delimiter+process.env.PATH}});_0x547b5f['on'](_0x429c7a(0x136),_0x2eab86=>{if(_0x2eab86===0x0||_0x2eab86===null)_0x399429();else _0xa90142(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x2eab86));}),_0x547b5f['on'](_0x429c7a(0x139),_0xa90142);});}function spawnVitePreview(_0x20899b){return new Promise((_0x56ce72,_0xd0dfa0)=>{const _0xa9be7b=a174_0x1125,_0x51dd73=spawn(_0xa9be7b(0x13d),[_0xa9be7b(0x109)],{'cwd':_0x20899b,'stdio':_0xa9be7b(0x11b),'shell':!![],'env':{...process.env,'PATH':''+join(_0x20899b,'node_modules',_0xa9be7b(0x135))+delimiter+process.env.PATH}});_0x51dd73['on'](_0xa9be7b(0x136),_0x59d447=>{const _0x545af0=_0xa9be7b;if(_0x59d447===0x0||_0x59d447===null)_0x56ce72();else _0xd0dfa0(new Error(_0x545af0(0x12f)+_0x59d447));}),_0x51dd73['on']('error',_0xd0dfa0);});}function a174_0x4c05(){const _0x474a15=['needsUpgrade','\x20run\x20preview','\x20run\x20start','\x20\x20\x20\x20','92721yqhAuW','24174DxdEtR','dev','No\x20package.json\x20found\x20in\x20current\x20directory.','11862uzFUxv','has','1393553XwszXv','log','push','Run\x20a\x20package.json\x20script','vite\x20preview\x20exited\x20with\x20code\x20','read','No\x20scripts\x20defined\x20in\x20package.json.','bun.lockb','watch','\x22\x20not\x20found\x20in\x20package.json.','.bin','close','all','736452BhEQmG','error','Available:\x20','validation','\x20run\x20<script>\x0a','vite','228834cPuSbJ','205MSqvHc','npm','940uYMsji','join','preview','run','yarn','10506DhbsdQ','package.json','start','args','script','pnpm-lock.yaml','\x20run\x20','Enable\x20watch\x20mode\x20for\x20preview','utf-8','\x20\x20EXAMPLES','node_modules','\x20exited\x20with\x20code\x20','boolean','parse','keys','inherit','\x0a\x20\x20Usage:\x20','belowMinimum','--watch','8LPeDmU','\x20run\x20build'];a174_0x4c05=function(){return _0x474a15;};return a174_0x4c05();}const runFlags=[{'name':a174_0x3b7545(0x133),'type':a174_0x3b7545(0x118),'description':a174_0x3b7545(0x113),'default':![]}];function a174_0x1125(_0x469241,_0x17128b){_0x469241=_0x469241-0x104;const _0x4c05aa=a174_0x4c05();let _0x112508=_0x4c05aa[_0x469241];return _0x112508;}export const runDefinition={'service':a174_0x3b7545(0x10a),'command':a174_0x3b7545(0x10a),'description':a174_0x3b7545(0x12e),'risk':a174_0x3b7545(0x130),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a174_0x3b7545(0x110),'description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x5961ea=a174_0x3b7545,_0x4afa9c=[];return _0x4afa9c[_0x5961ea(0x12d)](_0x5961ea(0x115)),_0x4afa9c[_0x5961ea(0x12d)](_0x5961ea(0x124)+CLI_BIN_NAME+_0x5961ea(0x123)),_0x4afa9c[_0x5961ea(0x12d)](_0x5961ea(0x124)+CLI_BIN_NAME+_0x5961ea(0x120)),_0x4afa9c['push'](_0x5961ea(0x124)+CLI_BIN_NAME+_0x5961ea(0x122)),_0x4afa9c[_0x5961ea(0x12d)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x4afa9c['join']('\x0a');},async 'execute'(_0x85caa9){const _0x2299fe=a174_0x3b7545,_0x4ad380=process['cwd'](),_0x541a93=_0x85caa9[_0x2299fe(0x10f)][0x0],_0x5d0366=_0x85caa9[_0x2299fe(0x10f)]['slice'](0x1),_0x474220=readPackageScripts(_0x4ad380);if(!_0x474220)throw CliErrors[_0x2299fe(0x13b)](_0x2299fe(0x128));if(!_0x541a93){const _0x5bb4c2=Object['keys'](_0x474220);if(_0x5bb4c2['length']===0x0)console[_0x2299fe(0x12c)](_0x2299fe(0x131));else{console['log']('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x116d72 of _0x5bb4c2){console['log'](_0x2299fe(0x124)+_0x116d72);}console[_0x2299fe(0x12c)](_0x2299fe(0x11c)+CLI_BIN_NAME+_0x2299fe(0x13c));}return{'ok':!![]};}if(!_0x474220[_0x541a93])throw CliErrors[_0x2299fe(0x13b)]('Script\x20\x22'+_0x541a93+_0x2299fe(0x134),_0x2299fe(0x13a)+(Object[_0x2299fe(0x11a)](_0x474220)[_0x2299fe(0x108)](',\x20')||'(none)'));const _0x53b698=detectPackageManager(_0x4ad380);VERSION_CHECK_SCRIPTS[_0x2299fe(0x12a)](_0x541a93)&&await versionCheck(_0x4ad380);if(_0x541a93==='preview'&&_0x85caa9['bool'](_0x2299fe(0x133)))return await Promise[_0x2299fe(0x137)]([spawnViteBuildWatch(_0x4ad380),spawnVitePreview(_0x4ad380)]),{'ok':!![]};return await spawnScript(_0x53b698,_0x541a93,_0x5d0366,_0x4ad380),{'ok':!![]};}};
1
+ const a181_0x57e2d4=a181_0x5cc5;(function(_0x45987b,_0xdc5b76){const _0x452acf=a181_0x5cc5,_0x4eff69=_0x45987b();while(!![]){try{const _0x2addf4=parseInt(_0x452acf(0xf8))/0x1*(-parseInt(_0x452acf(0xed))/0x2)+parseInt(_0x452acf(0x106))/0x3+parseInt(_0x452acf(0xf0))/0x4*(-parseInt(_0x452acf(0xf6))/0x5)+-parseInt(_0x452acf(0xf5))/0x6*(parseInt(_0x452acf(0xf3))/0x7)+-parseInt(_0x452acf(0xe0))/0x8+parseInt(_0x452acf(0xd2))/0x9*(-parseInt(_0x452acf(0x10c))/0xa)+-parseInt(_0x452acf(0xd9))/0xb*(-parseInt(_0x452acf(0xfe))/0xc);if(_0x2addf4===_0xdc5b76)break;else _0x4eff69['push'](_0x4eff69['shift']());}catch(_0x2472f7){_0x4eff69['push'](_0x4eff69['shift']());}}}(a181_0x555f,0x9b309));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(['start',a181_0x57e2d4(0xf1)]);function readPackageScripts(_0x1f304d){const _0x1c4c09=a181_0x57e2d4,_0x58bae3=resolve(_0x1f304d,_0x1c4c09(0x107));if(!existsSync(_0x58bae3))return null;try{const _0x44916f=JSON[_0x1c4c09(0xdc)](readFileSync(_0x58bae3,_0x1c4c09(0x105)));return _0x44916f['scripts']??{};}catch{return null;}}function detectPackageManager(_0x422b50){const _0x5bdfdd=a181_0x57e2d4;if(existsSync(resolve(_0x422b50,_0x5bdfdd(0xe1)))||existsSync(resolve(_0x422b50,'bun.lock')))return _0x5bdfdd(0x10a);if(existsSync(resolve(_0x422b50,_0x5bdfdd(0xe7))))return'pnpm';if(existsSync(resolve(_0x422b50,_0x5bdfdd(0xee))))return _0x5bdfdd(0xda);return'npm';}async function versionCheck(_0x212eab){const _0x4de7cb=a181_0x57e2d4,_0x55dbee=await checkCliVersion();(_0x55dbee[_0x4de7cb(0x102)]||_0x55dbee[_0x4de7cb(0x108)])&&(printCliUpgradeWarning(_0x55dbee),assertCliVersionSupported(_0x55dbee));const _0x3a87f4=await checkSdkVersion(_0x212eab);if(_0x3a87f4[_0x4de7cb(0x102)])printSdkUpgradeWarning(_0x3a87f4);}function a181_0x5cc5(_0x26545b,_0x4756c3){_0x26545b=_0x26545b-0xd1;const _0x555f5d=a181_0x555f();let _0x5cc570=_0x555f5d[_0x26545b];return _0x5cc570;}function a181_0x555f(){const _0xfc28cd=['run','pnpm-lock.yaml','\x20\x20\x20\x20','node_modules','Run\x20a\x20package.json\x20script','No\x20package.json\x20found\x20in\x20current\x20directory.','cwd','4WrsbhE','yarn.lock','vite','4AzrpjJ','dev','validation','294jwcidI','Script\x20name\x20defined\x20in\x20package.json','130734NDquJD','2514685XXNOUE','keys','113494kuyNsC','args','vite\x20preview\x20exited\x20with\x20code\x20','preview','\x20run\x20start','error','1541544vYEntM','\x0a\x20\x20Available\x20scripts:\x0a','--watch','Available:\x20','needsUpgrade','close','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','utf-8','1792317wduCnH','package.json','belowMinimum','script','bun','.bin','10CQXCZo','all','2307321xoefaS','\x0a\x20\x20Usage:\x20','\x20exited\x20with\x20code\x20','push','log','(none)','inherit','253krxDdX','yarn','bool','parse','length','slice','\x22\x20not\x20found\x20in\x20package.json.','8119808ePzARH','bun.lockb','join','watch','read','\x20run\x20'];a181_0x555f=function(){return _0xfc28cd;};return a181_0x555f();}function spawnScript(_0x595608,_0x26eee3,_0x137306,_0x8019ce){return new Promise((_0x5c4667,_0x23b0e3)=>{const _0x55cf10=a181_0x5cc5,_0x1c1692=['run',_0x26eee3,..._0x137306],_0x49dffb=spawn(_0x595608,_0x1c1692,{'cwd':_0x8019ce,'stdio':_0x55cf10(0xd8),'shell':!![],'env':{...process.env,'PATH':''+join(_0x8019ce,_0x55cf10(0xe9),'.bin')+delimiter+process.env.PATH}});_0x49dffb['on'](_0x55cf10(0x103),_0xf514ce=>{const _0x59e7ac=_0x55cf10;if(_0xf514ce===0x0||_0xf514ce===null)_0x5c4667();else _0x23b0e3(new Error(_0x595608+_0x59e7ac(0xe5)+_0x26eee3+_0x59e7ac(0xd4)+_0xf514ce));}),_0x49dffb['on'](_0x55cf10(0xfd),_0x23b0e3);});}function spawnViteBuildWatch(_0x5bab80){return new Promise((_0x31b194,_0xcaaf44)=>{const _0x4555a3=a181_0x5cc5,_0x2ddcce=spawn(_0x4555a3(0xef),['build',_0x4555a3(0x100)],{'cwd':_0x5bab80,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x5bab80,'node_modules',_0x4555a3(0x10b))+delimiter+process.env.PATH}});_0x2ddcce['on'](_0x4555a3(0x103),_0xdb3018=>{const _0xf61fd8=_0x4555a3;if(_0xdb3018===0x0||_0xdb3018===null)_0x31b194();else _0xcaaf44(new Error(_0xf61fd8(0x104)+_0xdb3018));}),_0x2ddcce['on'](_0x4555a3(0xfd),_0xcaaf44);});}function spawnVitePreview(_0x3bf5c1){return new Promise((_0x2279e2,_0x531b69)=>{const _0x83ffbb=a181_0x5cc5,_0x1b9389=spawn(_0x83ffbb(0xef),['preview'],{'cwd':_0x3bf5c1,'stdio':_0x83ffbb(0xd8),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3bf5c1,_0x83ffbb(0xe9),_0x83ffbb(0x10b))+delimiter+process.env.PATH}});_0x1b9389['on'](_0x83ffbb(0x103),_0xc0ca86=>{const _0x1222d1=_0x83ffbb;if(_0xc0ca86===0x0||_0xc0ca86===null)_0x2279e2();else _0x531b69(new Error(_0x1222d1(0xfa)+_0xc0ca86));}),_0x1b9389['on'](_0x83ffbb(0xfd),_0x531b69);});}const runFlags=[{'name':a181_0x57e2d4(0xe3),'type':'boolean','description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a181_0x57e2d4(0xe6),'command':a181_0x57e2d4(0xe6),'description':a181_0x57e2d4(0xea),'risk':a181_0x57e2d4(0xe4),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a181_0x57e2d4(0x109),'description':a181_0x57e2d4(0xf4),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x325aeb=a181_0x57e2d4,_0x2f8741=[];return _0x2f8741['push']('\x20\x20EXAMPLES'),_0x2f8741['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x325aeb(0xfc)),_0x2f8741[_0x325aeb(0xd5)](_0x325aeb(0xe8)+CLI_BIN_NAME+'\x20run\x20build'),_0x2f8741[_0x325aeb(0xd5)](_0x325aeb(0xe8)+CLI_BIN_NAME+'\x20run\x20preview'),_0x2f8741[_0x325aeb(0xd5)](_0x325aeb(0xe8)+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x2f8741[_0x325aeb(0xe2)]('\x0a');},async 'execute'(_0x68224b){const _0x59ae09=a181_0x57e2d4,_0x5a55c2=process[_0x59ae09(0xec)](),_0x5b99c3=_0x68224b[_0x59ae09(0xf9)][0x0],_0x5de2d5=_0x68224b[_0x59ae09(0xf9)][_0x59ae09(0xde)](0x1),_0x2cb56f=readPackageScripts(_0x5a55c2);if(!_0x2cb56f)throw CliErrors['validation'](_0x59ae09(0xeb));if(!_0x5b99c3){const _0x2e328b=Object[_0x59ae09(0xf7)](_0x2cb56f);if(_0x2e328b[_0x59ae09(0xdd)]===0x0)console[_0x59ae09(0xd6)]('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x59ae09(0xd6)](_0x59ae09(0xff));for(const _0x5726c2 of _0x2e328b){console[_0x59ae09(0xd6)](_0x59ae09(0xe8)+_0x5726c2);}console[_0x59ae09(0xd6)](_0x59ae09(0xd3)+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x2cb56f[_0x5b99c3])throw CliErrors[_0x59ae09(0xf2)]('Script\x20\x22'+_0x5b99c3+_0x59ae09(0xdf),_0x59ae09(0x101)+(Object[_0x59ae09(0xf7)](_0x2cb56f)['join'](',\x20')||_0x59ae09(0xd7)));const _0x44272d=detectPackageManager(_0x5a55c2);VERSION_CHECK_SCRIPTS['has'](_0x5b99c3)&&await versionCheck(_0x5a55c2);if(_0x5b99c3===_0x59ae09(0xfb)&&_0x68224b[_0x59ae09(0xdb)](_0x59ae09(0xe3)))return await Promise[_0x59ae09(0xd1)]([spawnViteBuildWatch(_0x5a55c2),spawnVitePreview(_0x5a55c2)]),{'ok':!![]};return await spawnScript(_0x44272d,_0x5b99c3,_0x5de2d5,_0x5a55c2),{'ok':!![]};}};
@@ -1 +1 @@
1
- const a175_0x8f7ac7=a175_0x1d05;function a175_0x1973(){const _0x10ce1c=['json','schema','1915827jsJuPd','read','1084DJKZdK','export','Export\x20machine-readable\x20command\x20schema\x20(JSON)','911028LRBXuC','4711294lctXhr','2159208yDXUxx','18230mskUnP','1194348VeWrSP','189907oDJExK'];a175_0x1973=function(){return _0x10ce1c;};return a175_0x1973();}(function(_0x8fcbcb,_0x4503db){const _0x2c638f=a175_0x1d05,_0x476ff5=_0x8fcbcb();while(!![]){try{const _0x27de1f=parseInt(_0x2c638f(0x142))/0x1+parseInt(_0x2c638f(0x14a))/0x2+parseInt(_0x2c638f(0x145))/0x3+-parseInt(_0x2c638f(0x147))/0x4*(parseInt(_0x2c638f(0x140))/0x5)+-parseInt(_0x2c638f(0x141))/0x6+parseInt(_0x2c638f(0x14b))/0x7+-parseInt(_0x2c638f(0x14c))/0x8;if(_0x27de1f===_0x4503db)break;else _0x476ff5['push'](_0x476ff5['shift']());}catch(_0x2ced38){_0x476ff5['push'](_0x476ff5['shift']());}}}(a175_0x1973,0x7a14f));function a175_0x1d05(_0x448f6a,_0x288fad){_0x448f6a=_0x448f6a-0x140;const _0x197393=a175_0x1973();let _0x1d05e2=_0x197393[_0x448f6a];return _0x1d05e2;}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x4916a3){const _0xbf4287=await buildSchemaPayload();return{'ok':!![],'data':_0xbf4287};}export const schemaDefinition={'service':a175_0x8f7ac7(0x144),'command':a175_0x8f7ac7(0x148),'description':a175_0x8f7ac7(0x149),'risk':a175_0x8f7ac7(0x146),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a175_0x8f7ac7(0x143),'flags':[],'execute':execute};
1
+ function a182_0x2bb6(_0x1e792e,_0x164f7f){_0x1e792e=_0x1e792e-0x1c0;const _0x238b96=a182_0x238b();let _0x2bb610=_0x238b96[_0x1e792e];return _0x2bb610;}const a182_0x3aae65=a182_0x2bb6;(function(_0x4d195c,_0x1fda32){const _0x2b2c86=a182_0x2bb6,_0x163855=_0x4d195c();while(!![]){try{const _0x19a38a=parseInt(_0x2b2c86(0x1c6))/0x1*(-parseInt(_0x2b2c86(0x1cf))/0x2)+parseInt(_0x2b2c86(0x1ca))/0x3*(parseInt(_0x2b2c86(0x1cd))/0x4)+-parseInt(_0x2b2c86(0x1c1))/0x5+-parseInt(_0x2b2c86(0x1cb))/0x6*(-parseInt(_0x2b2c86(0x1c5))/0x7)+parseInt(_0x2b2c86(0x1c0))/0x8+parseInt(_0x2b2c86(0x1c3))/0x9*(parseInt(_0x2b2c86(0x1d0))/0xa)+-parseInt(_0x2b2c86(0x1c4))/0xb*(parseInt(_0x2b2c86(0x1cc))/0xc);if(_0x19a38a===_0x1fda32)break;else _0x163855['push'](_0x163855['shift']());}catch(_0x35e1e3){_0x163855['push'](_0x163855['shift']());}}}(a182_0x238b,0xdaf50));import{buildSchemaPayload}from'../framework/schema-export.js';function a182_0x238b(){const _0xeeb9f6=['331790HEMRBA','5290760JORNhl','6437505heNdEV','export','441DwzmIK','176Dbfucp','239869AntJyV','25207VSLDdN','read','Export\x20machine-readable\x20command\x20schema\x20(JSON)','schema','232263SsougF','210aUhPbJ','1150776AYXklq','68snhGXE','json','86HRfJzn'];a182_0x238b=function(){return _0xeeb9f6;};return a182_0x238b();}async function execute(_0x2bca3b){const _0x44a5ef=await buildSchemaPayload();return{'ok':!![],'data':_0x44a5ef};}export const schemaDefinition={'service':a182_0x3aae65(0x1c9),'command':a182_0x3aae65(0x1c2),'description':a182_0x3aae65(0x1c8),'risk':a182_0x3aae65(0x1c7),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a182_0x3aae65(0x1ce),'flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a176_0xb697b2=a176_0xf1a1;(function(_0x9b77c7,_0x34e3d7){const _0x58ab31=a176_0xf1a1,_0x281983=_0x9b77c7();while(!![]){try{const _0x450c71=parseInt(_0x58ab31(0x193))/0x1+-parseInt(_0x58ab31(0x194))/0x2+parseInt(_0x58ab31(0x18c))/0x3+-parseInt(_0x58ab31(0x199))/0x4+parseInt(_0x58ab31(0x1a6))/0x5*(-parseInt(_0x58ab31(0x192))/0x6)+-parseInt(_0x58ab31(0x1be))/0x7+parseInt(_0x58ab31(0x1ca))/0x8;if(_0x450c71===_0x34e3d7)break;else _0x281983['push'](_0x281983['shift']());}catch(_0x2219b8){_0x281983['push'](_0x281983['shift']());}}}(a176_0x52b5,0x7ee0f));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';function a176_0xf1a1(_0x1a6c45,_0x254739){_0x1a6c45=_0x1a6c45-0x186;const _0x52b535=a176_0x52b5();let _0xf1a134=_0x52b535[_0x1a6c45];return _0xf1a134;}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x15f9b0){const _0x2b8f54=a176_0xf1a1;if(_0x15f9b0===_0x2b8f54(0x18b))return[_0x2b8f54(0x1c2),'\x20\x20SELECT\x201\x20AS\x20id',_0x2b8f54(0x19c),''][_0x2b8f54(0x190)]('\x0a');return[_0x2b8f54(0x197),'']['join']('\x0a');}export const sqlCreate={'service':a176_0xb697b2(0x19a),'command':a176_0xb697b2(0x1c1),'description':a176_0xb697b2(0x198),'risk':a176_0xb697b2(0x18a),'flags':[{'name':a176_0xb697b2(0x188),'type':a176_0xb697b2(0x1a0),'description':a176_0xb697b2(0x1b8)},{'name':a176_0xb697b2(0x19d),'type':a176_0xb697b2(0x1b3),'description':a176_0xb697b2(0x1af)},{'name':a176_0xb697b2(0x1c5),'type':a176_0xb697b2(0x1a0),'enum':['sql',a176_0xb697b2(0x18b)],'description':a176_0xb697b2(0x186)}],async 'validate'(_0x120c46){const _0x17a877=a176_0xb697b2;if(!_0x120c46[_0x17a877(0x1c3)])return;if(!_0x120c46['str']('name')['trim']())throw CliErrors[_0x17a877(0x1a3)](_0x17a877(0x188),_0x17a877(0x1b7));const _0x1c8e20=resolveProvidedDbId(_0x120c46);if(typeof _0x1c8e20!==_0x17a877(0x1b3)||!Number[_0x17a877(0x1bb)](_0x1c8e20)||_0x1c8e20<=0x0)throw CliErrors[_0x17a877(0x1a3)](_0x17a877(0x19d),_0x17a877(0x1c8));if(!_0x120c46[_0x17a877(0x1a4)](_0x17a877(0x1c5))[_0x17a877(0x191)]())throw CliErrors[_0x17a877(0x1a3)](_0x17a877(0x1c5),_0x17a877(0x1a5));},async 'dryRun'(_0x3db762){const _0x3a3cf2=a176_0xb697b2,_0x3a9ca7=loadSqlProjectConfig(_0x3db762[_0x3a3cf2(0x19f)]),{sqlName:_0x49d839,dbId:_0x297502,dbName:_0x8c66ef,mode:_0x1d50e8}=await resolveSqlNewInputs(_0x3db762),_0x45581a=buildSqlRelativePath(_0x3a3cf2(0x18f),_0x49d839,_0x8c66ef,_0x1d50e8,_0x297502),_0x163405=_0x3a9ca7[_0x3a3cf2(0x189)]+'/'+_0x45581a;return{'method':'POST','url':_0x3a3cf2(0x1b9),'body':{'appCode':_0x3db762[_0x3a3cf2(0x19f)],'sqlName':_0x49d839,'dbId':_0x297502,'mode':_0x1d50e8,'localPath':_0x163405},'description':_0x3a3cf2(0x195)+_0x3a9ca7[_0x3a3cf2(0x189)]};},async 'execute'(_0x2e154b){const _0x1ac0c9=a176_0xb697b2,_0x1dc73f=loadSqlProjectConfig(_0x2e154b[_0x1ac0c9(0x19f)]),{sqlName:_0x3bf90a,dbId:_0x38a7c5,dbName:_0xeb1c7c,mode:_0x370ea9}=await resolveSqlNewInputs(_0x2e154b),_0x1f8a91=generateSqlTemplate(_0x370ea9),_0x40cfc0=await createSqlQuery({'appCode':_0x2e154b['appCode'],'sqlName':_0x3bf90a,'dbId':_0x38a7c5,'sqlContent':_0x1f8a91}),_0x325f09=ensureRemoteSqlContent(_0x40cfc0),_0x3b6413=_0xeb1c7c||await getDbName(_0x2e154b['appCode'],_0x38a7c5)['catch'](()=>undefined),_0x1a8596=buildSqlRelativePath(_0x40cfc0[_0x1ac0c9(0x187)],_0x40cfc0[_0x1ac0c9(0x1c9)],_0x3b6413,_0x370ea9,_0x38a7c5),_0x527b2d=_0x1dc73f[_0x1ac0c9(0x189)]+'/'+_0x1a8596,_0x5dee16=buildLocalSqlFileContent({'sqlCode':_0x40cfc0[_0x1ac0c9(0x187)],'sqlName':_0x40cfc0[_0x1ac0c9(0x1c9)],'dbId':_0x40cfc0[_0x1ac0c9(0x1b2)]},_0x325f09,{'dbName':_0x3b6413,'mode':_0x370ea9,'syncedAt':new Date()[_0x1ac0c9(0x1c4)](),'description':_0x40cfc0[_0x1ac0c9(0x1cb)]});if(await fileExists(_0x527b2d))throw CliErrors[_0x1ac0c9(0x1c6)](_0x1ac0c9(0x1a1)+_0x527b2d);await ensureParentDirectory(_0x527b2d),await writeFile(_0x527b2d,_0x5dee16,_0x1ac0c9(0x1b6));const _0x52a6a2=await readSqlLockFile(_0x1dc73f['lockFilePath']),{lockData:_0x1f01b7,appLock:_0x54993b}=ensureSqlLockScope(_0x52a6a2??createEmptySqlLock(),_0x1dc73f[_0x1ac0c9(0x19f)],_0x1dc73f[_0x1ac0c9(0x18e)],_0x1ac0c9(0x1b4));return _0x54993b[_0x1ac0c9(0x1aa)][_0x40cfc0[_0x1ac0c9(0x187)]]={...buildSqlLockEntry(_0x40cfc0,_0x325f09,computeSqlContentHash(_0x5dee16),{'dbName':_0x3b6413}),'path':_0x1a8596,'mode':_0x370ea9},_0x54993b[_0x1ac0c9(0x19b)]=new Date()[_0x1ac0c9(0x1c4)](),await writeSqlLockFile(_0x1dc73f['lockFilePath'],_0x1f01b7),{'ok':!![],'data':{'id':_0x40cfc0['id'],'sqlCode':_0x40cfc0[_0x1ac0c9(0x187)],'sqlName':_0x40cfc0[_0x1ac0c9(0x1c9)],'dbId':_0x40cfc0[_0x1ac0c9(0x1b2)],'path':_0x527b2d,'mode':_0x370ea9},'message':'Created\x20SQL\x20query\x20'+_0x40cfc0[_0x1ac0c9(0x187)]};}};async function resolveSqlNewInputs(_0x22e6fa){const _0x14f04d=await resolveSqlNameInput(_0x22e6fa),{dbId:_0x14780c,dbName:_0x17b447}=await resolveDbSelection(_0x22e6fa),_0x256307=await resolveSqlModeInput(_0x22e6fa);return{'sqlName':_0x14f04d,'dbId':_0x14780c,'dbName':_0x17b447,'mode':_0x256307};}function a176_0x52b5(){const _0x2ea6ef=['普通\x20SQL(sql)','SELECT\x201\x20AS\x20id;','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','3009376AHasvo','sql','lastSync','</select>','db-id','length','appCode','string','File\x20already\x20exists:\x20','isInteger','flagMissing','str','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','5yaOZHi','stringify','SQL\x20名称不能为空','flag','sqls','parse','请输入\x20SQL\x20名称:','适合带动态标签的\x20MyBatis\x20XML\x20SQL','MyBatis\x20XML(mybatisXml)','Target\x20database\x20ID','dbName','Invalid\x20database\x20selection\x20payload:\x20','dbId','number','new','dbId\x20必须为正整数','utf8','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20query\x20display\x20name','/smartapi/custom/saveUserCustomSql','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','isFinite','请输入目标数据库\x20dbId:','✎\x20手动输入\x20dbId','1266384aGszpK','请选择目标数据库:','map','create','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','nonInteractive','toISOString','mode','validation','catch','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlName','16002368oXblru','description','Local\x20SQL\x20file\x20mode','sqlCode','name','sqlRootDir','high-risk-write','mybatisXml','1594032HguBff','请选择本地\x20SQL\x20模式:','sqlRoot','<server-generated-sqlCode>','join','trim','5183778vWsXHb','818614tmbygO','2066680EoZWeM','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'];a176_0x52b5=function(){return _0x2ea6ef;};return a176_0x52b5();}async function resolveSqlNameInput(_0x10a0cf){const _0x16ec75=a176_0xb697b2,_0x53391e=_0x10a0cf[_0x16ec75(0x1a4)](_0x16ec75(0x188))['trim']();if(_0x53391e)return _0x53391e;if(_0x10a0cf[_0x16ec75(0x1c3)])throw CliErrors[_0x16ec75(0x1a3)](_0x16ec75(0x188),_0x16ec75(0x1b7));return(await input({'message':_0x16ec75(0x1ac),'validate':_0x2ab96f=>_0x2ab96f['trim']()?!![]:_0x16ec75(0x1a8)}))[_0x16ec75(0x191)]();}async function resolveDbSelection(_0x2cee87){const _0x370d2e=a176_0xb697b2,_0x17868f=resolveProvidedDbId(_0x2cee87);if(typeof _0x17868f==='number'&&Number[_0x370d2e(0x1bb)](_0x17868f)&&_0x17868f>0x0)return{'dbId':_0x17868f,'dbName':await getDbName(_0x2cee87[_0x370d2e(0x19f)],_0x17868f)[_0x370d2e(0x1c7)](()=>undefined)};if(_0x2cee87['nonInteractive'])throw CliErrors[_0x370d2e(0x1a3)]('db-id',_0x370d2e(0x1c8));const _0x3475c7=await listDatabases(_0x2cee87['appCode'])[_0x370d2e(0x1c7)](()=>[]);if(_0x3475c7['length']===0x1)return{'dbId':_0x3475c7[0x0][_0x370d2e(0x1b2)],'dbName':_0x3475c7[0x0][_0x370d2e(0x1b0)]};if(_0x3475c7[_0x370d2e(0x19e)]>0x1){const _0x943d1b=await select({'message':_0x370d2e(0x1bf),'choices':[..._0x3475c7[_0x370d2e(0x1c0)](_0x29e296=>({'name':_0x29e296[_0x370d2e(0x1b0)]+'\x20('+_0x29e296[_0x370d2e(0x1b2)]+')','value':serializeDbSelection(_0x29e296)})),{'name':_0x370d2e(0x1bd),'value':'__manual__'}]});if(_0x943d1b!=='__manual__')return deserializeDbSelection(_0x943d1b);}const _0x543494=await input({'message':_0x370d2e(0x1bc),'validate':_0x4c4a9d=>{const _0x168425=_0x370d2e,_0x1e3600=_0x4c4a9d[_0x168425(0x191)]();if(!_0x1e3600)return'dbId\x20不能为空';const _0x485fe0=Number(_0x1e3600);if(!Number[_0x168425(0x1a2)](_0x485fe0)||_0x485fe0<=0x0)return _0x168425(0x1b5);return!![];}});return{'dbId':Number(_0x543494[_0x370d2e(0x191)]())};}async function resolveSqlModeInput(_0x278ab5){const _0x2340f4=a176_0xb697b2,_0x15cd34=_0x278ab5[_0x2340f4(0x1a4)](_0x2340f4(0x1c5))[_0x2340f4(0x191)]();if(_0x15cd34==='sql'||_0x15cd34===_0x2340f4(0x18b))return _0x15cd34;if(_0x278ab5[_0x2340f4(0x1c3)])throw CliErrors[_0x2340f4(0x1a3)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x2340f4(0x18d),'choices':[{'name':_0x2340f4(0x196),'value':_0x2340f4(0x19a),'description':_0x2340f4(0x1ba)},{'name':_0x2340f4(0x1ae),'value':_0x2340f4(0x18b),'description':_0x2340f4(0x1ad)}]});}function serializeDbSelection(_0x2f01e5){const _0x3954d0=a176_0xb697b2;return JSON[_0x3954d0(0x1a7)]({'dbId':_0x2f01e5['dbId'],'dbName':_0x2f01e5[_0x3954d0(0x1b0)]});}function deserializeDbSelection(_0x55b186){const _0xb01455=a176_0xb697b2;try{const _0x4ef6e6=JSON[_0xb01455(0x1ab)](_0x55b186);if(typeof _0x4ef6e6[_0xb01455(0x1b2)]===_0xb01455(0x1b3)&&Number[_0xb01455(0x1bb)](_0x4ef6e6[_0xb01455(0x1b2)]))return{'dbId':_0x4ef6e6[_0xb01455(0x1b2)],'dbName':_0x4ef6e6[_0xb01455(0x1b0)]};}catch{}throw CliErrors[_0xb01455(0x1c6)](_0xb01455(0x1b1)+_0x55b186);}function resolveProvidedDbId(_0x21a341){const _0x681269=a176_0xb697b2,_0x3e650f=_0x21a341[_0x681269(0x1a9)](_0x681269(0x19d));if(typeof _0x3e650f===_0x681269(0x1b3)&&Number[_0x681269(0x1bb)](_0x3e650f))return _0x3e650f;return undefined;}
1
+ const a183_0x373880=a183_0x568a;(function(_0x15ce12,_0x119e28){const _0x1e82a1=a183_0x568a,_0x542c17=_0x15ce12();while(!![]){try{const _0x59bb4d=-parseInt(_0x1e82a1(0xdd))/0x1+-parseInt(_0x1e82a1(0xc9))/0x2*(-parseInt(_0x1e82a1(0xbe))/0x3)+-parseInt(_0x1e82a1(0xd1))/0x4*(parseInt(_0x1e82a1(0xe2))/0x5)+-parseInt(_0x1e82a1(0xd3))/0x6+parseInt(_0x1e82a1(0xf1))/0x7*(-parseInt(_0x1e82a1(0xf5))/0x8)+parseInt(_0x1e82a1(0xe4))/0x9+-parseInt(_0x1e82a1(0xb4))/0xa*(-parseInt(_0x1e82a1(0xbf))/0xb);if(_0x59bb4d===_0x119e28)break;else _0x542c17['push'](_0x542c17['shift']());}catch(_0x1a8a0c){_0x542c17['push'](_0x542c17['shift']());}}}(a183_0x53aa,0x1ce60));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';function a183_0x568a(_0x27f783,_0x290823){_0x27f783=_0x27f783-0xb1;const _0x53aaea=a183_0x53aa();let _0x568a7e=_0x53aaea[_0x27f783];return _0x568a7e;}import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function a183_0x53aa(){const _0x5cd5d7=['SQL\x20query\x20display\x20name','create','请选择目标数据库:','Created\x20SQL\x20query\x20','普通\x20SQL(sql)','dbId\x20不能为空','56UjJTAt','isInteger','556296jRiDxr','Target\x20database\x20ID','__manual__','trim','join','适合带动态标签的\x20MyBatis\x20XML\x20SQL','new','stringify','\x20\x20SELECT\x201\x20AS\x20id','validation','129416DZusaf','mode','string','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','mybatisXml','63955EuXOuG','<server-generated-sqlCode>','564300wgpKyj','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','请选择本地\x20SQL\x20模式:','nonInteractive','name','sqlRootDir','appCode','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','high-risk-write','Invalid\x20database\x20selection\x20payload:\x20','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','isFinite','map','14ieWFlW','sqlCode','number','parse','57584PiLVeq','请输入目标数据库\x20dbId:','/smartapi/custom/saveUserCustomSql','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','4502890yegsJw','Local\x20SQL\x20file\x20mode','catch','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','lockFilePath','flag','SQL\x20名称不能为空','sqlName','POST','sql','3FMVpOK','11epxqlg','toISOString','flagMissing','✎\x20手动输入\x20dbId','dbName','db-id','请输入\x20SQL\x20名称:','length','str','dbId','41962TOoXjj','description'];a183_0x53aa=function(){return _0x5cd5d7;};return a183_0x53aa();}function generateSqlTemplate(_0x4e4e5f){const _0x51f809=a183_0x568a;if(_0x4e4e5f==='mybatisXml')return[_0x51f809(0xeb),_0x51f809(0xdb),'</select>','']['join']('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x51f809(0xd7)]('\x0a');}export const sqlCreate={'service':'sql','command':a183_0x373880(0xcc),'description':a183_0x373880(0xe5),'risk':a183_0x373880(0xec),'flags':[{'name':'name','type':a183_0x373880(0xdf),'description':a183_0x373880(0xcb)},{'name':a183_0x373880(0xc4),'type':a183_0x373880(0xf3),'description':a183_0x373880(0xd4)},{'name':a183_0x373880(0xde),'type':a183_0x373880(0xdf),'enum':[a183_0x373880(0xbd),a183_0x373880(0xe1)],'description':a183_0x373880(0xb5)}],async 'validate'(_0x5bf12f){const _0x252002=a183_0x373880;if(!_0x5bf12f['nonInteractive'])return;if(!_0x5bf12f[_0x252002(0xc7)]('name')[_0x252002(0xd6)]())throw CliErrors['flagMissing'](_0x252002(0xe8),_0x252002(0xe0));const _0x1bff76=resolveProvidedDbId(_0x5bf12f);if(typeof _0x1bff76!==_0x252002(0xf3)||!Number[_0x252002(0xef)](_0x1bff76)||_0x1bff76<=0x0)throw CliErrors['flagMissing'](_0x252002(0xc4),_0x252002(0xb3));if(!_0x5bf12f[_0x252002(0xc7)](_0x252002(0xde))[_0x252002(0xd6)]())throw CliErrors[_0x252002(0xc1)](_0x252002(0xde),_0x252002(0xb7));},async 'dryRun'(_0xebde2c){const _0x11b8e0=a183_0x373880,_0x389d85=loadSqlProjectConfig(_0xebde2c[_0x11b8e0(0xea)]),{sqlName:_0x46ac1b,dbId:_0x333fd0,dbName:_0x331c43,mode:_0xfdea48}=await resolveSqlNewInputs(_0xebde2c),_0x2d9a8b=buildSqlRelativePath(_0x11b8e0(0xe3),_0x46ac1b,_0x331c43,_0xfdea48,_0x333fd0),_0x15bf44=_0x389d85['sqlRootDir']+'/'+_0x2d9a8b;return{'method':_0x11b8e0(0xbc),'url':_0x11b8e0(0xb2),'body':{'appCode':_0xebde2c[_0x11b8e0(0xea)],'sqlName':_0x46ac1b,'dbId':_0x333fd0,'mode':_0xfdea48,'localPath':_0x15bf44},'description':_0x11b8e0(0xee)+_0x389d85[_0x11b8e0(0xe9)]};},async 'execute'(_0x5a62df){const _0x28ece5=a183_0x373880,_0x4890a8=loadSqlProjectConfig(_0x5a62df[_0x28ece5(0xea)]),{sqlName:_0x4eb12b,dbId:_0x33ec5f,dbName:_0x128ecf,mode:_0x4ad584}=await resolveSqlNewInputs(_0x5a62df),_0x2625e8=generateSqlTemplate(_0x4ad584),_0x1fd3a6=await createSqlQuery({'appCode':_0x5a62df[_0x28ece5(0xea)],'sqlName':_0x4eb12b,'dbId':_0x33ec5f,'sqlContent':_0x2625e8}),_0x2df91f=ensureRemoteSqlContent(_0x1fd3a6),_0x51a636=_0x128ecf||await getDbName(_0x5a62df[_0x28ece5(0xea)],_0x33ec5f)[_0x28ece5(0xb6)](()=>undefined),_0x4a307b=buildSqlRelativePath(_0x1fd3a6[_0x28ece5(0xf2)],_0x1fd3a6[_0x28ece5(0xbb)],_0x51a636,_0x4ad584,_0x33ec5f),_0xd2b6aa=_0x4890a8['sqlRootDir']+'/'+_0x4a307b,_0x5ca069=buildLocalSqlFileContent({'sqlCode':_0x1fd3a6[_0x28ece5(0xf2)],'sqlName':_0x1fd3a6[_0x28ece5(0xbb)],'dbId':_0x1fd3a6[_0x28ece5(0xc8)]},_0x2df91f,{'dbName':_0x51a636,'mode':_0x4ad584,'syncedAt':new Date()[_0x28ece5(0xc0)](),'description':_0x1fd3a6[_0x28ece5(0xca)]});if(await fileExists(_0xd2b6aa))throw CliErrors[_0x28ece5(0xdc)]('File\x20already\x20exists:\x20'+_0xd2b6aa);await ensureParentDirectory(_0xd2b6aa),await writeFile(_0xd2b6aa,_0x5ca069,'utf8');const _0x42525e=await readSqlLockFile(_0x4890a8['lockFilePath']),{lockData:_0x4b9a2c,appLock:_0x4c558f}=ensureSqlLockScope(_0x42525e??createEmptySqlLock(),_0x4890a8['appCode'],_0x4890a8['sqlRoot'],_0x28ece5(0xd9));return _0x4c558f['sqls'][_0x1fd3a6['sqlCode']]={...buildSqlLockEntry(_0x1fd3a6,_0x2df91f,computeSqlContentHash(_0x5ca069),{'dbName':_0x51a636}),'path':_0x4a307b,'mode':_0x4ad584},_0x4c558f['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x4890a8[_0x28ece5(0xb8)],_0x4b9a2c),{'ok':!![],'data':{'id':_0x1fd3a6['id'],'sqlCode':_0x1fd3a6[_0x28ece5(0xf2)],'sqlName':_0x1fd3a6[_0x28ece5(0xbb)],'dbId':_0x1fd3a6['dbId'],'path':_0xd2b6aa,'mode':_0x4ad584},'message':_0x28ece5(0xce)+_0x1fd3a6[_0x28ece5(0xf2)]};}};async function resolveSqlNewInputs(_0x23007d){const _0x655c33=await resolveSqlNameInput(_0x23007d),{dbId:_0x375020,dbName:_0x3ef684}=await resolveDbSelection(_0x23007d),_0x6830c1=await resolveSqlModeInput(_0x23007d);return{'sqlName':_0x655c33,'dbId':_0x375020,'dbName':_0x3ef684,'mode':_0x6830c1};}async function resolveSqlNameInput(_0xa69dd5){const _0xdaa0f4=a183_0x373880,_0x8d3fda=_0xa69dd5[_0xdaa0f4(0xc7)](_0xdaa0f4(0xe8))[_0xdaa0f4(0xd6)]();if(_0x8d3fda)return _0x8d3fda;if(_0xa69dd5[_0xdaa0f4(0xe7)])throw CliErrors[_0xdaa0f4(0xc1)](_0xdaa0f4(0xe8),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0xdaa0f4(0xc5),'validate':_0x3d49f2=>_0x3d49f2[_0xdaa0f4(0xd6)]()?!![]:_0xdaa0f4(0xba)}))['trim']();}async function resolveDbSelection(_0x118f4c){const _0x348643=a183_0x373880,_0x5764f7=resolveProvidedDbId(_0x118f4c);if(typeof _0x5764f7===_0x348643(0xf3)&&Number[_0x348643(0xef)](_0x5764f7)&&_0x5764f7>0x0)return{'dbId':_0x5764f7,'dbName':await getDbName(_0x118f4c[_0x348643(0xea)],_0x5764f7)[_0x348643(0xb6)](()=>undefined)};if(_0x118f4c['nonInteractive'])throw CliErrors[_0x348643(0xc1)](_0x348643(0xc4),_0x348643(0xb3));const _0x3619ec=await listDatabases(_0x118f4c['appCode'])[_0x348643(0xb6)](()=>[]);if(_0x3619ec[_0x348643(0xc6)]===0x1)return{'dbId':_0x3619ec[0x0][_0x348643(0xc8)],'dbName':_0x3619ec[0x0]['dbName']};if(_0x3619ec[_0x348643(0xc6)]>0x1){const _0x27c866=await select({'message':_0x348643(0xcd),'choices':[..._0x3619ec[_0x348643(0xf0)](_0x674670=>({'name':_0x674670['dbName']+'\x20('+_0x674670['dbId']+')','value':serializeDbSelection(_0x674670)})),{'name':_0x348643(0xc2),'value':_0x348643(0xd5)}]});if(_0x27c866!==_0x348643(0xd5))return deserializeDbSelection(_0x27c866);}const _0x44cd28=await input({'message':_0x348643(0xb1),'validate':_0x2e5b6a=>{const _0x3a9d81=_0x348643,_0x33c56b=_0x2e5b6a['trim']();if(!_0x33c56b)return _0x3a9d81(0xd0);const _0x36c5dd=Number(_0x33c56b);if(!Number[_0x3a9d81(0xd2)](_0x36c5dd)||_0x36c5dd<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x44cd28[_0x348643(0xd6)]())};}async function resolveSqlModeInput(_0x5bfd9b){const _0x52af7a=a183_0x373880,_0x2fbaa2=_0x5bfd9b[_0x52af7a(0xc7)](_0x52af7a(0xde))['trim']();if(_0x2fbaa2===_0x52af7a(0xbd)||_0x2fbaa2===_0x52af7a(0xe1))return _0x2fbaa2;if(_0x5bfd9b[_0x52af7a(0xe7)])throw CliErrors[_0x52af7a(0xc1)](_0x52af7a(0xde),_0x52af7a(0xb7));return await select({'message':_0x52af7a(0xe6),'choices':[{'name':_0x52af7a(0xcf),'value':'sql','description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':'MyBatis\x20XML(mybatisXml)','value':_0x52af7a(0xe1),'description':_0x52af7a(0xd8)}]});}function serializeDbSelection(_0x22437e){const _0x5c3e2d=a183_0x373880;return JSON[_0x5c3e2d(0xda)]({'dbId':_0x22437e[_0x5c3e2d(0xc8)],'dbName':_0x22437e[_0x5c3e2d(0xc3)]});}function deserializeDbSelection(_0x4e2c40){const _0x14a863=a183_0x373880;try{const _0x14142d=JSON[_0x14a863(0xf4)](_0x4e2c40);if(typeof _0x14142d[_0x14a863(0xc8)]===_0x14a863(0xf3)&&Number['isFinite'](_0x14142d[_0x14a863(0xc8)]))return{'dbId':_0x14142d[_0x14a863(0xc8)],'dbName':_0x14142d[_0x14a863(0xc3)]};}catch{}throw CliErrors['validation'](_0x14a863(0xed)+_0x4e2c40);}function resolveProvidedDbId(_0x1d99c0){const _0x2dcf1c=a183_0x373880,_0x465d14=_0x1d99c0[_0x2dcf1c(0xb9)](_0x2dcf1c(0xc4));if(typeof _0x465d14===_0x2dcf1c(0xf3)&&Number[_0x2dcf1c(0xef)](_0x465d14))return _0x465d14;return undefined;}
@@ -1 +1 @@
1
- const a177_0x3fc80c=a177_0x3138;(function(_0x36fb71,_0xf921f1){const _0x305eaa=a177_0x3138,_0x28b6b7=_0x36fb71();while(!![]){try{const _0x541671=-parseInt(_0x305eaa(0xbb))/0x1*(parseInt(_0x305eaa(0x97))/0x2)+parseInt(_0x305eaa(0xb6))/0x3*(-parseInt(_0x305eaa(0xad))/0x4)+parseInt(_0x305eaa(0x96))/0x5*(-parseInt(_0x305eaa(0xa4))/0x6)+parseInt(_0x305eaa(0x9e))/0x7+-parseInt(_0x305eaa(0xbc))/0x8+parseInt(_0x305eaa(0xb5))/0x9*(-parseInt(_0x305eaa(0xab))/0xa)+parseInt(_0x305eaa(0xb9))/0xb*(parseInt(_0x305eaa(0xb0))/0xc);if(_0x541671===_0xf921f1)break;else _0x28b6b7['push'](_0x28b6b7['shift']());}catch(_0x24762f){_0x28b6b7['push'](_0x28b6b7['shift']());}}}(a177_0x5b76,0x24875));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a177_0x3fc80c(0x99),'command':'delete','description':a177_0x3fc80c(0xb3),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x8fea1){const _0x1412e9=a177_0x3fc80c,_0x2ed10e=loadSqlProjectConfig(_0x8fea1[_0x1412e9(0xae)]),_0x25b9ff=await readSqlLockFile(_0x2ed10e[_0x1412e9(0xac)]);if(!_0x25b9ff)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x1282c6){const _0x32c278=a177_0x3fc80c,_0x5556d0=loadSqlProjectConfig(_0x1282c6[_0x32c278(0xae)]),_0xfe1ef9=await readSqlLockFile(_0x5556d0[_0x32c278(0xac)]);if(!_0xfe1ef9)throw CliErrors['validation'](_0x32c278(0xaf));const {appLock:_0x2af492}=ensureSqlLockScope(_0xfe1ef9,_0x1282c6['appCode'],_0x5556d0[_0x32c278(0x9f)],_0x32c278(0xba)),_0x3b22df=_0x1282c6[_0x32c278(0xa3)](_0x32c278(0xa0)),_0x2f79ab=_0x2af492[_0x32c278(0x9d)][_0x3b22df];if(!_0x2f79ab)throw CliErrors[_0x32c278(0xbf)](_0x32c278(0xa1)+_0x3b22df+'\x22.');return{'method':_0x32c278(0x98),'url':_0x32c278(0xa2),'body':{'sqlCode':_0x3b22df,'id':_0x2f79ab[_0x32c278(0xb1)],'localPath':resolveLocalSqlFilePath(_0x5556d0,_0x3b22df,_0x2f79ab)},'description':_0x32c278(0xb2)+_0x3b22df+_0x32c278(0xa7)+_0x5556d0[_0x32c278(0xbe)]};},async 'execute'(_0x1432a7){const _0x1cee3d=a177_0x3fc80c,_0x347919=loadSqlProjectConfig(_0x1432a7[_0x1cee3d(0xae)]),_0x48ebc7=await readSqlLockFile(_0x347919[_0x1cee3d(0xac)]);if(!_0x48ebc7)throw CliErrors[_0x1cee3d(0xbf)](_0x1cee3d(0xb8));const {lockData:_0xd6ad86,appLock:_0x4c7b3e}=ensureSqlLockScope(_0x48ebc7,_0x1432a7['appCode'],_0x347919[_0x1cee3d(0x9f)],_0x1cee3d(0xba)),_0x4712b2=_0x1432a7[_0x1cee3d(0xa3)](_0x1cee3d(0xa0)),_0x1b943f=_0x4c7b3e[_0x1cee3d(0x9d)][_0x4712b2];if(!_0x1b943f)throw CliErrors[_0x1cee3d(0xbf)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x4712b2+'\x22.');await deleteSqlQuery({'id':_0x1b943f[_0x1cee3d(0xb1)],'sqlCode':_0x4712b2}),_0x4c7b3e[_0x1cee3d(0x9d)]=Object[_0x1cee3d(0x9c)](Object[_0x1cee3d(0xa5)](_0x4c7b3e['sqls'])[_0x1cee3d(0xa8)](([_0x54c8a9])=>_0x54c8a9!==_0x4712b2)),_0x4c7b3e[_0x1cee3d(0xa6)]=new Date()['toISOString'](),await writeSqlLockFile(_0x347919[_0x1cee3d(0xac)],_0xd6ad86);const _0x514118=resolveLocalSqlFilePath(_0x347919,_0x4712b2,_0x1b943f);let _0x30b0a0;await fileExists(_0x514118)&&(_0x30b0a0=await moveToTrash(_0x347919['projectRoot'],_0x347919[_0x1cee3d(0xbe)],_0x514118),await cleanupEmptyDirectories(dirname(_0x514118),_0x347919[_0x1cee3d(0xaa)]));const _0x18004c={'deleted':_0x4712b2,'remoteId':_0x1b943f[_0x1cee3d(0xb1)]};if(_0x30b0a0)_0x18004c[_0x1cee3d(0xbd)]=_0x30b0a0;return{'ok':!![],'data':_0x18004c,'message':_0x1cee3d(0xb4)+_0x4712b2+(_0x30b0a0?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function a177_0x5b76(){const _0x57c1ae=['entries','lastSync','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','filter','toISOString','sqlRootDir','1430JVcLMt','lockFilePath','7468GVDJDa','appCode','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','16392GkqxCv','remoteId','Would\x20delete\x20SQL\x20','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','Deleted\x20','387QPJjgt','69vvfQuV','startsWith','SQL\x20lock\x20file\x20not\x20found.','5753bjlahP','delete','1909qrgBqM','2020544wnMtLz','trashedTo','trashDir','validation','1375AVYuez','142fhBiyN','POST','sql','replace','length','fromEntries','sqls','933625DmQeMP','sqlRoot','sqlcode','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','/smartapi/custom/deleteUserCustomSql','str','5694YEQHZX'];a177_0x5b76=function(){return _0x57c1ae;};return a177_0x5b76();}async function moveToTrash(_0x34bc6b,_0x32928d,_0x469306){const _0x20ef04=a177_0x3fc80c,_0x322dc7=new Date()[_0x20ef04(0xa9)]()[_0x20ef04(0x9a)](/[:.]/g,'-'),_0x7a298=relative(_0x34bc6b,_0x469306),_0x3b15a7=join(_0x32928d,_0x322dc7,_0x7a298);return await mkdir(dirname(_0x3b15a7),{'recursive':!![]}),await rename(_0x469306,_0x3b15a7),_0x3b15a7;}function a177_0x3138(_0x234e41,_0x2773c8){_0x234e41=_0x234e41-0x96;const _0x5b760a=a177_0x5b76();let _0x313832=_0x5b760a[_0x234e41];return _0x313832;}async function cleanupEmptyDirectories(_0x109634,_0x279db6){const _0x5c15bb=a177_0x3fc80c;let _0x3e86e4=resolve(_0x109634);const _0x57e11b=resolve(_0x279db6);while(_0x3e86e4[_0x5c15bb(0xb7)](''+_0x57e11b+sep)||_0x3e86e4===_0x57e11b){if(_0x3e86e4===_0x57e11b)return;try{const _0x2cef73=await readdir(_0x3e86e4);if(_0x2cef73[_0x5c15bb(0x9b)]>0x0)return;await rmdir(_0x3e86e4);}catch{return;}_0x3e86e4=dirname(_0x3e86e4);}}
1
+ const a184_0xd07327=a184_0x4dd2;(function(_0x18fb2b,_0xec9754){const _0x535ad2=a184_0x4dd2,_0x165ef3=_0x18fb2b();while(!![]){try{const _0x58c28e=-parseInt(_0x535ad2(0x10c))/0x1+parseInt(_0x535ad2(0xff))/0x2*(-parseInt(_0x535ad2(0x11b))/0x3)+-parseInt(_0x535ad2(0x105))/0x4*(parseInt(_0x535ad2(0x116))/0x5)+parseInt(_0x535ad2(0x100))/0x6+parseInt(_0x535ad2(0xf8))/0x7+-parseInt(_0x535ad2(0x114))/0x8*(-parseInt(_0x535ad2(0x119))/0x9)+parseInt(_0x535ad2(0xfa))/0xa;if(_0x58c28e===_0xec9754)break;else _0x165ef3['push'](_0x165ef3['shift']());}catch(_0x3a013a){_0x165ef3['push'](_0x165ef3['shift']());}}}(a184_0x3f41,0x210df));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a184_0xd07327(0x102),'command':a184_0xd07327(0x117),'description':a184_0xd07327(0x106),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x385f87){const _0x1aeb65=a184_0xd07327,_0x269983=loadSqlProjectConfig(_0x385f87[_0x1aeb65(0x10f)]),_0x220381=await readSqlLockFile(_0x269983[_0x1aeb65(0x112)]);if(!_0x220381)throw CliErrors[_0x1aeb65(0x115)](_0x1aeb65(0x101));},async 'dryRun'(_0x423cf9){const _0x1e01c5=a184_0xd07327,_0x3ee0d=loadSqlProjectConfig(_0x423cf9[_0x1e01c5(0x10f)]),_0x330e37=await readSqlLockFile(_0x3ee0d[_0x1e01c5(0x112)]);if(!_0x330e37)throw CliErrors[_0x1e01c5(0x115)](_0x1e01c5(0x101));const {appLock:_0x752c4e}=ensureSqlLockScope(_0x330e37,_0x423cf9[_0x1e01c5(0x10f)],_0x3ee0d[_0x1e01c5(0xf4)],_0x1e01c5(0x117)),_0x876e18=_0x423cf9[_0x1e01c5(0xfc)]('sqlcode'),_0x3d0352=_0x752c4e[_0x1e01c5(0xfd)][_0x876e18];if(!_0x3d0352)throw CliErrors[_0x1e01c5(0x115)](_0x1e01c5(0x118)+_0x876e18+'\x22.');return{'method':_0x1e01c5(0x108),'url':_0x1e01c5(0x10d),'body':{'sqlCode':_0x876e18,'id':_0x3d0352[_0x1e01c5(0x11a)],'localPath':resolveLocalSqlFilePath(_0x3ee0d,_0x876e18,_0x3d0352)},'description':_0x1e01c5(0x103)+_0x876e18+_0x1e01c5(0xfb)+_0x3ee0d[_0x1e01c5(0x11d)]};},async 'execute'(_0x505595){const _0x2e401f=a184_0xd07327,_0x1acd6=loadSqlProjectConfig(_0x505595[_0x2e401f(0x10f)]),_0x112f56=await readSqlLockFile(_0x1acd6['lockFilePath']);if(!_0x112f56)throw CliErrors[_0x2e401f(0x115)](_0x2e401f(0x10e));const {lockData:_0x2b1408,appLock:_0x1b05f6}=ensureSqlLockScope(_0x112f56,_0x505595[_0x2e401f(0x10f)],_0x1acd6[_0x2e401f(0xf4)],'delete'),_0x42a3e7=_0x505595[_0x2e401f(0xfc)](_0x2e401f(0x10b)),_0x3c1378=_0x1b05f6['sqls'][_0x42a3e7];if(!_0x3c1378)throw CliErrors[_0x2e401f(0x115)](_0x2e401f(0x118)+_0x42a3e7+'\x22.');await deleteSqlQuery({'id':_0x3c1378[_0x2e401f(0x11a)],'sqlCode':_0x42a3e7}),_0x1b05f6['sqls']=Object[_0x2e401f(0xf7)](Object[_0x2e401f(0x109)](_0x1b05f6[_0x2e401f(0xfd)])[_0x2e401f(0x104)](([_0x229763])=>_0x229763!==_0x42a3e7)),_0x1b05f6[_0x2e401f(0x107)]=new Date()[_0x2e401f(0x110)](),await writeSqlLockFile(_0x1acd6[_0x2e401f(0x112)],_0x2b1408);const _0xa873ef=resolveLocalSqlFilePath(_0x1acd6,_0x42a3e7,_0x3c1378);let _0x4a1052;await fileExists(_0xa873ef)&&(_0x4a1052=await moveToTrash(_0x1acd6[_0x2e401f(0x11c)],_0x1acd6[_0x2e401f(0x11d)],_0xa873ef),await cleanupEmptyDirectories(dirname(_0xa873ef),_0x1acd6[_0x2e401f(0xf5)]));const _0x28cbf6={'deleted':_0x42a3e7,'remoteId':_0x3c1378[_0x2e401f(0x11a)]};if(_0x4a1052)_0x28cbf6[_0x2e401f(0x113)]=_0x4a1052;return{'ok':!![],'data':_0x28cbf6,'message':_0x2e401f(0xfe)+_0x42a3e7+(_0x4a1052?_0x2e401f(0xf9):'')};}};async function moveToTrash(_0x1a668d,_0x3d6388,_0x3fad6c){const _0xf62b25=a184_0xd07327,_0x4036a7=new Date()[_0xf62b25(0x110)]()[_0xf62b25(0x111)](/[:.]/g,'-'),_0x361833=relative(_0x1a668d,_0x3fad6c),_0x4ce0a0=join(_0x3d6388,_0x4036a7,_0x361833);return await mkdir(dirname(_0x4ce0a0),{'recursive':!![]}),await rename(_0x3fad6c,_0x4ce0a0),_0x4ce0a0;}function a184_0x3f41(){const _0x1ecd3c=['delete','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','4473FlwlyN','remoteId','93NMmGFL','projectRoot','trashDir','sqlRoot','sqlRootDir','length','fromEntries','811657nbVPkb','\x20(local\x20file\x20moved\x20to\x20trash)','5076700rRdkrd','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','str','sqls','Deleted\x20','16402HlDdIx','1593330AJsImy','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','sql','Would\x20delete\x20SQL\x20','filter','48QFyfWZ','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','lastSync','POST','entries','startsWith','sqlcode','258935gyIojo','/smartapi/custom/deleteUserCustomSql','SQL\x20lock\x20file\x20not\x20found.','appCode','toISOString','replace','lockFilePath','trashedTo','8wBRCWp','validation','100465XgqOLr'];a184_0x3f41=function(){return _0x1ecd3c;};return a184_0x3f41();}function a184_0x4dd2(_0x533094,_0x5e7619){_0x533094=_0x533094-0xf4;const _0x3f410b=a184_0x3f41();let _0x4dd2ad=_0x3f410b[_0x533094];return _0x4dd2ad;}async function cleanupEmptyDirectories(_0x2ccbe2,_0x28d667){const _0x565fec=a184_0xd07327;let _0x3e452d=resolve(_0x2ccbe2);const _0xcd7509=resolve(_0x28d667);while(_0x3e452d[_0x565fec(0x10a)](''+_0xcd7509+sep)||_0x3e452d===_0xcd7509){if(_0x3e452d===_0xcd7509)return;try{const _0x14f4f1=await readdir(_0x3e452d);if(_0x14f4f1[_0x565fec(0xf6)]>0x0)return;await rmdir(_0x3e452d);}catch{return;}_0x3e452d=dirname(_0x3e452d);}}
@@ -1 +1 @@
1
- function a178_0x1b5b(){const _0x2db443=['dbId','description','sqlCode','65104yaaYsN','13825nNLmsK','22627544pXQVwd','1111209lncEfx','4071670WOGRLN','2909960ZEsziG','appCode','str','9WcOtlh','bool','1812AYguQc','verbose','read','Return\x20full\x20raw\x20SQL\x20query\x20object','489173pJRwyW','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode'];a178_0x1b5b=function(){return _0x2db443;};return a178_0x1b5b();}const a178_0x44d9c4=a178_0x17b2;(function(_0x10fa68,_0x13c524){const _0x41a1e6=a178_0x17b2,_0x1e36e2=_0x10fa68();while(!![]){try{const _0x47a5c9=-parseInt(_0x41a1e6(0x84))/0x1+-parseInt(_0x41a1e6(0x76))/0x2+parseInt(_0x41a1e6(0x79))/0x3+-parseInt(_0x41a1e6(0x7b))/0x4+-parseInt(_0x41a1e6(0x7a))/0x5+-parseInt(_0x41a1e6(0x80))/0x6*(parseInt(_0x41a1e6(0x77))/0x7)+parseInt(_0x41a1e6(0x78))/0x8*(parseInt(_0x41a1e6(0x7e))/0x9);if(_0x47a5c9===_0x13c524)break;else _0x1e36e2['push'](_0x1e36e2['shift']());}catch(_0x426d4b){_0x1e36e2['push'](_0x1e36e2['shift']());}}}(a178_0x1b5b,0x838df));function a178_0x17b2(_0x9fb1fb,_0x22afe5){_0x9fb1fb=_0x9fb1fb-0x73;const _0x1b5bd8=a178_0x1b5b();let _0x17b284=_0x1b5bd8[_0x9fb1fb];return _0x17b284;}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':'detail','description':a178_0x44d9c4(0x85),'risk':a178_0x44d9c4(0x82),'flags':[SQLCODE_FLAG,{'name':'verbose','type':'boolean','description':a178_0x44d9c4(0x83)}],async 'execute'(_0x34d404){const _0x47982d=a178_0x44d9c4,_0x3a604b=await getSqlQueryInfo(_0x34d404[_0x47982d(0x7c)],_0x34d404[_0x47982d(0x7d)]('sqlcode')),_0x30737e=_0x34d404[_0x47982d(0x7f)](_0x47982d(0x81));if(_0x30737e)return{'ok':!![],'data':_0x3a604b};const _0x3cd1f2=_0x3a604b[_0x47982d(0x73)]?await getDbName(_0x34d404[_0x47982d(0x7c)],_0x3a604b[_0x47982d(0x73)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x3a604b[_0x47982d(0x75)],'sqlName':_0x3a604b['sqlName'],'db':_0x3cd1f2?_0x3cd1f2+'\x20('+_0x3a604b[_0x47982d(0x73)]+')':_0x3a604b[_0x47982d(0x73)]??'','description':_0x3a604b[_0x47982d(0x74)]??'','sqlContent':_0x3a604b['sqlContent']??''}};}};
1
+ function a185_0xb38d(){const _0x348deb=['sqlcode','str','8152CCEKqN','verbose','boolean','read','sqlContent','693dCvVqj','3349535ZloKTx','11655936HdfPwD','dbId','description','4890592rUDiAY','appCode','sqlCode','3166796ETHLds','bool','264750LbptCW','sqlName','11025042beheVz','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode'];a185_0xb38d=function(){return _0x348deb;};return a185_0xb38d();}const a185_0x2689cd=a185_0x101e;(function(_0x53ada2,_0x2b9f14){const _0x3b3168=a185_0x101e,_0x26a7fd=_0x53ada2();while(!![]){try{const _0x1b6fd8=parseInt(_0x3b3168(0xba))/0x1+parseInt(_0x3b3168(0xb8))/0x2+parseInt(_0x3b3168(0xc5))/0x3*(-parseInt(_0x3b3168(0xc0))/0x4)+parseInt(_0x3b3168(0xc6))/0x5+-parseInt(_0x3b3168(0xbc))/0x6+-parseInt(_0x3b3168(0xca))/0x7+parseInt(_0x3b3168(0xc7))/0x8;if(_0x1b6fd8===_0x2b9f14)break;else _0x26a7fd['push'](_0x26a7fd['shift']());}catch(_0x14504b){_0x26a7fd['push'](_0x26a7fd['shift']());}}}(a185_0xb38d,0xec5aa));import{getSqlQueryInfo}from'../../core/api-client.js';function a185_0x101e(_0x5de8ef,_0x4ba840){_0x5de8ef=_0x5de8ef-0xb8;const _0xb38d61=a185_0xb38d();let _0x101e67=_0xb38d61[_0x5de8ef];return _0x101e67;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':'detail','description':a185_0x2689cd(0xbd),'risk':a185_0x2689cd(0xc3),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a185_0x2689cd(0xc2),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0xc57559){const _0x35a488=a185_0x2689cd,_0x3e0c96=await getSqlQueryInfo(_0xc57559[_0x35a488(0xcb)],_0xc57559[_0x35a488(0xbf)](_0x35a488(0xbe))),_0x2c1beb=_0xc57559[_0x35a488(0xb9)](_0x35a488(0xc1));if(_0x2c1beb)return{'ok':!![],'data':_0x3e0c96};const _0x5a4ada=_0x3e0c96[_0x35a488(0xc8)]?await getDbName(_0xc57559[_0x35a488(0xcb)],_0x3e0c96[_0x35a488(0xc8)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x3e0c96[_0x35a488(0xcc)],'sqlName':_0x3e0c96[_0x35a488(0xbb)],'db':_0x5a4ada?_0x5a4ada+'\x20('+_0x3e0c96['dbId']+')':_0x3e0c96['dbId']??'','description':_0x3e0c96[_0x35a488(0xc9)]??'','sqlContent':_0x3e0c96[_0x35a488(0xc4)]??''}};}};
@@ -1 +1 @@
1
- const a179_0x2a64be=a179_0x4d1d;function a179_0x4d1d(_0x48ce0d,_0x3fb132){_0x48ce0d=_0x48ce0d-0x149;const _0x2fa33a=a179_0x2fa3();let _0x4d1d28=_0x2fa33a[_0x48ce0d];return _0x4d1d28;}(function(_0x1dba34,_0xa736e2){const _0x434409=a179_0x4d1d,_0x5cb378=_0x1dba34();while(!![]){try{const _0x317064=-parseInt(_0x434409(0x14e))/0x1+parseInt(_0x434409(0x157))/0x2+-parseInt(_0x434409(0x161))/0x3*(-parseInt(_0x434409(0x14c))/0x4)+-parseInt(_0x434409(0x156))/0x5+parseInt(_0x434409(0x15b))/0x6*(-parseInt(_0x434409(0x14d))/0x7)+parseInt(_0x434409(0x160))/0x8*(-parseInt(_0x434409(0x15a))/0x9)+-parseInt(_0x434409(0x14b))/0xa*(-parseInt(_0x434409(0x14f))/0xb);if(_0x317064===_0xa736e2)break;else _0x5cb378['push'](_0x5cb378['shift']());}catch(_0x58c781){_0x5cb378['push'](_0x5cb378['shift']());}}}(a179_0x2fa3,0x8ef67));function a179_0x2fa3(){const _0x3703ee=['SQL\x20execution\x20failed','22529590duTiVm','8cANxBl','6251psmaZl','711846dikfQd','11JohPEI','appCode','exec','now','params','execResult','execSuccess','4464770cGRcqL','2226250xHNsmZ','read','string','2334447EdYLRi','6894UPbmDr','length','isArray','sqlcode','sql','16uoDhqB','553671qDnNkl','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'];a179_0x2fa3=function(){return _0x3703ee;};return a179_0x2fa3();}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a179_0x2a64be(0x15f),'command':a179_0x2a64be(0x151),'description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a179_0x2a64be(0x158),'flags':[SQLCODE_FLAG,{'name':a179_0x2a64be(0x153),'type':a179_0x2a64be(0x159),'description':a179_0x2a64be(0x149)}],async 'execute'(_0x55f4a4){const _0x18a546=a179_0x2a64be,_0x4ed29a=parseJsonParams(_0x55f4a4['str'](_0x18a546(0x153))),_0x4927fc=Date['now'](),_0x2997bc=await executeSql(_0x55f4a4[_0x18a546(0x150)],_0x55f4a4['str'](_0x18a546(0x15e)),_0x4ed29a),_0x2e5d92=Date[_0x18a546(0x152)]()-_0x4927fc,_0x1b997c=_0x2997bc?.[_0x18a546(0x154)]??_0x2997bc,_0x27588d=_0x2997bc?.[_0x18a546(0x155)]??!![];if(!_0x27588d)return{'ok':![],'data':{'error':_0x2997bc?.['execError']||_0x18a546(0x14a),'elapsed':_0x2e5d92},'message':'SQL\x20execution\x20failed'};const _0x1005d4=Array[_0x18a546(0x15d)](_0x1b997c)?_0x1b997c:[];return{'ok':!![],'data':{'rows':_0x1005d4,'rowCount':_0x1005d4[_0x18a546(0x15c)],'elapsed':_0x2e5d92},'message':'Returned\x20'+_0x1005d4[_0x18a546(0x15c)]+'\x20row(s)\x20in\x20'+_0x2e5d92+'ms'};}};
1
+ const a186_0x502eb4=a186_0x202d;(function(_0x2f8e83,_0x80730b){const _0x263408=a186_0x202d,_0x247552=_0x2f8e83();while(!![]){try{const _0x1cbcdb=parseInt(_0x263408(0x190))/0x1+parseInt(_0x263408(0x187))/0x2*(-parseInt(_0x263408(0x191))/0x3)+-parseInt(_0x263408(0x199))/0x4+parseInt(_0x263408(0x19c))/0x5*(parseInt(_0x263408(0x19f))/0x6)+parseInt(_0x263408(0x18b))/0x7*(parseInt(_0x263408(0x189))/0x8)+-parseInt(_0x263408(0x18e))/0x9*(-parseInt(_0x263408(0x195))/0xa)+-parseInt(_0x263408(0x198))/0xb*(-parseInt(_0x263408(0x188))/0xc);if(_0x1cbcdb===_0x80730b)break;else _0x247552['push'](_0x247552['shift']());}catch(_0x164035){_0x247552['push'](_0x247552['shift']());}}}(a186_0x4469,0x1d789));import{executeSql}from'../../core/api-client.js';function a186_0x202d(_0x2605da,_0xed58a8){_0x2605da=_0x2605da-0x185;const _0x44698f=a186_0x4469();let _0x202d0f=_0x44698f[_0x2605da];return _0x202d0f;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a186_0x502eb4(0x185),'command':a186_0x502eb4(0x194),'description':a186_0x502eb4(0x192),'risk':'read','flags':[SQLCODE_FLAG,{'name':a186_0x502eb4(0x18d),'type':'string','description':a186_0x502eb4(0x19b)}],async 'execute'(_0x33bfc8){const _0xe5f694=a186_0x502eb4,_0x4ab67f=parseJsonParams(_0x33bfc8[_0xe5f694(0x18a)]('params')),_0x8a1e28=Date[_0xe5f694(0x197)](),_0x53c5c1=await executeSql(_0x33bfc8[_0xe5f694(0x186)],_0x33bfc8[_0xe5f694(0x18a)](_0xe5f694(0x19d)),_0x4ab67f),_0x4d1593=Date[_0xe5f694(0x197)]()-_0x8a1e28,_0x45e477=_0x53c5c1?.[_0xe5f694(0x193)]??_0x53c5c1,_0x1a4740=_0x53c5c1?.[_0xe5f694(0x196)]??!![];if(!_0x1a4740)return{'ok':![],'data':{'error':_0x53c5c1?.['execError']||'SQL\x20execution\x20failed','elapsed':_0x4d1593},'message':_0xe5f694(0x19a)};const _0x1de053=Array[_0xe5f694(0x19e)](_0x45e477)?_0x45e477:[];return{'ok':!![],'data':{'rows':_0x1de053,'rowCount':_0x1de053[_0xe5f694(0x18f)],'elapsed':_0x4d1593},'message':'Returned\x20'+_0x1de053['length']+_0xe5f694(0x18c)+_0x4d1593+'ms'};}};function a186_0x4469(){const _0x1afbe1=['88649pTQGBH','6FnWBEd','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','execResult','exec','185520uLcGHT','execSuccess','now','12617ESSVFx','828876ykdEeM','SQL\x20execution\x20failed','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','10hkJTNv','sqlcode','isArray','306618AnOzvo','sql','appCode','140558WBHNLA','552MGQLrl','1205320xkvfRj','str','7AVaZnN','\x20row(s)\x20in\x20','params','36tGhwpS','length'];a186_0x4469=function(){return _0x1afbe1;};return a186_0x4469();}
@@ -1 +1 @@
1
- (function(_0x176eca,_0x56c752){const _0x493dcf=a180_0x4c09,_0x57eb5e=_0x176eca();while(!![]){try{const _0x23134e=-parseInt(_0x493dcf(0x182))/0x1*(-parseInt(_0x493dcf(0x17a))/0x2)+-parseInt(_0x493dcf(0x180))/0x3*(parseInt(_0x493dcf(0x17e))/0x4)+parseInt(_0x493dcf(0x179))/0x5+parseInt(_0x493dcf(0x17f))/0x6+parseInt(_0x493dcf(0x17d))/0x7+parseInt(_0x493dcf(0x181))/0x8*(parseInt(_0x493dcf(0x178))/0x9)+parseInt(_0x493dcf(0x17c))/0xa*(-parseInt(_0x493dcf(0x17b))/0xb);if(_0x23134e===_0x56c752)break;else _0x57eb5e['push'](_0x57eb5e['shift']());}catch(_0x949372){_0x57eb5e['push'](_0x57eb5e['shift']());}}}(a180_0x2207,0x30380));function a180_0x2207(){const _0x3babbf=['436300yLQyPR','767542KTMCur','13002NScuYm','6070VYzvlP','1942990wdKVvq','286548DrDTpk','108954qNMauG','9ysovJz','104YVjoGF','1mRXBgU','251397sTekAe'];a180_0x2207=function(){return _0x3babbf;};return a180_0x2207();}import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';function a180_0x4c09(_0x6d8865,_0x29f6e3){_0x6d8865=_0x6d8865-0x178;const _0x220751=a180_0x2207();let _0x4c0916=_0x220751[_0x6d8865];return _0x4c0916;}import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x36011b,_0x5f475a){const _0x26f8af=a187_0x320b,_0x541b4e=_0x36011b();while(!![]){try{const _0x2774ae=-parseInt(_0x26f8af(0x1ed))/0x1+parseInt(_0x26f8af(0x1e4))/0x2*(-parseInt(_0x26f8af(0x1e5))/0x3)+parseInt(_0x26f8af(0x1eb))/0x4*(-parseInt(_0x26f8af(0x1e7))/0x5)+-parseInt(_0x26f8af(0x1e6))/0x6*(parseInt(_0x26f8af(0x1e8))/0x7)+-parseInt(_0x26f8af(0x1ee))/0x8+-parseInt(_0x26f8af(0x1e9))/0x9*(parseInt(_0x26f8af(0x1ec))/0xa)+parseInt(_0x26f8af(0x1ea))/0xb;if(_0x2774ae===_0x5f475a)break;else _0x541b4e['push'](_0x541b4e['shift']());}catch(_0x41fc59){_0x541b4e['push'](_0x541b4e['shift']());}}}(a187_0x354d,0xb5b72));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';function a187_0x354d(){const _0x1304ca=['3845816vMqTlt','10qkrXZF','1146594RTcULf','3225056bvgOYZ','285986bRrkmT','3OvTKli','206358hDAltg','5abUmas','133DbkJbF','11246913JxPWIJ','58317633XriLdA'];a187_0x354d=function(){return _0x1304ca;};return a187_0x354d();}import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';function a187_0x320b(_0x588592,_0x190731){_0x588592=_0x588592-0x1e4;const _0x354dce=a187_0x354d();let _0x320bd4=_0x354dce[_0x588592];return _0x320bd4;}import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a181_0x166d2b=a181_0x4e8c;(function(_0x579cbe,_0x50be78){const _0x9d8983=a181_0x4e8c,_0x5e65d7=_0x579cbe();while(!![]){try{const _0x378125=parseInt(_0x9d8983(0x77))/0x1+-parseInt(_0x9d8983(0x82))/0x2+-parseInt(_0x9d8983(0x7b))/0x3+-parseInt(_0x9d8983(0x80))/0x4*(-parseInt(_0x9d8983(0x7c))/0x5)+parseInt(_0x9d8983(0x6f))/0x6+-parseInt(_0x9d8983(0x79))/0x7+parseInt(_0x9d8983(0x73))/0x8;if(_0x378125===_0x50be78)break;else _0x5e65d7['push'](_0x5e65d7['shift']());}catch(_0x513132){_0x5e65d7['push'](_0x5e65d7['shift']());}}}(a181_0x28a8,0xcf1a3));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a181_0x4e8c(_0x2eaea6,_0x5200be){_0x2eaea6=_0x2eaea6-0x66;const _0x28a87f=a181_0x28a8();let _0x4e8c0a=_0x28a87f[_0x2eaea6];return _0x4e8c0a;}function a181_0x28a8(){const _0x355ad1=['Page\x20size','all','verbose','172RLsGOe','sqlcode','2383050DCjZqN','List\x20custom\x20SQL\x20queries','pagesize','appCode','Page\x20number','page','list','name','Filter\x20by\x20SQL\x20name','bool','num','str','paging','5578662fMQRZp','description','sql','length','13156360ekzVnX','sqlName','map','dbId','1432837scKCPk','sqlCode','9893317GdxkMz','totalCount','2538333VHwuvd','33965sSIfed'];a181_0x28a8=function(){return _0x355ad1;};return a181_0x28a8();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a181_0x166d2b(0x71),'command':a181_0x166d2b(0x68),'description':a181_0x166d2b(0x83),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':'string','description':a181_0x166d2b(0x6a)},{'name':a181_0x166d2b(0x67),'type':'number','description':a181_0x166d2b(0x66),'default':0x1},{'name':a181_0x166d2b(0x84),'type':'number','description':a181_0x166d2b(0x7d)},{'name':'verbose','type':'boolean','description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x34155c){const _0x7a0f72=a181_0x166d2b,_0x163ee1=await listSqlQueries(_0x34155c[_0x7a0f72(0x85)],{'sqlCode':_0x34155c['str'](_0x7a0f72(0x81))||undefined,'sqlName':_0x34155c[_0x7a0f72(0x6d)](_0x7a0f72(0x69))||undefined,'currentPage':_0x34155c[_0x7a0f72(0x6c)](_0x7a0f72(0x67)),'pageSize':_0x34155c[_0x7a0f72(0x6c)](_0x7a0f72(0x84),0x32)}),_0x26ff24=_0x34155c[_0x7a0f72(0x6b)](_0x7a0f72(0x7f)),_0x275976=_0x163ee1['tableData']??[],_0x1e4988=_0x163ee1[_0x7a0f72(0x6e)]?.[_0x7a0f72(0x7a)]??_0x275976[_0x7a0f72(0x72)];let _0x13ed84;return _0x26ff24?_0x13ed84=_0x275976:_0x13ed84=await Promise[_0x7a0f72(0x7e)](_0x275976[_0x7a0f72(0x75)](async _0x897b15=>{const _0x521fcd=_0x7a0f72;let _0x533261;try{_0x533261=_0x897b15[_0x521fcd(0x76)]?await getDbName(_0x34155c['appCode'],_0x897b15[_0x521fcd(0x76)]):undefined;}catch{}return{'sqlCode':_0x897b15[_0x521fcd(0x78)],'sqlName':_0x897b15[_0x521fcd(0x74)],'description':_0x897b15[_0x521fcd(0x70)]??'','db':_0x533261?_0x533261+'\x20('+_0x897b15[_0x521fcd(0x76)]+')':_0x897b15[_0x521fcd(0x76)]??''};})),{'ok':!![],'data':_0x13ed84,'message':_0x275976[_0x7a0f72(0x72)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':'Found\x20'+_0x275976['length']+'\x20SQL\x20queries\x20(total:\x20'+_0x1e4988+').'};}};
1
+ const a188_0x24c434=a188_0x3288;(function(_0x53b86b,_0x3e25ff){const _0x43bbf9=a188_0x3288,_0x25ba2d=_0x53b86b();while(!![]){try{const _0x3231b4=-parseInt(_0x43bbf9(0xe3))/0x1+parseInt(_0x43bbf9(0xde))/0x2*(-parseInt(_0x43bbf9(0xe5))/0x3)+-parseInt(_0x43bbf9(0xf2))/0x4*(-parseInt(_0x43bbf9(0xfd))/0x5)+-parseInt(_0x43bbf9(0xe9))/0x6+parseInt(_0x43bbf9(0xf5))/0x7+parseInt(_0x43bbf9(0xe7))/0x8+parseInt(_0x43bbf9(0xf3))/0x9*(parseInt(_0x43bbf9(0xf0))/0xa);if(_0x3231b4===_0x3e25ff)break;else _0x25ba2d['push'](_0x25ba2d['shift']());}catch(_0x37ca29){_0x25ba2d['push'](_0x25ba2d['shift']());}}}(a188_0x5cdf,0x36453));function a188_0x3288(_0x19cbb0,_0x382839){_0x19cbb0=_0x19cbb0-0xd9;const _0x5cdf48=a188_0x5cdf();let _0x3288c5=_0x5cdf48[_0x19cbb0];return _0x3288c5;}import{listSqlQueries}from'../../core/api-client.js';function a188_0x5cdf(){const _0x2248d5=['dbId','224133HPHaBg','sql','1113728MGtJpK','page','1827810TKjlIo','verbose','name','pagesize','paging','bool','read','30bmepAs','map','20fXlmRh','1044279vbJlHO','totalCount','2326247PuYRLb','No\x20custom\x20SQL\x20queries\x20found.','Page\x20size','boolean','Filter\x20by\x20SQL\x20name','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','number','appCode','279050CfNdot','all','Page\x20number','length','tableData','num','4AnBOZs','List\x20custom\x20SQL\x20queries','description','\x20SQL\x20queries\x20(total:\x20','str','422332iOuRdQ'];a188_0x5cdf=function(){return _0x2248d5;};return a188_0x5cdf();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a188_0x24c434(0xe6),'command':'list','description':a188_0x24c434(0xdf),'risk':a188_0x24c434(0xef),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a188_0x24c434(0xeb),'type':'string','description':a188_0x24c434(0xf9)},{'name':a188_0x24c434(0xe8),'type':'number','description':a188_0x24c434(0xda),'default':0x1},{'name':a188_0x24c434(0xec),'type':a188_0x24c434(0xfb),'description':a188_0x24c434(0xf7)},{'name':a188_0x24c434(0xea),'type':a188_0x24c434(0xf8),'description':a188_0x24c434(0xfa)}],async 'execute'(_0x981ef){const _0x193195=a188_0x24c434,_0x2f3e80=await listSqlQueries(_0x981ef[_0x193195(0xfc)],{'sqlCode':_0x981ef[_0x193195(0xe2)]('sqlcode')||undefined,'sqlName':_0x981ef['str'](_0x193195(0xeb))||undefined,'currentPage':_0x981ef['num'](_0x193195(0xe8)),'pageSize':_0x981ef[_0x193195(0xdd)](_0x193195(0xec),0x32)}),_0x44c06a=_0x981ef[_0x193195(0xee)]('verbose'),_0x2486d4=_0x2f3e80[_0x193195(0xdc)]??[],_0xb34916=_0x2f3e80[_0x193195(0xed)]?.[_0x193195(0xf4)]??_0x2486d4[_0x193195(0xdb)];let _0x32855f;return _0x44c06a?_0x32855f=_0x2486d4:_0x32855f=await Promise[_0x193195(0xd9)](_0x2486d4[_0x193195(0xf1)](async _0x2a2404=>{const _0x2870e2=_0x193195;let _0x35b73b;try{_0x35b73b=_0x2a2404['dbId']?await getDbName(_0x981ef['appCode'],_0x2a2404[_0x2870e2(0xe4)]):undefined;}catch{}return{'sqlCode':_0x2a2404['sqlCode'],'sqlName':_0x2a2404['sqlName'],'description':_0x2a2404[_0x2870e2(0xe0)]??'','db':_0x35b73b?_0x35b73b+'\x20('+_0x2a2404[_0x2870e2(0xe4)]+')':_0x2a2404['dbId']??''};})),{'ok':!![],'data':_0x32855f,'message':_0x2486d4[_0x193195(0xdb)]===0x0?_0x193195(0xf6):'Found\x20'+_0x2486d4['length']+_0x193195(0xe1)+_0xb34916+').'};}};
@@ -1 +1 @@
1
- const a182_0x2e485a=a182_0x403e;(function(_0xbd71d5,_0x1e9b94){const _0x393065=a182_0x403e,_0x227bbc=_0xbd71d5();while(!![]){try{const _0x1a76d7=parseInt(_0x393065(0x7c))/0x1+parseInt(_0x393065(0xa4))/0x2+-parseInt(_0x393065(0x6f))/0x3+-parseInt(_0x393065(0x8e))/0x4+-parseInt(_0x393065(0x72))/0x5*(parseInt(_0x393065(0x9c))/0x6)+-parseInt(_0x393065(0x93))/0x7*(parseInt(_0x393065(0x7f))/0x8)+parseInt(_0x393065(0x70))/0x9;if(_0x1a76d7===_0x1e9b94)break;else _0x227bbc['push'](_0x227bbc['shift']());}catch(_0x3caafd){_0x227bbc['push'](_0x227bbc['shift']());}}}(a182_0x14ee,0x8c272));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';function a182_0x403e(_0x10f54e,_0xc7ac3c){_0x10f54e=_0x10f54e-0x6f;const _0x14eebe=a182_0x14ee();let _0x403e5d=_0x14eebe[_0x10f54e];return _0x403e5d;}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x272168,_0x3391e1){const _0x2005b5=a182_0x403e,_0x27d3fd=[];let _0x2ddf56=0x1;while(!![]){const _0x49fa27=await listSqlQueries(_0x272168,{'currentPage':_0x2ddf56,'pageSize':PAGE_SIZE,'sqlCode':_0x3391e1[_0x2005b5(0xa0)],'sqlName':_0x3391e1[_0x2005b5(0x97)]}),_0x90ef51=_0x49fa27['tableData']??[];_0x27d3fd[_0x2005b5(0x75)](..._0x90ef51);if(_0x90ef51['length']===0x0)break;const _0x5c5aaf=_0x49fa27[_0x2005b5(0x87)]?.[_0x2005b5(0x83)];if(_0x5c5aaf!=null?_0x27d3fd[_0x2005b5(0xa5)]>=_0x5c5aaf:_0x90ef51[_0x2005b5(0xa5)]<PAGE_SIZE)break;_0x2ddf56++;}return _0x27d3fd;}async function ensureSqlContent(_0x2d2011){const _0x34557b=a182_0x403e;if(_0x2d2011['sqlContent']!=null&&String(_0x2d2011[_0x34557b(0x9f)])[_0x34557b(0xa5)]>0x0)return _0x2d2011;return getSqlQueryDetail(_0x2d2011['sqlCode']);}export const sqlPull={'service':'sql','command':'pull','description':a182_0x2e485a(0x82),'risk':a182_0x2e485a(0x96),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a182_0x2e485a(0x8d),'type':a182_0x2e485a(0x80),'description':a182_0x2e485a(0xa3)},{'name':'force','type':a182_0x2e485a(0xa2),'description':a182_0x2e485a(0x98)}],async 'dryRun'(_0x2f675b){const _0x334a7c=a182_0x2e485a,_0x2ad7e5=loadSqlProjectConfig(_0x2f675b['appCode']),_0x583d08=await readSqlLockFile(_0x2ad7e5[_0x334a7c(0xa9)]),{appLock:_0x52004e}=ensureSqlLockScope(_0x583d08??createEmptySqlLock(),_0x2ad7e5[_0x334a7c(0x7a)],_0x2ad7e5[_0x334a7c(0x89)],_0x334a7c(0x9e)),_0x130213=await fetchAllSqlQueries(_0x2f675b[_0x334a7c(0x7a)],{'sqlCode':_0x2f675b[_0x334a7c(0xa8)](_0x334a7c(0x8f))||undefined,'sqlName':_0x2f675b['str'](_0x334a7c(0x8d))||undefined}),_0x2525ff=[];for(const _0x161825 of _0x130213){const _0x24af3b=await ensureSqlContent(_0x161825),_0x168c19=ensureRemoteSqlContent(_0x24af3b),_0x44d256=detectModeFromSql(_0x24af3b),_0x2c7892=_0x24af3b['dbId']?await getDbName(_0x2f675b['appCode'],Number(_0x24af3b[_0x334a7c(0x76)]))['catch'](()=>undefined):undefined,_0x500b8d=buildLocalSqlFileContent({'sqlCode':_0x24af3b[_0x334a7c(0xa0)],'sqlName':_0x24af3b['sqlName'],'dbId':_0x24af3b[_0x334a7c(0x76)]},_0x168c19,{'dbName':_0x2c7892,'mode':_0x44d256,'syncedAt':new Date()[_0x334a7c(0x90)](),'description':_0x24af3b[_0x334a7c(0x79)]}),_0x4d17e0=buildSqlLockEntry(_0x24af3b,_0x168c19,'',{'dbName':_0x2c7892}),_0x1d7fb4=resolveLocalSqlFilePath(_0x2ad7e5,_0x24af3b[_0x334a7c(0xa0)],_0x4d17e0);let _0x3ea18a=_0x334a7c(0x94),_0x1c990d;if(await fileExists(_0x1d7fb4)){const _0x409aff=await readFile(_0x1d7fb4,'utf8');isEquivalentPulledSqlFile(_0x409aff,_0x500b8d,_0x44d256)?(_0x3ea18a='skipped',_0x1c990d=_0x334a7c(0x85)):(_0x3ea18a=_0x334a7c(0x78),_0x1c990d='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x2525ff[_0x334a7c(0x75)]({'sqlCode':_0x24af3b[_0x334a7c(0xa0)],'sqlName':_0x24af3b[_0x334a7c(0x97)],'filePath':_0x1d7fb4,'status':_0x3ea18a,'reason':_0x1c990d});}return{'method':_0x334a7c(0x71),'url':_0x334a7c(0x91),'body':{'appCode':_0x2f675b['appCode'],'sqlCode':_0x2f675b[_0x334a7c(0xa8)](_0x334a7c(0x8f))||null,'sqlName':_0x2f675b[_0x334a7c(0xa8)]('name')||null,'files':_0x2525ff},'description':_0x334a7c(0xa1)+_0x2525ff['length']+_0x334a7c(0x7b)+_0x2ad7e5[_0x334a7c(0x9d)]};},async 'execute'(_0x3f0d51){const _0x3d9f88=a182_0x2e485a,_0x8a1055=loadSqlProjectConfig(_0x3f0d51[_0x3d9f88(0x7a)]),_0x5e1c9b=await readSqlLockFile(_0x8a1055['lockFilePath']),{lockData:_0x51d927,appLock:_0x5f2e7c}=ensureSqlLockScope(_0x5e1c9b??createEmptySqlLock(),_0x8a1055['appCode'],_0x8a1055['sqlRoot'],_0x3d9f88(0x9e)),_0x12bc53=_0x3f0d51[_0x3d9f88(0x8a)](_0x3d9f88(0xa7)),_0x2748dd=await fetchAllSqlQueries(_0x3f0d51['appCode'],{'sqlCode':_0x3f0d51[_0x3d9f88(0xa8)](_0x3d9f88(0x8f))||undefined,'sqlName':_0x3f0d51[_0x3d9f88(0xa8)](_0x3d9f88(0x8d))||undefined});if(_0x2748dd['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x3d9f88(0x88)};const _0x29da81=[],_0xd6f846=[];for(const _0x153e1e of _0x2748dd){try{_0x29da81[_0x3d9f88(0x75)](await ensureSqlContent(_0x153e1e));}catch(_0x42f8df){_0xd6f846[_0x3d9f88(0x75)]({'sqlCode':_0x153e1e['sqlCode'],'error':_0x42f8df instanceof Error?_0x42f8df[_0x3d9f88(0x92)]:String(_0x42f8df)});}}if(_0x12bc53&&!_0x3f0d51[_0x3d9f88(0x86)]){let _0x49ee55=![];for(const _0x3481d9 of _0x29da81){const _0x51f803=detectModeFromSql(_0x3481d9),_0x548a71=_0x3481d9['dbId']?await getDbName(_0x3f0d51[_0x3d9f88(0x7a)],Number(_0x3481d9['dbId']))[_0x3d9f88(0x7e)](()=>undefined):undefined,_0xa92b25=buildLocalSqlFileContent({'sqlCode':_0x3481d9[_0x3d9f88(0xa0)],'sqlName':_0x3481d9['sqlName'],'dbId':_0x3481d9[_0x3d9f88(0x76)]},ensureRemoteSqlContent(_0x3481d9),{'dbName':_0x548a71,'mode':_0x51f803,'syncedAt':new Date()[_0x3d9f88(0x90)](),'description':_0x3481d9[_0x3d9f88(0x79)]}),_0x1ff8b0=resolveLocalSqlFilePath(_0x8a1055,_0x3481d9['sqlCode'],buildSqlLockEntry(_0x3481d9,ensureRemoteSqlContent(_0x3481d9),'',{'dbName':_0x548a71}));if(await fileExists(_0x1ff8b0)){const _0x47c9e3=await readFile(_0x1ff8b0,_0x3d9f88(0xaa));if(!isEquivalentPulledSqlFile(_0x47c9e3,_0xa92b25,_0x51f803)){_0x49ee55=!![];break;}}}if(_0x49ee55){const _0x250d62=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x250d62)throw CliErrors[_0x3d9f88(0x8b)](_0x3d9f88(0xab));}}const _0x48610e=cloneSqlLockData(_0x51d927),_0x4e4101=_0x48610e[_0x3d9f88(0x74)][_0x8a1055[_0x3d9f88(0x7a)]],_0x40f982=[],_0x535070=[];for(const _0x57ccb6 of _0x29da81){const _0x3b3dc9=_0x4e4101[_0x3d9f88(0x73)][_0x57ccb6[_0x3d9f88(0xa0)]],_0x81c6b0=ensureRemoteSqlContent(_0x57ccb6),_0x2f09d4=detectModeFromSql(_0x57ccb6),_0x530e16=_0x57ccb6[_0x3d9f88(0x76)]?await getDbName(_0x3f0d51[_0x3d9f88(0x7a)],Number(_0x57ccb6['dbId']))[_0x3d9f88(0x7e)](()=>undefined):undefined,_0x50a06a=buildLocalSqlFileContent({'sqlCode':_0x57ccb6[_0x3d9f88(0xa0)],'sqlName':_0x57ccb6[_0x3d9f88(0x97)],'dbId':_0x57ccb6[_0x3d9f88(0x76)]},_0x81c6b0,{'dbName':_0x530e16,'mode':_0x2f09d4,'syncedAt':new Date()[_0x3d9f88(0x90)](),'description':_0x57ccb6[_0x3d9f88(0x79)]}),_0x3f94cc=buildSqlLockEntry(_0x57ccb6,_0x81c6b0,computeSqlContentHash(_0x50a06a),{'dbName':_0x530e16}),_0x4db23b=_0x3f94cc[_0x3d9f88(0x84)],_0x23cc94=join(_0x8a1055[_0x3d9f88(0x9d)],_0x4db23b);try{if(await fileExists(_0x23cc94)){const _0x48f609=await readFile(_0x23cc94,_0x3d9f88(0xaa));if(isEquivalentPulledSqlFile(_0x48f609,_0x50a06a,_0x2f09d4)){_0x535070['push']({'sqlCode':_0x57ccb6['sqlCode'],'reason':_0x3d9f88(0x85)}),_0x4e4101[_0x3d9f88(0x73)][_0x57ccb6[_0x3d9f88(0xa0)]]={..._0x3f94cc,'hash':computeSqlContentHash(_0x48f609),'path':_0x4db23b};continue;}if(!_0x12bc53){_0x535070[_0x3d9f88(0x75)]({'sqlCode':_0x57ccb6[_0x3d9f88(0xa0)],'reason':_0x3d9f88(0x9a)});continue;}}const _0x5e5cc6=_0x3b3dc9?.[_0x3d9f88(0x84)]?join(_0x8a1055[_0x3d9f88(0x9d)],_0x3b3dc9[_0x3d9f88(0x84)]):undefined;_0x5e5cc6&&_0x5e5cc6!==_0x23cc94&&await fileExists(_0x5e5cc6)&&await rm(_0x5e5cc6,{'force':!![]}),await ensureParentDirectory(_0x23cc94),await writeFile(_0x23cc94,_0x50a06a,_0x3d9f88(0xaa)),_0x4e4101['sqls'][_0x57ccb6[_0x3d9f88(0xa0)]]={..._0x3f94cc,'path':_0x4db23b},_0x40f982[_0x3d9f88(0x75)]({'sqlCode':_0x57ccb6[_0x3d9f88(0xa0)],'filePath':_0x23cc94});}catch(_0x187cf0){_0xd6f846[_0x3d9f88(0x75)]({'sqlCode':_0x57ccb6['sqlCode'],'error':_0x187cf0 instanceof Error?_0x187cf0['message']:String(_0x187cf0)});}}return _0x4e4101[_0x3d9f88(0x81)]=new Date()[_0x3d9f88(0x90)](),await writeSqlLockFile(_0x8a1055[_0x3d9f88(0xa9)],_0x48610e),{'ok':_0xd6f846[_0x3d9f88(0xa5)]===0x0,'data':{'pulled':_0x40f982,'skipped':_0x535070,'failed':_0xd6f846},'message':_0x3d9f88(0x99)+_0x40f982['length']+'\x20written,\x20'+_0x535070[_0x3d9f88(0xa5)]+_0x3d9f88(0x7d)+_0xd6f846[_0x3d9f88(0xa5)]+'\x20failed'};}};function detectModeFromSql(_0x4c166c){const _0x4a604b=a182_0x2e485a,_0x24d8c7=ensureRemoteSqlContent(_0x4c166c),_0x4cc8d7=stripLocalSqlMetadata(_0x24d8c7,_0x4a604b(0x9b))['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x4a604b(0x77)](_0x4cc8d7))return _0x4a604b(0x9b);return'sql';}function isEquivalentPulledSqlFile(_0x3d44c8,_0x34966d,_0x7b008){return normalizePullComparableContent(_0x3d44c8,_0x7b008)===normalizePullComparableContent(_0x34966d,_0x7b008);}function normalizePullComparableContent(_0xf5ca09,_0x23b983){const _0x5b2e1a=a182_0x2e485a,_0x471f0b=_0xf5ca09[_0x5b2e1a(0xa6)](/\r\n/g,'\x0a')[_0x5b2e1a(0x8c)]('\x0a'),_0x4d4183=_0x471f0b['filter'](_0x6795e1=>!isSyncedAtMetadataLine(_0x6795e1,_0x23b983));return _0x4d4183[_0x5b2e1a(0x95)]('\x0a');}function a182_0x14ee(){const _0x315d3a=['utf8','Force\x20pull\x20cancelled.','2696736QhsMrE','21969234GdlXOp','POST','2155Icipbx','sqls','apps','push','dbId','test','conflict','description','appCode','\x20SQL\x20file(s)\x20into\x20','14833YrXEZm','\x20skipped,\x20','catch','24mbBjAK','string','lastSync','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','totalCount','path','unchanged','nonInteractive','paging','No\x20remote\x20SQL\x20queries\x20matched.','sqlRoot','bool','cancelled','split','name','3950172qFcVGn','sqlcode','toISOString','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','message','345562bccJgb','would_pull','join','write','sqlName','Force\x20overwrite\x20local\x20unsynced\x20changes','Pull\x20complete:\x20','local\x20differs\x20from\x20remote','mybatisXml','8958tESFBq','sqlRootDir','pull','sqlContent','sqlCode','Would\x20pull\x20','boolean','Filter\x20by\x20SQL\x20display\x20name','1592486RawrxV','length','replace','force','str','lockFilePath'];a182_0x14ee=function(){return _0x315d3a;};return a182_0x14ee();}function isSyncedAtMetadataLine(_0x524318,_0xb6045e){const _0x12890e=a182_0x2e485a;if(_0xb6045e===_0x12890e(0x9b))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x12890e(0x77)](_0x524318);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x524318);}
1
+ const a189_0xfc5292=a189_0x1942;(function(_0x2a3420,_0x49abae){const _0x120b15=a189_0x1942,_0x112651=_0x2a3420();while(!![]){try{const _0xfd418=parseInt(_0x120b15(0x173))/0x1*(-parseInt(_0x120b15(0x16f))/0x2)+-parseInt(_0x120b15(0x179))/0x3+parseInt(_0x120b15(0x160))/0x4+-parseInt(_0x120b15(0x164))/0x5*(parseInt(_0x120b15(0x195))/0x6)+parseInt(_0x120b15(0x172))/0x7+parseInt(_0x120b15(0x18f))/0x8+parseInt(_0x120b15(0x187))/0x9*(parseInt(_0x120b15(0x17e))/0xa);if(_0xfd418===_0x49abae)break;else _0x112651['push'](_0x112651['shift']());}catch(_0x4e07a0){_0x112651['push'](_0x112651['shift']());}}}(a189_0x1c40,0x7cc3d));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';function a189_0x1942(_0x2fe7ac,_0x3d64cb){_0x2fe7ac=_0x2fe7ac-0x15e;const _0x1c4074=a189_0x1c40();let _0x1942b5=_0x1c4074[_0x2fe7ac];return _0x1942b5;}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;function a189_0x1c40(){const _0x51e8c5=['nonInteractive','bool','message','Force\x20overwrite\x20local\x20unsynced\x20changes','pull','sqls','trimStart','paging','6qtkeLz','lockFilePath','utf8','829577EWNYLb','109206QqErZi','filter','mybatisXml','\x20failed','local\x20differs\x20from\x20remote','\x20written,\x20','1550052TTPSIB','appCode','Force\x20pull\x20cancelled.','str','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','31550eguPmC','would_pull','\x20skipped,\x20','lastSync','boolean','sqlCode','unchanged','Filter\x20by\x20SQL\x20display\x20name','sqlcode','117KGljDJ','join','totalCount','force','push','cancelled','length','No\x20remote\x20SQL\x20queries\x20matched.','6132944rVlrLt','name','POST','string','sqlContent','dbId','152694YIrzcn','catch','Pull\x20complete:\x20','sql','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','split','test','\x20SQL\x20file(s)\x20into\x20','sqlRoot','2022168FqILEq','sqlRootDir','description','sqlName','15tayjZR','toISOString','path'];a189_0x1c40=function(){return _0x51e8c5;};return a189_0x1c40();}async function fetchAllSqlQueries(_0x39aa12,_0x1e12ed){const _0x3db37c=a189_0x1942,_0x32eb3e=[];let _0x25fea1=0x1;while(!![]){const _0x5e34d2=await listSqlQueries(_0x39aa12,{'currentPage':_0x25fea1,'pageSize':PAGE_SIZE,'sqlCode':_0x1e12ed[_0x3db37c(0x183)],'sqlName':_0x1e12ed['sqlName']}),_0x235d85=_0x5e34d2['tableData']??[];_0x32eb3e[_0x3db37c(0x18b)](..._0x235d85);if(_0x235d85[_0x3db37c(0x18d)]===0x0)break;const _0x23338b=_0x5e34d2[_0x3db37c(0x16e)]?.[_0x3db37c(0x189)];if(_0x23338b!=null?_0x32eb3e[_0x3db37c(0x18d)]>=_0x23338b:_0x235d85['length']<PAGE_SIZE)break;_0x25fea1++;}return _0x32eb3e;}async function ensureSqlContent(_0x3fe760){const _0xd46102=a189_0x1942;if(_0x3fe760[_0xd46102(0x193)]!=null&&String(_0x3fe760['sqlContent'])[_0xd46102(0x18d)]>0x0)return _0x3fe760;return getSqlQueryDetail(_0x3fe760['sqlCode']);}export const sqlPull={'service':a189_0xfc5292(0x198),'command':a189_0xfc5292(0x16b),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a189_0xfc5292(0x190),'type':a189_0xfc5292(0x192),'description':a189_0xfc5292(0x185)},{'name':a189_0xfc5292(0x18a),'type':a189_0xfc5292(0x182),'description':a189_0xfc5292(0x16a)}],async 'dryRun'(_0x6bafba){const _0x4647f6=a189_0xfc5292,_0x5796da=loadSqlProjectConfig(_0x6bafba[_0x4647f6(0x17a)]),_0x44159b=await readSqlLockFile(_0x5796da[_0x4647f6(0x170)]),{appLock:_0x91a91b}=ensureSqlLockScope(_0x44159b??createEmptySqlLock(),_0x5796da[_0x4647f6(0x17a)],_0x5796da[_0x4647f6(0x15f)],_0x4647f6(0x16b)),_0x4e740=await fetchAllSqlQueries(_0x6bafba[_0x4647f6(0x17a)],{'sqlCode':_0x6bafba[_0x4647f6(0x17c)](_0x4647f6(0x186))||undefined,'sqlName':_0x6bafba['str'](_0x4647f6(0x190))||undefined}),_0x19044e=[];for(const _0xaf9f31 of _0x4e740){const _0x41b980=await ensureSqlContent(_0xaf9f31),_0x2d4bd9=ensureRemoteSqlContent(_0x41b980),_0xc900fe=detectModeFromSql(_0x41b980),_0x480b8d=_0x41b980[_0x4647f6(0x194)]?await getDbName(_0x6bafba[_0x4647f6(0x17a)],Number(_0x41b980[_0x4647f6(0x194)]))[_0x4647f6(0x196)](()=>undefined):undefined,_0x4d7f7e=buildLocalSqlFileContent({'sqlCode':_0x41b980[_0x4647f6(0x183)],'sqlName':_0x41b980['sqlName'],'dbId':_0x41b980[_0x4647f6(0x194)]},_0x2d4bd9,{'dbName':_0x480b8d,'mode':_0xc900fe,'syncedAt':new Date()['toISOString'](),'description':_0x41b980[_0x4647f6(0x162)]}),_0xac7845=buildSqlLockEntry(_0x41b980,_0x2d4bd9,'',{'dbName':_0x480b8d}),_0x201d11=resolveLocalSqlFilePath(_0x5796da,_0x41b980[_0x4647f6(0x183)],_0xac7845);let _0x3c7c53=_0x4647f6(0x17f),_0x500ed;if(await fileExists(_0x201d11)){const _0x248bb5=await readFile(_0x201d11,_0x4647f6(0x171));isEquivalentPulledSqlFile(_0x248bb5,_0x4d7f7e,_0xc900fe)?(_0x3c7c53='skipped',_0x500ed='unchanged'):(_0x3c7c53='conflict',_0x500ed=_0x4647f6(0x17d));}_0x19044e['push']({'sqlCode':_0x41b980[_0x4647f6(0x183)],'sqlName':_0x41b980[_0x4647f6(0x163)],'filePath':_0x201d11,'status':_0x3c7c53,'reason':_0x500ed});}return{'method':_0x4647f6(0x191),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x6bafba['appCode'],'sqlCode':_0x6bafba[_0x4647f6(0x17c)]('sqlcode')||null,'sqlName':_0x6bafba[_0x4647f6(0x17c)](_0x4647f6(0x190))||null,'files':_0x19044e},'description':'Would\x20pull\x20'+_0x19044e[_0x4647f6(0x18d)]+_0x4647f6(0x15e)+_0x5796da[_0x4647f6(0x161)]};},async 'execute'(_0xb886c5){const _0xf62f41=a189_0xfc5292,_0x250257=loadSqlProjectConfig(_0xb886c5[_0xf62f41(0x17a)]),_0x4df998=await readSqlLockFile(_0x250257[_0xf62f41(0x170)]),{lockData:_0x1dfc35,appLock:_0x4409bf}=ensureSqlLockScope(_0x4df998??createEmptySqlLock(),_0x250257['appCode'],_0x250257[_0xf62f41(0x15f)],'pull'),_0x7fc229=_0xb886c5[_0xf62f41(0x168)]('force'),_0x20deb8=await fetchAllSqlQueries(_0xb886c5[_0xf62f41(0x17a)],{'sqlCode':_0xb886c5[_0xf62f41(0x17c)](_0xf62f41(0x186))||undefined,'sqlName':_0xb886c5[_0xf62f41(0x17c)]('name')||undefined});if(_0x20deb8[_0xf62f41(0x18d)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0xf62f41(0x18e)};const _0x5e832c=[],_0x2d9359=[];for(const _0x322b27 of _0x20deb8){try{_0x5e832c[_0xf62f41(0x18b)](await ensureSqlContent(_0x322b27));}catch(_0x2c0f02){_0x2d9359[_0xf62f41(0x18b)]({'sqlCode':_0x322b27[_0xf62f41(0x183)],'error':_0x2c0f02 instanceof Error?_0x2c0f02[_0xf62f41(0x169)]:String(_0x2c0f02)});}}if(_0x7fc229&&!_0xb886c5[_0xf62f41(0x167)]){let _0x282a70=![];for(const _0x52e161 of _0x5e832c){const _0x2ef2bf=detectModeFromSql(_0x52e161),_0x2d6b98=_0x52e161[_0xf62f41(0x194)]?await getDbName(_0xb886c5['appCode'],Number(_0x52e161[_0xf62f41(0x194)]))[_0xf62f41(0x196)](()=>undefined):undefined,_0xdb17aa=buildLocalSqlFileContent({'sqlCode':_0x52e161[_0xf62f41(0x183)],'sqlName':_0x52e161[_0xf62f41(0x163)],'dbId':_0x52e161[_0xf62f41(0x194)]},ensureRemoteSqlContent(_0x52e161),{'dbName':_0x2d6b98,'mode':_0x2ef2bf,'syncedAt':new Date()[_0xf62f41(0x165)](),'description':_0x52e161['description']}),_0x42dabb=resolveLocalSqlFilePath(_0x250257,_0x52e161[_0xf62f41(0x183)],buildSqlLockEntry(_0x52e161,ensureRemoteSqlContent(_0x52e161),'',{'dbName':_0x2d6b98}));if(await fileExists(_0x42dabb)){const _0x2aa55d=await readFile(_0x42dabb,'utf8');if(!isEquivalentPulledSqlFile(_0x2aa55d,_0xdb17aa,_0x2ef2bf)){_0x282a70=!![];break;}}}if(_0x282a70){const _0x417144=await confirmForceOverwrite(_0xf62f41(0x199));if(!_0x417144)throw CliErrors[_0xf62f41(0x18c)](_0xf62f41(0x17b));}}const _0x2ed0cb=cloneSqlLockData(_0x1dfc35),_0xf4328e=_0x2ed0cb['apps'][_0x250257[_0xf62f41(0x17a)]],_0x3763ad=[],_0x1b206a=[];for(const _0x337bd8 of _0x5e832c){const _0x273cd9=_0xf4328e[_0xf62f41(0x16c)][_0x337bd8[_0xf62f41(0x183)]],_0x3ed2a2=ensureRemoteSqlContent(_0x337bd8),_0x5cf55c=detectModeFromSql(_0x337bd8),_0x5b0097=_0x337bd8[_0xf62f41(0x194)]?await getDbName(_0xb886c5['appCode'],Number(_0x337bd8[_0xf62f41(0x194)]))[_0xf62f41(0x196)](()=>undefined):undefined,_0x385ae1=buildLocalSqlFileContent({'sqlCode':_0x337bd8[_0xf62f41(0x183)],'sqlName':_0x337bd8['sqlName'],'dbId':_0x337bd8['dbId']},_0x3ed2a2,{'dbName':_0x5b0097,'mode':_0x5cf55c,'syncedAt':new Date()[_0xf62f41(0x165)](),'description':_0x337bd8[_0xf62f41(0x162)]}),_0x286ea7=buildSqlLockEntry(_0x337bd8,_0x3ed2a2,computeSqlContentHash(_0x385ae1),{'dbName':_0x5b0097}),_0x34e338=_0x286ea7['path'],_0x3b6dfe=join(_0x250257[_0xf62f41(0x161)],_0x34e338);try{if(await fileExists(_0x3b6dfe)){const _0x12fc18=await readFile(_0x3b6dfe,_0xf62f41(0x171));if(isEquivalentPulledSqlFile(_0x12fc18,_0x385ae1,_0x5cf55c)){_0x1b206a[_0xf62f41(0x18b)]({'sqlCode':_0x337bd8[_0xf62f41(0x183)],'reason':_0xf62f41(0x184)}),_0xf4328e[_0xf62f41(0x16c)][_0x337bd8[_0xf62f41(0x183)]]={..._0x286ea7,'hash':computeSqlContentHash(_0x12fc18),'path':_0x34e338};continue;}if(!_0x7fc229){_0x1b206a[_0xf62f41(0x18b)]({'sqlCode':_0x337bd8[_0xf62f41(0x183)],'reason':_0xf62f41(0x177)});continue;}}const _0x433727=_0x273cd9?.[_0xf62f41(0x166)]?join(_0x250257[_0xf62f41(0x161)],_0x273cd9[_0xf62f41(0x166)]):undefined;_0x433727&&_0x433727!==_0x3b6dfe&&await fileExists(_0x433727)&&await rm(_0x433727,{'force':!![]}),await ensureParentDirectory(_0x3b6dfe),await writeFile(_0x3b6dfe,_0x385ae1,_0xf62f41(0x171)),_0xf4328e[_0xf62f41(0x16c)][_0x337bd8[_0xf62f41(0x183)]]={..._0x286ea7,'path':_0x34e338},_0x3763ad[_0xf62f41(0x18b)]({'sqlCode':_0x337bd8['sqlCode'],'filePath':_0x3b6dfe});}catch(_0x543e8a){_0x2d9359['push']({'sqlCode':_0x337bd8[_0xf62f41(0x183)],'error':_0x543e8a instanceof Error?_0x543e8a[_0xf62f41(0x169)]:String(_0x543e8a)});}}return _0xf4328e[_0xf62f41(0x181)]=new Date()[_0xf62f41(0x165)](),await writeSqlLockFile(_0x250257['lockFilePath'],_0x2ed0cb),{'ok':_0x2d9359['length']===0x0,'data':{'pulled':_0x3763ad,'skipped':_0x1b206a,'failed':_0x2d9359},'message':_0xf62f41(0x197)+_0x3763ad[_0xf62f41(0x18d)]+_0xf62f41(0x178)+_0x1b206a[_0xf62f41(0x18d)]+_0xf62f41(0x180)+_0x2d9359[_0xf62f41(0x18d)]+_0xf62f41(0x176)};}};function detectModeFromSql(_0x5bc5c6){const _0x1765e6=a189_0xfc5292,_0x5f3679=ensureRemoteSqlContent(_0x5bc5c6),_0xda3741=stripLocalSqlMetadata(_0x5f3679,'mybatisXml')[_0x1765e6(0x16d)]();if(/^<(select|insert|update|delete)\b/i[_0x1765e6(0x19b)](_0xda3741))return _0x1765e6(0x175);return'sql';}function isEquivalentPulledSqlFile(_0x5ecb97,_0x1637c0,_0xb4da3){return normalizePullComparableContent(_0x5ecb97,_0xb4da3)===normalizePullComparableContent(_0x1637c0,_0xb4da3);}function normalizePullComparableContent(_0x307f60,_0x2a3a43){const _0x1742c4=a189_0xfc5292,_0x1e9c3c=_0x307f60['replace'](/\r\n/g,'\x0a')[_0x1742c4(0x19a)]('\x0a'),_0x3775b0=_0x1e9c3c[_0x1742c4(0x174)](_0xd24a5a=>!isSyncedAtMetadataLine(_0xd24a5a,_0x2a3a43));return _0x3775b0[_0x1742c4(0x188)]('\x0a');}function isSyncedAtMetadataLine(_0x577bd8,_0x184e4f){const _0x48b8d9=a189_0xfc5292;if(_0x184e4f==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x48b8d9(0x19b)](_0x577bd8);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x48b8d9(0x19b)](_0x577bd8);}