@lovrabet/rabetbase-cli 2.5.2 → 2.5.3-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (395) 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.d.ts +1 -1
  4. package/lib/api/generate-api-file.js +1 -1
  5. package/lib/api/generate-sdk-config-file.d.ts +2 -1
  6. package/lib/api/generate-sdk-config-file.js +1 -1
  7. package/lib/auth/auth-server-ui.js +1 -1
  8. package/lib/auth/auth-server.js +1 -1
  9. package/lib/auth/constant.js +1 -1
  10. package/lib/auth/get-cookie.js +1 -1
  11. package/lib/auth/get-session-user.js +1 -1
  12. package/lib/auth/is-session-valid.js +1 -1
  13. package/lib/auth/login-success-html.js +1 -1
  14. package/lib/auth/logout.js +1 -1
  15. package/lib/cli-flags.js +1 -1
  16. package/lib/cli.js +1 -1
  17. package/lib/commands/api/generate.js +1 -1
  18. package/lib/commands/api/index.js +1 -1
  19. package/lib/commands/api/list.js +1 -1
  20. package/lib/commands/api/pull.js +1 -1
  21. package/lib/commands/api/shared.js +1 -1
  22. package/lib/commands/app/index.js +1 -1
  23. package/lib/commands/app/list.js +1 -1
  24. package/lib/commands/app/members-list.js +1 -1
  25. package/lib/commands/app/remote-directory.js +1 -1
  26. package/lib/commands/app/shared.js +1 -1
  27. package/lib/commands/app-config/delete.js +1 -1
  28. package/lib/commands/app-config/get.js +1 -1
  29. package/lib/commands/app-config/index.js +1 -1
  30. package/lib/commands/app-config/list.js +1 -1
  31. package/lib/commands/app-config/set.js +1 -1
  32. package/lib/commands/app-config/shared.js +1 -1
  33. package/lib/commands/auth/index.js +1 -1
  34. package/lib/commands/bff/create.js +1 -1
  35. package/lib/commands/bff/delete.js +1 -1
  36. package/lib/commands/bff/detail.js +1 -1
  37. package/lib/commands/bff/index.js +1 -1
  38. package/lib/commands/bff/list.js +1 -1
  39. package/lib/commands/bff/logs.d.ts +7 -0
  40. package/lib/commands/bff/logs.js +1 -0
  41. package/lib/commands/bff/pull.js +1 -1
  42. package/lib/commands/bff/push.js +1 -1
  43. package/lib/commands/bff/status.js +1 -1
  44. package/lib/commands/cli-skill/index.js +1 -1
  45. package/lib/commands/cli-update.js +1 -1
  46. package/lib/commands/codegen/index.js +1 -1
  47. package/lib/commands/codegen/sdk.js +1 -1
  48. package/lib/commands/codegen/sql.js +1 -1
  49. package/lib/commands/common/app-registry.js +1 -1
  50. package/lib/commands/common/app-selector.js +1 -1
  51. package/lib/commands/common/async-task.js +1 -1
  52. package/lib/commands/common/dry-run.js +1 -1
  53. package/lib/commands/common/flags.js +1 -1
  54. package/lib/commands/common/local-file.js +1 -1
  55. package/lib/commands/common/validate.js +1 -1
  56. package/lib/commands/config/delete.js +1 -1
  57. package/lib/commands/config/get.js +1 -1
  58. package/lib/commands/config/index.js +1 -1
  59. package/lib/commands/config/init.js +1 -1
  60. package/lib/commands/config/list.js +1 -1
  61. package/lib/commands/config/set.js +1 -1
  62. package/lib/commands/config/shared.js +1 -1
  63. package/lib/commands/dataset/batch-design.d.ts +21 -0
  64. package/lib/commands/dataset/batch-design.js +1 -0
  65. package/lib/commands/dataset/business-group-update.js +1 -1
  66. package/lib/commands/dataset/business-groups.js +1 -1
  67. package/lib/commands/dataset/capability.js +1 -1
  68. package/lib/commands/dataset/delete.js +1 -1
  69. package/lib/commands/dataset/detail.js +1 -1
  70. package/lib/commands/dataset/extend-update.js +1 -1
  71. package/lib/commands/dataset/field-restore.js +1 -1
  72. package/lib/commands/dataset/field-update.js +1 -1
  73. package/lib/commands/dataset/generate.js +1 -1
  74. package/lib/commands/dataset/index.js +1 -1
  75. package/lib/commands/dataset/list.js +1 -1
  76. package/lib/commands/dataset/operations.js +1 -1
  77. package/lib/commands/dataset/relation-audit.js +1 -1
  78. package/lib/commands/dataset/relation-create.js +1 -1
  79. package/lib/commands/dataset/relation-delete.js +1 -1
  80. package/lib/commands/dataset/relation-shared.js +1 -1
  81. package/lib/commands/dataset/relation-update.js +1 -1
  82. package/lib/commands/dataset/relations.js +1 -1
  83. package/lib/commands/dataset/rename.js +1 -1
  84. package/lib/commands/dataset/restore.js +1 -1
  85. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  86. package/lib/commands/db/analysis-batching.js +1 -1
  87. package/lib/commands/db/analyze-batch-plan.js +1 -1
  88. package/lib/commands/db/analyze-cancel.js +1 -1
  89. package/lib/commands/db/analyze-start.js +1 -1
  90. package/lib/commands/db/analyze-status.js +1 -1
  91. package/lib/commands/db/create.js +1 -1
  92. package/lib/commands/db/delete.js +1 -1
  93. package/lib/commands/db/detail.js +1 -1
  94. package/lib/commands/db/diff-refresh-start.js +1 -1
  95. package/lib/commands/db/diff-refresh-status.js +1 -1
  96. package/lib/commands/db/diff.js +1 -1
  97. package/lib/commands/db/index.js +1 -1
  98. package/lib/commands/db/list.js +1 -1
  99. package/lib/commands/db/shared.js +1 -1
  100. package/lib/commands/db/table-diff-shared.js +1 -1
  101. package/lib/commands/db/tables.js +1 -1
  102. package/lib/commands/db/test.js +1 -1
  103. package/lib/commands/db/update.js +1 -1
  104. package/lib/commands/deployment/index.js +1 -1
  105. package/lib/commands/deployment/sync-all.js +1 -1
  106. package/lib/commands/deployment/sync-jobs.js +1 -1
  107. package/lib/commands/deployment/sync-status.js +1 -1
  108. package/lib/commands/doctor.js +1 -1
  109. package/lib/commands/file/index.js +1 -1
  110. package/lib/commands/flow/create.d.ts +2 -0
  111. package/lib/commands/flow/create.js +1 -0
  112. package/lib/commands/flow/detail.d.ts +2 -0
  113. package/lib/commands/flow/detail.js +1 -0
  114. package/lib/commands/flow/index.d.ts +3 -0
  115. package/lib/commands/flow/index.js +1 -0
  116. package/lib/commands/flow/list.d.ts +2 -0
  117. package/lib/commands/flow/list.js +1 -0
  118. package/lib/commands/flow/publish.d.ts +2 -0
  119. package/lib/commands/flow/publish.js +1 -0
  120. package/lib/commands/flow/runtime-resources-shared.d.ts +40 -0
  121. package/lib/commands/flow/runtime-resources-shared.js +1 -0
  122. package/lib/commands/flow/runtime-role-list.d.ts +2 -0
  123. package/lib/commands/flow/runtime-role-list.js +1 -0
  124. package/lib/commands/flow/runtime-role-user-list.d.ts +2 -0
  125. package/lib/commands/flow/runtime-role-user-list.js +1 -0
  126. package/lib/commands/flow/runtime-user-search.d.ts +2 -0
  127. package/lib/commands/flow/runtime-user-search.js +1 -0
  128. package/lib/commands/flow/shared.d.ts +41 -0
  129. package/lib/commands/flow/shared.js +1 -0
  130. package/lib/commands/flow/update.d.ts +2 -0
  131. package/lib/commands/flow/update.js +1 -0
  132. package/lib/commands/flow/validate.d.ts +3 -0
  133. package/lib/commands/flow/validate.js +1 -0
  134. package/lib/commands/instant-api-policy/current.js +1 -1
  135. package/lib/commands/instant-api-policy/index.js +1 -1
  136. package/lib/commands/instant-api-policy/init.js +1 -1
  137. package/lib/commands/instant-api-policy/publish.js +1 -1
  138. package/lib/commands/instant-api-policy/pull.js +1 -1
  139. package/lib/commands/instant-api-policy/revision.js +1 -1
  140. package/lib/commands/instant-api-policy/revisions.js +1 -1
  141. package/lib/commands/instant-api-policy/rollback.js +1 -1
  142. package/lib/commands/instant-api-policy/shared.js +1 -1
  143. package/lib/commands/instant-api-policy/validate.js +1 -1
  144. package/lib/commands/issue/index.js +1 -1
  145. package/lib/commands/issue/nudge.js +1 -1
  146. package/lib/commands/issue/report.js +1 -1
  147. package/lib/commands/issue/shared.js +1 -1
  148. package/lib/commands/kb/create.js +1 -1
  149. package/lib/commands/kb/delete.js +1 -1
  150. package/lib/commands/kb/detail.js +1 -1
  151. package/lib/commands/kb/index.js +1 -1
  152. package/lib/commands/kb/list.js +1 -1
  153. package/lib/commands/kb/search.js +1 -1
  154. package/lib/commands/kb/shared.js +1 -1
  155. package/lib/commands/kb/update.js +1 -1
  156. package/lib/commands/logs/index.js +1 -1
  157. package/lib/commands/menu/asset-update.js +1 -1
  158. package/lib/commands/menu/delete.js +1 -1
  159. package/lib/commands/menu/external-link-create.js +1 -1
  160. package/lib/commands/menu/external-link-update.js +1 -1
  161. package/lib/commands/menu/group-create.js +1 -1
  162. package/lib/commands/menu/group-update.js +1 -1
  163. package/lib/commands/menu/index.js +1 -1
  164. package/lib/commands/menu/list.js +1 -1
  165. package/lib/commands/menu/move.js +1 -1
  166. package/lib/commands/menu/regroup-start.js +1 -1
  167. package/lib/commands/menu/rename.js +1 -1
  168. package/lib/commands/menu/shared/compare-table.js +1 -1
  169. package/lib/commands/menu/shared/delete-plan.js +1 -1
  170. package/lib/commands/menu/shared/facts.js +1 -1
  171. package/lib/commands/menu/shared/index.js +1 -1
  172. package/lib/commands/menu/shared/inquirer.js +1 -1
  173. package/lib/commands/menu/shared/local-pages.js +1 -1
  174. package/lib/commands/menu/shared/logic.js +1 -1
  175. package/lib/commands/menu/shared/mutations.js +1 -1
  176. package/lib/commands/menu/shared/service.js +1 -1
  177. package/lib/commands/menu/shared/sync-core.js +1 -1
  178. package/lib/commands/menu/shared/update-core.js +1 -1
  179. package/lib/commands/menu/shared/valid-url.js +1 -1
  180. package/lib/commands/menu/sync.js +1 -1
  181. package/lib/commands/menu/visibility-update.js +1 -1
  182. package/lib/commands/notification/config-create.js +1 -1
  183. package/lib/commands/notification/config-delete.js +1 -1
  184. package/lib/commands/notification/config-list.js +1 -1
  185. package/lib/commands/notification/config-update.js +1 -1
  186. package/lib/commands/notification/index.js +1 -1
  187. package/lib/commands/notification/shared.js +1 -1
  188. package/lib/commands/ocr/index.js +1 -1
  189. package/lib/commands/page/create.js +1 -1
  190. package/lib/commands/page/custom/detail.js +1 -1
  191. package/lib/commands/page/custom/list.js +1 -1
  192. package/lib/commands/page/custom/publish.js +1 -1
  193. package/lib/commands/page/custom/shared.js +1 -1
  194. package/lib/commands/page/custom/syntax.js +1 -1
  195. package/lib/commands/page/custom/update.js +1 -1
  196. package/lib/commands/page/data-list-status.js +1 -1
  197. package/lib/commands/page/generate-start.js +1 -1
  198. package/lib/commands/page/generate-status.js +1 -1
  199. package/lib/commands/page/index.js +1 -1
  200. package/lib/commands/page/pull.js +1 -1
  201. package/lib/commands/page/push.js +1 -1
  202. package/lib/commands/page/relation-audit.js +1 -1
  203. package/lib/commands/page/restore.js +1 -1
  204. package/lib/commands/page/shared.js +1 -1
  205. package/lib/commands/page/sync.js +1 -1
  206. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  207. package/lib/commands/project/create/format-elapsed.js +1 -1
  208. package/lib/commands/project/create/main.js +1 -1
  209. package/lib/commands/project/create/materialize-project-template.js +1 -1
  210. package/lib/commands/project/create/project-name.js +1 -1
  211. package/lib/commands/project/create/project-template-archive.js +1 -1
  212. package/lib/commands/project/create/project-template-path.js +1 -1
  213. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  214. package/lib/commands/project/create/use-format-code.js +1 -1
  215. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  216. package/lib/commands/project/domain-routing-sync.js +1 -1
  217. package/lib/commands/project/index.js +1 -1
  218. package/lib/commands/project/upgrade.js +1 -1
  219. package/lib/commands/registry.js +1 -1
  220. package/lib/commands/role/delete.js +1 -1
  221. package/lib/commands/role/detail.js +1 -1
  222. package/lib/commands/role/index.js +1 -1
  223. package/lib/commands/role/list.js +1 -1
  224. package/lib/commands/role/shared.js +1 -1
  225. package/lib/commands/role/update.js +1 -1
  226. package/lib/commands/role/user-add.js +1 -1
  227. package/lib/commands/role/user-remove.js +1 -1
  228. package/lib/commands/role/user-resolve.js +1 -1
  229. package/lib/commands/rule/get.js +1 -1
  230. package/lib/commands/rule/index.js +1 -1
  231. package/lib/commands/rule/list.js +1 -1
  232. package/lib/commands/rule/set.js +1 -1
  233. package/lib/commands/rule/shared.js +1 -1
  234. package/lib/commands/run/index.js +1 -1
  235. package/lib/commands/schema.js +1 -1
  236. package/lib/commands/sql/create.js +1 -1
  237. package/lib/commands/sql/delete.js +1 -1
  238. package/lib/commands/sql/detail.js +1 -1
  239. package/lib/commands/sql/exec.js +1 -1
  240. package/lib/commands/sql/index.js +1 -1
  241. package/lib/commands/sql/list.js +1 -1
  242. package/lib/commands/sql/pull.js +1 -1
  243. package/lib/commands/sql/push.js +1 -1
  244. package/lib/commands/sql/shared.js +1 -1
  245. package/lib/commands/sql/status.js +1 -1
  246. package/lib/commands/sql/validate.js +1 -1
  247. package/lib/commands/task/index.js +1 -1
  248. package/lib/commands/task/status.js +1 -1
  249. package/lib/commands/tenant/index.js +1 -1
  250. package/lib/commands/tenant/members-list.js +1 -1
  251. package/lib/commands/tenant/shared.js +1 -1
  252. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  253. package/lib/commands/user-account/index.js +1 -1
  254. package/lib/commands/workspace/add.js +1 -1
  255. package/lib/commands/workspace/index.js +1 -1
  256. package/lib/commands/workspace/remove.js +1 -1
  257. package/lib/config/domain-config.js +1 -1
  258. package/lib/config/project-domain-routing.js +1 -1
  259. package/lib/config/region-config.d.ts +23 -0
  260. package/lib/config/region-config.js +1 -0
  261. package/lib/config/schema.d.ts +15 -0
  262. package/lib/config/schema.js +1 -1
  263. package/lib/constant/cdn.js +1 -1
  264. package/lib/constant/cli.js +1 -1
  265. package/lib/constant/defaults.js +1 -1
  266. package/lib/constant/domain.js +1 -1
  267. package/lib/constant/env.js +1 -1
  268. package/lib/constant/output.js +1 -1
  269. package/lib/constant/paths.js +1 -1
  270. package/lib/constant/region.js +1 -1
  271. package/lib/constant/risk.js +1 -1
  272. package/lib/constant/routing-profile.js +1 -1
  273. package/lib/context/app-resolver.d.ts +6 -0
  274. package/lib/context/app-resolver.js +1 -1
  275. package/lib/context/auth-resolver.js +1 -1
  276. package/lib/context/config-loader.js +1 -1
  277. package/lib/context.d.ts +13 -0
  278. package/lib/context.js +1 -1
  279. package/lib/core/alias-resolver.js +1 -1
  280. package/lib/core/api-client.d.ts +172 -1
  281. package/lib/core/api-client.js +1 -1
  282. package/lib/core/bff/config.js +1 -1
  283. package/lib/core/bff/file-system.js +1 -1
  284. package/lib/core/bff/hash.js +1 -1
  285. package/lib/core/bff/hook-directory.d.ts +55 -0
  286. package/lib/core/bff/hook-directory.js +1 -0
  287. package/lib/core/bff/lock.js +1 -1
  288. package/lib/core/bff/types.d.ts +15 -0
  289. package/lib/core/bff/utils.js +1 -1
  290. package/lib/core/db-resolver.js +1 -1
  291. package/lib/core/flow-config.d.ts +628 -0
  292. package/lib/core/flow-config.js +1 -0
  293. package/lib/core/instant-api-policy/config.js +1 -1
  294. package/lib/core/kb-search-client.js +1 -1
  295. package/lib/core/page/file-system.js +1 -1
  296. package/lib/core/page/hash.js +1 -1
  297. package/lib/core/page/lock.js +1 -1
  298. package/lib/core/page/lr-smart-jsx.d.ts +6 -0
  299. package/lib/core/page/lr-smart-jsx.js +1 -0
  300. package/lib/core/sql-index-auditor.js +1 -1
  301. package/lib/core/sql-sync/config.js +1 -1
  302. package/lib/core/sql-sync/file-system.js +1 -1
  303. package/lib/core/sql-sync/hash.js +1 -1
  304. package/lib/core/sql-sync/lock.js +1 -1
  305. package/lib/core/sql-sync/utils.js +1 -1
  306. package/lib/core/sql-validator.js +1 -1
  307. package/lib/errors.js +1 -1
  308. package/lib/framework/build-all-flags.js +1 -1
  309. package/lib/framework/error-output.js +1 -1
  310. package/lib/framework/explicit-yes.js +1 -1
  311. package/lib/framework/flags.js +1 -1
  312. package/lib/framework/help.js +1 -1
  313. package/lib/framework/index.js +1 -1
  314. package/lib/framework/output.js +1 -1
  315. package/lib/framework/response.js +1 -1
  316. package/lib/framework/runner-alias.js +1 -1
  317. package/lib/framework/runner.js +1 -1
  318. package/lib/framework/schema-export.js +1 -1
  319. package/lib/framework/supported-flags.js +1 -1
  320. package/lib/framework/types.js +1 -1
  321. package/lib/generated/build-info.d.ts +4 -4
  322. package/lib/generated/build-info.js +1 -1
  323. package/lib/generated/official-routing.js +1 -1
  324. package/lib/generated/routing-contract.js +1 -1
  325. package/lib/help.js +1 -1
  326. package/lib/postinstall.js +1 -1
  327. package/lib/runtime/confirmation.js +1 -1
  328. package/lib/runtime/event.js +1 -1
  329. package/lib/runtime/index.js +1 -1
  330. package/lib/runtime/queue.js +1 -1
  331. package/lib/runtime/resolve.js +1 -1
  332. package/lib/skills/builtin-skill.js +1 -1
  333. package/lib/skills/main.js +1 -1
  334. package/lib/skills/npx-skills-add.js +1 -1
  335. package/lib/skills/skill-presence.js +1 -1
  336. package/lib/telemetry/cli-command-trace.js +1 -1
  337. package/lib/telemetry/cli-help-trace.js +1 -1
  338. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  339. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  340. package/lib/telemetry/send-cli-trace-log.js +1 -1
  341. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  342. package/lib/types/index.d.ts +1 -1
  343. package/lib/utils/ai_config.js +1 -1
  344. package/lib/utils/apply-jq-filter.js +1 -1
  345. package/lib/utils/cdn-config.js +1 -1
  346. package/lib/utils/check-sdk-version.js +1 -1
  347. package/lib/utils/cli-version-check.js +1 -1
  348. package/lib/utils/cli-version-policy.js +1 -1
  349. package/lib/utils/config.d.ts +2 -8
  350. package/lib/utils/config.js +1 -1
  351. package/lib/utils/entity-with-id.js +1 -1
  352. package/lib/utils/file-utils.js +1 -1
  353. package/lib/utils/guides-cdn.js +1 -1
  354. package/lib/utils/http-client.js +1 -1
  355. package/lib/utils/is-non-interactive.js +1 -1
  356. package/lib/utils/logger.js +1 -1
  357. package/lib/utils/params.js +1 -1
  358. package/lib/utils/platform.js +1 -1
  359. package/lib/utils/sleep.js +1 -1
  360. package/lib/utils/template-replacer.d.ts +2 -1
  361. package/lib/utils/template-replacer.js +1 -1
  362. package/lib/utils/update-notice.js +1 -1
  363. package/lib/utils/version.js +1 -1
  364. package/lib/utils/with-active-cookie.js +1 -1
  365. package/lib/utils/write-cli-side-channel.js +1 -1
  366. package/package.json +1 -1
  367. package/skills/rabetbase/SKILL.md +27 -8
  368. package/skills/rabetbase/guides/approval-flow-development-workflow.md +137 -0
  369. package/skills/rabetbase/guides/backend-function.md +19 -9
  370. package/skills/rabetbase/guides/bff-creation-workflow.md +10 -1
  371. package/skills/rabetbase/guides/conflict-detection.md +2 -0
  372. package/skills/rabetbase/guides/page-development-workflow.md +3 -0
  373. package/skills/rabetbase/guides/sdk-client-generation.md +6 -5
  374. package/skills/rabetbase/knowledge/approval-flow/config-json-schema.md +290 -0
  375. package/skills/rabetbase/knowledge/page-schema/LrSmartJsx.md +11 -3
  376. package/skills/rabetbase/references/rabetbase-api-pull.md +5 -4
  377. package/skills/rabetbase/references/rabetbase-app-list.md +3 -0
  378. package/skills/rabetbase/references/rabetbase-bff-create.md +1 -1
  379. package/skills/rabetbase/references/rabetbase-bff-list.md +1 -1
  380. package/skills/rabetbase/references/rabetbase-bff-logs.md +47 -0
  381. package/skills/rabetbase/references/rabetbase-bff-pull.md +9 -3
  382. package/skills/rabetbase/references/rabetbase-bff-push.md +10 -2
  383. package/skills/rabetbase/references/rabetbase-bff-status.md +2 -0
  384. package/skills/rabetbase/references/rabetbase-config.md +10 -9
  385. package/skills/rabetbase/references/rabetbase-dataset-generate.md +52 -2
  386. package/skills/rabetbase/references/rabetbase-doctor.md +2 -2
  387. package/skills/rabetbase/references/rabetbase-flow-commands.md +86 -0
  388. package/skills/rabetbase/references/rabetbase-flow-resources.md +83 -0
  389. package/skills/rabetbase/references/rabetbase-flow-runtime-boundary.md +25 -0
  390. package/skills/rabetbase/references/rabetbase-instant-api-policy.md +103 -11
  391. package/skills/rabetbase/references/rabetbase-notification-config-list.md +17 -0
  392. package/skills/rabetbase/references/rabetbase-page-push.md +5 -1
  393. package/skills/rabetbase/references/rabetbase-workspace.md +4 -2
  394. package/skills/rabetbase.manifest.json +9 -3
  395. package/templates/generate-api/client.ts.tpl +1 -1
