@lovrabet/rabetbase-cli 2.4.6-beta.1 → 2.4.6-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 (299) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/fetch-model-list.js +1 -1
  3. package/lib/api/generate-api-file.js +1 -1
  4. package/lib/auth/auth-server-ui.js +1 -1
  5. package/lib/auth/auth-server.js +1 -1
  6. package/lib/auth/constant.js +1 -1
  7. package/lib/auth/get-cookie.js +1 -1
  8. package/lib/auth/get-session-user.js +1 -1
  9. package/lib/auth/is-session-valid.js +1 -1
  10. package/lib/auth/login-success-html.js +1 -1
  11. package/lib/auth/logout.js +1 -1
  12. package/lib/cli-flags.js +1 -1
  13. package/lib/cli.js +1 -1
  14. package/lib/commands/api/generate.js +1 -1
  15. package/lib/commands/api/index.js +1 -1
  16. package/lib/commands/api/list.js +1 -1
  17. package/lib/commands/api/pull.js +1 -1
  18. package/lib/commands/api/shared.js +1 -1
  19. package/lib/commands/app/index.js +1 -1
  20. package/lib/commands/app/list.js +1 -1
  21. package/lib/commands/app/members-list.js +1 -1
  22. package/lib/commands/app/remote-directory.js +1 -1
  23. package/lib/commands/app/shared.js +1 -1
  24. package/lib/commands/app-config/delete.js +1 -1
  25. package/lib/commands/app-config/get.js +1 -1
  26. package/lib/commands/app-config/index.js +1 -1
  27. package/lib/commands/app-config/list.js +1 -1
  28. package/lib/commands/app-config/set.js +1 -1
  29. package/lib/commands/app-config/shared.js +1 -1
  30. package/lib/commands/auth/index.js +1 -1
  31. package/lib/commands/bff/create.js +1 -1
  32. package/lib/commands/bff/delete.js +1 -1
  33. package/lib/commands/bff/detail.js +1 -1
  34. package/lib/commands/bff/index.js +1 -1
  35. package/lib/commands/bff/list.js +1 -1
  36. package/lib/commands/bff/pull.js +1 -1
  37. package/lib/commands/bff/push.js +1 -1
  38. package/lib/commands/bff/status.js +1 -1
  39. package/lib/commands/cli-skill/index.js +1 -1
  40. package/lib/commands/cli-update.js +1 -1
  41. package/lib/commands/codegen/index.js +1 -1
  42. package/lib/commands/codegen/sdk.js +1 -1
  43. package/lib/commands/codegen/sql.js +1 -1
  44. package/lib/commands/common/app-registry.js +1 -1
  45. package/lib/commands/common/app-selector.js +1 -1
  46. package/lib/commands/common/async-task.js +1 -1
  47. package/lib/commands/common/dry-run.js +1 -1
  48. package/lib/commands/common/flags.js +1 -1
  49. package/lib/commands/common/local-file.js +1 -1
  50. package/lib/commands/common/validate.js +1 -1
  51. package/lib/commands/config/get.js +1 -1
  52. package/lib/commands/config/index.js +1 -1
  53. package/lib/commands/config/list.js +1 -1
  54. package/lib/commands/config/set.js +1 -1
  55. package/lib/commands/config/shared.js +1 -1
  56. package/lib/commands/data/filter.js +1 -1
  57. package/lib/commands/data/getOne.js +1 -1
  58. package/lib/commands/data/index.js +1 -1
  59. package/lib/commands/data/shared.js +1 -1
  60. package/lib/commands/dataset/business-group-update.js +1 -1
  61. package/lib/commands/dataset/business-groups.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-refresh-start.js +1 -1
  88. package/lib/commands/db/diff-refresh-status.js +1 -1
  89. package/lib/commands/db/diff.js +1 -1
  90. package/lib/commands/db/index.js +1 -1
  91. package/lib/commands/db/list.js +1 -1
  92. package/lib/commands/db/shared.js +1 -1
  93. package/lib/commands/db/tables.js +1 -1
  94. package/lib/commands/db/test.js +1 -1
  95. package/lib/commands/db/update.js +1 -1
  96. package/lib/commands/doctor.js +1 -1
  97. package/lib/commands/file/index.js +1 -1
  98. package/lib/commands/init/index.js +1 -1
  99. package/lib/commands/issue/index.js +1 -1
  100. package/lib/commands/issue/nudge.js +1 -1
  101. package/lib/commands/issue/report.js +1 -1
  102. package/lib/commands/issue/shared.js +1 -1
  103. package/lib/commands/kb/create.js +1 -1
  104. package/lib/commands/kb/delete.js +1 -1
  105. package/lib/commands/kb/detail.js +1 -1
  106. package/lib/commands/kb/index.js +1 -1
  107. package/lib/commands/kb/list.js +1 -1
  108. package/lib/commands/kb/shared.js +1 -1
  109. package/lib/commands/kb/update.js +1 -1
  110. package/lib/commands/logs/index.js +1 -1
  111. package/lib/commands/menu/asset-update.js +1 -1
  112. package/lib/commands/menu/delete.js +1 -1
  113. package/lib/commands/menu/external-link-create.js +1 -1
  114. package/lib/commands/menu/external-link-update.js +1 -1
  115. package/lib/commands/menu/group-create.js +1 -1
  116. package/lib/commands/menu/group-update.js +1 -1
  117. package/lib/commands/menu/index.js +1 -1
  118. package/lib/commands/menu/list.js +1 -1
  119. package/lib/commands/menu/move.js +1 -1
  120. package/lib/commands/menu/regroup-start.js +1 -1
  121. package/lib/commands/menu/rename.js +1 -1
  122. package/lib/commands/menu/shared/compare-table.js +1 -1
  123. package/lib/commands/menu/shared/delete-plan.js +1 -1
  124. package/lib/commands/menu/shared/facts.js +1 -1
  125. package/lib/commands/menu/shared/index.js +1 -1
  126. package/lib/commands/menu/shared/inquirer.js +1 -1
  127. package/lib/commands/menu/shared/local-pages.js +1 -1
  128. package/lib/commands/menu/shared/logic.js +1 -1
  129. package/lib/commands/menu/shared/mutations.d.ts +8 -7
  130. package/lib/commands/menu/shared/mutations.js +1 -1
  131. package/lib/commands/menu/shared/service.js +1 -1
  132. package/lib/commands/menu/shared/sync-core.js +1 -1
  133. package/lib/commands/menu/shared/types.d.ts +17 -2
  134. package/lib/commands/menu/shared/update-core.js +1 -1
  135. package/lib/commands/menu/shared/valid-url.js +1 -1
  136. package/lib/commands/menu/sync.js +1 -1
  137. package/lib/commands/menu/visibility-update.d.ts +2 -0
  138. package/lib/commands/menu/visibility-update.js +1 -0
  139. package/lib/commands/notification/config-create.js +1 -1
  140. package/lib/commands/notification/config-delete.js +1 -1
  141. package/lib/commands/notification/config-list.js +1 -1
  142. package/lib/commands/notification/config-update.js +1 -1
  143. package/lib/commands/notification/index.js +1 -1
  144. package/lib/commands/notification/shared.js +1 -1
  145. package/lib/commands/ocr/index.js +1 -1
  146. package/lib/commands/page/create.js +1 -1
  147. package/lib/commands/page/custom/detail.js +1 -1
  148. package/lib/commands/page/custom/list.js +1 -1
  149. package/lib/commands/page/custom/publish.js +1 -1
  150. package/lib/commands/page/custom/shared.js +1 -1
  151. package/lib/commands/page/custom/syntax.js +1 -1
  152. package/lib/commands/page/custom/template.js +1 -1
  153. package/lib/commands/page/custom/update.js +1 -1
  154. package/lib/commands/page/data-list-status.js +1 -1
  155. package/lib/commands/page/generate-start.js +1 -1
  156. package/lib/commands/page/generate-status.js +1 -1
  157. package/lib/commands/page/index.js +1 -1
  158. package/lib/commands/page/pull.js +1 -1
  159. package/lib/commands/page/push.js +1 -1
  160. package/lib/commands/page/relation-audit.js +1 -1
  161. package/lib/commands/page/restore.js +1 -1
  162. package/lib/commands/page/shared.js +1 -1
  163. package/lib/commands/page/sync.js +1 -1
  164. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  165. package/lib/commands/project/create/format-elapsed.js +1 -1
  166. package/lib/commands/project/create/main.js +1 -1
  167. package/lib/commands/project/create/materialize-project-template.js +1 -1
  168. package/lib/commands/project/create/project-name.js +1 -1
  169. package/lib/commands/project/create/project-template-archive.js +1 -1
  170. package/lib/commands/project/create/project-template-path.js +1 -1
  171. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  172. package/lib/commands/project/create/use-format-code.js +1 -1
  173. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  174. package/lib/commands/project/index.js +1 -1
  175. package/lib/commands/project/upgrade.js +1 -1
  176. package/lib/commands/registry.js +1 -1
  177. package/lib/commands/role/delete.js +1 -1
  178. package/lib/commands/role/detail.js +1 -1
  179. package/lib/commands/role/index.js +1 -1
  180. package/lib/commands/role/list.js +1 -1
  181. package/lib/commands/role/shared.js +1 -1
  182. package/lib/commands/role/update.js +1 -1
  183. package/lib/commands/role/user-add.js +1 -1
  184. package/lib/commands/role/user-remove.js +1 -1
  185. package/lib/commands/role/user-resolve.js +1 -1
  186. package/lib/commands/run/index.js +1 -1
  187. package/lib/commands/schema.js +1 -1
  188. package/lib/commands/sql/create.js +1 -1
  189. package/lib/commands/sql/delete.js +1 -1
  190. package/lib/commands/sql/detail.js +1 -1
  191. package/lib/commands/sql/exec.js +1 -1
  192. package/lib/commands/sql/index.js +1 -1
  193. package/lib/commands/sql/list.js +1 -1
  194. package/lib/commands/sql/pull.js +1 -1
  195. package/lib/commands/sql/push.js +1 -1
  196. package/lib/commands/sql/shared.js +1 -1
  197. package/lib/commands/sql/status.js +1 -1
  198. package/lib/commands/sql/validate.js +1 -1
  199. package/lib/commands/task/index.js +1 -1
  200. package/lib/commands/task/status.js +1 -1
  201. package/lib/commands/tenant/index.js +1 -1
  202. package/lib/commands/tenant/members-list.js +1 -1
  203. package/lib/commands/tenant/shared.js +1 -1
  204. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  205. package/lib/commands/user-account/index.js +1 -1
  206. package/lib/commands/workspace/add.js +1 -1
  207. package/lib/commands/workspace/index.js +1 -1
  208. package/lib/commands/workspace/remove.js +1 -1
  209. package/lib/config/schema.js +1 -1
  210. package/lib/constant/cdn.js +1 -1
  211. package/lib/constant/cli.js +1 -1
  212. package/lib/constant/defaults.js +1 -1
  213. package/lib/constant/domain.js +1 -1
  214. package/lib/constant/env.js +1 -1
  215. package/lib/constant/output.js +1 -1
  216. package/lib/constant/paths.js +1 -1
  217. package/lib/constant/risk.js +1 -1
  218. package/lib/context/app-resolver.js +1 -1
  219. package/lib/context/auth-resolver.js +1 -1
  220. package/lib/context/config-loader.js +1 -1
  221. package/lib/context.js +1 -1
  222. package/lib/core/alias-resolver.js +1 -1
  223. package/lib/core/api-client.js +1 -1
  224. package/lib/core/bff/config.js +1 -1
  225. package/lib/core/bff/file-system.js +1 -1
  226. package/lib/core/bff/hash.js +1 -1
  227. package/lib/core/bff/lock.js +1 -1
  228. package/lib/core/bff/utils.js +1 -1
  229. package/lib/core/db-resolver.js +1 -1
  230. package/lib/core/page/file-system.js +1 -1
  231. package/lib/core/page/hash.js +1 -1
  232. package/lib/core/page/lock.js +1 -1
  233. package/lib/core/sql-index-auditor.js +1 -1
  234. package/lib/core/sql-sync/config.js +1 -1
  235. package/lib/core/sql-sync/file-system.js +1 -1
  236. package/lib/core/sql-sync/hash.js +1 -1
  237. package/lib/core/sql-sync/lock.js +1 -1
  238. package/lib/core/sql-sync/utils.js +1 -1
  239. package/lib/core/sql-validator.js +1 -1
  240. package/lib/errors.js +1 -1
  241. package/lib/framework/build-all-flags.js +1 -1
  242. package/lib/framework/error-output.js +1 -1
  243. package/lib/framework/explicit-yes.js +1 -1
  244. package/lib/framework/flags.js +1 -1
  245. package/lib/framework/help.js +1 -1
  246. package/lib/framework/index.js +1 -1
  247. package/lib/framework/output.js +1 -1
  248. package/lib/framework/response.js +1 -1
  249. package/lib/framework/runner-alias.js +1 -1
  250. package/lib/framework/runner.js +1 -1
  251. package/lib/framework/schema-export.js +1 -1
  252. package/lib/framework/types.js +1 -1
  253. package/lib/generated/build-info.d.ts +4 -4
  254. package/lib/generated/build-info.js +1 -1
  255. package/lib/help.js +1 -1
  256. package/lib/postinstall.js +1 -1
  257. package/lib/runtime/confirmation.js +1 -1
  258. package/lib/runtime/event.js +1 -1
  259. package/lib/runtime/index.js +1 -1
  260. package/lib/runtime/queue.js +1 -1
  261. package/lib/runtime/resolve.js +1 -1
  262. package/lib/skills/builtin-skill.js +1 -1
  263. package/lib/skills/main.js +1 -1
  264. package/lib/skills/npx-skills-add.js +1 -1
  265. package/lib/skills/skill-presence.js +1 -1
  266. package/lib/telemetry/cli-command-trace.js +1 -1
  267. package/lib/telemetry/cli-help-trace.js +1 -1
  268. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  269. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  270. package/lib/telemetry/send-cli-trace-log.js +1 -1
  271. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  272. package/lib/utils/ai_config.js +1 -1
  273. package/lib/utils/apply-jq-filter.js +1 -1
  274. package/lib/utils/cdn-config.js +1 -1
  275. package/lib/utils/check-sdk-version.js +1 -1
  276. package/lib/utils/cli-version-check.js +1 -1
  277. package/lib/utils/cli-version-policy.js +1 -1
  278. package/lib/utils/config.js +1 -1
  279. package/lib/utils/entity-with-id.js +1 -1
  280. package/lib/utils/file-utils.js +1 -1
  281. package/lib/utils/guides-cdn.js +1 -1
  282. package/lib/utils/http-client.js +1 -1
  283. package/lib/utils/is-non-interactive.js +1 -1
  284. package/lib/utils/logger.js +1 -1
  285. package/lib/utils/params.js +1 -1
  286. package/lib/utils/platform.js +1 -1
  287. package/lib/utils/rules-cdn.js +1 -1
  288. package/lib/utils/sleep.js +1 -1
  289. package/lib/utils/template-replacer.js +1 -1
  290. package/lib/utils/update-notice.js +1 -1
  291. package/lib/utils/version.js +1 -1
  292. package/lib/utils/with-active-cookie.js +1 -1
  293. package/lib/utils/write-cli-side-channel.js +1 -1
  294. package/package.json +1 -1
  295. package/skills/rabetbase/SKILL.md +4 -3
  296. package/skills/rabetbase/references/rabetbase-menu-list.md +3 -1
  297. package/skills/rabetbase/references/rabetbase-menu-visibility-update.md +59 -0
  298. package/skills/rabetbase/references/rabetbase-ocr.md +17 -2
  299. package/skills/rabetbase.manifest.json +4 -3