@@ -1 +1 @@
1
- const a207_0x18bdd4=a207_0x5c53;(function(_0x32b52a,_0xfb2514){const _0x2d4e88=a207_0x5c53,_0x30e67f=_0x32b52a();while(!![]){try{const _0x142381=-parseInt(_0x2d4e88(0x124))/0x1+-parseInt(_0x2d4e88(0x130))/0x2+parseInt(_0x2d4e88(0x113))/0x3+parseInt(_0x2d4e88(0x11d))/0x4*(parseInt(_0x2d4e88(0x114))/0x5)+parseInt(_0x2d4e88(0x11e))/0x6+-parseInt(_0x2d4e88(0x125))/0x7*(parseInt(_0x2d4e88(0x131))/0x8)+parseInt(_0x2d4e88(0x132))/0x9;if(_0x142381===_0xfb2514)break;else _0x30e67f['push'](_0x30e67f['shift']());}catch(_0x3fb2ee){_0x30e67f['push'](_0x30e67f['shift']());}}}(a207_0x4586,0x3a523));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a207_0x4586(){const _0x3d4cc9=['Deleted\x20','SQL\x20lock\x20file\x20not\x20found.','appCode','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','122084NEkwSn','325674ZhyuGk','sqlRootDir','remoteId','delete','/smartapi/custom/deleteUserCustomSql','sqlRoot','270033QhRrYj','735NvHiku','filter','Would\x20delete\x20SQL\x20','entries','trashDir','sqls','validation','str','length','fromEntries','\x20(local\x20file\x20moved\x20to\x20trash)','798836FBQnjn','21848NzxjVW','4971510cUvUkZ','POST','lockFilePath','1399008rhNjXq','20wPJkAo','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','sql','sqlcode','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'];a207_0x4586=function(){return _0x3d4cc9;};return a207_0x4586();}import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a207_0x5c53(_0x51b748,_0xbd3c0b){_0x51b748=_0x51b748-0x112;const _0x45863b=a207_0x4586();let _0x5c535c=_0x45863b[_0x51b748];return _0x5c535c;}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':a207_0x18bdd4(0x116),'command':'delete','description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x10dcc2){const _0x25a8e4=a207_0x18bdd4,_0x43564f=loadSqlProjectConfig(_0x10dcc2[_0x25a8e4(0x11b)]),_0x1a6315=await readSqlLockFile(_0x43564f[_0x25a8e4(0x112)]);if(!_0x1a6315)throw CliErrors[_0x25a8e4(0x12b)](_0x25a8e4(0x115));},async 'dryRun'(_0x3c348b){const _0x24db65=a207_0x18bdd4,_0x4dca53=loadSqlProjectConfig(_0x3c348b[_0x24db65(0x11b)]),_0x44ffb5=await readSqlLockFile(_0x4dca53[_0x24db65(0x112)]);if(!_0x44ffb5)throw CliErrors[_0x24db65(0x12b)](_0x24db65(0x115));const {appLock:_0x54bf7a}=ensureSqlLockScope(_0x44ffb5,_0x3c348b[_0x24db65(0x11b)],_0x4dca53[_0x24db65(0x123)],_0x24db65(0x121)),_0x383e6a=_0x3c348b[_0x24db65(0x12c)](_0x24db65(0x117)),_0x33874c=_0x54bf7a[_0x24db65(0x12a)][_0x383e6a];if(!_0x33874c)throw CliErrors[_0x24db65(0x12b)](_0x24db65(0x118)+_0x383e6a+'\x22.');return{'method':_0x24db65(0x133),'url':_0x24db65(0x122),'body':{'sqlCode':_0x383e6a,'id':_0x33874c['remoteId'],'localPath':resolveLocalSqlFilePath(_0x4dca53,_0x383e6a,_0x33874c)},'description':_0x24db65(0x127)+_0x383e6a+_0x24db65(0x11c)+_0x4dca53[_0x24db65(0x129)]};},async 'execute'(_0x214393){const _0x1456a8=a207_0x18bdd4,_0x1d05a5=loadSqlProjectConfig(_0x214393[_0x1456a8(0x11b)]),_0x5b6708=await readSqlLockFile(_0x1d05a5[_0x1456a8(0x112)]);if(!_0x5b6708)throw CliErrors[_0x1456a8(0x12b)](_0x1456a8(0x11a));const {lockData:_0x4cf8a1,appLock:_0x2beec7}=ensureSqlLockScope(_0x5b6708,_0x214393['appCode'],_0x1d05a5[_0x1456a8(0x123)],'delete'),_0x3ddaac=_0x214393['str']('sqlcode'),_0x15b761=_0x2beec7['sqls'][_0x3ddaac];if(!_0x15b761)throw CliErrors[_0x1456a8(0x12b)](_0x1456a8(0x118)+_0x3ddaac+'\x22.');await deleteSqlQuery({'id':_0x15b761[_0x1456a8(0x120)],'sqlCode':_0x3ddaac}),_0x2beec7[_0x1456a8(0x12a)]=Object[_0x1456a8(0x12e)](Object[_0x1456a8(0x128)](_0x2beec7[_0x1456a8(0x12a)])[_0x1456a8(0x126)](([_0x5a1eb9])=>_0x5a1eb9!==_0x3ddaac)),_0x2beec7['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x1d05a5[_0x1456a8(0x112)],_0x4cf8a1);const _0x29d272=resolveLocalSqlFilePath(_0x1d05a5,_0x3ddaac,_0x15b761);let _0x146c14;await fileExists(_0x29d272)&&(_0x146c14=await moveToTrash(_0x1d05a5['projectRoot'],_0x1d05a5[_0x1456a8(0x129)],_0x29d272),await cleanupEmptyDirectories(dirname(_0x29d272),_0x1d05a5[_0x1456a8(0x11f)]));const _0x51af28={'deleted':_0x3ddaac,'remoteId':_0x15b761[_0x1456a8(0x120)]};if(_0x146c14)_0x51af28['trashedTo']=_0x146c14;return{'ok':!![],'data':_0x51af28,'message':_0x1456a8(0x119)+_0x3ddaac+(_0x146c14?_0x1456a8(0x12f):'')};}};async function moveToTrash(_0x5a0001,_0x58f1d0,_0xb3637e){const _0x10e623=new Date()['toISOString']()['replace'](/[:.]/g,'-'),_0x19e184=relative(_0x5a0001,_0xb3637e),_0x376c59=join(_0x58f1d0,_0x10e623,_0x19e184);return await mkdir(dirname(_0x376c59),{'recursive':!![]}),await rename(_0xb3637e,_0x376c59),_0x376c59;}async function cleanupEmptyDirectories(_0x4722a2,_0x18f4ea){const _0x10a2f4=a207_0x18bdd4;let _0xf44302=resolve(_0x4722a2);const _0x37d6da=resolve(_0x18f4ea);while(_0xf44302['startsWith'](''+_0x37d6da+sep)||_0xf44302===_0x37d6da){if(_0xf44302===_0x37d6da)return;try{const _0x54da59=await readdir(_0xf44302);if(_0x54da59[_0x10a2f4(0x12d)]>0x0)return;await rmdir(_0xf44302);}catch{return;}_0xf44302=dirname(_0xf44302);}}
1
+ const a221_0xaec108=a221_0x381b;(function(_0x100ebf,_0x3d790a){const _0x45c74b=a221_0x381b,_0x11c969=_0x100ebf();while(!![]){try{const _0xb13e07=parseInt(_0x45c74b(0xd3))/0x1+-parseInt(_0x45c74b(0xdf))/0x2*(parseInt(_0x45c74b(0xd5))/0x3)+-parseInt(_0x45c74b(0xe2))/0x4*(-parseInt(_0x45c74b(0xdb))/0x5)+-parseInt(_0x45c74b(0xec))/0x6+-parseInt(_0x45c74b(0xe9))/0x7+-parseInt(_0x45c74b(0xe6))/0x8+parseInt(_0x45c74b(0xe1))/0x9;if(_0xb13e07===_0x3d790a)break;else _0x11c969['push'](_0x11c969['shift']());}catch(_0x2afae1){_0x11c969['push'](_0x11c969['shift']());}}}(a221_0x2b35,0xa1285));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';function a221_0x381b(_0xbbb326,_0xeb9d38){_0xbbb326=_0xbbb326-0xc9;const _0x2b3500=a221_0x2b35();let _0x381b02=_0x2b3500[_0xbbb326];return _0x381b02;}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':a221_0xaec108(0xd1),'command':a221_0xaec108(0xcd),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a221_0xaec108(0xd4),'flags':[SQLCODE_FLAG],async 'validate'(_0x10e616){const _0x343306=a221_0xaec108,_0xc9ba9d=loadSqlProjectConfig(_0x10e616[_0x343306(0xda)]),_0x4d38d3=await readSqlLockFile(_0xc9ba9d[_0x343306(0xde)]);if(!_0x4d38d3)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x530380){const _0x5a8a3f=a221_0xaec108,_0x32ad56=loadSqlProjectConfig(_0x530380['appCode']),_0x416706=await readSqlLockFile(_0x32ad56[_0x5a8a3f(0xde)]);if(!_0x416706)throw CliErrors['validation'](_0x5a8a3f(0xcf));const {appLock:_0xc3a1a8}=ensureSqlLockScope(_0x416706,_0x530380[_0x5a8a3f(0xda)],_0x32ad56[_0x5a8a3f(0xcc)],_0x5a8a3f(0xcd)),_0x533de3=_0x530380[_0x5a8a3f(0xe7)](_0x5a8a3f(0xe5)),_0x23c74d=_0xc3a1a8['sqls'][_0x533de3];if(!_0x23c74d)throw CliErrors[_0x5a8a3f(0xdc)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x533de3+'\x22.');return{'method':_0x5a8a3f(0xea),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x533de3,'id':_0x23c74d[_0x5a8a3f(0xd6)],'localPath':resolveLocalSqlFilePath(_0x32ad56,_0x533de3,_0x23c74d)},'description':_0x5a8a3f(0xca)+_0x533de3+_0x5a8a3f(0xe4)+_0x32ad56[_0x5a8a3f(0xe0)]};},async 'execute'(_0x268d51){const _0x5a34c5=a221_0xaec108,_0xe9bb71=loadSqlProjectConfig(_0x268d51[_0x5a34c5(0xda)]),_0x4f6875=await readSqlLockFile(_0xe9bb71[_0x5a34c5(0xde)]);if(!_0x4f6875)throw CliErrors[_0x5a34c5(0xdc)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x283b73,appLock:_0x355d41}=ensureSqlLockScope(_0x4f6875,_0x268d51[_0x5a34c5(0xda)],_0xe9bb71[_0x5a34c5(0xcc)],'delete'),_0xe0865c=_0x268d51[_0x5a34c5(0xe7)](_0x5a34c5(0xe5)),_0x3caf4f=_0x355d41[_0x5a34c5(0xd7)][_0xe0865c];if(!_0x3caf4f)throw CliErrors[_0x5a34c5(0xdc)](_0x5a34c5(0xeb)+_0xe0865c+'\x22.');await deleteSqlQuery({'id':_0x3caf4f['remoteId'],'sqlCode':_0xe0865c}),_0x355d41['sqls']=Object[_0x5a34c5(0xdd)](Object[_0x5a34c5(0xe8)](_0x355d41[_0x5a34c5(0xd7)])[_0x5a34c5(0xd9)](([_0x157603])=>_0x157603!==_0xe0865c)),_0x355d41['lastSync']=new Date()[_0x5a34c5(0xd0)](),await writeSqlLockFile(_0xe9bb71[_0x5a34c5(0xde)],_0x283b73);const _0x3b1bda=resolveLocalSqlFilePath(_0xe9bb71,_0xe0865c,_0x3caf4f);let _0x3d9da0;await fileExists(_0x3b1bda)&&(_0x3d9da0=await moveToTrash(_0xe9bb71[_0x5a34c5(0xd2)],_0xe9bb71[_0x5a34c5(0xe0)],_0x3b1bda),await cleanupEmptyDirectories(dirname(_0x3b1bda),_0xe9bb71[_0x5a34c5(0xce)]));const _0x502733={'deleted':_0xe0865c,'remoteId':_0x3caf4f['remoteId']};if(_0x3d9da0)_0x502733[_0x5a34c5(0xd8)]=_0x3d9da0;return{'ok':!![],'data':_0x502733,'message':_0x5a34c5(0xcb)+_0xe0865c+(_0x3d9da0?_0x5a34c5(0xc9):'')};}};async function moveToTrash(_0x44bc29,_0xb33de,_0x1f8a41){const _0x5b7c99=a221_0xaec108,_0x66299e=new Date()[_0x5b7c99(0xd0)]()[_0x5b7c99(0xe3)](/[:.]/g,'-'),_0x38a37a=relative(_0x44bc29,_0x1f8a41),_0x253a36=join(_0xb33de,_0x66299e,_0x38a37a);return await mkdir(dirname(_0x253a36),{'recursive':!![]}),await rename(_0x1f8a41,_0x253a36),_0x253a36;}function a221_0x2b35(){const _0x334823=['SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','toISOString','sql','projectRoot','318462aFIfJm','high-risk-write','15XgRLRJ','remoteId','sqls','trashedTo','filter','appCode','955TkUPUt','validation','fromEntries','lockFilePath','506362ciUWzE','trashDir','28708749SYesxR','2964KRyDEk','replace','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','sqlcode','7313624HZHDYu','str','entries','2937998EORKDb','POST','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','2339586hVClQc','\x20(local\x20file\x20moved\x20to\x20trash)','Would\x20delete\x20SQL\x20','Deleted\x20','sqlRoot','delete','sqlRootDir'];a221_0x2b35=function(){return _0x334823;};return a221_0x2b35();}async function cleanupEmptyDirectories(_0x3aa97a,_0x42e711){let _0x4fd876=resolve(_0x3aa97a);const _0x24286f=resolve(_0x42e711);while(_0x4fd876['startsWith'](''+_0x24286f+sep)||_0x4fd876===_0x24286f){if(_0x4fd876===_0x24286f)return;try{const _0xfaabf6=await readdir(_0x4fd876);if(_0xfaabf6['length']>0x0)return;await rmdir(_0x4fd876);}catch{return;}_0x4fd876=dirname(_0x4fd876);}}
@@ -1 +1 @@
1
- function a208_0x46ad(_0x26be09,_0x2484c7){_0x26be09=_0x26be09-0x183;const _0x314156=a208_0x3141();let _0x46adb8=_0x314156[_0x26be09];return _0x46adb8;}const a208_0x331d7a=a208_0x46ad;function a208_0x3141(){const _0x2e941a=['803016IWcPbh','bool','read','12456704JdEXLR','sqlContent','Return\x20full\x20raw\x20SQL\x20query\x20object','verbose','dbId','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','sqlcode','5iiYRtw','sql','str','1634zxxQuf','1898532aDEUNL','sqlName','3134782GkQwos','boolean','description','130089VlxCba','267xuSBbu','appCode','191790twkHVO','1160bnmBmL'];a208_0x3141=function(){return _0x2e941a;};return a208_0x3141();}(function(_0x5bd633,_0x2701dd){const _0x2cffce=a208_0x46ad,_0x17dc91=_0x5bd633();while(!![]){try{const _0xe37fb5=parseInt(_0x2cffce(0x183))/0x1+parseInt(_0x2cffce(0x195))/0x2*(parseInt(_0x2cffce(0x184))/0x3)+-parseInt(_0x2cffce(0x188))/0x4+parseInt(_0x2cffce(0x192))/0x5*(parseInt(_0x2cffce(0x196))/0x6)+-parseInt(_0x2cffce(0x198))/0x7+-parseInt(_0x2cffce(0x18b))/0x8+parseInt(_0x2cffce(0x186))/0x9*(parseInt(_0x2cffce(0x187))/0xa);if(_0xe37fb5===_0x2701dd)break;else _0x17dc91['push'](_0x17dc91['shift']());}catch(_0x104e2b){_0x17dc91['push'](_0x17dc91['shift']());}}}(a208_0x3141,0xbfc6c));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a208_0x331d7a(0x193),'command':'detail','description':a208_0x331d7a(0x190),'risk':a208_0x331d7a(0x18a),'flags':[SQLCODE_FLAG,{'name':a208_0x331d7a(0x18e),'type':a208_0x331d7a(0x199),'description':a208_0x331d7a(0x18d)}],async 'execute'(_0x554acc){const _0x2306c9=a208_0x331d7a,_0x888628=await getSqlQueryInfo(_0x554acc[_0x2306c9(0x185)],_0x554acc[_0x2306c9(0x194)](_0x2306c9(0x191))),_0x2d777a=_0x554acc[_0x2306c9(0x189)](_0x2306c9(0x18e));if(_0x2d777a)return{'ok':!![],'data':_0x888628};const _0x2cd9c4=_0x888628[_0x2306c9(0x18f)]?await getDbName(_0x554acc[_0x2306c9(0x185)],_0x888628['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x888628['sqlCode'],'sqlName':_0x888628[_0x2306c9(0x197)],'db':_0x2cd9c4?_0x2cd9c4+'\x20('+_0x888628[_0x2306c9(0x18f)]+')':_0x888628[_0x2306c9(0x18f)]??'','description':_0x888628[_0x2306c9(0x19a)]??'','sqlContent':_0x888628[_0x2306c9(0x18c)]??''}};}};
1
+ const a222_0x4f0b52=a222_0x447c;(function(_0x340912,_0x3eb730){const _0x3b345d=a222_0x447c,_0x2abe65=_0x340912();while(!![]){try{const _0x43e67e=parseInt(_0x3b345d(0x1c1))/0x1+-parseInt(_0x3b345d(0x1d4))/0x2*(-parseInt(_0x3b345d(0x1cc))/0x3)+-parseInt(_0x3b345d(0x1c7))/0x4*(parseInt(_0x3b345d(0x1d0))/0x5)+-parseInt(_0x3b345d(0x1c4))/0x6+-parseInt(_0x3b345d(0x1c8))/0x7*(parseInt(_0x3b345d(0x1d1))/0x8)+parseInt(_0x3b345d(0x1cf))/0x9*(parseInt(_0x3b345d(0x1c5))/0xa)+parseInt(_0x3b345d(0x1ce))/0xb;if(_0x43e67e===_0x3eb730)break;else _0x2abe65['push'](_0x2abe65['shift']());}catch(_0x1b1773){_0x2abe65['push'](_0x2abe65['shift']());}}}(a222_0x8455,0xb3ead));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a222_0x447c(_0x3d64d1,_0x2e248b){_0x3d64d1=_0x3d64d1-0x1c0;const _0x84551=a222_0x8455();let _0x447c41=_0x84551[_0x3d64d1];return _0x447c41;}function a222_0x8455(){const _0x34935b=['11821623psooqB','81pCKTpa','14225PVAdyC','32CAXWpx','sqlcode','description','232534IosBQO','sqlName','appCode','833914kivLGQ','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','verbose','5021340NXczVw','319040UDcYzF','sql','1796SksAmd','277158FvtBwD','sqlCode','Return\x20full\x20raw\x20SQL\x20query\x20object','read','21XoLeSG','dbId'];a222_0x8455=function(){return _0x34935b;};return a222_0x8455();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a222_0x4f0b52(0x1c6),'command':'detail','description':a222_0x4f0b52(0x1c2),'risk':a222_0x4f0b52(0x1cb),'flags':[SQLCODE_FLAG,{'name':a222_0x4f0b52(0x1c3),'type':'boolean','description':a222_0x4f0b52(0x1ca)}],async 'execute'(_0x9e72c0){const _0x445fa8=a222_0x4f0b52,_0x1d3345=await getSqlQueryInfo(_0x9e72c0[_0x445fa8(0x1c0)],_0x9e72c0['str'](_0x445fa8(0x1d2))),_0x1e9afc=_0x9e72c0['bool']('verbose');if(_0x1e9afc)return{'ok':!![],'data':_0x1d3345};const _0x506dda=_0x1d3345[_0x445fa8(0x1cd)]?await getDbName(_0x9e72c0[_0x445fa8(0x1c0)],_0x1d3345['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x1d3345[_0x445fa8(0x1c9)],'sqlName':_0x1d3345[_0x445fa8(0x1d5)],'db':_0x506dda?_0x506dda+'\x20('+_0x1d3345[_0x445fa8(0x1cd)]+')':_0x1d3345[_0x445fa8(0x1cd)]??'','description':_0x1d3345[_0x445fa8(0x1d3)]??'','sqlContent':_0x1d3345['sqlContent']??''}};}};
@@ -1 +1 @@
1
- const a209_0x37dcb3=a209_0x4c19;(function(_0x32de7a,_0x5bd93c){const _0x386e4e=a209_0x4c19,_0xa71649=_0x32de7a();while(!![]){try{const _0x242e75=parseInt(_0x386e4e(0x19a))/0x1*(parseInt(_0x386e4e(0x1b2))/0x2)+parseInt(_0x386e4e(0x1ae))/0x3*(parseInt(_0x386e4e(0x19f))/0x4)+parseInt(_0x386e4e(0x1ab))/0x5*(-parseInt(_0x386e4e(0x1b7))/0x6)+-parseInt(_0x386e4e(0x1a1))/0x7*(-parseInt(_0x386e4e(0x1ac))/0x8)+parseInt(_0x386e4e(0x1a3))/0x9*(parseInt(_0x386e4e(0x1b6))/0xa)+-parseInt(_0x386e4e(0x1b5))/0xb*(-parseInt(_0x386e4e(0x1a6))/0xc)+parseInt(_0x386e4e(0x1af))/0xd*(-parseInt(_0x386e4e(0x19b))/0xe);if(_0x242e75===_0x5bd93c)break;else _0xa71649['push'](_0xa71649['shift']());}catch(_0x512b01){_0xa71649['push'](_0xa71649['shift']());}}}(a209_0x1dee,0xb1015));function a209_0x1dee(){const _0xaaa43f=['execError','88rTDuyS','967490nsSetV','66ftTXZQ','SQL\x20execution\x20failed','1ItQWor','14GLdwfi','execResult','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','sql','2416668KeObQP','str','35OHDHUD','read','99fkqqHE','sqlcode','length','1519140AHkBwF','string','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','\x20row(s)\x20in\x20','execSuccess','410995wVEIWe','993120ARyZJR','exec','3bBlOZA','28504099skcjzg','params','now','1039918rbXrLE','appCode'];a209_0x1dee=function(){return _0xaaa43f;};return a209_0x1dee();}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a209_0x4c19(_0x3ae206,_0x2c28ca){_0x3ae206=_0x3ae206-0x199;const _0x1dee07=a209_0x1dee();let _0x4c19a9=_0x1dee07[_0x3ae206];return _0x4c19a9;}export const sqlExec={'service':a209_0x37dcb3(0x19e),'command':a209_0x37dcb3(0x1ad),'description':a209_0x37dcb3(0x19d),'risk':a209_0x37dcb3(0x1a2),'flags':[SQLCODE_FLAG,{'name':a209_0x37dcb3(0x1b0),'type':a209_0x37dcb3(0x1a7),'description':a209_0x37dcb3(0x1a8)}],async 'execute'(_0x139c68){const _0x42c37c=a209_0x37dcb3,_0x232d15=parseJsonParams(_0x139c68[_0x42c37c(0x1a0)]('params')),_0x7f0ce9=Date[_0x42c37c(0x1b1)](),_0x4a3f7f=await executeSql(_0x139c68[_0x42c37c(0x1b3)],_0x139c68[_0x42c37c(0x1a0)](_0x42c37c(0x1a4)),_0x232d15),_0x59bd56=Date[_0x42c37c(0x1b1)]()-_0x7f0ce9,_0x57de52=_0x4a3f7f?.[_0x42c37c(0x19c)]??_0x4a3f7f,_0x5acd9b=_0x4a3f7f?.[_0x42c37c(0x1aa)]??!![];if(!_0x5acd9b)return{'ok':![],'data':{'error':_0x4a3f7f?.[_0x42c37c(0x1b4)]||_0x42c37c(0x199),'elapsed':_0x59bd56},'message':'SQL\x20execution\x20failed'};const _0x573a06=Array['isArray'](_0x57de52)?_0x57de52:[];return{'ok':!![],'data':{'rows':_0x573a06,'rowCount':_0x573a06['length'],'elapsed':_0x59bd56},'message':'Returned\x20'+_0x573a06[_0x42c37c(0x1a5)]+_0x42c37c(0x1a9)+_0x59bd56+'ms'};}};
1
+ const a223_0x2bc08b=a223_0x10ae;(function(_0x5b600e,_0x5decf0){const _0x241a91=a223_0x10ae,_0x5bf4d0=_0x5b600e();while(!![]){try{const _0xe4151d=-parseInt(_0x241a91(0x124))/0x1+-parseInt(_0x241a91(0x11a))/0x2+-parseInt(_0x241a91(0x126))/0x3+-parseInt(_0x241a91(0x127))/0x4+-parseInt(_0x241a91(0x11e))/0x5*(parseInt(_0x241a91(0x120))/0x6)+-parseInt(_0x241a91(0x112))/0x7*(parseInt(_0x241a91(0x116))/0x8)+parseInt(_0x241a91(0x115))/0x9;if(_0xe4151d===_0x5decf0)break;else _0x5bf4d0['push'](_0x5bf4d0['shift']());}catch(_0x869a17){_0x5bf4d0['push'](_0x5bf4d0['shift']());}}}(a223_0x5ab6,0x618b0));import{executeSql}from'../../core/api-client.js';function a223_0x5ab6(){const _0x299799=['string','153520QiLSlJ','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','appCode','execResult','355AMXZLo','now','38196lPyBZV','sql','length','isArray','646831IkUeds','SQL\x20execution\x20failed','412374Csanrr','89836NtmRjX','56OqYyuq','params','str','16624638qNAtXT','112152JqdsNc','read','execSuccess'];a223_0x5ab6=function(){return _0x299799;};return a223_0x5ab6();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a223_0x10ae(_0x2462db,_0x1c51f7){_0x2462db=_0x2462db-0x112;const _0x5ab6d3=a223_0x5ab6();let _0x10aea5=_0x5ab6d3[_0x2462db];return _0x10aea5;}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a223_0x2bc08b(0x121),'command':'exec','description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a223_0x2bc08b(0x117),'flags':[SQLCODE_FLAG,{'name':a223_0x2bc08b(0x113),'type':a223_0x2bc08b(0x119),'description':a223_0x2bc08b(0x11b)}],async 'execute'(_0x51a1ff){const _0x253bd2=a223_0x2bc08b,_0x596808=parseJsonParams(_0x51a1ff[_0x253bd2(0x114)](_0x253bd2(0x113))),_0x4e4c54=Date[_0x253bd2(0x11f)](),_0x2457e4=await executeSql(_0x51a1ff[_0x253bd2(0x11c)],_0x51a1ff[_0x253bd2(0x114)]('sqlcode'),_0x596808),_0x538f79=Date[_0x253bd2(0x11f)]()-_0x4e4c54,_0xfd6448=_0x2457e4?.[_0x253bd2(0x11d)]??_0x2457e4,_0x1cdd73=_0x2457e4?.[_0x253bd2(0x118)]??!![];if(!_0x1cdd73)return{'ok':![],'data':{'error':_0x2457e4?.['execError']||_0x253bd2(0x125),'elapsed':_0x538f79},'message':_0x253bd2(0x125)};const _0x5a61d5=Array[_0x253bd2(0x123)](_0xfd6448)?_0xfd6448:[];return{'ok':!![],'data':{'rows':_0x5a61d5,'rowCount':_0x5a61d5[_0x253bd2(0x122)],'elapsed':_0x538f79},'message':'Returned\x20'+_0x5a61d5[_0x253bd2(0x122)]+'\x20row(s)\x20in\x20'+_0x538f79+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x2b3a83,_0x4b4b41){const _0x36dbd5=a210_0x4d20,_0xe9c25=_0x2b3a83();while(!![]){try{const _0x1bafdf=-parseInt(_0x36dbd5(0x1e0))/0x1+parseInt(_0x36dbd5(0x1e3))/0x2*(-parseInt(_0x36dbd5(0x1de))/0x3)+-parseInt(_0x36dbd5(0x1e8))/0x4*(parseInt(_0x36dbd5(0x1dd))/0x5)+-parseInt(_0x36dbd5(0x1e1))/0x6*(-parseInt(_0x36dbd5(0x1e2))/0x7)+-parseInt(_0x36dbd5(0x1df))/0x8*(parseInt(_0x36dbd5(0x1e7))/0x9)+-parseInt(_0x36dbd5(0x1e6))/0xa+-parseInt(_0x36dbd5(0x1e5))/0xb*(-parseInt(_0x36dbd5(0x1e4))/0xc);if(_0x1bafdf===_0x4b4b41)break;else _0xe9c25['push'](_0xe9c25['shift']());}catch(_0x3d602d){_0xe9c25['push'](_0xe9c25['shift']());}}}(a210_0x9b4e,0x37381));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';function a210_0x4d20(_0x144958,_0x117518){_0x144958=_0x144958-0x1dd;const _0x9b4e76=a210_0x9b4e();let _0x4d2019=_0x9b4e76[_0x144958];return _0x4d2019;}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';function a210_0x9b4e(){const _0x9f803d=['9zgSAoX','492608bsIKKO','5tiAxMX','219vgKTyj','3184888QvDEMd','26336IxnNMt','6djNSKa','2872814rhNVps','3342hxMlVq','348qaPYhI','196603mIGEHc','329600zjSpyi'];a210_0x9b4e=function(){return _0x9f803d;};return a210_0x9b4e();}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
+ (function(_0x4d0bed,_0xc22b5b){const _0xc8a2be=a224_0xedcc,_0x163d89=_0x4d0bed();while(!![]){try{const _0x20740f=-parseInt(_0xc8a2be(0x87))/0x1*(-parseInt(_0xc8a2be(0x86))/0x2)+-parseInt(_0xc8a2be(0x7f))/0x3+-parseInt(_0xc8a2be(0x80))/0x4*(-parseInt(_0xc8a2be(0x83))/0x5)+-parseInt(_0xc8a2be(0x88))/0x6+-parseInt(_0xc8a2be(0x85))/0x7+-parseInt(_0xc8a2be(0x84))/0x8*(parseInt(_0xc8a2be(0x82))/0x9)+-parseInt(_0xc8a2be(0x81))/0xa*(-parseInt(_0xc8a2be(0x89))/0xb);if(_0x20740f===_0xc22b5b)break;else _0x163d89['push'](_0x163d89['shift']());}catch(_0x2ee4a0){_0x163d89['push'](_0x163d89['shift']());}}}(a224_0x2a27,0x423b0));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a224_0xedcc(_0x50c95e,_0x5aaf0b){_0x50c95e=_0x50c95e-0x7f;const _0x2a275a=a224_0x2a27();let _0xedccbc=_0x2a275a[_0x50c95e];return _0xedccbc;}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 a224_0x2a27(){const _0x3136f7=['2433466KzQHsp','2334rsLhuu','73nbfYcN','2761188XUbhxU','22RyaViw','261576DlVlgm','8PtnpRw','4284580EWYMxT','318753NwSSDK','826130yDvruu','24gDwfDC'];a224_0x2a27=function(){return _0x3136f7;};return a224_0x2a27();}import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a211_0x3fc1f8=a211_0x11ce;(function(_0x313e31,_0x129aeb){const _0x241cf8=a211_0x11ce,_0x818ae1=_0x313e31();while(!![]){try{const _0x285133=-parseInt(_0x241cf8(0x13a))/0x1+-parseInt(_0x241cf8(0x141))/0x2+-parseInt(_0x241cf8(0x124))/0x3*(-parseInt(_0x241cf8(0x130))/0x4)+parseInt(_0x241cf8(0x126))/0x5*(parseInt(_0x241cf8(0x128))/0x6)+parseInt(_0x241cf8(0x133))/0x7*(-parseInt(_0x241cf8(0x132))/0x8)+-parseInt(_0x241cf8(0x12d))/0x9*(-parseInt(_0x241cf8(0x121))/0xa)+parseInt(_0x241cf8(0x11e))/0xb;if(_0x285133===_0x129aeb)break;else _0x818ae1['push'](_0x818ae1['shift']());}catch(_0x25af62){_0x818ae1['push'](_0x818ae1['shift']());}}}(a211_0x19ac,0xafd3c));import{listSqlQueries}from'../../core/api-client.js';function a211_0x11ce(_0x106b26,_0x4e8bcf){_0x106b26=_0x106b26-0x11e;const _0x19ac6c=a211_0x19ac();let _0x11ce4f=_0x19ac6c[_0x106b26];return _0x11ce4f;}function a211_0x19ac(){const _0x4146c4=['Filter\x20by\x20SQL\x20name','length','1799608QVQANQ','\x20SQL\x20queries\x20(total:\x20','name','number','sqlCode','7872337OVsHmb','num','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','25030lEKCcM','description','page','9EaZKDk','pagesize','1255TrREdo','bool','31740rCJpYD','Page\x20number','sqlName','list','List\x20custom\x20SQL\x20queries','2763TcuKvU','all','boolean','185948BzujoB','totalCount','120DpsuXi','211274AbkEBj','appCode','read','string','sqlcode','map','str','878617ZmanoD','Found\x20','Page\x20size','verbose','dbId'];a211_0x19ac=function(){return _0x4146c4;};return a211_0x19ac();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a211_0x3fc1f8(0x12b),'description':a211_0x3fc1f8(0x12c),'risk':a211_0x3fc1f8(0x135),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a211_0x3fc1f8(0x143),'type':a211_0x3fc1f8(0x136),'description':a211_0x3fc1f8(0x13f)},{'name':a211_0x3fc1f8(0x123),'type':a211_0x3fc1f8(0x144),'description':a211_0x3fc1f8(0x129),'default':0x1},{'name':a211_0x3fc1f8(0x125),'type':a211_0x3fc1f8(0x144),'description':a211_0x3fc1f8(0x13c)},{'name':a211_0x3fc1f8(0x13d),'type':a211_0x3fc1f8(0x12f),'description':a211_0x3fc1f8(0x120)}],async 'execute'(_0x13bb99){const _0x13114e=a211_0x3fc1f8,_0x41cd38=await listSqlQueries(_0x13bb99[_0x13114e(0x134)],{'sqlCode':_0x13bb99[_0x13114e(0x139)](_0x13114e(0x137))||undefined,'sqlName':_0x13bb99[_0x13114e(0x139)](_0x13114e(0x143))||undefined,'currentPage':_0x13bb99[_0x13114e(0x11f)](_0x13114e(0x123)),'pageSize':_0x13bb99['num'](_0x13114e(0x125),0x32)}),_0x2bcd2e=_0x13bb99[_0x13114e(0x127)](_0x13114e(0x13d)),_0x46228b=_0x41cd38['tableData']??[],_0x38b851=_0x41cd38['paging']?.[_0x13114e(0x131)]??_0x46228b[_0x13114e(0x140)];let _0x28bb9f;return _0x2bcd2e?_0x28bb9f=_0x46228b:_0x28bb9f=await Promise[_0x13114e(0x12e)](_0x46228b[_0x13114e(0x138)](async _0x2b2552=>{const _0x58d09b=_0x13114e;let _0x23864a;try{_0x23864a=_0x2b2552[_0x58d09b(0x13e)]?await getDbName(_0x13bb99[_0x58d09b(0x134)],_0x2b2552[_0x58d09b(0x13e)]):undefined;}catch{}return{'sqlCode':_0x2b2552[_0x58d09b(0x145)],'sqlName':_0x2b2552[_0x58d09b(0x12a)],'description':_0x2b2552[_0x58d09b(0x122)]??'','db':_0x23864a?_0x23864a+'\x20('+_0x2b2552[_0x58d09b(0x13e)]+')':_0x2b2552['dbId']??''};})),{'ok':!![],'data':_0x28bb9f,'message':_0x46228b[_0x13114e(0x140)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x13114e(0x13b)+_0x46228b[_0x13114e(0x140)]+_0x13114e(0x142)+_0x38b851+').'};}};
1
+ const a225_0x52779c=a225_0x48a7;function a225_0x1f21(){const _0x2349ec=['paging','2192KlBKuw','13704400ocgbgs','pagesize','sqlcode','176844AWPkcd','list','appCode','str','name','string','bool','boolean','sqlName','1589535JtuVPo','read','verbose','No\x20custom\x20SQL\x20queries\x20found.','sqlCode','tableData','List\x20custom\x20SQL\x20queries','12327KKQIGO','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','all','sql','Found\x20','number','dbId','map','245OkoOyF','\x20SQL\x20queries\x20(total:\x20','length','1261196ueqmII','Filter\x20by\x20SQL\x20name','1180NrOEWC','totalCount','65418wcOOxV','45063Qytnio','page','description'];a225_0x1f21=function(){return _0x2349ec;};return a225_0x1f21();}(function(_0xa30ce2,_0xe42670){const _0x201b5a=a225_0x48a7,_0x5450b8=_0xa30ce2();while(!![]){try{const _0x57c888=parseInt(_0x201b5a(0x15f))/0x1+-parseInt(_0x201b5a(0x17a))/0x2+parseInt(_0x201b5a(0x16f))/0x3*(parseInt(_0x201b5a(0x17c))/0x4)+-parseInt(_0x201b5a(0x168))/0x5+-parseInt(_0x201b5a(0x17e))/0x6*(-parseInt(_0x201b5a(0x177))/0x7)+parseInt(_0x201b5a(0x15b))/0x8*(-parseInt(_0x201b5a(0x157))/0x9)+parseInt(_0x201b5a(0x15c))/0xa;if(_0x57c888===_0xe42670)break;else _0x5450b8['push'](_0x5450b8['shift']());}catch(_0x211ab3){_0x5450b8['push'](_0x5450b8['shift']());}}}(a225_0x1f21,0xc858d));import{listSqlQueries}from'../../core/api-client.js';function a225_0x48a7(_0x44200a,_0x4190c0){_0x44200a=_0x44200a-0x157;const _0x1f2124=a225_0x1f21();let _0x48a7cf=_0x1f2124[_0x44200a];return _0x48a7cf;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a225_0x52779c(0x172),'command':a225_0x52779c(0x160),'description':a225_0x52779c(0x16e),'risk':a225_0x52779c(0x169),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a225_0x52779c(0x164),'description':a225_0x52779c(0x17b)},{'name':a225_0x52779c(0x158),'type':a225_0x52779c(0x174),'description':'Page\x20number','default':0x1},{'name':a225_0x52779c(0x15d),'type':a225_0x52779c(0x174),'description':'Page\x20size'},{'name':a225_0x52779c(0x16a),'type':a225_0x52779c(0x166),'description':a225_0x52779c(0x170)}],async 'execute'(_0x2a0298){const _0x168947=a225_0x52779c,_0x317c16=await listSqlQueries(_0x2a0298['appCode'],{'sqlCode':_0x2a0298[_0x168947(0x162)](_0x168947(0x15e))||undefined,'sqlName':_0x2a0298[_0x168947(0x162)](_0x168947(0x163))||undefined,'currentPage':_0x2a0298['num']('page'),'pageSize':_0x2a0298['num']('pagesize',0x32)}),_0x2b3973=_0x2a0298[_0x168947(0x165)](_0x168947(0x16a)),_0x457252=_0x317c16[_0x168947(0x16d)]??[],_0x35a841=_0x317c16[_0x168947(0x15a)]?.[_0x168947(0x17d)]??_0x457252[_0x168947(0x179)];let _0x33e110;return _0x2b3973?_0x33e110=_0x457252:_0x33e110=await Promise[_0x168947(0x171)](_0x457252[_0x168947(0x176)](async _0x27097e=>{const _0x632257=_0x168947;let _0x48b466;try{_0x48b466=_0x27097e[_0x632257(0x175)]?await getDbName(_0x2a0298[_0x632257(0x161)],_0x27097e[_0x632257(0x175)]):undefined;}catch{}return{'sqlCode':_0x27097e[_0x632257(0x16c)],'sqlName':_0x27097e[_0x632257(0x167)],'description':_0x27097e[_0x632257(0x159)]??'','db':_0x48b466?_0x48b466+'\x20('+_0x27097e['dbId']+')':_0x27097e[_0x632257(0x175)]??''};})),{'ok':!![],'data':_0x33e110,'message':_0x457252[_0x168947(0x179)]===0x0?_0x168947(0x16b):_0x168947(0x173)+_0x457252[_0x168947(0x179)]+_0x168947(0x178)+_0x35a841+').'};}};
@@ -1 +1 @@
1
- function a212_0x461c(){const _0x1f9351=['skipped','Filter\x20by\x20SQL\x20display\x20name','8MmeJie','message','push','split','str','Would\x20pull\x20','boolean','local\x20differs\x20from\x20remote','utf8','dbId','Force\x20pull\x20cancelled.','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','force','104FIVVvN','\x20skipped,\x20','trimStart','sqlContent','join','sqls','612378yZndHQ','602631ebXuRn','read','sqlRootDir','bool','\x20SQL\x20file(s)\x20into\x20','lockFilePath','sqlName','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','conflict','description','catch','replace','708rgiNFI','sqlcode','POST','535975wiTZnR','sqlCode','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sql','4kOEMwY','3614292bZEGJb','string','Force\x20overwrite\x20local\x20unsynced\x20changes','86884tEFbXy','sqlRoot','mybatisXml','pull','10347440lQZZKm','name','path','length','totalCount','2437195suMwaJ','tableData','nonInteractive','unchanged','toISOString','test','appCode','apps'];a212_0x461c=function(){return _0x1f9351;};return a212_0x461c();}const a212_0x14db3a=a212_0x41b1;(function(_0x409ab3,_0x102035){const _0x159406=a212_0x41b1,_0x5c6bce=_0x409ab3();while(!![]){try{const _0x54dd3d=parseInt(_0x159406(0x1be))/0x1*(parseInt(_0x159406(0x194))/0x2)+parseInt(_0x159406(0x195))/0x3+-parseInt(_0x159406(0x1ab))/0x4*(parseInt(_0x159406(0x1a1))/0x5)+-parseInt(_0x159406(0x18d))/0x6*(-parseInt(_0x159406(0x198))/0x7)+-parseInt(_0x159406(0x1b8))/0x8*(parseInt(_0x159406(0x1bf))/0x9)+-parseInt(_0x159406(0x19c))/0xa+-parseInt(_0x159406(0x190))/0xb;if(_0x54dd3d===_0x102035)break;else _0x5c6bce['push'](_0x5c6bce['shift']());}catch(_0x151dbe){_0x5c6bce['push'](_0x5c6bce['shift']());}}}(a212_0x461c,0xebaca));import{readFile,rm,writeFile}from'node:fs/promises';function a212_0x41b1(_0x108a42,_0x4a8133){_0x108a42=_0x108a42-0x184;const _0x461c83=a212_0x461c();let _0x41b131=_0x461c83[_0x108a42];return _0x41b131;}import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0xb276a8,_0x324423){const _0x2a4837=a212_0x41b1,_0x247e87=[];let _0x54e2e3=0x1;while(!![]){const _0x221334=await listSqlQueries(_0xb276a8,{'currentPage':_0x54e2e3,'pageSize':PAGE_SIZE,'sqlCode':_0x324423[_0x2a4837(0x191)],'sqlName':_0x324423['sqlName']}),_0x32b9ec=_0x221334[_0x2a4837(0x1a2)]??[];_0x247e87[_0x2a4837(0x1ad)](..._0x32b9ec);if(_0x32b9ec[_0x2a4837(0x19f)]===0x0)break;const _0x3bae53=_0x221334['paging']?.[_0x2a4837(0x1a0)];if(_0x3bae53!=null?_0x247e87['length']>=_0x3bae53:_0x32b9ec[_0x2a4837(0x19f)]<PAGE_SIZE)break;_0x54e2e3++;}return _0x247e87;}async function ensureSqlContent(_0x3bc194){const _0x144ef5=a212_0x41b1;if(_0x3bc194[_0x144ef5(0x1bb)]!=null&&String(_0x3bc194[_0x144ef5(0x1bb)])[_0x144ef5(0x19f)]>0x0)return _0x3bc194;return getSqlQueryDetail(_0x3bc194[_0x144ef5(0x191)]);}export const sqlPull={'service':a212_0x14db3a(0x193),'command':'pull','description':a212_0x14db3a(0x192),'risk':a212_0x14db3a(0x1c0),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a212_0x14db3a(0x196),'description':a212_0x14db3a(0x1aa)},{'name':a212_0x14db3a(0x1b7),'type':a212_0x14db3a(0x1b1),'description':a212_0x14db3a(0x197)}],async 'dryRun'(_0x340c94){const _0x28fb8c=a212_0x14db3a,_0x7447f8=loadSqlProjectConfig(_0x340c94[_0x28fb8c(0x1a7)]),_0x3157bc=await readSqlLockFile(_0x7447f8[_0x28fb8c(0x186)]),{appLock:_0x418318}=ensureSqlLockScope(_0x3157bc??createEmptySqlLock(),_0x7447f8['appCode'],_0x7447f8[_0x28fb8c(0x199)],_0x28fb8c(0x19b)),_0x546317=await fetchAllSqlQueries(_0x340c94[_0x28fb8c(0x1a7)],{'sqlCode':_0x340c94[_0x28fb8c(0x1af)](_0x28fb8c(0x18e))||undefined,'sqlName':_0x340c94[_0x28fb8c(0x1af)](_0x28fb8c(0x19d))||undefined}),_0x42961c=[];for(const _0x1d2435 of _0x546317){const _0x42fab5=await ensureSqlContent(_0x1d2435),_0xf6723a=ensureRemoteSqlContent(_0x42fab5),_0x4d6fc0=detectModeFromSql(_0x42fab5),_0x35fda4=_0x42fab5['dbId']?await getDbName(_0x340c94[_0x28fb8c(0x1a7)],Number(_0x42fab5['dbId']))[_0x28fb8c(0x18b)](()=>undefined):undefined,_0x3f1921=buildLocalSqlFileContent({'sqlCode':_0x42fab5[_0x28fb8c(0x191)],'sqlName':_0x42fab5['sqlName'],'dbId':_0x42fab5[_0x28fb8c(0x1b4)]},_0xf6723a,{'dbName':_0x35fda4,'mode':_0x4d6fc0,'syncedAt':new Date()[_0x28fb8c(0x1a5)](),'description':_0x42fab5[_0x28fb8c(0x18a)]}),_0x4cdedc=buildSqlLockEntry(_0x42fab5,_0xf6723a,'',{'dbName':_0x35fda4}),_0x5443cb=resolveLocalSqlFilePath(_0x7447f8,_0x42fab5[_0x28fb8c(0x191)],_0x4cdedc);let _0x53554b='would_pull',_0xa73831;if(await fileExists(_0x5443cb)){const _0x46c183=await readFile(_0x5443cb,'utf8');isEquivalentPulledSqlFile(_0x46c183,_0x3f1921,_0x4d6fc0)?(_0x53554b=_0x28fb8c(0x1a9),_0xa73831=_0x28fb8c(0x1a4)):(_0x53554b=_0x28fb8c(0x189),_0xa73831='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x42961c[_0x28fb8c(0x1ad)]({'sqlCode':_0x42fab5[_0x28fb8c(0x191)],'sqlName':_0x42fab5['sqlName'],'filePath':_0x5443cb,'status':_0x53554b,'reason':_0xa73831});}return{'method':_0x28fb8c(0x18f),'url':_0x28fb8c(0x1b6),'body':{'appCode':_0x340c94[_0x28fb8c(0x1a7)],'sqlCode':_0x340c94[_0x28fb8c(0x1af)](_0x28fb8c(0x18e))||null,'sqlName':_0x340c94['str'](_0x28fb8c(0x19d))||null,'files':_0x42961c},'description':_0x28fb8c(0x1b0)+_0x42961c[_0x28fb8c(0x19f)]+_0x28fb8c(0x185)+_0x7447f8[_0x28fb8c(0x1c1)]};},async 'execute'(_0x53f97b){const _0x3f98ce=a212_0x14db3a,_0x19d223=loadSqlProjectConfig(_0x53f97b[_0x3f98ce(0x1a7)]),_0x233ec4=await readSqlLockFile(_0x19d223[_0x3f98ce(0x186)]),{lockData:_0x17bd43,appLock:_0x5ec5bc}=ensureSqlLockScope(_0x233ec4??createEmptySqlLock(),_0x19d223['appCode'],_0x19d223['sqlRoot'],_0x3f98ce(0x19b)),_0x32f602=_0x53f97b[_0x3f98ce(0x184)]('force'),_0x35a9c3=await fetchAllSqlQueries(_0x53f97b[_0x3f98ce(0x1a7)],{'sqlCode':_0x53f97b[_0x3f98ce(0x1af)]('sqlcode')||undefined,'sqlName':_0x53f97b['str'](_0x3f98ce(0x19d))||undefined});if(_0x35a9c3[_0x3f98ce(0x19f)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x40de1c=[],_0x579cbd=[];for(const _0x5d610c of _0x35a9c3){try{_0x40de1c['push'](await ensureSqlContent(_0x5d610c));}catch(_0x27bdc0){_0x579cbd[_0x3f98ce(0x1ad)]({'sqlCode':_0x5d610c['sqlCode'],'error':_0x27bdc0 instanceof Error?_0x27bdc0[_0x3f98ce(0x1ac)]:String(_0x27bdc0)});}}if(_0x32f602&&!_0x53f97b[_0x3f98ce(0x1a3)]){let _0x3bda49=![];for(const _0x2155e3 of _0x40de1c){const _0xcfaaa0=detectModeFromSql(_0x2155e3),_0x2ba70d=_0x2155e3[_0x3f98ce(0x1b4)]?await getDbName(_0x53f97b[_0x3f98ce(0x1a7)],Number(_0x2155e3['dbId']))[_0x3f98ce(0x18b)](()=>undefined):undefined,_0x9c7c76=buildLocalSqlFileContent({'sqlCode':_0x2155e3[_0x3f98ce(0x191)],'sqlName':_0x2155e3[_0x3f98ce(0x187)],'dbId':_0x2155e3['dbId']},ensureRemoteSqlContent(_0x2155e3),{'dbName':_0x2ba70d,'mode':_0xcfaaa0,'syncedAt':new Date()[_0x3f98ce(0x1a5)](),'description':_0x2155e3[_0x3f98ce(0x18a)]}),_0x48c904=resolveLocalSqlFilePath(_0x19d223,_0x2155e3['sqlCode'],buildSqlLockEntry(_0x2155e3,ensureRemoteSqlContent(_0x2155e3),'',{'dbName':_0x2ba70d}));if(await fileExists(_0x48c904)){const _0x4c84c8=await readFile(_0x48c904,_0x3f98ce(0x1b3));if(!isEquivalentPulledSqlFile(_0x4c84c8,_0x9c7c76,_0xcfaaa0)){_0x3bda49=!![];break;}}}if(_0x3bda49){const _0x2f9fe2=await confirmForceOverwrite(_0x3f98ce(0x188));if(!_0x2f9fe2)throw CliErrors['cancelled'](_0x3f98ce(0x1b5));}}const _0x52d1c0=cloneSqlLockData(_0x17bd43),_0x250be6=_0x52d1c0[_0x3f98ce(0x1a8)][_0x19d223[_0x3f98ce(0x1a7)]],_0x4f2f2d=[],_0x4e7f2a=[];for(const _0x16928b of _0x40de1c){const _0x5308fd=_0x250be6[_0x3f98ce(0x1bd)][_0x16928b[_0x3f98ce(0x191)]],_0x48925d=ensureRemoteSqlContent(_0x16928b),_0x2e92ed=detectModeFromSql(_0x16928b),_0x2c1752=_0x16928b[_0x3f98ce(0x1b4)]?await getDbName(_0x53f97b[_0x3f98ce(0x1a7)],Number(_0x16928b['dbId']))['catch'](()=>undefined):undefined,_0x773b6c=buildLocalSqlFileContent({'sqlCode':_0x16928b[_0x3f98ce(0x191)],'sqlName':_0x16928b[_0x3f98ce(0x187)],'dbId':_0x16928b[_0x3f98ce(0x1b4)]},_0x48925d,{'dbName':_0x2c1752,'mode':_0x2e92ed,'syncedAt':new Date()[_0x3f98ce(0x1a5)](),'description':_0x16928b['description']}),_0x2d9513=buildSqlLockEntry(_0x16928b,_0x48925d,computeSqlContentHash(_0x773b6c),{'dbName':_0x2c1752}),_0x2e9ef2=_0x2d9513[_0x3f98ce(0x19e)],_0x4d9643=join(_0x19d223[_0x3f98ce(0x1c1)],_0x2e9ef2);try{if(await fileExists(_0x4d9643)){const _0x390161=await readFile(_0x4d9643,_0x3f98ce(0x1b3));if(isEquivalentPulledSqlFile(_0x390161,_0x773b6c,_0x2e92ed)){_0x4e7f2a['push']({'sqlCode':_0x16928b['sqlCode'],'reason':_0x3f98ce(0x1a4)}),_0x250be6[_0x3f98ce(0x1bd)][_0x16928b[_0x3f98ce(0x191)]]={..._0x2d9513,'hash':computeSqlContentHash(_0x390161),'path':_0x2e9ef2};continue;}if(!_0x32f602){_0x4e7f2a[_0x3f98ce(0x1ad)]({'sqlCode':_0x16928b[_0x3f98ce(0x191)],'reason':_0x3f98ce(0x1b2)});continue;}}const _0x5305e8=_0x5308fd?.[_0x3f98ce(0x19e)]?join(_0x19d223[_0x3f98ce(0x1c1)],_0x5308fd[_0x3f98ce(0x19e)]):undefined;_0x5305e8&&_0x5305e8!==_0x4d9643&&await fileExists(_0x5305e8)&&await rm(_0x5305e8,{'force':!![]}),await ensureParentDirectory(_0x4d9643),await writeFile(_0x4d9643,_0x773b6c,_0x3f98ce(0x1b3)),_0x250be6[_0x3f98ce(0x1bd)][_0x16928b['sqlCode']]={..._0x2d9513,'path':_0x2e9ef2},_0x4f2f2d['push']({'sqlCode':_0x16928b[_0x3f98ce(0x191)],'filePath':_0x4d9643});}catch(_0x25afa6){_0x579cbd[_0x3f98ce(0x1ad)]({'sqlCode':_0x16928b['sqlCode'],'error':_0x25afa6 instanceof Error?_0x25afa6['message']:String(_0x25afa6)});}}return _0x250be6['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x19d223[_0x3f98ce(0x186)],_0x52d1c0),{'ok':_0x579cbd[_0x3f98ce(0x19f)]===0x0,'data':{'pulled':_0x4f2f2d,'skipped':_0x4e7f2a,'failed':_0x579cbd},'message':'Pull\x20complete:\x20'+_0x4f2f2d[_0x3f98ce(0x19f)]+'\x20written,\x20'+_0x4e7f2a[_0x3f98ce(0x19f)]+_0x3f98ce(0x1b9)+_0x579cbd[_0x3f98ce(0x19f)]+'\x20failed'};}};function detectModeFromSql(_0x44e4c8){const _0xe8940c=a212_0x14db3a,_0x1712ff=ensureRemoteSqlContent(_0x44e4c8),_0x585451=stripLocalSqlMetadata(_0x1712ff,_0xe8940c(0x19a))[_0xe8940c(0x1ba)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x585451))return _0xe8940c(0x19a);return'sql';}function isEquivalentPulledSqlFile(_0x4d6db5,_0x386159,_0x669bdf){return normalizePullComparableContent(_0x4d6db5,_0x669bdf)===normalizePullComparableContent(_0x386159,_0x669bdf);}function normalizePullComparableContent(_0x4de56a,_0x21fa5c){const _0x5be104=a212_0x14db3a,_0x53f46c=_0x4de56a[_0x5be104(0x18c)](/\r\n/g,'\x0a')[_0x5be104(0x1ae)]('\x0a'),_0x370b13=_0x53f46c['filter'](_0x15cd53=>!isSyncedAtMetadataLine(_0x15cd53,_0x21fa5c));return _0x370b13[_0x5be104(0x1bc)]('\x0a');}function isSyncedAtMetadataLine(_0x4c7baf,_0x504311){const _0x3ce4c9=a212_0x14db3a;if(_0x504311===_0x3ce4c9(0x19a))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x3ce4c9(0x1a6)](_0x4c7baf);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x3ce4c9(0x1a6)](_0x4c7baf);}
1
+ const a226_0x28bb34=a226_0x1b12;(function(_0x4808e1,_0x25550e){const _0x2b5948=a226_0x1b12,_0xec9362=_0x4808e1();while(!![]){try{const _0x297b18=-parseInt(_0x2b5948(0xa1))/0x1*(-parseInt(_0x2b5948(0xa0))/0x2)+-parseInt(_0x2b5948(0xb8))/0x3*(-parseInt(_0x2b5948(0x8c))/0x4)+parseInt(_0x2b5948(0xba))/0x5*(parseInt(_0x2b5948(0x9a))/0x6)+-parseInt(_0x2b5948(0x98))/0x7+parseInt(_0x2b5948(0xb0))/0x8+-parseInt(_0x2b5948(0x89))/0x9*(-parseInt(_0x2b5948(0x9b))/0xa)+-parseInt(_0x2b5948(0x92))/0xb;if(_0x297b18===_0x25550e)break;else _0xec9362['push'](_0xec9362['shift']());}catch(_0x443a2d){_0xec9362['push'](_0xec9362['shift']());}}}(a226_0x5a47,0x380e6));function a226_0x5a47(){const _0x56d870=['513060STDZMl','force','push','sqlcode','sqlName','2RAWSDN','429062PQytNz','Pull\x20complete:\x20','\x20skipped,\x20','catch','sqlCode','str','POST','cancelled','sqlRootDir','message','paging','boolean','toISOString','tableData','\x20failed','2866760GwBNPK','appCode','would_pull','sql','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','read','pull','name','3iEojXl','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','185sAUZwp','No\x20remote\x20SQL\x20queries\x20matched.','length','replace','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','mybatisXml','path','test','local\x20differs\x20from\x20remote','skipped','utf8','lockFilePath','unchanged','dbId','36qtVqmi','sqlRoot','description','398540mAIJtR','string','lastSync','Would\x20pull\x20','sqls','\x20written,\x20','7742867cWZSCN','Force\x20overwrite\x20local\x20unsynced\x20changes','Filter\x20by\x20SQL\x20display\x20name','Force\x20pull\x20cancelled.','split','nonInteractive','1218826DivkZG','filter','2490VJMiPv'];a226_0x5a47=function(){return _0x56d870;};return a226_0x5a47();}import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0xcd500b,_0x3e689f){const _0x34e048=a226_0x1b12,_0x2b2d72=[];let _0x1c5add=0x1;while(!![]){const _0x1995f0=await listSqlQueries(_0xcd500b,{'currentPage':_0x1c5add,'pageSize':PAGE_SIZE,'sqlCode':_0x3e689f[_0x34e048(0xa5)],'sqlName':_0x3e689f['sqlName']}),_0x3d348a=_0x1995f0[_0x34e048(0xae)]??[];_0x2b2d72[_0x34e048(0x9d)](..._0x3d348a);if(_0x3d348a[_0x34e048(0xbc)]===0x0)break;const _0x3e48a5=_0x1995f0[_0x34e048(0xab)]?.['totalCount'];if(_0x3e48a5!=null?_0x2b2d72[_0x34e048(0xbc)]>=_0x3e48a5:_0x3d348a[_0x34e048(0xbc)]<PAGE_SIZE)break;_0x1c5add++;}return _0x2b2d72;}async function ensureSqlContent(_0x24a13f){const _0x50d6bd=a226_0x1b12;if(_0x24a13f['sqlContent']!=null&&String(_0x24a13f['sqlContent'])[_0x50d6bd(0xbc)]>0x0)return _0x24a13f;return getSqlQueryDetail(_0x24a13f['sqlCode']);}export const sqlPull={'service':a226_0x28bb34(0xb3),'command':'pull','description':a226_0x28bb34(0xb9),'risk':a226_0x28bb34(0xb5),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a226_0x28bb34(0x8d),'description':a226_0x28bb34(0x94)},{'name':a226_0x28bb34(0x9c),'type':a226_0x28bb34(0xac),'description':a226_0x28bb34(0x93)}],async 'dryRun'(_0x5cd8ed){const _0x4a0e10=a226_0x28bb34,_0x445693=loadSqlProjectConfig(_0x5cd8ed[_0x4a0e10(0xb1)]),_0x4edd82=await readSqlLockFile(_0x445693['lockFilePath']),{appLock:_0x25f6ca}=ensureSqlLockScope(_0x4edd82??createEmptySqlLock(),_0x445693[_0x4a0e10(0xb1)],_0x445693[_0x4a0e10(0x8a)],'pull'),_0x1382f9=await fetchAllSqlQueries(_0x5cd8ed['appCode'],{'sqlCode':_0x5cd8ed[_0x4a0e10(0xa6)](_0x4a0e10(0x9e))||undefined,'sqlName':_0x5cd8ed[_0x4a0e10(0xa6)](_0x4a0e10(0xb7))||undefined}),_0x5d9926=[];for(const _0x515c14 of _0x1382f9){const _0x22f9e5=await ensureSqlContent(_0x515c14),_0x5a3281=ensureRemoteSqlContent(_0x22f9e5),_0x20ca55=detectModeFromSql(_0x22f9e5),_0x598f9b=_0x22f9e5[_0x4a0e10(0x88)]?await getDbName(_0x5cd8ed[_0x4a0e10(0xb1)],Number(_0x22f9e5[_0x4a0e10(0x88)]))[_0x4a0e10(0xa4)](()=>undefined):undefined,_0x1515cd=buildLocalSqlFileContent({'sqlCode':_0x22f9e5[_0x4a0e10(0xa5)],'sqlName':_0x22f9e5[_0x4a0e10(0x9f)],'dbId':_0x22f9e5[_0x4a0e10(0x88)]},_0x5a3281,{'dbName':_0x598f9b,'mode':_0x20ca55,'syncedAt':new Date()[_0x4a0e10(0xad)](),'description':_0x22f9e5[_0x4a0e10(0x8b)]}),_0x229a7f=buildSqlLockEntry(_0x22f9e5,_0x5a3281,'',{'dbName':_0x598f9b}),_0x5c1f05=resolveLocalSqlFilePath(_0x445693,_0x22f9e5[_0x4a0e10(0xa5)],_0x229a7f);let _0x21d2ef=_0x4a0e10(0xb2),_0x32a211;if(await fileExists(_0x5c1f05)){const _0x9467c2=await readFile(_0x5c1f05,_0x4a0e10(0x85));isEquivalentPulledSqlFile(_0x9467c2,_0x1515cd,_0x20ca55)?(_0x21d2ef=_0x4a0e10(0x84),_0x32a211=_0x4a0e10(0x87)):(_0x21d2ef='conflict',_0x32a211=_0x4a0e10(0x7f));}_0x5d9926['push']({'sqlCode':_0x22f9e5['sqlCode'],'sqlName':_0x22f9e5[_0x4a0e10(0x9f)],'filePath':_0x5c1f05,'status':_0x21d2ef,'reason':_0x32a211});}return{'method':_0x4a0e10(0xa7),'url':_0x4a0e10(0xb4),'body':{'appCode':_0x5cd8ed[_0x4a0e10(0xb1)],'sqlCode':_0x5cd8ed[_0x4a0e10(0xa6)]('sqlcode')||null,'sqlName':_0x5cd8ed[_0x4a0e10(0xa6)]('name')||null,'files':_0x5d9926},'description':_0x4a0e10(0x8f)+_0x5d9926[_0x4a0e10(0xbc)]+'\x20SQL\x20file(s)\x20into\x20'+_0x445693[_0x4a0e10(0xa9)]};},async 'execute'(_0x35f092){const _0x255a93=a226_0x28bb34,_0x21588b=loadSqlProjectConfig(_0x35f092[_0x255a93(0xb1)]),_0x2eb344=await readSqlLockFile(_0x21588b[_0x255a93(0x86)]),{lockData:_0x2b7d19,appLock:_0x1ae898}=ensureSqlLockScope(_0x2eb344??createEmptySqlLock(),_0x21588b[_0x255a93(0xb1)],_0x21588b['sqlRoot'],_0x255a93(0xb6)),_0x1013bf=_0x35f092['bool']('force'),_0x230900=await fetchAllSqlQueries(_0x35f092[_0x255a93(0xb1)],{'sqlCode':_0x35f092[_0x255a93(0xa6)]('sqlcode')||undefined,'sqlName':_0x35f092[_0x255a93(0xa6)](_0x255a93(0xb7))||undefined});if(_0x230900['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x255a93(0xbb)};const _0x5519dc=[],_0x3bc892=[];for(const _0x2b41d1 of _0x230900){try{_0x5519dc['push'](await ensureSqlContent(_0x2b41d1));}catch(_0xa59fbb){_0x3bc892[_0x255a93(0x9d)]({'sqlCode':_0x2b41d1[_0x255a93(0xa5)],'error':_0xa59fbb instanceof Error?_0xa59fbb[_0x255a93(0xaa)]:String(_0xa59fbb)});}}if(_0x1013bf&&!_0x35f092[_0x255a93(0x97)]){let _0x34e2d9=![];for(const _0x387508 of _0x5519dc){const _0x4ad24d=detectModeFromSql(_0x387508),_0x35fe91=_0x387508[_0x255a93(0x88)]?await getDbName(_0x35f092[_0x255a93(0xb1)],Number(_0x387508[_0x255a93(0x88)]))[_0x255a93(0xa4)](()=>undefined):undefined,_0x5854c0=buildLocalSqlFileContent({'sqlCode':_0x387508[_0x255a93(0xa5)],'sqlName':_0x387508['sqlName'],'dbId':_0x387508['dbId']},ensureRemoteSqlContent(_0x387508),{'dbName':_0x35fe91,'mode':_0x4ad24d,'syncedAt':new Date()[_0x255a93(0xad)](),'description':_0x387508[_0x255a93(0x8b)]}),_0x43a46f=resolveLocalSqlFilePath(_0x21588b,_0x387508['sqlCode'],buildSqlLockEntry(_0x387508,ensureRemoteSqlContent(_0x387508),'',{'dbName':_0x35fe91}));if(await fileExists(_0x43a46f)){const _0x188d49=await readFile(_0x43a46f,_0x255a93(0x85));if(!isEquivalentPulledSqlFile(_0x188d49,_0x5854c0,_0x4ad24d)){_0x34e2d9=!![];break;}}}if(_0x34e2d9){const _0x28a311=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x28a311)throw CliErrors[_0x255a93(0xa8)](_0x255a93(0x95));}}const _0x78d826=cloneSqlLockData(_0x2b7d19),_0x53c04f=_0x78d826['apps'][_0x21588b['appCode']],_0x5259cb=[],_0x291ea6=[];for(const _0xfcd9a9 of _0x5519dc){const _0x702443=_0x53c04f['sqls'][_0xfcd9a9[_0x255a93(0xa5)]],_0x492f1a=ensureRemoteSqlContent(_0xfcd9a9),_0x3e040b=detectModeFromSql(_0xfcd9a9),_0x3b1fa8=_0xfcd9a9[_0x255a93(0x88)]?await getDbName(_0x35f092['appCode'],Number(_0xfcd9a9[_0x255a93(0x88)]))[_0x255a93(0xa4)](()=>undefined):undefined,_0x326d7b=buildLocalSqlFileContent({'sqlCode':_0xfcd9a9[_0x255a93(0xa5)],'sqlName':_0xfcd9a9[_0x255a93(0x9f)],'dbId':_0xfcd9a9[_0x255a93(0x88)]},_0x492f1a,{'dbName':_0x3b1fa8,'mode':_0x3e040b,'syncedAt':new Date()[_0x255a93(0xad)](),'description':_0xfcd9a9[_0x255a93(0x8b)]}),_0x31d269=buildSqlLockEntry(_0xfcd9a9,_0x492f1a,computeSqlContentHash(_0x326d7b),{'dbName':_0x3b1fa8}),_0x2565ec=_0x31d269[_0x255a93(0x81)],_0x1a9aa1=join(_0x21588b[_0x255a93(0xa9)],_0x2565ec);try{if(await fileExists(_0x1a9aa1)){const _0x24e92a=await readFile(_0x1a9aa1,_0x255a93(0x85));if(isEquivalentPulledSqlFile(_0x24e92a,_0x326d7b,_0x3e040b)){_0x291ea6['push']({'sqlCode':_0xfcd9a9['sqlCode'],'reason':_0x255a93(0x87)}),_0x53c04f[_0x255a93(0x90)][_0xfcd9a9['sqlCode']]={..._0x31d269,'hash':computeSqlContentHash(_0x24e92a),'path':_0x2565ec};continue;}if(!_0x1013bf){_0x291ea6[_0x255a93(0x9d)]({'sqlCode':_0xfcd9a9[_0x255a93(0xa5)],'reason':_0x255a93(0x83)});continue;}}const _0x18ad23=_0x702443?.[_0x255a93(0x81)]?join(_0x21588b[_0x255a93(0xa9)],_0x702443[_0x255a93(0x81)]):undefined;_0x18ad23&&_0x18ad23!==_0x1a9aa1&&await fileExists(_0x18ad23)&&await rm(_0x18ad23,{'force':!![]}),await ensureParentDirectory(_0x1a9aa1),await writeFile(_0x1a9aa1,_0x326d7b,_0x255a93(0x85)),_0x53c04f['sqls'][_0xfcd9a9[_0x255a93(0xa5)]]={..._0x31d269,'path':_0x2565ec},_0x5259cb[_0x255a93(0x9d)]({'sqlCode':_0xfcd9a9[_0x255a93(0xa5)],'filePath':_0x1a9aa1});}catch(_0x253792){_0x3bc892['push']({'sqlCode':_0xfcd9a9[_0x255a93(0xa5)],'error':_0x253792 instanceof Error?_0x253792[_0x255a93(0xaa)]:String(_0x253792)});}}return _0x53c04f[_0x255a93(0x8e)]=new Date()[_0x255a93(0xad)](),await writeSqlLockFile(_0x21588b[_0x255a93(0x86)],_0x78d826),{'ok':_0x3bc892[_0x255a93(0xbc)]===0x0,'data':{'pulled':_0x5259cb,'skipped':_0x291ea6,'failed':_0x3bc892},'message':_0x255a93(0xa2)+_0x5259cb[_0x255a93(0xbc)]+_0x255a93(0x91)+_0x291ea6['length']+_0x255a93(0xa3)+_0x3bc892[_0x255a93(0xbc)]+_0x255a93(0xaf)};}};function detectModeFromSql(_0x327746){const _0x51d0b9=a226_0x28bb34,_0x121efd=ensureRemoteSqlContent(_0x327746),_0x5d5dc6=stripLocalSqlMetadata(_0x121efd,_0x51d0b9(0x80))['trimStart']();if(/^<(select|insert|update|delete)\b/i['test'](_0x5d5dc6))return _0x51d0b9(0x80);return _0x51d0b9(0xb3);}function a226_0x1b12(_0x1b181c,_0x1ce365){_0x1b181c=_0x1b181c-0x7e;const _0x5a47a7=a226_0x5a47();let _0x1b121a=_0x5a47a7[_0x1b181c];return _0x1b121a;}function isEquivalentPulledSqlFile(_0xdeaa6d,_0x5167ea,_0x5dced7){return normalizePullComparableContent(_0xdeaa6d,_0x5dced7)===normalizePullComparableContent(_0x5167ea,_0x5dced7);}function normalizePullComparableContent(_0x347559,_0x2caa5e){const _0x2ae761=a226_0x28bb34,_0x7fe1c8=_0x347559[_0x2ae761(0x7e)](/\r\n/g,'\x0a')[_0x2ae761(0x96)]('\x0a'),_0x44bac1=_0x7fe1c8[_0x2ae761(0x99)](_0x44a112=>!isSyncedAtMetadataLine(_0x44a112,_0x2caa5e));return _0x44bac1['join']('\x0a');}function isSyncedAtMetadataLine(_0x5ca201,_0x4f4836){const _0x1abe96=a226_0x28bb34;if(_0x4f4836==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x1abe96(0x82)](_0x5ca201);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x1abe96(0x82)](_0x5ca201);}
@@ -1 +1 @@
1
- function a213_0x1c47(_0x32a822,_0x3d123b){_0x32a822=_0x32a822-0x157;const _0xff3c17=a213_0xff3c();let _0x1c4766=_0xff3c17[_0x32a822];return _0x1c4766;}const a213_0x479043=a213_0x1c47;(function(_0x498031,_0x588216){const _0x54b5b0=a213_0x1c47,_0x3503a9=_0x498031();while(!![]){try{const _0x1a18cb=-parseInt(_0x54b5b0(0x188))/0x1*(-parseInt(_0x54b5b0(0x181))/0x2)+-parseInt(_0x54b5b0(0x159))/0x3+-parseInt(_0x54b5b0(0x164))/0x4*(-parseInt(_0x54b5b0(0x19b))/0x5)+parseInt(_0x54b5b0(0x19c))/0x6*(parseInt(_0x54b5b0(0x18f))/0x7)+-parseInt(_0x54b5b0(0x17a))/0x8+parseInt(_0x54b5b0(0x191))/0x9+-parseInt(_0x54b5b0(0x15f))/0xa;if(_0x1a18cb===_0x588216)break;else _0x3503a9['push'](_0x3503a9['shift']());}catch(_0x41639f){_0x3503a9['push'](_0x3503a9['shift']());}}}(a213_0xff3c,0x597d0));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a213_0xff3c(){const _0x5b2eed=['927288xLEvgi','No\x20database\x20matches\x20local\x20directory\x20\x22','lastSync','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','remoteId','/smartapi/custom/updateUserCustomSql','5509920vPisjp','push','has','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','catch','58260IZhMSO','\x20pushed,\x20','get','relativePath','dbName','path','hash','lockFilePath','\x22\x20for\x20sqlCode\x20','dbId','Local\x20SQL\x20not\x20found:\x20','sqlcode','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','length','mode','boolean','startsWith','sqlRootDir','utf8','\x20failed','Push\x20local\x20SQL\x20files\x20to\x20remote','filter','1684232UCTbEF','Local\x20directory\x20\x22','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','message','filePath','sqlRoot','map','253714sCXYTF','str','sqlCode','sql','replace','sqls','toISOString','4QPvJpx','exec','No\x20local\x20SQL\x20files\x20found.','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','sqlName','projectRoot','dbDirectory','7DCWgvp','unchanged','5643045WkXPDE','isFinite','\x20skipped,\x20','appCode','entries','bool','force','Push\x20complete:\x20','validation','\x20SQL\x20file(s)','15pCDplB','1554198xqzpKj','version','Would\x20push\x20'];a213_0xff3c=function(){return _0x5b2eed;};return a213_0xff3c();}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x52015c,_0xf5e871,_0x1f15de){const _0x4fbac4=a213_0x1c47,_0x1e4707=await scanLocalSqlQueries(_0x52015c),_0x117351=new Map();for(const _0xc26864 of _0x1e4707){if(_0x1f15de&&_0xc26864['sqlCode']!==_0x1f15de)continue;const _0xc9af8b=_0x117351[_0x4fbac4(0x166)](_0xc26864[_0x4fbac4(0x183)])??[];_0xc9af8b[_0x4fbac4(0x160)](_0xc26864),_0x117351['set'](_0xc26864[_0x4fbac4(0x183)],_0xc9af8b);}if(_0x1f15de&&!_0x117351[_0x4fbac4(0x161)](_0x1f15de))throw CliErrors['validation'](_0x4fbac4(0x16e)+_0x1f15de);const _0x50b389=[];for(const [_0x28d3d2,_0x4bbb2c]of _0x117351[_0x4fbac4(0x195)]()){if(_0x4bbb2c[_0x4fbac4(0x171)]===0x1){_0x50b389[_0x4fbac4(0x160)](_0x4bbb2c[0x0]);continue;}const _0x310f4b=_0xf5e871[_0x4fbac4(0x186)][_0x28d3d2],_0x4aad03=_0x310f4b?.['path'],_0x210718=_0x4aad03?_0x4bbb2c[_0x4fbac4(0x179)](_0x3fc1bc=>_0x3fc1bc[_0x4fbac4(0x167)]!==_0x4aad03):_0x4bbb2c;if(_0x310f4b&&_0x210718[_0x4fbac4(0x171)]===0x1){_0x50b389['push'](_0x210718[0x0]);continue;}throw CliErrors['validation']('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x28d3d2+_0x4fbac4(0x18b));}return _0x50b389;}export const sqlPush={'service':a213_0x479043(0x184),'command':'push','description':a213_0x479043(0x178),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a213_0x479043(0x173),'description':a213_0x479043(0x170)}],async 'dryRun'(_0x93173e){const _0x5f5514=a213_0x479043,_0x38e851=loadSqlProjectConfig(_0x93173e[_0x5f5514(0x194)]),_0x57fe11=await readSqlLockFile(_0x38e851['lockFilePath']),{appLock:_0x68535d}=ensureSqlLockScope(_0x57fe11??createEmptySqlLock(),_0x93173e['appCode'],_0x38e851[_0x5f5514(0x17f)],_0x5f5514(0x160)),_0x27ff3b=await getTargetSqlQueries(_0x38e851,_0x68535d,_0x93173e[_0x5f5514(0x182)](_0x5f5514(0x16f))||undefined),_0x2da0c5=[];for(const _0x300489 of _0x27ff3b){const _0x2c95db=await computeSqlFileHash(_0x300489[_0x5f5514(0x17e)]),_0x51511d=_0x68535d[_0x5f5514(0x186)][_0x300489['sqlCode']],_0x1d8a8a=!!_0x51511d&&(_0x51511d[_0x5f5514(0x169)]!==_0x300489[_0x5f5514(0x167)]||!!_0x300489[_0x5f5514(0x18c)]&&_0x51511d['sqlName']!==_0x300489[_0x5f5514(0x18c)]);if(!_0x93173e[_0x5f5514(0x196)](_0x5f5514(0x197))&&_0x51511d&&_0x51511d[_0x5f5514(0x16a)]===_0x2c95db&&!_0x1d8a8a)continue;_0x2da0c5[_0x5f5514(0x160)](_0x300489[_0x5f5514(0x183)]);}return{'method':'POST','url':_0x5f5514(0x15e),'body':{'sqlCodes':_0x2da0c5,'appCode':_0x93173e[_0x5f5514(0x194)]},'description':_0x5f5514(0x158)+_0x2da0c5[_0x5f5514(0x171)]+_0x5f5514(0x19a)};},async 'execute'(_0x408d6e){const _0x333ce4=a213_0x479043,_0x5094df=loadSqlProjectConfig(_0x408d6e['appCode']),_0x3555f1=await readSqlLockFile(_0x5094df[_0x333ce4(0x16b)]),{lockData:_0x2c3096,appLock:_0x398920}=ensureSqlLockScope(_0x3555f1??createEmptySqlLock(),_0x408d6e[_0x333ce4(0x194)],_0x5094df[_0x333ce4(0x17f)],'push'),_0x259281=await getTargetSqlQueries(_0x5094df,_0x398920,_0x408d6e['str'](_0x333ce4(0x16f))||undefined);if(_0x259281[_0x333ce4(0x171)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x333ce4(0x18a)};const _0x3994df=[],_0x353021=[],_0xcd7b60=[];for(const _0x377615 of _0x259281){const _0x4785fb=_0x398920[_0x333ce4(0x186)][_0x377615[_0x333ce4(0x183)]];if(!_0x4785fb){_0xcd7b60[_0x333ce4(0x160)]({'sqlCode':_0x377615['sqlCode'],'error':_0x333ce4(0x17c)});continue;}try{const _0x921ba4=await computeSqlFileHash(_0x377615[_0x333ce4(0x17e)]),_0x356ff3=_0x4785fb[_0x333ce4(0x169)]!==_0x377615[_0x333ce4(0x167)]||!!_0x377615[_0x333ce4(0x18c)]&&_0x4785fb[_0x333ce4(0x18c)]!==_0x377615[_0x333ce4(0x18c)];if(!_0x408d6e[_0x333ce4(0x196)]('force')&&_0x4785fb[_0x333ce4(0x16a)]===_0x921ba4&&!_0x356ff3){_0x353021[_0x333ce4(0x160)]({'sqlCode':_0x377615[_0x333ce4(0x183)],'reason':_0x333ce4(0x190)});continue;}if(_0x4785fb[_0x333ce4(0x157)]==null){_0xcd7b60[_0x333ce4(0x160)]({'sqlCode':_0x377615[_0x333ce4(0x183)],'error':_0x333ce4(0x162)});continue;}const _0x1f4566=await readFile(_0x377615[_0x333ce4(0x17e)],_0x333ce4(0x176)),_0x1d9c76=stripLocalSqlMetadata(_0x1f4566,_0x377615[_0x333ce4(0x172)]),_0xf862df=_0x377615['sqlName']||_0x4785fb[_0x333ce4(0x18c)],_0x782fb2=await resolveTargetDbBinding(_0x408d6e[_0x333ce4(0x194)],_0x377615,_0x4785fb),_0x24951c=await updateSqlQuery({'id':_0x4785fb[_0x333ce4(0x15d)],'appCode':_0x408d6e['appCode'],'sqlCode':_0x377615[_0x333ce4(0x183)],'sqlName':_0xf862df,'dbId':_0x782fb2[_0x333ce4(0x16d)],'version':_0x4785fb['version'],'sqlContent':_0x1d9c76,'sqlConfig':_0x4785fb['sqlConfig']??undefined}),_0x18a1d3=_0x24951c[_0x333ce4(0x16d)]?await getDbName(_0x408d6e['appCode'],Number(_0x24951c[_0x333ce4(0x16d)]))[_0x333ce4(0x163)](()=>_0x782fb2[_0x333ce4(0x168)]):_0x782fb2[_0x333ce4(0x168)];_0x398920[_0x333ce4(0x186)][_0x377615[_0x333ce4(0x183)]]={...buildSqlLockEntry(_0x24951c,_0x1d9c76,_0x921ba4,{'dbName':_0x18a1d3}),'path':_0x377615['relativePath'],'mode':_0x4785fb[_0x333ce4(0x172)]},await archivePreviousSqlFileIfNeeded(_0x5094df,_0x4785fb[_0x333ce4(0x169)],_0x377615[_0x333ce4(0x167)]),_0x3994df['push']({'sqlCode':_0x377615[_0x333ce4(0x183)],'remoteId':_0x4785fb['remoteId']});}catch(_0x489d55){_0xcd7b60[_0x333ce4(0x160)]({'sqlCode':_0x377615[_0x333ce4(0x183)],'error':_0x489d55 instanceof Error?_0x489d55[_0x333ce4(0x17d)]:String(_0x489d55)});}}_0x398920[_0x333ce4(0x15b)]=new Date()[_0x333ce4(0x187)](),await writeSqlLockFile(_0x5094df[_0x333ce4(0x16b)],_0x2c3096);const _0x2a640e=_0xcd7b60[_0x333ce4(0x171)]===0x0;return{'ok':_0x2a640e,'data':{'pushed':_0x3994df,'skipped':_0x353021,'failed':_0xcd7b60},'message':_0x333ce4(0x198)+_0x3994df[_0x333ce4(0x171)]+_0x333ce4(0x165)+_0x353021['length']+_0x333ce4(0x193)+_0xcd7b60['length']+_0x333ce4(0x177)};}};async function archivePreviousSqlFileIfNeeded(_0x2927aa,_0x5be5d5,_0x1311c9){const _0xef4694=a213_0x479043;if(!_0x5be5d5||_0x5be5d5===_0x1311c9)return;const _0x238484=join(_0x2927aa[_0xef4694(0x175)],_0x5be5d5);if(!await fileExists(_0x238484))return;const _0x502d4c=await moveToTrash(_0x2927aa[_0xef4694(0x18d)],_0x2927aa['trashDir'],_0x238484);await cleanupEmptyDirectories(dirname(_0x238484),_0x2927aa['sqlRootDir']),void _0x502d4c;}async function moveToTrash(_0x504097,_0x30b3a4,_0x3db04f){const _0x29313c=a213_0x479043,_0x5d0fd2=new Date()[_0x29313c(0x187)]()[_0x29313c(0x185)](/[:.]/g,'-'),_0x9dfe70=relative(_0x504097,_0x3db04f),_0x583b3b=join(_0x30b3a4,_0x5d0fd2,_0x9dfe70);return await mkdir(dirname(_0x583b3b),{'recursive':!![]}),await rename(_0x3db04f,_0x583b3b),_0x583b3b;}async function cleanupEmptyDirectories(_0x48d328,_0x835b00){const _0x235ca5=a213_0x479043;let _0x471655=resolve(_0x48d328);const _0x4b3555=resolve(_0x835b00);while(_0x471655[_0x235ca5(0x174)](''+_0x4b3555+sep)||_0x471655===_0x4b3555){if(_0x471655===_0x4b3555)return;try{const _0x5615f0=await readdir(_0x471655);if(_0x5615f0['length']>0x0)return;await rmdir(_0x471655);}catch{return;}_0x471655=dirname(_0x471655);}}async function resolveTargetDbBinding(_0x2d2175,_0x40cec9,_0x3338b3){const _0x485261=a213_0x479043,_0x2380b8=_0x40cec9[_0x485261(0x18e)];if(!_0x2380b8)return{'dbId':_0x3338b3['dbId'],'dbName':_0x3338b3[_0x485261(0x168)]};const _0x2f2f00=buildDbDirectoryName(_0x3338b3['dbName'],_0x3338b3[_0x485261(0x16d)]);if(_0x2380b8===_0x2f2f00)return{'dbId':_0x3338b3[_0x485261(0x16d)],'dbName':_0x3338b3[_0x485261(0x168)]};const _0x48003d=parseExplicitDbDirectory(_0x2380b8);if(_0x48003d!=null)return{'dbId':_0x48003d,'dbName':await getDbName(_0x2d2175,_0x48003d)[_0x485261(0x163)](()=>undefined)};const _0x5e5d90=await listDatabases(_0x2d2175),_0x30e336=_0x5e5d90[_0x485261(0x179)](_0x19a753=>buildDbDirectoryName(_0x19a753['dbName'],_0x19a753[_0x485261(0x16d)])===_0x2380b8);if(_0x30e336[_0x485261(0x171)]===0x1)return{'dbId':_0x30e336[0x0]['dbId'],'dbName':_0x30e336[0x0][_0x485261(0x168)]};if(_0x30e336['length']===0x0)throw CliErrors[_0x485261(0x199)](_0x485261(0x15a)+_0x2380b8+_0x485261(0x16c)+_0x40cec9['sqlCode']+'.');const _0x31687f=_0x30e336[_0x485261(0x180)](_0x30e7df=>_0x30e7df[_0x485261(0x168)]+'\x20('+_0x30e7df['dbId']+')')['join'](',\x20');throw CliErrors['validation'](_0x485261(0x17b)+_0x2380b8+_0x485261(0x15c)+_0x40cec9[_0x485261(0x183)]+':\x20'+_0x31687f);}function parseExplicitDbDirectory(_0x4722a5){const _0x421fe3=a213_0x479043,_0x49213e=/^db-(\d+)$/[_0x421fe3(0x189)](_0x4722a5);if(!_0x49213e)return null;const _0x3ab8f1=Number(_0x49213e[0x1]);return Number[_0x421fe3(0x192)](_0x3ab8f1)&&_0x3ab8f1>0x0?_0x3ab8f1:null;}
1
+ const a227_0x596368=a227_0x3094;(function(_0x3d0703,_0x3aa844){const _0x45e595=a227_0x3094,_0x942296=_0x3d0703();while(!![]){try{const _0xf8370b=parseInt(_0x45e595(0x1f0))/0x1*(parseInt(_0x45e595(0x1e1))/0x2)+parseInt(_0x45e595(0x1e3))/0x3+-parseInt(_0x45e595(0x1dd))/0x4+parseInt(_0x45e595(0x1d9))/0x5*(-parseInt(_0x45e595(0x1d7))/0x6)+-parseInt(_0x45e595(0x1f2))/0x7*(-parseInt(_0x45e595(0x1de))/0x8)+parseInt(_0x45e595(0x1d2))/0x9*(-parseInt(_0x45e595(0x1f5))/0xa)+-parseInt(_0x45e595(0x1dc))/0xb;if(_0xf8370b===_0x3aa844)break;else _0x942296['push'](_0x942296['shift']());}catch(_0x9b6be9){_0x942296['push'](_0x942296['shift']());}}}(a227_0x1e86,0xdc891));function a227_0x3094(_0xde04f4,_0x156c05){_0xde04f4=_0xde04f4-0x1c8;const _0x1e862c=a227_0x1e86();let _0x309464=_0x1e862c[_0xde04f4];return _0x309464;}import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x437de4,_0x54245e,_0x1fdca5){const _0x2c4399=a227_0x3094,_0x866b31=await scanLocalSqlQueries(_0x437de4),_0x2b3f23=new Map();for(const _0x4e9b09 of _0x866b31){if(_0x1fdca5&&_0x4e9b09[_0x2c4399(0x1e2)]!==_0x1fdca5)continue;const _0x12888a=_0x2b3f23['get'](_0x4e9b09['sqlCode'])??[];_0x12888a[_0x2c4399(0x1e5)](_0x4e9b09),_0x2b3f23['set'](_0x4e9b09[_0x2c4399(0x1e2)],_0x12888a);}if(_0x1fdca5&&!_0x2b3f23['has'](_0x1fdca5))throw CliErrors['validation'](_0x2c4399(0x1e6)+_0x1fdca5);const _0x49e369=[];for(const [_0x583d33,_0x19beb0]of _0x2b3f23[_0x2c4399(0x1ff)]()){if(_0x19beb0[_0x2c4399(0x1db)]===0x1){_0x49e369[_0x2c4399(0x1e5)](_0x19beb0[0x0]);continue;}const _0x163d56=_0x54245e[_0x2c4399(0x1d5)][_0x583d33],_0x993040=_0x163d56?.[_0x2c4399(0x1eb)],_0x5cc56f=_0x993040?_0x19beb0['filter'](_0xd4e863=>_0xd4e863[_0x2c4399(0x1f4)]!==_0x993040):_0x19beb0;if(_0x163d56&&_0x5cc56f['length']===0x1){_0x49e369[_0x2c4399(0x1e5)](_0x5cc56f[0x0]);continue;}throw CliErrors[_0x2c4399(0x1f7)](_0x2c4399(0x1cb)+_0x583d33+_0x2c4399(0x1fc));}return _0x49e369;}export const sqlPush={'service':a227_0x596368(0x1e7),'command':a227_0x596368(0x1e5),'description':a227_0x596368(0x1cf),'risk':a227_0x596368(0x1cd),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a227_0x596368(0x1ce),'type':'boolean','description':a227_0x596368(0x1e8)}],async 'dryRun'(_0x512745){const _0x15e241=a227_0x596368,_0x24810e=loadSqlProjectConfig(_0x512745[_0x15e241(0x1d0)]),_0x409587=await readSqlLockFile(_0x24810e[_0x15e241(0x1df)]),{appLock:_0x11af14}=ensureSqlLockScope(_0x409587??createEmptySqlLock(),_0x512745[_0x15e241(0x1d0)],_0x24810e[_0x15e241(0x201)],_0x15e241(0x1e5)),_0x117482=await getTargetSqlQueries(_0x24810e,_0x11af14,_0x512745['str'](_0x15e241(0x1ee))||undefined),_0x54b4cc=[];for(const _0x50ad95 of _0x117482){const _0x3c5597=await computeSqlFileHash(_0x50ad95[_0x15e241(0x1d3)]),_0x46078e=_0x11af14[_0x15e241(0x1d5)][_0x50ad95['sqlCode']],_0x2e5741=!!_0x46078e&&(_0x46078e[_0x15e241(0x1eb)]!==_0x50ad95[_0x15e241(0x1f4)]||!!_0x50ad95[_0x15e241(0x1c9)]&&_0x46078e[_0x15e241(0x1c9)]!==_0x50ad95[_0x15e241(0x1c9)]);if(!_0x512745[_0x15e241(0x1ec)](_0x15e241(0x1ce))&&_0x46078e&&_0x46078e['hash']===_0x3c5597&&!_0x2e5741)continue;_0x54b4cc[_0x15e241(0x1e5)](_0x50ad95[_0x15e241(0x1e2)]);}return{'method':'POST','url':_0x15e241(0x1f3),'body':{'sqlCodes':_0x54b4cc,'appCode':_0x512745[_0x15e241(0x1d0)]},'description':'Would\x20push\x20'+_0x54b4cc[_0x15e241(0x1db)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x3820d1){const _0x437228=a227_0x596368,_0x12e85f=loadSqlProjectConfig(_0x3820d1['appCode']),_0x5c2b48=await readSqlLockFile(_0x12e85f[_0x437228(0x1df)]),{lockData:_0x2a9210,appLock:_0x5b6b83}=ensureSqlLockScope(_0x5c2b48??createEmptySqlLock(),_0x3820d1[_0x437228(0x1d0)],_0x12e85f['sqlRoot'],_0x437228(0x1e5)),_0x414510=await getTargetSqlQueries(_0x12e85f,_0x5b6b83,_0x3820d1[_0x437228(0x1cc)]('sqlcode')||undefined);if(_0x414510[_0x437228(0x1db)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x217cf3=[],_0x24300c=[],_0x1ecfe2=[];for(const _0xdf2e9f of _0x414510){const _0x3acfae=_0x5b6b83['sqls'][_0xdf2e9f[_0x437228(0x1e2)]];if(!_0x3acfae){_0x1ecfe2[_0x437228(0x1e5)]({'sqlCode':_0xdf2e9f[_0x437228(0x1e2)],'error':_0x437228(0x1d4)});continue;}try{const _0x3340e9=await computeSqlFileHash(_0xdf2e9f[_0x437228(0x1d3)]),_0x12bdc=_0x3acfae[_0x437228(0x1eb)]!==_0xdf2e9f['relativePath']||!!_0xdf2e9f['sqlName']&&_0x3acfae[_0x437228(0x1c9)]!==_0xdf2e9f['sqlName'];if(!_0x3820d1[_0x437228(0x1ec)]('force')&&_0x3acfae[_0x437228(0x1fd)]===_0x3340e9&&!_0x12bdc){_0x24300c[_0x437228(0x1e5)]({'sqlCode':_0xdf2e9f[_0x437228(0x1e2)],'reason':_0x437228(0x1fb)});continue;}if(_0x3acfae['version']==null){_0x1ecfe2[_0x437228(0x1e5)]({'sqlCode':_0xdf2e9f[_0x437228(0x1e2)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x2611c5=await readFile(_0xdf2e9f['filePath'],_0x437228(0x203)),_0x5dc164=stripLocalSqlMetadata(_0x2611c5,_0xdf2e9f[_0x437228(0x1e0)]),_0x3eb98b=_0xdf2e9f[_0x437228(0x1c9)]||_0x3acfae[_0x437228(0x1c9)],_0x3cb177=await resolveTargetDbBinding(_0x3820d1[_0x437228(0x1d0)],_0xdf2e9f,_0x3acfae),_0x5a6679=await updateSqlQuery({'id':_0x3acfae[_0x437228(0x1d8)],'appCode':_0x3820d1[_0x437228(0x1d0)],'sqlCode':_0xdf2e9f['sqlCode'],'sqlName':_0x3eb98b,'dbId':_0x3cb177['dbId'],'version':_0x3acfae['version'],'sqlContent':_0x5dc164,'sqlConfig':_0x3acfae['sqlConfig']??undefined}),_0x153e0f=_0x5a6679[_0x437228(0x1e9)]?await getDbName(_0x3820d1[_0x437228(0x1d0)],Number(_0x5a6679[_0x437228(0x1e9)]))[_0x437228(0x1da)](()=>_0x3cb177[_0x437228(0x1ef)]):_0x3cb177[_0x437228(0x1ef)];_0x5b6b83['sqls'][_0xdf2e9f[_0x437228(0x1e2)]]={...buildSqlLockEntry(_0x5a6679,_0x5dc164,_0x3340e9,{'dbName':_0x153e0f}),'path':_0xdf2e9f[_0x437228(0x1f4)],'mode':_0x3acfae[_0x437228(0x1e0)]},await archivePreviousSqlFileIfNeeded(_0x12e85f,_0x3acfae['path'],_0xdf2e9f[_0x437228(0x1f4)]),_0x217cf3[_0x437228(0x1e5)]({'sqlCode':_0xdf2e9f[_0x437228(0x1e2)],'remoteId':_0x3acfae[_0x437228(0x1d8)]});}catch(_0x2dfbd0){_0x1ecfe2['push']({'sqlCode':_0xdf2e9f['sqlCode'],'error':_0x2dfbd0 instanceof Error?_0x2dfbd0[_0x437228(0x1f6)]:String(_0x2dfbd0)});}}_0x5b6b83['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x12e85f[_0x437228(0x1df)],_0x2a9210);const _0x372c41=_0x1ecfe2['length']===0x0;return{'ok':_0x372c41,'data':{'pushed':_0x217cf3,'skipped':_0x24300c,'failed':_0x1ecfe2},'message':_0x437228(0x1ed)+_0x217cf3[_0x437228(0x1db)]+_0x437228(0x1f8)+_0x24300c[_0x437228(0x1db)]+'\x20skipped,\x20'+_0x1ecfe2['length']+_0x437228(0x1ea)};}};async function archivePreviousSqlFileIfNeeded(_0x105727,_0x553184,_0x2176af){const _0x40766e=a227_0x596368;if(!_0x553184||_0x553184===_0x2176af)return;const _0x18431f=join(_0x105727[_0x40766e(0x1f9)],_0x553184);if(!await fileExists(_0x18431f))return;const _0x3b3518=await moveToTrash(_0x105727['projectRoot'],_0x105727['trashDir'],_0x18431f);await cleanupEmptyDirectories(dirname(_0x18431f),_0x105727[_0x40766e(0x1f9)]),void _0x3b3518;}async function moveToTrash(_0x4a89a9,_0x1a22f2,_0x4be8bb){const _0x1bc4bc=a227_0x596368,_0x351278=new Date()[_0x1bc4bc(0x1fe)]()[_0x1bc4bc(0x1d1)](/[:.]/g,'-'),_0x2480b0=relative(_0x4a89a9,_0x4be8bb),_0x458f22=join(_0x1a22f2,_0x351278,_0x2480b0);return await mkdir(dirname(_0x458f22),{'recursive':!![]}),await rename(_0x4be8bb,_0x458f22),_0x458f22;}function a227_0x1e86(){const _0x211839=['sqlRootDir','\x22\x20for\x20sqlCode\x20','unchanged','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','hash','toISOString','entries','Local\x20directory\x20\x22','sqlRoot','join','utf8','exec','sqlName','dbDirectory','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','str','write','force','Push\x20local\x20SQL\x20files\x20to\x20remote','appCode','replace','18nMlyQH','filePath','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','sqls','filter','1716wcYhOe','remoteId','8210ITCQFh','catch','length','13982122aYmrfA','2662500AjjUln','6808scgeyu','lockFilePath','mode','82670KTrOaQ','sqlCode','4610985yEVtBi','isFinite','push','Local\x20SQL\x20not\x20found:\x20','sql','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','dbId','\x20failed','path','bool','Push\x20complete:\x20','sqlcode','dbName','24SZiZBY','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','9247tRAmEg','/smartapi/custom/updateUserCustomSql','relativePath','1717770BjrVCs','message','validation','\x20pushed,\x20'];a227_0x1e86=function(){return _0x211839;};return a227_0x1e86();}async function cleanupEmptyDirectories(_0x16739d,_0x43bb7e){let _0x2d150d=resolve(_0x16739d);const _0x5c5852=resolve(_0x43bb7e);while(_0x2d150d['startsWith'](''+_0x5c5852+sep)||_0x2d150d===_0x5c5852){if(_0x2d150d===_0x5c5852)return;try{const _0x428c98=await readdir(_0x2d150d);if(_0x428c98['length']>0x0)return;await rmdir(_0x2d150d);}catch{return;}_0x2d150d=dirname(_0x2d150d);}}async function resolveTargetDbBinding(_0xbb566b,_0x2730ad,_0x52fe83){const _0x2209ab=a227_0x596368,_0x4fcd10=_0x2730ad[_0x2209ab(0x1ca)];if(!_0x4fcd10)return{'dbId':_0x52fe83[_0x2209ab(0x1e9)],'dbName':_0x52fe83['dbName']};const _0x148199=buildDbDirectoryName(_0x52fe83[_0x2209ab(0x1ef)],_0x52fe83['dbId']);if(_0x4fcd10===_0x148199)return{'dbId':_0x52fe83['dbId'],'dbName':_0x52fe83[_0x2209ab(0x1ef)]};const _0x441648=parseExplicitDbDirectory(_0x4fcd10);if(_0x441648!=null)return{'dbId':_0x441648,'dbName':await getDbName(_0xbb566b,_0x441648)[_0x2209ab(0x1da)](()=>undefined)};const _0x47f85c=await listDatabases(_0xbb566b),_0x37142c=_0x47f85c[_0x2209ab(0x1d6)](_0xa3a404=>buildDbDirectoryName(_0xa3a404['dbName'],_0xa3a404[_0x2209ab(0x1e9)])===_0x4fcd10);if(_0x37142c[_0x2209ab(0x1db)]===0x1)return{'dbId':_0x37142c[0x0][_0x2209ab(0x1e9)],'dbName':_0x37142c[0x0][_0x2209ab(0x1ef)]};if(_0x37142c['length']===0x0)throw CliErrors[_0x2209ab(0x1f7)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x4fcd10+_0x2209ab(0x1fa)+_0x2730ad[_0x2209ab(0x1e2)]+'.');const _0x38d418=_0x37142c['map'](_0x39ba54=>_0x39ba54[_0x2209ab(0x1ef)]+'\x20('+_0x39ba54[_0x2209ab(0x1e9)]+')')[_0x2209ab(0x202)](',\x20');throw CliErrors['validation'](_0x2209ab(0x200)+_0x4fcd10+_0x2209ab(0x1f1)+_0x2730ad['sqlCode']+':\x20'+_0x38d418);}function parseExplicitDbDirectory(_0x31ec37){const _0xc73cc8=a227_0x596368,_0xcba9e4=/^db-(\d+)$/[_0xc73cc8(0x1c8)](_0x31ec37);if(!_0xcba9e4)return null;const _0x203b5e=Number(_0xcba9e4[0x1]);return Number[_0xc73cc8(0x1e4)](_0x203b5e)&&_0x203b5e>0x0?_0x203b5e:null;}
@@ -1 +1 @@
1
- const a214_0x427823=a214_0xc4d8;function a214_0xc4d8(_0x596545,_0x4d80e9){_0x596545=_0x596545-0xe2;const _0x304573=a214_0x3045();let _0xc4d810=_0x304573[_0x596545];return _0xc4d810;}(function(_0x538547,_0x55fdcd){const _0x245a25=a214_0xc4d8,_0x3a99ee=_0x538547();while(!![]){try{const _0x250485=parseInt(_0x245a25(0xf7))/0x1+parseInt(_0x245a25(0xff))/0x2*(-parseInt(_0x245a25(0xf5))/0x3)+-parseInt(_0x245a25(0x100))/0x4+-parseInt(_0x245a25(0x10b))/0x5+parseInt(_0x245a25(0xe9))/0x6+-parseInt(_0x245a25(0xed))/0x7*(parseInt(_0x245a25(0xec))/0x8)+parseInt(_0x245a25(0x102))/0x9*(parseInt(_0x245a25(0xf1))/0xa);if(_0x250485===_0x55fdcd)break;else _0x3a99ee['push'](_0x3a99ee['shift']());}catch(_0x126dfc){_0x3a99ee['push'](_0x3a99ee['shift']());}}}(a214_0x3045,0xd91e5));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a214_0x427823(0x105);export function buildSqlLockEntry(_0x5f23ff,_0x441278,_0x45f21d,_0x1e1b91){const _0x478efc=a214_0x427823,_0x241655=detectSqlMode(_0x441278);return{'path':buildSqlRelativePath(_0x5f23ff[_0x478efc(0xe2)],_0x5f23ff[_0x478efc(0xf3)],_0x1e1b91?.[_0x478efc(0x10a)],_0x241655,_0x5f23ff[_0x478efc(0xee)]),'hash':_0x45f21d,'remoteId':_0x5f23ff['id'],'version':_0x5f23ff[_0x478efc(0xfb)],'dbId':Number(_0x5f23ff['dbId']),'dbName':_0x1e1b91?.['dbName'],'sqlName':_0x5f23ff[_0x478efc(0xf3)],'sqlConfig':_0x5f23ff[_0x478efc(0xf9)]??undefined,'mode':_0x241655};}export function cloneSqlLockData(_0x58ce26){const _0x3ab44e=a214_0x427823;return{'apps':Object[_0x3ab44e(0xfc)](Object['entries'](_0x58ce26['apps'])[_0x3ab44e(0xef)](([_0x275fee,_0x4dfcbf])=>[_0x275fee,{'sqlRoot':_0x4dfcbf['sqlRoot'],'lastSync':_0x4dfcbf[_0x3ab44e(0xe3)],'sqls':{..._0x4dfcbf['sqls']}}]))};}export function ensureRemoteSqlContent(_0x5ef79f){const _0xfde11a=a214_0x427823;return _0x5ef79f[_0xfde11a(0x101)]??'';}export function buildLocalSqlFileContent(_0x2c1cf7,_0x4acb36,_0xe2dff8){const _0xc53ed5=a214_0x427823,_0x325595=_0xe2dff8?.[_0xc53ed5(0xf4)]??detectSqlMode(_0x4acb36),_0x2bfee2=stripLocalSqlMetadata(_0x4acb36,_0x325595)[_0xc53ed5(0xf0)](),_0x358adc=[...buildMetadataHeaderLines({'sqlCode':_0x2c1cf7[_0xc53ed5(0xe2)],'sqlName':_0x2c1cf7[_0xc53ed5(0xf3)],'dbId':_0x2c1cf7['dbId'],'dbName':_0xe2dff8?.['dbName'],'mode':_0x325595,'syncedAt':_0xe2dff8?.[_0xc53ed5(0xe8)],'description':_0xe2dff8?.[_0xc53ed5(0x104)]},_0x325595),'',_0x2bfee2],_0xf364cd=_0x358adc['join']('\x0a');return _0xf364cd[_0xc53ed5(0x10c)]('\x0a')?_0xf364cd:_0xf364cd+'\x0a';}export function stripLocalSqlMetadata(_0x1f532e,_0x5e19c5){const _0x5b1a27=a214_0x427823,_0x378eed=_0x1f532e[_0x5b1a27(0xfd)](/\r\n/g,'\x0a')[_0x5b1a27(0x108)]('\x0a'),_0x302552=[];let _0x2f323c=0x0;if(_0x5e19c5===_0x5b1a27(0xeb))while(_0x2f323c<_0x378eed[_0x5b1a27(0xe5)]){const _0x5548c1=_0x378eed[_0x2f323c]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x5548c1)){_0x2f323c++;continue;}if(_0x5548c1['trim']()===''&&_0x2f323c>0x0){_0x2f323c++;continue;}break;}else while(_0x2f323c<_0x378eed[_0x5b1a27(0xe5)]){const _0x2195ba=_0x378eed[_0x2f323c]??'';if(/^\s*--\s*@lovrabet\./[_0x5b1a27(0x109)](_0x2195ba)){_0x2f323c++;continue;}if(_0x2195ba[_0x5b1a27(0xf0)]()===''&&_0x2f323c>0x0){_0x2f323c++;continue;}break;}for(;_0x2f323c<_0x378eed[_0x5b1a27(0xe5)];_0x2f323c++){_0x302552['push'](_0x378eed[_0x2f323c]);}return _0x302552[_0x5b1a27(0xf2)]('\x0a')[_0x5b1a27(0xf6)]();}export function resolveSqlMode(_0x178d0e,_0xd10bdb){const _0x6000df=a214_0x427823;if(_0xd10bdb?.[_0x6000df(0xf4)])return _0xd10bdb[_0x6000df(0xf4)];return detectSqlMode(_0x178d0e);}export function resolveSqlFileName(_0x2c4c63,_0x51ce83,_0x4bb2d0){const _0x5312d9=a214_0x427823;if(_0x4bb2d0?.['path'])return _0x4bb2d0[_0x5312d9(0x10d)];if(_0x4bb2d0?.[_0x5312d9(0xf3)]||_0x4bb2d0?.[_0x5312d9(0x10a)])return buildSqlRelativePath(_0x2c4c63,_0x4bb2d0?.[_0x5312d9(0xf3)],_0x4bb2d0?.[_0x5312d9(0x10a)],resolveSqlMode(_0x51ce83,_0x4bb2d0),_0x4bb2d0?.[_0x5312d9(0xee)]);return buildDefaultSqlFileName(_0x2c4c63,resolveSqlMode(_0x51ce83,_0x4bb2d0));}export function resolveSqlLocalDir(_0x2a6a59,_0x1125c9){return join(_0x2a6a59,SQL_LOCAL_REL_DIR,_0x1125c9);}export async function confirmForceOverwrite(_0x834f8a){const _0x27a6b1=a214_0x427823,_0x52048e=createInterface({'input':process[_0x27a6b1(0x103)],'output':process[_0x27a6b1(0xea)]}),_0x50e45e=await new Promise(_0x46e171=>{const _0x1aba4a=_0x27a6b1;_0x52048e[_0x1aba4a(0xe6)](_0x834f8a+_0x1aba4a(0xfe),_0x46e171);});return _0x52048e[_0x27a6b1(0x106)](),['y','yes'][_0x27a6b1(0x107)](_0x50e45e[_0x27a6b1(0xf0)]()[_0x27a6b1(0xe4)]());}export function findSqlLockScope(_0x340773,_0x2ef130){const _0x329c70=a214_0x427823;return _0x340773[_0x329c70(0xf8)][_0x2ef130];}function buildMetadataHeaderLines(_0x3a5f66,_0x1a2790){const _0x1f8bc1=a214_0x427823,_0x341823=[['sqlCode',_0x3a5f66[_0x1f8bc1(0xe2)]],['sqlName',_0x3a5f66[_0x1f8bc1(0xf3)]],[_0x1f8bc1(0xee),_0x3a5f66[_0x1f8bc1(0xee)]],[_0x1f8bc1(0x10a),_0x3a5f66[_0x1f8bc1(0x10a)]],[_0x1f8bc1(0xf4),_0x3a5f66[_0x1f8bc1(0xf4)]],[_0x1f8bc1(0xe8),_0x3a5f66[_0x1f8bc1(0xe8)]],['description',_0x3a5f66[_0x1f8bc1(0x104)]]];if(_0x1a2790===_0x1f8bc1(0xeb))return _0x341823[_0x1f8bc1(0xfa)](([,_0x3c0503])=>_0x3c0503!==undefined&&_0x3c0503!==null&&String(_0x3c0503)[_0x1f8bc1(0xf0)]()!=='')[_0x1f8bc1(0xef)](([_0x27820f,_0x4aa60])=>_0x1f8bc1(0xe7)+_0x27820f+':\x20'+String(_0x4aa60)+'\x20-->');return _0x341823[_0x1f8bc1(0xfa)](([,_0x31de72])=>_0x31de72!==undefined&&_0x31de72!==null&&String(_0x31de72)[_0x1f8bc1(0xf0)]()!=='')[_0x1f8bc1(0xef)](([_0x235cfd,_0x390852])=>'--\x20@lovrabet.'+_0x235cfd+':\x20'+String(_0x390852));}function a214_0x3045(){const _0x43a044=['mybatisXml','24QRgYgk','2850267yIRBXw','dbId','map','trim','1690yiePPU','join','sqlName','mode','3216495MvOYWg','trimStart','1583101iwNnXZ','apps','sqlConfig','filter','version','fromEntries','replace','\x20[y/N]\x20','2iCXxZJ','1126060mEiBFi','sqlContent','113193yeGauv','stdin','description','.rabetbase/sql','close','includes','split','test','dbName','7034140nXDNou','endsWith','path','sqlCode','lastSync','toLowerCase','length','question','<!--\x20@lovrabet.','syncedAt','6976524mPsrSo','stderr'];a214_0x3045=function(){return _0x43a044;};return a214_0x3045();}
1
+ const a228_0x5a5eb8=a228_0x4a05;(function(_0x2fb6d2,_0x2ca37a){const _0x22b1bc=a228_0x4a05,_0x12194f=_0x2fb6d2();while(!![]){try{const _0x1040ce=parseInt(_0x22b1bc(0x11f))/0x1*(-parseInt(_0x22b1bc(0x128))/0x2)+-parseInt(_0x22b1bc(0x114))/0x3*(parseInt(_0x22b1bc(0x12b))/0x4)+-parseInt(_0x22b1bc(0x132))/0x5+parseInt(_0x22b1bc(0x12a))/0x6+parseInt(_0x22b1bc(0x13c))/0x7*(-parseInt(_0x22b1bc(0x113))/0x8)+-parseInt(_0x22b1bc(0x11d))/0x9*(-parseInt(_0x22b1bc(0x117))/0xa)+-parseInt(_0x22b1bc(0x10f))/0xb*(-parseInt(_0x22b1bc(0x125))/0xc);if(_0x1040ce===_0x2ca37a)break;else _0x12194f['push'](_0x12194f['shift']());}catch(_0x277674){_0x12194f['push'](_0x12194f['shift']());}}}(a228_0x52f9,0x596df));import{createInterface}from'node:readline';import{join}from'node:path';function a228_0x4a05(_0x46a081,_0x849a5f){_0x46a081=_0x46a081-0x10f;const _0x52f90b=a228_0x52f9();let _0x4a0578=_0x52f90b[_0x46a081];return _0x4a0578;}import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a228_0x5a5eb8(0x110);export function buildSqlLockEntry(_0x3a5632,_0x58b657,_0x2ee2dc,_0x553c1e){const _0x328fe9=a228_0x5a5eb8,_0x505303=detectSqlMode(_0x58b657);return{'path':buildSqlRelativePath(_0x3a5632[_0x328fe9(0x127)],_0x3a5632['sqlName'],_0x553c1e?.[_0x328fe9(0x119)],_0x505303,_0x3a5632[_0x328fe9(0x126)]),'hash':_0x2ee2dc,'remoteId':_0x3a5632['id'],'version':_0x3a5632['version'],'dbId':Number(_0x3a5632[_0x328fe9(0x126)]),'dbName':_0x553c1e?.[_0x328fe9(0x119)],'sqlName':_0x3a5632['sqlName'],'sqlConfig':_0x3a5632[_0x328fe9(0x122)]??undefined,'mode':_0x505303};}export function cloneSqlLockData(_0x3782be){const _0x857f88=a228_0x5a5eb8;return{'apps':Object[_0x857f88(0x133)](Object['entries'](_0x3782be[_0x857f88(0x120)])[_0x857f88(0x116)](([_0x44c466,_0x1b6587])=>[_0x44c466,{'sqlRoot':_0x1b6587[_0x857f88(0x115)],'lastSync':_0x1b6587[_0x857f88(0x11b)],'sqls':{..._0x1b6587['sqls']}}]))};}export function ensureRemoteSqlContent(_0x3ecfb0){const _0x13f137=a228_0x5a5eb8;return _0x3ecfb0[_0x13f137(0x135)]??'';}export function buildLocalSqlFileContent(_0x3c56e6,_0x5cf6ce,_0x270fa0){const _0x2164a1=a228_0x5a5eb8,_0x44eb10=_0x270fa0?.[_0x2164a1(0x118)]??detectSqlMode(_0x5cf6ce),_0x377cef=stripLocalSqlMetadata(_0x5cf6ce,_0x44eb10)['trim'](),_0x1040b5=[...buildMetadataHeaderLines({'sqlCode':_0x3c56e6['sqlCode'],'sqlName':_0x3c56e6['sqlName'],'dbId':_0x3c56e6['dbId'],'dbName':_0x270fa0?.[_0x2164a1(0x119)],'mode':_0x44eb10,'syncedAt':_0x270fa0?.['syncedAt'],'description':_0x270fa0?.['description']},_0x44eb10),'',_0x377cef],_0xcec008=_0x1040b5[_0x2164a1(0x112)]('\x0a');return _0xcec008[_0x2164a1(0x12f)]('\x0a')?_0xcec008:_0xcec008+'\x0a';}export function stripLocalSqlMetadata(_0x18f59a,_0x133fae){const _0x4acd3f=a228_0x5a5eb8,_0x249615=_0x18f59a[_0x4acd3f(0x12d)](/\r\n/g,'\x0a')[_0x4acd3f(0x130)]('\x0a'),_0x2c9d89=[];let _0x29a45b=0x0;if(_0x133fae===_0x4acd3f(0x11c))while(_0x29a45b<_0x249615[_0x4acd3f(0x129)]){const _0x320cbe=_0x249615[_0x29a45b]??'';if(/^\s*<!--\s*@lovrabet\./[_0x4acd3f(0x124)](_0x320cbe)){_0x29a45b++;continue;}if(_0x320cbe[_0x4acd3f(0x136)]()===''&&_0x29a45b>0x0){_0x29a45b++;continue;}break;}else while(_0x29a45b<_0x249615['length']){const _0x309c6d=_0x249615[_0x29a45b]??'';if(/^\s*--\s*@lovrabet\./[_0x4acd3f(0x124)](_0x309c6d)){_0x29a45b++;continue;}if(_0x309c6d[_0x4acd3f(0x136)]()===''&&_0x29a45b>0x0){_0x29a45b++;continue;}break;}for(;_0x29a45b<_0x249615[_0x4acd3f(0x129)];_0x29a45b++){_0x2c9d89[_0x4acd3f(0x138)](_0x249615[_0x29a45b]);}return _0x2c9d89[_0x4acd3f(0x112)]('\x0a')['trimStart']();}export function resolveSqlMode(_0x54446f,_0x3713a9){const _0x3c966f=a228_0x5a5eb8;if(_0x3713a9?.[_0x3c966f(0x118)])return _0x3713a9[_0x3c966f(0x118)];return detectSqlMode(_0x54446f);}function a228_0x52f9(){const _0x4f1031=['lastSync','mybatisXml','15894uYanqA','stderr','1pfspGi','apps','includes','sqlConfig','filter','test','72oXTnkf','dbId','sqlCode','1443458mAAgck','length','1676472FIyuLi','203652wvGCWD','\x20[y/N]\x20','replace','syncedAt','endsWith','split','<!--\x20@lovrabet.','1210375LrdMBe','fromEntries','close','sqlContent','trim','toLowerCase','push','stdin','path','description','7BIpwgt','1818366yKqMxC','.rabetbase/sql','--\x20@lovrabet.','join','1417784gxNRid','12svskzC','sqlRoot','map','2490hvfNlv','mode','dbName','sqlName'];a228_0x52f9=function(){return _0x4f1031;};return a228_0x52f9();}export function resolveSqlFileName(_0xdfb5d0,_0x11d94e,_0x1ecb3c){const _0x2fac3a=a228_0x5a5eb8;if(_0x1ecb3c?.['path'])return _0x1ecb3c[_0x2fac3a(0x13a)];if(_0x1ecb3c?.[_0x2fac3a(0x11a)]||_0x1ecb3c?.[_0x2fac3a(0x119)])return buildSqlRelativePath(_0xdfb5d0,_0x1ecb3c?.[_0x2fac3a(0x11a)],_0x1ecb3c?.[_0x2fac3a(0x119)],resolveSqlMode(_0x11d94e,_0x1ecb3c),_0x1ecb3c?.[_0x2fac3a(0x126)]);return buildDefaultSqlFileName(_0xdfb5d0,resolveSqlMode(_0x11d94e,_0x1ecb3c));}export function resolveSqlLocalDir(_0x2566d2,_0x2db98d){return join(_0x2566d2,SQL_LOCAL_REL_DIR,_0x2db98d);}export async function confirmForceOverwrite(_0x5248a0){const _0x3009fe=a228_0x5a5eb8,_0x497075=createInterface({'input':process[_0x3009fe(0x139)],'output':process[_0x3009fe(0x11e)]}),_0x558ca3=await new Promise(_0x5217d9=>{const _0x25b1a6=_0x3009fe;_0x497075['question'](_0x5248a0+_0x25b1a6(0x12c),_0x5217d9);});return _0x497075[_0x3009fe(0x134)](),['y','yes'][_0x3009fe(0x121)](_0x558ca3[_0x3009fe(0x136)]()[_0x3009fe(0x137)]());}export function findSqlLockScope(_0x5499b1,_0x55529f){const _0x2e7063=a228_0x5a5eb8;return _0x5499b1[_0x2e7063(0x120)][_0x55529f];}function buildMetadataHeaderLines(_0x50f075,_0x969327){const _0x4db961=a228_0x5a5eb8,_0x4dca21=[[_0x4db961(0x127),_0x50f075[_0x4db961(0x127)]],[_0x4db961(0x11a),_0x50f075[_0x4db961(0x11a)]],[_0x4db961(0x126),_0x50f075['dbId']],[_0x4db961(0x119),_0x50f075[_0x4db961(0x119)]],[_0x4db961(0x118),_0x50f075[_0x4db961(0x118)]],['syncedAt',_0x50f075[_0x4db961(0x12e)]],[_0x4db961(0x13b),_0x50f075[_0x4db961(0x13b)]]];if(_0x969327===_0x4db961(0x11c))return _0x4dca21[_0x4db961(0x123)](([,_0x3d4ea1])=>_0x3d4ea1!==undefined&&_0x3d4ea1!==null&&String(_0x3d4ea1)[_0x4db961(0x136)]()!=='')[_0x4db961(0x116)](([_0x1c59cf,_0x8341fa])=>_0x4db961(0x131)+_0x1c59cf+':\x20'+String(_0x8341fa)+'\x20-->');return _0x4dca21[_0x4db961(0x123)](([,_0x3743b2])=>_0x3743b2!==undefined&&_0x3743b2!==null&&String(_0x3743b2)[_0x4db961(0x136)]()!=='')[_0x4db961(0x116)](([_0x134acb,_0x3b1efd])=>_0x4db961(0x111)+_0x134acb+':\x20'+String(_0x3b1efd));}
@@ -1 +1 @@
1
- function a215_0x310c(){const _0x4fea9b=['7308530drbTLz','10GsfsFM','length','4629252mfntWu','1662yKDABC','243iOZwnk','sqlRoot','3976AjDfEo','map','\x20missing,\x20','keys','26VbnIms','\x20remote-only','appCode','56572rVZErB','lockFilePath','\x20modified,\x20','29718XYcEuc','sqlName','relativePath','paging','sqlCode','sql','324915NVBFBE','read','22UYggTm','hash','push','remote','has','24437OnMExz','lockKey','tableData','path','\x20added,\x20','\x20unchanged','filePath','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','7696795ikGaiw','sqls'];a215_0x310c=function(){return _0x4fea9b;};return a215_0x310c();}const a215_0x2dc53d=a215_0x100a;(function(_0x5b5c80,_0x529a62){const _0x3b37a4=a215_0x100a,_0x6380aa=_0x5b5c80();while(!![]){try{const _0x2a527e=parseInt(_0x3b37a4(0x145))/0x1*(parseInt(_0x3b37a4(0x12f))/0x2)+-parseInt(_0x3b37a4(0x133))/0x3*(-parseInt(_0x3b37a4(0x13c))/0x4)+-parseInt(_0x3b37a4(0x154))/0x5+parseInt(_0x3b37a4(0x132))/0x6*(-parseInt(_0x3b37a4(0x14c))/0x7)+-parseInt(_0x3b37a4(0x135))/0x8*(parseInt(_0x3b37a4(0x13f))/0x9)+parseInt(_0x3b37a4(0x12e))/0xa*(parseInt(_0x3b37a4(0x147))/0xb)+parseInt(_0x3b37a4(0x131))/0xc*(parseInt(_0x3b37a4(0x139))/0xd);if(_0x2a527e===_0x529a62)break;else _0x6380aa['push'](_0x6380aa['shift']());}catch(_0x578550){_0x6380aa['push'](_0x6380aa['shift']());}}}(a215_0x310c,0xd0f8a));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';function a215_0x100a(_0x508c38,_0x2c0164){_0x508c38=_0x508c38-0x12e;const _0x310c33=a215_0x310c();let _0x100af4=_0x310c33[_0x508c38];return _0x100af4;}import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x1ef49f){const _0x20cf07=a215_0x100a,_0x3d5ff4=[];let _0x9cb45=0x1;while(!![]){const _0x45338a=await listSqlQueries(_0x1ef49f,{'currentPage':_0x9cb45,'pageSize':PAGE_SIZE}),_0x2685bb=_0x45338a[_0x20cf07(0x14e)]??[];_0x3d5ff4['push'](..._0x2685bb['map'](_0x226738=>_0x226738[_0x20cf07(0x143)]));if(_0x2685bb[_0x20cf07(0x130)]===0x0)break;const _0x5deef5=_0x45338a[_0x20cf07(0x142)]?.['totalCount'];if(_0x5deef5!=null?_0x3d5ff4[_0x20cf07(0x130)]>=_0x5deef5:_0x2685bb[_0x20cf07(0x130)]<PAGE_SIZE)break;_0x9cb45++;}return _0x3d5ff4;}export const sqlStatus={'service':a215_0x2dc53d(0x144),'command':'status','description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a215_0x2dc53d(0x146),'flags':[{'name':a215_0x2dc53d(0x14a),'type':'boolean','description':a215_0x2dc53d(0x153)}],async 'execute'(_0x58b34b){const _0x4e16ff=a215_0x2dc53d,_0x36fbe6=loadSqlProjectConfig(_0x58b34b[_0x4e16ff(0x13b)]),_0x537d70=await readSqlLockFile(_0x36fbe6[_0x4e16ff(0x13d)]),{appLock:_0x7cdf83}=ensureSqlLockScope(_0x537d70??createEmptySqlLock(),_0x36fbe6[_0x4e16ff(0x13b)],_0x36fbe6[_0x4e16ff(0x134)],'status'),_0x435ebc=await scanLocalSqlQueries(_0x36fbe6),_0x865c9a=[],_0x16aebb=[],_0xd736c1=[],_0x287ea2=[],_0x45caea=new Set(_0x435ebc[_0x4e16ff(0x136)](_0x23a663=>_0x23a663[_0x4e16ff(0x14d)]));for(const _0x4034c6 of _0x435ebc){const _0xa96ef5=await computeSqlFileHash(_0x4034c6[_0x4e16ff(0x152)]),_0xc0177d=_0x7cdf83[_0x4e16ff(0x155)][_0x4034c6[_0x4e16ff(0x14d)]],_0x36a724=!!_0xc0177d&&_0xc0177d[_0x4e16ff(0x14f)]!==_0x4034c6[_0x4e16ff(0x141)],_0x5dd58f=!!_0xc0177d&&!!_0x4034c6[_0x4e16ff(0x140)]&&_0xc0177d[_0x4e16ff(0x140)]!==_0x4034c6[_0x4e16ff(0x140)];if(!_0xc0177d)_0x865c9a['push'](_0x4034c6[_0x4e16ff(0x14d)]);else _0xc0177d[_0x4e16ff(0x148)]!==_0xa96ef5||_0x36a724||_0x5dd58f?_0x16aebb[_0x4e16ff(0x149)](_0x4034c6[_0x4e16ff(0x14d)]):_0xd736c1[_0x4e16ff(0x149)](_0x4034c6['lockKey']);}for(const _0x5b2795 of Object[_0x4e16ff(0x138)](_0x7cdf83[_0x4e16ff(0x155)])){!_0x45caea[_0x4e16ff(0x14b)](_0x5b2795)&&_0x287ea2[_0x4e16ff(0x149)](_0x5b2795);}const _0x487467=[];if(_0x58b34b['bool'](_0x4e16ff(0x14a))){const _0x4afc4d=await fetchAllSqlCodes(_0x58b34b[_0x4e16ff(0x13b)]);for(const _0x4ddcf2 of _0x4afc4d){!_0x45caea[_0x4e16ff(0x14b)](_0x4ddcf2)&&!_0x7cdf83[_0x4e16ff(0x155)][_0x4ddcf2]&&_0x487467['push'](_0x4ddcf2);}}const _0x59be0a=_0x865c9a['length']===0x0&&_0x16aebb[_0x4e16ff(0x130)]===0x0&&_0x287ea2[_0x4e16ff(0x130)]===0x0&&_0x487467['length']===0x0;return{'ok':!![],'data':{'added':_0x865c9a,'modified':_0x16aebb,'missing':_0x287ea2,'unchanged':_0xd736c1,'remoteOnly':_0x487467},'message':_0x59be0a?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x865c9a[_0x4e16ff(0x130)]+_0x4e16ff(0x150)+_0x16aebb[_0x4e16ff(0x130)]+_0x4e16ff(0x13e)+_0x287ea2[_0x4e16ff(0x130)]+_0x4e16ff(0x137)+_0xd736c1[_0x4e16ff(0x130)]+_0x4e16ff(0x151)+(_0x487467[_0x4e16ff(0x130)]>0x0?',\x20'+_0x487467[_0x4e16ff(0x130)]+_0x4e16ff(0x13a):'')};}};
1
+ const a229_0x709696=a229_0x57ec;(function(_0x172136,_0x4c8434){const _0x1558e3=a229_0x57ec,_0x1854c2=_0x172136();while(!![]){try{const _0x1a081f=-parseInt(_0x1558e3(0x1c2))/0x1+-parseInt(_0x1558e3(0x1a2))/0x2*(-parseInt(_0x1558e3(0x1a5))/0x3)+parseInt(_0x1558e3(0x1af))/0x4+-parseInt(_0x1558e3(0x1ba))/0x5+-parseInt(_0x1558e3(0x1bf))/0x6+parseInt(_0x1558e3(0x1b0))/0x7+parseInt(_0x1558e3(0x1ae))/0x8;if(_0x1a081f===_0x4c8434)break;else _0x1854c2['push'](_0x1854c2['shift']());}catch(_0x5dccc5){_0x1854c2['push'](_0x1854c2['shift']());}}}(a229_0x1b55,0x90a8e));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x449a88){const _0x57ee46=a229_0x57ec,_0x16f28a=[];let _0xae86f0=0x1;while(!![]){const _0x176ff9=await listSqlQueries(_0x449a88,{'currentPage':_0xae86f0,'pageSize':PAGE_SIZE}),_0x9ab28b=_0x176ff9[_0x57ee46(0x1ac)]??[];_0x16f28a[_0x57ee46(0x1b3)](..._0x9ab28b['map'](_0x362f96=>_0x362f96[_0x57ee46(0x1c0)]));if(_0x9ab28b[_0x57ee46(0x1b4)]===0x0)break;const _0x269091=_0x176ff9['paging']?.[_0x57ee46(0x1bd)];if(_0x269091!=null?_0x16f28a[_0x57ee46(0x1b4)]>=_0x269091:_0x9ab28b[_0x57ee46(0x1b4)]<PAGE_SIZE)break;_0xae86f0++;}return _0x16f28a;}export const sqlStatus={'service':a229_0x709696(0x1c5),'command':'status','description':a229_0x709696(0x1bc),'risk':a229_0x709696(0x1a9),'flags':[{'name':a229_0x709696(0x1a6),'type':a229_0x709696(0x1a4),'description':a229_0x709696(0x1c3)}],async 'execute'(_0x12ab77){const _0x5d3d5e=a229_0x709696,_0x1a486a=loadSqlProjectConfig(_0x12ab77[_0x5d3d5e(0x1b7)]),_0x348de3=await readSqlLockFile(_0x1a486a[_0x5d3d5e(0x1b9)]),{appLock:_0xe744bb}=ensureSqlLockScope(_0x348de3??createEmptySqlLock(),_0x1a486a[_0x5d3d5e(0x1b7)],_0x1a486a[_0x5d3d5e(0x1bb)],_0x5d3d5e(0x1c6)),_0x1b5050=await scanLocalSqlQueries(_0x1a486a),_0x2d159c=[],_0x42b3a5=[],_0x58c2ea=[],_0x314520=[],_0x4b21b6=new Set(_0x1b5050[_0x5d3d5e(0x1aa)](_0x468acd=>_0x468acd[_0x5d3d5e(0x1ad)]));for(const _0x32c4c5 of _0x1b5050){const _0x2b8330=await computeSqlFileHash(_0x32c4c5['filePath']),_0x19d3ad=_0xe744bb[_0x5d3d5e(0x1b6)][_0x32c4c5[_0x5d3d5e(0x1ad)]],_0x1597ac=!!_0x19d3ad&&_0x19d3ad[_0x5d3d5e(0x1b8)]!==_0x32c4c5[_0x5d3d5e(0x1be)],_0x4803c5=!!_0x19d3ad&&!!_0x32c4c5['sqlName']&&_0x19d3ad[_0x5d3d5e(0x1b2)]!==_0x32c4c5[_0x5d3d5e(0x1b2)];if(!_0x19d3ad)_0x2d159c[_0x5d3d5e(0x1b3)](_0x32c4c5[_0x5d3d5e(0x1ad)]);else _0x19d3ad[_0x5d3d5e(0x1c4)]!==_0x2b8330||_0x1597ac||_0x4803c5?_0x42b3a5['push'](_0x32c4c5[_0x5d3d5e(0x1ad)]):_0x58c2ea['push'](_0x32c4c5[_0x5d3d5e(0x1ad)]);}for(const _0x905695 of Object[_0x5d3d5e(0x1a8)](_0xe744bb['sqls'])){!_0x4b21b6[_0x5d3d5e(0x1c1)](_0x905695)&&_0x314520['push'](_0x905695);}const _0x4aef6a=[];if(_0x12ab77[_0x5d3d5e(0x1ab)]('remote')){const _0x2db740=await fetchAllSqlCodes(_0x12ab77[_0x5d3d5e(0x1b7)]);for(const _0xb3a5ba of _0x2db740){!_0x4b21b6['has'](_0xb3a5ba)&&!_0xe744bb[_0x5d3d5e(0x1b6)][_0xb3a5ba]&&_0x4aef6a[_0x5d3d5e(0x1b3)](_0xb3a5ba);}}const _0x4becac=_0x2d159c[_0x5d3d5e(0x1b4)]===0x0&&_0x42b3a5['length']===0x0&&_0x314520['length']===0x0&&_0x4aef6a['length']===0x0;return{'ok':!![],'data':{'added':_0x2d159c,'modified':_0x42b3a5,'missing':_0x314520,'unchanged':_0x58c2ea,'remoteOnly':_0x4aef6a},'message':_0x4becac?_0x5d3d5e(0x1b5):_0x2d159c[_0x5d3d5e(0x1b4)]+_0x5d3d5e(0x1b1)+_0x42b3a5[_0x5d3d5e(0x1b4)]+'\x20modified,\x20'+_0x314520[_0x5d3d5e(0x1b4)]+_0x5d3d5e(0x1a7)+_0x58c2ea[_0x5d3d5e(0x1b4)]+_0x5d3d5e(0x1a3)+(_0x4aef6a[_0x5d3d5e(0x1b4)]>0x0?',\x20'+_0x4aef6a['length']+'\x20remote-only':'')};}};function a229_0x57ec(_0x1152a3,_0x552464){_0x1152a3=_0x1152a3-0x1a2;const _0x1b5561=a229_0x1b55();let _0x57ec09=_0x1b5561[_0x1152a3];return _0x57ec09;}function a229_0x1b55(){const _0x35f2c6=['6lHoCGm','remote','\x20missing,\x20','keys','read','map','bool','tableData','lockKey','3878064NGnAIP','359548TOrGYD','1352582UbxNny','\x20added,\x20','sqlName','push','length','All\x20SQL\x20queries\x20are\x20in\x20sync.','sqls','appCode','path','lockFilePath','1576970gLdjgt','sqlRoot','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','totalCount','relativePath','1224624bWKXhC','sqlCode','has','275831ldTKox','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','hash','sql','status','619984JiIIcv','\x20unchanged','boolean'];a229_0x1b55=function(){return _0x35f2c6;};return a229_0x1b55();}
@@ -1 +1 @@
1
- const a216_0x5ac64f=a216_0x1763;function a216_0x37ba(){const _0x45a05e=['228RKxxoa','bool','map','10001484azovMu','\x22\x20not\x20found\x20in\x20any\x20dataset','file','size','Table\x20\x22','get','dbtableConfig','message','flagMissing','\x22\x20not\x20found\x20or\x20not\x20accessible','index_type','check-indexes','validate','name','primary','6KSHJik','validation','unshift','indexName','sql','tableName','isArray','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','string','index_name','pkField','cwd','from','index_columns','Dataset\x20\x22','136vSvbHv','tables','schemas','File\x20not\x20found:\x20','boolean','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','filter','indexes','1955795HCbyfM','96771wbtgMI','toLowerCase','122480ZLFkHU','448TUKVUE','push','utf-8','split','217816CjXiAB','fields','joinAudit','sqlType','1HFjaTB','840488djYrfQ','columnNames','11989970rQyCsq','schemaWarnings','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','columns','isDangerous','--check-indexes\x20requires\x20--schemas.','str','trim','valid','reason','length','type'];a216_0x37ba=function(){return _0x45a05e;};return a216_0x37ba();}(function(_0x34077f,_0x37023c){const _0xc4418c=a216_0x1763,_0x134ab3=_0x34077f();while(!![]){try{const _0x2e6749=-parseInt(_0xc4418c(0x103))/0x1*(parseInt(_0xc4418c(0xff))/0x2)+parseInt(_0xc4418c(0xf8))/0x3*(parseInt(_0xc4418c(0xef))/0x4)+-parseInt(_0xc4418c(0xf7))/0x5*(-parseInt(_0xc4418c(0xe0))/0x6)+parseInt(_0xc4418c(0xfb))/0x7*(parseInt(_0xc4418c(0xfa))/0x8)+-parseInt(_0xc4418c(0xd1))/0x9+parseInt(_0xc4418c(0x106))/0xa+-parseInt(_0xc4418c(0x104))/0xb*(parseInt(_0xc4418c(0xce))/0xc);if(_0x2e6749===_0x37023c)break;else _0x134ab3['push'](_0x134ab3['shift']());}catch(_0x386f38){_0x134ab3['push'](_0x134ab3['shift']());}}}(a216_0x37ba,0xf2dee));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a216_0x1763(_0xb973a7,_0x1df5ec){_0xb973a7=_0xb973a7-0xc9;const _0x37baae=a216_0x37ba();let _0x17631d=_0x37baae[_0xb973a7];return _0x17631d;}import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a216_0x5ac64f(0xe4),'command':a216_0x5ac64f(0xdd),'description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':'read','flags':[{'name':a216_0x5ac64f(0xd3),'type':a216_0x5ac64f(0xe8),'description':a216_0x5ac64f(0xf4)},{'name':'sql','type':a216_0x5ac64f(0xe8),'description':a216_0x5ac64f(0xe7)},{'name':a216_0x5ac64f(0xf1),'type':'string','description':a216_0x5ac64f(0x108)},{'name':a216_0x5ac64f(0xdc),'type':a216_0x5ac64f(0xf3),'description':'Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'}],async 'execute'(_0x49d126){const _0x4f9b01=a216_0x5ac64f,_0x2c29a5=_0x49d126[_0x4f9b01(0x10c)](_0x4f9b01(0xd3)),_0x4ee814=_0x49d126[_0x4f9b01(0x10c)](_0x4f9b01(0xe4)),_0x38959c=_0x49d126[_0x4f9b01(0x10c)]('schemas'),_0x4a142a=_0x49d126[_0x4f9b01(0xcf)](_0x4f9b01(0xdc));if(!_0x2c29a5&&!_0x4ee814)throw CliErrors[_0x4f9b01(0xd9)]('file','Provide\x20--file\x20or\x20--sql');if(_0x4a142a&&!_0x38959c)throw CliErrors[_0x4f9b01(0xe1)](_0x4f9b01(0x10b));let _0x5d36a4;if(_0x2c29a5){const _0x4f5a6a=resolve(process[_0x4f9b01(0xeb)](),_0x2c29a5);if(!existsSync(_0x4f5a6a))throw CliErrors[_0x4f9b01(0xe1)](_0x4f9b01(0xf2)+_0x4f5a6a);_0x5d36a4=readFileSync(_0x4f5a6a,_0x4f9b01(0xfd));}else _0x5d36a4=_0x4ee814;const _0x40c024=validateSql(_0x5d36a4),_0x451bc9={'valid':_0x40c024['valid'],'sqlType':_0x40c024[_0x4f9b01(0x102)]['type'],'isSelectOnly':_0x40c024[_0x4f9b01(0x102)]['isSelectOnly'],'isDangerous':_0x40c024[_0x4f9b01(0x102)][_0x4f9b01(0x10a)],'tables':_0x40c024['tables'],'parameters':_0x40c024['parameters'],'message':_0x40c024[_0x4f9b01(0xd8)]};_0x40c024[_0x4f9b01(0x102)][_0x4f9b01(0xcb)]&&(_0x451bc9[_0x4f9b01(0xcb)]=_0x40c024['sqlType'][_0x4f9b01(0xcb)]);if(_0x38959c&&_0x40c024['valid']){const _0x13fe52=_0x38959c['split'](',')[_0x4f9b01(0xd0)](_0x196fe5=>_0x196fe5[_0x4f9b01(0xc9)]())[_0x4f9b01(0xf5)](Boolean),_0x306446=[],_0x5a05b9=[],_0x4a3c75=filterDbTableBackedDatasets(await listDatasets(_0x49d126['appCode'])),_0x262872=new Map(_0x4a3c75[_0x4f9b01(0xd0)](_0x1192c4=>[_0x1192c4[_0x4f9b01(0xd7)]?.[_0x4f9b01(0xe5)]?.['toLowerCase'](),_0x1192c4]));for(const _0x285db0 of _0x40c024[_0x4f9b01(0xf0)]){const _0x1c4ed4=_0x262872[_0x4f9b01(0xd6)](_0x285db0['toLowerCase']());!_0x1c4ed4&&_0x306446[_0x4f9b01(0xfc)](_0x4f9b01(0xd5)+_0x285db0+_0x4f9b01(0xd2));}for(const _0x3d513f of _0x13fe52){let _0x26ac46;try{_0x26ac46=await getDatasetDetail(_0x3d513f);}catch{_0x306446[_0x4f9b01(0xfc)](_0x4f9b01(0xee)+_0x3d513f+_0x4f9b01(0xda));continue;}assertDatasetIsDbTableBacked(_0x26ac46,'SQL\x20schema\x20validation');const _0x4aa336=Array[_0x4f9b01(0xe6)](_0x26ac46[_0x4f9b01(0x100)])?_0x26ac46[_0x4f9b01(0x100)]:[],_0x1c6641=new Set(_0x4aa336[_0x4f9b01(0xd0)](_0x1073f4=>_0x1073f4['name']?.[_0x4f9b01(0xf9)]())),_0x1ea4a6=_0x26ac46[_0x4f9b01(0xd7)]?.[_0x4f9b01(0xe5)]||_0x26ac46[_0x4f9b01(0xe5)]||_0x3d513f;_0x451bc9['schema:'+_0x1ea4a6]={'code':_0x3d513f,'tableName':_0x1ea4a6,'fieldCount':_0x1c6641[_0x4f9b01(0xd4)],'fields':Array[_0x4f9b01(0xec)](_0x1c6641)};if(_0x4a142a){const _0x7fc793=normalizeDatasetIndexes(_0x26ac46);_0x5a05b9[_0x4f9b01(0xfc)]({'tableName':_0x1ea4a6,..._0x7fc793});}}_0x306446[_0x4f9b01(0xcc)]>0x0&&(_0x451bc9[_0x4f9b01(0x107)]=_0x306446),_0x4a142a&&(_0x451bc9[_0x4f9b01(0x101)]=auditSqlJoinIndexes(_0x5d36a4,_0x5a05b9));}return{'ok':_0x40c024[_0x4f9b01(0xca)],'data':_0x451bc9,'message':_0x40c024[_0x4f9b01(0xd8)]};}};function normalizeDatasetIndexes(_0x1adc8a){const _0x3822b7=a216_0x5ac64f,_0x1b9ad3=Array[_0x3822b7(0xe6)](_0x1adc8a?.['dataset']?.[_0x3822b7(0xf6)])?_0x1adc8a['dataset']['indexes']:Array[_0x3822b7(0xe6)](_0x1adc8a?.[_0x3822b7(0xf6)])?_0x1adc8a[_0x3822b7(0xf6)]:[],_0x3f0a5c=_0x1b9ad3['flatMap'](_0x5a2996=>{const _0x5baf6a=_0x3822b7,_0x5aaebb=Array[_0x5baf6a(0xe6)](_0x5a2996?.[_0x5baf6a(0xed)])?_0x5a2996['index_columns']:Array[_0x5baf6a(0xe6)](_0x5a2996?.[_0x5baf6a(0x105)])?_0x5a2996[_0x5baf6a(0x105)]:Array[_0x5baf6a(0xe6)](_0x5a2996?.[_0x5baf6a(0x109)])?_0x5a2996[_0x5baf6a(0x109)]:[],_0x2fab23=_0x5aaebb[_0x5baf6a(0xf5)](_0x1ceed5=>typeof _0x1ceed5===_0x5baf6a(0xe8))[_0x5baf6a(0xd0)](_0x39c38a=>_0x39c38a[_0x5baf6a(0xc9)]())[_0x5baf6a(0xf5)](Boolean);if(_0x2fab23[_0x5baf6a(0xcc)]===0x0)return[];const _0x5edbee=[_0x5a2996?.[_0x5baf6a(0xe3)],_0x5a2996?.[_0x5baf6a(0xe9)],_0x5a2996?.[_0x5baf6a(0xde)]]['find'](_0x1bd6df=>typeof _0x1bd6df===_0x5baf6a(0xe8)&&_0x1bd6df['trim']()),_0x3faa54=[_0x5a2996?.[_0x5baf6a(0xdb)],_0x5a2996?.[_0x5baf6a(0xcd)]]['find'](_0x9bcd8a=>typeof _0x9bcd8a==='string'&&_0x9bcd8a['trim']());return[{..._0x5edbee?{'name':_0x5edbee['trim']()}:{},..._0x3faa54?{'type':_0x3faa54[_0x5baf6a(0xc9)]()}:{},'columns':_0x2fab23}];}),_0x159ccd=[..._0x3f0a5c],_0x9c51c=typeof _0x1adc8a?.['dbtableConfig']?.[_0x3822b7(0xea)]===_0x3822b7(0xe8)?_0x1adc8a[_0x3822b7(0xd7)][_0x3822b7(0xea)][_0x3822b7(0xfe)](',')[_0x3822b7(0xd0)](_0x604ddb=>_0x604ddb[_0x3822b7(0xc9)]())[_0x3822b7(0xf5)](Boolean):[];return _0x9c51c[_0x3822b7(0xcc)]>0x0&&_0x159ccd[_0x3822b7(0xe2)]({'type':_0x3822b7(0xdf),'columns':_0x9c51c}),{'indexes':_0x159ccd,'metadataAvailable':_0x3f0a5c[_0x3822b7(0xcc)]>0x0};}
1
+ const a230_0x5b385f=a230_0x3f2b;function a230_0x23a4(){const _0x8599bd=['boolean','isArray','appCode','\x22\x20not\x20found\x20in\x20any\x20dataset','schemas','joinAudit','SQL\x20schema\x20validation','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','cwd','1272412JBSiOJ','flagMissing','indexes','columns','length','primary','Table\x20\x22','columnNames','2166203MWEHFN','--check-indexes\x20requires\x20--schemas.','693MLdZdW','check-indexes','3370437YOQonY','index_type','message','3lAOSei','type','split','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','validation','push','tableName','file','66845goObaK','size','fields','name','string','utf-8','500086AEiLfs','flatMap','78TNCXrO','find','24HfxlxV','indexName','index_name','trim','from','valid','dbtableConfig','parameters','get','6792170bjRfiB','read','index_columns','\x22\x20not\x20found\x20or\x20not\x20accessible','reason','sql','tables','pkField','str','2FpotRI','toLowerCase','Dataset\x20\x22','schemaWarnings','filter','sqlType','schema:','map','dataset','File\x20not\x20found:\x20','50624QiTLRI','10kIXbCa'];a230_0x23a4=function(){return _0x8599bd;};return a230_0x23a4();}(function(_0x26849b,_0x34a225){const _0x2c0b20=a230_0x3f2b,_0x2a30e1=_0x26849b();while(!![]){try{const _0xa03922=parseInt(_0x2c0b20(0x1fc))/0x1*(-parseInt(_0x2c0b20(0x1c9))/0x2)+-parseInt(_0x2c0b20(0x1ed))/0x3*(-parseInt(_0x2c0b20(0x1de))/0x4)+-parseInt(_0x2c0b20(0x1f6))/0x5*(parseInt(_0x2c0b20(0x1b5))/0x6)+-parseInt(_0x2c0b20(0x1e8))/0x7*(-parseInt(_0x2c0b20(0x1d3))/0x8)+parseInt(_0x2c0b20(0x1ea))/0x9+parseInt(_0x2c0b20(0x1d4))/0xa*(-parseInt(_0x2c0b20(0x1c0))/0xb)+-parseInt(_0x2c0b20(0x1b7))/0xc*(-parseInt(_0x2c0b20(0x1e6))/0xd);if(_0xa03922===_0x34a225)break;else _0x2a30e1['push'](_0x2a30e1['shift']());}catch(_0x437309){_0x2a30e1['push'](_0x2a30e1['shift']());}}}(a230_0x23a4,0x58211));function a230_0x3f2b(_0x3a38fe,_0x2d5239){_0x3a38fe=_0x3a38fe-0x1b4;const _0x23a43e=a230_0x23a4();let _0x3f2b01=_0x23a43e[_0x3a38fe];return _0x3f2b01;}import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a230_0x5b385f(0x1c5),'command':'validate','description':a230_0x5b385f(0x1f1),'risk':a230_0x5b385f(0x1c1),'flags':[{'name':a230_0x5b385f(0x1f5),'type':a230_0x5b385f(0x1fa),'description':a230_0x5b385f(0x1f0)},{'name':a230_0x5b385f(0x1c5),'type':a230_0x5b385f(0x1fa),'description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':a230_0x5b385f(0x1d9),'type':a230_0x5b385f(0x1fa),'description':'Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against'},{'name':'check-indexes','type':a230_0x5b385f(0x1d5),'description':a230_0x5b385f(0x1dc)}],async 'execute'(_0x260c52){const _0x1ba085=a230_0x5b385f,_0x69d100=_0x260c52[_0x1ba085(0x1c8)](_0x1ba085(0x1f5)),_0xaea014=_0x260c52[_0x1ba085(0x1c8)](_0x1ba085(0x1c5)),_0x4dc237=_0x260c52[_0x1ba085(0x1c8)](_0x1ba085(0x1d9)),_0x478489=_0x260c52['bool'](_0x1ba085(0x1e9));if(!_0x69d100&&!_0xaea014)throw CliErrors[_0x1ba085(0x1df)](_0x1ba085(0x1f5),'Provide\x20--file\x20or\x20--sql');if(_0x478489&&!_0x4dc237)throw CliErrors[_0x1ba085(0x1f2)](_0x1ba085(0x1e7));let _0x2718fc;if(_0x69d100){const _0x44ae8e=resolve(process[_0x1ba085(0x1dd)](),_0x69d100);if(!existsSync(_0x44ae8e))throw CliErrors[_0x1ba085(0x1f2)](_0x1ba085(0x1d2)+_0x44ae8e);_0x2718fc=readFileSync(_0x44ae8e,_0x1ba085(0x1fb));}else _0x2718fc=_0xaea014;const _0x1ee882=validateSql(_0x2718fc),_0x164d94={'valid':_0x1ee882['valid'],'sqlType':_0x1ee882[_0x1ba085(0x1ce)][_0x1ba085(0x1ee)],'isSelectOnly':_0x1ee882[_0x1ba085(0x1ce)]['isSelectOnly'],'isDangerous':_0x1ee882[_0x1ba085(0x1ce)]['isDangerous'],'tables':_0x1ee882[_0x1ba085(0x1c6)],'parameters':_0x1ee882[_0x1ba085(0x1be)],'message':_0x1ee882[_0x1ba085(0x1ec)]};_0x1ee882[_0x1ba085(0x1ce)][_0x1ba085(0x1c4)]&&(_0x164d94['reason']=_0x1ee882[_0x1ba085(0x1ce)][_0x1ba085(0x1c4)]);if(_0x4dc237&&_0x1ee882[_0x1ba085(0x1bc)]){const _0x13be8e=_0x4dc237['split'](',')[_0x1ba085(0x1d0)](_0x3634d6=>_0x3634d6[_0x1ba085(0x1ba)]())['filter'](Boolean),_0xf5b163=[],_0x1a5b23=[],_0x2cb1c=filterDbTableBackedDatasets(await listDatasets(_0x260c52[_0x1ba085(0x1d7)])),_0x30740e=new Map(_0x2cb1c['map'](_0x3e8585=>[_0x3e8585['dbtableConfig']?.['tableName']?.[_0x1ba085(0x1ca)](),_0x3e8585]));for(const _0x7c37ea of _0x1ee882[_0x1ba085(0x1c6)]){const _0x395449=_0x30740e[_0x1ba085(0x1bf)](_0x7c37ea[_0x1ba085(0x1ca)]());!_0x395449&&_0xf5b163['push'](_0x1ba085(0x1e4)+_0x7c37ea+_0x1ba085(0x1d8));}for(const _0x1974f7 of _0x13be8e){let _0x525853;try{_0x525853=await getDatasetDetail(_0x1974f7);}catch{_0xf5b163['push'](_0x1ba085(0x1cb)+_0x1974f7+_0x1ba085(0x1c3));continue;}assertDatasetIsDbTableBacked(_0x525853,_0x1ba085(0x1db));const _0x1a02c3=Array[_0x1ba085(0x1d6)](_0x525853['fields'])?_0x525853[_0x1ba085(0x1f8)]:[],_0x1b2ef7=new Set(_0x1a02c3[_0x1ba085(0x1d0)](_0x5cb83f=>_0x5cb83f[_0x1ba085(0x1f9)]?.['toLowerCase']())),_0x228ca4=_0x525853[_0x1ba085(0x1bd)]?.[_0x1ba085(0x1f4)]||_0x525853[_0x1ba085(0x1f4)]||_0x1974f7;_0x164d94[_0x1ba085(0x1cf)+_0x228ca4]={'code':_0x1974f7,'tableName':_0x228ca4,'fieldCount':_0x1b2ef7[_0x1ba085(0x1f7)],'fields':Array[_0x1ba085(0x1bb)](_0x1b2ef7)};if(_0x478489){const _0x2bed5b=normalizeDatasetIndexes(_0x525853);_0x1a5b23[_0x1ba085(0x1f3)]({'tableName':_0x228ca4,..._0x2bed5b});}}_0xf5b163[_0x1ba085(0x1e2)]>0x0&&(_0x164d94[_0x1ba085(0x1cc)]=_0xf5b163),_0x478489&&(_0x164d94[_0x1ba085(0x1da)]=auditSqlJoinIndexes(_0x2718fc,_0x1a5b23));}return{'ok':_0x1ee882[_0x1ba085(0x1bc)],'data':_0x164d94,'message':_0x1ee882[_0x1ba085(0x1ec)]};}};function normalizeDatasetIndexes(_0x1fb421){const _0x51d8a8=a230_0x5b385f,_0x1d14b8=Array[_0x51d8a8(0x1d6)](_0x1fb421?.[_0x51d8a8(0x1d1)]?.[_0x51d8a8(0x1e0)])?_0x1fb421['dataset'][_0x51d8a8(0x1e0)]:Array[_0x51d8a8(0x1d6)](_0x1fb421?.['indexes'])?_0x1fb421[_0x51d8a8(0x1e0)]:[],_0x19a0a6=_0x1d14b8[_0x51d8a8(0x1b4)](_0x1f96eb=>{const _0x91ae49=_0x51d8a8,_0x11cb12=Array['isArray'](_0x1f96eb?.[_0x91ae49(0x1c2)])?_0x1f96eb[_0x91ae49(0x1c2)]:Array[_0x91ae49(0x1d6)](_0x1f96eb?.[_0x91ae49(0x1e5)])?_0x1f96eb[_0x91ae49(0x1e5)]:Array[_0x91ae49(0x1d6)](_0x1f96eb?.[_0x91ae49(0x1e1)])?_0x1f96eb['columns']:[],_0x4ee5c6=_0x11cb12[_0x91ae49(0x1cd)](_0x375d5d=>typeof _0x375d5d===_0x91ae49(0x1fa))['map'](_0x621b0a=>_0x621b0a[_0x91ae49(0x1ba)]())[_0x91ae49(0x1cd)](Boolean);if(_0x4ee5c6[_0x91ae49(0x1e2)]===0x0)return[];const _0x4c8668=[_0x1f96eb?.[_0x91ae49(0x1b8)],_0x1f96eb?.[_0x91ae49(0x1b9)],_0x1f96eb?.[_0x91ae49(0x1f9)]][_0x91ae49(0x1b6)](_0x50339c=>typeof _0x50339c===_0x91ae49(0x1fa)&&_0x50339c[_0x91ae49(0x1ba)]()),_0x21b709=[_0x1f96eb?.[_0x91ae49(0x1eb)],_0x1f96eb?.[_0x91ae49(0x1ee)]][_0x91ae49(0x1b6)](_0x1fc416=>typeof _0x1fc416===_0x91ae49(0x1fa)&&_0x1fc416[_0x91ae49(0x1ba)]());return[{..._0x4c8668?{'name':_0x4c8668[_0x91ae49(0x1ba)]()}:{},..._0x21b709?{'type':_0x21b709[_0x91ae49(0x1ba)]()}:{},'columns':_0x4ee5c6}];}),_0x53d3be=[..._0x19a0a6],_0x47fe49=typeof _0x1fb421?.[_0x51d8a8(0x1bd)]?.[_0x51d8a8(0x1c7)]==='string'?_0x1fb421[_0x51d8a8(0x1bd)][_0x51d8a8(0x1c7)][_0x51d8a8(0x1ef)](',')[_0x51d8a8(0x1d0)](_0x4de991=>_0x4de991[_0x51d8a8(0x1ba)]())[_0x51d8a8(0x1cd)](Boolean):[];return _0x47fe49[_0x51d8a8(0x1e2)]>0x0&&_0x53d3be['unshift']({'type':_0x51d8a8(0x1e3),'columns':_0x47fe49}),{'indexes':_0x53d3be,'metadataAvailable':_0x19a0a6[_0x51d8a8(0x1e2)]>0x0};}
@@ -1 +1 @@
1
- (function(_0x31e744,_0x2dd95f){const _0x3449f7=a217_0x5054,_0x28fd54=_0x31e744();while(!![]){try{const _0x10e7cb=-parseInt(_0x3449f7(0x132))/0x1+parseInt(_0x3449f7(0x12f))/0x2*(parseInt(_0x3449f7(0x136))/0x3)+parseInt(_0x3449f7(0x137))/0x4+parseInt(_0x3449f7(0x133))/0x5*(-parseInt(_0x3449f7(0x131))/0x6)+parseInt(_0x3449f7(0x135))/0x7+parseInt(_0x3449f7(0x12e))/0x8*(parseInt(_0x3449f7(0x130))/0x9)+parseInt(_0x3449f7(0x134))/0xa*(-parseInt(_0x3449f7(0x138))/0xb);if(_0x10e7cb===_0x2dd95f)break;else _0x28fd54['push'](_0x28fd54['shift']());}catch(_0x466684){_0x28fd54['push'](_0x28fd54['shift']());}}}(a217_0xf9d7,0xece5a));import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];function a217_0x5054(_0x34ec9f,_0x26fee7){_0x34ec9f=_0x34ec9f-0x12e;const _0xf9d7a8=a217_0xf9d7();let _0x5054f3=_0xf9d7a8[_0x34ec9f];return _0x5054f3;}function a217_0xf9d7(){const _0x56aba7=['855769pPnJfs','65225SmHXbQ','1563570OTWZcU','4941258Jhgfhi','1019058HEpaWc','941380OnxSNt','99iVhQzb','16432vJPJYA','8YYeCue','7119GxjGTl','318IDoQOT'];a217_0xf9d7=function(){return _0x56aba7;};return a217_0xf9d7();}
1
+ function a231_0x240c(_0x11c4e0,_0xafcfde){_0x11c4e0=_0x11c4e0-0x193;const _0x40e349=a231_0x40e3();let _0x240c53=_0x40e349[_0x11c4e0];return _0x240c53;}(function(_0x457dc4,_0x1c24f6){const _0x2c1690=a231_0x240c,_0x2380b6=_0x457dc4();while(!![]){try{const _0x2b8fad=parseInt(_0x2c1690(0x19a))/0x1+parseInt(_0x2c1690(0x198))/0x2+-parseInt(_0x2c1690(0x197))/0x3*(-parseInt(_0x2c1690(0x196))/0x4)+-parseInt(_0x2c1690(0x199))/0x5*(-parseInt(_0x2c1690(0x195))/0x6)+parseInt(_0x2c1690(0x19b))/0x7+parseInt(_0x2c1690(0x194))/0x8+-parseInt(_0x2c1690(0x193))/0x9;if(_0x2b8fad===_0x1c24f6)break;else _0x2380b6['push'](_0x2380b6['shift']());}catch(_0x1903eb){_0x2380b6['push'](_0x2380b6['shift']());}}}(a231_0x40e3,0x8bd27));import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];function a231_0x40e3(){const _0x2a3a0b=['1639674XILPZL','780812BemieG','6pAtrtH','122032zshKOe','15ufOQbU','494464RESRkw','5959569IjzGuC','26712972ORSavk','7389832pdAuAu'];a231_0x40e3=function(){return _0x2a3a0b;};return a231_0x40e3();}
@@ -1 +1 @@
1
- const a218_0x1baa00=a218_0x5266;(function(_0x463da4,_0x102992){const _0x281a84=a218_0x5266,_0x178ea9=_0x463da4();while(!![]){try{const _0x2e3258=parseInt(_0x281a84(0x123))/0x1*(-parseInt(_0x281a84(0x120))/0x2)+parseInt(_0x281a84(0x126))/0x3*(-parseInt(_0x281a84(0x11f))/0x4)+parseInt(_0x281a84(0x12b))/0x5+-parseInt(_0x281a84(0x127))/0x6*(parseInt(_0x281a84(0x118))/0x7)+-parseInt(_0x281a84(0x11b))/0x8+parseInt(_0x281a84(0x12a))/0x9+parseInt(_0x281a84(0x11e))/0xa;if(_0x2e3258===_0x102992)break;else _0x178ea9['push'](_0x178ea9['shift']());}catch(_0x189af3){_0x178ea9['push'](_0x178ea9['shift']());}}}(a218_0x3e85,0x80d29));function a218_0x5266(_0x23bacc,_0x343f08){_0x23bacc=_0x23bacc-0x117;const _0x3e8570=a218_0x3e85();let _0x526613=_0x3e8570[_0x23bacc];return _0x526613;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';function a218_0x3e85(){const _0x11aea4=['str','task-id','17189PDPDbi','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','flagMissing','35886WfhBaZ','167502SfrbYi','compress','isTerminal','4614570zLUlMB','607590ituxZO','trim','84MlubKA','status','string','3271664nkTECV','appCode','taskId','21398550lhfsJt','284wvFawl','76CwiLWq'];a218_0x3e85=function(){return _0x11aea4;};return a218_0x3e85();}import{CliErrors}from'../../errors.js';export const taskStatus={'service':'task','command':a218_0x1baa00(0x119),'description':a218_0x1baa00(0x124),'risk':'read','defaultOutputFormat':a218_0x1baa00(0x128),'structuredErrors':!![],'flags':[{'name':a218_0x1baa00(0x122),'type':a218_0x1baa00(0x11a),'required':!![],'description':'Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2fbc7d){const _0x6a769b=a218_0x1baa00;if(!_0x2fbc7d[_0x6a769b(0x121)](_0x6a769b(0x122))[_0x6a769b(0x117)]())throw CliErrors[_0x6a769b(0x125)](_0x6a769b(0x122));},async 'execute'(_0x54b960){const _0x437150=a218_0x1baa00,_0x5db969=_0x54b960[_0x437150(0x121)](_0x437150(0x122))[_0x437150(0x117)](),_0x316a85=normalizeAsyncTask(await getAsyncTaskStatus(_0x5db969,_0x54b960['appCode'],_0x54b960['cookie']));if(_0x316a85[_0x437150(0x11d)]!==_0x5db969)throw CliErrors['apiError']('Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20'+_0x5db969+',\x20received\x20'+_0x316a85[_0x437150(0x11d)]+'.');const _0x1ddae2=buildAsyncTaskStatusCommand(_0x316a85[_0x437150(0x11d)],_0x54b960['appCode']);return{'ok':!![],'message':asyncTaskMessage(_0x316a85),'data':{'appCode':_0x54b960[_0x437150(0x11c)],..._0x316a85,'query':_0x316a85[_0x437150(0x129)]?null:{'command':_0x1ddae2}}};}};
1
+ function a232_0x469c(_0x69f09b,_0x5c17e2){_0x69f09b=_0x69f09b-0x9c;const _0x4e2d9c=a232_0x4e2d();let _0x469cd1=_0x4e2d9c[_0x69f09b];return _0x469cd1;}function a232_0x4e2d(){const _0x567d54=['flagMissing','status','3032888oSrMMQ','2896DetPjn','1227516xGNhXz','894876PjVXXa','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','taskId','trim','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','apiError',',\x20received\x20','str','254zscSrQ','3966GywLhz','string','17808BinszL','task-id','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','16928442BzqGUM','363175zzNFEq','appCode','task'];a232_0x4e2d=function(){return _0x567d54;};return a232_0x4e2d();}const a232_0x3c6c87=a232_0x469c;(function(_0x5d7133,_0x417332){const _0xc34e6f=a232_0x469c,_0x5c7be1=_0x5d7133();while(!![]){try{const _0x5bc336=parseInt(_0xc34e6f(0xab))/0x1+-parseInt(_0xc34e6f(0x9c))/0x2*(-parseInt(_0xc34e6f(0x9d))/0x3)+parseInt(_0xc34e6f(0xa8))/0x4+-parseInt(_0xc34e6f(0xa3))/0x5+-parseInt(_0xc34e6f(0xaa))/0x6+parseInt(_0xc34e6f(0x9f))/0x7*(parseInt(_0xc34e6f(0xa9))/0x8)+-parseInt(_0xc34e6f(0xa2))/0x9;if(_0x5bc336===_0x417332)break;else _0x5c7be1['push'](_0x5c7be1['shift']());}catch(_0x2edeb9){_0x5c7be1['push'](_0x5c7be1['shift']());}}}(a232_0x4e2d,0x8e851));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const taskStatus={'service':a232_0x3c6c87(0xa5),'command':a232_0x3c6c87(0xa7),'description':a232_0x3c6c87(0xaf),'risk':'read','defaultOutputFormat':'compress','structuredErrors':!![],'flags':[{'name':a232_0x3c6c87(0xa0),'type':a232_0x3c6c87(0x9e),'required':!![],'description':a232_0x3c6c87(0xa1)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x434002){const _0x40c365=a232_0x3c6c87;if(!_0x434002[_0x40c365(0xb2)](_0x40c365(0xa0))['trim']())throw CliErrors[_0x40c365(0xa6)](_0x40c365(0xa0));},async 'execute'(_0x826aba){const _0x890181=a232_0x3c6c87,_0x49b142=_0x826aba[_0x890181(0xb2)](_0x890181(0xa0))[_0x890181(0xae)](),_0x303086=normalizeAsyncTask(await getAsyncTaskStatus(_0x49b142,_0x826aba[_0x890181(0xa4)],_0x826aba['cookie']));if(_0x303086[_0x890181(0xad)]!==_0x49b142)throw CliErrors[_0x890181(0xb0)](_0x890181(0xac)+_0x49b142+_0x890181(0xb1)+_0x303086[_0x890181(0xad)]+'.');const _0x461682=buildAsyncTaskStatusCommand(_0x303086[_0x890181(0xad)],_0x826aba[_0x890181(0xa4)]);return{'ok':!![],'message':asyncTaskMessage(_0x303086),'data':{'appCode':_0x826aba[_0x890181(0xa4)],..._0x303086,'query':_0x303086['isTerminal']?null:{'command':_0x461682}}};}};
@@ -1 +1 @@
1
- function a219_0x10ef(){const _0x7cc440=['150oiRwAm','40cLRSWh','7216QvGuka','875IKElvw','2826087vEiWyC','16925VFioox','1730379UtBgmP','6012999PCFVfY','1785796SrhxdB','525376JnunRC','15rAnRRT'];a219_0x10ef=function(){return _0x7cc440;};return a219_0x10ef();}(function(_0x163e0a,_0x1ba368){const _0x319e98=a219_0x5d1e,_0x4f9a9f=_0x163e0a();while(!![]){try{const _0x356a51=parseInt(_0x319e98(0xf1))/0x1+-parseInt(_0x319e98(0xf3))/0x2+-parseInt(_0x319e98(0xf5))/0x3*(-parseInt(_0x319e98(0xf4))/0x4)+parseInt(_0x319e98(0xf0))/0x5*(-parseInt(_0x319e98(0xf6))/0x6)+parseInt(_0x319e98(0xee))/0x7*(-parseInt(_0x319e98(0xed))/0x8)+parseInt(_0x319e98(0xf2))/0x9+parseInt(_0x319e98(0xec))/0xa*(-parseInt(_0x319e98(0xef))/0xb);if(_0x356a51===_0x1ba368)break;else _0x4f9a9f['push'](_0x4f9a9f['shift']());}catch(_0xca6528){_0x4f9a9f['push'](_0x4f9a9f['shift']());}}}(a219_0x10ef,0xe4d35));import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';function a219_0x5d1e(_0x41f96a,_0x128250){_0x41f96a=_0x41f96a-0xec;const _0x10ef80=a219_0x10ef();let _0x5d1ea3=_0x10ef80[_0x41f96a];return _0x5d1ea3;}export const tenantDefinitions=[tenantMembersListDefinition];
1
+ (function(_0x55c600,_0x3fe815){const _0x2bcdda=a233_0x1cfc,_0x2fe5df=_0x55c600();while(!![]){try{const _0x393fae=parseInt(_0x2bcdda(0x1e5))/0x1+-parseInt(_0x2bcdda(0x1dc))/0x2*(parseInt(_0x2bcdda(0x1e0))/0x3)+-parseInt(_0x2bcdda(0x1e2))/0x4*(-parseInt(_0x2bcdda(0x1e6))/0x5)+parseInt(_0x2bcdda(0x1e1))/0x6*(-parseInt(_0x2bcdda(0x1df))/0x7)+parseInt(_0x2bcdda(0x1e4))/0x8*(parseInt(_0x2bcdda(0x1de))/0x9)+-parseInt(_0x2bcdda(0x1dd))/0xa+parseInt(_0x2bcdda(0x1e3))/0xb;if(_0x393fae===_0x3fe815)break;else _0x2fe5df['push'](_0x2fe5df['shift']());}catch(_0x3abdce){_0x2fe5df['push'](_0x2fe5df['shift']());}}}(a233_0x80f5,0xa307f));function a233_0x1cfc(_0xe916f8,_0x3cb3d7){_0xe916f8=_0xe916f8-0x1dc;const _0x80f52d=a233_0x80f5();let _0x1cfcdb=_0x80f52d[_0xe916f8];return _0x1cfcdb;}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];function a233_0x80f5(){const _0x2741f4=['147VwJdXA','135858bsmpVb','260220MxveaM','2680kyNJZv','19957707eXDZLo','104hnpMkq','549009fGAcdg','7610LyaGmi','42zNukkI','11485440TivoFo','204237NMMAjr'];a233_0x80f5=function(){return _0x2741f4;};return a233_0x80f5();}
@@ -1 +1 @@
1
- function a220_0x33f1(_0x2b51ae,_0x4f9166){_0x2b51ae=_0x2b51ae-0x102;const _0x5dcdb1=a220_0x5dcd();let _0x33f1c4=_0x5dcdb1[_0x2b51ae];return _0x33f1c4;}const a220_0x26c1bb=a220_0x33f1;(function(_0x42f73a,_0x3dd16b){const _0x5f5261=a220_0x33f1,_0x79ffce=_0x42f73a();while(!![]){try{const _0x9e970a=-parseInt(_0x5f5261(0x110))/0x1+-parseInt(_0x5f5261(0x112))/0x2*(parseInt(_0x5f5261(0x103))/0x3)+parseInt(_0x5f5261(0x109))/0x4*(-parseInt(_0x5f5261(0x104))/0x5)+parseInt(_0x5f5261(0x10b))/0x6*(-parseInt(_0x5f5261(0x106))/0x7)+parseInt(_0x5f5261(0x102))/0x8*(parseInt(_0x5f5261(0x10e))/0x9)+-parseInt(_0x5f5261(0x115))/0xa+parseInt(_0x5f5261(0x10c))/0xb;if(_0x9e970a===_0x3dd16b)break;else _0x79ffce['push'](_0x79ffce['shift']());}catch(_0x16020c){_0x79ffce['push'](_0x79ffce['shift']());}}}(a220_0x5dcd,0x39139));function a220_0x5dcd(){const _0xde3144=['Pass\x20--tenant-code\x20<code>.','1289835FWPzMC','members-list','145052lHoHNF','\x20tenant\x20member(s)','31282ZRaLMZ','tenant','flagMissing','4002160DBGEFl','tenant-code','24SzKATG','27hBncVU','404555DohZWd','trim','483679tCANlH','str','string','4PqMAXI','read','18wlmLfX','8558869typcYi'];a220_0x5dcd=function(){return _0xde3144;};return a220_0x5dcd();}import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':a220_0x26c1bb(0x113),'command':a220_0x26c1bb(0x10f),'description':'List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','risk':a220_0x26c1bb(0x10a),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a220_0x26c1bb(0x116),'type':a220_0x26c1bb(0x108),'required':!![],'description':'Exact\x20tenant\x20code'}],async 'validate'(_0x278886){const _0x167842=a220_0x26c1bb;if(!_0x278886[_0x167842(0x107)]('tenant-code')[_0x167842(0x105)]())throw CliErrors[_0x167842(0x114)](_0x167842(0x116),_0x167842(0x10d));},async 'execute'(_0x433739){const _0x1f4084=a220_0x26c1bb,_0x3f784b=_0x433739[_0x1f4084(0x107)](_0x1f4084(0x116))[_0x1f4084(0x105)](),_0x2b0fee=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x3f784b,_0x2b0fee);const _0x541e56=projectTenantMembers(await listTenantDirectoryMembers(_0x3f784b));return{'ok':!![],'data':{'tenantCode':_0x3f784b,'items':_0x541e56,'totalCount':_0x541e56['length']},'message':'Found\x20'+_0x541e56['length']+_0x1f4084(0x111)};}};
1
+ const a234_0x1c68c2=a234_0x40c1;(function(_0x3b12e8,_0x57c5b6){const _0x4954fc=a234_0x40c1,_0x520dda=_0x3b12e8();while(!![]){try{const _0x3cb523=parseInt(_0x4954fc(0xa4))/0x1+parseInt(_0x4954fc(0x94))/0x2*(parseInt(_0x4954fc(0xa1))/0x3)+parseInt(_0x4954fc(0x9a))/0x4+parseInt(_0x4954fc(0x95))/0x5*(-parseInt(_0x4954fc(0xa8))/0x6)+-parseInt(_0x4954fc(0x9e))/0x7*(parseInt(_0x4954fc(0xa0))/0x8)+-parseInt(_0x4954fc(0x96))/0x9+parseInt(_0x4954fc(0xa6))/0xa;if(_0x3cb523===_0x57c5b6)break;else _0x520dda['push'](_0x520dda['shift']());}catch(_0x121d73){_0x520dda['push'](_0x520dda['shift']());}}}(a234_0x2166,0x8ebc7));function a234_0x40c1(_0x320b81,_0x1a765a){_0x320b81=_0x320b81-0x93;const _0x2166f1=a234_0x2166();let _0x40c163=_0x2166f1[_0x320b81];return _0x40c163;}import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a234_0x2166(){const _0x5cfc69=['string','flagMissing','Found\x20','3206756xnGVcS','str','members-list','Exact\x20tenant\x20code','7hYNGoK','trim','1805032ytznMt','78513PITuFi','\x20tenant\x20member(s)','read','355898XAtOlx','Pass\x20--tenant-code\x20<code>.','10958980lJilaq','length','3180444RDlArA','tenant-code','tenant','8qymZpd','5ZGCBZN','9160371jwMcBh'];a234_0x2166=function(){return _0x5cfc69;};return a234_0x2166();}import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':a234_0x1c68c2(0x93),'command':a234_0x1c68c2(0x9c),'description':'List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','risk':a234_0x1c68c2(0xa3),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a234_0x1c68c2(0xa9),'type':a234_0x1c68c2(0x97),'required':!![],'description':a234_0x1c68c2(0x9d)}],async 'validate'(_0x3b6d57){const _0xf7a754=a234_0x1c68c2;if(!_0x3b6d57[_0xf7a754(0x9b)](_0xf7a754(0xa9))[_0xf7a754(0x9f)]())throw CliErrors[_0xf7a754(0x98)](_0xf7a754(0xa9),_0xf7a754(0xa5));},async 'execute'(_0x2af82f){const _0x3c9f1a=a234_0x1c68c2,_0x23f37a=_0x2af82f['str'](_0x3c9f1a(0xa9))[_0x3c9f1a(0x9f)](),_0x32d1ef=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x23f37a,_0x32d1ef);const _0x617b60=projectTenantMembers(await listTenantDirectoryMembers(_0x23f37a));return{'ok':!![],'data':{'tenantCode':_0x23f37a,'items':_0x617b60,'totalCount':_0x617b60[_0x3c9f1a(0xa7)]},'message':_0x3c9f1a(0x99)+_0x617b60[_0x3c9f1a(0xa7)]+_0x3c9f1a(0xa2)};}};
@@ -1 +1 @@
1
- (function(_0x22ea9a,_0x5d72ff){const _0x20c597=a221_0x5df2,_0x55fde5=_0x22ea9a();while(!![]){try{const _0xa16d18=parseInt(_0x20c597(0x15c))/0x1+parseInt(_0x20c597(0x153))/0x2+parseInt(_0x20c597(0x14e))/0x3*(parseInt(_0x20c597(0x15d))/0x4)+parseInt(_0x20c597(0x160))/0x5+-parseInt(_0x20c597(0x15e))/0x6*(parseInt(_0x20c597(0x14f))/0x7)+-parseInt(_0x20c597(0x151))/0x8*(parseInt(_0x20c597(0x15b))/0x9)+parseInt(_0x20c597(0x154))/0xa;if(_0xa16d18===_0x5d72ff)break;else _0x55fde5['push'](_0x55fde5['shift']());}catch(_0x8c1e03){_0x55fde5['push'](_0x55fde5['shift']());}}}(a221_0x3874,0xecf43));import{CliErrors}from'../../errors.js';function textOrNull(_0x26baa1){const _0x3b69a6=a221_0x5df2,_0x3c0152=_0x26baa1?.[_0x3b69a6(0x158)]();return _0x3c0152?_0x3c0152:null;}export function projectTenantMembers(_0x26a134){const _0x56129e=a221_0x5df2,_0x5ace89=new Map();for(const _0x365c6b of _0x26a134){const _0x53c99b=Number(_0x365c6b[_0x56129e(0x14b)]);if(!Number['isFinite'](_0x53c99b)||_0x53c99b<=0x0)continue;const _0x8bf767={'userId':_0x53c99b,'username':textOrNull(_0x365c6b['username']),'displayName':textOrNull(_0x365c6b[_0x56129e(0x150)]),'role':_0x365c6b[_0x56129e(0x15f)]===!![]?_0x56129e(0x155):_0x56129e(0x159),'status':textOrNull(_0x365c6b[_0x56129e(0x14d)])},_0x5166aa=_0x5ace89[_0x56129e(0x15a)](_0x53c99b);if(!_0x5166aa){_0x5ace89[_0x56129e(0x152)](_0x53c99b,_0x8bf767);continue;}_0x5166aa[_0x56129e(0x157)]??=_0x8bf767[_0x56129e(0x157)],_0x5166aa['displayName']??=_0x8bf767[_0x56129e(0x163)],_0x5166aa[_0x56129e(0x14d)]??=_0x8bf767[_0x56129e(0x14d)];if(_0x8bf767[_0x56129e(0x14a)]==='ADMIN')_0x5166aa[_0x56129e(0x14a)]=_0x56129e(0x155);}return[..._0x5ace89[_0x56129e(0x161)]()]['sort']((_0x5ce1b0,_0x5778c4)=>_0x5ce1b0[_0x56129e(0x14b)]-_0x5778c4[_0x56129e(0x14b)]);}function a221_0x3874(){const _0x3bfa36=['ADMIN','some','username','trim','MEMBER','get','112383QeBsvS','770823zhblvl','4bzucYK','11271288XGJPhe','adminFlag','7000745zHlEYT','values','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','displayName','role','userId','Tenant\x20\x22','status','1977522StMyCC','7eNmRdL','nickname','744EoxANe','set','1316294cafkZU','5221090sPMdSg'];a221_0x3874=function(){return _0x3bfa36;};return a221_0x3874();}function a221_0x5df2(_0x43e991,_0x53a13a){_0x43e991=_0x43e991-0x14a;const _0x387484=a221_0x3874();let _0x5df21b=_0x387484[_0x43e991];return _0x5df21b;}export function assertTenantAccessible(_0x432b39,_0x44723d){const _0x4ad7bb=a221_0x5df2;if(_0x44723d[_0x4ad7bb(0x156)](_0xb6758d=>_0xb6758d['tenantCode']===_0x432b39))return;throw CliErrors['validation'](_0x4ad7bb(0x14c)+_0x432b39+'\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.',_0x4ad7bb(0x162));}
1
+ function a235_0x3c43(){const _0xb23f69=['36603900vRvNpx','nickname','30kuIFLQ','MEMBER','userId','validation','sort','1846831XLxtmf','role','434818dmunzy','values','1160706ukdvUg','81eZBDHy','get','adminFlag','844696YICldW','displayName','ADMIN','isFinite','status','username','5792095xhvJcl','Tenant\x20\x22','4eumACS','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','4yJQzcQ','49370uQvkzi','some','363RtNgNL','set','trim'];a235_0x3c43=function(){return _0xb23f69;};return a235_0x3c43();}function a235_0x11ff(_0x1e6268,_0x44494b){_0x1e6268=_0x1e6268-0x179;const _0x3c4348=a235_0x3c43();let _0x11ffb6=_0x3c4348[_0x1e6268];return _0x11ffb6;}(function(_0x301501,_0x5783e5){const _0x4275a8=a235_0x11ff,_0x5b1280=_0x301501();while(!![]){try{const _0x49360f=-parseInt(_0x4275a8(0x181))/0x1*(-parseInt(_0x4275a8(0x190))/0x2)+-parseInt(_0x4275a8(0x192))/0x3+-parseInt(_0x4275a8(0x17f))/0x4*(-parseInt(_0x4275a8(0x17d))/0x5)+parseInt(_0x4275a8(0x189))/0x6*(parseInt(_0x4275a8(0x18e))/0x7)+-parseInt(_0x4275a8(0x196))/0x8*(-parseInt(_0x4275a8(0x193))/0x9)+-parseInt(_0x4275a8(0x182))/0xa*(parseInt(_0x4275a8(0x184))/0xb)+-parseInt(_0x4275a8(0x187))/0xc;if(_0x49360f===_0x5783e5)break;else _0x5b1280['push'](_0x5b1280['shift']());}catch(_0x4cb7a0){_0x5b1280['push'](_0x5b1280['shift']());}}}(a235_0x3c43,0xaa40b));import{CliErrors}from'../../errors.js';function textOrNull(_0x4dd0bc){const _0xea068b=a235_0x11ff,_0x7409fa=_0x4dd0bc?.[_0xea068b(0x186)]();return _0x7409fa?_0x7409fa:null;}export function projectTenantMembers(_0x3e9be3){const _0x150f4a=a235_0x11ff,_0x20697b=new Map();for(const _0x125f55 of _0x3e9be3){const _0x372051=Number(_0x125f55[_0x150f4a(0x18b)]);if(!Number[_0x150f4a(0x17a)](_0x372051)||_0x372051<=0x0)continue;const _0x55bd7a={'userId':_0x372051,'username':textOrNull(_0x125f55[_0x150f4a(0x17c)]),'displayName':textOrNull(_0x125f55[_0x150f4a(0x188)]),'role':_0x125f55[_0x150f4a(0x195)]===!![]?_0x150f4a(0x179):_0x150f4a(0x18a),'status':textOrNull(_0x125f55[_0x150f4a(0x17b)])},_0x32d534=_0x20697b[_0x150f4a(0x194)](_0x372051);if(!_0x32d534){_0x20697b[_0x150f4a(0x185)](_0x372051,_0x55bd7a);continue;}_0x32d534[_0x150f4a(0x17c)]??=_0x55bd7a[_0x150f4a(0x17c)],_0x32d534[_0x150f4a(0x197)]??=_0x55bd7a['displayName'],_0x32d534[_0x150f4a(0x17b)]??=_0x55bd7a[_0x150f4a(0x17b)];if(_0x55bd7a[_0x150f4a(0x18f)]==='ADMIN')_0x32d534['role']='ADMIN';}return[..._0x20697b[_0x150f4a(0x191)]()][_0x150f4a(0x18d)]((_0x98028f,_0x2d8080)=>_0x98028f['userId']-_0x2d8080[_0x150f4a(0x18b)]);}export function assertTenantAccessible(_0x71c386,_0x5c0152){const _0x4c06f0=a235_0x11ff;if(_0x5c0152[_0x4c06f0(0x183)](_0x191c96=>_0x191c96['tenantCode']===_0x71c386))return;throw CliErrors[_0x4c06f0(0x18c)](_0x4c06f0(0x17e)+_0x71c386+'\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.',_0x4c06f0(0x180));}
@@ -1 +1 @@
1
- const a222_0x5429c3=a222_0x4fc8;(function(_0x48e6ea,_0x57c5cd){const _0x59e2aa=a222_0x4fc8,_0x4c2de7=_0x48e6ea();while(!![]){try{const _0x206113=parseInt(_0x59e2aa(0x17b))/0x1*(-parseInt(_0x59e2aa(0x17d))/0x2)+parseInt(_0x59e2aa(0x183))/0x3+-parseInt(_0x59e2aa(0x190))/0x4*(-parseInt(_0x59e2aa(0x188))/0x5)+-parseInt(_0x59e2aa(0x187))/0x6*(parseInt(_0x59e2aa(0x182))/0x7)+parseInt(_0x59e2aa(0x181))/0x8+-parseInt(_0x59e2aa(0x17a))/0x9+parseInt(_0x59e2aa(0x18a))/0xa;if(_0x206113===_0x57c5cd)break;else _0x4c2de7['push'](_0x4c2de7['shift']());}catch(_0x5a9ad9){_0x4c2de7['push'](_0x4c2de7['shift']());}}}(a222_0x2045,0xbfa96));function a222_0x4fc8(_0x507eb0,_0x179825){_0x507eb0=_0x507eb0-0x177;const _0x20452b=a222_0x2045();let _0x4fc823=_0x20452b[_0x507eb0];return _0x4fc823;}import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PROVIDER_ID=a222_0x5429c3(0x18b),CURRENT_BINDING_WARNING=a222_0x5429c3(0x178);function readDingTalkUserId(_0x15e70e){const _0x3358bd=a222_0x5429c3,_0x1a6f02=_0x15e70e[_0x3358bd(0x17f)](_0x3358bd(0x184))[_0x3358bd(0x179)]();if(!_0x1a6f02)throw CliErrors['validation'](_0x3358bd(0x180),_0x3358bd(0x186));return _0x1a6f02;}function buildBindingData(_0x22698f,_0x4b90f5){const _0xef439=a222_0x5429c3;return{'operation':'bind','selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x22698f},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x22698f,'bound':!![]},'dryRun':_0x4b90f5,'backend':{'method':_0xef439(0x18d),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a222_0x5429c3(0x177),'command':a222_0x5429c3(0x18c),'description':a222_0x5429c3(0x17c),'risk':a222_0x5429c3(0x189),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':'ding-talk-user-id','type':a222_0x5429c3(0x18e),'required':!![],'description':a222_0x5429c3(0x17e)}],async 'validate'(_0x20167e){readDingTalkUserId(_0x20167e);},async 'dryRun'(_0x4668a7){const _0x21482c=a222_0x5429c3,_0x544ff7=readDingTalkUserId(_0x4668a7);return asDryRunResult(buildBindingData(_0x544ff7,!![]),{'method':_0x21482c(0x18d),'url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x35321f){const _0x9ce0b1=a222_0x5429c3,_0x42eb28=readDingTalkUserId(_0x35321f),_0x54ed6d=await bindDingTalkSandboxAccount(_0x42eb28);if(_0x54ed6d!==!![])throw CliErrors[_0x9ce0b1(0x185)]('DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.',_0x9ce0b1(0x18f));return{'ok':!![],'data':buildBindingData(_0x42eb28,![]),'message':_0x9ce0b1(0x191)};}};function a222_0x2045(){const _0x29e690=['DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','str','--ding-talk-user-id\x20cannot\x20be\x20empty.','6063048UZIOfi','7ndSUYU','1654485AyzORC','ding-talk-user-id','apiError','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.','2274786DBnODA','15ClnuZW','write','4857510heEQFu','dingtalk','dingding-sandbox-bind','POST','string','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','646792lLVhGS','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','user-account','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','trim','2107710DEZjfF','13162bqWUrA','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','134LoaodT'];a222_0x2045=function(){return _0x29e690;};return a222_0x2045();}
1
+ function a236_0x147a(_0x34d5ae,_0x83d7ee){_0x34d5ae=_0x34d5ae-0x18a;const _0x15f8b1=a236_0x15f8();let _0x147a00=_0x15f8b1[_0x34d5ae];return _0x147a00;}const a236_0x506043=a236_0x147a;(function(_0x323f0e,_0x36bd07){const _0x16dc68=a236_0x147a,_0x3fba17=_0x323f0e();while(!![]){try{const _0x260654=parseInt(_0x16dc68(0x19b))/0x1+parseInt(_0x16dc68(0x19f))/0x2+parseInt(_0x16dc68(0x18b))/0x3*(parseInt(_0x16dc68(0x198))/0x4)+parseInt(_0x16dc68(0x19a))/0x5+-parseInt(_0x16dc68(0x192))/0x6+parseInt(_0x16dc68(0x195))/0x7+-parseInt(_0x16dc68(0x18a))/0x8;if(_0x260654===_0x36bd07)break;else _0x3fba17['push'](_0x3fba17['shift']());}catch(_0x915157){_0x3fba17['push'](_0x3fba17['shift']());}}}(a236_0x15f8,0x6f360));import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';function a236_0x15f8(){const _0x2c37ac=['158962umZlgA','21760jwuKTi','141lydZaZ','validation','apiError','--ding-talk-user-id\x20cannot\x20be\x20empty.','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','ding-talk-user-id','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','2371944qeFXjk','str','POST','1123983cigDhd','string','bind','41284CiEtpB','dingding-sandbox-bind','370970denQwQ','54233gelqQT','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','trim','write'];a236_0x15f8=function(){return _0x2c37ac;};return a236_0x15f8();}import{CliErrors}from'../../errors.js';const PROVIDER_ID='dingtalk',CURRENT_BINDING_WARNING=a236_0x506043(0x19c);function readDingTalkUserId(_0x4de5f7){const _0xce9513=a236_0x506043,_0x2cc73a=_0x4de5f7[_0xce9513(0x193)](_0xce9513(0x190))[_0xce9513(0x19d)]();if(!_0x2cc73a)throw CliErrors[_0xce9513(0x18c)](_0xce9513(0x18e),'Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.');return _0x2cc73a;}function buildBindingData(_0x3e328b,_0x41c96e){const _0x181ecc=a236_0x506043;return{'operation':_0x181ecc(0x197),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x3e328b},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x3e328b,'bound':!![]},'dryRun':_0x41c96e,'backend':{'method':_0x181ecc(0x194),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':'user-account','command':a236_0x506043(0x199),'description':a236_0x506043(0x191),'risk':a236_0x506043(0x19e),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a236_0x506043(0x190),'type':a236_0x506043(0x196),'required':!![],'description':'DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox'}],async 'validate'(_0x2a2a34){readDingTalkUserId(_0x2a2a34);},async 'dryRun'(_0x5d8ba9){const _0x57d958=readDingTalkUserId(_0x5d8ba9);return asDryRunResult(buildBindingData(_0x57d958,!![]),{'method':'POST','url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x3752bc){const _0x141375=a236_0x506043,_0x39bbb5=readDingTalkUserId(_0x3752bc),_0x348aea=await bindDingTalkSandboxAccount(_0x39bbb5);if(_0x348aea!==!![])throw CliErrors[_0x141375(0x18d)]('DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.',_0x141375(0x18f));return{'ok':!![],'data':buildBindingData(_0x39bbb5,![]),'message':'Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.'};}};