@@ -1 +1 @@
1
- const a177_0x4ca525=a177_0x19e2;(function(_0x3da623,_0x7427ac){const _0x2da704=a177_0x19e2,_0x506140=_0x3da623();while(!![]){try{const _0x2251a2=parseInt(_0x2da704(0x1c8))/0x1+-parseInt(_0x2da704(0x19b))/0x2+parseInt(_0x2da704(0x1de))/0x3*(parseInt(_0x2da704(0x1d6))/0x4)+-parseInt(_0x2da704(0x1bf))/0x5*(parseInt(_0x2da704(0x1d0))/0x6)+-parseInt(_0x2da704(0x1ba))/0x7*(-parseInt(_0x2da704(0x1ad))/0x8)+-parseInt(_0x2da704(0x1ce))/0x9*(-parseInt(_0x2da704(0x1b0))/0xa)+-parseInt(_0x2da704(0x19f))/0xb;if(_0x2251a2===_0x7427ac)break;else _0x506140['push'](_0x506140['shift']());}catch(_0x4897d9){_0x506140['push'](_0x506140['shift']());}}}(a177_0x24f1,0x1fa04));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':'number','required':!![],'description':a177_0x4ca525(0x19d)};export const ROLE_REF_FLAG={'name':'role','type':a177_0x4ca525(0x1a9),'required':!![],'description':'Role\x20id\x20or\x20exact\x20role\x20name'};export const USER_REF_FLAG={'name':'user','type':a177_0x4ca525(0x1a9),'required':!![],'description':a177_0x4ca525(0x192)};export const NAME_FLAG={'name':a177_0x4ca525(0x1c6),'type':a177_0x4ca525(0x1a9),'required':!![],'description':a177_0x4ca525(0x1bb)};export const USER_NAME_FLAG={'name':a177_0x4ca525(0x1c6),'type':a177_0x4ca525(0x1a9),'required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':a177_0x4ca525(0x19c),'type':'string','required':![],'description':a177_0x4ca525(0x1b6)};export const EXPECT_USER_COUNT_FLAG={'name':a177_0x4ca525(0x1a8),'type':a177_0x4ca525(0x1d2),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=[a177_0x4ca525(0x1b3),a177_0x4ca525(0x1af),a177_0x4ca525(0x1b9)];export function isBuiltinRole(_0x27911b){return BUILTIN_ROLE_TYPES['includes'](_0x27911b);}function a177_0x19e2(_0x194a61,_0x492bf0){_0x194a61=_0x194a61-0x191;const _0x24f131=a177_0x24f1();let _0x19e21a=_0x24f131[_0x194a61];return _0x19e21a;}function a177_0x24f1(){const _0x401d19=['nickname','name','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','118116DVBVbN','dryRun','CUSTOM','trim','permitCount','join','540747gDTOqU','validation','138eVJDfE','toLowerCase','number','\x20is\x20already\x20a\x20member\x20of\x20role\x20','\x20duplicate\x20memberships\x20for\x20user\x20','str','4BfsnPs','roleType','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','expectUserCount','roleName','filter','user','Cannot\x20','744993XIMdkK','test','\x20members\x20of\x20the\x20OWNER\x20role.','length','Anti-drift\x20check\x20failed:\x20expected\x20','appCode','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','userId','dev','Pass\x20--user\x20<id|name>.','tenant_code','map','userCount','flagMissing','\x20member(s)\x20but\x20role\x20has\x20','293210stgYFG','remark','Role\x20id\x20(from\x20`role\x20list`)','\x22\x20is\x20ambiguous\x20(ids:\x20','2670646dLKJWM','Pass\x20--role\x20<id|name>.','Removed\x20','Missing\x20user\x20reference.','/smartapi/permit/user-role/delete','\x20is\x20not\x20a\x20member\x20of\x20role\x20','Role\x20name\x20\x22','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','find','expect-user-count','string','tenant','push','\x22:\x20','8eDZXlP','role','DEV','10JPzFFU','User\x20','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','ADMIN','username',';\x20no\x20change.','Optional\x20role\x20remark/description','authRequired','\x22\x20not\x20found\x20in\x20app\x20','OWNER','1720194vOsTkm','Role\x20name','Disambiguate\x20with\x20--role\x20<id>.','Multiple\x20tenant\x20members\x20match\x20\x22','POST','33335KcgThH','totalCount','Role\x20id\x20','\x20built-in\x20role\x20','user-add','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.'];a177_0x24f1=function(){return _0x401d19;};return a177_0x24f1();}export function assertCustomRole(_0x5c5acb,_0x3304ad){const _0x812cb1=a177_0x4ca525;if(_0x5c5acb[_0x812cb1(0x1d7)]!==_0x812cb1(0x1ca))throw CliErrors[_0x812cb1(0x1cf)](_0x812cb1(0x1dd)+_0x3304ad+_0x812cb1(0x1c2)+_0x5c5acb[_0x812cb1(0x1da)]+'\x20('+_0x5c5acb[_0x812cb1(0x1d7)]+').',_0x812cb1(0x1c7));}export function projectRole(_0x25d82d){const _0x1050b1=a177_0x4ca525;return{'id':_0x25d82d['id'],'roleName':_0x25d82d[_0x1050b1(0x1da)],'roleType':_0x25d82d['roleType'],'remark':_0x25d82d[_0x1050b1(0x19c)],'userCount':_0x25d82d[_0x1050b1(0x198)],'permitCount':_0x25d82d[_0x1050b1(0x1cc)],'builtin':isBuiltinRole(_0x25d82d['roleType'])};}export async function resolveRoleRef(_0x309bf4,_0x235881){const _0x513f63=a177_0x4ca525,_0x5042a0=_0x235881[_0x513f63(0x1cb)]();if(!_0x5042a0)throw CliErrors['validation']('Missing\x20role\x20reference.','Pass\x20--role\x20<id|name>.');if(/^\d+$/['test'](_0x5042a0))return getRoleById(_0x309bf4,Number(_0x5042a0));const _0x38bf97=await listAllAppRoles(_0x309bf4),_0x50fee2=_0x38bf97['filter'](_0x193e9e=>_0x193e9e[_0x513f63(0x1da)]===_0x5042a0);if(_0x50fee2[_0x513f63(0x1e1)]===0x0)throw CliErrors[_0x513f63(0x1cf)](_0x513f63(0x1a5)+_0x5042a0+_0x513f63(0x1b8)+_0x309bf4+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.');if(_0x50fee2['length']>0x1){const _0x592e10=_0x50fee2['map'](_0x4fa9b5=>_0x4fa9b5['id'])[_0x513f63(0x1cd)](',\x20');throw CliErrors[_0x513f63(0x1cf)](_0x513f63(0x1a5)+_0x5042a0+_0x513f63(0x19e)+_0x592e10+').',_0x513f63(0x1bc));}return _0x50fee2[0x0];}export async function getRoleById(_0x810604,_0x5e7485){const _0x10f0ff=a177_0x4ca525,_0x47c593=await listAllAppRoles(_0x810604),_0x5bb85e=_0x47c593[_0x10f0ff(0x1db)](_0x131416=>_0x131416['id']===_0x5e7485&&(!_0x131416[_0x10f0ff(0x191)]||_0x131416['appCode']===_0x810604));if(_0x5bb85e[_0x10f0ff(0x1e1)]!==0x1)throw CliErrors[_0x10f0ff(0x1cf)](_0x10f0ff(0x1c1)+_0x5e7485+'\x20not\x20found\x20in\x20app\x20'+_0x810604+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');return _0x5bb85e[0x0];}async function listAllAppRoles(_0x4ef4c0){const _0x1e32ad=a177_0x4ca525,_0x4fa0f0=0x64,_0x53c352=[];for(let _0x5b6105=0x1;;_0x5b6105+=0x1){const {items:_0x407a0e,paging:_0x3a18aa}=await listAppRoles(_0x4ef4c0,{'currentPage':_0x5b6105,'pageSize':_0x4fa0f0});_0x53c352[_0x1e32ad(0x1ab)](..._0x407a0e);if(_0x407a0e[_0x1e32ad(0x1e1)]<_0x4fa0f0||_0x3a18aa&&_0x53c352[_0x1e32ad(0x1e1)]>=_0x3a18aa[_0x1e32ad(0x1c0)])return _0x53c352;}}export async function resolveTenantCode(){const _0x4780cc=a177_0x4ca525,_0x50383f=await getSessionUserInfo(),_0x1adf82=_0x50383f?.[_0x4780cc(0x1dc)]?.[_0x4780cc(0x1aa)]?.[_0x4780cc(0x196)];if(!_0x1adf82)throw CliErrors[_0x4780cc(0x1b7)](_0x4780cc(0x1a6));return _0x1adf82;}function matchMember(_0xfba2d6,_0x4160b4){const _0x15d7f4=a177_0x4ca525,_0x30b66b=_0x4160b4[_0x15d7f4(0x1cb)]()[_0x15d7f4(0x1d1)]();return(_0xfba2d6[_0x15d7f4(0x1c5)]??'')[_0x15d7f4(0x1d1)]()===_0x30b66b||(_0xfba2d6[_0x15d7f4(0x1b4)]??'')['toLowerCase']()===_0x30b66b;}export async function resolveUserRef(_0x279614){const _0x1a73e0=a177_0x4ca525,_0x3ee81a=_0x279614[_0x1a73e0(0x1cb)]();if(!_0x3ee81a)throw CliErrors['validation'](_0x1a73e0(0x1a2),_0x1a73e0(0x195));const _0x257856=await resolveTenantCode(),_0x1bf2fc=await getTenantMembers(_0x257856);if(/^\d+$/[_0x1a73e0(0x1df)](_0x3ee81a)){const _0x33af38=Number(_0x3ee81a),_0x2e1d78=_0x1bf2fc[_0x1a73e0(0x1a7)](_0x2903e6=>_0x2903e6[_0x1a73e0(0x193)]===_0x33af38);return{'userId':_0x33af38,'username':_0x2e1d78?.[_0x1a73e0(0x1b4)]??String(_0x33af38),'nickname':_0x2e1d78?.[_0x1a73e0(0x1c5)],'matchedBy':'id'};}const _0xd327f1=_0x1bf2fc[_0x1a73e0(0x1db)](_0x1f7dbf=>matchMember(_0x1f7dbf,_0x3ee81a));if(_0xd327f1[_0x1a73e0(0x1e1)]===0x0)throw CliErrors[_0x1a73e0(0x1cf)]('No\x20tenant\x20member\x20matches\x20\x22'+_0x3ee81a+'\x22.',_0x1a73e0(0x1c4));if(_0xd327f1[_0x1a73e0(0x1e1)]>0x1){const _0x25981d=_0xd327f1[_0x1a73e0(0x197)](_0x51461a=>(_0x51461a[_0x1a73e0(0x1c5)]??_0x51461a[_0x1a73e0(0x1b4)]??'?')+'('+_0x51461a[_0x1a73e0(0x193)]+')')['join'](',\x20');throw CliErrors[_0x1a73e0(0x1cf)](_0x1a73e0(0x1bd)+_0x3ee81a+_0x1a73e0(0x1ac)+_0x25981d+'.','Disambiguate\x20with\x20--user\x20<id>.');}const _0x52904f=_0xd327f1[0x0];return{'userId':_0x52904f[_0x1a73e0(0x193)],'username':_0x52904f[_0x1a73e0(0x1b4)]??String(_0x52904f[_0x1a73e0(0x193)]),'nickname':_0x52904f[_0x1a73e0(0x1c5)],'matchedBy':_0x1a73e0(0x1c6)};}export const CREATE_USER_ROLE_PATH='/smartapi/permit/user-role/create';export const DELETE_USER_ROLE_PATH=a177_0x4ca525(0x1a3);export function computeRoleUserMutation(_0x53c450){const _0x4dc466=a177_0x4ca525,{operation:_0x3274eb,appCode:_0x34a493,role:_0x12bb72,relations:_0x5e3efd,user:_0x303450}=_0x53c450,_0x30b509=[...new Set(_0x5e3efd['map'](_0x50758b=>_0x50758b['userId']))],_0x305ceb=[];if(_0x53c450[_0x4dc466(0x1d9)]!==undefined&&_0x53c450[_0x4dc466(0x1d9)]!==_0x30b509['length'])throw CliErrors[_0x4dc466(0x1cf)](_0x4dc466(0x1e2)+_0x53c450['expectUserCount']+_0x4dc466(0x19a)+_0x30b509[_0x4dc466(0x1e1)]+'.',_0x4dc466(0x1d8));const _0x259d45=_0x30b509['includes'](_0x303450['userId']),_0x37bbb1=_0x5e3efd[_0x4dc466(0x1db)](_0xa594be=>_0xa594be['userId']===_0x303450[_0x4dc466(0x193)])[_0x4dc466(0x197)](_0x5dd6b6=>_0x5dd6b6['id']),_0x22caa0=_0x3274eb===_0x4dc466(0x1c3)?!_0x259d45:_0x259d45;let _0x20906c=_0x30b509;_0x3274eb===_0x4dc466(0x1c3)?_0x259d45?_0x305ceb[_0x4dc466(0x1ab)](_0x4dc466(0x1b1)+_0x303450['userId']+_0x4dc466(0x1d3)+_0x12bb72[_0x4dc466(0x1da)]+';\x20no\x20change.'):_0x20906c=[..._0x30b509,_0x303450[_0x4dc466(0x193)]]:!_0x259d45?_0x305ceb['push'](_0x4dc466(0x1b1)+_0x303450[_0x4dc466(0x193)]+_0x4dc466(0x1a4)+_0x12bb72[_0x4dc466(0x1da)]+_0x4dc466(0x1b5)):(_0x20906c=_0x30b509[_0x4dc466(0x1db)](_0x3f121b=>_0x3f121b!==_0x303450[_0x4dc466(0x193)]),_0x37bbb1[_0x4dc466(0x1e1)]>0x1&&_0x305ceb[_0x4dc466(0x1ab)](_0x4dc466(0x1a1)+_0x37bbb1[_0x4dc466(0x1e1)]+_0x4dc466(0x1d4)+_0x303450['userId']+'.'));const _0x231015={'scope':_0x4dc466(0x194),'operation':_0x3274eb,'selector':{'appCode':_0x34a493,'roleId':_0x12bb72['id'],'roleName':_0x12bb72[_0x4dc466(0x1da)],'userId':_0x303450[_0x4dc466(0x193)]},'before':{'userIds':_0x30b509},'after':{'userIds':_0x20906c},'dryRun':_0x53c450[_0x4dc466(0x1c9)],'backend':{'method':_0x4dc466(0x1be),'path':_0x3274eb===_0x4dc466(0x1c3)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x305ceb};return{'mutation':_0x231015,'changed':_0x22caa0,'matchingRelationIds':_0x37bbb1};}export async function loadDevRoleRelations(_0x2c5ce9,_0x3ec0c4){const _0x173b0e=a177_0x4ca525,_0x225a13=0x64,_0x52babe=[];for(let _0x1e8062=0x1;;_0x1e8062+=0x1){const {items:_0x4b1ce0,paging:_0x2b96cb}=await listDevUserRoleRelations(_0x2c5ce9,{'roleId':_0x3ec0c4,'currentPage':_0x1e8062,'pageSize':_0x225a13});_0x52babe['push'](..._0x4b1ce0);if(_0x4b1ce0[_0x173b0e(0x1e1)]<_0x225a13||_0x2b96cb&&_0x52babe[_0x173b0e(0x1e1)]>=_0x2b96cb[_0x173b0e(0x1c0)])return _0x52babe;}}export function readRoleRef(_0x196c72){const _0x325715=a177_0x4ca525,_0xd2958f=_0x196c72[_0x325715(0x1d5)]('role')[_0x325715(0x1cb)]();if(!_0xd2958f)throw CliErrors[_0x325715(0x199)](_0x325715(0x1ae),_0x325715(0x1a0));return _0xd2958f;}export async function prepareUserMutation(_0x49a9df,_0x4c7e12,_0x8d6196){const _0x371d7c=a177_0x4ca525,_0x1acade=readRoleRef(_0x49a9df),_0x345431=_0x49a9df['str'](_0x371d7c(0x1dc))[_0x371d7c(0x1cb)]();if(!_0x345431)throw CliErrors[_0x371d7c(0x199)]('user',_0x371d7c(0x195));const _0x24cd59=_0x49a9df['flag'](_0x371d7c(0x1a8)),_0x661a22=_0x24cd59===undefined||_0x24cd59===null?undefined:Number(_0x24cd59),_0x397c3a=await resolveRoleRef(_0x49a9df[_0x371d7c(0x191)],_0x1acade);if(_0x397c3a[_0x371d7c(0x1d7)]==='OWNER')throw CliErrors[_0x371d7c(0x1cf)]('Cannot\x20'+_0x4c7e12+_0x371d7c(0x1e0),_0x371d7c(0x1b2));const _0x594184=await resolveUserRef(_0x345431),_0x461701=await loadDevRoleRelations(_0x49a9df[_0x371d7c(0x191)],_0x397c3a['id']);return{...computeRoleUserMutation({'operation':_0x4c7e12,'appCode':_0x49a9df[_0x371d7c(0x191)],'role':_0x397c3a,'relations':_0x461701,'user':{'userId':_0x594184[_0x371d7c(0x193)],'username':_0x594184[_0x371d7c(0x1b4)],'nickname':_0x594184['nickname']},'dryRun':_0x8d6196,..._0x661a22!==undefined?{'expectUserCount':_0x661a22}:{}}),'role':_0x397c3a,'user':_0x594184};}
1
+ const a178_0x9b2ca2=a178_0xe39b;function a178_0xe39b(_0x905b64,_0x12099c){_0x905b64=_0x905b64-0x111;const _0x5047bf=a178_0x5047();let _0xe39b7=_0x5047bf[_0x905b64];return _0xe39b7;}(function(_0x3b764f,_0x49c45c){const _0x187aac=a178_0xe39b,_0x424c2f=_0x3b764f();while(!![]){try{const _0x10fe3d=-parseInt(_0x187aac(0x13a))/0x1+-parseInt(_0x187aac(0x128))/0x2*(-parseInt(_0x187aac(0x137))/0x3)+-parseInt(_0x187aac(0x134))/0x4+parseInt(_0x187aac(0x13b))/0x5*(-parseInt(_0x187aac(0x115))/0x6)+-parseInt(_0x187aac(0x11f))/0x7*(-parseInt(_0x187aac(0x163))/0x8)+-parseInt(_0x187aac(0x13d))/0x9+parseInt(_0x187aac(0x15d))/0xa*(parseInt(_0x187aac(0x15c))/0xb);if(_0x10fe3d===_0x49c45c)break;else _0x424c2f['push'](_0x424c2f['shift']());}catch(_0x1fc67d){_0x424c2f['push'](_0x424c2f['shift']());}}}(a178_0x5047,0xd04ad));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}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':a178_0x9b2ca2(0x154),'required':!![],'description':a178_0x9b2ca2(0x15f)};export const ROLE_REF_FLAG={'name':a178_0x9b2ca2(0x13f),'type':a178_0x9b2ca2(0x12f),'required':!![],'description':'Role\x20id\x20or\x20exact\x20role\x20name'};export const USER_REF_FLAG={'name':a178_0x9b2ca2(0x11c),'type':a178_0x9b2ca2(0x12f),'required':!![],'description':a178_0x9b2ca2(0x14a)};export const NAME_FLAG={'name':a178_0x9b2ca2(0x14f),'type':a178_0x9b2ca2(0x12f),'required':!![],'description':a178_0x9b2ca2(0x129)};export const USER_NAME_FLAG={'name':a178_0x9b2ca2(0x14f),'type':a178_0x9b2ca2(0x12f),'required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':a178_0x9b2ca2(0x121),'type':'string','required':![],'description':a178_0x9b2ca2(0x125)};export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a178_0x9b2ca2(0x154),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=[a178_0x9b2ca2(0x156),a178_0x9b2ca2(0x118),a178_0x9b2ca2(0x143)];export function isBuiltinRole(_0x5de1c8){const _0x140e93=a178_0x9b2ca2;return BUILTIN_ROLE_TYPES[_0x140e93(0x117)](_0x5de1c8);}export function assertCustomRole(_0x10c732,_0x576543){const _0x134928=a178_0x9b2ca2;if(_0x10c732[_0x134928(0x149)]!==_0x134928(0x12b))throw CliErrors[_0x134928(0x144)](_0x134928(0x126)+_0x576543+_0x134928(0x152)+_0x10c732[_0x134928(0x147)]+'\x20('+_0x10c732['roleType']+').','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.');}export function projectRole(_0x4aebbf){const _0x4edd7a=a178_0x9b2ca2;return{'id':_0x4aebbf['id'],'roleName':_0x4aebbf[_0x4edd7a(0x147)],'roleType':_0x4aebbf[_0x4edd7a(0x149)],'remark':_0x4aebbf[_0x4edd7a(0x121)],'userCount':_0x4aebbf[_0x4edd7a(0x136)],'permitCount':_0x4aebbf[_0x4edd7a(0x114)],'builtin':isBuiltinRole(_0x4aebbf[_0x4edd7a(0x149)])};}export async function resolveRoleRef(_0x53a99e,_0x4f5fc2){const _0x1ec9f1=a178_0x9b2ca2,_0x3ab3a1=_0x4f5fc2[_0x1ec9f1(0x111)]();if(!_0x3ab3a1)throw CliErrors['validation'](_0x1ec9f1(0x120),_0x1ec9f1(0x160));if(/^\d+$/[_0x1ec9f1(0x127)](_0x3ab3a1))return getRoleById(_0x53a99e,Number(_0x3ab3a1));const _0x134023=await listAllAppRoles(_0x53a99e),_0x399c1d=_0x134023[_0x1ec9f1(0x112)](_0x4dc377=>_0x4dc377[_0x1ec9f1(0x147)]===_0x3ab3a1);if(_0x399c1d[_0x1ec9f1(0x132)]===0x0)throw CliErrors[_0x1ec9f1(0x144)]('Role\x20name\x20\x22'+_0x3ab3a1+_0x1ec9f1(0x131)+_0x53a99e+'.',_0x1ec9f1(0x146));if(_0x399c1d[_0x1ec9f1(0x132)]>0x1){const _0x511cf3=_0x399c1d[_0x1ec9f1(0x11a)](_0x33ed50=>_0x33ed50['id'])[_0x1ec9f1(0x116)](',\x20');throw CliErrors[_0x1ec9f1(0x144)](_0x1ec9f1(0x14d)+_0x3ab3a1+_0x1ec9f1(0x12a)+_0x511cf3+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x399c1d[0x0];}export async function getRoleById(_0x430004,_0x5ba81c){const _0x127b06=a178_0x9b2ca2,_0xcf4353=await listAllAppRoles(_0x430004),_0x7f7e1e=_0xcf4353[_0x127b06(0x112)](_0x52a2ba=>_0x52a2ba['id']===_0x5ba81c&&(!_0x52a2ba['appCode']||_0x52a2ba[_0x127b06(0x158)]===_0x430004));if(_0x7f7e1e['length']!==0x1)throw CliErrors[_0x127b06(0x144)](_0x127b06(0x12c)+_0x5ba81c+_0x127b06(0x153)+_0x430004+'.',_0x127b06(0x150));return _0x7f7e1e[0x0];}function a178_0x5047(){const _0x10c907=['1602354whfUAL','9050vuwRId','User\x20','8886681tHDAjq','Pass\x20--user\x20<id|name>.','role','Multiple\x20tenant\x20members\x20match\x20\x22','username','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','OWNER','validation','\x20member(s)\x20but\x20role\x20has\x20','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','roleName','push','roleType','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','userId','POST','Role\x20name\x20\x22','dev','name','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','/smartapi/permit/user-role/delete','\x20built-in\x20role\x20','\x20not\x20found\x20in\x20app\x20','number','totalCount','ADMIN','\x20duplicate\x20memberships\x20for\x20user\x20','appCode','No\x20tenant\x20member\x20matches\x20\x22','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','user-add','792gimuMR','237730xlzuzr','find','Role\x20id\x20(from\x20`role\x20list`)','Pass\x20--role\x20<id|name>.','expectUserCount','toLowerCase','609272XnSsAx','trim','filter','Removed\x20','permitCount','3336njgLti','join','includes','DEV','str','map','tenant_code','user','nickname','Missing\x20user\x20reference.','154CTZJdw','Missing\x20role\x20reference.','remark','\x20is\x20already\x20a\x20member\x20of\x20role\x20','dryRun','/smartapi/permit/user-role/create','Optional\x20role\x20remark/description','Cannot\x20','test','6ljdEMa','Role\x20name','\x22\x20is\x20ambiguous\x20(ids:\x20','CUSTOM','Role\x20id\x20','\x20members\x20of\x20the\x20OWNER\x20role.','\x22:\x20','string','Disambiguate\x20with\x20--user\x20<id>.','\x22\x20not\x20found\x20in\x20app\x20','length','flag','358900aTqzcd','expect-user-count','userCount','1151859ZxXOqF','tenant',';\x20no\x20change.'];a178_0x5047=function(){return _0x10c907;};return a178_0x5047();}async function listAllAppRoles(_0x4f01eb){const _0x18b4c5=a178_0x9b2ca2,_0x1525bf=0x64,_0x589a0f=[];for(let _0x51783e=0x1;;_0x51783e+=0x1){const {items:_0x22c799,paging:_0x215c0f}=await listAppRoles(_0x4f01eb,{'currentPage':_0x51783e,'pageSize':_0x1525bf});_0x589a0f['push'](..._0x22c799);if(_0x22c799[_0x18b4c5(0x132)]<_0x1525bf||_0x215c0f&&_0x589a0f[_0x18b4c5(0x132)]>=_0x215c0f['totalCount'])return _0x589a0f;}}export async function resolveTenantCode(){const _0xef58e1=a178_0x9b2ca2,_0x26ea38=await getSessionUserInfo(),_0x5cb93d=_0x26ea38?.['user']?.[_0xef58e1(0x138)]?.[_0xef58e1(0x11b)];if(!_0x5cb93d)throw CliErrors['authRequired'](_0xef58e1(0x142));return _0x5cb93d;}function matchMember(_0xdb5a60,_0x309ce2){const _0x56b703=a178_0x9b2ca2,_0x46a05a=_0x309ce2[_0x56b703(0x111)]()[_0x56b703(0x162)]();return(_0xdb5a60['nickname']??'')['toLowerCase']()===_0x46a05a||(_0xdb5a60[_0x56b703(0x141)]??'')['toLowerCase']()===_0x46a05a;}export async function resolveUserRef(_0x9a8fd4){const _0x3de883=a178_0x9b2ca2,_0x358e80=_0x9a8fd4[_0x3de883(0x111)]();if(!_0x358e80)throw CliErrors[_0x3de883(0x144)](_0x3de883(0x11e),_0x3de883(0x13e));const _0x567996=await resolveTenantCode(),_0x15da20=await getTenantMembers(_0x567996);if(/^\d+$/[_0x3de883(0x127)](_0x358e80)){const _0x34970e=Number(_0x358e80),_0x2a1293=_0x15da20[_0x3de883(0x15e)](_0x48ffa7=>_0x48ffa7[_0x3de883(0x14b)]===_0x34970e);return{'userId':_0x34970e,'username':_0x2a1293?.['username']??String(_0x34970e),'nickname':_0x2a1293?.[_0x3de883(0x11d)],'matchedBy':'id'};}const _0x4bbcc6=_0x15da20['filter'](_0x33dcd9=>matchMember(_0x33dcd9,_0x358e80));if(_0x4bbcc6[_0x3de883(0x132)]===0x0)throw CliErrors[_0x3de883(0x144)](_0x3de883(0x159)+_0x358e80+'\x22.','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.');if(_0x4bbcc6[_0x3de883(0x132)]>0x1){const _0x583821=_0x4bbcc6['map'](_0x557a8d=>(_0x557a8d['nickname']??_0x557a8d[_0x3de883(0x141)]??'?')+'('+_0x557a8d[_0x3de883(0x14b)]+')')[_0x3de883(0x116)](',\x20');throw CliErrors[_0x3de883(0x144)](_0x3de883(0x140)+_0x358e80+_0x3de883(0x12e)+_0x583821+'.',_0x3de883(0x130));}const _0x43bbfd=_0x4bbcc6[0x0];return{'userId':_0x43bbfd[_0x3de883(0x14b)],'username':_0x43bbfd[_0x3de883(0x141)]??String(_0x43bbfd['userId']),'nickname':_0x43bbfd[_0x3de883(0x11d)],'matchedBy':_0x3de883(0x14f)};}export const CREATE_USER_ROLE_PATH=a178_0x9b2ca2(0x124);export const DELETE_USER_ROLE_PATH=a178_0x9b2ca2(0x151);export function computeRoleUserMutation(_0x33d3d5){const _0x3c43ed=a178_0x9b2ca2,{operation:_0x333536,appCode:_0x21f41,role:_0x351ac8,relations:_0x2975bd,user:_0x5018aa}=_0x33d3d5,_0x4a002a=[...new Set(_0x2975bd[_0x3c43ed(0x11a)](_0x406569=>_0x406569[_0x3c43ed(0x14b)]))],_0x1032af=[];if(_0x33d3d5[_0x3c43ed(0x161)]!==undefined&&_0x33d3d5['expectUserCount']!==_0x4a002a[_0x3c43ed(0x132)])throw CliErrors[_0x3c43ed(0x144)]('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x33d3d5[_0x3c43ed(0x161)]+_0x3c43ed(0x145)+_0x4a002a['length']+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x1aa990=_0x4a002a[_0x3c43ed(0x117)](_0x5018aa[_0x3c43ed(0x14b)]),_0x20378c=_0x2975bd[_0x3c43ed(0x112)](_0x116e7e=>_0x116e7e[_0x3c43ed(0x14b)]===_0x5018aa['userId'])[_0x3c43ed(0x11a)](_0x168c20=>_0x168c20['id']),_0x5be613=_0x333536===_0x3c43ed(0x15b)?!_0x1aa990:_0x1aa990;let _0x41dca8=_0x4a002a;_0x333536===_0x3c43ed(0x15b)?_0x1aa990?_0x1032af[_0x3c43ed(0x148)](_0x3c43ed(0x13c)+_0x5018aa[_0x3c43ed(0x14b)]+_0x3c43ed(0x122)+_0x351ac8[_0x3c43ed(0x147)]+_0x3c43ed(0x139)):_0x41dca8=[..._0x4a002a,_0x5018aa[_0x3c43ed(0x14b)]]:!_0x1aa990?_0x1032af['push'](_0x3c43ed(0x13c)+_0x5018aa[_0x3c43ed(0x14b)]+'\x20is\x20not\x20a\x20member\x20of\x20role\x20'+_0x351ac8[_0x3c43ed(0x147)]+_0x3c43ed(0x139)):(_0x41dca8=_0x4a002a[_0x3c43ed(0x112)](_0x384567=>_0x384567!==_0x5018aa[_0x3c43ed(0x14b)]),_0x20378c[_0x3c43ed(0x132)]>0x1&&_0x1032af['push'](_0x3c43ed(0x113)+_0x20378c['length']+_0x3c43ed(0x157)+_0x5018aa[_0x3c43ed(0x14b)]+'.'));const _0x9aa11b={'scope':_0x3c43ed(0x14e),'operation':_0x333536,'selector':{'appCode':_0x21f41,'roleId':_0x351ac8['id'],'roleName':_0x351ac8['roleName'],'userId':_0x5018aa[_0x3c43ed(0x14b)]},'before':{'userIds':_0x4a002a},'after':{'userIds':_0x41dca8},'dryRun':_0x33d3d5[_0x3c43ed(0x123)],'backend':{'method':_0x3c43ed(0x14c),'path':_0x333536===_0x3c43ed(0x15b)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x1032af};return{'mutation':_0x9aa11b,'changed':_0x5be613,'matchingRelationIds':_0x20378c};}export async function loadDevRoleRelations(_0x497ff9,_0x5a7509){const _0x2c2281=a178_0x9b2ca2,_0x429206=0x64,_0x488bc2=[];for(let _0x470ab6=0x1;;_0x470ab6+=0x1){const {items:_0x1b2bc8,paging:_0x3f1b19}=await listDevUserRoleRelations(_0x497ff9,{'roleId':_0x5a7509,'currentPage':_0x470ab6,'pageSize':_0x429206});_0x488bc2[_0x2c2281(0x148)](..._0x1b2bc8);if(_0x1b2bc8['length']<_0x429206||_0x3f1b19&&_0x488bc2['length']>=_0x3f1b19[_0x2c2281(0x155)])return _0x488bc2;}}export function readRoleRef(_0x506c30){const _0x29ea6b=a178_0x9b2ca2,_0x2941d3=_0x506c30[_0x29ea6b(0x119)]('role')['trim']();if(!_0x2941d3)throw CliErrors['flagMissing'](_0x29ea6b(0x13f),_0x29ea6b(0x160));return _0x2941d3;}export async function prepareUserMutation(_0x1ffd2b,_0x4b37dc,_0x79ecca){const _0xebb7dc=a178_0x9b2ca2,_0x4440d5=readRoleRef(_0x1ffd2b),_0x87381b=_0x1ffd2b[_0xebb7dc(0x119)](_0xebb7dc(0x11c))[_0xebb7dc(0x111)]();if(!_0x87381b)throw CliErrors['flagMissing'](_0xebb7dc(0x11c),_0xebb7dc(0x13e));const _0x1fe030=_0x1ffd2b[_0xebb7dc(0x133)](_0xebb7dc(0x135)),_0x3fb1ac=_0x1fe030===undefined||_0x1fe030===null?undefined:Number(_0x1fe030),_0x59f132=await resolveRoleRef(_0x1ffd2b['appCode'],_0x4440d5);if(_0x59f132[_0xebb7dc(0x149)]===_0xebb7dc(0x143))throw CliErrors[_0xebb7dc(0x144)]('Cannot\x20'+_0x4b37dc+_0xebb7dc(0x12d),_0xebb7dc(0x15a));const _0xf81708=await resolveUserRef(_0x87381b),_0x50eb11=await loadDevRoleRelations(_0x1ffd2b[_0xebb7dc(0x158)],_0x59f132['id']);return{...computeRoleUserMutation({'operation':_0x4b37dc,'appCode':_0x1ffd2b['appCode'],'role':_0x59f132,'relations':_0x50eb11,'user':{'userId':_0xf81708[_0xebb7dc(0x14b)],'username':_0xf81708['username'],'nickname':_0xf81708[_0xebb7dc(0x11d)]},'dryRun':_0x79ecca,..._0x3fb1ac!==undefined?{'expectUserCount':_0x3fb1ac}:{}}),'role':_0x59f132,'user':_0xf81708};}
@@ -1 +1 @@
1
- const a178_0x4646a1=a178_0x375e;(function(_0x1788a7,_0x33aed4){const _0xcc0e0d=a178_0x375e,_0x3802aa=_0x1788a7();while(!![]){try{const _0x184a9b=-parseInt(_0xcc0e0d(0xe3))/0x1+-parseInt(_0xcc0e0d(0xd8))/0x2*(-parseInt(_0xcc0e0d(0xdc))/0x3)+-parseInt(_0xcc0e0d(0xe5))/0x4+-parseInt(_0xcc0e0d(0xdf))/0x5*(-parseInt(_0xcc0e0d(0xdd))/0x6)+parseInt(_0xcc0e0d(0xdb))/0x7+parseInt(_0xcc0e0d(0xe8))/0x8+-parseInt(_0xcc0e0d(0xe0))/0x9;if(_0x184a9b===_0x33aed4)break;else _0x3802aa['push'](_0x3802aa['shift']());}catch(_0x28fab5){_0x3802aa['push'](_0x3802aa['shift']());}}}(a178_0x1862,0xc9a93));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a178_0x375e(_0x20be63,_0x5b8c2e){_0x20be63=_0x20be63-0xcf;const _0x1862df=a178_0x1862();let _0x375e2b=_0x1862df[_0x20be63];return _0x375e2b;}import{asDryRunResult}from'../../commands/common/dry-run.js';function a178_0x1862(){const _0x449b5c=['length','flag','\x20(id=','734Wgdqfo','trim','/smartapi/permit/role/update','6255214xjxVEm','2853xXUdfm','8061432JyBJZx','roleName','5peZjCc','13337847XtRpFH','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','POST','105527OZuLOX','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','5075396RApYQf','Updated\x20role\x20','remark','8769368dzWXCz','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','role','write','update','--name\x20cannot\x20be\x20empty.','New\x20role\x20name','name','validation','appCode','dev','num'];a178_0x1862=function(){return _0x449b5c;};return a178_0x1862();}import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a178_0x4646a1(0xda);function readPatch(_0x49701f){const _0x5e5015=a178_0x4646a1,_0x486daf=_0x49701f[_0x5e5015(0xd6)](_0x5e5015(0xd0)),_0x4adfa6=_0x49701f[_0x5e5015(0xd6)](_0x5e5015(0xe7)),_0x4b4f61={};if(_0x486daf!==undefined&&_0x486daf!==null){const _0xe03960=String(_0x486daf)[_0x5e5015(0xd9)]();if(!_0xe03960)throw CliErrors[_0x5e5015(0xd1)](_0x5e5015(0xed));if(_0xe03960[_0x5e5015(0xd5)]>0x40)throw CliErrors[_0x5e5015(0xd1)](_0x5e5015(0xe9));_0x4b4f61[_0x5e5015(0xde)]=_0xe03960;}_0x4adfa6!==undefined&&_0x4adfa6!==null&&(_0x4b4f61[_0x5e5015(0xe7)]=String(_0x4adfa6));if(_0x4b4f61['roleName']===undefined&&_0x4b4f61['remark']===undefined)throw CliErrors[_0x5e5015(0xd1)]('Nothing\x20to\x20update.',_0x5e5015(0xe4));return _0x4b4f61;}export const roleUpdate={'service':a178_0x4646a1(0xea),'command':a178_0x4646a1(0xec),'description':a178_0x4646a1(0xe1),'risk':a178_0x4646a1(0xeb),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a178_0x4646a1(0xd0),'type':'string','required':![],'description':a178_0x4646a1(0xcf)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x248298){readPatch(_0x248298);},async 'dryRun'(_0x54fc84){const _0x16dace=a178_0x4646a1,_0x2db962=_0x54fc84['num']('id'),_0x6b1b0e=readPatch(_0x54fc84),_0xd76177=await getRoleById(_0x54fc84[_0x16dace(0xd2)],_0x2db962);return assertCustomRole(_0xd76177,_0x16dace(0xec)),asDryRunResult({'scope':_0x16dace(0xd3),'operation':_0x16dace(0xec),'selector':{'appCode':_0x54fc84['appCode'],'roleId':_0x2db962,'roleName':_0xd76177[_0x16dace(0xde)]},'before':projectRole(_0xd76177),'after':projectRole({..._0xd76177,..._0x6b1b0e['roleName']!==undefined?{'roleName':_0x6b1b0e[_0x16dace(0xde)]}:{},..._0x6b1b0e[_0x16dace(0xe7)]!==undefined?{'remark':_0x6b1b0e['remark']}:{}}),'dryRun':!![],'backend':{'method':_0x16dace(0xe2),'path':UPDATE_PATH},'warnings':[]},{'method':_0x16dace(0xe2),'url':UPDATE_PATH});},async 'execute'(_0x2d2a65){const _0x2e86c7=a178_0x4646a1,_0x141cfd=_0x2d2a65[_0x2e86c7(0xd4)]('id'),_0x2ad1ab=readPatch(_0x2d2a65),_0x46fd45=await getRoleById(_0x2d2a65[_0x2e86c7(0xd2)],_0x141cfd);assertCustomRole(_0x46fd45,_0x2e86c7(0xec)),await updateAppRole({'id':_0x141cfd,'appCode':_0x2d2a65[_0x2e86c7(0xd2)],..._0x2ad1ab[_0x2e86c7(0xde)]!==undefined?{'roleName':_0x2ad1ab[_0x2e86c7(0xde)]}:{},..._0x2ad1ab[_0x2e86c7(0xe7)]!==undefined?{'remark':_0x2ad1ab[_0x2e86c7(0xe7)]}:{}});const _0x2f26c8=await getRoleById(_0x2d2a65[_0x2e86c7(0xd2)],_0x141cfd);return{'ok':!![],'data':{'scope':_0x2e86c7(0xd3),'operation':_0x2e86c7(0xec),'selector':{'appCode':_0x2d2a65['appCode'],'roleId':_0x141cfd,'roleName':_0x2f26c8[_0x2e86c7(0xde)]},'before':projectRole(_0x46fd45),'after':projectRole(_0x2f26c8),'dryRun':![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},'message':_0x2e86c7(0xe6)+_0x2f26c8[_0x2e86c7(0xde)]+_0x2e86c7(0xd7)+_0x141cfd+')'};}};
1
+ const a179_0x76cc3e=a179_0x1962;(function(_0x46aa50,_0x1cdd5e){const _0x3c1439=a179_0x1962,_0x5cd647=_0x46aa50();while(!![]){try{const _0x5d79cc=-parseInt(_0x3c1439(0x1a0))/0x1+parseInt(_0x3c1439(0x1b1))/0x2+parseInt(_0x3c1439(0x1a6))/0x3+parseInt(_0x3c1439(0x1ac))/0x4+parseInt(_0x3c1439(0x1ad))/0x5+parseInt(_0x3c1439(0x1a8))/0x6+-parseInt(_0x3c1439(0x1a2))/0x7;if(_0x5d79cc===_0x1cdd5e)break;else _0x5cd647['push'](_0x5cd647['shift']());}catch(_0x2fb462){_0x5cd647['push'](_0x5cd647['shift']());}}}(a179_0x48df,0xd040f));import{updateAppRole}from'../../core/api-client.js';function a179_0x48df(){const _0x240cfc=['518211MIraHr','flag','1046682jcZpoh','trim','validation','roleName','4112824nMWdsQ','7944440qRzfJA','appCode','dev','Nothing\x20to\x20update.','2794900SKRcks','write','length','remark','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','New\x20role\x20name','name','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','role','Updated\x20role\x20','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','/smartapi/permit/role/update','1248886avmGKf','POST','15818845SXQctY','num','update','\x20(id='];a179_0x48df=function(){return _0x240cfc;};return a179_0x48df();}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';function a179_0x1962(_0x49097c,_0x712f98){_0x49097c=_0x49097c-0x19a;const _0x48df70=a179_0x48df();let _0x19622b=_0x48df70[_0x49097c];return _0x19622b;}const UPDATE_PATH=a179_0x76cc3e(0x19f);function readPatch(_0x54923a){const _0x4ff08a=a179_0x76cc3e,_0x20ce46=_0x54923a[_0x4ff08a(0x1a7)](_0x4ff08a(0x19a)),_0x207a6d=_0x54923a['flag'](_0x4ff08a(0x1b4)),_0x37cc30={};if(_0x20ce46!==undefined&&_0x20ce46!==null){const _0x27129f=String(_0x20ce46)[_0x4ff08a(0x1a9)]();if(!_0x27129f)throw CliErrors[_0x4ff08a(0x1aa)]('--name\x20cannot\x20be\x20empty.');if(_0x27129f[_0x4ff08a(0x1b3)]>0x40)throw CliErrors[_0x4ff08a(0x1aa)](_0x4ff08a(0x1b5));_0x37cc30[_0x4ff08a(0x1ab)]=_0x27129f;}_0x207a6d!==undefined&&_0x207a6d!==null&&(_0x37cc30[_0x4ff08a(0x1b4)]=String(_0x207a6d));if(_0x37cc30[_0x4ff08a(0x1ab)]===undefined&&_0x37cc30[_0x4ff08a(0x1b4)]===undefined)throw CliErrors['validation'](_0x4ff08a(0x1b0),_0x4ff08a(0x19e));return _0x37cc30;}export const roleUpdate={'service':a179_0x76cc3e(0x19c),'command':a179_0x76cc3e(0x1a4),'description':a179_0x76cc3e(0x19b),'risk':a179_0x76cc3e(0x1b2),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a179_0x76cc3e(0x19a),'type':'string','required':![],'description':a179_0x76cc3e(0x1b6)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2d9b6b){readPatch(_0x2d9b6b);},async 'dryRun'(_0x1a14b5){const _0x57c907=a179_0x76cc3e,_0x218725=_0x1a14b5[_0x57c907(0x1a3)]('id'),_0x1bf0ed=readPatch(_0x1a14b5),_0x3a5fdb=await getRoleById(_0x1a14b5[_0x57c907(0x1ae)],_0x218725);return assertCustomRole(_0x3a5fdb,_0x57c907(0x1a4)),asDryRunResult({'scope':_0x57c907(0x1af),'operation':_0x57c907(0x1a4),'selector':{'appCode':_0x1a14b5[_0x57c907(0x1ae)],'roleId':_0x218725,'roleName':_0x3a5fdb[_0x57c907(0x1ab)]},'before':projectRole(_0x3a5fdb),'after':projectRole({..._0x3a5fdb,..._0x1bf0ed['roleName']!==undefined?{'roleName':_0x1bf0ed['roleName']}:{},..._0x1bf0ed['remark']!==undefined?{'remark':_0x1bf0ed['remark']}:{}}),'dryRun':!![],'backend':{'method':_0x57c907(0x1a1),'path':UPDATE_PATH},'warnings':[]},{'method':_0x57c907(0x1a1),'url':UPDATE_PATH});},async 'execute'(_0x1ddba9){const _0x138dd3=a179_0x76cc3e,_0x260efd=_0x1ddba9[_0x138dd3(0x1a3)]('id'),_0x413b54=readPatch(_0x1ddba9),_0x303e29=await getRoleById(_0x1ddba9[_0x138dd3(0x1ae)],_0x260efd);assertCustomRole(_0x303e29,_0x138dd3(0x1a4)),await updateAppRole({'id':_0x260efd,'appCode':_0x1ddba9[_0x138dd3(0x1ae)],..._0x413b54[_0x138dd3(0x1ab)]!==undefined?{'roleName':_0x413b54[_0x138dd3(0x1ab)]}:{},..._0x413b54[_0x138dd3(0x1b4)]!==undefined?{'remark':_0x413b54['remark']}:{}});const _0x3f469a=await getRoleById(_0x1ddba9['appCode'],_0x260efd);return{'ok':!![],'data':{'scope':'dev','operation':_0x138dd3(0x1a4),'selector':{'appCode':_0x1ddba9[_0x138dd3(0x1ae)],'roleId':_0x260efd,'roleName':_0x3f469a[_0x138dd3(0x1ab)]},'before':projectRole(_0x303e29),'after':projectRole(_0x3f469a),'dryRun':![],'backend':{'method':_0x138dd3(0x1a1),'path':UPDATE_PATH},'warnings':[]},'message':_0x138dd3(0x19d)+_0x3f469a[_0x138dd3(0x1ab)]+_0x138dd3(0x1a5)+_0x260efd+')'};}};
@@ -1 +1 @@
1
- const a179_0x5ffddb=a179_0x1266;(function(_0x289018,_0x56686c){const _0x32aa4d=a179_0x1266,_0x1db782=_0x289018();while(!![]){try{const _0x57597f=-parseInt(_0x32aa4d(0x7e))/0x1+parseInt(_0x32aa4d(0x80))/0x2*(-parseInt(_0x32aa4d(0x73))/0x3)+-parseInt(_0x32aa4d(0x81))/0x4+parseInt(_0x32aa4d(0x7c))/0x5*(parseInt(_0x32aa4d(0x70))/0x6)+-parseInt(_0x32aa4d(0x71))/0x7*(-parseInt(_0x32aa4d(0x7f))/0x8)+parseInt(_0x32aa4d(0x83))/0x9+parseInt(_0x32aa4d(0x72))/0xa;if(_0x57597f===_0x56686c)break;else _0x1db782['push'](_0x1db782['shift']());}catch(_0x2a1645){_0x1db782['push'](_0x1db782['shift']());}}}(a179_0x17ad,0xb1508));import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a179_0x1266(_0x125c40,_0x49d875){_0x125c40=_0x125c40-0x6d;const _0x17ad5d=a179_0x17ad();let _0x126621=_0x17ad5d[_0x125c40];return _0x126621;}import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a179_0x5ffddb(0x6d),'command':a179_0x5ffddb(0x77),'description':a179_0x5ffddb(0x6e),'risk':a179_0x5ffddb(0x6f),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x12478e){const _0x6ced00=a179_0x5ffddb,{mutation:_0x26e084}=await prepareUserMutation(_0x12478e,_0x6ced00(0x77),!![]);return asDryRunResult(_0x26e084,{'method':_0x6ced00(0x75),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x3cbb1f){const _0x32b6d1=a179_0x5ffddb,{mutation:_0x71695e,changed:_0x22f551,role:_0x458d58,user:_0x5b0170}=await prepareUserMutation(_0x3cbb1f,'user-add',![]);return _0x22f551&&await createDevUserRole({'appCode':_0x3cbb1f[_0x32b6d1(0x7d)],'userId':_0x5b0170[_0x32b6d1(0x82)],'username':_0x5b0170['username'],'roleType':_0x458d58[_0x32b6d1(0x74)],'roleId':_0x71695e[_0x32b6d1(0x76)]['roleId']}),{'ok':!![],'data':_0x71695e,'message':_0x22f551?'Added\x20user\x20'+_0x71695e['selector'][_0x32b6d1(0x82)]+_0x32b6d1(0x7a)+_0x71695e[_0x32b6d1(0x76)][_0x32b6d1(0x7b)]:_0x32b6d1(0x78)+_0x71695e[_0x32b6d1(0x76)]['userId']+_0x32b6d1(0x79)+_0x71695e['selector'][_0x32b6d1(0x7b)]};}};function a179_0x17ad(){const _0x47a845=['8gOYuDR','219614YzclDq','5116548mvlpaR','userId','5226048ogwejS','role','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','high-risk-write','348ftqCXV','1916579kRcCfL','18568780aFncpG','3trxbTi','roleType','POST','selector','user-add','No\x20change:\x20user\x20','\x20already\x20in\x20role\x20','\x20to\x20role\x20','roleName','435pPRYcc','appCode','601169EJGaIB'];a179_0x17ad=function(){return _0x47a845;};return a179_0x17ad();}
1
+ function a180_0x7dbc(){const _0x1fd3ec=['username','31VFoozK','userId','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','43270GLnYjY','roleType','301525Rnmwll','15886aMDUAs','13672wEFBMB','1264USZzgw','\x20already\x20in\x20role\x20','12vtWTUx','selector','770zgNftJ','3060fuuXwY','5391arCxwF','3dcGOes','user-add','appCode','\x20to\x20role\x20','roleName','Added\x20user\x20','roleId','538732czBIqG','2242058vzfWmd'];a180_0x7dbc=function(){return _0x1fd3ec;};return a180_0x7dbc();}const a180_0x35287c=a180_0x4cd4;(function(_0x134174,_0x5aa92f){const _0x1c2f65=a180_0x4cd4,_0xec8ac9=_0x134174();while(!![]){try{const _0x823a5c=-parseInt(_0x1c2f65(0x144))/0x1*(parseInt(_0x1c2f65(0x14b))/0x2)+parseInt(_0x1c2f65(0x153))/0x3*(-parseInt(_0x1c2f65(0x141))/0x4)+parseInt(_0x1c2f65(0x149))/0x5*(parseInt(_0x1c2f65(0x14e))/0x6)+-parseInt(_0x1c2f65(0x142))/0x7+parseInt(_0x1c2f65(0x14c))/0x8*(parseInt(_0x1c2f65(0x152))/0x9)+parseInt(_0x1c2f65(0x147))/0xa*(parseInt(_0x1c2f65(0x150))/0xb)+-parseInt(_0x1c2f65(0x151))/0xc*(-parseInt(_0x1c2f65(0x14a))/0xd);if(_0x823a5c===_0x5aa92f)break;else _0xec8ac9['push'](_0xec8ac9['shift']());}catch(_0x37ab9b){_0xec8ac9['push'](_0xec8ac9['shift']());}}}(a180_0x7dbc,0x27c2b));function a180_0x4cd4(_0x5b8025,_0x19c38b){_0x5b8025=_0x5b8025-0x13d;const _0x7dbc18=a180_0x7dbc();let _0x4cd460=_0x7dbc18[_0x5b8025];return _0x4cd460;}import{createDevUserRole}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,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':'role','command':a180_0x35287c(0x154),'description':a180_0x35287c(0x146),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x452f62){const _0x46189a=a180_0x35287c,{mutation:_0x45624d}=await prepareUserMutation(_0x452f62,_0x46189a(0x154),!![]);return asDryRunResult(_0x45624d,{'method':'POST','url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x591068){const _0x18629e=a180_0x35287c,{mutation:_0x11356d,changed:_0x31bf96,role:_0x1ae76f,user:_0x4235e5}=await prepareUserMutation(_0x591068,_0x18629e(0x154),![]);return _0x31bf96&&await createDevUserRole({'appCode':_0x591068[_0x18629e(0x155)],'userId':_0x4235e5[_0x18629e(0x145)],'username':_0x4235e5[_0x18629e(0x143)],'roleType':_0x1ae76f[_0x18629e(0x148)],'roleId':_0x11356d[_0x18629e(0x14f)][_0x18629e(0x140)]}),{'ok':!![],'data':_0x11356d,'message':_0x31bf96?_0x18629e(0x13f)+_0x11356d[_0x18629e(0x14f)][_0x18629e(0x145)]+_0x18629e(0x13d)+_0x11356d['selector'][_0x18629e(0x13e)]:'No\x20change:\x20user\x20'+_0x11356d[_0x18629e(0x14f)][_0x18629e(0x145)]+_0x18629e(0x14d)+_0x11356d['selector'][_0x18629e(0x13e)]};}};
@@ -1 +1 @@
1
- const a180_0x2716e8=a180_0x402a;(function(_0x5825cd,_0x3c7c34){const _0x443270=a180_0x402a,_0x2f551a=_0x5825cd();while(!![]){try{const _0x3cc345=-parseInt(_0x443270(0x1d6))/0x1+parseInt(_0x443270(0x1d4))/0x2+-parseInt(_0x443270(0x1e0))/0x3+-parseInt(_0x443270(0x1d9))/0x4*(-parseInt(_0x443270(0x1d5))/0x5)+-parseInt(_0x443270(0x1da))/0x6+parseInt(_0x443270(0x1dc))/0x7+-parseInt(_0x443270(0x1de))/0x8*(parseInt(_0x443270(0x1e3))/0x9);if(_0x3cc345===_0x3c7c34)break;else _0x2f551a['push'](_0x2f551a['shift']());}catch(_0x3b6691){_0x2f551a['push'](_0x2f551a['shift']());}}}(a180_0x6ea1,0xd8542));import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a180_0x6ea1(){const _0x11efbe=['2224146prtgQv','selector','3538591YARMCn','\x20not\x20in\x20role\x20','16UJUJZv','POST','784389IseCVt','user-remove','userId','3804777nJLkMy','role','No\x20change:\x20user\x20','2940912YzTuOb','8185445ldawVP','1249316ZHPhJA','roleName','high-risk-write','4WbXEvf'];a180_0x6ea1=function(){return _0x11efbe;};return a180_0x6ea1();}import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';function a180_0x402a(_0x356b6c,_0x1c417d){_0x356b6c=_0x356b6c-0x1d4;const _0x6ea1a2=a180_0x6ea1();let _0x402a2e=_0x6ea1a2[_0x356b6c];return _0x402a2e;}export const roleUserRemove={'service':a180_0x2716e8(0x1e4),'command':a180_0x2716e8(0x1e1),'description':'Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','risk':a180_0x2716e8(0x1d8),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x310ade){const _0x458b4a=a180_0x2716e8,{mutation:_0x3938b8}=await prepareUserMutation(_0x310ade,_0x458b4a(0x1e1),!![]);return asDryRunResult(_0x3938b8,{'method':_0x458b4a(0x1df),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x28ca5d){const _0x3f5a6d=a180_0x2716e8,{matchingRelationIds:_0x46d689,mutation:_0x562d56,changed:_0x787d05}=await prepareUserMutation(_0x28ca5d,_0x3f5a6d(0x1e1),![]);if(_0x787d05)for(const _0x108a8b of _0x46d689){await deleteDevUserRole(_0x108a8b);}return{'ok':!![],'data':_0x562d56,'message':_0x787d05?'Removed\x20user\x20'+_0x562d56[_0x3f5a6d(0x1db)][_0x3f5a6d(0x1e2)]+'\x20from\x20role\x20'+_0x562d56['selector'][_0x3f5a6d(0x1d7)]:_0x3f5a6d(0x1e5)+_0x562d56[_0x3f5a6d(0x1db)][_0x3f5a6d(0x1e2)]+_0x3f5a6d(0x1dd)+_0x562d56[_0x3f5a6d(0x1db)][_0x3f5a6d(0x1d7)]};}};
1
+ const a181_0x4448ec=a181_0x5a87;(function(_0x88951c,_0x3ccb69){const _0x36a4ac=a181_0x5a87,_0x1aa0bd=_0x88951c();while(!![]){try{const _0x5280f2=-parseInt(_0x36a4ac(0xab))/0x1*(-parseInt(_0x36a4ac(0xb4))/0x2)+-parseInt(_0x36a4ac(0xa9))/0x3+parseInt(_0x36a4ac(0xaf))/0x4+-parseInt(_0x36a4ac(0xac))/0x5+-parseInt(_0x36a4ac(0xb6))/0x6+parseInt(_0x36a4ac(0xb3))/0x7+-parseInt(_0x36a4ac(0xb8))/0x8;if(_0x5280f2===_0x3ccb69)break;else _0x1aa0bd['push'](_0x1aa0bd['shift']());}catch(_0x3d1efa){_0x1aa0bd['push'](_0x1aa0bd['shift']());}}}(a181_0x2483,0xcf987));import{deleteDevUserRole}from'../../core/api-client.js';function a181_0x5a87(_0x4f13f9,_0xaa8954){_0x4f13f9=_0x4f13f9-0xa9;const _0x2483b6=a181_0x2483();let _0x5a87a5=_0x2483b6[_0x4f13f9];return _0x5a87a5;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a181_0x2483(){const _0x2b1e49=['roleName','4289224QOPhdQ','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','user-remove','selector','5226116BomoYn','1508314tmAPNq','userId','2599302GvbaUD','\x20from\x20role\x20','4279528mltTRj','1170060vsAiET','high-risk-write','1NxVSKZ','1822810WmNILW','POST'];a181_0x2483=function(){return _0x2b1e49;};return a181_0x2483();}import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':'role','command':a181_0x4448ec(0xb1),'description':a181_0x4448ec(0xb0),'risk':a181_0x4448ec(0xaa),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x4e64b5){const _0x466c73=a181_0x4448ec,{mutation:_0x561a2e}=await prepareUserMutation(_0x4e64b5,_0x466c73(0xb1),!![]);return asDryRunResult(_0x561a2e,{'method':_0x466c73(0xad),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x42d6cf){const _0x505e74=a181_0x4448ec,{matchingRelationIds:_0x575616,mutation:_0x337ef2,changed:_0x23f86b}=await prepareUserMutation(_0x42d6cf,_0x505e74(0xb1),![]);if(_0x23f86b)for(const _0x42c924 of _0x575616){await deleteDevUserRole(_0x42c924);}return{'ok':!![],'data':_0x337ef2,'message':_0x23f86b?'Removed\x20user\x20'+_0x337ef2[_0x505e74(0xb2)][_0x505e74(0xb5)]+_0x505e74(0xb7)+_0x337ef2[_0x505e74(0xb2)][_0x505e74(0xae)]:'No\x20change:\x20user\x20'+_0x337ef2[_0x505e74(0xb2)]['userId']+'\x20not\x20in\x20role\x20'+_0x337ef2['selector']['roleName']};}};
@@ -1 +1 @@
1
- const a181_0x254603=a181_0x38a1;(function(_0x29531f,_0xfac962){const _0x22e0c3=a181_0x38a1,_0x44680b=_0x29531f();while(!![]){try{const _0x52dd9a=-parseInt(_0x22e0c3(0xe5))/0x1*(-parseInt(_0x22e0c3(0xe7))/0x2)+-parseInt(_0x22e0c3(0xe0))/0x3*(parseInt(_0x22e0c3(0xe4))/0x4)+-parseInt(_0x22e0c3(0xeb))/0x5+parseInt(_0x22e0c3(0xda))/0x6+-parseInt(_0x22e0c3(0xd7))/0x7*(parseInt(_0x22e0c3(0xd8))/0x8)+parseInt(_0x22e0c3(0xe1))/0x9*(-parseInt(_0x22e0c3(0xea))/0xa)+parseInt(_0x22e0c3(0xde))/0xb*(parseInt(_0x22e0c3(0xed))/0xc);if(_0x52dd9a===_0xfac962)break;else _0x44680b['push'](_0x44680b['shift']());}catch(_0x3e977e){_0x44680b['push'](_0x44680b['shift']());}}}(a181_0x2c60,0x9da7c));import{CliErrors}from'../../errors.js';function a181_0x38a1(_0x586ab6,_0x1a5f3a){_0x586ab6=_0x586ab6-0xd7;const _0x2c6037=a181_0x2c60();let _0x38a1c2=_0x2c6037[_0x586ab6];return _0x38a1c2;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';function a181_0x2c60(){const _0x538626=['Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','721XZfwcM','23672HBkcEA','username','3317748RaynlV','str','\x22\x20→\x20userId\x20','matchedBy','18658387rtQxXD','trim','45AorLSt','486801sviwfj','user-resolve','role','211748NEKMbG','1367fwanlx','Resolved\x20\x22','266wVUueP','flagMissing','read','70CpUZOj','1538875cebaeD','name','12RQJOKh','nickname','userId'];a181_0x2c60=function(){return _0x538626;};return a181_0x2c60();}export const roleUserResolve={'service':a181_0x254603(0xe3),'command':a181_0x254603(0xe2),'description':a181_0x254603(0xf0),'risk':a181_0x254603(0xe9),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x53722e){const _0x1b53b3=a181_0x254603;if(!_0x53722e['str'](_0x1b53b3(0xec))[_0x1b53b3(0xdf)]())throw CliErrors[_0x1b53b3(0xe8)](_0x1b53b3(0xec),'Pass\x20--name\x20<nickname|username>.');},async 'execute'(_0x21ee87){const _0x4b2268=a181_0x254603,_0x4cb2f5=_0x21ee87[_0x4b2268(0xdb)](_0x4b2268(0xec))['trim'](),_0xcefcbe=await resolveUserRef(_0x4cb2f5);return{'ok':!![],'data':{'user':{'userId':_0xcefcbe[_0x4b2268(0xef)],'username':_0xcefcbe[_0x4b2268(0xd9)],'nickname':_0xcefcbe[_0x4b2268(0xee)],'matchedBy':_0xcefcbe[_0x4b2268(0xdd)]}},'message':_0x4b2268(0xe6)+_0x4cb2f5+_0x4b2268(0xdc)+_0xcefcbe[_0x4b2268(0xef)]};}};
1
+ const a182_0x53368b=a182_0x4f99;function a182_0x3986(){const _0x4aaf3a=['role','trim','user-resolve','27BKuPbk','155652THXNFj','Pass\x20--name\x20<nickname|username>.','85392VWehtI','str','66eOpXsL','userId','username','matchedBy','1888465EzacQO','\x22\x20→\x20userId\x20','120130WNEhze','name','307895xQgJnn','Resolved\x20\x22','3159852HZrmBY','189eSuYYX','nickname','flagMissing','8067360NPXdik'];a182_0x3986=function(){return _0x4aaf3a;};return a182_0x3986();}(function(_0x2b7fdb,_0x4c0761){const _0x58a964=a182_0x4f99,_0x41c234=_0x2b7fdb();while(!![]){try{const _0x5506c4=parseInt(_0x58a964(0x147))/0x1+-parseInt(_0x58a964(0x13d))/0x2*(-parseInt(_0x58a964(0x13a))/0x3)+-parseInt(_0x58a964(0x149))/0x4+-parseInt(_0x58a964(0x143))/0x5+parseInt(_0x58a964(0x13f))/0x6*(-parseInt(_0x58a964(0x13b))/0x7)+parseInt(_0x58a964(0x136))/0x8+parseInt(_0x58a964(0x133))/0x9*(parseInt(_0x58a964(0x145))/0xa);if(_0x5506c4===_0x4c0761)break;else _0x41c234['push'](_0x41c234['shift']());}catch(_0x1fface){_0x41c234['push'](_0x41c234['shift']());}}}(a182_0x3986,0x83fb8));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';function a182_0x4f99(_0x22abb2,_0xdeaa12){_0x22abb2=_0x22abb2-0x133;const _0x3986f3=a182_0x3986();let _0x4f9963=_0x3986f3[_0x22abb2];return _0x4f9963;}export const roleUserResolve={'service':a182_0x53368b(0x137),'command':a182_0x53368b(0x139),'description':'Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','risk':'read','flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1cbbc7){const _0x44b8dc=a182_0x53368b;if(!_0x1cbbc7[_0x44b8dc(0x13e)]('name')[_0x44b8dc(0x138)]())throw CliErrors[_0x44b8dc(0x135)](_0x44b8dc(0x146),_0x44b8dc(0x13c));},async 'execute'(_0x525aee){const _0x55aa8b=a182_0x53368b,_0x5c7205=_0x525aee[_0x55aa8b(0x13e)](_0x55aa8b(0x146))[_0x55aa8b(0x138)](),_0x1811c0=await resolveUserRef(_0x5c7205);return{'ok':!![],'data':{'user':{'userId':_0x1811c0[_0x55aa8b(0x140)],'username':_0x1811c0[_0x55aa8b(0x141)],'nickname':_0x1811c0[_0x55aa8b(0x134)],'matchedBy':_0x1811c0[_0x55aa8b(0x142)]}},'message':_0x55aa8b(0x148)+_0x5c7205+_0x55aa8b(0x144)+_0x1811c0['userId']};}};
@@ -1 +1 @@
1
- const a182_0x359128=a182_0x3316;(function(_0x3bc6e3,_0x2702ea){const _0x2f3163=a182_0x3316,_0x2539f0=_0x3bc6e3();while(!![]){try{const _0x3db8fe=parseInt(_0x2f3163(0x1e3))/0x1+parseInt(_0x2f3163(0x1d0))/0x2+-parseInt(_0x2f3163(0x1bd))/0x3+-parseInt(_0x2f3163(0x1e1))/0x4+-parseInt(_0x2f3163(0x1cd))/0x5+parseInt(_0x2f3163(0x1d5))/0x6*(-parseInt(_0x2f3163(0x1b7))/0x7)+parseInt(_0x2f3163(0x1b8))/0x8*(parseInt(_0x2f3163(0x1be))/0x9);if(_0x3db8fe===_0x2702ea)break;else _0x2539f0['push'](_0x2539f0['shift']());}catch(_0x57e7f6){_0x2539f0['push'](_0x2539f0['shift']());}}}(a182_0x1d18,0x6e72a));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([a182_0x359128(0x1bc),'dev']);function a182_0x3316(_0x2a2812,_0x16891a){_0x2a2812=_0x2a2812-0x1ad;const _0x1d181f=a182_0x1d18();let _0x331631=_0x1d181f[_0x2a2812];return _0x331631;}function readPackageScripts(_0x3cb529){const _0x295b28=a182_0x359128,_0x98ce36=resolve(_0x3cb529,'package.json');if(!existsSync(_0x98ce36))return null;try{const _0xf095e7=JSON['parse'](readFileSync(_0x98ce36,_0x295b28(0x1db)));return _0xf095e7[_0x295b28(0x1c1)]??{};}catch{return null;}}function detectPackageManager(_0x1edf14){const _0x46103e=a182_0x359128;if(existsSync(resolve(_0x1edf14,'bun.lockb'))||existsSync(resolve(_0x1edf14,'bun.lock')))return _0x46103e(0x1c4);if(existsSync(resolve(_0x1edf14,_0x46103e(0x1b3))))return _0x46103e(0x1d8);if(existsSync(resolve(_0x1edf14,_0x46103e(0x1df))))return _0x46103e(0x1e6);return _0x46103e(0x1bb);}async function versionCheck(_0x68382f){const _0x3afefc=a182_0x359128,_0x34f900=await checkCliVersion();(_0x34f900[_0x3afefc(0x1c5)]||_0x34f900[_0x3afefc(0x1ca)])&&(printCliUpgradeWarning(_0x34f900),assertCliVersionSupported(_0x34f900));const _0x550077=await checkSdkVersion(_0x68382f);if(_0x550077[_0x3afefc(0x1c5)])printSdkUpgradeWarning(_0x550077);}function spawnScript(_0xf39df,_0x1e63ae,_0x236cf6,_0x45e94d){return new Promise((_0x5e6b2f,_0x3a1804)=>{const _0xff6853=a182_0x3316,_0x4c2b4e=['run',_0x1e63ae,..._0x236cf6],_0xfed54b=spawn(_0xf39df,_0x4c2b4e,{'cwd':_0x45e94d,'stdio':_0xff6853(0x1cb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x45e94d,_0xff6853(0x1cf),_0xff6853(0x1c2))+delimiter+process.env.PATH}});_0xfed54b['on'](_0xff6853(0x1dc),_0x232e82=>{const _0x297488=_0xff6853;if(_0x232e82===0x0||_0x232e82===null)_0x5e6b2f();else _0x3a1804(new Error(_0xf39df+_0x297488(0x1c3)+_0x1e63ae+_0x297488(0x1bf)+_0x232e82));}),_0xfed54b['on'](_0xff6853(0x1de),_0x3a1804);});}function spawnViteBuildWatch(_0x3af558){return new Promise((_0x50e003,_0x41f89d)=>{const _0x30d760=a182_0x3316,_0x2ebbd7=spawn(_0x30d760(0x1b4),['build',_0x30d760(0x1da)],{'cwd':_0x3af558,'stdio':_0x30d760(0x1cb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3af558,_0x30d760(0x1cf),'.bin')+delimiter+process.env.PATH}});_0x2ebbd7['on'](_0x30d760(0x1dc),_0x1ac8a9=>{const _0x444cc3=_0x30d760;if(_0x1ac8a9===0x0||_0x1ac8a9===null)_0x50e003();else _0x41f89d(new Error(_0x444cc3(0x1c0)+_0x1ac8a9));}),_0x2ebbd7['on'](_0x30d760(0x1de),_0x41f89d);});}function spawnVitePreview(_0x428ea3){return new Promise((_0x5bead5,_0x4ac65f)=>{const _0x5a73f2=a182_0x3316,_0x5b2c7b=spawn(_0x5a73f2(0x1b4),[_0x5a73f2(0x1c7)],{'cwd':_0x428ea3,'stdio':_0x5a73f2(0x1cb),'shell':!![],'env':{...process.env,'PATH':''+join(_0x428ea3,_0x5a73f2(0x1cf),_0x5a73f2(0x1c2))+delimiter+process.env.PATH}});_0x5b2c7b['on'](_0x5a73f2(0x1dc),_0x365ca0=>{const _0x1cf41e=_0x5a73f2;if(_0x365ca0===0x0||_0x365ca0===null)_0x5bead5();else _0x4ac65f(new Error(_0x1cf41e(0x1e2)+_0x365ca0));}),_0x5b2c7b['on'](_0x5a73f2(0x1de),_0x4ac65f);});}const runFlags=[{'name':a182_0x359128(0x1e4),'type':'boolean','description':a182_0x359128(0x1c9),'default':![]}];function a182_0x1d18(){const _0x230b7d=['args','184037JkEeKV','24IFYWuY','Run\x20a\x20package.json\x20script','bool','npm','start','279963sJUDbO','5301297ytMpme','\x20exited\x20with\x20code\x20','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','scripts','.bin','\x20run\x20','bun','needsUpgrade','\x20\x20EXAMPLES','preview','\x20run\x20start','Enable\x20watch\x20mode\x20for\x20preview','belowMinimum','inherit','Script\x20\x22','3457585NbXhxL','log','node_modules','1112944iDdpXD','cwd','keys','\x22\x20not\x20found\x20in\x20package.json.','all','66AiFZrs','\x20\x20\x20\x20','Script\x20name\x20defined\x20in\x20package.json','pnpm','has','--watch','utf-8','close','\x20run\x20preview\x20--watch','error','yarn.lock','run','3488572XCMhpb','vite\x20preview\x20exited\x20with\x20code\x20','75005UHOvzW','watch','\x0a\x20\x20Usage:\x20','yarn','push','\x0a\x20\x20Available\x20scripts:\x0a','join','\x20run\x20build','write','No\x20package.json\x20found\x20in\x20current\x20directory.','\x20run\x20preview','pnpm-lock.yaml','vite','length'];a182_0x1d18=function(){return _0x230b7d;};return a182_0x1d18();}export const runDefinition={'service':'run','command':a182_0x359128(0x1e0),'description':a182_0x359128(0x1b9),'risk':a182_0x359128(0x1b0),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':a182_0x359128(0x1d7),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x537268=a182_0x359128,_0x1e23bf=[];return _0x1e23bf[_0x537268(0x1e7)](_0x537268(0x1c6)),_0x1e23bf[_0x537268(0x1e7)](_0x537268(0x1d6)+CLI_BIN_NAME+_0x537268(0x1c8)),_0x1e23bf[_0x537268(0x1e7)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x537268(0x1af)),_0x1e23bf[_0x537268(0x1e7)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x537268(0x1b2)),_0x1e23bf[_0x537268(0x1e7)](_0x537268(0x1d6)+CLI_BIN_NAME+_0x537268(0x1dd)),_0x1e23bf[_0x537268(0x1ae)]('\x0a');},async 'execute'(_0xc118f7){const _0x605712=a182_0x359128,_0x41ce47=process[_0x605712(0x1d1)](),_0x8e6127=_0xc118f7[_0x605712(0x1b6)][0x0],_0x25cf34=_0xc118f7[_0x605712(0x1b6)]['slice'](0x1),_0x2fee34=readPackageScripts(_0x41ce47);if(!_0x2fee34)throw CliErrors['validation'](_0x605712(0x1b1));if(!_0x8e6127){const _0x1f8d80=Object[_0x605712(0x1d2)](_0x2fee34);if(_0x1f8d80[_0x605712(0x1b5)]===0x0)console[_0x605712(0x1ce)]('No\x20scripts\x20defined\x20in\x20package.json.');else{console['log'](_0x605712(0x1ad));for(const _0x49e5a6 of _0x1f8d80){console[_0x605712(0x1ce)]('\x20\x20\x20\x20'+_0x49e5a6);}console[_0x605712(0x1ce)](_0x605712(0x1e5)+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x2fee34[_0x8e6127])throw CliErrors['validation'](_0x605712(0x1cc)+_0x8e6127+_0x605712(0x1d3),'Available:\x20'+(Object['keys'](_0x2fee34)[_0x605712(0x1ae)](',\x20')||'(none)'));const _0x4adc8c=detectPackageManager(_0x41ce47);VERSION_CHECK_SCRIPTS[_0x605712(0x1d9)](_0x8e6127)&&await versionCheck(_0x41ce47);if(_0x8e6127===_0x605712(0x1c7)&&_0xc118f7[_0x605712(0x1ba)]('watch'))return await Promise[_0x605712(0x1d4)]([spawnViteBuildWatch(_0x41ce47),spawnVitePreview(_0x41ce47)]),{'ok':!![]};return await spawnScript(_0x4adc8c,_0x8e6127,_0x25cf34,_0x41ce47),{'ok':!![]};}};
1
+ const a183_0xfc198=a183_0x3e50;(function(_0x26e0bf,_0x428d3a){const _0xe50fed=a183_0x3e50,_0x316540=_0x26e0bf();while(!![]){try{const _0x4ea35d=parseInt(_0xe50fed(0x1cd))/0x1*(parseInt(_0xe50fed(0x1a3))/0x2)+parseInt(_0xe50fed(0x1c4))/0x3+-parseInt(_0xe50fed(0x1c2))/0x4+-parseInt(_0xe50fed(0x1ce))/0x5+-parseInt(_0xe50fed(0x19c))/0x6+parseInt(_0xe50fed(0x1b2))/0x7*(-parseInt(_0xe50fed(0x1c6))/0x8)+parseInt(_0xe50fed(0x1b6))/0x9*(parseInt(_0xe50fed(0x1a7))/0xa);if(_0x4ea35d===_0x428d3a)break;else _0x316540['push'](_0x316540['shift']());}catch(_0xb129e4){_0x316540['push'](_0x316540['shift']());}}}(a183_0x53bf,0x50cc8));function a183_0x53bf(){const _0x123222=['scripts','vite','.bin','bun.lock','439692RzRkgR','belowMinimum','npm','Run\x20a\x20package.json\x20script','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','yarn.lock','parse','2132ITDArw','log','bool','script','1301290JSjUyc','bun.lockb','push','\x20run\x20start','Script\x20\x22','node_modules','vite\x20preview\x20exited\x20with\x20code\x20','--watch','inherit','length','\x20\x20\x20\x20','14qPQluN','\x20run\x20<script>\x0a','(none)','\x0a\x20\x20Usage:\x20','27lcccXw','run','No\x20package.json\x20found\x20in\x20current\x20directory.','keys','\x20\x20EXAMPLES','pnpm-lock.yaml','join','close','start','preview','pnpm','\x20exited\x20with\x20code\x20','167468EZtzhf','\x20run\x20','1439628KgGzrV','args','1625560ToQEaA','bun','boolean','\x0a\x20\x20Available\x20scripts:\x0a','Available:\x20','No\x20scripts\x20defined\x20in\x20package.json.','yarn','479enzxIJ','2641930ravfJJ','write','Script\x20name\x20defined\x20in\x20package.json','error','\x20run\x20preview','watch','slice','all'];a183_0x53bf=function(){return _0x123222;};return a183_0x53bf();}import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';function a183_0x3e50(_0x2a865e,_0x3b4d21){_0x2a865e=_0x2a865e-0x199;const _0x53bf70=a183_0x53bf();let _0x3e50d1=_0x53bf70[_0x2a865e];return _0x3e50d1;}const VERSION_CHECK_SCRIPTS=new Set([a183_0xfc198(0x1be),'dev']);function readPackageScripts(_0x1986bb){const _0x2c7b77=a183_0xfc198,_0x3b7a0b=resolve(_0x1986bb,'package.json');if(!existsSync(_0x3b7a0b))return null;try{const _0x21c3b6=JSON[_0x2c7b77(0x1a2)](readFileSync(_0x3b7a0b,'utf-8'));return _0x21c3b6[_0x2c7b77(0x1d6)]??{};}catch{return null;}}function detectPackageManager(_0x53a682){const _0x226a26=a183_0xfc198;if(existsSync(resolve(_0x53a682,_0x226a26(0x1a8)))||existsSync(resolve(_0x53a682,_0x226a26(0x19b))))return _0x226a26(0x1c7);if(existsSync(resolve(_0x53a682,_0x226a26(0x1bb))))return _0x226a26(0x1c0);if(existsSync(resolve(_0x53a682,_0x226a26(0x1a1))))return _0x226a26(0x1cc);return _0x226a26(0x19e);}async function versionCheck(_0x40080f){const _0x566f63=a183_0xfc198,_0x238c07=await checkCliVersion();(_0x238c07['needsUpgrade']||_0x238c07[_0x566f63(0x19d)])&&(printCliUpgradeWarning(_0x238c07),assertCliVersionSupported(_0x238c07));const _0x2ff911=await checkSdkVersion(_0x40080f);if(_0x2ff911['needsUpgrade'])printSdkUpgradeWarning(_0x2ff911);}function spawnScript(_0x5f1ce5,_0xaef430,_0x787804,_0x27c1b0){return new Promise((_0xcd285a,_0x20f098)=>{const _0x138971=a183_0x3e50,_0x5ca101=['run',_0xaef430,..._0x787804],_0x4d0d69=spawn(_0x5f1ce5,_0x5ca101,{'cwd':_0x27c1b0,'stdio':_0x138971(0x1af),'shell':!![],'env':{...process.env,'PATH':''+join(_0x27c1b0,'node_modules',_0x138971(0x19a))+delimiter+process.env.PATH}});_0x4d0d69['on']('close',_0x518fdc=>{const _0x8a75f2=_0x138971;if(_0x518fdc===0x0||_0x518fdc===null)_0xcd285a();else _0x20f098(new Error(_0x5f1ce5+_0x8a75f2(0x1c3)+_0xaef430+_0x8a75f2(0x1c1)+_0x518fdc));}),_0x4d0d69['on']('error',_0x20f098);});}function spawnViteBuildWatch(_0x51e372){return new Promise((_0x188fef,_0x48fa37)=>{const _0x5ec379=a183_0x3e50,_0x65a2b7=spawn(_0x5ec379(0x199),['build',_0x5ec379(0x1ae)],{'cwd':_0x51e372,'stdio':_0x5ec379(0x1af),'shell':!![],'env':{...process.env,'PATH':''+join(_0x51e372,_0x5ec379(0x1ac),_0x5ec379(0x19a))+delimiter+process.env.PATH}});_0x65a2b7['on'](_0x5ec379(0x1bd),_0x1be189=>{const _0x455832=_0x5ec379;if(_0x1be189===0x0||_0x1be189===null)_0x188fef();else _0x48fa37(new Error(_0x455832(0x1a0)+_0x1be189));}),_0x65a2b7['on'](_0x5ec379(0x1d1),_0x48fa37);});}function spawnVitePreview(_0x38f226){return new Promise((_0x25c3e9,_0x100087)=>{const _0x212c38=a183_0x3e50,_0x54dba8=spawn('vite',[_0x212c38(0x1bf)],{'cwd':_0x38f226,'stdio':_0x212c38(0x1af),'shell':!![],'env':{...process.env,'PATH':''+join(_0x38f226,'node_modules',_0x212c38(0x19a))+delimiter+process.env.PATH}});_0x54dba8['on'](_0x212c38(0x1bd),_0xd18e83=>{const _0x16fe5f=_0x212c38;if(_0xd18e83===0x0||_0xd18e83===null)_0x25c3e9();else _0x100087(new Error(_0x16fe5f(0x1ad)+_0xd18e83));}),_0x54dba8['on'](_0x212c38(0x1d1),_0x100087);});}const runFlags=[{'name':a183_0xfc198(0x1d3),'type':a183_0xfc198(0x1c8),'description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a183_0xfc198(0x1b7),'command':a183_0xfc198(0x1b7),'description':a183_0xfc198(0x19f),'risk':a183_0xfc198(0x1cf),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a183_0xfc198(0x1a6),'description':a183_0xfc198(0x1d0),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x522a2f=a183_0xfc198,_0x1f0101=[];return _0x1f0101[_0x522a2f(0x1a9)](_0x522a2f(0x1ba)),_0x1f0101[_0x522a2f(0x1a9)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x522a2f(0x1aa)),_0x1f0101['push'](_0x522a2f(0x1b1)+CLI_BIN_NAME+'\x20run\x20build'),_0x1f0101[_0x522a2f(0x1a9)](_0x522a2f(0x1b1)+CLI_BIN_NAME+_0x522a2f(0x1d2)),_0x1f0101[_0x522a2f(0x1a9)](_0x522a2f(0x1b1)+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x1f0101[_0x522a2f(0x1bc)]('\x0a');},async 'execute'(_0x10462a){const _0x4acc5c=a183_0xfc198,_0x4695c6=process['cwd'](),_0x340bbd=_0x10462a[_0x4acc5c(0x1c5)][0x0],_0x55250d=_0x10462a['args'][_0x4acc5c(0x1d4)](0x1),_0x2c05bf=readPackageScripts(_0x4695c6);if(!_0x2c05bf)throw CliErrors['validation'](_0x4acc5c(0x1b8));if(!_0x340bbd){const _0x524ec9=Object[_0x4acc5c(0x1b9)](_0x2c05bf);if(_0x524ec9[_0x4acc5c(0x1b0)]===0x0)console[_0x4acc5c(0x1a4)](_0x4acc5c(0x1cb));else{console['log'](_0x4acc5c(0x1c9));for(const _0x1e6ab8 of _0x524ec9){console[_0x4acc5c(0x1a4)](_0x4acc5c(0x1b1)+_0x1e6ab8);}console[_0x4acc5c(0x1a4)](_0x4acc5c(0x1b5)+CLI_BIN_NAME+_0x4acc5c(0x1b3));}return{'ok':!![]};}if(!_0x2c05bf[_0x340bbd])throw CliErrors['validation'](_0x4acc5c(0x1ab)+_0x340bbd+'\x22\x20not\x20found\x20in\x20package.json.',_0x4acc5c(0x1ca)+(Object[_0x4acc5c(0x1b9)](_0x2c05bf)[_0x4acc5c(0x1bc)](',\x20')||_0x4acc5c(0x1b4)));const _0x413fa0=detectPackageManager(_0x4695c6);VERSION_CHECK_SCRIPTS['has'](_0x340bbd)&&await versionCheck(_0x4695c6);if(_0x340bbd===_0x4acc5c(0x1bf)&&_0x10462a[_0x4acc5c(0x1a5)](_0x4acc5c(0x1d3)))return await Promise[_0x4acc5c(0x1d5)]([spawnViteBuildWatch(_0x4695c6),spawnVitePreview(_0x4695c6)]),{'ok':!![]};return await spawnScript(_0x413fa0,_0x340bbd,_0x55250d,_0x4695c6),{'ok':!![]};}};
@@ -1 +1 @@
1
- function a183_0x9c5b(){const _0x37e5a0=['2854586XNIBQq','440xuaTru','110vpiqUo','240LVzAwB','json','102003mWRVXk','554344ZWIkqx','export','119538YhHJlM','1565016DktUjd','Export\x20machine-readable\x20command\x20schema\x20(JSON)','read','6IveqjA','9565DHwtgI','170039wrHhKr'];a183_0x9c5b=function(){return _0x37e5a0;};return a183_0x9c5b();}function a183_0x42ce(_0x588f7a,_0x3ec915){_0x588f7a=_0x588f7a-0x127;const _0x9c5bb6=a183_0x9c5b();let _0x42ce5d=_0x9c5bb6[_0x588f7a];return _0x42ce5d;}const a183_0x2f5a40=a183_0x42ce;(function(_0x34e5ef,_0x382b97){const _0x81b7a=a183_0x42ce,_0xc2ebb6=_0x34e5ef();while(!![]){try{const _0x440ce7=parseInt(_0x81b7a(0x133))/0x1+-parseInt(_0x81b7a(0x12b))/0x2+-parseInt(_0x81b7a(0x12e))/0x3+parseInt(_0x81b7a(0x135))/0x4*(parseInt(_0x81b7a(0x132))/0x5)+parseInt(_0x81b7a(0x131))/0x6*(parseInt(_0x81b7a(0x134))/0x7)+parseInt(_0x81b7a(0x128))/0x8*(parseInt(_0x81b7a(0x12d))/0x9)+parseInt(_0x81b7a(0x127))/0xa*(-parseInt(_0x81b7a(0x12a))/0xb);if(_0x440ce7===_0x382b97)break;else _0xc2ebb6['push'](_0xc2ebb6['shift']());}catch(_0x33eeb6){_0xc2ebb6['push'](_0xc2ebb6['shift']());}}}(a183_0x9c5b,0x45cb8));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x3f44f7){const _0x553753=await buildSchemaPayload();return{'ok':!![],'data':_0x553753};}export const schemaDefinition={'service':'schema','command':a183_0x2f5a40(0x12c),'description':a183_0x2f5a40(0x12f),'risk':a183_0x2f5a40(0x130),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a183_0x2f5a40(0x129),'flags':[],'execute':execute};
1
+ const a184_0x107473=a184_0x3e1e;(function(_0x80c582,_0xa18015){const _0x5a0cd9=a184_0x3e1e,_0x34aacd=_0x80c582();while(!![]){try{const _0xa29e14=-parseInt(_0x5a0cd9(0x1cd))/0x1+-parseInt(_0x5a0cd9(0x1c1))/0x2+parseInt(_0x5a0cd9(0x1c2))/0x3*(parseInt(_0x5a0cd9(0x1cf))/0x4)+parseInt(_0x5a0cd9(0x1cc))/0x5*(parseInt(_0x5a0cd9(0x1c8))/0x6)+-parseInt(_0x5a0cd9(0x1c5))/0x7*(parseInt(_0x5a0cd9(0x1ca))/0x8)+-parseInt(_0x5a0cd9(0x1c9))/0x9+parseInt(_0x5a0cd9(0x1c7))/0xa*(parseInt(_0x5a0cd9(0x1c3))/0xb);if(_0xa29e14===_0xa18015)break;else _0x34aacd['push'](_0x34aacd['shift']());}catch(_0x372603){_0x34aacd['push'](_0x34aacd['shift']());}}}(a184_0x549b,0x36011));function a184_0x3e1e(_0x461344,_0x4b6917){_0x461344=_0x461344-0x1c1;const _0x549bd0=a184_0x549b();let _0x3e1ea6=_0x549bd0[_0x461344];return _0x3e1ea6;}import{buildSchemaPayload}from'../framework/schema-export.js';function a184_0x549b(){const _0x37a0e0=['295349AHEjfc','json','245060XdqSHO','128310eLWYCy','9DwizFS','7259879gDEUix','Export\x20machine-readable\x20command\x20schema\x20(JSON)','43351YWgtLV','read','10SelAEe','219918ZUiCSu','2971728bQsFKw','8qzUmet','schema','10GuHXEt'];a184_0x549b=function(){return _0x37a0e0;};return a184_0x549b();}async function execute(_0x48f661){const _0x336985=await buildSchemaPayload();return{'ok':!![],'data':_0x336985};}export const schemaDefinition={'service':a184_0x107473(0x1cb),'command':'export','description':a184_0x107473(0x1c4),'risk':a184_0x107473(0x1c6),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a184_0x107473(0x1ce),'flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a184_0x51188d=a184_0x3ce8;(function(_0x20d785,_0x14bf9c){const _0x4b5de0=a184_0x3ce8,_0x41092b=_0x20d785();while(!![]){try{const _0x41a59f=-parseInt(_0x4b5de0(0x189))/0x1*(parseInt(_0x4b5de0(0x1a5))/0x2)+-parseInt(_0x4b5de0(0x16f))/0x3+parseInt(_0x4b5de0(0x192))/0x4*(parseInt(_0x4b5de0(0x16c))/0x5)+parseInt(_0x4b5de0(0x173))/0x6*(parseInt(_0x4b5de0(0x1a6))/0x7)+-parseInt(_0x4b5de0(0x175))/0x8+parseInt(_0x4b5de0(0x1a9))/0x9*(parseInt(_0x4b5de0(0x19a))/0xa)+parseInt(_0x4b5de0(0x187))/0xb*(parseInt(_0x4b5de0(0x183))/0xc);if(_0x41a59f===_0x14bf9c)break;else _0x41092b['push'](_0x41092b['shift']());}catch(_0x4fe2eb){_0x41092b['push'](_0x41092b['shift']());}}}(a184_0x4065,0xb76d5));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';function a184_0x3ce8(_0x76c379,_0x4462b7){_0x76c379=_0x76c379-0x160;const _0x4065b9=a184_0x4065();let _0x3ce856=_0x4065b9[_0x76c379];return _0x3ce856;}import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';function a184_0x4065(){const _0x1f1b52=['1306185pqydTM','请选择目标数据库:','utf8','2520414PsAMrl','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','dbId\x20必须为正整数','Local\x20SQL\x20file\x20mode','18JcjNoY','name','5715736SAyJZk','parse','new','\x20\x20SELECT\x201\x20AS\x20id','SQL\x20query\x20display\x20name','SQL\x20名称不能为空','isFinite','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','File\x20already\x20exists:\x20','mybatisXml','__manual__','sql','Created\x20SQL\x20query\x20','dbName','12eRlXDE','db-id','MyBatis\x20XML(mybatisXml)','/smartapi/custom/saveUserCustomSql','1564079kuVoCq','Invalid\x20database\x20selection\x20payload:\x20','979ClsSnh','dbId\x20不能为空','sqlCode','validation','dbId','sqlRootDir','✎\x20手动输入\x20dbId','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','join','12WJeOoW','SELECT\x201\x20AS\x20id;','flagMissing','sqls','sqlRoot','isInteger','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','mode','3450aRyruq','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','description','string','trim','</select>','appCode','<server-generated-sqlCode>','stringify','sqlName','lastSync','16srgJTR','2561321YMXCmp','请选择本地\x20SQL\x20模式:','适合带动态标签的\x20MyBatis\x20XML\x20SQL','7569ChgIci','catch','请输入\x20SQL\x20名称:','str','length','flag','lockFilePath','number','create','toISOString','map','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','nonInteractive','write'];a184_0x4065=function(){return _0x1f1b52;};return a184_0x4065();}import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x50a235){const _0x8eb609=a184_0x3ce8;if(_0x50a235==='mybatisXml')return[_0x8eb609(0x170),_0x8eb609(0x178),_0x8eb609(0x19f),''][_0x8eb609(0x191)]('\x0a');return[_0x8eb609(0x193),''][_0x8eb609(0x191)]('\x0a');}export const sqlCreate={'service':'sql','command':a184_0x51188d(0x166),'description':a184_0x51188d(0x19b),'risk':a184_0x51188d(0x16b),'flags':[{'name':'name','type':a184_0x51188d(0x19d),'description':a184_0x51188d(0x179)},{'name':a184_0x51188d(0x184),'type':a184_0x51188d(0x165),'description':'Target\x20database\x20ID'},{'name':a184_0x51188d(0x199),'type':a184_0x51188d(0x19d),'enum':[a184_0x51188d(0x180),a184_0x51188d(0x17e)],'description':a184_0x51188d(0x172)}],async 'validate'(_0x581be7){const _0x43dba5=a184_0x51188d;if(!_0x581be7[_0x43dba5(0x16a)])return;if(!_0x581be7[_0x43dba5(0x161)](_0x43dba5(0x174))[_0x43dba5(0x19e)]())throw CliErrors[_0x43dba5(0x194)](_0x43dba5(0x174),_0x43dba5(0x17c));const _0x538b62=resolveProvidedDbId(_0x581be7);if(typeof _0x538b62!==_0x43dba5(0x165)||!Number[_0x43dba5(0x17b)](_0x538b62)||_0x538b62<=0x0)throw CliErrors['flagMissing'](_0x43dba5(0x184),_0x43dba5(0x198));if(!_0x581be7[_0x43dba5(0x161)](_0x43dba5(0x199))[_0x43dba5(0x19e)]())throw CliErrors['flagMissing'](_0x43dba5(0x199),_0x43dba5(0x190));},async 'dryRun'(_0x5984b2){const _0x368bab=a184_0x51188d,_0x25e12b=loadSqlProjectConfig(_0x5984b2[_0x368bab(0x1a0)]),{sqlName:_0x4a6db2,dbId:_0x497749,dbName:_0xb5c1db,mode:_0x5c4886}=await resolveSqlNewInputs(_0x5984b2),_0x32f879=buildSqlRelativePath(_0x368bab(0x1a1),_0x4a6db2,_0xb5c1db,_0x5c4886,_0x497749),_0x1fa3ec=_0x25e12b[_0x368bab(0x18e)]+'/'+_0x32f879;return{'method':'POST','url':_0x368bab(0x186),'body':{'appCode':_0x5984b2[_0x368bab(0x1a0)],'sqlName':_0x4a6db2,'dbId':_0x497749,'mode':_0x5c4886,'localPath':_0x1fa3ec},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x25e12b[_0x368bab(0x18e)]};},async 'execute'(_0xb0c5d2){const _0x27b529=a184_0x51188d,_0x13e434=loadSqlProjectConfig(_0xb0c5d2['appCode']),{sqlName:_0x48537c,dbId:_0x2d9297,dbName:_0x32d0e4,mode:_0x5b443e}=await resolveSqlNewInputs(_0xb0c5d2),_0x10e9e2=generateSqlTemplate(_0x5b443e),_0x16001b=await createSqlQuery({'appCode':_0xb0c5d2[_0x27b529(0x1a0)],'sqlName':_0x48537c,'dbId':_0x2d9297,'sqlContent':_0x10e9e2}),_0x1e255b=ensureRemoteSqlContent(_0x16001b),_0x4412eb=_0x32d0e4||await getDbName(_0xb0c5d2['appCode'],_0x2d9297)[_0x27b529(0x1aa)](()=>undefined),_0x340bfb=buildSqlRelativePath(_0x16001b[_0x27b529(0x18b)],_0x16001b[_0x27b529(0x1a3)],_0x4412eb,_0x5b443e,_0x2d9297),_0x59cc32=_0x13e434[_0x27b529(0x18e)]+'/'+_0x340bfb,_0x4f87e9=buildLocalSqlFileContent({'sqlCode':_0x16001b[_0x27b529(0x18b)],'sqlName':_0x16001b[_0x27b529(0x1a3)],'dbId':_0x16001b['dbId']},_0x1e255b,{'dbName':_0x4412eb,'mode':_0x5b443e,'syncedAt':new Date()[_0x27b529(0x167)](),'description':_0x16001b[_0x27b529(0x19c)]});if(await fileExists(_0x59cc32))throw CliErrors[_0x27b529(0x18c)](_0x27b529(0x17d)+_0x59cc32);await ensureParentDirectory(_0x59cc32),await writeFile(_0x59cc32,_0x4f87e9,_0x27b529(0x16e));const _0x44135f=await readSqlLockFile(_0x13e434[_0x27b529(0x164)]),{lockData:_0x1a153f,appLock:_0x437fef}=ensureSqlLockScope(_0x44135f??createEmptySqlLock(),_0x13e434[_0x27b529(0x1a0)],_0x13e434[_0x27b529(0x196)],_0x27b529(0x177));return _0x437fef[_0x27b529(0x195)][_0x16001b[_0x27b529(0x18b)]]={...buildSqlLockEntry(_0x16001b,_0x1e255b,computeSqlContentHash(_0x4f87e9),{'dbName':_0x4412eb}),'path':_0x340bfb,'mode':_0x5b443e},_0x437fef[_0x27b529(0x1a4)]=new Date()[_0x27b529(0x167)](),await writeSqlLockFile(_0x13e434[_0x27b529(0x164)],_0x1a153f),{'ok':!![],'data':{'id':_0x16001b['id'],'sqlCode':_0x16001b[_0x27b529(0x18b)],'sqlName':_0x16001b[_0x27b529(0x1a3)],'dbId':_0x16001b[_0x27b529(0x18d)],'path':_0x59cc32,'mode':_0x5b443e},'message':_0x27b529(0x181)+_0x16001b['sqlCode']};}};async function resolveSqlNewInputs(_0x55998b){const _0x308e5c=await resolveSqlNameInput(_0x55998b),{dbId:_0x3da10f,dbName:_0x41e632}=await resolveDbSelection(_0x55998b),_0x2e4007=await resolveSqlModeInput(_0x55998b);return{'sqlName':_0x308e5c,'dbId':_0x3da10f,'dbName':_0x41e632,'mode':_0x2e4007};}async function resolveSqlNameInput(_0x3b33a7){const _0x220799=a184_0x51188d,_0x5aa1f2=_0x3b33a7['str'](_0x220799(0x174))[_0x220799(0x19e)]();if(_0x5aa1f2)return _0x5aa1f2;if(_0x3b33a7[_0x220799(0x16a)])throw CliErrors['flagMissing']('name',_0x220799(0x17c));return(await input({'message':_0x220799(0x160),'validate':_0x51620f=>_0x51620f[_0x220799(0x19e)]()?!![]:_0x220799(0x17a)}))[_0x220799(0x19e)]();}async function resolveDbSelection(_0x3673ca){const _0x4a782d=a184_0x51188d,_0xa70075=resolveProvidedDbId(_0x3673ca);if(typeof _0xa70075===_0x4a782d(0x165)&&Number[_0x4a782d(0x17b)](_0xa70075)&&_0xa70075>0x0)return{'dbId':_0xa70075,'dbName':await getDbName(_0x3673ca['appCode'],_0xa70075)[_0x4a782d(0x1aa)](()=>undefined)};if(_0x3673ca['nonInteractive'])throw CliErrors['flagMissing'](_0x4a782d(0x184),_0x4a782d(0x198));const _0x3457a8=await listDatabases(_0x3673ca[_0x4a782d(0x1a0)])[_0x4a782d(0x1aa)](()=>[]);if(_0x3457a8[_0x4a782d(0x162)]===0x1)return{'dbId':_0x3457a8[0x0]['dbId'],'dbName':_0x3457a8[0x0][_0x4a782d(0x182)]};if(_0x3457a8[_0x4a782d(0x162)]>0x1){const _0x2dcaf7=await select({'message':_0x4a782d(0x16d),'choices':[..._0x3457a8[_0x4a782d(0x168)](_0x349c22=>({'name':_0x349c22['dbName']+'\x20('+_0x349c22[_0x4a782d(0x18d)]+')','value':serializeDbSelection(_0x349c22)})),{'name':_0x4a782d(0x18f),'value':_0x4a782d(0x17f)}]});if(_0x2dcaf7!==_0x4a782d(0x17f))return deserializeDbSelection(_0x2dcaf7);}const _0x5d1d38=await input({'message':'请输入目标数据库\x20dbId:','validate':_0x5ab4ca=>{const _0x92c986=_0x4a782d,_0xe31dc4=_0x5ab4ca['trim']();if(!_0xe31dc4)return _0x92c986(0x18a);const _0x410da4=Number(_0xe31dc4);if(!Number[_0x92c986(0x197)](_0x410da4)||_0x410da4<=0x0)return _0x92c986(0x171);return!![];}});return{'dbId':Number(_0x5d1d38['trim']())};}async function resolveSqlModeInput(_0xa1c08){const _0x4d6dce=a184_0x51188d,_0x4668a8=_0xa1c08['str'](_0x4d6dce(0x199))['trim']();if(_0x4668a8===_0x4d6dce(0x180)||_0x4668a8===_0x4d6dce(0x17e))return _0x4668a8;if(_0xa1c08[_0x4d6dce(0x16a)])throw CliErrors['flagMissing'](_0x4d6dce(0x199),_0x4d6dce(0x190));return await select({'message':_0x4d6dce(0x1a7),'choices':[{'name':'普通\x20SQL(sql)','value':_0x4d6dce(0x180),'description':_0x4d6dce(0x169)},{'name':_0x4d6dce(0x185),'value':_0x4d6dce(0x17e),'description':_0x4d6dce(0x1a8)}]});}function serializeDbSelection(_0x3bd464){const _0x5854f4=a184_0x51188d;return JSON[_0x5854f4(0x1a2)]({'dbId':_0x3bd464['dbId'],'dbName':_0x3bd464[_0x5854f4(0x182)]});}function deserializeDbSelection(_0x1f1ba3){const _0x58c6bb=a184_0x51188d;try{const _0x538265=JSON[_0x58c6bb(0x176)](_0x1f1ba3);if(typeof _0x538265[_0x58c6bb(0x18d)]===_0x58c6bb(0x165)&&Number[_0x58c6bb(0x17b)](_0x538265['dbId']))return{'dbId':_0x538265[_0x58c6bb(0x18d)],'dbName':_0x538265[_0x58c6bb(0x182)]};}catch{}throw CliErrors[_0x58c6bb(0x18c)](_0x58c6bb(0x188)+_0x1f1ba3);}function resolveProvidedDbId(_0x3af0cb){const _0x157fce=a184_0x51188d,_0x283e66=_0x3af0cb[_0x157fce(0x163)](_0x157fce(0x184));if(typeof _0x283e66==='number'&&Number[_0x157fce(0x17b)](_0x283e66))return _0x283e66;return undefined;}
1
+ const a185_0x4ceda7=a185_0x3d85;function a185_0x3543(){const _0x5d07a8=['mybatisXml','请输入\x20SQL\x20名称:','description','</select>','str','string','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','join','trim','lockFilePath','sqlName','SQL\x20名称不能为空','SQL\x20query\x20display\x20name','MyBatis\x20XML(mybatisXml)','请选择本地\x20SQL\x20模式:','nonInteractive','5721070RAeXTu','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','lastSync','普通\x20SQL(sql)','appCode','Invalid\x20database\x20selection\x20payload:\x20','250536baCfVm','dbName','utf8','map','isFinite','1488230ZGybPh','/smartapi/custom/saveUserCustomSql','5601944BywMGQ','validation','length','db-id','flagMissing','sqlCode','1257876pdjzMG','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Target\x20database\x20ID','Local\x20SQL\x20file\x20mode','sql','dbId\x20不能为空','SELECT\x201\x20AS\x20id;','File\x20already\x20exists:\x20','dbId','22595859FQQlGz','sqls','dbId\x20必须为正整数','9uroKOg','toISOString','mode','1870218vQkaVR','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','number','name','sqlRootDir','catch','new','<server-generated-sqlCode>','isInteger','36QNQdpB','POST'];a185_0x3543=function(){return _0x5d07a8;};return a185_0x3543();}(function(_0x54b776,_0x20c4eb){const _0x436292=a185_0x3d85,_0x5bbe8a=_0x54b776();while(!![]){try{const _0x478239=parseInt(_0x436292(0x1a7))/0x1+parseInt(_0x436292(0x1ac))/0x2+-parseInt(_0x436292(0x1c0))/0x3*(parseInt(_0x436292(0x1b4))/0x4)+parseInt(_0x436292(0x1a0))/0x5+-parseInt(_0x436292(0x1cc))/0x6*(-parseInt(_0x436292(0x1c3))/0x7)+parseInt(_0x436292(0x1ae))/0x8+-parseInt(_0x436292(0x1bd))/0x9;if(_0x478239===_0x20c4eb)break;else _0x5bbe8a['push'](_0x5bbe8a['shift']());}catch(_0x3c7f58){_0x5bbe8a['push'](_0x5bbe8a['shift']());}}}(a185_0x3543,0xf13be));import{writeFile}from'node:fs/promises';function a185_0x3d85(_0x241970,_0x10a992){_0x241970=_0x241970-0x197;const _0x354394=a185_0x3543();let _0x3d855f=_0x354394[_0x241970];return _0x3d855f;}import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x3f4d92){const _0x542d1f=a185_0x3d85;if(_0x3f4d92===_0x542d1f(0x1ce))return[_0x542d1f(0x1a2),'\x20\x20SELECT\x201\x20AS\x20id',_0x542d1f(0x1d1),''][_0x542d1f(0x197)]('\x0a');return[_0x542d1f(0x1ba),'']['join']('\x0a');}export const sqlCreate={'service':a185_0x4ceda7(0x1b8),'command':'create','description':a185_0x4ceda7(0x1b5),'risk':'write','flags':[{'name':a185_0x4ceda7(0x1c6),'type':'string','description':a185_0x4ceda7(0x19c)},{'name':a185_0x4ceda7(0x1b1),'type':a185_0x4ceda7(0x1c5),'description':a185_0x4ceda7(0x1b6)},{'name':'mode','type':a185_0x4ceda7(0x1d3),'enum':['sql',a185_0x4ceda7(0x1ce)],'description':a185_0x4ceda7(0x1b7)}],async 'validate'(_0x5dca97){const _0x526b94=a185_0x4ceda7;if(!_0x5dca97[_0x526b94(0x19f)])return;if(!_0x5dca97[_0x526b94(0x1d2)]('name')[_0x526b94(0x198)]())throw CliErrors['flagMissing'](_0x526b94(0x1c6),_0x526b94(0x1a1));const _0x45f541=resolveProvidedDbId(_0x5dca97);if(typeof _0x45f541!==_0x526b94(0x1c5)||!Number[_0x526b94(0x1ab)](_0x45f541)||_0x45f541<=0x0)throw CliErrors[_0x526b94(0x1b2)](_0x526b94(0x1b1),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x5dca97['str']('mode')[_0x526b94(0x198)]())throw CliErrors[_0x526b94(0x1b2)](_0x526b94(0x1c2),_0x526b94(0x1d4));},async 'dryRun'(_0x5d795b){const _0x27ae90=a185_0x4ceda7,_0x22917d=loadSqlProjectConfig(_0x5d795b[_0x27ae90(0x1a5)]),{sqlName:_0x25f812,dbId:_0x3a929b,dbName:_0x11cd2c,mode:_0x4bcf99}=await resolveSqlNewInputs(_0x5d795b),_0x27a349=buildSqlRelativePath(_0x27ae90(0x1ca),_0x25f812,_0x11cd2c,_0x4bcf99,_0x3a929b),_0x36863d=_0x22917d[_0x27ae90(0x1c7)]+'/'+_0x27a349;return{'method':_0x27ae90(0x1cd),'url':_0x27ae90(0x1ad),'body':{'appCode':_0x5d795b[_0x27ae90(0x1a5)],'sqlName':_0x25f812,'dbId':_0x3a929b,'mode':_0x4bcf99,'localPath':_0x36863d},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x22917d['sqlRootDir']};},async 'execute'(_0x35ae9e){const _0x1e3c75=a185_0x4ceda7,_0x4f61b3=loadSqlProjectConfig(_0x35ae9e['appCode']),{sqlName:_0x29fd3b,dbId:_0x35813f,dbName:_0x183935,mode:_0x1aee93}=await resolveSqlNewInputs(_0x35ae9e),_0x2d1f64=generateSqlTemplate(_0x1aee93),_0x5eb600=await createSqlQuery({'appCode':_0x35ae9e[_0x1e3c75(0x1a5)],'sqlName':_0x29fd3b,'dbId':_0x35813f,'sqlContent':_0x2d1f64}),_0x2a4163=ensureRemoteSqlContent(_0x5eb600),_0x3ebe0f=_0x183935||await getDbName(_0x35ae9e[_0x1e3c75(0x1a5)],_0x35813f)[_0x1e3c75(0x1c8)](()=>undefined),_0x5cf76b=buildSqlRelativePath(_0x5eb600[_0x1e3c75(0x1b3)],_0x5eb600['sqlName'],_0x3ebe0f,_0x1aee93,_0x35813f),_0x31be46=_0x4f61b3[_0x1e3c75(0x1c7)]+'/'+_0x5cf76b,_0x228e25=buildLocalSqlFileContent({'sqlCode':_0x5eb600['sqlCode'],'sqlName':_0x5eb600[_0x1e3c75(0x19a)],'dbId':_0x5eb600[_0x1e3c75(0x1bc)]},_0x2a4163,{'dbName':_0x3ebe0f,'mode':_0x1aee93,'syncedAt':new Date()[_0x1e3c75(0x1c1)](),'description':_0x5eb600[_0x1e3c75(0x1d0)]});if(await fileExists(_0x31be46))throw CliErrors[_0x1e3c75(0x1af)](_0x1e3c75(0x1bb)+_0x31be46);await ensureParentDirectory(_0x31be46),await writeFile(_0x31be46,_0x228e25,_0x1e3c75(0x1a9));const _0x37624d=await readSqlLockFile(_0x4f61b3[_0x1e3c75(0x199)]),{lockData:_0x26ae6b,appLock:_0x212c87}=ensureSqlLockScope(_0x37624d??createEmptySqlLock(),_0x4f61b3['appCode'],_0x4f61b3['sqlRoot'],_0x1e3c75(0x1c9));return _0x212c87[_0x1e3c75(0x1be)][_0x5eb600[_0x1e3c75(0x1b3)]]={...buildSqlLockEntry(_0x5eb600,_0x2a4163,computeSqlContentHash(_0x228e25),{'dbName':_0x3ebe0f}),'path':_0x5cf76b,'mode':_0x1aee93},_0x212c87[_0x1e3c75(0x1a3)]=new Date()[_0x1e3c75(0x1c1)](),await writeSqlLockFile(_0x4f61b3['lockFilePath'],_0x26ae6b),{'ok':!![],'data':{'id':_0x5eb600['id'],'sqlCode':_0x5eb600[_0x1e3c75(0x1b3)],'sqlName':_0x5eb600[_0x1e3c75(0x19a)],'dbId':_0x5eb600[_0x1e3c75(0x1bc)],'path':_0x31be46,'mode':_0x1aee93},'message':'Created\x20SQL\x20query\x20'+_0x5eb600[_0x1e3c75(0x1b3)]};}};async function resolveSqlNewInputs(_0x71a980){const _0x227c24=await resolveSqlNameInput(_0x71a980),{dbId:_0x4398c2,dbName:_0x5a5845}=await resolveDbSelection(_0x71a980),_0x4df483=await resolveSqlModeInput(_0x71a980);return{'sqlName':_0x227c24,'dbId':_0x4398c2,'dbName':_0x5a5845,'mode':_0x4df483};}async function resolveSqlNameInput(_0x24b148){const _0x232c3=a185_0x4ceda7,_0x615e31=_0x24b148[_0x232c3(0x1d2)](_0x232c3(0x1c6))[_0x232c3(0x198)]();if(_0x615e31)return _0x615e31;if(_0x24b148['nonInteractive'])throw CliErrors['flagMissing'](_0x232c3(0x1c6),_0x232c3(0x1a1));return(await input({'message':_0x232c3(0x1cf),'validate':_0x40f853=>_0x40f853[_0x232c3(0x198)]()?!![]:_0x232c3(0x19b)}))[_0x232c3(0x198)]();}async function resolveDbSelection(_0x40565b){const _0x9c47c4=a185_0x4ceda7,_0x4c0e7c=resolveProvidedDbId(_0x40565b);if(typeof _0x4c0e7c===_0x9c47c4(0x1c5)&&Number['isFinite'](_0x4c0e7c)&&_0x4c0e7c>0x0)return{'dbId':_0x4c0e7c,'dbName':await getDbName(_0x40565b[_0x9c47c4(0x1a5)],_0x4c0e7c)[_0x9c47c4(0x1c8)](()=>undefined)};if(_0x40565b[_0x9c47c4(0x19f)])throw CliErrors[_0x9c47c4(0x1b2)](_0x9c47c4(0x1b1),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x99e0cb=await listDatabases(_0x40565b[_0x9c47c4(0x1a5)])['catch'](()=>[]);if(_0x99e0cb['length']===0x1)return{'dbId':_0x99e0cb[0x0][_0x9c47c4(0x1bc)],'dbName':_0x99e0cb[0x0][_0x9c47c4(0x1a8)]};if(_0x99e0cb[_0x9c47c4(0x1b0)]>0x1){const _0x57d05a=await select({'message':'请选择目标数据库:','choices':[..._0x99e0cb[_0x9c47c4(0x1aa)](_0x2bd821=>({'name':_0x2bd821['dbName']+'\x20('+_0x2bd821['dbId']+')','value':serializeDbSelection(_0x2bd821)})),{'name':'✎\x20手动输入\x20dbId','value':'__manual__'}]});if(_0x57d05a!=='__manual__')return deserializeDbSelection(_0x57d05a);}const _0x67a85a=await input({'message':'请输入目标数据库\x20dbId:','validate':_0x4d3da7=>{const _0x217e86=_0x9c47c4,_0x556b86=_0x4d3da7[_0x217e86(0x198)]();if(!_0x556b86)return _0x217e86(0x1b9);const _0x2d5235=Number(_0x556b86);if(!Number[_0x217e86(0x1cb)](_0x2d5235)||_0x2d5235<=0x0)return _0x217e86(0x1bf);return!![];}});return{'dbId':Number(_0x67a85a[_0x9c47c4(0x198)]())};}async function resolveSqlModeInput(_0x4faa3b){const _0x38dc62=a185_0x4ceda7,_0x6b1192=_0x4faa3b[_0x38dc62(0x1d2)](_0x38dc62(0x1c2))['trim']();if(_0x6b1192===_0x38dc62(0x1b8)||_0x6b1192==='mybatisXml')return _0x6b1192;if(_0x4faa3b['nonInteractive'])throw CliErrors[_0x38dc62(0x1b2)](_0x38dc62(0x1c2),_0x38dc62(0x1d4));return await select({'message':_0x38dc62(0x19e),'choices':[{'name':_0x38dc62(0x1a4),'value':_0x38dc62(0x1b8),'description':_0x38dc62(0x1c4)},{'name':_0x38dc62(0x19d),'value':_0x38dc62(0x1ce),'description':'适合带动态标签的\x20MyBatis\x20XML\x20SQL'}]});}function serializeDbSelection(_0x3be1e1){const _0x2e4284=a185_0x4ceda7;return JSON['stringify']({'dbId':_0x3be1e1[_0x2e4284(0x1bc)],'dbName':_0x3be1e1[_0x2e4284(0x1a8)]});}function deserializeDbSelection(_0x2b6dd5){const _0xaae936=a185_0x4ceda7;try{const _0x419302=JSON['parse'](_0x2b6dd5);if(typeof _0x419302['dbId']===_0xaae936(0x1c5)&&Number[_0xaae936(0x1ab)](_0x419302['dbId']))return{'dbId':_0x419302[_0xaae936(0x1bc)],'dbName':_0x419302[_0xaae936(0x1a8)]};}catch{}throw CliErrors[_0xaae936(0x1af)](_0xaae936(0x1a6)+_0x2b6dd5);}function resolveProvidedDbId(_0x2cdb08){const _0x13017e=a185_0x4ceda7,_0x5d467a=_0x2cdb08['flag']('db-id');if(typeof _0x5d467a===_0x13017e(0x1c5)&&Number[_0x13017e(0x1ab)](_0x5d467a))return _0x5d467a;return undefined;}
@@ -1 +1 @@
1
- const a185_0x1d39d=a185_0x284c;(function(_0x72624f,_0x9b42dd){const _0x3bcda1=a185_0x284c,_0x17f82e=_0x72624f();while(!![]){try{const _0x5418fb=parseInt(_0x3bcda1(0x132))/0x1*(-parseInt(_0x3bcda1(0x12f))/0x2)+parseInt(_0x3bcda1(0x140))/0x3*(-parseInt(_0x3bcda1(0x147))/0x4)+-parseInt(_0x3bcda1(0x14c))/0x5*(-parseInt(_0x3bcda1(0x141))/0x6)+parseInt(_0x3bcda1(0x13a))/0x7+-parseInt(_0x3bcda1(0x131))/0x8+-parseInt(_0x3bcda1(0x135))/0x9+parseInt(_0x3bcda1(0x134))/0xa*(parseInt(_0x3bcda1(0x145))/0xb);if(_0x5418fb===_0x9b42dd)break;else _0x17f82e['push'](_0x17f82e['shift']());}catch(_0x459c55){_0x17f82e['push'](_0x17f82e['shift']());}}}(a185_0x2650,0xd3d93));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a185_0x2650(){const _0x2a0098=['validation','7602856JIpHQF','5634qgLlyk','lockFilePath','50241500TPfgFJ','9772857DJILdv','Would\x20delete\x20SQL\x20','replace','sql','appCode','4161906eHZpwb','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','trashDir','sqlRoot','startsWith','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','5193pjizGW','6JMFtyT','trashedTo','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','lastSync','11dPoABl','str','3412zcCJwW','high-risk-write','sqls','toISOString','filter','2288150IAfvqP','sqlcode','/smartapi/custom/deleteUserCustomSql','POST','delete','projectRoot','remoteId','SQL\x20lock\x20file\x20not\x20found.','602ZRZINK'];a185_0x2650=function(){return _0x2a0098;};return a185_0x2650();}export const sqlDelete={'service':a185_0x1d39d(0x138),'command':a185_0x1d39d(0x12b),'description':a185_0x1d39d(0x13f),'risk':a185_0x1d39d(0x148),'flags':[SQLCODE_FLAG],async 'validate'(_0x26b46b){const _0x4b025e=a185_0x1d39d,_0xa150d4=loadSqlProjectConfig(_0x26b46b['appCode']),_0x262ae5=await readSqlLockFile(_0xa150d4['lockFilePath']);if(!_0x262ae5)throw CliErrors[_0x4b025e(0x130)](_0x4b025e(0x143));},async 'dryRun'(_0x54a81d){const _0x17c602=a185_0x1d39d,_0xfd9417=loadSqlProjectConfig(_0x54a81d[_0x17c602(0x139)]),_0x481787=await readSqlLockFile(_0xfd9417[_0x17c602(0x133)]);if(!_0x481787)throw CliErrors[_0x17c602(0x130)](_0x17c602(0x143));const {appLock:_0x579f36}=ensureSqlLockScope(_0x481787,_0x54a81d[_0x17c602(0x139)],_0xfd9417[_0x17c602(0x13d)],'delete'),_0x510596=_0x54a81d[_0x17c602(0x146)](_0x17c602(0x14d)),_0x38aa99=_0x579f36[_0x17c602(0x149)][_0x510596];if(!_0x38aa99)throw CliErrors['validation']('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x510596+'\x22.');return{'method':_0x17c602(0x12a),'url':_0x17c602(0x14e),'body':{'sqlCode':_0x510596,'id':_0x38aa99[_0x17c602(0x12d)],'localPath':resolveLocalSqlFilePath(_0xfd9417,_0x510596,_0x38aa99)},'description':_0x17c602(0x136)+_0x510596+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0xfd9417[_0x17c602(0x13c)]};},async 'execute'(_0x57b1f7){const _0x12bccd=a185_0x1d39d,_0x596fd5=loadSqlProjectConfig(_0x57b1f7['appCode']),_0x473751=await readSqlLockFile(_0x596fd5[_0x12bccd(0x133)]);if(!_0x473751)throw CliErrors[_0x12bccd(0x130)](_0x12bccd(0x12e));const {lockData:_0x5a1962,appLock:_0x54c8d9}=ensureSqlLockScope(_0x473751,_0x57b1f7['appCode'],_0x596fd5[_0x12bccd(0x13d)],_0x12bccd(0x12b)),_0x52235c=_0x57b1f7[_0x12bccd(0x146)](_0x12bccd(0x14d)),_0x6ced51=_0x54c8d9[_0x12bccd(0x149)][_0x52235c];if(!_0x6ced51)throw CliErrors['validation'](_0x12bccd(0x13b)+_0x52235c+'\x22.');await deleteSqlQuery({'id':_0x6ced51['remoteId'],'sqlCode':_0x52235c}),_0x54c8d9[_0x12bccd(0x149)]=Object['fromEntries'](Object['entries'](_0x54c8d9['sqls'])[_0x12bccd(0x14b)](([_0x3e403f])=>_0x3e403f!==_0x52235c)),_0x54c8d9[_0x12bccd(0x144)]=new Date()[_0x12bccd(0x14a)](),await writeSqlLockFile(_0x596fd5[_0x12bccd(0x133)],_0x5a1962);const _0x1935ef=resolveLocalSqlFilePath(_0x596fd5,_0x52235c,_0x6ced51);let _0x2be8bf;await fileExists(_0x1935ef)&&(_0x2be8bf=await moveToTrash(_0x596fd5[_0x12bccd(0x12c)],_0x596fd5['trashDir'],_0x1935ef),await cleanupEmptyDirectories(dirname(_0x1935ef),_0x596fd5['sqlRootDir']));const _0x48b1a5={'deleted':_0x52235c,'remoteId':_0x6ced51[_0x12bccd(0x12d)]};if(_0x2be8bf)_0x48b1a5[_0x12bccd(0x142)]=_0x2be8bf;return{'ok':!![],'data':_0x48b1a5,'message':'Deleted\x20'+_0x52235c+(_0x2be8bf?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function a185_0x284c(_0xd665f6,_0x502257){_0xd665f6=_0xd665f6-0x12a;const _0x2650df=a185_0x2650();let _0x284c1e=_0x2650df[_0xd665f6];return _0x284c1e;}async function moveToTrash(_0x1efa48,_0x267e75,_0x210c83){const _0x397edc=a185_0x1d39d,_0xed9213=new Date()[_0x397edc(0x14a)]()[_0x397edc(0x137)](/[:.]/g,'-'),_0x3e5abd=relative(_0x1efa48,_0x210c83),_0xcf4800=join(_0x267e75,_0xed9213,_0x3e5abd);return await mkdir(dirname(_0xcf4800),{'recursive':!![]}),await rename(_0x210c83,_0xcf4800),_0xcf4800;}async function cleanupEmptyDirectories(_0x4da1d9,_0xbe7086){const _0x4b6ca3=a185_0x1d39d;let _0x4b24b7=resolve(_0x4da1d9);const _0x1ffb57=resolve(_0xbe7086);while(_0x4b24b7[_0x4b6ca3(0x13e)](''+_0x1ffb57+sep)||_0x4b24b7===_0x1ffb57){if(_0x4b24b7===_0x1ffb57)return;try{const _0x5262b0=await readdir(_0x4b24b7);if(_0x5262b0['length']>0x0)return;await rmdir(_0x4b24b7);}catch{return;}_0x4b24b7=dirname(_0x4b24b7);}}
1
+ const a186_0x46bc0b=a186_0x4432;(function(_0x2fbf3e,_0x5be8ad){const _0xe0e27e=a186_0x4432,_0x324944=_0x2fbf3e();while(!![]){try{const _0x606dea=-parseInt(_0xe0e27e(0x15e))/0x1+parseInt(_0xe0e27e(0x179))/0x2*(parseInt(_0xe0e27e(0x17d))/0x3)+-parseInt(_0xe0e27e(0x166))/0x4*(-parseInt(_0xe0e27e(0x15c))/0x5)+-parseInt(_0xe0e27e(0x168))/0x6+parseInt(_0xe0e27e(0x165))/0x7+parseInt(_0xe0e27e(0x16a))/0x8*(-parseInt(_0xe0e27e(0x180))/0x9)+parseInt(_0xe0e27e(0x164))/0xa;if(_0x606dea===_0x5be8ad)break;else _0x324944['push'](_0x324944['shift']());}catch(_0x3e6689){_0x324944['push'](_0x324944['shift']());}}}(a186_0x15cb,0x8ba0a));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':a186_0x46bc0b(0x163),'command':a186_0x46bc0b(0x160),'description':a186_0x46bc0b(0x172),'risk':a186_0x46bc0b(0x17a),'flags':[SQLCODE_FLAG],async 'validate'(_0x23c5b2){const _0x616e80=a186_0x46bc0b,_0x19d0d1=loadSqlProjectConfig(_0x23c5b2[_0x616e80(0x171)]),_0x49d8fb=await readSqlLockFile(_0x19d0d1[_0x616e80(0x15d)]);if(!_0x49d8fb)throw CliErrors[_0x616e80(0x15f)](_0x616e80(0x17c));},async 'dryRun'(_0x3c79ec){const _0x18449c=a186_0x46bc0b,_0x5da00e=loadSqlProjectConfig(_0x3c79ec[_0x18449c(0x171)]),_0x191ac7=await readSqlLockFile(_0x5da00e['lockFilePath']);if(!_0x191ac7)throw CliErrors[_0x18449c(0x15f)](_0x18449c(0x17c));const {appLock:_0x1bcd14}=ensureSqlLockScope(_0x191ac7,_0x3c79ec[_0x18449c(0x171)],_0x5da00e[_0x18449c(0x162)],_0x18449c(0x160)),_0x6b05dc=_0x3c79ec['str']('sqlcode'),_0x3fb26e=_0x1bcd14[_0x18449c(0x169)][_0x6b05dc];if(!_0x3fb26e)throw CliErrors[_0x18449c(0x15f)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x6b05dc+'\x22.');return{'method':_0x18449c(0x173),'url':_0x18449c(0x181),'body':{'sqlCode':_0x6b05dc,'id':_0x3fb26e[_0x18449c(0x16f)],'localPath':resolveLocalSqlFilePath(_0x5da00e,_0x6b05dc,_0x3fb26e)},'description':_0x18449c(0x167)+_0x6b05dc+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x5da00e['trashDir']};},async 'execute'(_0x3726a3){const _0xef18b5=a186_0x46bc0b,_0x4968f3=loadSqlProjectConfig(_0x3726a3['appCode']),_0x3cab7e=await readSqlLockFile(_0x4968f3['lockFilePath']);if(!_0x3cab7e)throw CliErrors[_0xef18b5(0x15f)](_0xef18b5(0x17f));const {lockData:_0x535eec,appLock:_0x420614}=ensureSqlLockScope(_0x3cab7e,_0x3726a3[_0xef18b5(0x171)],_0x4968f3[_0xef18b5(0x162)],_0xef18b5(0x160)),_0x2ab3f0=_0x3726a3[_0xef18b5(0x16b)](_0xef18b5(0x176)),_0x1d2438=_0x420614[_0xef18b5(0x169)][_0x2ab3f0];if(!_0x1d2438)throw CliErrors['validation']('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x2ab3f0+'\x22.');await deleteSqlQuery({'id':_0x1d2438[_0xef18b5(0x16f)],'sqlCode':_0x2ab3f0}),_0x420614[_0xef18b5(0x169)]=Object['fromEntries'](Object['entries'](_0x420614[_0xef18b5(0x169)])[_0xef18b5(0x170)](([_0x301764])=>_0x301764!==_0x2ab3f0)),_0x420614[_0xef18b5(0x17e)]=new Date()[_0xef18b5(0x17b)](),await writeSqlLockFile(_0x4968f3['lockFilePath'],_0x535eec);const _0x2fd083=resolveLocalSqlFilePath(_0x4968f3,_0x2ab3f0,_0x1d2438);let _0x16693c;await fileExists(_0x2fd083)&&(_0x16693c=await moveToTrash(_0x4968f3[_0xef18b5(0x16d)],_0x4968f3[_0xef18b5(0x174)],_0x2fd083),await cleanupEmptyDirectories(dirname(_0x2fd083),_0x4968f3[_0xef18b5(0x178)]));const _0x497468={'deleted':_0x2ab3f0,'remoteId':_0x1d2438[_0xef18b5(0x16f)]};if(_0x16693c)_0x497468[_0xef18b5(0x177)]=_0x16693c;return{'ok':!![],'data':_0x497468,'message':_0xef18b5(0x16e)+_0x2ab3f0+(_0x16693c?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x2891f,_0x597f3c,_0x227552){const _0x44677a=a186_0x46bc0b,_0x58f624=new Date()[_0x44677a(0x17b)]()[_0x44677a(0x16c)](/[:.]/g,'-'),_0x173c10=relative(_0x2891f,_0x227552),_0x629293=join(_0x597f3c,_0x58f624,_0x173c10);return await mkdir(dirname(_0x629293),{'recursive':!![]}),await rename(_0x227552,_0x629293),_0x629293;}async function cleanupEmptyDirectories(_0x3e9838,_0x2bcc77){const _0x3858f0=a186_0x46bc0b;let _0x2c266f=resolve(_0x3e9838);const _0x25d035=resolve(_0x2bcc77);while(_0x2c266f[_0x3858f0(0x161)](''+_0x25d035+sep)||_0x2c266f===_0x25d035){if(_0x2c266f===_0x25d035)return;try{const _0x1be799=await readdir(_0x2c266f);if(_0x1be799[_0x3858f0(0x175)]>0x0)return;await rmdir(_0x2c266f);}catch{return;}_0x2c266f=dirname(_0x2c266f);}}function a186_0x4432(_0x3e21bd,_0x46c7d0){_0x3e21bd=_0x3e21bd-0x15c;const _0x15cb3d=a186_0x15cb();let _0x44324f=_0x15cb3d[_0x3e21bd];return _0x44324f;}function a186_0x15cb(){const _0x36f4d9=['replace','projectRoot','Deleted\x20','remoteId','filter','appCode','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','POST','trashDir','length','sqlcode','trashedTo','sqlRootDir','16jATIVo','high-risk-write','toISOString','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','5112NEWPcx','lastSync','SQL\x20lock\x20file\x20not\x20found.','285066eCHcUY','/smartapi/custom/deleteUserCustomSql','5cEunGT','lockFilePath','791289IdEWzQ','validation','delete','startsWith','sqlRoot','sql','15731090FeWynD','1597918ddUeRH','2235764xXnleZ','Would\x20delete\x20SQL\x20','4544166woRZGW','sqls','64ywoKoG','str'];a186_0x15cb=function(){return _0x36f4d9;};return a186_0x15cb();}
@@ -1 +1 @@
1
- function a186_0x1e83(){const _0x34a696=['43460oWpnuD','4411631FFOkFu','3051276xThico','393LZDqyo','9NupkeS','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','8TkyEZY','description','5121112tqtpwt','sqlcode','str','sqlCode','sqlContent','verbose','dbId','1397lndGRc','appCode','13672IsnyKL','detail','69557TvHVYf','sql','boolean','Return\x20full\x20raw\x20SQL\x20query\x20object','6NTJMSc','2386645nKCMSl'];a186_0x1e83=function(){return _0x34a696;};return a186_0x1e83();}const a186_0x1ddddb=a186_0xb037;(function(_0x1fb993,_0x331649){const _0x419169=a186_0xb037,_0x10d03d=_0x1fb993();while(!![]){try{const _0x2af801=parseInt(_0x419169(0x1ab))/0x1*(-parseInt(_0x419169(0x1b7))/0x2)+-parseInt(_0x419169(0x1b4))/0x3*(-parseInt(_0x419169(0x1a9))/0x4)+-parseInt(_0x419169(0x1b0))/0x5*(-parseInt(_0x419169(0x1af))/0x6)+parseInt(_0x419169(0x1b2))/0x7+-parseInt(_0x419169(0x1a0))/0x8*(parseInt(_0x419169(0x1b5))/0x9)+-parseInt(_0x419169(0x1b1))/0xa*(parseInt(_0x419169(0x1a7))/0xb)+parseInt(_0x419169(0x1b3))/0xc;if(_0x2af801===_0x331649)break;else _0x10d03d['push'](_0x10d03d['shift']());}catch(_0x470eb6){_0x10d03d['push'](_0x10d03d['shift']());}}}(a186_0x1e83,0x52d54));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a186_0xb037(_0x3c94ac,_0x2d120c){_0x3c94ac=_0x3c94ac-0x19f;const _0x1e83b9=a186_0x1e83();let _0xb037=_0x1e83b9[_0x3c94ac];return _0xb037;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a186_0x1ddddb(0x1ac),'command':a186_0x1ddddb(0x1aa),'description':a186_0x1ddddb(0x1b6),'risk':'read','flags':[SQLCODE_FLAG,{'name':'verbose','type':a186_0x1ddddb(0x1ad),'description':a186_0x1ddddb(0x1ae)}],async 'execute'(_0x4868cd){const _0xe0a63f=a186_0x1ddddb,_0x4b3ae3=await getSqlQueryInfo(_0x4868cd[_0xe0a63f(0x1a8)],_0x4868cd[_0xe0a63f(0x1a2)](_0xe0a63f(0x1a1))),_0x3f67ea=_0x4868cd['bool'](_0xe0a63f(0x1a5));if(_0x3f67ea)return{'ok':!![],'data':_0x4b3ae3};const _0x336c29=_0x4b3ae3['dbId']?await getDbName(_0x4868cd['appCode'],_0x4b3ae3[_0xe0a63f(0x1a6)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x4b3ae3[_0xe0a63f(0x1a3)],'sqlName':_0x4b3ae3['sqlName'],'db':_0x336c29?_0x336c29+'\x20('+_0x4b3ae3[_0xe0a63f(0x1a6)]+')':_0x4b3ae3[_0xe0a63f(0x1a6)]??'','description':_0x4b3ae3[_0xe0a63f(0x19f)]??'','sqlContent':_0x4b3ae3[_0xe0a63f(0x1a4)]??''}};}};
1
+ const a187_0x124bec=a187_0x5bbd;function a187_0x5bbd(_0x1222d3,_0x58ce14){_0x1222d3=_0x1222d3-0x156;const _0x3cf053=a187_0x3cf0();let _0x5bbdf5=_0x3cf053[_0x1222d3];return _0x5bbdf5;}(function(_0x179a48,_0x5e906f){const _0x31aa33=a187_0x5bbd,_0x5a88ee=_0x179a48();while(!![]){try{const _0x34697a=-parseInt(_0x31aa33(0x163))/0x1*(-parseInt(_0x31aa33(0x15c))/0x2)+parseInt(_0x31aa33(0x158))/0x3*(parseInt(_0x31aa33(0x168))/0x4)+parseInt(_0x31aa33(0x166))/0x5+parseInt(_0x31aa33(0x157))/0x6*(-parseInt(_0x31aa33(0x15f))/0x7)+-parseInt(_0x31aa33(0x161))/0x8+-parseInt(_0x31aa33(0x169))/0x9+-parseInt(_0x31aa33(0x15b))/0xa*(-parseInt(_0x31aa33(0x15a))/0xb);if(_0x34697a===_0x5e906f)break;else _0x5a88ee['push'](_0x5a88ee['shift']());}catch(_0xf8dc07){_0x5a88ee['push'](_0x5a88ee['shift']());}}}(a187_0x3cf0,0xdd607));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a187_0x3cf0(){const _0x14bdfd=['sqlName','167256rRWqGe','3RplplT','dbId','23726857dzmPjJ','10KWosRa','4SgNLLe','detail','sqlContent','175LEsXCe','verbose','10491848WfvPqv','str','80657fDElce','read','Return\x20full\x20raw\x20SQL\x20query\x20object','4678395EzlWDG','sqlcode','5271172MimmHp','14909697fnmfPA'];a187_0x3cf0=function(){return _0x14bdfd;};return a187_0x3cf0();}export const sqlDetail={'service':'sql','command':a187_0x124bec(0x15d),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a187_0x124bec(0x164),'flags':[SQLCODE_FLAG,{'name':a187_0x124bec(0x160),'type':'boolean','description':a187_0x124bec(0x165)}],async 'execute'(_0x1f933c){const _0x162963=a187_0x124bec,_0x403692=await getSqlQueryInfo(_0x1f933c['appCode'],_0x1f933c[_0x162963(0x162)](_0x162963(0x167))),_0x287c43=_0x1f933c['bool'](_0x162963(0x160));if(_0x287c43)return{'ok':!![],'data':_0x403692};const _0x3ee419=_0x403692[_0x162963(0x159)]?await getDbName(_0x1f933c['appCode'],_0x403692[_0x162963(0x159)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x403692['sqlCode'],'sqlName':_0x403692[_0x162963(0x156)],'db':_0x3ee419?_0x3ee419+'\x20('+_0x403692[_0x162963(0x159)]+')':_0x403692[_0x162963(0x159)]??'','description':_0x403692['description']??'','sqlContent':_0x403692[_0x162963(0x15e)]??''}};}};
@@ -1 +1 @@
1
- function a187_0x5424(_0x243417,_0x1b0450){_0x243417=_0x243417-0x1a8;const _0x3fa187=a187_0x3fa1();let _0x5424ba=_0x3fa187[_0x243417];return _0x5424ba;}const a187_0x195718=a187_0x5424;(function(_0x59c1a3,_0x2ea945){const _0x332af6=a187_0x5424,_0x23ce71=_0x59c1a3();while(!![]){try{const _0x5633f0=-parseInt(_0x332af6(0x1bb))/0x1+parseInt(_0x332af6(0x1af))/0x2*(-parseInt(_0x332af6(0x1b3))/0x3)+-parseInt(_0x332af6(0x1ab))/0x4+-parseInt(_0x332af6(0x1b5))/0x5*(parseInt(_0x332af6(0x1a8))/0x6)+-parseInt(_0x332af6(0x1b2))/0x7+parseInt(_0x332af6(0x1b6))/0x8*(-parseInt(_0x332af6(0x1b7))/0x9)+parseInt(_0x332af6(0x1b1))/0xa*(parseInt(_0x332af6(0x1b9))/0xb);if(_0x5633f0===_0x2ea945)break;else _0x23ce71['push'](_0x23ce71['shift']());}catch(_0x2b8411){_0x23ce71['push'](_0x23ce71['shift']());}}}(a187_0x3fa1,0x5c89a));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a187_0x3fa1(){const _0xb3ce1c=['55vTyTXS','16DTdWLB','1889919SizkEh','sql','5863286rZjHPD','str','177644rjFKpV','execError','string','length','read','Returned\x20','execSuccess','sqlcode','293052uArAov','isArray','now','2780452XFWTXu','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','execResult','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','1804BAgcjm','params','60wbCkgF','2264115JPoscb','2214SWxuQi','SQL\x20execution\x20failed'];a187_0x3fa1=function(){return _0xb3ce1c;};return a187_0x3fa1();}export const sqlExec={'service':a187_0x195718(0x1b8),'command':'exec','description':a187_0x195718(0x1ac),'risk':a187_0x195718(0x1bf),'flags':[SQLCODE_FLAG,{'name':a187_0x195718(0x1b0),'type':a187_0x195718(0x1bd),'description':a187_0x195718(0x1ae)}],async 'execute'(_0x219c08){const _0xf96fa5=a187_0x195718,_0x189fc7=parseJsonParams(_0x219c08[_0xf96fa5(0x1ba)](_0xf96fa5(0x1b0))),_0x27dbaf=Date[_0xf96fa5(0x1aa)](),_0x14becd=await executeSql(_0x219c08['appCode'],_0x219c08[_0xf96fa5(0x1ba)](_0xf96fa5(0x1c2)),_0x189fc7),_0x430308=Date[_0xf96fa5(0x1aa)]()-_0x27dbaf,_0x1cb88a=_0x14becd?.[_0xf96fa5(0x1ad)]??_0x14becd,_0x4f0239=_0x14becd?.[_0xf96fa5(0x1c1)]??!![];if(!_0x4f0239)return{'ok':![],'data':{'error':_0x14becd?.[_0xf96fa5(0x1bc)]||'SQL\x20execution\x20failed','elapsed':_0x430308},'message':_0xf96fa5(0x1b4)};const _0x27a855=Array[_0xf96fa5(0x1a9)](_0x1cb88a)?_0x1cb88a:[];return{'ok':!![],'data':{'rows':_0x27a855,'rowCount':_0x27a855[_0xf96fa5(0x1be)],'elapsed':_0x430308},'message':_0xf96fa5(0x1c0)+_0x27a855['length']+'\x20row(s)\x20in\x20'+_0x430308+'ms'};}};
1
+ const a188_0x16d873=a188_0x4073;function a188_0x2c24(){const _0x3987d1=['length','4945888RkGkTR','sql','34400BpVHut','exec','9YQObTH','4854400sqkmjY','read','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','66kqCUUq','execResult','\x20row(s)\x20in\x20','1460374RzqNkk','20BArRvs','sqlcode','isArray','now','str','5785374KQRuoK','1574947jHRUup','150DOdHck','SQL\x20execution\x20failed','execSuccess','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','appCode','string','46754qAEcZF','params'];a188_0x2c24=function(){return _0x3987d1;};return a188_0x2c24();}(function(_0x24d050,_0x57d749){const _0x2f5d09=a188_0x4073,_0x48379a=_0x24d050();while(!![]){try{const _0x581f14=parseInt(_0x2f5d09(0x179))/0x1+-parseInt(_0x2f5d09(0x187))/0x2*(-parseInt(_0x2f5d09(0x181))/0x3)+-parseInt(_0x2f5d09(0x16e))/0x4+-parseInt(_0x2f5d09(0x170))/0x5*(parseInt(_0x2f5d09(0x176))/0x6)+-parseInt(_0x2f5d09(0x17f))/0x7+-parseInt(_0x2f5d09(0x173))/0x8*(-parseInt(_0x2f5d09(0x172))/0x9)+parseInt(_0x2f5d09(0x17a))/0xa*(-parseInt(_0x2f5d09(0x180))/0xb);if(_0x581f14===_0x57d749)break;else _0x48379a['push'](_0x48379a['shift']());}catch(_0x5232e1){_0x48379a['push'](_0x48379a['shift']());}}}(a188_0x2c24,0xc601c));function a188_0x4073(_0x40040a,_0x395ba8){_0x40040a=_0x40040a-0x16e;const _0x2c2467=a188_0x2c24();let _0x4073c3=_0x2c2467[_0x40040a];return _0x4073c3;}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':a188_0x16d873(0x16f),'command':a188_0x16d873(0x171),'description':a188_0x16d873(0x184),'risk':a188_0x16d873(0x174),'flags':[SQLCODE_FLAG,{'name':a188_0x16d873(0x188),'type':a188_0x16d873(0x186),'description':a188_0x16d873(0x175)}],async 'execute'(_0x3a1dcc){const _0x399808=a188_0x16d873,_0x5e2e05=parseJsonParams(_0x3a1dcc['str']('params')),_0x332017=Date[_0x399808(0x17d)](),_0x4272bb=await executeSql(_0x3a1dcc[_0x399808(0x185)],_0x3a1dcc[_0x399808(0x17e)](_0x399808(0x17b)),_0x5e2e05),_0x42b778=Date['now']()-_0x332017,_0xe11103=_0x4272bb?.[_0x399808(0x177)]??_0x4272bb,_0x9aa2ec=_0x4272bb?.[_0x399808(0x183)]??!![];if(!_0x9aa2ec)return{'ok':![],'data':{'error':_0x4272bb?.['execError']||_0x399808(0x182),'elapsed':_0x42b778},'message':_0x399808(0x182)};const _0xd1c78f=Array[_0x399808(0x17c)](_0xe11103)?_0xe11103:[];return{'ok':!![],'data':{'rows':_0xd1c78f,'rowCount':_0xd1c78f['length'],'elapsed':_0x42b778},'message':'Returned\x20'+_0xd1c78f[_0x399808(0x189)]+_0x399808(0x178)+_0x42b778+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x978098,_0xbcf4e5){const _0xc7a62c=a188_0x3ab2,_0x538d45=_0x978098();while(!![]){try{const _0xb6e4d3=parseInt(_0xc7a62c(0x16e))/0x1+parseInt(_0xc7a62c(0x16d))/0x2*(parseInt(_0xc7a62c(0x16a))/0x3)+-parseInt(_0xc7a62c(0x16f))/0x4+-parseInt(_0xc7a62c(0x172))/0x5*(parseInt(_0xc7a62c(0x171))/0x6)+parseInt(_0xc7a62c(0x173))/0x7*(parseInt(_0xc7a62c(0x16c))/0x8)+-parseInt(_0xc7a62c(0x169))/0x9*(-parseInt(_0xc7a62c(0x16b))/0xa)+-parseInt(_0xc7a62c(0x170))/0xb;if(_0xb6e4d3===_0xbcf4e5)break;else _0x538d45['push'](_0x538d45['shift']());}catch(_0x42522c){_0x538d45['push'](_0x538d45['shift']());}}}(a188_0x31cf,0x3e0d2));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';function a188_0x31cf(){const _0x6f8129=['8197tCubnZ','134622hPNlXO','315483fELxbj','100OnpyNC','1928KCHsRc','6wKwTHw','257040nFkcFQ','1212268XvWZTM','892628UibTIJ','731874eQgYHV','15IRowin'];a188_0x31cf=function(){return _0x6f8129;};return a188_0x31cf();}import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';function a188_0x3ab2(_0x40586e,_0x3aff80){_0x40586e=_0x40586e-0x169;const _0x31cf97=a188_0x31cf();let _0x3ab206=_0x31cf97[_0x40586e];return _0x3ab206;}import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x28a6ef,_0x2934f9){const _0xc88a3f=a189_0x37a6,_0x45fc51=_0x28a6ef();while(!![]){try{const _0x571f70=-parseInt(_0xc88a3f(0xb6))/0x1*(parseInt(_0xc88a3f(0xb1))/0x2)+-parseInt(_0xc88a3f(0xae))/0x3*(-parseInt(_0xc88a3f(0xb3))/0x4)+parseInt(_0xc88a3f(0xad))/0x5+-parseInt(_0xc88a3f(0xb2))/0x6*(parseInt(_0xc88a3f(0xb7))/0x7)+-parseInt(_0xc88a3f(0xaf))/0x8+parseInt(_0xc88a3f(0xb5))/0x9*(-parseInt(_0xc88a3f(0xac))/0xa)+-parseInt(_0xc88a3f(0xb4))/0xb*(-parseInt(_0xc88a3f(0xb0))/0xc);if(_0x571f70===_0x2934f9)break;else _0x45fc51['push'](_0x45fc51['shift']());}catch(_0x4027c9){_0x45fc51['push'](_0x45fc51['shift']());}}}(a189_0x3e1f,0x3e892));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 a189_0x3e1f(){const _0x3b43c4=['12qSTaJE','2043064VvHDZH','3960DrroTU','614DEvXaK','42VgTUwu','166740XYcaQa','11682IgEeft','2586456mNUWGR','1CRSigG','207291wcnhvk','10HkHEuM','2446555vcWXbU'];a189_0x3e1f=function(){return _0x3b43c4;};return a189_0x3e1f();}function a189_0x37a6(_0x18e973,_0x150ddc){_0x18e973=_0x18e973-0xac;const _0x3e1fd6=a189_0x3e1f();let _0x37a638=_0x3e1fd6[_0x18e973];return _0x37a638;}import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- function a189_0x424e(_0x5351f8,_0x2f8e42){_0x5351f8=_0x5351f8-0x7e;const _0x49096d=a189_0x4909();let _0x424e4a=_0x49096d[_0x5351f8];return _0x424e4a;}const a189_0x14ab82=a189_0x424e;(function(_0x12aee0,_0x370afd){const _0x53b692=a189_0x424e,_0x4a20cb=_0x12aee0();while(!![]){try{const _0x2d5679=-parseInt(_0x53b692(0x97))/0x1*(-parseInt(_0x53b692(0x8f))/0x2)+-parseInt(_0x53b692(0x9a))/0x3+parseInt(_0x53b692(0x94))/0x4*(parseInt(_0x53b692(0x87))/0x5)+parseInt(_0x53b692(0x9e))/0x6+parseInt(_0x53b692(0x80))/0x7*(-parseInt(_0x53b692(0x8a))/0x8)+parseInt(_0x53b692(0xa0))/0x9*(parseInt(_0x53b692(0x85))/0xa)+-parseInt(_0x53b692(0x89))/0xb;if(_0x2d5679===_0x370afd)break;else _0x4a20cb['push'](_0x4a20cb['shift']());}catch(_0x5b5d4e){_0x4a20cb['push'](_0x4a20cb['shift']());}}}(a189_0x4909,0xf0a32));import{listSqlQueries}from'../../core/api-client.js';function a189_0x4909(){const _0x334e28=['Page\x20size','10UrOBnU','Filter\x20by\x20SQL\x20name','102065OAbApQ','\x20SQL\x20queries\x20(total:\x20','3362502TDCUJF','600ljwCDY','verbose','paging','Found\x20','List\x20custom\x20SQL\x20queries','2061846YOjwqM','map','str','No\x20custom\x20SQL\x20queries\x20found.','sqlCode','148HziVjk','sqlcode','description','1PCzDbL','num','list','3078171iCWeCF','read','all','number','10886802LahlFe','length','1053387VisxTm','totalCount','Page\x20number','130697POAiec','name','dbId','appCode'];a189_0x4909=function(){return _0x334e28;};return a189_0x4909();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a189_0x14ab82(0x99),'description':a189_0x14ab82(0x8e),'risk':a189_0x14ab82(0x9b),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a189_0x14ab82(0x81),'type':'string','description':a189_0x14ab82(0x86)},{'name':'page','type':a189_0x14ab82(0x9d),'description':a189_0x14ab82(0x7f),'default':0x1},{'name':'pagesize','type':a189_0x14ab82(0x9d),'description':a189_0x14ab82(0x84)},{'name':a189_0x14ab82(0x8b),'type':'boolean','description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x5bae8b){const _0x5b5159=a189_0x14ab82,_0x3a65c7=await listSqlQueries(_0x5bae8b[_0x5b5159(0x83)],{'sqlCode':_0x5bae8b[_0x5b5159(0x91)](_0x5b5159(0x95))||undefined,'sqlName':_0x5bae8b[_0x5b5159(0x91)]('name')||undefined,'currentPage':_0x5bae8b[_0x5b5159(0x98)]('page'),'pageSize':_0x5bae8b['num']('pagesize',0x32)}),_0x5208a=_0x5bae8b['bool'](_0x5b5159(0x8b)),_0x4d066a=_0x3a65c7['tableData']??[],_0x18e3a5=_0x3a65c7[_0x5b5159(0x8c)]?.[_0x5b5159(0x7e)]??_0x4d066a[_0x5b5159(0x9f)];let _0x1fbfe3;return _0x5208a?_0x1fbfe3=_0x4d066a:_0x1fbfe3=await Promise[_0x5b5159(0x9c)](_0x4d066a[_0x5b5159(0x90)](async _0x59caa1=>{const _0x484651=_0x5b5159;let _0x3e3fa5;try{_0x3e3fa5=_0x59caa1['dbId']?await getDbName(_0x5bae8b['appCode'],_0x59caa1['dbId']):undefined;}catch{}return{'sqlCode':_0x59caa1[_0x484651(0x93)],'sqlName':_0x59caa1['sqlName'],'description':_0x59caa1[_0x484651(0x96)]??'','db':_0x3e3fa5?_0x3e3fa5+'\x20('+_0x59caa1['dbId']+')':_0x59caa1[_0x484651(0x82)]??''};})),{'ok':!![],'data':_0x1fbfe3,'message':_0x4d066a[_0x5b5159(0x9f)]===0x0?_0x5b5159(0x92):_0x5b5159(0x8d)+_0x4d066a[_0x5b5159(0x9f)]+_0x5b5159(0x88)+_0x18e3a5+').'};}};
1
+ const a190_0x5b3b08=a190_0x3748;function a190_0x3748(_0xe6696,_0x34ee5f){_0xe6696=_0xe6696-0xf2;const _0xe644c5=a190_0xe644();let _0x374882=_0xe644c5[_0xe6696];return _0x374882;}(function(_0xd519e7,_0x2de6ef){const _0x575667=a190_0x3748,_0x53f009=_0xd519e7();while(!![]){try{const _0x4d3c8d=parseInt(_0x575667(0x113))/0x1+-parseInt(_0x575667(0x10f))/0x2*(-parseInt(_0x575667(0x105))/0x3)+-parseInt(_0x575667(0x102))/0x4+-parseInt(_0x575667(0x103))/0x5+-parseInt(_0x575667(0x116))/0x6*(-parseInt(_0x575667(0xf7))/0x7)+-parseInt(_0x575667(0x106))/0x8*(-parseInt(_0x575667(0xf2))/0x9)+-parseInt(_0x575667(0x117))/0xa;if(_0x4d3c8d===_0x2de6ef)break;else _0x53f009['push'](_0x53f009['shift']());}catch(_0x213f7e){_0x53f009['push'](_0x53f009['shift']());}}}(a190_0xe644,0x2a8cf));import{listSqlQueries}from'../../core/api-client.js';function a190_0xe644(){const _0xcc6f8d=['number','paging','30ffTGBU','1838260nmckPQ','544176vzUFBZ','length','Filter\x20by\x20SQL\x20name','sql','name','429296oAvOdN','Page\x20size','verbose','num','sqlName','\x20SQL\x20queries\x20(total:\x20','Page\x20number','sqlCode','page','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','string','1095720KzqZgb','271835iAWmjf','description','34653CEhnsN','16DiEDfu','appCode','dbId','list','sqlcode','str','List\x20custom\x20SQL\x20queries','totalCount','pagesize','6IwioPQ','read','No\x20custom\x20SQL\x20queries\x20found.','tableData','224189CNmxea'];a190_0xe644=function(){return _0xcc6f8d;};return a190_0xe644();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a190_0x5b3b08(0xf5),'command':a190_0x5b3b08(0x109),'description':a190_0x5b3b08(0x10c),'risk':a190_0x5b3b08(0x110),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a190_0x5b3b08(0xf6),'type':a190_0x5b3b08(0x101),'description':a190_0x5b3b08(0xf4)},{'name':a190_0x5b3b08(0xff),'type':a190_0x5b3b08(0x114),'description':a190_0x5b3b08(0xfd),'default':0x1},{'name':a190_0x5b3b08(0x10e),'type':a190_0x5b3b08(0x114),'description':a190_0x5b3b08(0xf8)},{'name':a190_0x5b3b08(0xf9),'type':'boolean','description':a190_0x5b3b08(0x100)}],async 'execute'(_0x1b27c2){const _0x35c8e4=a190_0x5b3b08,_0xba770c=await listSqlQueries(_0x1b27c2[_0x35c8e4(0x107)],{'sqlCode':_0x1b27c2[_0x35c8e4(0x10b)](_0x35c8e4(0x10a))||undefined,'sqlName':_0x1b27c2[_0x35c8e4(0x10b)](_0x35c8e4(0xf6))||undefined,'currentPage':_0x1b27c2[_0x35c8e4(0xfa)]('page'),'pageSize':_0x1b27c2[_0x35c8e4(0xfa)](_0x35c8e4(0x10e),0x32)}),_0x165fb8=_0x1b27c2['bool'](_0x35c8e4(0xf9)),_0x15f560=_0xba770c[_0x35c8e4(0x112)]??[],_0x2dbc92=_0xba770c[_0x35c8e4(0x115)]?.[_0x35c8e4(0x10d)]??_0x15f560['length'];let _0x5fac66;return _0x165fb8?_0x5fac66=_0x15f560:_0x5fac66=await Promise['all'](_0x15f560['map'](async _0x191e02=>{const _0x5e8034=_0x35c8e4;let _0x3ac131;try{_0x3ac131=_0x191e02[_0x5e8034(0x108)]?await getDbName(_0x1b27c2['appCode'],_0x191e02[_0x5e8034(0x108)]):undefined;}catch{}return{'sqlCode':_0x191e02[_0x5e8034(0xfe)],'sqlName':_0x191e02[_0x5e8034(0xfb)],'description':_0x191e02[_0x5e8034(0x104)]??'','db':_0x3ac131?_0x3ac131+'\x20('+_0x191e02[_0x5e8034(0x108)]+')':_0x191e02[_0x5e8034(0x108)]??''};})),{'ok':!![],'data':_0x5fac66,'message':_0x15f560[_0x35c8e4(0xf3)]===0x0?_0x35c8e4(0x111):'Found\x20'+_0x15f560[_0x35c8e4(0xf3)]+_0x35c8e4(0xfc)+_0x2dbc92+').'};}};
@@ -1 +1 @@
1
- const a190_0x104622=a190_0x1389;(function(_0x25eb5c,_0x1f5cdf){const _0x2a3ea8=a190_0x1389,_0x4968a1=_0x25eb5c();while(!![]){try{const _0x16fe1e=-parseInt(_0x2a3ea8(0x12c))/0x1+-parseInt(_0x2a3ea8(0x12a))/0x2+parseInt(_0x2a3ea8(0xfd))/0x3*(-parseInt(_0x2a3ea8(0x127))/0x4)+-parseInt(_0x2a3ea8(0x11f))/0x5*(-parseInt(_0x2a3ea8(0x120))/0x6)+parseInt(_0x2a3ea8(0x11d))/0x7+-parseInt(_0x2a3ea8(0x10f))/0x8+parseInt(_0x2a3ea8(0x114))/0x9*(parseInt(_0x2a3ea8(0x108))/0xa);if(_0x16fe1e===_0x1f5cdf)break;else _0x4968a1['push'](_0x4968a1['shift']());}catch(_0x359ef1){_0x4968a1['push'](_0x4968a1['shift']());}}}(a190_0x4f87,0x6bd72));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';function a190_0x1389(_0x1916f8,_0x8f70fd){_0x1916f8=_0x1916f8-0xfd;const _0x4f870c=a190_0x4f87();let _0x13898b=_0x4f870c[_0x1916f8];return _0x13898b;}function a190_0x4f87(){const _0x84a589=['filter','2058355QmqIdk','6dnRadV','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','sqlRoot','dbId','bool','sqlcode','1258052xHWyge','description','str','1583260GMZNgQ','sqls','325912PgNWza','totalCount','lastSync','replace','path','\x20failed','sqlCode','push','string','catch','appCode','Would\x20pull\x20','pull','3YmeSJN','sqlRootDir','lockFilePath','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','local\x20differs\x20from\x20remote','\x20skipped,\x20','utf8','message','\x20SQL\x20file(s)\x20into\x20','sqlName','boolean','5270VzMKYz','\x20written,\x20','toISOString','split','trimStart','would_pull','conflict','6300264OJrhwA','Force\x20pull\x20cancelled.','test','Filter\x20by\x20SQL\x20display\x20name','force','24039IhSgBm','cancelled','sql','length','name','unchanged','join','mybatisXml','tableData','5894098lfcptm'];a190_0x4f87=function(){return _0x84a589;};return a190_0x4f87();}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(_0x2ef6fd,_0x1052b0){const _0x2c992a=a190_0x1389,_0x259b64=[];let _0x3a7fed=0x1;while(!![]){const _0x2501d4=await listSqlQueries(_0x2ef6fd,{'currentPage':_0x3a7fed,'pageSize':PAGE_SIZE,'sqlCode':_0x1052b0[_0x2c992a(0x132)],'sqlName':_0x1052b0[_0x2c992a(0x106)]}),_0x4aa01e=_0x2501d4[_0x2c992a(0x11c)]??[];_0x259b64[_0x2c992a(0x133)](..._0x4aa01e);if(_0x4aa01e[_0x2c992a(0x117)]===0x0)break;const _0x12518a=_0x2501d4['paging']?.[_0x2c992a(0x12d)];if(_0x12518a!=null?_0x259b64[_0x2c992a(0x117)]>=_0x12518a:_0x4aa01e[_0x2c992a(0x117)]<PAGE_SIZE)break;_0x3a7fed++;}return _0x259b64;}async function ensureSqlContent(_0x1fe2dd){const _0x8cb3a6=a190_0x1389;if(_0x1fe2dd['sqlContent']!=null&&String(_0x1fe2dd['sqlContent'])[_0x8cb3a6(0x117)]>0x0)return _0x1fe2dd;return getSqlQueryDetail(_0x1fe2dd['sqlCode']);}export const sqlPull={'service':'sql','command':a190_0x104622(0x138),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a190_0x104622(0x118),'type':a190_0x104622(0x134),'description':a190_0x104622(0x112)},{'name':a190_0x104622(0x113),'type':a190_0x104622(0x107),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x46377f){const _0x140985=a190_0x104622,_0x15fd78=loadSqlProjectConfig(_0x46377f[_0x140985(0x136)]),_0x26ec60=await readSqlLockFile(_0x15fd78['lockFilePath']),{appLock:_0x442f19}=ensureSqlLockScope(_0x26ec60??createEmptySqlLock(),_0x15fd78[_0x140985(0x136)],_0x15fd78[_0x140985(0x123)],_0x140985(0x138)),_0x4b627e=await fetchAllSqlQueries(_0x46377f[_0x140985(0x136)],{'sqlCode':_0x46377f[_0x140985(0x129)](_0x140985(0x126))||undefined,'sqlName':_0x46377f[_0x140985(0x129)](_0x140985(0x118))||undefined}),_0x4a3091=[];for(const _0x5b04cd of _0x4b627e){const _0x2743ab=await ensureSqlContent(_0x5b04cd),_0x352b60=ensureRemoteSqlContent(_0x2743ab),_0x42ea8b=detectModeFromSql(_0x2743ab),_0x2b4e63=_0x2743ab[_0x140985(0x124)]?await getDbName(_0x46377f[_0x140985(0x136)],Number(_0x2743ab['dbId']))[_0x140985(0x135)](()=>undefined):undefined,_0x28330c=buildLocalSqlFileContent({'sqlCode':_0x2743ab[_0x140985(0x132)],'sqlName':_0x2743ab[_0x140985(0x106)],'dbId':_0x2743ab[_0x140985(0x124)]},_0x352b60,{'dbName':_0x2b4e63,'mode':_0x42ea8b,'syncedAt':new Date()['toISOString'](),'description':_0x2743ab[_0x140985(0x128)]}),_0x2a18f2=buildSqlLockEntry(_0x2743ab,_0x352b60,'',{'dbName':_0x2b4e63}),_0x404e40=resolveLocalSqlFilePath(_0x15fd78,_0x2743ab[_0x140985(0x132)],_0x2a18f2);let _0x46a4c3=_0x140985(0x10d),_0x2644f8;if(await fileExists(_0x404e40)){const _0x185cc5=await readFile(_0x404e40,'utf8');isEquivalentPulledSqlFile(_0x185cc5,_0x28330c,_0x42ea8b)?(_0x46a4c3='skipped',_0x2644f8=_0x140985(0x119)):(_0x46a4c3=_0x140985(0x10e),_0x2644f8=_0x140985(0x121));}_0x4a3091['push']({'sqlCode':_0x2743ab[_0x140985(0x132)],'sqlName':_0x2743ab['sqlName'],'filePath':_0x404e40,'status':_0x46a4c3,'reason':_0x2644f8});}return{'method':'POST','url':_0x140985(0x122),'body':{'appCode':_0x46377f['appCode'],'sqlCode':_0x46377f[_0x140985(0x129)](_0x140985(0x126))||null,'sqlName':_0x46377f[_0x140985(0x129)](_0x140985(0x118))||null,'files':_0x4a3091},'description':_0x140985(0x137)+_0x4a3091['length']+_0x140985(0x105)+_0x15fd78['sqlRootDir']};},async 'execute'(_0x3ab236){const _0x4d4415=a190_0x104622,_0x40af18=loadSqlProjectConfig(_0x3ab236[_0x4d4415(0x136)]),_0x3d7163=await readSqlLockFile(_0x40af18[_0x4d4415(0xff)]),{lockData:_0x52c383,appLock:_0x5d471}=ensureSqlLockScope(_0x3d7163??createEmptySqlLock(),_0x40af18['appCode'],_0x40af18['sqlRoot'],_0x4d4415(0x138)),_0x58bc89=_0x3ab236[_0x4d4415(0x125)](_0x4d4415(0x113)),_0x9b6eaf=await fetchAllSqlQueries(_0x3ab236[_0x4d4415(0x136)],{'sqlCode':_0x3ab236['str'](_0x4d4415(0x126))||undefined,'sqlName':_0x3ab236[_0x4d4415(0x129)](_0x4d4415(0x118))||undefined});if(_0x9b6eaf[_0x4d4415(0x117)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x5147f8=[],_0x685e4f=[];for(const _0x452689 of _0x9b6eaf){try{_0x5147f8['push'](await ensureSqlContent(_0x452689));}catch(_0x52898a){_0x685e4f[_0x4d4415(0x133)]({'sqlCode':_0x452689[_0x4d4415(0x132)],'error':_0x52898a instanceof Error?_0x52898a['message']:String(_0x52898a)});}}if(_0x58bc89&&!_0x3ab236['nonInteractive']){let _0x107d9d=![];for(const _0x2fb5ee of _0x5147f8){const _0x356bc8=detectModeFromSql(_0x2fb5ee),_0x414247=_0x2fb5ee[_0x4d4415(0x124)]?await getDbName(_0x3ab236[_0x4d4415(0x136)],Number(_0x2fb5ee[_0x4d4415(0x124)]))[_0x4d4415(0x135)](()=>undefined):undefined,_0xa27f68=buildLocalSqlFileContent({'sqlCode':_0x2fb5ee[_0x4d4415(0x132)],'sqlName':_0x2fb5ee[_0x4d4415(0x106)],'dbId':_0x2fb5ee[_0x4d4415(0x124)]},ensureRemoteSqlContent(_0x2fb5ee),{'dbName':_0x414247,'mode':_0x356bc8,'syncedAt':new Date()[_0x4d4415(0x10a)](),'description':_0x2fb5ee[_0x4d4415(0x128)]}),_0x2ffe68=resolveLocalSqlFilePath(_0x40af18,_0x2fb5ee[_0x4d4415(0x132)],buildSqlLockEntry(_0x2fb5ee,ensureRemoteSqlContent(_0x2fb5ee),'',{'dbName':_0x414247}));if(await fileExists(_0x2ffe68)){const _0x15bc27=await readFile(_0x2ffe68,_0x4d4415(0x103));if(!isEquivalentPulledSqlFile(_0x15bc27,_0xa27f68,_0x356bc8)){_0x107d9d=!![];break;}}}if(_0x107d9d){const _0x559b9e=await confirmForceOverwrite(_0x4d4415(0x100));if(!_0x559b9e)throw CliErrors[_0x4d4415(0x115)](_0x4d4415(0x110));}}const _0x16352e=cloneSqlLockData(_0x52c383),_0x35971d=_0x16352e['apps'][_0x40af18[_0x4d4415(0x136)]],_0x5b84fe=[],_0x3cd0a5=[];for(const _0x36543e of _0x5147f8){const _0x3a54a6=_0x35971d[_0x4d4415(0x12b)][_0x36543e[_0x4d4415(0x132)]],_0x511fab=ensureRemoteSqlContent(_0x36543e),_0x51b01c=detectModeFromSql(_0x36543e),_0x7e97d6=_0x36543e['dbId']?await getDbName(_0x3ab236[_0x4d4415(0x136)],Number(_0x36543e[_0x4d4415(0x124)]))[_0x4d4415(0x135)](()=>undefined):undefined,_0x38fe7a=buildLocalSqlFileContent({'sqlCode':_0x36543e['sqlCode'],'sqlName':_0x36543e[_0x4d4415(0x106)],'dbId':_0x36543e[_0x4d4415(0x124)]},_0x511fab,{'dbName':_0x7e97d6,'mode':_0x51b01c,'syncedAt':new Date()[_0x4d4415(0x10a)](),'description':_0x36543e[_0x4d4415(0x128)]}),_0x45cb1d=buildSqlLockEntry(_0x36543e,_0x511fab,computeSqlContentHash(_0x38fe7a),{'dbName':_0x7e97d6}),_0xcfba0a=_0x45cb1d['path'],_0x2e6fd4=join(_0x40af18[_0x4d4415(0xfe)],_0xcfba0a);try{if(await fileExists(_0x2e6fd4)){const _0x29feec=await readFile(_0x2e6fd4,_0x4d4415(0x103));if(isEquivalentPulledSqlFile(_0x29feec,_0x38fe7a,_0x51b01c)){_0x3cd0a5['push']({'sqlCode':_0x36543e['sqlCode'],'reason':_0x4d4415(0x119)}),_0x35971d[_0x4d4415(0x12b)][_0x36543e[_0x4d4415(0x132)]]={..._0x45cb1d,'hash':computeSqlContentHash(_0x29feec),'path':_0xcfba0a};continue;}if(!_0x58bc89){_0x3cd0a5[_0x4d4415(0x133)]({'sqlCode':_0x36543e[_0x4d4415(0x132)],'reason':_0x4d4415(0x101)});continue;}}const _0x165190=_0x3a54a6?.[_0x4d4415(0x130)]?join(_0x40af18[_0x4d4415(0xfe)],_0x3a54a6[_0x4d4415(0x130)]):undefined;_0x165190&&_0x165190!==_0x2e6fd4&&await fileExists(_0x165190)&&await rm(_0x165190,{'force':!![]}),await ensureParentDirectory(_0x2e6fd4),await writeFile(_0x2e6fd4,_0x38fe7a,_0x4d4415(0x103)),_0x35971d[_0x4d4415(0x12b)][_0x36543e['sqlCode']]={..._0x45cb1d,'path':_0xcfba0a},_0x5b84fe['push']({'sqlCode':_0x36543e[_0x4d4415(0x132)],'filePath':_0x2e6fd4});}catch(_0xe81f7c){_0x685e4f[_0x4d4415(0x133)]({'sqlCode':_0x36543e[_0x4d4415(0x132)],'error':_0xe81f7c instanceof Error?_0xe81f7c[_0x4d4415(0x104)]:String(_0xe81f7c)});}}return _0x35971d[_0x4d4415(0x12e)]=new Date()[_0x4d4415(0x10a)](),await writeSqlLockFile(_0x40af18[_0x4d4415(0xff)],_0x16352e),{'ok':_0x685e4f[_0x4d4415(0x117)]===0x0,'data':{'pulled':_0x5b84fe,'skipped':_0x3cd0a5,'failed':_0x685e4f},'message':'Pull\x20complete:\x20'+_0x5b84fe['length']+_0x4d4415(0x109)+_0x3cd0a5[_0x4d4415(0x117)]+_0x4d4415(0x102)+_0x685e4f[_0x4d4415(0x117)]+_0x4d4415(0x131)};}};function detectModeFromSql(_0x554d6b){const _0x4b98bf=a190_0x104622,_0x40d6ed=ensureRemoteSqlContent(_0x554d6b),_0x3c5d57=stripLocalSqlMetadata(_0x40d6ed,'mybatisXml')[_0x4b98bf(0x10c)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x3c5d57))return _0x4b98bf(0x11b);return _0x4b98bf(0x116);}function isEquivalentPulledSqlFile(_0x3cb009,_0x9e0d6d,_0x4aa610){return normalizePullComparableContent(_0x3cb009,_0x4aa610)===normalizePullComparableContent(_0x9e0d6d,_0x4aa610);}function normalizePullComparableContent(_0x1e21a0,_0x54e931){const _0x4548d5=a190_0x104622,_0x11f6be=_0x1e21a0[_0x4548d5(0x12f)](/\r\n/g,'\x0a')[_0x4548d5(0x10b)]('\x0a'),_0x55e633=_0x11f6be[_0x4548d5(0x11e)](_0x3eee30=>!isSyncedAtMetadataLine(_0x3eee30,_0x54e931));return _0x55e633[_0x4548d5(0x11a)]('\x0a');}function isSyncedAtMetadataLine(_0x386c96,_0x2ebcb7){const _0x3200ee=a190_0x104622;if(_0x2ebcb7===_0x3200ee(0x11b))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x3200ee(0x111)](_0x386c96);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x386c96);}
1
+ const a191_0x297d7a=a191_0x34c2;(function(_0x409495,_0x14c66e){const _0x46cc48=a191_0x34c2,_0x2ed9be=_0x409495();while(!![]){try{const _0x918a82=parseInt(_0x46cc48(0x105))/0x1+-parseInt(_0x46cc48(0x11c))/0x2+-parseInt(_0x46cc48(0xe6))/0x3+parseInt(_0x46cc48(0x11d))/0x4+parseInt(_0x46cc48(0x115))/0x5+parseInt(_0x46cc48(0xec))/0x6+parseInt(_0x46cc48(0x101))/0x7*(parseInt(_0x46cc48(0x116))/0x8);if(_0x918a82===_0x14c66e)break;else _0x2ed9be['push'](_0x2ed9be['shift']());}catch(_0x2aa11d){_0x2ed9be['push'](_0x2ed9be['shift']());}}}(a191_0xb44d,0xe645d));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a191_0xb44d(){const _0x4ebc17=['local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','string','70HbMVsQ','tableData','lastSync','nonInteractive','10327qGLDrs','apps','unchanged','sqlcode','description','trimStart','toISOString','\x20written,\x20','test','sqlRootDir','Filter\x20by\x20SQL\x20display\x20name','path','\x20failed','sqls','Force\x20overwrite\x20local\x20unsynced\x20changes','skipped','2267475WoCUUc','995128WWKbuI','mybatisXml','would_pull','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','bool','sqlContent','3505130BAZyFD','3932812CaPlJf','push','totalCount','sqlRoot','5190387DEQwIf','sqlName','cancelled','POST','utf8','No\x20remote\x20SQL\x20queries\x20matched.','10409736mYUmpa','length','force','pull','dbId','\x20skipped,\x20','lockFilePath','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','conflict','str','replace','name','sql','appCode','join','sqlCode','Force\x20pull\x20cancelled.','catch'];a191_0xb44d=function(){return _0x4ebc17;};return a191_0xb44d();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';function a191_0x34c2(_0x46a97d,_0x56969c){_0x46a97d=_0x46a97d-0xe4;const _0xb44dca=a191_0xb44d();let _0x34c224=_0xb44dca[_0x46a97d];return _0x34c224;}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x249313,_0x57f2b4){const _0x1980d4=a191_0x34c2,_0x3e6e62=[];let _0x1091ca=0x1;while(!![]){const _0x59ac6b=await listSqlQueries(_0x249313,{'currentPage':_0x1091ca,'pageSize':PAGE_SIZE,'sqlCode':_0x57f2b4[_0x1980d4(0xfc)],'sqlName':_0x57f2b4[_0x1980d4(0xe7)]}),_0x445c80=_0x59ac6b[_0x1980d4(0x102)]??[];_0x3e6e62['push'](..._0x445c80);if(_0x445c80['length']===0x0)break;const _0xcf6417=_0x59ac6b['paging']?.[_0x1980d4(0xe4)];if(_0xcf6417!=null?_0x3e6e62[_0x1980d4(0xed)]>=_0xcf6417:_0x445c80[_0x1980d4(0xed)]<PAGE_SIZE)break;_0x1091ca++;}return _0x3e6e62;}async function ensureSqlContent(_0x5288fd){const _0x29affe=a191_0x34c2;if(_0x5288fd['sqlContent']!=null&&String(_0x5288fd[_0x29affe(0x11b)])[_0x29affe(0xed)]>0x0)return _0x5288fd;return getSqlQueryDetail(_0x5288fd[_0x29affe(0xfc)]);}export const sqlPull={'service':a191_0x297d7a(0xf9),'command':a191_0x297d7a(0xef),'description':a191_0x297d7a(0xf4),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a191_0x297d7a(0xf8),'type':a191_0x297d7a(0x100),'description':a191_0x297d7a(0x10f)},{'name':a191_0x297d7a(0xee),'type':'boolean','description':a191_0x297d7a(0x113)}],async 'dryRun'(_0x1f93a1){const _0x5be0ba=a191_0x297d7a,_0x2a9930=loadSqlProjectConfig(_0x1f93a1['appCode']),_0x9bf481=await readSqlLockFile(_0x2a9930[_0x5be0ba(0xf2)]),{appLock:_0x565ece}=ensureSqlLockScope(_0x9bf481??createEmptySqlLock(),_0x2a9930[_0x5be0ba(0xfa)],_0x2a9930[_0x5be0ba(0xe5)],'pull'),_0x105ad0=await fetchAllSqlQueries(_0x1f93a1[_0x5be0ba(0xfa)],{'sqlCode':_0x1f93a1[_0x5be0ba(0xf6)](_0x5be0ba(0x108))||undefined,'sqlName':_0x1f93a1[_0x5be0ba(0xf6)](_0x5be0ba(0xf8))||undefined}),_0x2821fe=[];for(const _0x335560 of _0x105ad0){const _0x35ab63=await ensureSqlContent(_0x335560),_0x679d48=ensureRemoteSqlContent(_0x35ab63),_0x2db8a6=detectModeFromSql(_0x35ab63),_0x3dcb5f=_0x35ab63[_0x5be0ba(0xf0)]?await getDbName(_0x1f93a1[_0x5be0ba(0xfa)],Number(_0x35ab63['dbId']))[_0x5be0ba(0xfe)](()=>undefined):undefined,_0x22fc5c=buildLocalSqlFileContent({'sqlCode':_0x35ab63[_0x5be0ba(0xfc)],'sqlName':_0x35ab63[_0x5be0ba(0xe7)],'dbId':_0x35ab63[_0x5be0ba(0xf0)]},_0x679d48,{'dbName':_0x3dcb5f,'mode':_0x2db8a6,'syncedAt':new Date()[_0x5be0ba(0x10b)](),'description':_0x35ab63[_0x5be0ba(0x109)]}),_0x1a6e0d=buildSqlLockEntry(_0x35ab63,_0x679d48,'',{'dbName':_0x3dcb5f}),_0x5d43d0=resolveLocalSqlFilePath(_0x2a9930,_0x35ab63[_0x5be0ba(0xfc)],_0x1a6e0d);let _0x87d915=_0x5be0ba(0x118),_0x5eec86;if(await fileExists(_0x5d43d0)){const _0x5ed15d=await readFile(_0x5d43d0,_0x5be0ba(0xea));isEquivalentPulledSqlFile(_0x5ed15d,_0x22fc5c,_0x2db8a6)?(_0x87d915=_0x5be0ba(0x114),_0x5eec86='unchanged'):(_0x87d915=_0x5be0ba(0xf5),_0x5eec86=_0x5be0ba(0xff));}_0x2821fe[_0x5be0ba(0x11e)]({'sqlCode':_0x35ab63['sqlCode'],'sqlName':_0x35ab63[_0x5be0ba(0xe7)],'filePath':_0x5d43d0,'status':_0x87d915,'reason':_0x5eec86});}return{'method':_0x5be0ba(0xe9),'url':_0x5be0ba(0x119),'body':{'appCode':_0x1f93a1[_0x5be0ba(0xfa)],'sqlCode':_0x1f93a1[_0x5be0ba(0xf6)](_0x5be0ba(0x108))||null,'sqlName':_0x1f93a1[_0x5be0ba(0xf6)](_0x5be0ba(0xf8))||null,'files':_0x2821fe},'description':'Would\x20pull\x20'+_0x2821fe[_0x5be0ba(0xed)]+'\x20SQL\x20file(s)\x20into\x20'+_0x2a9930[_0x5be0ba(0x10e)]};},async 'execute'(_0x50c6d9){const _0x570c58=a191_0x297d7a,_0xca3c47=loadSqlProjectConfig(_0x50c6d9[_0x570c58(0xfa)]),_0x340e57=await readSqlLockFile(_0xca3c47['lockFilePath']),{lockData:_0x5610ae,appLock:_0x2e9ff3}=ensureSqlLockScope(_0x340e57??createEmptySqlLock(),_0xca3c47[_0x570c58(0xfa)],_0xca3c47[_0x570c58(0xe5)],_0x570c58(0xef)),_0x40e8f6=_0x50c6d9[_0x570c58(0x11a)](_0x570c58(0xee)),_0x2b8a83=await fetchAllSqlQueries(_0x50c6d9[_0x570c58(0xfa)],{'sqlCode':_0x50c6d9[_0x570c58(0xf6)]('sqlcode')||undefined,'sqlName':_0x50c6d9['str'](_0x570c58(0xf8))||undefined});if(_0x2b8a83[_0x570c58(0xed)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x570c58(0xeb)};const _0x366281=[],_0x3d8c8b=[];for(const _0x4f04f1 of _0x2b8a83){try{_0x366281[_0x570c58(0x11e)](await ensureSqlContent(_0x4f04f1));}catch(_0x5552e5){_0x3d8c8b[_0x570c58(0x11e)]({'sqlCode':_0x4f04f1[_0x570c58(0xfc)],'error':_0x5552e5 instanceof Error?_0x5552e5['message']:String(_0x5552e5)});}}if(_0x40e8f6&&!_0x50c6d9[_0x570c58(0x104)]){let _0x4d45a9=![];for(const _0x3728cd of _0x366281){const _0x12c098=detectModeFromSql(_0x3728cd),_0x21fe31=_0x3728cd[_0x570c58(0xf0)]?await getDbName(_0x50c6d9[_0x570c58(0xfa)],Number(_0x3728cd[_0x570c58(0xf0)]))[_0x570c58(0xfe)](()=>undefined):undefined,_0x32d0d4=buildLocalSqlFileContent({'sqlCode':_0x3728cd[_0x570c58(0xfc)],'sqlName':_0x3728cd[_0x570c58(0xe7)],'dbId':_0x3728cd[_0x570c58(0xf0)]},ensureRemoteSqlContent(_0x3728cd),{'dbName':_0x21fe31,'mode':_0x12c098,'syncedAt':new Date()['toISOString'](),'description':_0x3728cd[_0x570c58(0x109)]}),_0x3dd6a0=resolveLocalSqlFilePath(_0xca3c47,_0x3728cd[_0x570c58(0xfc)],buildSqlLockEntry(_0x3728cd,ensureRemoteSqlContent(_0x3728cd),'',{'dbName':_0x21fe31}));if(await fileExists(_0x3dd6a0)){const _0x486e31=await readFile(_0x3dd6a0,_0x570c58(0xea));if(!isEquivalentPulledSqlFile(_0x486e31,_0x32d0d4,_0x12c098)){_0x4d45a9=!![];break;}}}if(_0x4d45a9){const _0x4d2da8=await confirmForceOverwrite(_0x570c58(0xf3));if(!_0x4d2da8)throw CliErrors[_0x570c58(0xe8)](_0x570c58(0xfd));}}const _0x1c058e=cloneSqlLockData(_0x5610ae),_0x1d0ca9=_0x1c058e[_0x570c58(0x106)][_0xca3c47[_0x570c58(0xfa)]],_0x4af78e=[],_0x13ec67=[];for(const _0xd70035 of _0x366281){const _0x464995=_0x1d0ca9[_0x570c58(0x112)][_0xd70035[_0x570c58(0xfc)]],_0x47ae90=ensureRemoteSqlContent(_0xd70035),_0x4f93c6=detectModeFromSql(_0xd70035),_0x2ea821=_0xd70035[_0x570c58(0xf0)]?await getDbName(_0x50c6d9[_0x570c58(0xfa)],Number(_0xd70035[_0x570c58(0xf0)]))['catch'](()=>undefined):undefined,_0xbfbc2d=buildLocalSqlFileContent({'sqlCode':_0xd70035['sqlCode'],'sqlName':_0xd70035['sqlName'],'dbId':_0xd70035[_0x570c58(0xf0)]},_0x47ae90,{'dbName':_0x2ea821,'mode':_0x4f93c6,'syncedAt':new Date()[_0x570c58(0x10b)](),'description':_0xd70035[_0x570c58(0x109)]}),_0x4158b8=buildSqlLockEntry(_0xd70035,_0x47ae90,computeSqlContentHash(_0xbfbc2d),{'dbName':_0x2ea821}),_0x1b8fe5=_0x4158b8['path'],_0xffaf04=join(_0xca3c47[_0x570c58(0x10e)],_0x1b8fe5);try{if(await fileExists(_0xffaf04)){const _0x34483f=await readFile(_0xffaf04,_0x570c58(0xea));if(isEquivalentPulledSqlFile(_0x34483f,_0xbfbc2d,_0x4f93c6)){_0x13ec67[_0x570c58(0x11e)]({'sqlCode':_0xd70035['sqlCode'],'reason':_0x570c58(0x107)}),_0x1d0ca9['sqls'][_0xd70035[_0x570c58(0xfc)]]={..._0x4158b8,'hash':computeSqlContentHash(_0x34483f),'path':_0x1b8fe5};continue;}if(!_0x40e8f6){_0x13ec67[_0x570c58(0x11e)]({'sqlCode':_0xd70035[_0x570c58(0xfc)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x3a7c44=_0x464995?.[_0x570c58(0x110)]?join(_0xca3c47[_0x570c58(0x10e)],_0x464995[_0x570c58(0x110)]):undefined;_0x3a7c44&&_0x3a7c44!==_0xffaf04&&await fileExists(_0x3a7c44)&&await rm(_0x3a7c44,{'force':!![]}),await ensureParentDirectory(_0xffaf04),await writeFile(_0xffaf04,_0xbfbc2d,_0x570c58(0xea)),_0x1d0ca9[_0x570c58(0x112)][_0xd70035[_0x570c58(0xfc)]]={..._0x4158b8,'path':_0x1b8fe5},_0x4af78e['push']({'sqlCode':_0xd70035['sqlCode'],'filePath':_0xffaf04});}catch(_0x1b238a){_0x3d8c8b['push']({'sqlCode':_0xd70035['sqlCode'],'error':_0x1b238a instanceof Error?_0x1b238a['message']:String(_0x1b238a)});}}return _0x1d0ca9[_0x570c58(0x103)]=new Date()['toISOString'](),await writeSqlLockFile(_0xca3c47[_0x570c58(0xf2)],_0x1c058e),{'ok':_0x3d8c8b[_0x570c58(0xed)]===0x0,'data':{'pulled':_0x4af78e,'skipped':_0x13ec67,'failed':_0x3d8c8b},'message':'Pull\x20complete:\x20'+_0x4af78e[_0x570c58(0xed)]+_0x570c58(0x10c)+_0x13ec67[_0x570c58(0xed)]+_0x570c58(0xf1)+_0x3d8c8b[_0x570c58(0xed)]+_0x570c58(0x111)};}};function detectModeFromSql(_0x5dc8dd){const _0x1d11b6=a191_0x297d7a,_0x20df5c=ensureRemoteSqlContent(_0x5dc8dd),_0x193049=stripLocalSqlMetadata(_0x20df5c,_0x1d11b6(0x117))[_0x1d11b6(0x10a)]();if(/^<(select|insert|update|delete)\b/i[_0x1d11b6(0x10d)](_0x193049))return _0x1d11b6(0x117);return _0x1d11b6(0xf9);}function isEquivalentPulledSqlFile(_0x363fb1,_0x5d3930,_0x4ca5db){return normalizePullComparableContent(_0x363fb1,_0x4ca5db)===normalizePullComparableContent(_0x5d3930,_0x4ca5db);}function normalizePullComparableContent(_0x40fff3,_0x584003){const _0x5e1a74=a191_0x297d7a,_0x243b1b=_0x40fff3[_0x5e1a74(0xf7)](/\r\n/g,'\x0a')['split']('\x0a'),_0x297c20=_0x243b1b['filter'](_0x1ae71e=>!isSyncedAtMetadataLine(_0x1ae71e,_0x584003));return _0x297c20[_0x5e1a74(0xfb)]('\x0a');}function isSyncedAtMetadataLine(_0x5d0a59,_0x466e40){const _0x2c5d09=a191_0x297d7a;if(_0x466e40===_0x2c5d09(0x117))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x2c5d09(0x10d)](_0x5d0a59);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x5d0a59);}