@lovrabet/rabetbase-cli 2.5.3-beta.1 → 2.5.3-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (419) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/api-group.d.ts +22 -0
  3. package/lib/api/api-group.js +1 -0
  4. package/lib/api/fetch-model-list.js +1 -1
  5. package/lib/api/generate-api-file.d.ts +18 -2
  6. package/lib/api/generate-api-file.js +1 -1
  7. package/lib/api/generate-sdk-config-file.js +1 -1
  8. package/lib/api/legacy-api-file.d.ts +11 -0
  9. package/lib/api/legacy-api-file.js +1 -0
  10. package/lib/api/model-registry-file.d.ts +36 -0
  11. package/lib/api/model-registry-file.js +1 -0
  12. package/lib/api/model-registry-scaffold.d.ts +7 -0
  13. package/lib/api/model-registry-scaffold.js +1 -0
  14. package/lib/api/model-source.d.ts +6 -0
  15. package/lib/api/model-source.js +1 -0
  16. package/lib/auth/auth-server-ui.js +1 -1
  17. package/lib/auth/auth-server.js +1 -1
  18. package/lib/auth/constant.js +1 -1
  19. package/lib/auth/get-cookie.js +1 -1
  20. package/lib/auth/get-session-user.js +1 -1
  21. package/lib/auth/is-session-valid.js +1 -1
  22. package/lib/auth/login-success-html.js +1 -1
  23. package/lib/auth/logout.js +1 -1
  24. package/lib/cli-flags.js +1 -1
  25. package/lib/cli.js +1 -1
  26. package/lib/commands/api/generate.js +1 -1
  27. package/lib/commands/api/index.js +1 -1
  28. package/lib/commands/api/list.js +1 -1
  29. package/lib/commands/api/pull.js +1 -1
  30. package/lib/commands/api/shared.js +1 -1
  31. package/lib/commands/app/index.js +1 -1
  32. package/lib/commands/app/list.js +1 -1
  33. package/lib/commands/app/members-list.js +1 -1
  34. package/lib/commands/app/remote-directory.js +1 -1
  35. package/lib/commands/app/shared.js +1 -1
  36. package/lib/commands/app-config/delete.js +1 -1
  37. package/lib/commands/app-config/get.js +1 -1
  38. package/lib/commands/app-config/index.js +1 -1
  39. package/lib/commands/app-config/list.js +1 -1
  40. package/lib/commands/app-config/set.js +1 -1
  41. package/lib/commands/app-config/shared.js +1 -1
  42. package/lib/commands/auth/index.js +1 -1
  43. package/lib/commands/bff/create.js +1 -1
  44. package/lib/commands/bff/delete.js +1 -1
  45. package/lib/commands/bff/detail.js +1 -1
  46. package/lib/commands/bff/index.js +1 -1
  47. package/lib/commands/bff/list.js +1 -1
  48. package/lib/commands/bff/logs.d.ts +7 -0
  49. package/lib/commands/bff/logs.js +1 -0
  50. package/lib/commands/bff/pull.js +1 -1
  51. package/lib/commands/bff/push.js +1 -1
  52. package/lib/commands/bff/status.js +1 -1
  53. package/lib/commands/cli-skill/index.js +1 -1
  54. package/lib/commands/cli-update.js +1 -1
  55. package/lib/commands/codegen/index.js +1 -1
  56. package/lib/commands/codegen/sdk.js +1 -1
  57. package/lib/commands/codegen/sql.js +1 -1
  58. package/lib/commands/common/app-registry.js +1 -1
  59. package/lib/commands/common/app-selector.js +1 -1
  60. package/lib/commands/common/async-task.js +1 -1
  61. package/lib/commands/common/dry-run.js +1 -1
  62. package/lib/commands/common/flags.d.ts +7 -0
  63. package/lib/commands/common/flags.js +1 -1
  64. package/lib/commands/common/local-file.js +1 -1
  65. package/lib/commands/common/validate.js +1 -1
  66. package/lib/commands/config/delete.js +1 -1
  67. package/lib/commands/config/get.js +1 -1
  68. package/lib/commands/config/index.js +1 -1
  69. package/lib/commands/config/init.js +1 -1
  70. package/lib/commands/config/list.js +1 -1
  71. package/lib/commands/config/set.js +1 -1
  72. package/lib/commands/config/shared.js +1 -1
  73. package/lib/commands/dataset/batch-design.d.ts +21 -0
  74. package/lib/commands/dataset/batch-design.js +1 -0
  75. package/lib/commands/dataset/business-group-update.js +1 -1
  76. package/lib/commands/dataset/business-groups.js +1 -1
  77. package/lib/commands/dataset/capability.js +1 -1
  78. package/lib/commands/dataset/cross-relation-create.d.ts +2 -0
  79. package/lib/commands/dataset/cross-relation-create.js +1 -0
  80. package/lib/commands/dataset/cross-relation-delete.d.ts +2 -0
  81. package/lib/commands/dataset/cross-relation-delete.js +1 -0
  82. package/lib/commands/dataset/cross-relation-list.d.ts +2 -0
  83. package/lib/commands/dataset/cross-relation-list.js +1 -0
  84. package/lib/commands/dataset/cross-relation-shared.d.ts +190 -0
  85. package/lib/commands/dataset/cross-relation-shared.js +1 -0
  86. package/lib/commands/dataset/cross-relation-update.d.ts +2 -0
  87. package/lib/commands/dataset/cross-relation-update.js +1 -0
  88. package/lib/commands/dataset/delete.js +1 -1
  89. package/lib/commands/dataset/detail.js +1 -1
  90. package/lib/commands/dataset/extend-update.js +1 -1
  91. package/lib/commands/dataset/field-restore.js +1 -1
  92. package/lib/commands/dataset/field-update.js +1 -1
  93. package/lib/commands/dataset/generate.js +1 -1
  94. package/lib/commands/dataset/index.js +1 -1
  95. package/lib/commands/dataset/list.js +1 -1
  96. package/lib/commands/dataset/operations.js +1 -1
  97. package/lib/commands/dataset/relation-audit.js +1 -1
  98. package/lib/commands/dataset/relation-create.js +1 -1
  99. package/lib/commands/dataset/relation-delete.js +1 -1
  100. package/lib/commands/dataset/relation-shared.js +1 -1
  101. package/lib/commands/dataset/relation-update.js +1 -1
  102. package/lib/commands/dataset/relations.js +1 -1
  103. package/lib/commands/dataset/rename.js +1 -1
  104. package/lib/commands/dataset/restore.js +1 -1
  105. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  106. package/lib/commands/db/analysis-batching.js +1 -1
  107. package/lib/commands/db/analyze-batch-plan.js +1 -1
  108. package/lib/commands/db/analyze-cancel.js +1 -1
  109. package/lib/commands/db/analyze-start.js +1 -1
  110. package/lib/commands/db/analyze-status.js +1 -1
  111. package/lib/commands/db/create.js +1 -1
  112. package/lib/commands/db/delete.js +1 -1
  113. package/lib/commands/db/detail.js +1 -1
  114. package/lib/commands/db/diff-refresh-start.js +1 -1
  115. package/lib/commands/db/diff-refresh-status.js +1 -1
  116. package/lib/commands/db/diff.js +1 -1
  117. package/lib/commands/db/index.js +1 -1
  118. package/lib/commands/db/list.js +1 -1
  119. package/lib/commands/db/shared.js +1 -1
  120. package/lib/commands/db/table-diff-shared.js +1 -1
  121. package/lib/commands/db/tables.js +1 -1
  122. package/lib/commands/db/test.js +1 -1
  123. package/lib/commands/db/update.js +1 -1
  124. package/lib/commands/deployment/index.js +1 -1
  125. package/lib/commands/deployment/sync-all.js +1 -1
  126. package/lib/commands/deployment/sync-jobs.js +1 -1
  127. package/lib/commands/deployment/sync-status.js +1 -1
  128. package/lib/commands/doctor.js +1 -1
  129. package/lib/commands/file/index.js +1 -1
  130. package/lib/commands/flow/create.d.ts +2 -0
  131. package/lib/commands/flow/create.js +1 -0
  132. package/lib/commands/flow/detail.d.ts +2 -0
  133. package/lib/commands/flow/detail.js +1 -0
  134. package/lib/commands/flow/index.d.ts +3 -0
  135. package/lib/commands/flow/index.js +1 -0
  136. package/lib/commands/flow/list.d.ts +2 -0
  137. package/lib/commands/flow/list.js +1 -0
  138. package/lib/commands/flow/publish.d.ts +2 -0
  139. package/lib/commands/flow/publish.js +1 -0
  140. package/lib/commands/flow/runtime-resources-shared.d.ts +40 -0
  141. package/lib/commands/flow/runtime-resources-shared.js +1 -0
  142. package/lib/commands/flow/runtime-role-list.d.ts +2 -0
  143. package/lib/commands/flow/runtime-role-list.js +1 -0
  144. package/lib/commands/flow/runtime-role-user-list.d.ts +2 -0
  145. package/lib/commands/flow/runtime-role-user-list.js +1 -0
  146. package/lib/commands/flow/runtime-user-search.d.ts +2 -0
  147. package/lib/commands/flow/runtime-user-search.js +1 -0
  148. package/lib/commands/flow/shared.d.ts +41 -0
  149. package/lib/commands/flow/shared.js +1 -0
  150. package/lib/commands/flow/update.d.ts +2 -0
  151. package/lib/commands/flow/update.js +1 -0
  152. package/lib/commands/flow/validate.d.ts +3 -0
  153. package/lib/commands/flow/validate.js +1 -0
  154. package/lib/commands/instant-api-policy/current.js +1 -1
  155. package/lib/commands/instant-api-policy/index.js +1 -1
  156. package/lib/commands/instant-api-policy/init.js +1 -1
  157. package/lib/commands/instant-api-policy/publish.js +1 -1
  158. package/lib/commands/instant-api-policy/pull.js +1 -1
  159. package/lib/commands/instant-api-policy/revision.js +1 -1
  160. package/lib/commands/instant-api-policy/revisions.js +1 -1
  161. package/lib/commands/instant-api-policy/rollback.js +1 -1
  162. package/lib/commands/instant-api-policy/shared.js +1 -1
  163. package/lib/commands/instant-api-policy/validate.js +1 -1
  164. package/lib/commands/issue/index.js +1 -1
  165. package/lib/commands/issue/nudge.js +1 -1
  166. package/lib/commands/issue/report.js +1 -1
  167. package/lib/commands/issue/shared.js +1 -1
  168. package/lib/commands/kb/create.js +1 -1
  169. package/lib/commands/kb/delete.js +1 -1
  170. package/lib/commands/kb/detail.js +1 -1
  171. package/lib/commands/kb/index.js +1 -1
  172. package/lib/commands/kb/list.js +1 -1
  173. package/lib/commands/kb/search.js +1 -1
  174. package/lib/commands/kb/shared.js +1 -1
  175. package/lib/commands/kb/update.js +1 -1
  176. package/lib/commands/logs/index.js +1 -1
  177. package/lib/commands/menu/asset-update.js +1 -1
  178. package/lib/commands/menu/delete.js +1 -1
  179. package/lib/commands/menu/external-link-create.js +1 -1
  180. package/lib/commands/menu/external-link-update.js +1 -1
  181. package/lib/commands/menu/group-create.js +1 -1
  182. package/lib/commands/menu/group-update.js +1 -1
  183. package/lib/commands/menu/index.js +1 -1
  184. package/lib/commands/menu/list.js +1 -1
  185. package/lib/commands/menu/move.js +1 -1
  186. package/lib/commands/menu/regroup-start.js +1 -1
  187. package/lib/commands/menu/rename.js +1 -1
  188. package/lib/commands/menu/shared/compare-table.js +1 -1
  189. package/lib/commands/menu/shared/delete-plan.js +1 -1
  190. package/lib/commands/menu/shared/facts.js +1 -1
  191. package/lib/commands/menu/shared/index.js +1 -1
  192. package/lib/commands/menu/shared/inquirer.js +1 -1
  193. package/lib/commands/menu/shared/local-pages.js +1 -1
  194. package/lib/commands/menu/shared/logic.js +1 -1
  195. package/lib/commands/menu/shared/mutations.js +1 -1
  196. package/lib/commands/menu/shared/service.js +1 -1
  197. package/lib/commands/menu/shared/sync-core.js +1 -1
  198. package/lib/commands/menu/shared/update-core.js +1 -1
  199. package/lib/commands/menu/shared/valid-url.js +1 -1
  200. package/lib/commands/menu/sync.js +1 -1
  201. package/lib/commands/menu/visibility-update.js +1 -1
  202. package/lib/commands/notification/config-create.js +1 -1
  203. package/lib/commands/notification/config-delete.js +1 -1
  204. package/lib/commands/notification/config-list.js +1 -1
  205. package/lib/commands/notification/config-update.js +1 -1
  206. package/lib/commands/notification/index.js +1 -1
  207. package/lib/commands/notification/shared.js +1 -1
  208. package/lib/commands/ocr/index.js +1 -1
  209. package/lib/commands/page/create.js +1 -1
  210. package/lib/commands/page/custom/detail.js +1 -1
  211. package/lib/commands/page/custom/list.js +1 -1
  212. package/lib/commands/page/custom/publish.js +1 -1
  213. package/lib/commands/page/custom/shared.js +1 -1
  214. package/lib/commands/page/custom/syntax.js +1 -1
  215. package/lib/commands/page/custom/update.js +1 -1
  216. package/lib/commands/page/data-list-status.js +1 -1
  217. package/lib/commands/page/generate-start.js +1 -1
  218. package/lib/commands/page/generate-status.js +1 -1
  219. package/lib/commands/page/index.js +1 -1
  220. package/lib/commands/page/pull.js +1 -1
  221. package/lib/commands/page/push.js +1 -1
  222. package/lib/commands/page/relation-audit.js +1 -1
  223. package/lib/commands/page/restore.js +1 -1
  224. package/lib/commands/page/shared.js +1 -1
  225. package/lib/commands/page/sync.js +1 -1
  226. package/lib/commands/project/api-architecture-upgrade.d.ts +28 -0
  227. package/lib/commands/project/api-architecture-upgrade.js +1 -0
  228. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  229. package/lib/commands/project/create/format-elapsed.js +1 -1
  230. package/lib/commands/project/create/main.js +1 -1
  231. package/lib/commands/project/create/materialize-project-template.js +1 -1
  232. package/lib/commands/project/create/project-name.js +1 -1
  233. package/lib/commands/project/create/project-template-archive.js +1 -1
  234. package/lib/commands/project/create/project-template-path.js +1 -1
  235. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  236. package/lib/commands/project/create/use-format-code.js +1 -1
  237. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  238. package/lib/commands/project/domain-routing-sync.js +1 -1
  239. package/lib/commands/project/index.js +1 -1
  240. package/lib/commands/project/upgrade.d.ts +30 -1
  241. package/lib/commands/project/upgrade.js +1 -1
  242. package/lib/commands/registry.js +1 -1
  243. package/lib/commands/role/delete.js +1 -1
  244. package/lib/commands/role/detail.js +1 -1
  245. package/lib/commands/role/index.js +1 -1
  246. package/lib/commands/role/list.js +1 -1
  247. package/lib/commands/role/shared.js +1 -1
  248. package/lib/commands/role/update.js +1 -1
  249. package/lib/commands/role/user-add.js +1 -1
  250. package/lib/commands/role/user-remove.js +1 -1
  251. package/lib/commands/role/user-resolve.js +1 -1
  252. package/lib/commands/rule/get.js +1 -1
  253. package/lib/commands/rule/index.js +1 -1
  254. package/lib/commands/rule/list.js +1 -1
  255. package/lib/commands/rule/set.js +1 -1
  256. package/lib/commands/rule/shared.js +1 -1
  257. package/lib/commands/run/index.js +1 -1
  258. package/lib/commands/schema.js +1 -1
  259. package/lib/commands/sql/create.js +1 -1
  260. package/lib/commands/sql/delete.js +1 -1
  261. package/lib/commands/sql/detail.js +1 -1
  262. package/lib/commands/sql/exec.js +1 -1
  263. package/lib/commands/sql/index.js +1 -1
  264. package/lib/commands/sql/list.js +1 -1
  265. package/lib/commands/sql/pull.js +1 -1
  266. package/lib/commands/sql/push.js +1 -1
  267. package/lib/commands/sql/shared.js +1 -1
  268. package/lib/commands/sql/status.js +1 -1
  269. package/lib/commands/sql/validate.js +1 -1
  270. package/lib/commands/task/index.js +1 -1
  271. package/lib/commands/task/status.js +1 -1
  272. package/lib/commands/tenant/index.js +1 -1
  273. package/lib/commands/tenant/members-list.js +1 -1
  274. package/lib/commands/tenant/shared.js +1 -1
  275. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  276. package/lib/commands/user-account/index.js +1 -1
  277. package/lib/commands/workspace/add.js +1 -1
  278. package/lib/commands/workspace/index.js +1 -1
  279. package/lib/commands/workspace/remove.js +1 -1
  280. package/lib/config/domain-config.js +1 -1
  281. package/lib/config/project-domain-routing.js +1 -1
  282. package/lib/config/region-config.js +1 -1
  283. package/lib/config/schema.js +1 -1
  284. package/lib/constant/cdn.js +1 -1
  285. package/lib/constant/cli.js +1 -1
  286. package/lib/constant/defaults.js +1 -1
  287. package/lib/constant/domain.js +1 -1
  288. package/lib/constant/env.js +1 -1
  289. package/lib/constant/output.js +1 -1
  290. package/lib/constant/paths.js +1 -1
  291. package/lib/constant/region.js +1 -1
  292. package/lib/constant/risk.js +1 -1
  293. package/lib/constant/routing-profile.js +1 -1
  294. package/lib/context/app-resolver.d.ts +2 -0
  295. package/lib/context/app-resolver.js +1 -1
  296. package/lib/context/auth-resolver.js +1 -1
  297. package/lib/context/config-loader.js +1 -1
  298. package/lib/context.d.ts +2 -1
  299. package/lib/context.js +1 -1
  300. package/lib/core/alias-resolver.d.ts +13 -17
  301. package/lib/core/alias-resolver.js +1 -1
  302. package/lib/core/api-client.d.ts +176 -1
  303. package/lib/core/api-client.js +1 -1
  304. package/lib/core/bff/config.js +1 -1
  305. package/lib/core/bff/file-system.js +1 -1
  306. package/lib/core/bff/hash.js +1 -1
  307. package/lib/core/bff/hook-directory.d.ts +55 -0
  308. package/lib/core/bff/hook-directory.js +1 -0
  309. package/lib/core/bff/lock.js +1 -1
  310. package/lib/core/bff/types.d.ts +15 -0
  311. package/lib/core/bff/utils.js +1 -1
  312. package/lib/core/cross-db-relation.d.ts +41 -0
  313. package/lib/core/cross-db-relation.js +1 -0
  314. package/lib/core/db-resolver.js +1 -1
  315. package/lib/core/flow-config.d.ts +628 -0
  316. package/lib/core/flow-config.js +1 -0
  317. package/lib/core/instant-api-policy/config.js +1 -1
  318. package/lib/core/kb-search-client.js +1 -1
  319. package/lib/core/page/file-system.js +1 -1
  320. package/lib/core/page/hash.js +1 -1
  321. package/lib/core/page/lock.js +1 -1
  322. package/lib/core/page/lr-smart-jsx.js +1 -1
  323. package/lib/core/sql-index-auditor.js +1 -1
  324. package/lib/core/sql-sync/config.js +1 -1
  325. package/lib/core/sql-sync/file-system.js +1 -1
  326. package/lib/core/sql-sync/hash.js +1 -1
  327. package/lib/core/sql-sync/lock.js +1 -1
  328. package/lib/core/sql-sync/utils.js +1 -1
  329. package/lib/core/sql-validator.js +1 -1
  330. package/lib/errors.js +1 -1
  331. package/lib/framework/build-all-flags.js +1 -1
  332. package/lib/framework/error-output.js +1 -1
  333. package/lib/framework/explicit-yes.js +1 -1
  334. package/lib/framework/flags.js +1 -1
  335. package/lib/framework/help.js +1 -1
  336. package/lib/framework/index.js +1 -1
  337. package/lib/framework/output.js +1 -1
  338. package/lib/framework/response.js +1 -1
  339. package/lib/framework/runner-alias.d.ts +1 -1
  340. package/lib/framework/runner-alias.js +1 -1
  341. package/lib/framework/runner.js +1 -1
  342. package/lib/framework/schema-export.js +1 -1
  343. package/lib/framework/supported-flags.js +1 -1
  344. package/lib/framework/types.js +1 -1
  345. package/lib/generated/build-info.d.ts +4 -4
  346. package/lib/generated/build-info.js +1 -1
  347. package/lib/generated/official-routing.js +1 -1
  348. package/lib/generated/routing-contract.js +1 -1
  349. package/lib/help.js +1 -1
  350. package/lib/postinstall.js +1 -1
  351. package/lib/runtime/confirmation.js +1 -1
  352. package/lib/runtime/event.js +1 -1
  353. package/lib/runtime/index.js +1 -1
  354. package/lib/runtime/queue.js +1 -1
  355. package/lib/runtime/resolve.js +1 -1
  356. package/lib/skills/builtin-skill.js +1 -1
  357. package/lib/skills/main.js +1 -1
  358. package/lib/skills/npx-skills-add.d.ts +0 -10
  359. package/lib/skills/npx-skills-add.js +1 -1
  360. package/lib/skills/skill-presence.js +1 -1
  361. package/lib/telemetry/cli-command-trace.js +1 -1
  362. package/lib/telemetry/cli-help-trace.js +1 -1
  363. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  364. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  365. package/lib/telemetry/send-cli-trace-log.js +1 -1
  366. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  367. package/lib/types/index.d.ts +11 -1
  368. package/lib/utils/ai_config.js +1 -1
  369. package/lib/utils/apply-jq-filter.js +1 -1
  370. package/lib/utils/cdn-config.js +1 -1
  371. package/lib/utils/check-sdk-version.js +1 -1
  372. package/lib/utils/cli-version-check.js +1 -1
  373. package/lib/utils/cli-version-policy.d.ts +12 -0
  374. package/lib/utils/cli-version-policy.js +1 -1
  375. package/lib/utils/config.js +1 -1
  376. package/lib/utils/entity-with-id.js +1 -1
  377. package/lib/utils/file-utils.js +1 -1
  378. package/lib/utils/guides-cdn.js +1 -1
  379. package/lib/utils/http-client.js +1 -1
  380. package/lib/utils/is-non-interactive.js +1 -1
  381. package/lib/utils/logger.js +1 -1
  382. package/lib/utils/params.js +1 -1
  383. package/lib/utils/platform.js +1 -1
  384. package/lib/utils/sleep.js +1 -1
  385. package/lib/utils/template-replacer.js +1 -1
  386. package/lib/utils/update-notice.js +1 -1
  387. package/lib/utils/version.js +1 -1
  388. package/lib/utils/with-active-cookie.js +1 -1
  389. package/lib/utils/write-cli-side-channel.js +1 -1
  390. package/package.json +4 -1
  391. package/skills/rabetbase/SKILL.md +31 -9
  392. package/skills/rabetbase/guides/approval-flow-development-workflow.md +137 -0
  393. package/skills/rabetbase/guides/backend-function.md +19 -9
  394. package/skills/rabetbase/guides/bff-creation-workflow.md +10 -1
  395. package/skills/rabetbase/guides/conflict-detection.md +2 -0
  396. package/skills/rabetbase/guides/sdk-client-generation.md +112 -60
  397. package/skills/rabetbase/guides/typescript-sdk.md +9 -0
  398. package/skills/rabetbase/knowledge/approval-flow/config-json-schema.md +290 -0
  399. package/skills/rabetbase/references/rabetbase-api-pull.md +30 -19
  400. package/skills/rabetbase/references/rabetbase-app-list.md +1 -1
  401. package/skills/rabetbase/references/rabetbase-bff-create.md +1 -1
  402. package/skills/rabetbase/references/rabetbase-bff-logs.md +47 -0
  403. package/skills/rabetbase/references/rabetbase-bff-pull.md +7 -3
  404. package/skills/rabetbase/references/rabetbase-bff-push.md +10 -2
  405. package/skills/rabetbase/references/rabetbase-config.md +2 -1
  406. package/skills/rabetbase/references/rabetbase-dataset-cross-relations.md +60 -0
  407. package/skills/rabetbase/references/rabetbase-dataset-generate.md +52 -2
  408. package/skills/rabetbase/references/rabetbase-flow-commands.md +86 -0
  409. package/skills/rabetbase/references/rabetbase-flow-resources.md +83 -0
  410. package/skills/rabetbase/references/rabetbase-flow-runtime-boundary.md +25 -0
  411. package/skills/rabetbase/references/rabetbase-instant-api-policy.md +103 -11
  412. package/skills/rabetbase/references/rabetbase-notification-config-list.md +17 -0
  413. package/skills/rabetbase/references/rabetbase-project-create.md +3 -3
  414. package/skills/rabetbase/references/rabetbase-project-upgrade.md +24 -13
  415. package/skills/rabetbase.manifest.json +10 -3
  416. package/templates/README.md +16 -4
  417. package/templates/generate-api/model-runtime.ts.tpl +101 -0
  418. package/templates/generate-api/profile-api.ts.tpl +21 -0
  419. package/templates/generate-api/profile-client.ts.tpl +14 -0
@@ -1 +1 @@
1
- const a207_0x2805e8=a207_0x2b08;(function(_0x35937e,_0x3c14fa){const _0x41ae34=a207_0x2b08,_0x1bef8e=_0x35937e();while(!![]){try{const _0x3b4b49=parseInt(_0x41ae34(0x1a5))/0x1+-parseInt(_0x41ae34(0x1b9))/0x2+-parseInt(_0x41ae34(0x1bb))/0x3*(parseInt(_0x41ae34(0x1b2))/0x4)+parseInt(_0x41ae34(0x1ae))/0x5+parseInt(_0x41ae34(0x1c1))/0x6*(-parseInt(_0x41ae34(0x19e))/0x7)+-parseInt(_0x41ae34(0x1ac))/0x8*(parseInt(_0x41ae34(0x19f))/0x9)+-parseInt(_0x41ae34(0x19d))/0xa*(-parseInt(_0x41ae34(0x1bf))/0xb);if(_0x3b4b49===_0x3c14fa)break;else _0x1bef8e['push'](_0x1bef8e['shift']());}catch(_0x225ccb){_0x1bef8e['push'](_0x1bef8e['shift']());}}}(a207_0x5e9b,0xdfd46));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a207_0x5e9b(){const _0x188eb7=['sqlcode','fromEntries','8WIoNDq','lockFilePath','5682005QWKpMq','sqlRootDir','toISOString','str','772UupHeS','sqls','validation','\x20(local\x20file\x20moved\x20to\x20trash)','Would\x20delete\x20SQL\x20','sqlRoot','SQL\x20lock\x20file\x20not\x20found.','1355176eIZJQa','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','10065XNwLcG','entries','Deleted\x20','trashedTo','11oBgfGW','replace','42YwpAxn','24590110KLXLwU','659722bkVyaO','9598851UPcdaf','POST','length','delete','trashDir','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','372758VKaDUN','filter','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','remoteId','appCode'];a207_0x5e9b=function(){return _0x188eb7;};return a207_0x5e9b();}import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';function a207_0x2b08(_0x24841e,_0x207c84){_0x24841e=_0x24841e-0x19d;const _0x5e9b02=a207_0x5e9b();let _0x2b0845=_0x5e9b02[_0x24841e];return _0x2b0845;}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':'sql','command':a207_0x2805e8(0x1a2),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x2939f3){const _0x9e3eb0=a207_0x2805e8,_0x7be055=loadSqlProjectConfig(_0x2939f3[_0x9e3eb0(0x1a9)]),_0x3df3c1=await readSqlLockFile(_0x7be055[_0x9e3eb0(0x1ad)]);if(!_0x3df3c1)throw CliErrors[_0x9e3eb0(0x1b4)](_0x9e3eb0(0x1a4));},async 'dryRun'(_0xe5a63b){const _0xb7bc84=a207_0x2805e8,_0x461e03=loadSqlProjectConfig(_0xe5a63b[_0xb7bc84(0x1a9)]),_0x291e1f=await readSqlLockFile(_0x461e03[_0xb7bc84(0x1ad)]);if(!_0x291e1f)throw CliErrors[_0xb7bc84(0x1b4)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x23fab8}=ensureSqlLockScope(_0x291e1f,_0xe5a63b[_0xb7bc84(0x1a9)],_0x461e03[_0xb7bc84(0x1b7)],_0xb7bc84(0x1a2)),_0x1dd1db=_0xe5a63b[_0xb7bc84(0x1b1)]('sqlcode'),_0x334256=_0x23fab8[_0xb7bc84(0x1b3)][_0x1dd1db];if(!_0x334256)throw CliErrors[_0xb7bc84(0x1b4)](_0xb7bc84(0x1a7)+_0x1dd1db+'\x22.');return{'method':_0xb7bc84(0x1a0),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x1dd1db,'id':_0x334256[_0xb7bc84(0x1a8)],'localPath':resolveLocalSqlFilePath(_0x461e03,_0x1dd1db,_0x334256)},'description':_0xb7bc84(0x1b6)+_0x1dd1db+_0xb7bc84(0x1ba)+_0x461e03['trashDir']};},async 'execute'(_0x28dcc8){const _0x2e1bc8=a207_0x2805e8,_0x31cbcf=loadSqlProjectConfig(_0x28dcc8[_0x2e1bc8(0x1a9)]),_0x1bed23=await readSqlLockFile(_0x31cbcf[_0x2e1bc8(0x1ad)]);if(!_0x1bed23)throw CliErrors['validation'](_0x2e1bc8(0x1b8));const {lockData:_0xda5772,appLock:_0x1edbca}=ensureSqlLockScope(_0x1bed23,_0x28dcc8[_0x2e1bc8(0x1a9)],_0x31cbcf['sqlRoot'],_0x2e1bc8(0x1a2)),_0x42fbd5=_0x28dcc8[_0x2e1bc8(0x1b1)](_0x2e1bc8(0x1aa)),_0x44787e=_0x1edbca['sqls'][_0x42fbd5];if(!_0x44787e)throw CliErrors[_0x2e1bc8(0x1b4)](_0x2e1bc8(0x1a7)+_0x42fbd5+'\x22.');await deleteSqlQuery({'id':_0x44787e[_0x2e1bc8(0x1a8)],'sqlCode':_0x42fbd5}),_0x1edbca['sqls']=Object[_0x2e1bc8(0x1ab)](Object[_0x2e1bc8(0x1bc)](_0x1edbca['sqls'])[_0x2e1bc8(0x1a6)](([_0x157c8d])=>_0x157c8d!==_0x42fbd5)),_0x1edbca['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x31cbcf['lockFilePath'],_0xda5772);const _0x3d9e04=resolveLocalSqlFilePath(_0x31cbcf,_0x42fbd5,_0x44787e);let _0x1e9822;await fileExists(_0x3d9e04)&&(_0x1e9822=await moveToTrash(_0x31cbcf['projectRoot'],_0x31cbcf[_0x2e1bc8(0x1a3)],_0x3d9e04),await cleanupEmptyDirectories(dirname(_0x3d9e04),_0x31cbcf[_0x2e1bc8(0x1af)]));const _0x27bc2b={'deleted':_0x42fbd5,'remoteId':_0x44787e[_0x2e1bc8(0x1a8)]};if(_0x1e9822)_0x27bc2b[_0x2e1bc8(0x1be)]=_0x1e9822;return{'ok':!![],'data':_0x27bc2b,'message':_0x2e1bc8(0x1bd)+_0x42fbd5+(_0x1e9822?_0x2e1bc8(0x1b5):'')};}};async function moveToTrash(_0x5c9732,_0x426c65,_0x9cfc73){const _0x88eac1=a207_0x2805e8,_0x3762a7=new Date()[_0x88eac1(0x1b0)]()[_0x88eac1(0x1c0)](/[:.]/g,'-'),_0x2cf4d0=relative(_0x5c9732,_0x9cfc73),_0x276a9f=join(_0x426c65,_0x3762a7,_0x2cf4d0);return await mkdir(dirname(_0x276a9f),{'recursive':!![]}),await rename(_0x9cfc73,_0x276a9f),_0x276a9f;}async function cleanupEmptyDirectories(_0x23593c,_0x584513){const _0x4dfbd7=a207_0x2805e8;let _0x58f6e3=resolve(_0x23593c);const _0x21588d=resolve(_0x584513);while(_0x58f6e3['startsWith'](''+_0x21588d+sep)||_0x58f6e3===_0x21588d){if(_0x58f6e3===_0x21588d)return;try{const _0xb97260=await readdir(_0x58f6e3);if(_0xb97260[_0x4dfbd7(0x1a1)]>0x0)return;await rmdir(_0x58f6e3);}catch{return;}_0x58f6e3=dirname(_0x58f6e3);}}
1
+ const a232_0x5294ac=a232_0x49d1;(function(_0x46b079,_0xf102de){const _0x418da9=a232_0x49d1,_0x7b1131=_0x46b079();while(!![]){try{const _0x2a7b64=parseInt(_0x418da9(0xd1))/0x1*(parseInt(_0x418da9(0xe4))/0x2)+parseInt(_0x418da9(0xdd))/0x3+parseInt(_0x418da9(0xd2))/0x4*(parseInt(_0x418da9(0xed))/0x5)+parseInt(_0x418da9(0xcb))/0x6*(-parseInt(_0x418da9(0xce))/0x7)+parseInt(_0x418da9(0xd5))/0x8+parseInt(_0x418da9(0xe6))/0x9+parseInt(_0x418da9(0xdc))/0xa*(-parseInt(_0x418da9(0xe5))/0xb);if(_0x2a7b64===_0xf102de)break;else _0x7b1131['push'](_0x7b1131['shift']());}catch(_0x16810f){_0x7b1131['push'](_0x7b1131['shift']());}}}(a232_0x453e,0x50974));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a232_0x49d1(_0xcf53f4,_0x161ffe){_0xcf53f4=_0xcf53f4-0xca;const _0x453e19=a232_0x453e();let _0x49d16f=_0x453e19[_0xcf53f4];return _0x49d16f;}export const sqlDelete={'service':a232_0x5294ac(0xd4),'command':a232_0x5294ac(0xdb),'description':a232_0x5294ac(0xea),'risk':a232_0x5294ac(0xd8),'flags':[SQLCODE_FLAG],async 'validate'(_0x2e6ed4){const _0x422b29=a232_0x5294ac,_0x23cb75=loadSqlProjectConfig(_0x2e6ed4[_0x422b29(0xcf)]),_0x237947=await readSqlLockFile(_0x23cb75[_0x422b29(0xe9)]);if(!_0x237947)throw CliErrors[_0x422b29(0xe0)](_0x422b29(0xe2));},async 'dryRun'(_0x59a007){const _0x3d11db=a232_0x5294ac,_0x9c291a=loadSqlProjectConfig(_0x59a007[_0x3d11db(0xcf)]),_0x450ecd=await readSqlLockFile(_0x9c291a[_0x3d11db(0xe9)]);if(!_0x450ecd)throw CliErrors[_0x3d11db(0xe0)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x1747ee}=ensureSqlLockScope(_0x450ecd,_0x59a007[_0x3d11db(0xcf)],_0x9c291a[_0x3d11db(0xda)],_0x3d11db(0xdb)),_0xeb4fb5=_0x59a007['str'](_0x3d11db(0xd6)),_0x153bf2=_0x1747ee[_0x3d11db(0xca)][_0xeb4fb5];if(!_0x153bf2)throw CliErrors['validation'](_0x3d11db(0xd3)+_0xeb4fb5+'\x22.');return{'method':_0x3d11db(0xd0),'url':_0x3d11db(0xe8),'body':{'sqlCode':_0xeb4fb5,'id':_0x153bf2[_0x3d11db(0xdf)],'localPath':resolveLocalSqlFilePath(_0x9c291a,_0xeb4fb5,_0x153bf2)},'description':_0x3d11db(0xeb)+_0xeb4fb5+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x9c291a[_0x3d11db(0xe7)]};},async 'execute'(_0x117c7b){const _0x5b4ebd=a232_0x5294ac,_0x50b561=loadSqlProjectConfig(_0x117c7b['appCode']),_0x4e8df5=await readSqlLockFile(_0x50b561[_0x5b4ebd(0xe9)]);if(!_0x4e8df5)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x148012,appLock:_0x24ff87}=ensureSqlLockScope(_0x4e8df5,_0x117c7b[_0x5b4ebd(0xcf)],_0x50b561[_0x5b4ebd(0xda)],_0x5b4ebd(0xdb)),_0xfcf1e8=_0x117c7b[_0x5b4ebd(0xd7)](_0x5b4ebd(0xd6)),_0x238b1a=_0x24ff87[_0x5b4ebd(0xca)][_0xfcf1e8];if(!_0x238b1a)throw CliErrors[_0x5b4ebd(0xe0)](_0x5b4ebd(0xd3)+_0xfcf1e8+'\x22.');await deleteSqlQuery({'id':_0x238b1a[_0x5b4ebd(0xdf)],'sqlCode':_0xfcf1e8}),_0x24ff87[_0x5b4ebd(0xca)]=Object['fromEntries'](Object['entries'](_0x24ff87[_0x5b4ebd(0xca)])['filter'](([_0x2b1b5c])=>_0x2b1b5c!==_0xfcf1e8)),_0x24ff87[_0x5b4ebd(0xe3)]=new Date()[_0x5b4ebd(0xec)](),await writeSqlLockFile(_0x50b561[_0x5b4ebd(0xe9)],_0x148012);const _0x14ee4b=resolveLocalSqlFilePath(_0x50b561,_0xfcf1e8,_0x238b1a);let _0x35d0a6;await fileExists(_0x14ee4b)&&(_0x35d0a6=await moveToTrash(_0x50b561[_0x5b4ebd(0xde)],_0x50b561[_0x5b4ebd(0xe7)],_0x14ee4b),await cleanupEmptyDirectories(dirname(_0x14ee4b),_0x50b561['sqlRootDir']));const _0x10d9a6={'deleted':_0xfcf1e8,'remoteId':_0x238b1a[_0x5b4ebd(0xdf)]};if(_0x35d0a6)_0x10d9a6[_0x5b4ebd(0xcc)]=_0x35d0a6;return{'ok':!![],'data':_0x10d9a6,'message':'Deleted\x20'+_0xfcf1e8+(_0x35d0a6?_0x5b4ebd(0xd9):'')};}};function a232_0x453e(){const _0x4d6e35=['sql','1597288EZyAZj','sqlcode','str','high-risk-write','\x20(local\x20file\x20moved\x20to\x20trash)','sqlRoot','delete','430Qrsnqa','1666845DWiIFp','projectRoot','remoteId','validation','replace','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','lastSync','759028gescnF','381458smIGrs','3643731vXYuIG','trashDir','/smartapi/custom/deleteUserCustomSql','lockFilePath','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','Would\x20delete\x20SQL\x20','toISOString','295nAFHSu','sqls','96ZCvKYn','trashedTo','startsWith','30821HfJscT','appCode','POST','1XkGRXT','23868dNeEoN','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'];a232_0x453e=function(){return _0x4d6e35;};return a232_0x453e();}async function moveToTrash(_0x53a9c3,_0x4008d9,_0xf09484){const _0x284df8=a232_0x5294ac,_0x275ef8=new Date()['toISOString']()[_0x284df8(0xe1)](/[:.]/g,'-'),_0x139899=relative(_0x53a9c3,_0xf09484),_0x3ef168=join(_0x4008d9,_0x275ef8,_0x139899);return await mkdir(dirname(_0x3ef168),{'recursive':!![]}),await rename(_0xf09484,_0x3ef168),_0x3ef168;}async function cleanupEmptyDirectories(_0x2c8a70,_0xb82aa6){const _0x151e1d=a232_0x5294ac;let _0x16950a=resolve(_0x2c8a70);const _0x5e72a3=resolve(_0xb82aa6);while(_0x16950a[_0x151e1d(0xcd)](''+_0x5e72a3+sep)||_0x16950a===_0x5e72a3){if(_0x16950a===_0x5e72a3)return;try{const _0x2c78f3=await readdir(_0x16950a);if(_0x2c78f3['length']>0x0)return;await rmdir(_0x16950a);}catch{return;}_0x16950a=dirname(_0x16950a);}}
@@ -1 +1 @@
1
- function a208_0x51a4(){const _0x4e47cc=['str','76559BoEjdD','12VSVuAl','399530lUZWwi','193372vSJPzq','99pLnXdl','66kBbChL','dbId','707640upGvUI','27YTXbIp','826768CCkkUT','318424KsnbaX','appCode','bool','2334050QazWjw','Return\x20full\x20raw\x20SQL\x20query\x20object','description','verbose','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode'];a208_0x51a4=function(){return _0x4e47cc;};return a208_0x51a4();}const a208_0x359cf0=a208_0x6e40;(function(_0x38bb7d,_0x35be9b){const _0x7a28bd=a208_0x6e40,_0x1cb8a3=_0x38bb7d();while(!![]){try{const _0x5257b8=parseInt(_0x7a28bd(0x10d))/0x1+parseInt(_0x7a28bd(0x119))/0x2*(parseInt(_0x7a28bd(0x117))/0x3)+parseInt(_0x7a28bd(0x10a))/0x4+-parseInt(_0x7a28bd(0x110))/0x5+-parseInt(_0x7a28bd(0x108))/0x6*(parseInt(_0x7a28bd(0x116))/0x7)+-parseInt(_0x7a28bd(0x10c))/0x8*(-parseInt(_0x7a28bd(0x10b))/0x9)+-parseInt(_0x7a28bd(0x118))/0xa*(parseInt(_0x7a28bd(0x11a))/0xb);if(_0x5257b8===_0x35be9b)break;else _0x1cb8a3['push'](_0x1cb8a3['shift']());}catch(_0x3b7ea6){_0x1cb8a3['push'](_0x1cb8a3['shift']());}}}(a208_0x51a4,0x3beae));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a208_0x6e40(_0x2ccb6e,_0x1d34d5){_0x2ccb6e=_0x2ccb6e-0x108;const _0x51a4d9=a208_0x51a4();let _0x6e407a=_0x51a4d9[_0x2ccb6e];return _0x6e407a;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':'detail','description':a208_0x359cf0(0x114),'risk':'read','flags':[SQLCODE_FLAG,{'name':a208_0x359cf0(0x113),'type':'boolean','description':a208_0x359cf0(0x111)}],async 'execute'(_0x2eafcb){const _0x51c9c7=a208_0x359cf0,_0x399f82=await getSqlQueryInfo(_0x2eafcb[_0x51c9c7(0x10e)],_0x2eafcb[_0x51c9c7(0x115)]('sqlcode')),_0x3864bc=_0x2eafcb[_0x51c9c7(0x10f)]('verbose');if(_0x3864bc)return{'ok':!![],'data':_0x399f82};const _0x59667a=_0x399f82[_0x51c9c7(0x109)]?await getDbName(_0x2eafcb['appCode'],_0x399f82[_0x51c9c7(0x109)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x399f82['sqlCode'],'sqlName':_0x399f82['sqlName'],'db':_0x59667a?_0x59667a+'\x20('+_0x399f82[_0x51c9c7(0x109)]+')':_0x399f82[_0x51c9c7(0x109)]??'','description':_0x399f82[_0x51c9c7(0x112)]??'','sqlContent':_0x399f82['sqlContent']??''}};}};
1
+ function a233_0x33ee(_0x2fa7a7,_0x9f1c6a){_0x2fa7a7=_0x2fa7a7-0x1c0;const _0xcbf016=a233_0xcbf0();let _0x33ee1f=_0xcbf016[_0x2fa7a7];return _0x33ee1f;}const a233_0x305f4d=a233_0x33ee;(function(_0x5e4cec,_0x27501e){const _0x48b954=a233_0x33ee,_0x3d8463=_0x5e4cec();while(!![]){try{const _0x4b4697=-parseInt(_0x48b954(0x1d7))/0x1*(parseInt(_0x48b954(0x1c5))/0x2)+-parseInt(_0x48b954(0x1d5))/0x3+parseInt(_0x48b954(0x1c6))/0x4+-parseInt(_0x48b954(0x1c8))/0x5*(parseInt(_0x48b954(0x1c9))/0x6)+parseInt(_0x48b954(0x1d8))/0x7*(-parseInt(_0x48b954(0x1d3))/0x8)+-parseInt(_0x48b954(0x1c3))/0x9*(-parseInt(_0x48b954(0x1d0))/0xa)+parseInt(_0x48b954(0x1cc))/0xb*(parseInt(_0x48b954(0x1ca))/0xc);if(_0x4b4697===_0x27501e)break;else _0x3d8463['push'](_0x3d8463['shift']());}catch(_0x49e8f2){_0x3d8463['push'](_0x3d8463['shift']());}}}(a233_0xcbf0,0xc53fd));function a233_0xcbf0(){const _0x4446d0=['appCode','145023EFzreX','154khAzzk','detail','boolean','read','198ZcJUvl','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','6MGiMwh','6140092pXxEVk','bool','505cFcLXl','40026KklFfy','18144SRMSYd','sqlContent','14817BbRCvl','sql','sqlName','dbId','484790BoaeRL','verbose','str','584032cfUZeu','sqlcode','3346092iPPLIb'];a233_0xcbf0=function(){return _0x4446d0;};return a233_0xcbf0();}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':a233_0x305f4d(0x1cd),'command':a233_0x305f4d(0x1c0),'description':a233_0x305f4d(0x1c4),'risk':a233_0x305f4d(0x1c2),'flags':[SQLCODE_FLAG,{'name':a233_0x305f4d(0x1d1),'type':a233_0x305f4d(0x1c1),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x274e0f){const _0x13653c=a233_0x305f4d,_0x37a2e7=await getSqlQueryInfo(_0x274e0f[_0x13653c(0x1d6)],_0x274e0f[_0x13653c(0x1d2)](_0x13653c(0x1d4))),_0x453c9=_0x274e0f[_0x13653c(0x1c7)]('verbose');if(_0x453c9)return{'ok':!![],'data':_0x37a2e7};const _0x1fb6f5=_0x37a2e7[_0x13653c(0x1cf)]?await getDbName(_0x274e0f[_0x13653c(0x1d6)],_0x37a2e7[_0x13653c(0x1cf)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x37a2e7['sqlCode'],'sqlName':_0x37a2e7[_0x13653c(0x1ce)],'db':_0x1fb6f5?_0x1fb6f5+'\x20('+_0x37a2e7[_0x13653c(0x1cf)]+')':_0x37a2e7[_0x13653c(0x1cf)]??'','description':_0x37a2e7['description']??'','sqlContent':_0x37a2e7[_0x13653c(0x1cb)]??''}};}};
@@ -1 +1 @@
1
- const a209_0x50cf5e=a209_0x4979;function a209_0x1ab4(){const _0x5c5096=['appCode','now','2768700EGUOAQ','read','SQL\x20execution\x20failed','sqlcode','\x20row(s)\x20in\x20','176StkHbz','7dlHAVF','exec','params','262952DYMLSv','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','287631fzjzbd','execSuccess','Returned\x20','string','execError','str','682DDpvIx','execResult','66320RovpKb','234160rlkzYl','450753uoODyv','335eWujpZ','8910496sJlnyy','isArray','length','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'];a209_0x1ab4=function(){return _0x5c5096;};return a209_0x1ab4();}(function(_0x3459f9,_0x25d4c6){const _0x1182e7=a209_0x4979,_0x4e7513=_0x3459f9();while(!![]){try{const _0x3b2956=-parseInt(_0x1182e7(0xa6))/0x1*(-parseInt(_0x1182e7(0xa9))/0x2)+-parseInt(_0x1182e7(0xb5))/0x3+parseInt(_0x1182e7(0xb3))/0x4*(-parseInt(_0x1182e7(0xb6))/0x5)+parseInt(_0x1182e7(0xbd))/0x6+parseInt(_0x1182e7(0xb7))/0x7+parseInt(_0x1182e7(0xa5))/0x8*(parseInt(_0x1182e7(0xab))/0x9)+parseInt(_0x1182e7(0xb4))/0xa*(-parseInt(_0x1182e7(0xb1))/0xb);if(_0x3b2956===_0x25d4c6)break;else _0x4e7513['push'](_0x4e7513['shift']());}catch(_0x354c1f){_0x4e7513['push'](_0x4e7513['shift']());}}}(a209_0x1ab4,0x9d729));function a209_0x4979(_0x35a267,_0x4a1ab2){_0x35a267=_0x35a267-0xa1;const _0x1ab4b0=a209_0x1ab4();let _0x49791c=_0x1ab4b0[_0x35a267];return _0x49791c;}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':'sql','command':a209_0x50cf5e(0xa7),'description':a209_0x50cf5e(0xaa),'risk':a209_0x50cf5e(0xa1),'flags':[SQLCODE_FLAG,{'name':a209_0x50cf5e(0xa8),'type':a209_0x50cf5e(0xae),'description':a209_0x50cf5e(0xba)}],async 'execute'(_0x36e3a2){const _0x58b62b=a209_0x50cf5e,_0x47557b=parseJsonParams(_0x36e3a2['str'](_0x58b62b(0xa8))),_0x59e9fa=Date[_0x58b62b(0xbc)](),_0x1354b4=await executeSql(_0x36e3a2[_0x58b62b(0xbb)],_0x36e3a2[_0x58b62b(0xb0)](_0x58b62b(0xa3)),_0x47557b),_0x9755a2=Date[_0x58b62b(0xbc)]()-_0x59e9fa,_0x560e9f=_0x1354b4?.[_0x58b62b(0xb2)]??_0x1354b4,_0x1bcd80=_0x1354b4?.[_0x58b62b(0xac)]??!![];if(!_0x1bcd80)return{'ok':![],'data':{'error':_0x1354b4?.[_0x58b62b(0xaf)]||_0x58b62b(0xa2),'elapsed':_0x9755a2},'message':_0x58b62b(0xa2)};const _0x17442f=Array[_0x58b62b(0xb8)](_0x560e9f)?_0x560e9f:[];return{'ok':!![],'data':{'rows':_0x17442f,'rowCount':_0x17442f[_0x58b62b(0xb9)],'elapsed':_0x9755a2},'message':_0x58b62b(0xad)+_0x17442f[_0x58b62b(0xb9)]+_0x58b62b(0xa4)+_0x9755a2+'ms'};}};
1
+ const a234_0x4a6367=a234_0x40da;(function(_0x1951af,_0x5e95d5){const _0x237391=a234_0x40da,_0x1322a9=_0x1951af();while(!![]){try{const _0x2912ef=parseInt(_0x237391(0x14f))/0x1*(parseInt(_0x237391(0x15a))/0x2)+parseInt(_0x237391(0x146))/0x3*(parseInt(_0x237391(0x14c))/0x4)+parseInt(_0x237391(0x151))/0x5*(parseInt(_0x237391(0x15b))/0x6)+-parseInt(_0x237391(0x144))/0x7+parseInt(_0x237391(0x15d))/0x8*(-parseInt(_0x237391(0x159))/0x9)+parseInt(_0x237391(0x148))/0xa+parseInt(_0x237391(0x152))/0xb*(-parseInt(_0x237391(0x149))/0xc);if(_0x2912ef===_0x5e95d5)break;else _0x1322a9['push'](_0x1322a9['shift']());}catch(_0x236061){_0x1322a9['push'](_0x1322a9['shift']());}}}(a234_0x3d9d,0x64500));import{executeSql}from'../../core/api-client.js';function a234_0x3d9d(){const _0x15ef60=['3614513qoHbXx','Returned\x20','24eaPqGG','sqlcode','7723330qivAaU','36VYnqKg','length','string','143516zWWoDm','execError','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','7508kyaMPd','SQL\x20execution\x20failed','5jijcRR','561473zZGLQU','execResult','exec','sql','isArray','now','\x20row(s)\x20in\x20','85194ZHYVso','34krbQrA','893694GxaebT','read','216FIEBQW','appCode','str','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'];a234_0x3d9d=function(){return _0x15ef60;};return a234_0x3d9d();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a234_0x40da(_0x7e2e94,_0x329632){_0x7e2e94=_0x7e2e94-0x143;const _0x3d9dee=a234_0x3d9d();let _0x40dad0=_0x3d9dee[_0x7e2e94];return _0x40dad0;}export const sqlExec={'service':a234_0x4a6367(0x155),'command':a234_0x4a6367(0x154),'description':a234_0x4a6367(0x14e),'risk':a234_0x4a6367(0x15c),'flags':[SQLCODE_FLAG,{'name':'params','type':a234_0x4a6367(0x14b),'description':a234_0x4a6367(0x143)}],async 'execute'(_0x584768){const _0x1dea58=a234_0x4a6367,_0x1619ac=parseJsonParams(_0x584768['str']('params')),_0x1c2481=Date['now'](),_0x2eb364=await executeSql(_0x584768[_0x1dea58(0x15e)],_0x584768[_0x1dea58(0x15f)](_0x1dea58(0x147)),_0x1619ac),_0x12220b=Date[_0x1dea58(0x157)]()-_0x1c2481,_0x2864f3=_0x2eb364?.[_0x1dea58(0x153)]??_0x2eb364,_0x560b25=_0x2eb364?.['execSuccess']??!![];if(!_0x560b25)return{'ok':![],'data':{'error':_0x2eb364?.[_0x1dea58(0x14d)]||_0x1dea58(0x150),'elapsed':_0x12220b},'message':'SQL\x20execution\x20failed'};const _0x570410=Array[_0x1dea58(0x156)](_0x2864f3)?_0x2864f3:[];return{'ok':!![],'data':{'rows':_0x570410,'rowCount':_0x570410[_0x1dea58(0x14a)],'elapsed':_0x12220b},'message':_0x1dea58(0x145)+_0x570410[_0x1dea58(0x14a)]+_0x1dea58(0x158)+_0x12220b+'ms'};}};
@@ -1 +1 @@
1
- (function(_0xce280c,_0x43101c){const _0x1f2839=a210_0x90cb,_0x2f1f5a=_0xce280c();while(!![]){try{const _0x5a96d8=parseInt(_0x1f2839(0x170))/0x1*(-parseInt(_0x1f2839(0x174))/0x2)+-parseInt(_0x1f2839(0x16f))/0x3+-parseInt(_0x1f2839(0x16d))/0x4+parseInt(_0x1f2839(0x172))/0x5*(-parseInt(_0x1f2839(0x173))/0x6)+parseInt(_0x1f2839(0x16e))/0x7*(parseInt(_0x1f2839(0x16c))/0x8)+parseInt(_0x1f2839(0x175))/0x9*(-parseInt(_0x1f2839(0x171))/0xa)+parseInt(_0x1f2839(0x176))/0xb;if(_0x5a96d8===_0x43101c)break;else _0x2f1f5a['push'](_0x2f1f5a['shift']());}catch(_0x125c1e){_0x2f1f5a['push'](_0x2f1f5a['shift']());}}}(a210_0x1d8b,0x501cd));import{sqlList}from'../../commands/sql/list.js';function a210_0x1d8b(){const _0xa58486=['30947TTlUvJ','1731168FZkcXD','103YimDRd','50yyoCRl','504805kGYrEv','30HYfSKz','2522oiNQwq','202437UWlPDA','18050109iENAXd','336RHltMs','697004ySCbbP'];a210_0x1d8b=function(){return _0xa58486;};return a210_0x1d8b();}function a210_0x90cb(_0x5612c3,_0x4c71ec){_0x5612c3=_0x5612c3-0x16c;const _0x1d8b6b=a210_0x1d8b();let _0x90cbd8=_0x1d8b6b[_0x5612c3];return _0x90cbd8;}import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0xa88827,_0x10e5a6){const _0x5be6ba=a235_0x13de,_0x1643c0=_0xa88827();while(!![]){try{const _0x4de9ab=-parseInt(_0x5be6ba(0x1df))/0x1*(-parseInt(_0x5be6ba(0x1dc))/0x2)+-parseInt(_0x5be6ba(0x1de))/0x3*(-parseInt(_0x5be6ba(0x1da))/0x4)+parseInt(_0x5be6ba(0x1dd))/0x5+-parseInt(_0x5be6ba(0x1d7))/0x6+parseInt(_0x5be6ba(0x1d8))/0x7*(-parseInt(_0x5be6ba(0x1d9))/0x8)+parseInt(_0x5be6ba(0x1d6))/0x9+-parseInt(_0x5be6ba(0x1db))/0xa*(parseInt(_0x5be6ba(0x1e0))/0xb);if(_0x4de9ab===_0x10e5a6)break;else _0x1643c0['push'](_0x1643c0['shift']());}catch(_0xa4d7ea){_0x1643c0['push'](_0x1643c0['shift']());}}}(a235_0x55f4,0xb1df1));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';function a235_0x13de(_0x4fc562,_0xa903e6){_0x4fc562=_0x4fc562-0x1d6;const _0x55f40e=a235_0x55f4();let _0x13de84=_0x55f40e[_0x4fc562];return _0x13de84;}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 a235_0x55f4(){const _0x19a016=['778852SuXUTa','10gzsAsa','431254AaKwRU','4631630omVdod','15GLhJdG','1rWcHjm','4334429lGrUQJ','3888441jqaKzr','8444478fxkpkG','122878akOxsW','8LpqXPo'];a235_0x55f4=function(){return _0x19a016;};return a235_0x55f4();}import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- function a211_0x57e3(_0x4c07c9,_0x707d29){_0x4c07c9=_0x4c07c9-0x1c0;const _0x2b7cf0=a211_0x2b7c();let _0x57e31a=_0x2b7cf0[_0x4c07c9];return _0x57e31a;}function a211_0x2b7c(){const _0x553959=['3sYvmFR','bool','dbId','68190QacANr','paging','3197200ytCYEw','pagesize','3147725mqaQlp','appCode','read','3478744ETqPxR','882587xpJsvr','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','979gfNBTK','tableData','name','number','str','page','boolean','List\x20custom\x20SQL\x20queries','totalCount','\x20SQL\x20queries\x20(total:\x20','sql','sqlcode','string','907118wSRFok','Page\x20number','Filter\x20by\x20SQL\x20name','107210LSYGNh','sqlCode','map','sqlName','469oIcIIW','Page\x20size','18mGaOLb','length','description'];a211_0x2b7c=function(){return _0x553959;};return a211_0x2b7c();}const a211_0x4557f2=a211_0x57e3;(function(_0x2e4cf0,_0x13284b){const _0x513cb2=a211_0x57e3,_0x91d9a5=_0x2e4cf0();while(!![]){try{const _0x1cfe97=-parseInt(_0x513cb2(0x1e5))/0x1+-parseInt(_0x513cb2(0x1ce))/0x2*(-parseInt(_0x513cb2(0x1da))/0x3)+parseInt(_0x513cb2(0x1e4))/0x4+parseInt(_0x513cb2(0x1e1))/0x5+parseInt(_0x513cb2(0x1dd))/0x6*(-parseInt(_0x513cb2(0x1d5))/0x7)+parseInt(_0x513cb2(0x1df))/0x8*(-parseInt(_0x513cb2(0x1d7))/0x9)+parseInt(_0x513cb2(0x1d1))/0xa*(parseInt(_0x513cb2(0x1c1))/0xb);if(_0x1cfe97===_0x13284b)break;else _0x91d9a5['push'](_0x91d9a5['shift']());}catch(_0x5389cf){_0x91d9a5['push'](_0x91d9a5['shift']());}}}(a211_0x2b7c,0x71301));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a211_0x4557f2(0x1cb),'command':'list','description':a211_0x4557f2(0x1c8),'risk':a211_0x4557f2(0x1e3),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a211_0x4557f2(0x1c3),'type':a211_0x4557f2(0x1cd),'description':a211_0x4557f2(0x1d0)},{'name':'page','type':a211_0x4557f2(0x1c4),'description':a211_0x4557f2(0x1cf),'default':0x1},{'name':a211_0x4557f2(0x1e0),'type':a211_0x4557f2(0x1c4),'description':a211_0x4557f2(0x1d6)},{'name':'verbose','type':a211_0x4557f2(0x1c7),'description':a211_0x4557f2(0x1c0)}],async 'execute'(_0x135019){const _0x4fa5be=a211_0x4557f2,_0x425bcc=await listSqlQueries(_0x135019[_0x4fa5be(0x1e2)],{'sqlCode':_0x135019[_0x4fa5be(0x1c5)](_0x4fa5be(0x1cc))||undefined,'sqlName':_0x135019[_0x4fa5be(0x1c5)](_0x4fa5be(0x1c3))||undefined,'currentPage':_0x135019['num'](_0x4fa5be(0x1c6)),'pageSize':_0x135019['num'](_0x4fa5be(0x1e0),0x32)}),_0x45cf0a=_0x135019[_0x4fa5be(0x1db)]('verbose'),_0x38dc5c=_0x425bcc[_0x4fa5be(0x1c2)]??[],_0x5d884a=_0x425bcc[_0x4fa5be(0x1de)]?.[_0x4fa5be(0x1c9)]??_0x38dc5c[_0x4fa5be(0x1d8)];let _0x41b68d;return _0x45cf0a?_0x41b68d=_0x38dc5c:_0x41b68d=await Promise['all'](_0x38dc5c[_0x4fa5be(0x1d3)](async _0x3aa3c4=>{const _0x3b11e0=_0x4fa5be;let _0xb1e639;try{_0xb1e639=_0x3aa3c4['dbId']?await getDbName(_0x135019['appCode'],_0x3aa3c4[_0x3b11e0(0x1dc)]):undefined;}catch{}return{'sqlCode':_0x3aa3c4[_0x3b11e0(0x1d2)],'sqlName':_0x3aa3c4[_0x3b11e0(0x1d4)],'description':_0x3aa3c4[_0x3b11e0(0x1d9)]??'','db':_0xb1e639?_0xb1e639+'\x20('+_0x3aa3c4[_0x3b11e0(0x1dc)]+')':_0x3aa3c4[_0x3b11e0(0x1dc)]??''};})),{'ok':!![],'data':_0x41b68d,'message':_0x38dc5c[_0x4fa5be(0x1d8)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':'Found\x20'+_0x38dc5c['length']+_0x4fa5be(0x1ca)+_0x5d884a+').'};}};
1
+ const a236_0x699c04=a236_0x9815;(function(_0x168635,_0x169a42){const _0xb2a285=a236_0x9815,_0x247eb1=_0x168635();while(!![]){try{const _0x5a546d=parseInt(_0xb2a285(0x8b))/0x1+parseInt(_0xb2a285(0x7e))/0x2*(parseInt(_0xb2a285(0x88))/0x3)+parseInt(_0xb2a285(0x77))/0x4+parseInt(_0xb2a285(0x7d))/0x5*(parseInt(_0xb2a285(0x8d))/0x6)+parseInt(_0xb2a285(0x78))/0x7+parseInt(_0xb2a285(0x91))/0x8*(parseInt(_0xb2a285(0x8c))/0x9)+-parseInt(_0xb2a285(0x8f))/0xa;if(_0x5a546d===_0x169a42)break;else _0x247eb1['push'](_0x247eb1['shift']());}catch(_0x3aec1b){_0x247eb1['push'](_0x247eb1['shift']());}}}(a236_0x3ab3,0xcae27));function a236_0x9815(_0x468881,_0x14028f){_0x468881=_0x468881-0x71;const _0x3ab37c=a236_0x3ab3();let _0x981530=_0x3ab37c[_0x468881];return _0x981530;}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a236_0x3ab3(){const _0x166ade=['3gVekqy','boolean','\x20SQL\x20queries\x20(total:\x20','212943OOcSMX','423zJsIGx','341196xSHiNu','appCode','34872210kltbHK','No\x20custom\x20SQL\x20queries\x20found.','69784RzeSNx','Filter\x20by\x20SQL\x20name','pagesize','sqlCode','verbose','length','name','num','sqlName','list','sql','2978932ShKPOe','7501438XYdCea','read','all','str','string','35fctpRg','2961766PHZBfX','paging','page','description','map','dbId','Found\x20','number','List\x20custom\x20SQL\x20queries','tableData'];a236_0x3ab3=function(){return _0x166ade;};return a236_0x3ab3();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a236_0x699c04(0x76),'command':a236_0x699c04(0x75),'description':a236_0x699c04(0x86),'risk':a236_0x699c04(0x79),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a236_0x699c04(0x72),'type':a236_0x699c04(0x7c),'description':a236_0x699c04(0x92)},{'name':a236_0x699c04(0x80),'type':a236_0x699c04(0x85),'description':'Page\x20number','default':0x1},{'name':a236_0x699c04(0x93),'type':a236_0x699c04(0x85),'description':'Page\x20size'},{'name':a236_0x699c04(0x95),'type':a236_0x699c04(0x89),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x4c9917){const _0x76e1=a236_0x699c04,_0x353a06=await listSqlQueries(_0x4c9917[_0x76e1(0x8e)],{'sqlCode':_0x4c9917[_0x76e1(0x7b)]('sqlcode')||undefined,'sqlName':_0x4c9917[_0x76e1(0x7b)](_0x76e1(0x72))||undefined,'currentPage':_0x4c9917['num']('page'),'pageSize':_0x4c9917[_0x76e1(0x73)](_0x76e1(0x93),0x32)}),_0x5a4313=_0x4c9917['bool'](_0x76e1(0x95)),_0x1a00fe=_0x353a06[_0x76e1(0x87)]??[],_0x463c3b=_0x353a06[_0x76e1(0x7f)]?.['totalCount']??_0x1a00fe[_0x76e1(0x71)];let _0x14eeae;return _0x5a4313?_0x14eeae=_0x1a00fe:_0x14eeae=await Promise[_0x76e1(0x7a)](_0x1a00fe[_0x76e1(0x82)](async _0xc10636=>{const _0x519829=_0x76e1;let _0x2877dc;try{_0x2877dc=_0xc10636['dbId']?await getDbName(_0x4c9917[_0x519829(0x8e)],_0xc10636[_0x519829(0x83)]):undefined;}catch{}return{'sqlCode':_0xc10636[_0x519829(0x94)],'sqlName':_0xc10636[_0x519829(0x74)],'description':_0xc10636[_0x519829(0x81)]??'','db':_0x2877dc?_0x2877dc+'\x20('+_0xc10636[_0x519829(0x83)]+')':_0xc10636[_0x519829(0x83)]??''};})),{'ok':!![],'data':_0x14eeae,'message':_0x1a00fe[_0x76e1(0x71)]===0x0?_0x76e1(0x90):_0x76e1(0x84)+_0x1a00fe[_0x76e1(0x71)]+_0x76e1(0x8a)+_0x463c3b+').'};}};
@@ -1 +1 @@
1
- const a212_0x4ecddd=a212_0x44ae;(function(_0x20b2a5,_0x592fe6){const _0x55ac03=a212_0x44ae,_0x140f97=_0x20b2a5();while(!![]){try{const _0x5befc5=-parseInt(_0x55ac03(0x1c5))/0x1+parseInt(_0x55ac03(0x1a8))/0x2*(-parseInt(_0x55ac03(0x197))/0x3)+parseInt(_0x55ac03(0x1b7))/0x4*(parseInt(_0x55ac03(0x1af))/0x5)+parseInt(_0x55ac03(0x1be))/0x6*(parseInt(_0x55ac03(0x1a5))/0x7)+parseInt(_0x55ac03(0x199))/0x8+parseInt(_0x55ac03(0x1a6))/0x9+-parseInt(_0x55ac03(0x1c6))/0xa*(-parseInt(_0x55ac03(0x1b0))/0xb);if(_0x5befc5===_0x592fe6)break;else _0x140f97['push'](_0x140f97['shift']());}catch(_0x5940ab){_0x140f97['push'](_0x140f97['shift']());}}}(a212_0x56e2,0x89d1b));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';function a212_0x56e2(){const _0x1e9ff8=['string','name','bool','11435stkqRX','13376OARLYn','test','str','Pull\x20complete:\x20','Filter\x20by\x20SQL\x20display\x20name','push','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','580utOaHJ','filter','sqlcode','boolean','\x20skipped,\x20','toISOString','pull','1479522DvNDJt','paging','trimStart','mybatisXml','sqlCode','Would\x20pull\x20','catch','812852lGufFW','880BSitqz','replace','length','totalCount','lockFilePath','sql','sqls','POST','local\x20differs\x20from\x20remote','tableData','appCode','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','force','join','\x20failed','3bdjOyx','sqlName','2582304JognXd','lastSync','skipped','utf8','dbId','path','nonInteractive','unchanged','sqlRoot','\x20SQL\x20file(s)\x20into\x20','would_pull','description','7VDFLau','3750003vaESTE','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','94612HfjtyH','cancelled','sqlContent','sqlRootDir'];a212_0x56e2=function(){return _0x1e9ff8;};return a212_0x56e2();}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x190acd,_0x20fbbc){const _0x54249d=a212_0x44ae,_0x509cbd=[];let _0x3bf5dd=0x1;while(!![]){const _0x3488c6=await listSqlQueries(_0x190acd,{'currentPage':_0x3bf5dd,'pageSize':PAGE_SIZE,'sqlCode':_0x20fbbc[_0x54249d(0x1c2)],'sqlName':_0x20fbbc[_0x54249d(0x198)]}),_0x561d2c=_0x3488c6[_0x54249d(0x1cf)]??[];_0x509cbd[_0x54249d(0x1b5)](..._0x561d2c);if(_0x561d2c[_0x54249d(0x1c8)]===0x0)break;const _0x97d588=_0x3488c6[_0x54249d(0x1bf)]?.[_0x54249d(0x1c9)];if(_0x97d588!=null?_0x509cbd[_0x54249d(0x1c8)]>=_0x97d588:_0x561d2c[_0x54249d(0x1c8)]<PAGE_SIZE)break;_0x3bf5dd++;}return _0x509cbd;}async function ensureSqlContent(_0x187ee3){const _0x32ac69=a212_0x44ae;if(_0x187ee3[_0x32ac69(0x1aa)]!=null&&String(_0x187ee3['sqlContent'])['length']>0x0)return _0x187ee3;return getSqlQueryDetail(_0x187ee3[_0x32ac69(0x1c2)]);}export const sqlPull={'service':a212_0x4ecddd(0x1cb),'command':a212_0x4ecddd(0x1bd),'description':a212_0x4ecddd(0x1a7),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a212_0x4ecddd(0x1ac),'description':a212_0x4ecddd(0x1b4)},{'name':'force','type':a212_0x4ecddd(0x1ba),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x311e00){const _0x136296=a212_0x4ecddd,_0x59cd3a=loadSqlProjectConfig(_0x311e00[_0x136296(0x1d0)]),_0x3fb7bd=await readSqlLockFile(_0x59cd3a[_0x136296(0x1ca)]),{appLock:_0xe02317}=ensureSqlLockScope(_0x3fb7bd??createEmptySqlLock(),_0x59cd3a[_0x136296(0x1d0)],_0x59cd3a[_0x136296(0x1a1)],_0x136296(0x1bd)),_0xcee0ee=await fetchAllSqlQueries(_0x311e00[_0x136296(0x1d0)],{'sqlCode':_0x311e00[_0x136296(0x1b2)](_0x136296(0x1b9))||undefined,'sqlName':_0x311e00['str'](_0x136296(0x1ad))||undefined}),_0x4fa8ca=[];for(const _0x4c0df5 of _0xcee0ee){const _0x4bb91d=await ensureSqlContent(_0x4c0df5),_0x3409ce=ensureRemoteSqlContent(_0x4bb91d),_0x445686=detectModeFromSql(_0x4bb91d),_0x3d82ae=_0x4bb91d[_0x136296(0x19d)]?await getDbName(_0x311e00[_0x136296(0x1d0)],Number(_0x4bb91d[_0x136296(0x19d)]))[_0x136296(0x1c4)](()=>undefined):undefined,_0x50ee20=buildLocalSqlFileContent({'sqlCode':_0x4bb91d[_0x136296(0x1c2)],'sqlName':_0x4bb91d[_0x136296(0x198)],'dbId':_0x4bb91d['dbId']},_0x3409ce,{'dbName':_0x3d82ae,'mode':_0x445686,'syncedAt':new Date()[_0x136296(0x1bc)](),'description':_0x4bb91d[_0x136296(0x1a4)]}),_0x472490=buildSqlLockEntry(_0x4bb91d,_0x3409ce,'',{'dbName':_0x3d82ae}),_0x2e7687=resolveLocalSqlFilePath(_0x59cd3a,_0x4bb91d[_0x136296(0x1c2)],_0x472490);let _0x38a430=_0x136296(0x1a3),_0x3e0b62;if(await fileExists(_0x2e7687)){const _0x44555c=await readFile(_0x2e7687,_0x136296(0x19c));isEquivalentPulledSqlFile(_0x44555c,_0x50ee20,_0x445686)?(_0x38a430=_0x136296(0x19b),_0x3e0b62=_0x136296(0x1a0)):(_0x38a430='conflict',_0x3e0b62=_0x136296(0x1d1));}_0x4fa8ca[_0x136296(0x1b5)]({'sqlCode':_0x4bb91d[_0x136296(0x1c2)],'sqlName':_0x4bb91d['sqlName'],'filePath':_0x2e7687,'status':_0x38a430,'reason':_0x3e0b62});}return{'method':_0x136296(0x1cd),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x311e00[_0x136296(0x1d0)],'sqlCode':_0x311e00[_0x136296(0x1b2)](_0x136296(0x1b9))||null,'sqlName':_0x311e00[_0x136296(0x1b2)](_0x136296(0x1ad))||null,'files':_0x4fa8ca},'description':_0x136296(0x1c3)+_0x4fa8ca[_0x136296(0x1c8)]+_0x136296(0x1a2)+_0x59cd3a[_0x136296(0x1ab)]};},async 'execute'(_0x5a1998){const _0x1d7975=a212_0x4ecddd,_0x3a4f6c=loadSqlProjectConfig(_0x5a1998[_0x1d7975(0x1d0)]),_0x35a612=await readSqlLockFile(_0x3a4f6c[_0x1d7975(0x1ca)]),{lockData:_0x28e050,appLock:_0x53a53e}=ensureSqlLockScope(_0x35a612??createEmptySqlLock(),_0x3a4f6c['appCode'],_0x3a4f6c[_0x1d7975(0x1a1)],'pull'),_0x1a088c=_0x5a1998[_0x1d7975(0x1ae)](_0x1d7975(0x1d2)),_0x37f021=await fetchAllSqlQueries(_0x5a1998[_0x1d7975(0x1d0)],{'sqlCode':_0x5a1998[_0x1d7975(0x1b2)](_0x1d7975(0x1b9))||undefined,'sqlName':_0x5a1998[_0x1d7975(0x1b2)](_0x1d7975(0x1ad))||undefined});if(_0x37f021[_0x1d7975(0x1c8)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x54f0e1=[],_0x4c692f=[];for(const _0x2ecf6a of _0x37f021){try{_0x54f0e1[_0x1d7975(0x1b5)](await ensureSqlContent(_0x2ecf6a));}catch(_0x1c8246){_0x4c692f[_0x1d7975(0x1b5)]({'sqlCode':_0x2ecf6a[_0x1d7975(0x1c2)],'error':_0x1c8246 instanceof Error?_0x1c8246['message']:String(_0x1c8246)});}}if(_0x1a088c&&!_0x5a1998[_0x1d7975(0x19f)]){let _0x21bb85=![];for(const _0x4b2bad of _0x54f0e1){const _0xa06b17=detectModeFromSql(_0x4b2bad),_0x3a64bd=_0x4b2bad[_0x1d7975(0x19d)]?await getDbName(_0x5a1998['appCode'],Number(_0x4b2bad[_0x1d7975(0x19d)]))[_0x1d7975(0x1c4)](()=>undefined):undefined,_0x39d49a=buildLocalSqlFileContent({'sqlCode':_0x4b2bad['sqlCode'],'sqlName':_0x4b2bad[_0x1d7975(0x198)],'dbId':_0x4b2bad[_0x1d7975(0x19d)]},ensureRemoteSqlContent(_0x4b2bad),{'dbName':_0x3a64bd,'mode':_0xa06b17,'syncedAt':new Date()[_0x1d7975(0x1bc)](),'description':_0x4b2bad[_0x1d7975(0x1a4)]}),_0x45c87d=resolveLocalSqlFilePath(_0x3a4f6c,_0x4b2bad[_0x1d7975(0x1c2)],buildSqlLockEntry(_0x4b2bad,ensureRemoteSqlContent(_0x4b2bad),'',{'dbName':_0x3a64bd}));if(await fileExists(_0x45c87d)){const _0x1da928=await readFile(_0x45c87d,_0x1d7975(0x19c));if(!isEquivalentPulledSqlFile(_0x1da928,_0x39d49a,_0xa06b17)){_0x21bb85=!![];break;}}}if(_0x21bb85){const _0x172926=await confirmForceOverwrite(_0x1d7975(0x1b6));if(!_0x172926)throw CliErrors[_0x1d7975(0x1a9)]('Force\x20pull\x20cancelled.');}}const _0x3bcd87=cloneSqlLockData(_0x28e050),_0x96faaf=_0x3bcd87['apps'][_0x3a4f6c['appCode']],_0x1132dd=[],_0x4589a5=[];for(const _0xe25923 of _0x54f0e1){const _0xa173fe=_0x96faaf[_0x1d7975(0x1cc)][_0xe25923[_0x1d7975(0x1c2)]],_0x39612c=ensureRemoteSqlContent(_0xe25923),_0x5b03b3=detectModeFromSql(_0xe25923),_0x3d43a5=_0xe25923[_0x1d7975(0x19d)]?await getDbName(_0x5a1998[_0x1d7975(0x1d0)],Number(_0xe25923[_0x1d7975(0x19d)]))[_0x1d7975(0x1c4)](()=>undefined):undefined,_0x16c9e2=buildLocalSqlFileContent({'sqlCode':_0xe25923[_0x1d7975(0x1c2)],'sqlName':_0xe25923[_0x1d7975(0x198)],'dbId':_0xe25923[_0x1d7975(0x19d)]},_0x39612c,{'dbName':_0x3d43a5,'mode':_0x5b03b3,'syncedAt':new Date()[_0x1d7975(0x1bc)](),'description':_0xe25923['description']}),_0x3bd402=buildSqlLockEntry(_0xe25923,_0x39612c,computeSqlContentHash(_0x16c9e2),{'dbName':_0x3d43a5}),_0x18603a=_0x3bd402[_0x1d7975(0x19e)],_0x2d8e40=join(_0x3a4f6c[_0x1d7975(0x1ab)],_0x18603a);try{if(await fileExists(_0x2d8e40)){const _0x349cee=await readFile(_0x2d8e40,'utf8');if(isEquivalentPulledSqlFile(_0x349cee,_0x16c9e2,_0x5b03b3)){_0x4589a5[_0x1d7975(0x1b5)]({'sqlCode':_0xe25923['sqlCode'],'reason':_0x1d7975(0x1a0)}),_0x96faaf[_0x1d7975(0x1cc)][_0xe25923['sqlCode']]={..._0x3bd402,'hash':computeSqlContentHash(_0x349cee),'path':_0x18603a};continue;}if(!_0x1a088c){_0x4589a5[_0x1d7975(0x1b5)]({'sqlCode':_0xe25923['sqlCode'],'reason':_0x1d7975(0x1ce)});continue;}}const _0x118971=_0xa173fe?.[_0x1d7975(0x19e)]?join(_0x3a4f6c[_0x1d7975(0x1ab)],_0xa173fe[_0x1d7975(0x19e)]):undefined;_0x118971&&_0x118971!==_0x2d8e40&&await fileExists(_0x118971)&&await rm(_0x118971,{'force':!![]}),await ensureParentDirectory(_0x2d8e40),await writeFile(_0x2d8e40,_0x16c9e2,_0x1d7975(0x19c)),_0x96faaf['sqls'][_0xe25923[_0x1d7975(0x1c2)]]={..._0x3bd402,'path':_0x18603a},_0x1132dd[_0x1d7975(0x1b5)]({'sqlCode':_0xe25923[_0x1d7975(0x1c2)],'filePath':_0x2d8e40});}catch(_0x21d0e3){_0x4c692f[_0x1d7975(0x1b5)]({'sqlCode':_0xe25923[_0x1d7975(0x1c2)],'error':_0x21d0e3 instanceof Error?_0x21d0e3['message']:String(_0x21d0e3)});}}return _0x96faaf[_0x1d7975(0x19a)]=new Date()[_0x1d7975(0x1bc)](),await writeSqlLockFile(_0x3a4f6c['lockFilePath'],_0x3bcd87),{'ok':_0x4c692f['length']===0x0,'data':{'pulled':_0x1132dd,'skipped':_0x4589a5,'failed':_0x4c692f},'message':_0x1d7975(0x1b3)+_0x1132dd['length']+'\x20written,\x20'+_0x4589a5['length']+_0x1d7975(0x1bb)+_0x4c692f['length']+_0x1d7975(0x196)};}};function detectModeFromSql(_0x503a8b){const _0x280874=a212_0x4ecddd,_0x580395=ensureRemoteSqlContent(_0x503a8b),_0x4dbb32=stripLocalSqlMetadata(_0x580395,_0x280874(0x1c1))[_0x280874(0x1c0)]();if(/^<(select|insert|update|delete)\b/i[_0x280874(0x1b1)](_0x4dbb32))return _0x280874(0x1c1);return _0x280874(0x1cb);}function isEquivalentPulledSqlFile(_0x1d5f76,_0x5a3df8,_0x96a540){return normalizePullComparableContent(_0x1d5f76,_0x96a540)===normalizePullComparableContent(_0x5a3df8,_0x96a540);}function a212_0x44ae(_0x1192d0,_0xd4bfbe){_0x1192d0=_0x1192d0-0x195;const _0x56e22f=a212_0x56e2();let _0x44ae6e=_0x56e22f[_0x1192d0];return _0x44ae6e;}function normalizePullComparableContent(_0x266a75,_0x8a35d0){const _0x2b077b=a212_0x4ecddd,_0x5151b1=_0x266a75[_0x2b077b(0x1c7)](/\r\n/g,'\x0a')['split']('\x0a'),_0x417e0d=_0x5151b1[_0x2b077b(0x1b8)](_0x1c4fed=>!isSyncedAtMetadataLine(_0x1c4fed,_0x8a35d0));return _0x417e0d[_0x2b077b(0x195)]('\x0a');}function isSyncedAtMetadataLine(_0xb27144,_0x24b4e0){const _0x5ed7c8=a212_0x4ecddd;if(_0x24b4e0===_0x5ed7c8(0x1c1))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x5ed7c8(0x1b1)](_0xb27144);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0xb27144);}
1
+ const a237_0x2fb91e=a237_0x325d;(function(_0x2e8481,_0x4ec5e8){const _0x39183d=a237_0x325d,_0x3c6342=_0x2e8481();while(!![]){try{const _0x38c0f0=parseInt(_0x39183d(0x167))/0x1+parseInt(_0x39183d(0x17c))/0x2+parseInt(_0x39183d(0x14b))/0x3+-parseInt(_0x39183d(0x178))/0x4+parseInt(_0x39183d(0x145))/0x5*(-parseInt(_0x39183d(0x176))/0x6)+-parseInt(_0x39183d(0x149))/0x7*(parseInt(_0x39183d(0x16e))/0x8)+parseInt(_0x39183d(0x166))/0x9;if(_0x38c0f0===_0x4ec5e8)break;else _0x3c6342['push'](_0x3c6342['shift']());}catch(_0x3c26b0){_0x3c6342['push'](_0x3c6342['shift']());}}}(a237_0x4e8f,0x62785));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;function a237_0x4e8f(){const _0x3c3d2d=['string','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','bool','str','cancelled','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','description','No\x20remote\x20SQL\x20queries\x20matched.','pull','unchanged','Filter\x20by\x20SQL\x20display\x20name','sqlName','catch','would_pull','Force\x20overwrite\x20local\x20unsynced\x20changes','utf8','mybatisXml','join','sqlRootDir','toISOString','filter','3474846HkjNsv','747868wjbrNv','POST','force','\x20failed','name','appCode','tableData','8JaNsGx','dbId','path','trimStart','sqlcode','skipped','paging','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','78kXmwcy','\x20skipped,\x20','2249668EEtOjQ','nonInteractive','push','sqls','185992VSkYPX','lastSync','conflict','test','Pull\x20complete:\x20','56185xoxuks','totalCount','apps','local\x20differs\x20from\x20remote','2591463CIQwCf','sqlContent','765246PrPMpJ','sqlCode','sql','message','lockFilePath','length'];a237_0x4e8f=function(){return _0x3c3d2d;};return a237_0x4e8f();}function a237_0x325d(_0x5b1240,_0x52e622){_0x5b1240=_0x5b1240-0x144;const _0x4e8f7d=a237_0x4e8f();let _0x325d79=_0x4e8f7d[_0x5b1240];return _0x325d79;}async function fetchAllSqlQueries(_0x6f4394,_0xe7115e){const _0xe3016c=a237_0x325d,_0x4d38c4=[];let _0x2d0951=0x1;while(!![]){const _0xb93fa1=await listSqlQueries(_0x6f4394,{'currentPage':_0x2d0951,'pageSize':PAGE_SIZE,'sqlCode':_0xe7115e[_0xe3016c(0x14c)],'sqlName':_0xe7115e[_0xe3016c(0x15c)]}),_0x4bdb51=_0xb93fa1[_0xe3016c(0x16d)]??[];_0x4d38c4[_0xe3016c(0x17a)](..._0x4bdb51);if(_0x4bdb51[_0xe3016c(0x150)]===0x0)break;const _0x9a4e97=_0xb93fa1[_0xe3016c(0x174)]?.[_0xe3016c(0x146)];if(_0x9a4e97!=null?_0x4d38c4[_0xe3016c(0x150)]>=_0x9a4e97:_0x4bdb51[_0xe3016c(0x150)]<PAGE_SIZE)break;_0x2d0951++;}return _0x4d38c4;}async function ensureSqlContent(_0x429a2a){const _0x38394b=a237_0x325d;if(_0x429a2a[_0x38394b(0x14a)]!=null&&String(_0x429a2a[_0x38394b(0x14a)])[_0x38394b(0x150)]>0x0)return _0x429a2a;return getSqlQueryDetail(_0x429a2a[_0x38394b(0x14c)]);}export const sqlPull={'service':a237_0x2fb91e(0x14d),'command':'pull','description':a237_0x2fb91e(0x175),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a237_0x2fb91e(0x16b),'type':a237_0x2fb91e(0x151),'description':a237_0x2fb91e(0x15b)},{'name':a237_0x2fb91e(0x169),'type':'boolean','description':a237_0x2fb91e(0x15f)}],async 'dryRun'(_0x38d1ec){const _0x5042a9=a237_0x2fb91e,_0x23bf6b=loadSqlProjectConfig(_0x38d1ec[_0x5042a9(0x16c)]),_0x3da512=await readSqlLockFile(_0x23bf6b['lockFilePath']),{appLock:_0x285a2d}=ensureSqlLockScope(_0x3da512??createEmptySqlLock(),_0x23bf6b[_0x5042a9(0x16c)],_0x23bf6b['sqlRoot'],_0x5042a9(0x159)),_0x5661a3=await fetchAllSqlQueries(_0x38d1ec[_0x5042a9(0x16c)],{'sqlCode':_0x38d1ec[_0x5042a9(0x154)](_0x5042a9(0x172))||undefined,'sqlName':_0x38d1ec[_0x5042a9(0x154)](_0x5042a9(0x16b))||undefined}),_0x282f33=[];for(const _0x4950dd of _0x5661a3){const _0x391940=await ensureSqlContent(_0x4950dd),_0x1fd98c=ensureRemoteSqlContent(_0x391940),_0x2cbe40=detectModeFromSql(_0x391940),_0x144e3f=_0x391940[_0x5042a9(0x16f)]?await getDbName(_0x38d1ec[_0x5042a9(0x16c)],Number(_0x391940[_0x5042a9(0x16f)]))[_0x5042a9(0x15d)](()=>undefined):undefined,_0x420df7=buildLocalSqlFileContent({'sqlCode':_0x391940[_0x5042a9(0x14c)],'sqlName':_0x391940['sqlName'],'dbId':_0x391940['dbId']},_0x1fd98c,{'dbName':_0x144e3f,'mode':_0x2cbe40,'syncedAt':new Date()['toISOString'](),'description':_0x391940[_0x5042a9(0x157)]}),_0x1f49a5=buildSqlLockEntry(_0x391940,_0x1fd98c,'',{'dbName':_0x144e3f}),_0x573137=resolveLocalSqlFilePath(_0x23bf6b,_0x391940['sqlCode'],_0x1f49a5);let _0x338a43=_0x5042a9(0x15e),_0x27fec1;if(await fileExists(_0x573137)){const _0x5acc84=await readFile(_0x573137,'utf8');isEquivalentPulledSqlFile(_0x5acc84,_0x420df7,_0x2cbe40)?(_0x338a43=_0x5042a9(0x173),_0x27fec1=_0x5042a9(0x15a)):(_0x338a43=_0x5042a9(0x17e),_0x27fec1='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x282f33[_0x5042a9(0x17a)]({'sqlCode':_0x391940['sqlCode'],'sqlName':_0x391940[_0x5042a9(0x15c)],'filePath':_0x573137,'status':_0x338a43,'reason':_0x27fec1});}return{'method':_0x5042a9(0x168),'url':_0x5042a9(0x152),'body':{'appCode':_0x38d1ec['appCode'],'sqlCode':_0x38d1ec[_0x5042a9(0x154)](_0x5042a9(0x172))||null,'sqlName':_0x38d1ec[_0x5042a9(0x154)]('name')||null,'files':_0x282f33},'description':'Would\x20pull\x20'+_0x282f33['length']+'\x20SQL\x20file(s)\x20into\x20'+_0x23bf6b[_0x5042a9(0x163)]};},async 'execute'(_0x4630b9){const _0x4acf9b=a237_0x2fb91e,_0x224abe=loadSqlProjectConfig(_0x4630b9[_0x4acf9b(0x16c)]),_0x50044a=await readSqlLockFile(_0x224abe['lockFilePath']),{lockData:_0x157456,appLock:_0xbb5024}=ensureSqlLockScope(_0x50044a??createEmptySqlLock(),_0x224abe['appCode'],_0x224abe['sqlRoot'],_0x4acf9b(0x159)),_0x292dcf=_0x4630b9[_0x4acf9b(0x153)](_0x4acf9b(0x169)),_0x3351a0=await fetchAllSqlQueries(_0x4630b9[_0x4acf9b(0x16c)],{'sqlCode':_0x4630b9[_0x4acf9b(0x154)](_0x4acf9b(0x172))||undefined,'sqlName':_0x4630b9['str']('name')||undefined});if(_0x3351a0['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4acf9b(0x158)};const _0x1f408f=[],_0x555683=[];for(const _0x4375b6 of _0x3351a0){try{_0x1f408f[_0x4acf9b(0x17a)](await ensureSqlContent(_0x4375b6));}catch(_0x193159){_0x555683[_0x4acf9b(0x17a)]({'sqlCode':_0x4375b6[_0x4acf9b(0x14c)],'error':_0x193159 instanceof Error?_0x193159[_0x4acf9b(0x14e)]:String(_0x193159)});}}if(_0x292dcf&&!_0x4630b9[_0x4acf9b(0x179)]){let _0x3960e7=![];for(const _0x4b785b of _0x1f408f){const _0xe81c5a=detectModeFromSql(_0x4b785b),_0x2e558a=_0x4b785b[_0x4acf9b(0x16f)]?await getDbName(_0x4630b9[_0x4acf9b(0x16c)],Number(_0x4b785b['dbId']))[_0x4acf9b(0x15d)](()=>undefined):undefined,_0x50658e=buildLocalSqlFileContent({'sqlCode':_0x4b785b[_0x4acf9b(0x14c)],'sqlName':_0x4b785b['sqlName'],'dbId':_0x4b785b[_0x4acf9b(0x16f)]},ensureRemoteSqlContent(_0x4b785b),{'dbName':_0x2e558a,'mode':_0xe81c5a,'syncedAt':new Date()[_0x4acf9b(0x164)](),'description':_0x4b785b[_0x4acf9b(0x157)]}),_0x4c1787=resolveLocalSqlFilePath(_0x224abe,_0x4b785b['sqlCode'],buildSqlLockEntry(_0x4b785b,ensureRemoteSqlContent(_0x4b785b),'',{'dbName':_0x2e558a}));if(await fileExists(_0x4c1787)){const _0x1a9a21=await readFile(_0x4c1787,'utf8');if(!isEquivalentPulledSqlFile(_0x1a9a21,_0x50658e,_0xe81c5a)){_0x3960e7=!![];break;}}}if(_0x3960e7){const _0x2ef5e7=await confirmForceOverwrite(_0x4acf9b(0x156));if(!_0x2ef5e7)throw CliErrors[_0x4acf9b(0x155)]('Force\x20pull\x20cancelled.');}}const _0x430672=cloneSqlLockData(_0x157456),_0x5bb7d4=_0x430672[_0x4acf9b(0x147)][_0x224abe[_0x4acf9b(0x16c)]],_0x768d74=[],_0x41e6f7=[];for(const _0x533bc4 of _0x1f408f){const _0x41ee3c=_0x5bb7d4[_0x4acf9b(0x17b)][_0x533bc4['sqlCode']],_0x1129cb=ensureRemoteSqlContent(_0x533bc4),_0x24de28=detectModeFromSql(_0x533bc4),_0x28699a=_0x533bc4[_0x4acf9b(0x16f)]?await getDbName(_0x4630b9[_0x4acf9b(0x16c)],Number(_0x533bc4['dbId']))[_0x4acf9b(0x15d)](()=>undefined):undefined,_0x5b7a2d=buildLocalSqlFileContent({'sqlCode':_0x533bc4[_0x4acf9b(0x14c)],'sqlName':_0x533bc4[_0x4acf9b(0x15c)],'dbId':_0x533bc4[_0x4acf9b(0x16f)]},_0x1129cb,{'dbName':_0x28699a,'mode':_0x24de28,'syncedAt':new Date()[_0x4acf9b(0x164)](),'description':_0x533bc4[_0x4acf9b(0x157)]}),_0x1e3f1b=buildSqlLockEntry(_0x533bc4,_0x1129cb,computeSqlContentHash(_0x5b7a2d),{'dbName':_0x28699a}),_0x2ec176=_0x1e3f1b[_0x4acf9b(0x170)],_0x3ff407=join(_0x224abe[_0x4acf9b(0x163)],_0x2ec176);try{if(await fileExists(_0x3ff407)){const _0x3248fb=await readFile(_0x3ff407,_0x4acf9b(0x160));if(isEquivalentPulledSqlFile(_0x3248fb,_0x5b7a2d,_0x24de28)){_0x41e6f7['push']({'sqlCode':_0x533bc4['sqlCode'],'reason':_0x4acf9b(0x15a)}),_0x5bb7d4[_0x4acf9b(0x17b)][_0x533bc4[_0x4acf9b(0x14c)]]={..._0x1e3f1b,'hash':computeSqlContentHash(_0x3248fb),'path':_0x2ec176};continue;}if(!_0x292dcf){_0x41e6f7['push']({'sqlCode':_0x533bc4[_0x4acf9b(0x14c)],'reason':_0x4acf9b(0x148)});continue;}}const _0x23502b=_0x41ee3c?.[_0x4acf9b(0x170)]?join(_0x224abe[_0x4acf9b(0x163)],_0x41ee3c[_0x4acf9b(0x170)]):undefined;_0x23502b&&_0x23502b!==_0x3ff407&&await fileExists(_0x23502b)&&await rm(_0x23502b,{'force':!![]}),await ensureParentDirectory(_0x3ff407),await writeFile(_0x3ff407,_0x5b7a2d,'utf8'),_0x5bb7d4[_0x4acf9b(0x17b)][_0x533bc4[_0x4acf9b(0x14c)]]={..._0x1e3f1b,'path':_0x2ec176},_0x768d74[_0x4acf9b(0x17a)]({'sqlCode':_0x533bc4[_0x4acf9b(0x14c)],'filePath':_0x3ff407});}catch(_0x2d0b69){_0x555683[_0x4acf9b(0x17a)]({'sqlCode':_0x533bc4[_0x4acf9b(0x14c)],'error':_0x2d0b69 instanceof Error?_0x2d0b69[_0x4acf9b(0x14e)]:String(_0x2d0b69)});}}return _0x5bb7d4[_0x4acf9b(0x17d)]=new Date()[_0x4acf9b(0x164)](),await writeSqlLockFile(_0x224abe[_0x4acf9b(0x14f)],_0x430672),{'ok':_0x555683[_0x4acf9b(0x150)]===0x0,'data':{'pulled':_0x768d74,'skipped':_0x41e6f7,'failed':_0x555683},'message':_0x4acf9b(0x144)+_0x768d74[_0x4acf9b(0x150)]+'\x20written,\x20'+_0x41e6f7['length']+_0x4acf9b(0x177)+_0x555683['length']+_0x4acf9b(0x16a)};}};function detectModeFromSql(_0x251fd2){const _0x5b3560=a237_0x2fb91e,_0x1dbcc2=ensureRemoteSqlContent(_0x251fd2),_0x14431a=stripLocalSqlMetadata(_0x1dbcc2,_0x5b3560(0x161))[_0x5b3560(0x171)]();if(/^<(select|insert|update|delete)\b/i[_0x5b3560(0x17f)](_0x14431a))return'mybatisXml';return'sql';}function isEquivalentPulledSqlFile(_0x26eb23,_0x525313,_0x1f71fb){return normalizePullComparableContent(_0x26eb23,_0x1f71fb)===normalizePullComparableContent(_0x525313,_0x1f71fb);}function normalizePullComparableContent(_0x11584f,_0x1bee53){const _0x51f994=a237_0x2fb91e,_0x3588c8=_0x11584f['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x33bd28=_0x3588c8[_0x51f994(0x165)](_0x36045a=>!isSyncedAtMetadataLine(_0x36045a,_0x1bee53));return _0x33bd28[_0x51f994(0x162)]('\x0a');}function isSyncedAtMetadataLine(_0x4da0cc,_0x65f810){const _0x462ed0=a237_0x2fb91e;if(_0x65f810==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x462ed0(0x17f)](_0x4da0cc);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x4da0cc);}
@@ -1 +1 @@
1
- const a213_0x1718bb=a213_0x4948;(function(_0x4fac46,_0x511c42){const _0x15b8a9=a213_0x4948,_0x98892e=_0x4fac46();while(!![]){try{const _0x5ac995=-parseInt(_0x15b8a9(0xdd))/0x1*(parseInt(_0x15b8a9(0xcf))/0x2)+parseInt(_0x15b8a9(0xb5))/0x3*(-parseInt(_0x15b8a9(0xac))/0x4)+-parseInt(_0x15b8a9(0xdc))/0x5*(-parseInt(_0x15b8a9(0xce))/0x6)+-parseInt(_0x15b8a9(0xb2))/0x7*(parseInt(_0x15b8a9(0xeb))/0x8)+parseInt(_0x15b8a9(0xe8))/0x9+parseInt(_0x15b8a9(0xd1))/0xa*(parseInt(_0x15b8a9(0xd2))/0xb)+parseInt(_0x15b8a9(0xc3))/0xc*(parseInt(_0x15b8a9(0xae))/0xd);if(_0x5ac995===_0x511c42)break;else _0x98892e['push'](_0x98892e['shift']());}catch(_0x22296c){_0x98892e['push'](_0x98892e['shift']());}}}(a213_0x1fdb,0x482a6));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';function a213_0x4948(_0x59642c,_0x564a5a){_0x59642c=_0x59642c-0xab;const _0x1fdbc4=a213_0x1fdb();let _0x4948c7=_0x1fdbc4[_0x59642c];return _0x4948c7;}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(_0x86396,_0x161b8f,_0x2da1df){const _0x287cac=a213_0x4948,_0x5a06e4=await scanLocalSqlQueries(_0x86396),_0x36c084=new Map();for(const _0x195073 of _0x5a06e4){if(_0x2da1df&&_0x195073[_0x287cac(0xb7)]!==_0x2da1df)continue;const _0xe244e7=_0x36c084[_0x287cac(0xe7)](_0x195073[_0x287cac(0xb7)])??[];_0xe244e7[_0x287cac(0xd9)](_0x195073),_0x36c084[_0x287cac(0xd5)](_0x195073[_0x287cac(0xb7)],_0xe244e7);}if(_0x2da1df&&!_0x36c084[_0x287cac(0xe3)](_0x2da1df))throw CliErrors[_0x287cac(0xc0)](_0x287cac(0xc6)+_0x2da1df);const _0x1d6af4=[];for(const [_0x4a45e8,_0x478192]of _0x36c084[_0x287cac(0xb1)]()){if(_0x478192[_0x287cac(0xbf)]===0x1){_0x1d6af4[_0x287cac(0xd9)](_0x478192[0x0]);continue;}const _0x27bbe1=_0x161b8f[_0x287cac(0xd8)][_0x4a45e8],_0x420e21=_0x27bbe1?.[_0x287cac(0xe0)],_0x14bb19=_0x420e21?_0x478192[_0x287cac(0xc4)](_0xf022b6=>_0xf022b6[_0x287cac(0xba)]!==_0x420e21):_0x478192;if(_0x27bbe1&&_0x14bb19[_0x287cac(0xbf)]===0x1){_0x1d6af4[_0x287cac(0xd9)](_0x14bb19[0x0]);continue;}throw CliErrors[_0x287cac(0xc0)](_0x287cac(0xcd)+_0x4a45e8+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x1d6af4;}export const sqlPush={'service':a213_0x1718bb(0xd3),'command':a213_0x1718bb(0xd9),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a213_0x1718bb(0xe5),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a213_0x1718bb(0xc7),'type':'boolean','description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x5bf561){const _0x137d17=a213_0x1718bb,_0x13da32=loadSqlProjectConfig(_0x5bf561[_0x137d17(0xd4)]),_0x57cc3a=await readSqlLockFile(_0x13da32['lockFilePath']),{appLock:_0x228947}=ensureSqlLockScope(_0x57cc3a??createEmptySqlLock(),_0x5bf561[_0x137d17(0xd4)],_0x13da32[_0x137d17(0xcb)],_0x137d17(0xd9)),_0x435fa8=await getTargetSqlQueries(_0x13da32,_0x228947,_0x5bf561[_0x137d17(0xee)](_0x137d17(0xb6))||undefined),_0x40ce94=[];for(const _0x25a718 of _0x435fa8){const _0x26de85=await computeSqlFileHash(_0x25a718[_0x137d17(0xec)]),_0x42e991=_0x228947['sqls'][_0x25a718[_0x137d17(0xb7)]],_0x37ea75=!!_0x42e991&&(_0x42e991[_0x137d17(0xe0)]!==_0x25a718['relativePath']||!!_0x25a718['sqlName']&&_0x42e991[_0x137d17(0xe4)]!==_0x25a718['sqlName']);if(!_0x5bf561[_0x137d17(0xd6)]('force')&&_0x42e991&&_0x42e991['hash']===_0x26de85&&!_0x37ea75)continue;_0x40ce94[_0x137d17(0xd9)](_0x25a718[_0x137d17(0xb7)]);}return{'method':'POST','url':_0x137d17(0xc5),'body':{'sqlCodes':_0x40ce94,'appCode':_0x5bf561[_0x137d17(0xd4)]},'description':_0x137d17(0xe1)+_0x40ce94['length']+_0x137d17(0xc2)};},async 'execute'(_0x3b5b1e){const _0xe81cdc=a213_0x1718bb,_0x3451e7=loadSqlProjectConfig(_0x3b5b1e[_0xe81cdc(0xd4)]),_0x24f8ac=await readSqlLockFile(_0x3451e7[_0xe81cdc(0xca)]),{lockData:_0x242a64,appLock:_0x9cbb60}=ensureSqlLockScope(_0x24f8ac??createEmptySqlLock(),_0x3b5b1e['appCode'],_0x3451e7[_0xe81cdc(0xcb)],_0xe81cdc(0xd9)),_0x3f2387=await getTargetSqlQueries(_0x3451e7,_0x9cbb60,_0x3b5b1e[_0xe81cdc(0xee)](_0xe81cdc(0xb6))||undefined);if(_0x3f2387[_0xe81cdc(0xbf)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x3aa878=[],_0x134492=[],_0x4dce2f=[];for(const _0x5709a0 of _0x3f2387){const _0x40f053=_0x9cbb60[_0xe81cdc(0xd8)][_0x5709a0['sqlCode']];if(!_0x40f053){_0x4dce2f[_0xe81cdc(0xd9)]({'sqlCode':_0x5709a0[_0xe81cdc(0xb7)],'error':_0xe81cdc(0xbd)});continue;}try{const _0x425dc9=await computeSqlFileHash(_0x5709a0[_0xe81cdc(0xec)]),_0x181ce8=_0x40f053['path']!==_0x5709a0[_0xe81cdc(0xba)]||!!_0x5709a0[_0xe81cdc(0xe4)]&&_0x40f053[_0xe81cdc(0xe4)]!==_0x5709a0[_0xe81cdc(0xe4)];if(!_0x3b5b1e[_0xe81cdc(0xd6)](_0xe81cdc(0xc7))&&_0x40f053[_0xe81cdc(0xaf)]===_0x425dc9&&!_0x181ce8){_0x134492[_0xe81cdc(0xd9)]({'sqlCode':_0x5709a0[_0xe81cdc(0xb7)],'reason':_0xe81cdc(0xbe)});continue;}if(_0x40f053['version']==null){_0x4dce2f[_0xe81cdc(0xd9)]({'sqlCode':_0x5709a0[_0xe81cdc(0xb7)],'error':_0xe81cdc(0xd7)});continue;}const _0x5a706b=await readFile(_0x5709a0[_0xe81cdc(0xec)],'utf8'),_0x11cb0c=stripLocalSqlMetadata(_0x5a706b,_0x5709a0['mode']),_0x279fd8=_0x5709a0['sqlName']||_0x40f053[_0xe81cdc(0xe4)],_0x58c849=await resolveTargetDbBinding(_0x3b5b1e[_0xe81cdc(0xd4)],_0x5709a0,_0x40f053),_0x20cc13=await updateSqlQuery({'id':_0x40f053[_0xe81cdc(0xdf)],'appCode':_0x3b5b1e[_0xe81cdc(0xd4)],'sqlCode':_0x5709a0[_0xe81cdc(0xb7)],'sqlName':_0x279fd8,'dbId':_0x58c849['dbId'],'version':_0x40f053[_0xe81cdc(0xb9)],'sqlContent':_0x11cb0c,'sqlConfig':_0x40f053['sqlConfig']??undefined}),_0x1decc4=_0x20cc13[_0xe81cdc(0xbb)]?await getDbName(_0x3b5b1e[_0xe81cdc(0xd4)],Number(_0x20cc13[_0xe81cdc(0xbb)]))[_0xe81cdc(0xb3)](()=>_0x58c849[_0xe81cdc(0xe2)]):_0x58c849[_0xe81cdc(0xe2)];_0x9cbb60[_0xe81cdc(0xd8)][_0x5709a0['sqlCode']]={...buildSqlLockEntry(_0x20cc13,_0x11cb0c,_0x425dc9,{'dbName':_0x1decc4}),'path':_0x5709a0[_0xe81cdc(0xba)],'mode':_0x40f053[_0xe81cdc(0xe6)]},await archivePreviousSqlFileIfNeeded(_0x3451e7,_0x40f053[_0xe81cdc(0xe0)],_0x5709a0[_0xe81cdc(0xba)]),_0x3aa878[_0xe81cdc(0xd9)]({'sqlCode':_0x5709a0['sqlCode'],'remoteId':_0x40f053[_0xe81cdc(0xdf)]});}catch(_0x53270a){_0x4dce2f[_0xe81cdc(0xd9)]({'sqlCode':_0x5709a0[_0xe81cdc(0xb7)],'error':_0x53270a instanceof Error?_0x53270a['message']:String(_0x53270a)});}}_0x9cbb60[_0xe81cdc(0xb4)]=new Date()[_0xe81cdc(0xda)](),await writeSqlLockFile(_0x3451e7[_0xe81cdc(0xca)],_0x242a64);const _0x5e1bd1=_0x4dce2f[_0xe81cdc(0xbf)]===0x0;return{'ok':_0x5e1bd1,'data':{'pushed':_0x3aa878,'skipped':_0x134492,'failed':_0x4dce2f},'message':_0xe81cdc(0xc9)+_0x3aa878[_0xe81cdc(0xbf)]+_0xe81cdc(0xed)+_0x134492[_0xe81cdc(0xbf)]+_0xe81cdc(0xcc)+_0x4dce2f[_0xe81cdc(0xbf)]+_0xe81cdc(0xc1)};}};async function archivePreviousSqlFileIfNeeded(_0x1ccd96,_0xed159a,_0x2a481a){const _0x18f7f0=a213_0x1718bb;if(!_0xed159a||_0xed159a===_0x2a481a)return;const _0x1f8c6a=join(_0x1ccd96[_0x18f7f0(0xad)],_0xed159a);if(!await fileExists(_0x1f8c6a))return;const _0x24521c=await moveToTrash(_0x1ccd96[_0x18f7f0(0xdb)],_0x1ccd96[_0x18f7f0(0xe9)],_0x1f8c6a);await cleanupEmptyDirectories(dirname(_0x1f8c6a),_0x1ccd96[_0x18f7f0(0xad)]),void _0x24521c;}function a213_0x1fdb(){const _0x801744=['version','relativePath','dbId','No\x20database\x20matches\x20local\x20directory\x20\x22','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','unchanged','length','validation','\x20failed','\x20SQL\x20file(s)','24evAkcx','filter','/smartapi/custom/updateUserCustomSql','Local\x20SQL\x20not\x20found:\x20','force','\x22\x20for\x20sqlCode\x20','Push\x20complete:\x20','lockFilePath','sqlRoot','\x20skipped,\x20','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','2211504qjqHxt','2jYygBw','isFinite','970mspKIy','62414QcGxUl','sql','appCode','set','bool','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqls','push','toISOString','projectRoot','5PhAZUp','361770rdLwrU','replace','remoteId','path','Would\x20push\x20','dbName','has','sqlName','write','mode','get','2857950NOwvPU','trashDir','startsWith','8HjtaHK','filePath','\x20pushed,\x20','str','Local\x20directory\x20\x22','2107828CfMhcx','sqlRootDir','491543AibYiH','hash','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','entries','894719xeyzjW','catch','lastSync','3ZyUJme','sqlcode','sqlCode','exec'];a213_0x1fdb=function(){return _0x801744;};return a213_0x1fdb();}async function moveToTrash(_0x4323b0,_0x458e57,_0x445d5a){const _0x5ac8f9=a213_0x1718bb,_0x4cf50b=new Date()[_0x5ac8f9(0xda)]()[_0x5ac8f9(0xde)](/[:.]/g,'-'),_0x1f0cd1=relative(_0x4323b0,_0x445d5a),_0x5c75e7=join(_0x458e57,_0x4cf50b,_0x1f0cd1);return await mkdir(dirname(_0x5c75e7),{'recursive':!![]}),await rename(_0x445d5a,_0x5c75e7),_0x5c75e7;}async function cleanupEmptyDirectories(_0x3b3e46,_0x5957ee){const _0x293071=a213_0x1718bb;let _0x26bc3d=resolve(_0x3b3e46);const _0x3ead71=resolve(_0x5957ee);while(_0x26bc3d[_0x293071(0xea)](''+_0x3ead71+sep)||_0x26bc3d===_0x3ead71){if(_0x26bc3d===_0x3ead71)return;try{const _0x3edb77=await readdir(_0x26bc3d);if(_0x3edb77[_0x293071(0xbf)]>0x0)return;await rmdir(_0x26bc3d);}catch{return;}_0x26bc3d=dirname(_0x26bc3d);}}async function resolveTargetDbBinding(_0x28a99d,_0x53c9b2,_0x266adc){const _0x306c7a=a213_0x1718bb,_0x4d3e99=_0x53c9b2['dbDirectory'];if(!_0x4d3e99)return{'dbId':_0x266adc[_0x306c7a(0xbb)],'dbName':_0x266adc[_0x306c7a(0xe2)]};const _0x4de44c=buildDbDirectoryName(_0x266adc[_0x306c7a(0xe2)],_0x266adc[_0x306c7a(0xbb)]);if(_0x4d3e99===_0x4de44c)return{'dbId':_0x266adc[_0x306c7a(0xbb)],'dbName':_0x266adc[_0x306c7a(0xe2)]};const _0x2c4ee8=parseExplicitDbDirectory(_0x4d3e99);if(_0x2c4ee8!=null)return{'dbId':_0x2c4ee8,'dbName':await getDbName(_0x28a99d,_0x2c4ee8)[_0x306c7a(0xb3)](()=>undefined)};const _0x5a424e=await listDatabases(_0x28a99d),_0x5634b0=_0x5a424e[_0x306c7a(0xc4)](_0x54dea2=>buildDbDirectoryName(_0x54dea2[_0x306c7a(0xe2)],_0x54dea2[_0x306c7a(0xbb)])===_0x4d3e99);if(_0x5634b0[_0x306c7a(0xbf)]===0x1)return{'dbId':_0x5634b0[0x0][_0x306c7a(0xbb)],'dbName':_0x5634b0[0x0]['dbName']};if(_0x5634b0[_0x306c7a(0xbf)]===0x0)throw CliErrors[_0x306c7a(0xc0)](_0x306c7a(0xbc)+_0x4d3e99+_0x306c7a(0xc8)+_0x53c9b2[_0x306c7a(0xb7)]+'.');const _0x2ce4d1=_0x5634b0['map'](_0x3a4c21=>_0x3a4c21[_0x306c7a(0xe2)]+'\x20('+_0x3a4c21[_0x306c7a(0xbb)]+')')['join'](',\x20');throw CliErrors[_0x306c7a(0xc0)](_0x306c7a(0xab)+_0x4d3e99+_0x306c7a(0xb0)+_0x53c9b2[_0x306c7a(0xb7)]+':\x20'+_0x2ce4d1);}function parseExplicitDbDirectory(_0x382070){const _0x5eae42=a213_0x1718bb,_0x2ffe15=/^db-(\d+)$/[_0x5eae42(0xb8)](_0x382070);if(!_0x2ffe15)return null;const _0x20df91=Number(_0x2ffe15[0x1]);return Number[_0x5eae42(0xd0)](_0x20df91)&&_0x20df91>0x0?_0x20df91:null;}
1
+ const a238_0x31b7cd=a238_0x1449;(function(_0x52d0ac,_0x44f729){const _0x7ae4c7=a238_0x1449,_0x595443=_0x52d0ac();while(!![]){try{const _0x180cce=-parseInt(_0x7ae4c7(0x17e))/0x1+parseInt(_0x7ae4c7(0x172))/0x2*(parseInt(_0x7ae4c7(0x1af))/0x3)+-parseInt(_0x7ae4c7(0x1a4))/0x4+parseInt(_0x7ae4c7(0x1ab))/0x5*(-parseInt(_0x7ae4c7(0x18d))/0x6)+parseInt(_0x7ae4c7(0x1a3))/0x7*(-parseInt(_0x7ae4c7(0x1a2))/0x8)+parseInt(_0x7ae4c7(0x174))/0x9*(parseInt(_0x7ae4c7(0x176))/0xa)+-parseInt(_0x7ae4c7(0x184))/0xb*(-parseInt(_0x7ae4c7(0x196))/0xc);if(_0x180cce===_0x44f729)break;else _0x595443['push'](_0x595443['shift']());}catch(_0x263e56){_0x595443['push'](_0x595443['shift']());}}}(a238_0x5734,0xd17b8));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';function a238_0x1449(_0xd0e9d5,_0x4e6761){_0xd0e9d5=_0xd0e9d5-0x16f;const _0x573497=a238_0x5734();let _0x144970=_0x573497[_0xd0e9d5];return _0x144970;}import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x16af0c,_0xaccbae,_0x1dd148){const _0xcfef10=a238_0x1449,_0x3f98c3=await scanLocalSqlQueries(_0x16af0c),_0xd101ae=new Map();for(const _0x14d675 of _0x3f98c3){if(_0x1dd148&&_0x14d675[_0xcfef10(0x1a5)]!==_0x1dd148)continue;const _0x572b0b=_0xd101ae[_0xcfef10(0x1ad)](_0x14d675[_0xcfef10(0x1a5)])??[];_0x572b0b[_0xcfef10(0x194)](_0x14d675),_0xd101ae[_0xcfef10(0x1a8)](_0x14d675[_0xcfef10(0x1a5)],_0x572b0b);}if(_0x1dd148&&!_0xd101ae[_0xcfef10(0x187)](_0x1dd148))throw CliErrors['validation']('Local\x20SQL\x20not\x20found:\x20'+_0x1dd148);const _0x2b128f=[];for(const [_0x57ee73,_0x21fa81]of _0xd101ae['entries']()){if(_0x21fa81[_0xcfef10(0x185)]===0x1){_0x2b128f[_0xcfef10(0x194)](_0x21fa81[0x0]);continue;}const _0x41d3cc=_0xaccbae['sqls'][_0x57ee73],_0xfdfd4a=_0x41d3cc?.[_0xcfef10(0x177)],_0x434403=_0xfdfd4a?_0x21fa81['filter'](_0x195d73=>_0x195d73[_0xcfef10(0x19a)]!==_0xfdfd4a):_0x21fa81;if(_0x41d3cc&&_0x434403[_0xcfef10(0x185)]===0x1){_0x2b128f[_0xcfef10(0x194)](_0x434403[0x0]);continue;}throw CliErrors['validation'](_0xcfef10(0x17b)+_0x57ee73+_0xcfef10(0x18e));}return _0x2b128f;}export const sqlPush={'service':a238_0x31b7cd(0x175),'command':'push','description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a238_0x31b7cd(0x18a),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a238_0x31b7cd(0x1ac),'type':a238_0x31b7cd(0x199),'description':a238_0x31b7cd(0x17f)}],async 'dryRun'(_0x39c7b2){const _0x3ef9a3=a238_0x31b7cd,_0x246c8b=loadSqlProjectConfig(_0x39c7b2[_0x3ef9a3(0x1a1)]),_0x11f18e=await readSqlLockFile(_0x246c8b['lockFilePath']),{appLock:_0x2b7c0d}=ensureSqlLockScope(_0x11f18e??createEmptySqlLock(),_0x39c7b2[_0x3ef9a3(0x1a1)],_0x246c8b[_0x3ef9a3(0x19b)],_0x3ef9a3(0x194)),_0x503574=await getTargetSqlQueries(_0x246c8b,_0x2b7c0d,_0x39c7b2[_0x3ef9a3(0x186)](_0x3ef9a3(0x18b))||undefined),_0x1569bd=[];for(const _0x4a7691 of _0x503574){const _0x283e3d=await computeSqlFileHash(_0x4a7691['filePath']),_0x2ab3a2=_0x2b7c0d[_0x3ef9a3(0x198)][_0x4a7691[_0x3ef9a3(0x1a5)]],_0x470592=!!_0x2ab3a2&&(_0x2ab3a2[_0x3ef9a3(0x177)]!==_0x4a7691[_0x3ef9a3(0x19a)]||!!_0x4a7691[_0x3ef9a3(0x181)]&&_0x2ab3a2[_0x3ef9a3(0x181)]!==_0x4a7691[_0x3ef9a3(0x181)]);if(!_0x39c7b2[_0x3ef9a3(0x1a6)](_0x3ef9a3(0x1ac))&&_0x2ab3a2&&_0x2ab3a2[_0x3ef9a3(0x190)]===_0x283e3d&&!_0x470592)continue;_0x1569bd[_0x3ef9a3(0x194)](_0x4a7691[_0x3ef9a3(0x1a5)]);}return{'method':_0x3ef9a3(0x1b2),'url':_0x3ef9a3(0x197),'body':{'sqlCodes':_0x1569bd,'appCode':_0x39c7b2[_0x3ef9a3(0x1a1)]},'description':_0x3ef9a3(0x191)+_0x1569bd[_0x3ef9a3(0x185)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x21654e){const _0x4ac0c=a238_0x31b7cd,_0x5e4ef6=loadSqlProjectConfig(_0x21654e[_0x4ac0c(0x1a1)]),_0x247ff0=await readSqlLockFile(_0x5e4ef6[_0x4ac0c(0x1ae)]),{lockData:_0x300b8b,appLock:_0x59c168}=ensureSqlLockScope(_0x247ff0??createEmptySqlLock(),_0x21654e[_0x4ac0c(0x1a1)],_0x5e4ef6[_0x4ac0c(0x19b)],'push'),_0x5c51b8=await getTargetSqlQueries(_0x5e4ef6,_0x59c168,_0x21654e[_0x4ac0c(0x186)](_0x4ac0c(0x18b))||undefined);if(_0x5c51b8['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x4ac0c(0x173)};const _0x34ed56=[],_0x2b95ab=[],_0x1284d9=[];for(const _0x5403ae of _0x5c51b8){const _0x1fd1cd=_0x59c168['sqls'][_0x5403ae[_0x4ac0c(0x1a5)]];if(!_0x1fd1cd){_0x1284d9['push']({'sqlCode':_0x5403ae[_0x4ac0c(0x1a5)],'error':_0x4ac0c(0x1b0)});continue;}try{const _0x5785af=await computeSqlFileHash(_0x5403ae[_0x4ac0c(0x19c)]),_0x9c2d05=_0x1fd1cd[_0x4ac0c(0x177)]!==_0x5403ae[_0x4ac0c(0x19a)]||!!_0x5403ae[_0x4ac0c(0x181)]&&_0x1fd1cd['sqlName']!==_0x5403ae['sqlName'];if(!_0x21654e[_0x4ac0c(0x1a6)](_0x4ac0c(0x1ac))&&_0x1fd1cd[_0x4ac0c(0x190)]===_0x5785af&&!_0x9c2d05){_0x2b95ab[_0x4ac0c(0x194)]({'sqlCode':_0x5403ae['sqlCode'],'reason':_0x4ac0c(0x1a9)});continue;}if(_0x1fd1cd[_0x4ac0c(0x17c)]==null){_0x1284d9[_0x4ac0c(0x194)]({'sqlCode':_0x5403ae['sqlCode'],'error':_0x4ac0c(0x19e)});continue;}const _0x4a902f=await readFile(_0x5403ae[_0x4ac0c(0x19c)],_0x4ac0c(0x193)),_0x333fd1=stripLocalSqlMetadata(_0x4a902f,_0x5403ae[_0x4ac0c(0x192)]),_0x306161=_0x5403ae[_0x4ac0c(0x181)]||_0x1fd1cd[_0x4ac0c(0x181)],_0x457bf8=await resolveTargetDbBinding(_0x21654e[_0x4ac0c(0x1a1)],_0x5403ae,_0x1fd1cd),_0x5cb2e8=await updateSqlQuery({'id':_0x1fd1cd[_0x4ac0c(0x183)],'appCode':_0x21654e[_0x4ac0c(0x1a1)],'sqlCode':_0x5403ae[_0x4ac0c(0x1a5)],'sqlName':_0x306161,'dbId':_0x457bf8[_0x4ac0c(0x180)],'version':_0x1fd1cd[_0x4ac0c(0x17c)],'sqlContent':_0x333fd1,'sqlConfig':_0x1fd1cd[_0x4ac0c(0x19f)]??undefined}),_0x30b85a=_0x5cb2e8[_0x4ac0c(0x180)]?await getDbName(_0x21654e[_0x4ac0c(0x1a1)],Number(_0x5cb2e8[_0x4ac0c(0x180)]))[_0x4ac0c(0x188)](()=>_0x457bf8[_0x4ac0c(0x16f)]):_0x457bf8['dbName'];_0x59c168['sqls'][_0x5403ae[_0x4ac0c(0x1a5)]]={...buildSqlLockEntry(_0x5cb2e8,_0x333fd1,_0x5785af,{'dbName':_0x30b85a}),'path':_0x5403ae[_0x4ac0c(0x19a)],'mode':_0x1fd1cd[_0x4ac0c(0x192)]},await archivePreviousSqlFileIfNeeded(_0x5e4ef6,_0x1fd1cd[_0x4ac0c(0x177)],_0x5403ae[_0x4ac0c(0x19a)]),_0x34ed56['push']({'sqlCode':_0x5403ae[_0x4ac0c(0x1a5)],'remoteId':_0x1fd1cd[_0x4ac0c(0x183)]});}catch(_0x294ec5){_0x1284d9[_0x4ac0c(0x194)]({'sqlCode':_0x5403ae[_0x4ac0c(0x1a5)],'error':_0x294ec5 instanceof Error?_0x294ec5[_0x4ac0c(0x178)]:String(_0x294ec5)});}}_0x59c168['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x5e4ef6['lockFilePath'],_0x300b8b);const _0x24177c=_0x1284d9[_0x4ac0c(0x185)]===0x0;return{'ok':_0x24177c,'data':{'pushed':_0x34ed56,'skipped':_0x2b95ab,'failed':_0x1284d9},'message':_0x4ac0c(0x195)+_0x34ed56[_0x4ac0c(0x185)]+_0x4ac0c(0x170)+_0x2b95ab[_0x4ac0c(0x185)]+'\x20skipped,\x20'+_0x1284d9['length']+_0x4ac0c(0x1a0)};}};async function archivePreviousSqlFileIfNeeded(_0x410f77,_0x1e07af,_0x234125){const _0x3aeb2a=a238_0x31b7cd;if(!_0x1e07af||_0x1e07af===_0x234125)return;const _0xfff213=join(_0x410f77['sqlRootDir'],_0x1e07af);if(!await fileExists(_0xfff213))return;const _0x33da29=await moveToTrash(_0x410f77['projectRoot'],_0x410f77[_0x3aeb2a(0x182)],_0xfff213);await cleanupEmptyDirectories(dirname(_0xfff213),_0x410f77[_0x3aeb2a(0x1aa)]),void _0x33da29;}function a238_0x5734(){const _0x739ea6=['sqlRootDir','254495nDyZyZ','force','get','lockFilePath','9PrOjJA','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','POST','map','dbName','\x20pushed,\x20','filter','289862tlcfKM','No\x20local\x20SQL\x20files\x20found.','36pjuSmi','sql','4080830sSHjeV','path','message','validation','toISOString','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','version','replace','421501SynYdm','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','dbId','sqlName','trashDir','remoteId','308TZEWrt','length','str','has','catch','startsWith','write','sqlcode','join','78oDEXJC','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','No\x20database\x20matches\x20local\x20directory\x20\x22','hash','Would\x20push\x20','mode','utf8','push','Push\x20complete:\x20','596436vXuHnQ','/smartapi/custom/updateUserCustomSql','sqls','boolean','relativePath','sqlRoot','filePath','dbDirectory','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqlConfig','\x20failed','appCode','4236992qmlxoX','14wdbnku','1833332LdzeRg','sqlCode','bool','exec','set','unchanged'];a238_0x5734=function(){return _0x739ea6;};return a238_0x5734();}async function moveToTrash(_0x272f9a,_0x49fa99,_0x1b0abb){const _0x99eff7=a238_0x31b7cd,_0x2799d2=new Date()[_0x99eff7(0x17a)]()[_0x99eff7(0x17d)](/[:.]/g,'-'),_0x3abf98=relative(_0x272f9a,_0x1b0abb),_0x53ce35=join(_0x49fa99,_0x2799d2,_0x3abf98);return await mkdir(dirname(_0x53ce35),{'recursive':!![]}),await rename(_0x1b0abb,_0x53ce35),_0x53ce35;}async function cleanupEmptyDirectories(_0xd0a29b,_0x180a09){const _0x388c5f=a238_0x31b7cd;let _0xf25f46=resolve(_0xd0a29b);const _0x55a1a5=resolve(_0x180a09);while(_0xf25f46[_0x388c5f(0x189)](''+_0x55a1a5+sep)||_0xf25f46===_0x55a1a5){if(_0xf25f46===_0x55a1a5)return;try{const _0x305a5a=await readdir(_0xf25f46);if(_0x305a5a['length']>0x0)return;await rmdir(_0xf25f46);}catch{return;}_0xf25f46=dirname(_0xf25f46);}}async function resolveTargetDbBinding(_0x21c85e,_0xc427fc,_0xf76380){const _0x2ea6b4=a238_0x31b7cd,_0xd72018=_0xc427fc[_0x2ea6b4(0x19d)];if(!_0xd72018)return{'dbId':_0xf76380[_0x2ea6b4(0x180)],'dbName':_0xf76380['dbName']};const _0x5ec984=buildDbDirectoryName(_0xf76380[_0x2ea6b4(0x16f)],_0xf76380[_0x2ea6b4(0x180)]);if(_0xd72018===_0x5ec984)return{'dbId':_0xf76380[_0x2ea6b4(0x180)],'dbName':_0xf76380['dbName']};const _0x171ce4=parseExplicitDbDirectory(_0xd72018);if(_0x171ce4!=null)return{'dbId':_0x171ce4,'dbName':await getDbName(_0x21c85e,_0x171ce4)[_0x2ea6b4(0x188)](()=>undefined)};const _0x5f001f=await listDatabases(_0x21c85e),_0x5ac296=_0x5f001f[_0x2ea6b4(0x171)](_0xb9973d=>buildDbDirectoryName(_0xb9973d['dbName'],_0xb9973d[_0x2ea6b4(0x180)])===_0xd72018);if(_0x5ac296[_0x2ea6b4(0x185)]===0x1)return{'dbId':_0x5ac296[0x0][_0x2ea6b4(0x180)],'dbName':_0x5ac296[0x0][_0x2ea6b4(0x16f)]};if(_0x5ac296['length']===0x0)throw CliErrors[_0x2ea6b4(0x179)](_0x2ea6b4(0x18f)+_0xd72018+'\x22\x20for\x20sqlCode\x20'+_0xc427fc[_0x2ea6b4(0x1a5)]+'.');const _0x3472dd=_0x5ac296[_0x2ea6b4(0x1b3)](_0x35a509=>_0x35a509[_0x2ea6b4(0x16f)]+'\x20('+_0x35a509['dbId']+')')[_0x2ea6b4(0x18c)](',\x20');throw CliErrors[_0x2ea6b4(0x179)]('Local\x20directory\x20\x22'+_0xd72018+_0x2ea6b4(0x1b1)+_0xc427fc[_0x2ea6b4(0x1a5)]+':\x20'+_0x3472dd);}function parseExplicitDbDirectory(_0x5eb0dc){const _0xb67cd=a238_0x31b7cd,_0x15192e=/^db-(\d+)$/[_0xb67cd(0x1a7)](_0x5eb0dc);if(!_0x15192e)return null;const _0x226878=Number(_0x15192e[0x1]);return Number['isFinite'](_0x226878)&&_0x226878>0x0?_0x226878:null;}
@@ -1 +1 @@
1
- const a214_0x34a22e=a214_0x28e4;(function(_0xd2dc53,_0x1af156){const _0x3f05bd=a214_0x28e4,_0xc5b278=_0xd2dc53();while(!![]){try{const _0x287e1e=parseInt(_0x3f05bd(0x8a))/0x1+parseInt(_0x3f05bd(0x80))/0x2*(parseInt(_0x3f05bd(0x8e))/0x3)+parseInt(_0x3f05bd(0x76))/0x4*(parseInt(_0x3f05bd(0x7e))/0x5)+parseInt(_0x3f05bd(0x73))/0x6*(parseInt(_0x3f05bd(0x77))/0x7)+parseInt(_0x3f05bd(0x96))/0x8+parseInt(_0x3f05bd(0x83))/0x9*(-parseInt(_0x3f05bd(0x90))/0xa)+-parseInt(_0x3f05bd(0x74))/0xb*(parseInt(_0x3f05bd(0x8b))/0xc);if(_0x287e1e===_0x1af156)break;else _0xc5b278['push'](_0xc5b278['shift']());}catch(_0x392816){_0xc5b278['push'](_0xc5b278['shift']());}}}(a214_0x3a9d,0x9dd26));function a214_0x3a9d(){const _0x418bd4=['join','description','question','dbName','version','450757mNazmW','192180qZHYZq','apps','dbId','282UMNHGW','trim','421340PWEgdN','length','path','filter','toLowerCase','sqlName','1439432XbcPXO','close','sqls','map','includes','split','sqlCode','2123412Aewtsd','979AgnUKb','replace','92pwFwHf','7zBfvSp','lastSync','mybatisXml','mode','endsWith','trimStart','test','188885zBbUYH','entries','18092AGVJDK','--\x20@lovrabet.','\x20[y/N]\x20','135ihbFOi','.rabetbase/sql'];a214_0x3a9d=function(){return _0x418bd4;};return a214_0x3a9d();}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_0x34a22e(0x84);export function buildSqlLockEntry(_0x493de1,_0x46d849,_0x9f3db8,_0x3a2d35){const _0x1a8944=a214_0x34a22e,_0x16c8f8=detectSqlMode(_0x46d849);return{'path':buildSqlRelativePath(_0x493de1['sqlCode'],_0x493de1[_0x1a8944(0x95)],_0x3a2d35?.[_0x1a8944(0x88)],_0x16c8f8,_0x493de1['dbId']),'hash':_0x9f3db8,'remoteId':_0x493de1['id'],'version':_0x493de1[_0x1a8944(0x89)],'dbId':Number(_0x493de1[_0x1a8944(0x8d)]),'dbName':_0x3a2d35?.[_0x1a8944(0x88)],'sqlName':_0x493de1[_0x1a8944(0x95)],'sqlConfig':_0x493de1['sqlConfig']??undefined,'mode':_0x16c8f8};}export function cloneSqlLockData(_0x333fd9){const _0x1d9f79=a214_0x34a22e;return{'apps':Object['fromEntries'](Object[_0x1d9f79(0x7f)](_0x333fd9[_0x1d9f79(0x8c)])[_0x1d9f79(0x6f)](([_0x57ddf8,_0x139e5d])=>[_0x57ddf8,{'sqlRoot':_0x139e5d['sqlRoot'],'lastSync':_0x139e5d[_0x1d9f79(0x78)],'sqls':{..._0x139e5d[_0x1d9f79(0x6e)]}}]))};}export function ensureRemoteSqlContent(_0x3a7729){return _0x3a7729['sqlContent']??'';}export function buildLocalSqlFileContent(_0x23ae55,_0x1b8abd,_0x29d375){const _0x314422=a214_0x34a22e,_0x4f74ba=_0x29d375?.[_0x314422(0x7a)]??detectSqlMode(_0x1b8abd),_0xcf72a5=stripLocalSqlMetadata(_0x1b8abd,_0x4f74ba)[_0x314422(0x8f)](),_0x33af9f=[...buildMetadataHeaderLines({'sqlCode':_0x23ae55[_0x314422(0x72)],'sqlName':_0x23ae55[_0x314422(0x95)],'dbId':_0x23ae55['dbId'],'dbName':_0x29d375?.[_0x314422(0x88)],'mode':_0x4f74ba,'syncedAt':_0x29d375?.['syncedAt'],'description':_0x29d375?.[_0x314422(0x86)]},_0x4f74ba),'',_0xcf72a5],_0x39aa04=_0x33af9f['join']('\x0a');return _0x39aa04[_0x314422(0x7b)]('\x0a')?_0x39aa04:_0x39aa04+'\x0a';}function a214_0x28e4(_0x1045af,_0x175a22){_0x1045af=_0x1045af-0x6d;const _0x3a9d48=a214_0x3a9d();let _0x28e47c=_0x3a9d48[_0x1045af];return _0x28e47c;}export function stripLocalSqlMetadata(_0x4b7394,_0xca3218){const _0x1c36ef=a214_0x34a22e,_0xbb8fe6=_0x4b7394[_0x1c36ef(0x75)](/\r\n/g,'\x0a')[_0x1c36ef(0x71)]('\x0a'),_0x5521fa=[];let _0x262244=0x0;if(_0xca3218===_0x1c36ef(0x79))while(_0x262244<_0xbb8fe6[_0x1c36ef(0x91)]){const _0x42f32d=_0xbb8fe6[_0x262244]??'';if(/^\s*<!--\s*@lovrabet\./[_0x1c36ef(0x7d)](_0x42f32d)){_0x262244++;continue;}if(_0x42f32d['trim']()===''&&_0x262244>0x0){_0x262244++;continue;}break;}else while(_0x262244<_0xbb8fe6['length']){const _0x5aec64=_0xbb8fe6[_0x262244]??'';if(/^\s*--\s*@lovrabet\./[_0x1c36ef(0x7d)](_0x5aec64)){_0x262244++;continue;}if(_0x5aec64['trim']()===''&&_0x262244>0x0){_0x262244++;continue;}break;}for(;_0x262244<_0xbb8fe6[_0x1c36ef(0x91)];_0x262244++){_0x5521fa['push'](_0xbb8fe6[_0x262244]);}return _0x5521fa[_0x1c36ef(0x85)]('\x0a')[_0x1c36ef(0x7c)]();}export function resolveSqlMode(_0x1d5f93,_0x1ea8ae){const _0x29ab96=a214_0x34a22e;if(_0x1ea8ae?.[_0x29ab96(0x7a)])return _0x1ea8ae[_0x29ab96(0x7a)];return detectSqlMode(_0x1d5f93);}export function resolveSqlFileName(_0x2f557e,_0x5c5d6a,_0x7bc1db){const _0x2cd3dd=a214_0x34a22e;if(_0x7bc1db?.[_0x2cd3dd(0x92)])return _0x7bc1db[_0x2cd3dd(0x92)];if(_0x7bc1db?.['sqlName']||_0x7bc1db?.[_0x2cd3dd(0x88)])return buildSqlRelativePath(_0x2f557e,_0x7bc1db?.[_0x2cd3dd(0x95)],_0x7bc1db?.[_0x2cd3dd(0x88)],resolveSqlMode(_0x5c5d6a,_0x7bc1db),_0x7bc1db?.[_0x2cd3dd(0x8d)]);return buildDefaultSqlFileName(_0x2f557e,resolveSqlMode(_0x5c5d6a,_0x7bc1db));}export function resolveSqlLocalDir(_0x1b03d4,_0x10da76){return join(_0x1b03d4,SQL_LOCAL_REL_DIR,_0x10da76);}export async function confirmForceOverwrite(_0x13d00f){const _0x11e43e=a214_0x34a22e,_0x12cb7a=createInterface({'input':process['stdin'],'output':process['stderr']}),_0x18f3ad=await new Promise(_0xebdae2=>{const _0x2fa8ba=a214_0x28e4;_0x12cb7a[_0x2fa8ba(0x87)](_0x13d00f+_0x2fa8ba(0x82),_0xebdae2);});return _0x12cb7a[_0x11e43e(0x6d)](),['y','yes'][_0x11e43e(0x70)](_0x18f3ad[_0x11e43e(0x8f)]()[_0x11e43e(0x94)]());}export function findSqlLockScope(_0x1aa20e,_0x134467){const _0x47115b=a214_0x34a22e;return _0x1aa20e[_0x47115b(0x8c)][_0x134467];}function buildMetadataHeaderLines(_0x46fe52,_0x1b31c8){const _0x439d9c=a214_0x34a22e,_0x3d3ac4=[[_0x439d9c(0x72),_0x46fe52[_0x439d9c(0x72)]],['sqlName',_0x46fe52['sqlName']],[_0x439d9c(0x8d),_0x46fe52['dbId']],[_0x439d9c(0x88),_0x46fe52[_0x439d9c(0x88)]],[_0x439d9c(0x7a),_0x46fe52[_0x439d9c(0x7a)]],['syncedAt',_0x46fe52['syncedAt']],['description',_0x46fe52[_0x439d9c(0x86)]]];if(_0x1b31c8===_0x439d9c(0x79))return _0x3d3ac4[_0x439d9c(0x93)](([,_0x27885a])=>_0x27885a!==undefined&&_0x27885a!==null&&String(_0x27885a)['trim']()!=='')['map'](([_0x54f2a2,_0x1242bd])=>'<!--\x20@lovrabet.'+_0x54f2a2+':\x20'+String(_0x1242bd)+'\x20-->');return _0x3d3ac4['filter'](([,_0x185847])=>_0x185847!==undefined&&_0x185847!==null&&String(_0x185847)[_0x439d9c(0x8f)]()!=='')[_0x439d9c(0x6f)](([_0xf67b99,_0x1d0409])=>_0x439d9c(0x81)+_0xf67b99+':\x20'+String(_0x1d0409));}
1
+ const a239_0x8f4c4c=a239_0x4d7b;(function(_0x542459,_0x3a3084){const _0x2df8c1=a239_0x4d7b,_0x17813f=_0x542459();while(!![]){try{const _0x3007c0=parseInt(_0x2df8c1(0x1b1))/0x1*(parseInt(_0x2df8c1(0x1bf))/0x2)+-parseInt(_0x2df8c1(0x1b0))/0x3*(-parseInt(_0x2df8c1(0x1ca))/0x4)+parseInt(_0x2df8c1(0x1d0))/0x5+parseInt(_0x2df8c1(0x1a7))/0x6+parseInt(_0x2df8c1(0x1b7))/0x7*(-parseInt(_0x2df8c1(0x1ba))/0x8)+-parseInt(_0x2df8c1(0x1ae))/0x9*(parseInt(_0x2df8c1(0x1b5))/0xa)+parseInt(_0x2df8c1(0x1bd))/0xb*(-parseInt(_0x2df8c1(0x1a3))/0xc);if(_0x3007c0===_0x3a3084)break;else _0x17813f['push'](_0x17813f['shift']());}catch(_0x391510){_0x17813f['push'](_0x17813f['shift']());}}}(a239_0x39dc,0x1cd9c));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=a239_0x8f4c4c(0x1cd);function a239_0x39dc(){const _0x3c9f95=['mybatisXml','join','5962icoyhe','syncedAt','2zSDcFD','sqls','trim','version','sqlRoot','push','\x20[y/N]\x20','\x20-->','lastSync','<!--\x20@lovrabet.','toLowerCase','9988AqruLi','dbName','dbId','.rabetbase/sql','stdin','trimStart','782475sPizyS','path','3732WoBbHC','filter','description','sqlCode','377724ajbhWZ','question','close','sqlName','includes','split','map','9ktttKG','test','111yjTVAZ','109411jbGKzh','sqlContent','apps','length','952530TqtPbX','--\x20@lovrabet.','469cijvGB','yes','mode','4688yEjnCT'];a239_0x39dc=function(){return _0x3c9f95;};return a239_0x39dc();}export function buildSqlLockEntry(_0xd47fd6,_0x5de639,_0x542500,_0x46d1f8){const _0x2fa0a9=a239_0x8f4c4c,_0x48d062=detectSqlMode(_0x5de639);return{'path':buildSqlRelativePath(_0xd47fd6[_0x2fa0a9(0x1a6)],_0xd47fd6[_0x2fa0a9(0x1aa)],_0x46d1f8?.[_0x2fa0a9(0x1cb)],_0x48d062,_0xd47fd6[_0x2fa0a9(0x1cc)]),'hash':_0x542500,'remoteId':_0xd47fd6['id'],'version':_0xd47fd6[_0x2fa0a9(0x1c2)],'dbId':Number(_0xd47fd6[_0x2fa0a9(0x1cc)]),'dbName':_0x46d1f8?.[_0x2fa0a9(0x1cb)],'sqlName':_0xd47fd6['sqlName'],'sqlConfig':_0xd47fd6['sqlConfig']??undefined,'mode':_0x48d062};}function a239_0x4d7b(_0x34b6f5,_0xbf2db3){_0x34b6f5=_0x34b6f5-0x1a2;const _0x39dc04=a239_0x39dc();let _0x4d7be0=_0x39dc04[_0x34b6f5];return _0x4d7be0;}export function cloneSqlLockData(_0x163a8a){const _0x481297=a239_0x8f4c4c;return{'apps':Object['fromEntries'](Object['entries'](_0x163a8a[_0x481297(0x1b3)])[_0x481297(0x1ad)](([_0x4e311f,_0x2acc99])=>[_0x4e311f,{'sqlRoot':_0x2acc99[_0x481297(0x1c3)],'lastSync':_0x2acc99[_0x481297(0x1c7)],'sqls':{..._0x2acc99[_0x481297(0x1c0)]}}]))};}export function ensureRemoteSqlContent(_0x2a850d){const _0x3f9197=a239_0x8f4c4c;return _0x2a850d[_0x3f9197(0x1b2)]??'';}export function buildLocalSqlFileContent(_0x3c4492,_0x9a8752,_0x357300){const _0x47af58=a239_0x8f4c4c,_0x52963e=_0x357300?.[_0x47af58(0x1b9)]??detectSqlMode(_0x9a8752),_0x5e9d1b=stripLocalSqlMetadata(_0x9a8752,_0x52963e)[_0x47af58(0x1c1)](),_0x5c5013=[...buildMetadataHeaderLines({'sqlCode':_0x3c4492[_0x47af58(0x1a6)],'sqlName':_0x3c4492['sqlName'],'dbId':_0x3c4492[_0x47af58(0x1cc)],'dbName':_0x357300?.[_0x47af58(0x1cb)],'mode':_0x52963e,'syncedAt':_0x357300?.[_0x47af58(0x1be)],'description':_0x357300?.['description']},_0x52963e),'',_0x5e9d1b],_0x56b625=_0x5c5013[_0x47af58(0x1bc)]('\x0a');return _0x56b625['endsWith']('\x0a')?_0x56b625:_0x56b625+'\x0a';}export function stripLocalSqlMetadata(_0x3e0192,_0x1d8c93){const _0x4df0aa=a239_0x8f4c4c,_0x471de3=_0x3e0192['replace'](/\r\n/g,'\x0a')[_0x4df0aa(0x1ac)]('\x0a'),_0x3536ab=[];let _0x148b73=0x0;if(_0x1d8c93===_0x4df0aa(0x1bb))while(_0x148b73<_0x471de3[_0x4df0aa(0x1b4)]){const _0x394083=_0x471de3[_0x148b73]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x394083)){_0x148b73++;continue;}if(_0x394083[_0x4df0aa(0x1c1)]()===''&&_0x148b73>0x0){_0x148b73++;continue;}break;}else while(_0x148b73<_0x471de3[_0x4df0aa(0x1b4)]){const _0x39905b=_0x471de3[_0x148b73]??'';if(/^\s*--\s*@lovrabet\./[_0x4df0aa(0x1af)](_0x39905b)){_0x148b73++;continue;}if(_0x39905b[_0x4df0aa(0x1c1)]()===''&&_0x148b73>0x0){_0x148b73++;continue;}break;}for(;_0x148b73<_0x471de3[_0x4df0aa(0x1b4)];_0x148b73++){_0x3536ab[_0x4df0aa(0x1c4)](_0x471de3[_0x148b73]);}return _0x3536ab[_0x4df0aa(0x1bc)]('\x0a')[_0x4df0aa(0x1cf)]();}export function resolveSqlMode(_0x268e2b,_0x1188a2){const _0x14c337=a239_0x8f4c4c;if(_0x1188a2?.[_0x14c337(0x1b9)])return _0x1188a2[_0x14c337(0x1b9)];return detectSqlMode(_0x268e2b);}export function resolveSqlFileName(_0x591e42,_0x4ca0a8,_0x2f3183){const _0x45f4f0=a239_0x8f4c4c;if(_0x2f3183?.[_0x45f4f0(0x1a2)])return _0x2f3183['path'];if(_0x2f3183?.[_0x45f4f0(0x1aa)]||_0x2f3183?.['dbName'])return buildSqlRelativePath(_0x591e42,_0x2f3183?.[_0x45f4f0(0x1aa)],_0x2f3183?.['dbName'],resolveSqlMode(_0x4ca0a8,_0x2f3183),_0x2f3183?.[_0x45f4f0(0x1cc)]);return buildDefaultSqlFileName(_0x591e42,resolveSqlMode(_0x4ca0a8,_0x2f3183));}export function resolveSqlLocalDir(_0x1d36c1,_0x14032b){return join(_0x1d36c1,SQL_LOCAL_REL_DIR,_0x14032b);}export async function confirmForceOverwrite(_0x4e20c4){const _0x54b665=a239_0x8f4c4c,_0x58f18d=createInterface({'input':process[_0x54b665(0x1ce)],'output':process['stderr']}),_0x191e44=await new Promise(_0x226f77=>{const _0x25e5e6=_0x54b665;_0x58f18d[_0x25e5e6(0x1a8)](_0x4e20c4+_0x25e5e6(0x1c5),_0x226f77);});return _0x58f18d[_0x54b665(0x1a9)](),['y',_0x54b665(0x1b8)][_0x54b665(0x1ab)](_0x191e44[_0x54b665(0x1c1)]()[_0x54b665(0x1c9)]());}export function findSqlLockScope(_0x16d9c0,_0x224da7){const _0x3dbb63=a239_0x8f4c4c;return _0x16d9c0[_0x3dbb63(0x1b3)][_0x224da7];}function buildMetadataHeaderLines(_0x592cc1,_0x18cdfd){const _0x8d3baa=a239_0x8f4c4c,_0x3ddae6=[[_0x8d3baa(0x1a6),_0x592cc1['sqlCode']],[_0x8d3baa(0x1aa),_0x592cc1['sqlName']],[_0x8d3baa(0x1cc),_0x592cc1[_0x8d3baa(0x1cc)]],[_0x8d3baa(0x1cb),_0x592cc1[_0x8d3baa(0x1cb)]],[_0x8d3baa(0x1b9),_0x592cc1[_0x8d3baa(0x1b9)]],[_0x8d3baa(0x1be),_0x592cc1[_0x8d3baa(0x1be)]],[_0x8d3baa(0x1a5),_0x592cc1[_0x8d3baa(0x1a5)]]];if(_0x18cdfd===_0x8d3baa(0x1bb))return _0x3ddae6[_0x8d3baa(0x1a4)](([,_0x5d28d7])=>_0x5d28d7!==undefined&&_0x5d28d7!==null&&String(_0x5d28d7)[_0x8d3baa(0x1c1)]()!=='')['map'](([_0x41a99c,_0xc93a23])=>_0x8d3baa(0x1c8)+_0x41a99c+':\x20'+String(_0xc93a23)+_0x8d3baa(0x1c6));return _0x3ddae6['filter'](([,_0x28a37b])=>_0x28a37b!==undefined&&_0x28a37b!==null&&String(_0x28a37b)['trim']()!=='')['map'](([_0x258cda,_0x3ed92a])=>_0x8d3baa(0x1b6)+_0x258cda+':\x20'+String(_0x3ed92a));}
@@ -1 +1 @@
1
- const a215_0x255533=a215_0x15a4;function a215_0x15a4(_0x5c3296,_0x4b733e){_0x5c3296=_0x5c3296-0x1d1;const _0x1b193f=a215_0x1b19();let _0x15a422=_0x1b193f[_0x5c3296];return _0x15a422;}(function(_0x53e824,_0x32109a){const _0x1dc62f=a215_0x15a4,_0x50fbd2=_0x53e824();while(!![]){try{const _0x3aa149=parseInt(_0x1dc62f(0x1e1))/0x1*(parseInt(_0x1dc62f(0x1e6))/0x2)+-parseInt(_0x1dc62f(0x1d4))/0x3+parseInt(_0x1dc62f(0x1ed))/0x4+-parseInt(_0x1dc62f(0x1d5))/0x5*(-parseInt(_0x1dc62f(0x1e8))/0x6)+parseInt(_0x1dc62f(0x1f4))/0x7+-parseInt(_0x1dc62f(0x1ec))/0x8+-parseInt(_0x1dc62f(0x1f1))/0x9*(parseInt(_0x1dc62f(0x1e4))/0xa);if(_0x3aa149===_0x32109a)break;else _0x50fbd2['push'](_0x50fbd2['shift']());}catch(_0x55909c){_0x50fbd2['push'](_0x50fbd2['shift']());}}}(a215_0x1b19,0x28cde));function a215_0x1b19(){const _0x572ea2=['boolean','33618jnHBAh','lockFilePath','has','push','2667240akmsVY','913792slTBqp','path','sqls','map','81vtIrfi','lockKey','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','1166872yCGsDL','All\x20SQL\x20queries\x20are\x20in\x20sync.','\x20added,\x20','keys','43443iTxTMb','165SbjPYz','hash','relativePath','remote','\x20unchanged','totalCount','sqlCode','filePath','sqlName','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','\x20remote-only','tableData','81974aWBvQb','length','appCode','163330tUMLUP','status','2JadHdE'];a215_0x1b19=function(){return _0x572ea2;};return a215_0x1b19();}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(_0x169468){const _0x574830=a215_0x15a4,_0xfbf881=[];let _0x256634=0x1;while(!![]){const _0x74a35b=await listSqlQueries(_0x169468,{'currentPage':_0x256634,'pageSize':PAGE_SIZE}),_0x4dc16d=_0x74a35b[_0x574830(0x1e0)]??[];_0xfbf881['push'](..._0x4dc16d[_0x574830(0x1f0)](_0x200fc6=>_0x200fc6[_0x574830(0x1db)]));if(_0x4dc16d[_0x574830(0x1e2)]===0x0)break;const _0x192dbc=_0x74a35b['paging']?.[_0x574830(0x1da)];if(_0x192dbc!=null?_0xfbf881[_0x574830(0x1e2)]>=_0x192dbc:_0x4dc16d[_0x574830(0x1e2)]<PAGE_SIZE)break;_0x256634++;}return _0xfbf881;}export const sqlStatus={'service':'sql','command':a215_0x255533(0x1e5),'description':a215_0x255533(0x1f3),'risk':'read','flags':[{'name':'remote','type':a215_0x255533(0x1e7),'description':a215_0x255533(0x1de)}],async 'execute'(_0x5b977){const _0x3919cb=a215_0x255533,_0x46d933=loadSqlProjectConfig(_0x5b977['appCode']),_0x3adb4f=await readSqlLockFile(_0x46d933[_0x3919cb(0x1e9)]),{appLock:_0x1cdfa8}=ensureSqlLockScope(_0x3adb4f??createEmptySqlLock(),_0x46d933['appCode'],_0x46d933['sqlRoot'],'status'),_0x4b7ca0=await scanLocalSqlQueries(_0x46d933),_0x253b9a=[],_0x20acfb=[],_0x261a8f=[],_0x4418e0=[],_0x11e8a2=new Set(_0x4b7ca0['map'](_0x182ed5=>_0x182ed5[_0x3919cb(0x1f2)]));for(const _0x3c38a3 of _0x4b7ca0){const _0x34bb0b=await computeSqlFileHash(_0x3c38a3[_0x3919cb(0x1dc)]),_0x22770e=_0x1cdfa8['sqls'][_0x3c38a3[_0x3919cb(0x1f2)]],_0x50dfa7=!!_0x22770e&&_0x22770e[_0x3919cb(0x1ee)]!==_0x3c38a3[_0x3919cb(0x1d7)],_0x235d95=!!_0x22770e&&!!_0x3c38a3[_0x3919cb(0x1dd)]&&_0x22770e['sqlName']!==_0x3c38a3[_0x3919cb(0x1dd)];if(!_0x22770e)_0x253b9a[_0x3919cb(0x1eb)](_0x3c38a3[_0x3919cb(0x1f2)]);else _0x22770e[_0x3919cb(0x1d6)]!==_0x34bb0b||_0x50dfa7||_0x235d95?_0x20acfb['push'](_0x3c38a3[_0x3919cb(0x1f2)]):_0x261a8f[_0x3919cb(0x1eb)](_0x3c38a3[_0x3919cb(0x1f2)]);}for(const _0x4cb7fa of Object[_0x3919cb(0x1d3)](_0x1cdfa8[_0x3919cb(0x1ef)])){!_0x11e8a2[_0x3919cb(0x1ea)](_0x4cb7fa)&&_0x4418e0['push'](_0x4cb7fa);}const _0x2fb03c=[];if(_0x5b977['bool'](_0x3919cb(0x1d8))){const _0x532267=await fetchAllSqlCodes(_0x5b977[_0x3919cb(0x1e3)]);for(const _0x555d71 of _0x532267){!_0x11e8a2[_0x3919cb(0x1ea)](_0x555d71)&&!_0x1cdfa8['sqls'][_0x555d71]&&_0x2fb03c['push'](_0x555d71);}}const _0x25c839=_0x253b9a[_0x3919cb(0x1e2)]===0x0&&_0x20acfb['length']===0x0&&_0x4418e0[_0x3919cb(0x1e2)]===0x0&&_0x2fb03c['length']===0x0;return{'ok':!![],'data':{'added':_0x253b9a,'modified':_0x20acfb,'missing':_0x4418e0,'unchanged':_0x261a8f,'remoteOnly':_0x2fb03c},'message':_0x25c839?_0x3919cb(0x1d1):_0x253b9a[_0x3919cb(0x1e2)]+_0x3919cb(0x1d2)+_0x20acfb[_0x3919cb(0x1e2)]+'\x20modified,\x20'+_0x4418e0[_0x3919cb(0x1e2)]+'\x20missing,\x20'+_0x261a8f[_0x3919cb(0x1e2)]+_0x3919cb(0x1d9)+(_0x2fb03c[_0x3919cb(0x1e2)]>0x0?',\x20'+_0x2fb03c[_0x3919cb(0x1e2)]+_0x3919cb(0x1df):'')};}};
1
+ const a240_0x38b08d=a240_0x38bd;(function(_0x1787ea,_0x33361d){const _0x2c5c73=a240_0x38bd,_0x43cf5b=_0x1787ea();while(!![]){try{const _0xf19c59=-parseInt(_0x2c5c73(0x1ef))/0x1+parseInt(_0x2c5c73(0x1fc))/0x2*(-parseInt(_0x2c5c73(0x1f9))/0x3)+-parseInt(_0x2c5c73(0x20a))/0x4+parseInt(_0x2c5c73(0x200))/0x5+-parseInt(_0x2c5c73(0x204))/0x6*(parseInt(_0x2c5c73(0x1ee))/0x7)+parseInt(_0x2c5c73(0x1f2))/0x8+-parseInt(_0x2c5c73(0x207))/0x9*(parseInt(_0x2c5c73(0x201))/0xa);if(_0xf19c59===_0x33361d)break;else _0x43cf5b['push'](_0x43cf5b['shift']());}catch(_0x2d8c16){_0x43cf5b['push'](_0x43cf5b['shift']());}}}(a240_0x51f9,0x4d9eb));function a240_0x51f9(){const _0x320bf3=['read','remote','appCode','3149985lQvMEt','1007150MvCltL','sqls','lockKey','6eVldVz','totalCount','has','9damded','\x20added,\x20','path','1509356fGfVLc','map','\x20unchanged','sqlCode','status','649089nInKPP','326401ceeMHr','keys','filePath','4765512xAkhcp','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','push','lockFilePath','sqlRoot','\x20modified,\x20','All\x20SQL\x20queries\x20are\x20in\x20sync.','31719riuJwB','length','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','2arChKR'];a240_0x51f9=function(){return _0x320bf3;};return a240_0x51f9();}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;function a240_0x38bd(_0x536f2b,_0x45aa35){_0x536f2b=_0x536f2b-0x1ea;const _0x51f93d=a240_0x51f9();let _0x38bd80=_0x51f93d[_0x536f2b];return _0x38bd80;}async function fetchAllSqlCodes(_0x453d8b){const _0x9f447e=a240_0x38bd,_0x524b70=[];let _0x4c12f7=0x1;while(!![]){const _0x180355=await listSqlQueries(_0x453d8b,{'currentPage':_0x4c12f7,'pageSize':PAGE_SIZE}),_0x3d55f1=_0x180355['tableData']??[];_0x524b70[_0x9f447e(0x1f4)](..._0x3d55f1[_0x9f447e(0x1ea)](_0x195196=>_0x195196[_0x9f447e(0x1ec)]));if(_0x3d55f1[_0x9f447e(0x1fa)]===0x0)break;const _0x2ccccc=_0x180355['paging']?.[_0x9f447e(0x205)];if(_0x2ccccc!=null?_0x524b70['length']>=_0x2ccccc:_0x3d55f1[_0x9f447e(0x1fa)]<PAGE_SIZE)break;_0x4c12f7++;}return _0x524b70;}export const sqlStatus={'service':'sql','command':a240_0x38b08d(0x1ed),'description':a240_0x38b08d(0x1fb),'risk':a240_0x38b08d(0x1fd),'flags':[{'name':a240_0x38b08d(0x1fe),'type':'boolean','description':a240_0x38b08d(0x1f3)}],async 'execute'(_0x401bd3){const _0x2f248b=a240_0x38b08d,_0x4702ed=loadSqlProjectConfig(_0x401bd3[_0x2f248b(0x1ff)]),_0x266c8e=await readSqlLockFile(_0x4702ed[_0x2f248b(0x1f5)]),{appLock:_0x54a887}=ensureSqlLockScope(_0x266c8e??createEmptySqlLock(),_0x4702ed[_0x2f248b(0x1ff)],_0x4702ed[_0x2f248b(0x1f6)],_0x2f248b(0x1ed)),_0xfd731c=await scanLocalSqlQueries(_0x4702ed),_0x5107a1=[],_0x1527c1=[],_0x4b16f8=[],_0x4ba2a7=[],_0x2a4ca3=new Set(_0xfd731c['map'](_0x1cfd57=>_0x1cfd57[_0x2f248b(0x203)]));for(const _0x3985a0 of _0xfd731c){const _0x43b6d7=await computeSqlFileHash(_0x3985a0[_0x2f248b(0x1f1)]),_0x286d85=_0x54a887[_0x2f248b(0x202)][_0x3985a0['lockKey']],_0x292064=!!_0x286d85&&_0x286d85[_0x2f248b(0x209)]!==_0x3985a0['relativePath'],_0x33272f=!!_0x286d85&&!!_0x3985a0['sqlName']&&_0x286d85['sqlName']!==_0x3985a0['sqlName'];if(!_0x286d85)_0x5107a1['push'](_0x3985a0[_0x2f248b(0x203)]);else _0x286d85['hash']!==_0x43b6d7||_0x292064||_0x33272f?_0x1527c1[_0x2f248b(0x1f4)](_0x3985a0['lockKey']):_0x4b16f8[_0x2f248b(0x1f4)](_0x3985a0[_0x2f248b(0x203)]);}for(const _0x7adf86 of Object[_0x2f248b(0x1f0)](_0x54a887['sqls'])){!_0x2a4ca3[_0x2f248b(0x206)](_0x7adf86)&&_0x4ba2a7[_0x2f248b(0x1f4)](_0x7adf86);}const _0x42e6bb=[];if(_0x401bd3['bool']('remote')){const _0x4f0f31=await fetchAllSqlCodes(_0x401bd3[_0x2f248b(0x1ff)]);for(const _0x2fc8ad of _0x4f0f31){!_0x2a4ca3[_0x2f248b(0x206)](_0x2fc8ad)&&!_0x54a887[_0x2f248b(0x202)][_0x2fc8ad]&&_0x42e6bb[_0x2f248b(0x1f4)](_0x2fc8ad);}}const _0xd71c37=_0x5107a1[_0x2f248b(0x1fa)]===0x0&&_0x1527c1['length']===0x0&&_0x4ba2a7[_0x2f248b(0x1fa)]===0x0&&_0x42e6bb[_0x2f248b(0x1fa)]===0x0;return{'ok':!![],'data':{'added':_0x5107a1,'modified':_0x1527c1,'missing':_0x4ba2a7,'unchanged':_0x4b16f8,'remoteOnly':_0x42e6bb},'message':_0xd71c37?_0x2f248b(0x1f8):_0x5107a1[_0x2f248b(0x1fa)]+_0x2f248b(0x208)+_0x1527c1[_0x2f248b(0x1fa)]+_0x2f248b(0x1f7)+_0x4ba2a7['length']+'\x20missing,\x20'+_0x4b16f8[_0x2f248b(0x1fa)]+_0x2f248b(0x1eb)+(_0x42e6bb[_0x2f248b(0x1fa)]>0x0?',\x20'+_0x42e6bb[_0x2f248b(0x1fa)]+'\x20remote-only':'')};}};
@@ -1 +1 @@
1
- const a216_0x4ff32a=a216_0x250d;function a216_0x250d(_0x1b16ed,_0x2582ff){_0x1b16ed=_0x1b16ed-0x6d;const _0x391c1b=a216_0x391c();let _0x250d14=_0x391c1b[_0x1b16ed];return _0x250d14;}(function(_0x248243,_0x2ecc70){const _0x7025b2=a216_0x250d,_0x32cc1b=_0x248243();while(!![]){try{const _0xbd4c80=parseInt(_0x7025b2(0x92))/0x1*(parseInt(_0x7025b2(0x97))/0x2)+parseInt(_0x7025b2(0x72))/0x3*(-parseInt(_0x7025b2(0x6d))/0x4)+-parseInt(_0x7025b2(0x78))/0x5*(-parseInt(_0x7025b2(0x6f))/0x6)+parseInt(_0x7025b2(0xa9))/0x7+parseInt(_0x7025b2(0x83))/0x8*(-parseInt(_0x7025b2(0x86))/0x9)+parseInt(_0x7025b2(0x8a))/0xa*(parseInt(_0x7025b2(0x7b))/0xb)+parseInt(_0x7025b2(0x90))/0xc*(parseInt(_0x7025b2(0xab))/0xd);if(_0xbd4c80===_0x2ecc70)break;else _0x32cc1b['push'](_0x32cc1b['shift']());}catch(_0x5de944){_0x32cc1b['push'](_0x32cc1b['shift']());}}}(a216_0x391c,0x3078c));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';function a216_0x391c(){const _0x363a3a=['bool','validation','trim','660JNpllx','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','\x22\x20not\x20found\x20in\x20any\x20dataset','type','read','valid','11844vZbgIf','columns','111811QibuHE','Dataset\x20\x22','sqlType','validate','dbtableConfig','2GQFymq','isArray','filter','dataset','name','find','columnNames','parameters','toLowerCase','check-indexes','indexName','fields','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','push','tableName','flatMap','indexes','tables','368809GAoOwF','str','4745EuAzWd','--check-indexes\x20requires\x20--schemas.','flagMissing','split','get','unshift','reason','appCode','357288Wuxpdy','pkField','269538wKmJAa','index_name','sql','9eoQBpU','from','Table\x20\x22','string','message','size','5TRKLnp','length','Provide\x20--file\x20or\x20--sql','46673BNZtXF','utf-8','schema:','\x22\x20not\x20found\x20or\x20not\x20accessible','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','isDangerous','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','file','54744NJjNWM','isSelectOnly','map','504lDzGFm'];a216_0x391c=function(){return _0x363a3a;};return a216_0x391c();}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_0x4ff32a(0x71),'command':a216_0x4ff32a(0x95),'description':a216_0x4ff32a(0xa3),'risk':a216_0x4ff32a(0x8e),'flags':[{'name':a216_0x4ff32a(0x82),'type':a216_0x4ff32a(0x75),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a216_0x4ff32a(0x71),'type':a216_0x4ff32a(0x75),'description':a216_0x4ff32a(0x7f)},{'name':'schemas','type':'string','description':a216_0x4ff32a(0x8b)},{'name':a216_0x4ff32a(0xa0),'type':'boolean','description':a216_0x4ff32a(0x81)}],async 'execute'(_0xe82334){const _0x215afb=a216_0x4ff32a,_0x1c6d6b=_0xe82334[_0x215afb(0xaa)]('file'),_0x290d86=_0xe82334[_0x215afb(0xaa)](_0x215afb(0x71)),_0x1bb209=_0xe82334[_0x215afb(0xaa)]('schemas'),_0x576759=_0xe82334[_0x215afb(0x87)]('check-indexes');if(!_0x1c6d6b&&!_0x290d86)throw CliErrors[_0x215afb(0xad)]('file',_0x215afb(0x7a));if(_0x576759&&!_0x1bb209)throw CliErrors['validation'](_0x215afb(0xac));let _0x264901;if(_0x1c6d6b){const _0x3f4bfb=resolve(process['cwd'](),_0x1c6d6b);if(!existsSync(_0x3f4bfb))throw CliErrors[_0x215afb(0x88)]('File\x20not\x20found:\x20'+_0x3f4bfb);_0x264901=readFileSync(_0x3f4bfb,_0x215afb(0x7c));}else _0x264901=_0x290d86;const _0x92ac9e=validateSql(_0x264901),_0x46e684={'valid':_0x92ac9e[_0x215afb(0x8f)],'sqlType':_0x92ac9e[_0x215afb(0x94)][_0x215afb(0x8d)],'isSelectOnly':_0x92ac9e[_0x215afb(0x94)][_0x215afb(0x84)],'isDangerous':_0x92ac9e['sqlType'][_0x215afb(0x80)],'tables':_0x92ac9e[_0x215afb(0xa8)],'parameters':_0x92ac9e[_0x215afb(0x9e)],'message':_0x92ac9e[_0x215afb(0x76)]};_0x92ac9e[_0x215afb(0x94)][_0x215afb(0xb1)]&&(_0x46e684[_0x215afb(0xb1)]=_0x92ac9e[_0x215afb(0x94)][_0x215afb(0xb1)]);if(_0x1bb209&&_0x92ac9e[_0x215afb(0x8f)]){const _0x54bed3=_0x1bb209[_0x215afb(0xae)](',')[_0x215afb(0x85)](_0x113dad=>_0x113dad[_0x215afb(0x89)]())[_0x215afb(0x99)](Boolean),_0x1897b6=[],_0x3ee826=[],_0xc83c1f=filterDbTableBackedDatasets(await listDatasets(_0xe82334[_0x215afb(0xb2)])),_0x242fee=new Map(_0xc83c1f[_0x215afb(0x85)](_0x479649=>[_0x479649['dbtableConfig']?.['tableName']?.[_0x215afb(0x9f)](),_0x479649]));for(const _0x28e9ba of _0x92ac9e[_0x215afb(0xa8)]){const _0x475ab8=_0x242fee[_0x215afb(0xaf)](_0x28e9ba[_0x215afb(0x9f)]());!_0x475ab8&&_0x1897b6[_0x215afb(0xa4)](_0x215afb(0x74)+_0x28e9ba+_0x215afb(0x8c));}for(const _0x139093 of _0x54bed3){let _0x16e825;try{_0x16e825=await getDatasetDetail(_0x139093);}catch{_0x1897b6[_0x215afb(0xa4)](_0x215afb(0x93)+_0x139093+_0x215afb(0x7e));continue;}assertDatasetIsDbTableBacked(_0x16e825,'SQL\x20schema\x20validation');const _0xd2f3fc=Array[_0x215afb(0x98)](_0x16e825[_0x215afb(0xa2)])?_0x16e825[_0x215afb(0xa2)]:[],_0x1d6560=new Set(_0xd2f3fc['map'](_0x483336=>_0x483336[_0x215afb(0x9b)]?.[_0x215afb(0x9f)]())),_0x7620b9=_0x16e825[_0x215afb(0x96)]?.[_0x215afb(0xa5)]||_0x16e825['tableName']||_0x139093;_0x46e684[_0x215afb(0x7d)+_0x7620b9]={'code':_0x139093,'tableName':_0x7620b9,'fieldCount':_0x1d6560[_0x215afb(0x77)],'fields':Array[_0x215afb(0x73)](_0x1d6560)};if(_0x576759){const _0x258e3c=normalizeDatasetIndexes(_0x16e825);_0x3ee826[_0x215afb(0xa4)]({'tableName':_0x7620b9,..._0x258e3c});}}_0x1897b6[_0x215afb(0x79)]>0x0&&(_0x46e684['schemaWarnings']=_0x1897b6),_0x576759&&(_0x46e684['joinAudit']=auditSqlJoinIndexes(_0x264901,_0x3ee826));}return{'ok':_0x92ac9e[_0x215afb(0x8f)],'data':_0x46e684,'message':_0x92ac9e[_0x215afb(0x76)]};}};function normalizeDatasetIndexes(_0x226184){const _0x9928c8=a216_0x4ff32a,_0x11274e=Array[_0x9928c8(0x98)](_0x226184?.[_0x9928c8(0x9a)]?.['indexes'])?_0x226184[_0x9928c8(0x9a)][_0x9928c8(0xa7)]:Array[_0x9928c8(0x98)](_0x226184?.[_0x9928c8(0xa7)])?_0x226184[_0x9928c8(0xa7)]:[],_0x2a10de=_0x11274e[_0x9928c8(0xa6)](_0x24cf14=>{const _0x5845b6=_0x9928c8,_0x14d714=Array[_0x5845b6(0x98)](_0x24cf14?.['index_columns'])?_0x24cf14['index_columns']:Array[_0x5845b6(0x98)](_0x24cf14?.['columnNames'])?_0x24cf14[_0x5845b6(0x9d)]:Array[_0x5845b6(0x98)](_0x24cf14?.[_0x5845b6(0x91)])?_0x24cf14['columns']:[],_0x2f4c1e=_0x14d714[_0x5845b6(0x99)](_0x47c60a=>typeof _0x47c60a===_0x5845b6(0x75))[_0x5845b6(0x85)](_0x377d36=>_0x377d36['trim']())[_0x5845b6(0x99)](Boolean);if(_0x2f4c1e[_0x5845b6(0x79)]===0x0)return[];const _0x441ce2=[_0x24cf14?.[_0x5845b6(0xa1)],_0x24cf14?.[_0x5845b6(0x70)],_0x24cf14?.['name']][_0x5845b6(0x9c)](_0x203825=>typeof _0x203825===_0x5845b6(0x75)&&_0x203825[_0x5845b6(0x89)]()),_0xce7956=[_0x24cf14?.['index_type'],_0x24cf14?.[_0x5845b6(0x8d)]][_0x5845b6(0x9c)](_0x4f3d96=>typeof _0x4f3d96===_0x5845b6(0x75)&&_0x4f3d96['trim']());return[{..._0x441ce2?{'name':_0x441ce2[_0x5845b6(0x89)]()}:{},..._0xce7956?{'type':_0xce7956[_0x5845b6(0x89)]()}:{},'columns':_0x2f4c1e}];}),_0x130940=[..._0x2a10de],_0x31d7cc=typeof _0x226184?.[_0x9928c8(0x96)]?.[_0x9928c8(0x6e)]===_0x9928c8(0x75)?_0x226184['dbtableConfig'][_0x9928c8(0x6e)][_0x9928c8(0xae)](',')[_0x9928c8(0x85)](_0x2271d5=>_0x2271d5[_0x9928c8(0x89)]())[_0x9928c8(0x99)](Boolean):[];return _0x31d7cc[_0x9928c8(0x79)]>0x0&&_0x130940[_0x9928c8(0xb0)]({'type':'primary','columns':_0x31d7cc}),{'indexes':_0x130940,'metadataAvailable':_0x2a10de[_0x9928c8(0x79)]>0x0};}
1
+ const a241_0xe856ee=a241_0x6301;(function(_0x1f5224,_0x196b21){const _0x1e659d=a241_0x6301,_0x3387f4=_0x1f5224();while(!![]){try{const _0x503554=-parseInt(_0x1e659d(0x14a))/0x1*(parseInt(_0x1e659d(0x179))/0x2)+parseInt(_0x1e659d(0x180))/0x3+-parseInt(_0x1e659d(0x16e))/0x4*(parseInt(_0x1e659d(0x163))/0x5)+parseInt(_0x1e659d(0x155))/0x6*(-parseInt(_0x1e659d(0x187))/0x7)+-parseInt(_0x1e659d(0x184))/0x8*(-parseInt(_0x1e659d(0x16d))/0x9)+parseInt(_0x1e659d(0x152))/0xa*(-parseInt(_0x1e659d(0x18f))/0xb)+parseInt(_0x1e659d(0x18c))/0xc*(-parseInt(_0x1e659d(0x16c))/0xd);if(_0x503554===_0x196b21)break;else _0x3387f4['push'](_0x3387f4['shift']());}catch(_0x3cd6e4){_0x3387f4['push'](_0x3387f4['shift']());}}}(a241_0x2100,0x99852));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';function a241_0x2100(){const _0x29ccbd=['16950VUDzsO','dbtableConfig','fields','filter','sql','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','dataset','flagMissing','trim','13qVPTLF','9vfUhLI','12cLxwzb','validation','map','reason','index_type','boolean','SQL\x20schema\x20validation','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','Provide\x20--file\x20or\x20--sql','cwd','\x22\x20not\x20found\x20in\x20any\x20dataset','266IHacKS','indexes','get','length','appCode','parameters','file','2909646aNIldu','bool','columns','flatMap','5489968EGlSbP','tableName','toLowerCase','7ifzaBv','isDangerous','str','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','--check-indexes\x20requires\x20--schemas.','428172ubvhBu','valid','File\x20not\x20found:\x20','167497vcrUWb','tables','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','3863LyArZW','check-indexes','type','message','string','isArray','find','schemaWarnings','210MuuHpq','columnNames','joinAudit','887478XBiext','sqlType','push','name','index_columns','schemas','split','indexName','size','unshift','Table\x20\x22','validate','schema:','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'];a241_0x2100=function(){return _0x29ccbd;};return a241_0x2100();}import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a241_0xe856ee(0x167),'command':a241_0xe856ee(0x160),'description':a241_0xe856ee(0x168),'risk':'read','flags':[{'name':a241_0xe856ee(0x17f),'type':a241_0xe856ee(0x14e),'description':a241_0xe856ee(0x18a)},{'name':a241_0xe856ee(0x167),'type':a241_0xe856ee(0x14e),'description':a241_0xe856ee(0x191)},{'name':a241_0xe856ee(0x15a),'type':a241_0xe856ee(0x14e),'description':a241_0xe856ee(0x175)},{'name':a241_0xe856ee(0x14b),'type':a241_0xe856ee(0x173),'description':a241_0xe856ee(0x162)}],async 'execute'(_0x145653){const _0x4da592=a241_0xe856ee,_0x5ccbb0=_0x145653[_0x4da592(0x189)](_0x4da592(0x17f)),_0x689662=_0x145653['str'](_0x4da592(0x167)),_0x7e3d8e=_0x145653[_0x4da592(0x189)](_0x4da592(0x15a)),_0x1ad17f=_0x145653[_0x4da592(0x181)](_0x4da592(0x14b));if(!_0x5ccbb0&&!_0x689662)throw CliErrors[_0x4da592(0x16a)](_0x4da592(0x17f),_0x4da592(0x176));if(_0x1ad17f&&!_0x7e3d8e)throw CliErrors[_0x4da592(0x16f)](_0x4da592(0x18b));let _0xbf59a5;if(_0x5ccbb0){const _0x501d82=resolve(process[_0x4da592(0x177)](),_0x5ccbb0);if(!existsSync(_0x501d82))throw CliErrors[_0x4da592(0x16f)](_0x4da592(0x18e)+_0x501d82);_0xbf59a5=readFileSync(_0x501d82,'utf-8');}else _0xbf59a5=_0x689662;const _0x3cb810=validateSql(_0xbf59a5),_0x340c9b={'valid':_0x3cb810[_0x4da592(0x18d)],'sqlType':_0x3cb810[_0x4da592(0x156)][_0x4da592(0x14c)],'isSelectOnly':_0x3cb810['sqlType']['isSelectOnly'],'isDangerous':_0x3cb810['sqlType'][_0x4da592(0x188)],'tables':_0x3cb810[_0x4da592(0x190)],'parameters':_0x3cb810[_0x4da592(0x17e)],'message':_0x3cb810[_0x4da592(0x14d)]};_0x3cb810[_0x4da592(0x156)][_0x4da592(0x171)]&&(_0x340c9b[_0x4da592(0x171)]=_0x3cb810[_0x4da592(0x156)]['reason']);if(_0x7e3d8e&&_0x3cb810[_0x4da592(0x18d)]){const _0x263742=_0x7e3d8e[_0x4da592(0x15b)](',')[_0x4da592(0x170)](_0x24122a=>_0x24122a[_0x4da592(0x16b)]())[_0x4da592(0x166)](Boolean),_0x3942d8=[],_0x4237d8=[],_0x303cd5=filterDbTableBackedDatasets(await listDatasets(_0x145653[_0x4da592(0x17d)])),_0xe6513a=new Map(_0x303cd5[_0x4da592(0x170)](_0x1a5cb1=>[_0x1a5cb1[_0x4da592(0x164)]?.[_0x4da592(0x185)]?.[_0x4da592(0x186)](),_0x1a5cb1]));for(const _0x3d7193 of _0x3cb810[_0x4da592(0x190)]){const _0x14130a=_0xe6513a[_0x4da592(0x17b)](_0x3d7193[_0x4da592(0x186)]());!_0x14130a&&_0x3942d8[_0x4da592(0x157)](_0x4da592(0x15f)+_0x3d7193+_0x4da592(0x178));}for(const _0x513f3c of _0x263742){let _0x3268a2;try{_0x3268a2=await getDatasetDetail(_0x513f3c);}catch{_0x3942d8[_0x4da592(0x157)]('Dataset\x20\x22'+_0x513f3c+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x3268a2,_0x4da592(0x174));const _0x56b00e=Array['isArray'](_0x3268a2[_0x4da592(0x165)])?_0x3268a2[_0x4da592(0x165)]:[],_0x16ac82=new Set(_0x56b00e[_0x4da592(0x170)](_0x2801f6=>_0x2801f6['name']?.[_0x4da592(0x186)]())),_0x409eaf=_0x3268a2['dbtableConfig']?.['tableName']||_0x3268a2[_0x4da592(0x185)]||_0x513f3c;_0x340c9b[_0x4da592(0x161)+_0x409eaf]={'code':_0x513f3c,'tableName':_0x409eaf,'fieldCount':_0x16ac82[_0x4da592(0x15d)],'fields':Array['from'](_0x16ac82)};if(_0x1ad17f){const _0xb77b78=normalizeDatasetIndexes(_0x3268a2);_0x4237d8[_0x4da592(0x157)]({'tableName':_0x409eaf,..._0xb77b78});}}_0x3942d8[_0x4da592(0x17c)]>0x0&&(_0x340c9b[_0x4da592(0x151)]=_0x3942d8),_0x1ad17f&&(_0x340c9b[_0x4da592(0x154)]=auditSqlJoinIndexes(_0xbf59a5,_0x4237d8));}return{'ok':_0x3cb810[_0x4da592(0x18d)],'data':_0x340c9b,'message':_0x3cb810['message']};}};function a241_0x6301(_0x32e476,_0x2717a8){_0x32e476=_0x32e476-0x14a;const _0x21005a=a241_0x2100();let _0x6301fa=_0x21005a[_0x32e476];return _0x6301fa;}function normalizeDatasetIndexes(_0x22716c){const _0x1da3d2=a241_0xe856ee,_0x3229c4=Array[_0x1da3d2(0x14f)](_0x22716c?.['dataset']?.[_0x1da3d2(0x17a)])?_0x22716c[_0x1da3d2(0x169)]['indexes']:Array['isArray'](_0x22716c?.[_0x1da3d2(0x17a)])?_0x22716c[_0x1da3d2(0x17a)]:[],_0x4b2ab0=_0x3229c4[_0x1da3d2(0x183)](_0x19f0e5=>{const _0x75ec39=_0x1da3d2,_0xb79687=Array[_0x75ec39(0x14f)](_0x19f0e5?.['index_columns'])?_0x19f0e5[_0x75ec39(0x159)]:Array[_0x75ec39(0x14f)](_0x19f0e5?.[_0x75ec39(0x153)])?_0x19f0e5[_0x75ec39(0x153)]:Array[_0x75ec39(0x14f)](_0x19f0e5?.['columns'])?_0x19f0e5[_0x75ec39(0x182)]:[],_0x5e9382=_0xb79687['filter'](_0x105907=>typeof _0x105907===_0x75ec39(0x14e))[_0x75ec39(0x170)](_0x4776d6=>_0x4776d6[_0x75ec39(0x16b)]())[_0x75ec39(0x166)](Boolean);if(_0x5e9382[_0x75ec39(0x17c)]===0x0)return[];const _0x34a310=[_0x19f0e5?.[_0x75ec39(0x15c)],_0x19f0e5?.['index_name'],_0x19f0e5?.[_0x75ec39(0x158)]][_0x75ec39(0x150)](_0x418414=>typeof _0x418414==='string'&&_0x418414['trim']()),_0x5c1b65=[_0x19f0e5?.[_0x75ec39(0x172)],_0x19f0e5?.[_0x75ec39(0x14c)]][_0x75ec39(0x150)](_0x34f4b1=>typeof _0x34f4b1==='string'&&_0x34f4b1[_0x75ec39(0x16b)]());return[{..._0x34a310?{'name':_0x34a310[_0x75ec39(0x16b)]()}:{},..._0x5c1b65?{'type':_0x5c1b65[_0x75ec39(0x16b)]()}:{},'columns':_0x5e9382}];}),_0x199e01=[..._0x4b2ab0],_0x34de92=typeof _0x22716c?.['dbtableConfig']?.['pkField']===_0x1da3d2(0x14e)?_0x22716c[_0x1da3d2(0x164)]['pkField'][_0x1da3d2(0x15b)](',')[_0x1da3d2(0x170)](_0x182b4c=>_0x182b4c[_0x1da3d2(0x16b)]())[_0x1da3d2(0x166)](Boolean):[];return _0x34de92[_0x1da3d2(0x17c)]>0x0&&_0x199e01[_0x1da3d2(0x15e)]({'type':'primary','columns':_0x34de92}),{'indexes':_0x199e01,'metadataAvailable':_0x4b2ab0[_0x1da3d2(0x17c)]>0x0};}
@@ -1 +1 @@
1
- (function(_0x1ad525,_0x183560){const _0x1d9020=a217_0x5500,_0x4f2075=_0x1ad525();while(!![]){try{const _0x28553c=parseInt(_0x1d9020(0x10b))/0x1+parseInt(_0x1d9020(0x10d))/0x2+-parseInt(_0x1d9020(0x112))/0x3+-parseInt(_0x1d9020(0x113))/0x4+-parseInt(_0x1d9020(0x10f))/0x5*(parseInt(_0x1d9020(0x10c))/0x6)+-parseInt(_0x1d9020(0x10e))/0x7+-parseInt(_0x1d9020(0x110))/0x8*(-parseInt(_0x1d9020(0x111))/0x9);if(_0x28553c===_0x183560)break;else _0x4f2075['push'](_0x4f2075['shift']());}catch(_0x4641a2){_0x4f2075['push'](_0x4f2075['shift']());}}}(a217_0x3252,0x1fb08));import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];function a217_0x5500(_0x535a96,_0x560409){_0x535a96=_0x535a96-0x10b;const _0x32525d=a217_0x3252();let _0x55007a=_0x32525d[_0x535a96];return _0x55007a;}function a217_0x3252(){const _0x22b0f2=['1334522TcoyMA','5riQKpf','4014272ShMBbh','9pvEbSH','476676Ihumfi','722444efvqxd','49816Tqgzgx','341826meYTsn','330640TAuvxr'];a217_0x3252=function(){return _0x22b0f2;};return a217_0x3252();}
1
+ function a242_0x6c57(){const _0x48385b=['76IlrEsL','13574oHJoVH','7rglyIA','7570mntuia','534275LEqQfk','4953ZzAlQm','3850746FywkAn','84530cGQvWT','2467816vUVDyb','18YoPhvr','1813210pSucCi'];a242_0x6c57=function(){return _0x48385b;};return a242_0x6c57();}(function(_0x6b8660,_0x2aef16){const _0x2d9c9d=a242_0x214e,_0x27e12b=_0x6b8660();while(!![]){try{const _0x45e533=parseInt(_0x2d9c9d(0x8d))/0x1+parseInt(_0x2d9c9d(0x85))/0x2+parseInt(_0x2d9c9d(0x8b))/0x3*(-parseInt(_0x2d9c9d(0x86))/0x4)+-parseInt(_0x2d9c9d(0x8a))/0x5+-parseInt(_0x2d9c9d(0x8c))/0x6*(parseInt(_0x2d9c9d(0x88))/0x7)+parseInt(_0x2d9c9d(0x8e))/0x8*(-parseInt(_0x2d9c9d(0x8f))/0x9)+parseInt(_0x2d9c9d(0x89))/0xa*(parseInt(_0x2d9c9d(0x87))/0xb);if(_0x45e533===_0x2aef16)break;else _0x27e12b['push'](_0x27e12b['shift']());}catch(_0x4eb912){_0x27e12b['push'](_0x27e12b['shift']());}}}(a242_0x6c57,0x80fb0));function a242_0x214e(_0x1b4ad4,_0x3627cf){_0x1b4ad4=_0x1b4ad4-0x85;const _0x6c5749=a242_0x6c57();let _0x214eaf=_0x6c5749[_0x1b4ad4];return _0x214eaf;}import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];
@@ -1 +1 @@
1
- const a218_0x1ad049=a218_0x7e26;function a218_0x7e26(_0x403449,_0x17514e){_0x403449=_0x403449-0xfc;const _0xbc8bcd=a218_0xbc8b();let _0x7e26b0=_0xbc8bcd[_0x403449];return _0x7e26b0;}(function(_0x32c42c,_0x428528){const _0x164ff6=a218_0x7e26,_0x4a01c1=_0x32c42c();while(!![]){try{const _0x48e1ef=-parseInt(_0x164ff6(0x10a))/0x1*(-parseInt(_0x164ff6(0x105))/0x2)+-parseInt(_0x164ff6(0x109))/0x3*(parseInt(_0x164ff6(0x116))/0x4)+parseInt(_0x164ff6(0x114))/0x5*(-parseInt(_0x164ff6(0x10c))/0x6)+-parseInt(_0x164ff6(0xfd))/0x7*(parseInt(_0x164ff6(0x115))/0x8)+parseInt(_0x164ff6(0x10d))/0x9*(-parseInt(_0x164ff6(0x100))/0xa)+parseInt(_0x164ff6(0x106))/0xb*(-parseInt(_0x164ff6(0x10b))/0xc)+-parseInt(_0x164ff6(0x117))/0xd*(-parseInt(_0x164ff6(0x113))/0xe);if(_0x48e1ef===_0x428528)break;else _0x4a01c1['push'](_0x4a01c1['shift']());}catch(_0x6454a6){_0x4a01c1['push'](_0x4a01c1['shift']());}}}(a218_0xbc8b,0x50553));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';function a218_0xbc8b(){const _0x4236cc=['Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','112238KrNbeB','305100wZuGZJ','40wacQHM','2504BMkrvg','1599WLhkzS','taskId','483273JvrLoY','status','trim','161360hdKRDh','string','flagMissing','isTerminal','apiError','361668MpoYNz','11PbgNbn','task-id','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','1878sLFwxh','3kJNMOm','4430244dKJUKg','6ICHDEf','18kkCiwX','str','appCode','compress'];a218_0xbc8b=function(){return _0x4236cc;};return a218_0xbc8b();}export const taskStatus={'service':'task','command':a218_0x1ad049(0xfe),'description':a218_0x1ad049(0x108),'risk':'read','defaultOutputFormat':a218_0x1ad049(0x110),'structuredErrors':!![],'flags':[{'name':'task-id','type':a218_0x1ad049(0x101),'required':!![],'description':a218_0x1ad049(0x112)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1b0fff){const _0x2e5bb2=a218_0x1ad049;if(!_0x1b0fff[_0x2e5bb2(0x10e)](_0x2e5bb2(0x107))[_0x2e5bb2(0xff)]())throw CliErrors[_0x2e5bb2(0x102)](_0x2e5bb2(0x107));},async 'execute'(_0x546699){const _0x3a65e8=a218_0x1ad049,_0x52f38f=_0x546699[_0x3a65e8(0x10e)](_0x3a65e8(0x107))[_0x3a65e8(0xff)](),_0x278cf8=normalizeAsyncTask(await getAsyncTaskStatus(_0x52f38f,_0x546699[_0x3a65e8(0x10f)],_0x546699['cookie']));if(_0x278cf8[_0x3a65e8(0xfc)]!==_0x52f38f)throw CliErrors[_0x3a65e8(0x104)](_0x3a65e8(0x111)+_0x52f38f+',\x20received\x20'+_0x278cf8['taskId']+'.');const _0x140472=buildAsyncTaskStatusCommand(_0x278cf8[_0x3a65e8(0xfc)],_0x546699['appCode']);return{'ok':!![],'message':asyncTaskMessage(_0x278cf8),'data':{'appCode':_0x546699[_0x3a65e8(0x10f)],..._0x278cf8,'query':_0x278cf8[_0x3a65e8(0x103)]?null:{'command':_0x140472}}};}};
1
+ const a243_0x307709=a243_0x218b;(function(_0x4fea72,_0x4665c0){const _0x17ad28=a243_0x218b,_0x5791f7=_0x4fea72();while(!![]){try{const _0x4946d1=-parseInt(_0x17ad28(0xc6))/0x1*(-parseInt(_0x17ad28(0xc9))/0x2)+-parseInt(_0x17ad28(0xca))/0x3*(-parseInt(_0x17ad28(0xc1))/0x4)+-parseInt(_0x17ad28(0xb4))/0x5*(-parseInt(_0x17ad28(0xcb))/0x6)+-parseInt(_0x17ad28(0xc8))/0x7*(-parseInt(_0x17ad28(0xc3))/0x8)+-parseInt(_0x17ad28(0xc7))/0x9+-parseInt(_0x17ad28(0xc0))/0xa+parseInt(_0x17ad28(0xbe))/0xb;if(_0x4946d1===_0x4665c0)break;else _0x5791f7['push'](_0x5791f7['shift']());}catch(_0x33ef12){_0x5791f7['push'](_0x5791f7['shift']());}}}(a243_0x40b4,0xba748));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':a243_0x307709(0xb3),'command':a243_0x307709(0xc5),'description':a243_0x307709(0xbb),'risk':'read','defaultOutputFormat':a243_0x307709(0xcc),'structuredErrors':!![],'flags':[{'name':a243_0x307709(0xbd),'type':a243_0x307709(0xc4),'required':!![],'description':a243_0x307709(0xbf)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x31614d){const _0xf6bac1=a243_0x307709;if(!_0x31614d['str'](_0xf6bac1(0xbd))['trim']())throw CliErrors[_0xf6bac1(0xb7)](_0xf6bac1(0xbd));},async 'execute'(_0x462349){const _0x708e8a=a243_0x307709,_0x5f5a22=_0x462349['str'](_0x708e8a(0xbd))[_0x708e8a(0xbc)](),_0x49224e=normalizeAsyncTask(await getAsyncTaskStatus(_0x5f5a22,_0x462349[_0x708e8a(0xc2)],_0x462349[_0x708e8a(0xb9)]));if(_0x49224e[_0x708e8a(0xba)]!==_0x5f5a22)throw CliErrors['apiError'](_0x708e8a(0xb5)+_0x5f5a22+_0x708e8a(0xb6)+_0x49224e[_0x708e8a(0xba)]+'.');const _0x344a35=buildAsyncTaskStatusCommand(_0x49224e[_0x708e8a(0xba)],_0x462349[_0x708e8a(0xc2)]);return{'ok':!![],'message':asyncTaskMessage(_0x49224e),'data':{'appCode':_0x462349[_0x708e8a(0xc2)],..._0x49224e,'query':_0x49224e[_0x708e8a(0xb8)]?null:{'command':_0x344a35}}};}};function a243_0x218b(_0x1f2cd7,_0x3f8d51){_0x1f2cd7=_0x1f2cd7-0xb3;const _0x40b451=a243_0x40b4();let _0x218bff=_0x40b451[_0x1f2cd7];return _0x218bff;}function a243_0x40b4(){const _0x4dd280=['5CvcbnD','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20',',\x20received\x20','flagMissing','isTerminal','cookie','taskId','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','trim','task-id','5595535MkxaNY','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','7639970vAuXnc','132VaNzVB','appCode','13016KnzeMp','string','status','809534YHKAlO','12964599KvsIWW','63dGrJGB','2rSWxSB','84264ykupCu','4250772siNywU','compress','task'];a243_0x40b4=function(){return _0x4dd280;};return a243_0x40b4();}
@@ -1 +1 @@
1
- function a219_0x3118(){const _0x3333f7=['11FuOOZx','750651aOsqwy','2913ItkvxH','2360430pQZVGr','5702988tFvsOf','4muXeUs','1174435IEEMyp','138RxFwME','308HvYhbp','8fwTzki','36048dZdpcO','1580733xQPSMC'];a219_0x3118=function(){return _0x3333f7;};return a219_0x3118();}(function(_0x3c6d8e,_0x16c66b){const _0x136700=a219_0x4f21,_0x2b8c3a=_0x3c6d8e();while(!![]){try{const _0x4ee0ad=parseInt(_0x136700(0x14e))/0x1*(-parseInt(_0x136700(0x147))/0x2)+parseInt(_0x136700(0x14d))/0x3*(parseInt(_0x136700(0x145))/0x4)+-parseInt(_0x136700(0x146))/0x5+parseInt(_0x136700(0x14a))/0x6*(parseInt(_0x136700(0x148))/0x7)+parseInt(_0x136700(0x149))/0x8*(-parseInt(_0x136700(0x14b))/0x9)+-parseInt(_0x136700(0x14f))/0xa*(parseInt(_0x136700(0x14c))/0xb)+parseInt(_0x136700(0x144))/0xc;if(_0x4ee0ad===_0x16c66b)break;else _0x2b8c3a['push'](_0x2b8c3a['shift']());}catch(_0x100f03){_0x2b8c3a['push'](_0x2b8c3a['shift']());}}}(a219_0x3118,0x22bae));import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';function a219_0x4f21(_0x4e28b2,_0x48c19d){_0x4e28b2=_0x4e28b2-0x144;const _0x3118d8=a219_0x3118();let _0x4f21b3=_0x3118d8[_0x4e28b2];return _0x4f21b3;}export const tenantDefinitions=[tenantMembersListDefinition];
1
+ (function(_0x50fb6e,_0x2bccaf){const _0x4b02aa=a244_0xbf9a,_0x2dc6c7=_0x50fb6e();while(!![]){try{const _0xb7c3ef=parseInt(_0x4b02aa(0x1f4))/0x1+parseInt(_0x4b02aa(0x1f2))/0x2*(parseInt(_0x4b02aa(0x1f5))/0x3)+-parseInt(_0x4b02aa(0x1ee))/0x4+-parseInt(_0x4b02aa(0x1f0))/0x5+parseInt(_0x4b02aa(0x1f3))/0x6*(parseInt(_0x4b02aa(0x1ef))/0x7)+parseInt(_0x4b02aa(0x1f1))/0x8*(-parseInt(_0x4b02aa(0x1ed))/0x9)+parseInt(_0x4b02aa(0x1f6))/0xa;if(_0xb7c3ef===_0x2bccaf)break;else _0x2dc6c7['push'](_0x2dc6c7['shift']());}catch(_0x128ca4){_0x2dc6c7['push'](_0x2dc6c7['shift']());}}}(a244_0x3cb2,0x2d618));function a244_0x3cb2(){const _0x44fc0f=['456kKqFEY','54ObDLvB','6tRWWRm','205196UEApGd','879HtkIia','5343330iBMCMF','38736dUsSoj','1122136lQNAWJ','941409VSbZYI','850925gpAqLM'];a244_0x3cb2=function(){return _0x44fc0f;};return a244_0x3cb2();}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';function a244_0xbf9a(_0x8315af,_0x410b5f){_0x8315af=_0x8315af-0x1ed;const _0x3cb28a=a244_0x3cb2();let _0xbf9a39=_0x3cb28a[_0x8315af];return _0xbf9a39;}export const tenantDefinitions=[tenantMembersListDefinition];
@@ -1 +1 @@
1
- function a220_0x5dad(){const _0x5a7be7=['Exact\x20tenant\x20code','length','1196ZczyUf','16kKoGMt','501083NyWwzh','36358BSDDlD','190qrQiAt','591806Fgvmbr','read','tenant','205735CwXoTd','str','trim','3489QcXXnD','\x20tenant\x20member(s)','flagMissing','members-list','288NeNIvl','2127525MlsCNI','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','Pass\x20--tenant-code\x20<code>.','tenant-code','Found\x20','1386963nXIWeF'];a220_0x5dad=function(){return _0x5a7be7;};return a220_0x5dad();}const a220_0x220cce=a220_0x5597;(function(_0xe3424,_0x420d08){const _0x28236f=a220_0x5597,_0x31f2de=_0xe3424();while(!![]){try{const _0x3d8204=-parseInt(_0x28236f(0x100))/0x1+parseInt(_0x28236f(0xfd))/0x2+parseInt(_0x28236f(0x103))/0x3*(-parseInt(_0x28236f(0xf8))/0x4)+-parseInt(_0x28236f(0x108))/0x5+-parseInt(_0x28236f(0x107))/0x6*(parseInt(_0x28236f(0xfb))/0x7)+parseInt(_0x28236f(0xf9))/0x8*(parseInt(_0x28236f(0xf5))/0x9)+-parseInt(_0x28236f(0xfc))/0xa*(-parseInt(_0x28236f(0xfa))/0xb);if(_0x3d8204===_0x420d08)break;else _0x31f2de['push'](_0x31f2de['shift']());}catch(_0x464c14){_0x31f2de['push'](_0x31f2de['shift']());}}}(a220_0x5dad,0x3aeb7));function a220_0x5597(_0x546f2d,_0xca27b3){_0x546f2d=_0x546f2d-0xf2;const _0x5dadda=a220_0x5dad();let _0x55974b=_0x5dadda[_0x546f2d];return _0x55974b;}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_0x220cce(0xff),'command':a220_0x220cce(0x106),'description':a220_0x220cce(0x109),'risk':a220_0x220cce(0xfe),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a220_0x220cce(0xf3),'type':'string','required':!![],'description':a220_0x220cce(0xf6)}],async 'validate'(_0x38bf16){const _0x46cd1d=a220_0x220cce;if(!_0x38bf16[_0x46cd1d(0x101)](_0x46cd1d(0xf3))['trim']())throw CliErrors[_0x46cd1d(0x105)](_0x46cd1d(0xf3),_0x46cd1d(0xf2));},async 'execute'(_0x554496){const _0x235fd9=a220_0x220cce,_0x95ced=_0x554496[_0x235fd9(0x101)]('tenant-code')[_0x235fd9(0x102)](),_0x269f5c=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x95ced,_0x269f5c);const _0x411662=projectTenantMembers(await listTenantDirectoryMembers(_0x95ced));return{'ok':!![],'data':{'tenantCode':_0x95ced,'items':_0x411662,'totalCount':_0x411662[_0x235fd9(0xf7)]},'message':_0x235fd9(0xf4)+_0x411662[_0x235fd9(0xf7)]+_0x235fd9(0x104)};}};
1
+ const a245_0x5ebaed=a245_0x365a;(function(_0x35f092,_0x2d0de9){const _0x230ffc=a245_0x365a,_0x3633ed=_0x35f092();while(!![]){try{const _0x3d276a=-parseInt(_0x230ffc(0x15c))/0x1*(parseInt(_0x230ffc(0x150))/0x2)+parseInt(_0x230ffc(0x14e))/0x3*(parseInt(_0x230ffc(0x15a))/0x4)+-parseInt(_0x230ffc(0x14f))/0x5+parseInt(_0x230ffc(0x157))/0x6+-parseInt(_0x230ffc(0x15b))/0x7+-parseInt(_0x230ffc(0x159))/0x8+parseInt(_0x230ffc(0x14b))/0x9;if(_0x3d276a===_0x2d0de9)break;else _0x3633ed['push'](_0x3633ed['shift']());}catch(_0x5ab8a4){_0x3633ed['push'](_0x3633ed['shift']());}}}(a245_0x2a17,0x73845));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';function a245_0x365a(_0x3653bd,_0x49eb16){_0x3653bd=_0x3653bd-0x14b;const _0x2a1736=a245_0x2a17();let _0x365a92=_0x2a1736[_0x3653bd];return _0x365a92;}import{CliErrors}from'../../errors.js';function a245_0x2a17(){const _0x1b7f05=['2033295qAUwfv','2DdzIFR','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','members-list','length','tenant-code','trim','str','807990simXEW','read','6374760AXMDuZ','1432316OrDSIR','1836415IPkulR','43270QdCnFz','13405788cKQKnv','Exact\x20tenant\x20code','string','3wsGFaR'];a245_0x2a17=function(){return _0x1b7f05;};return a245_0x2a17();}import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':'tenant','command':a245_0x5ebaed(0x152),'description':a245_0x5ebaed(0x151),'risk':a245_0x5ebaed(0x158),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a245_0x5ebaed(0x154),'type':a245_0x5ebaed(0x14d),'required':!![],'description':a245_0x5ebaed(0x14c)}],async 'validate'(_0x4efa72){const _0x2b27a7=a245_0x5ebaed;if(!_0x4efa72[_0x2b27a7(0x156)]('tenant-code')[_0x2b27a7(0x155)]())throw CliErrors['flagMissing'](_0x2b27a7(0x154),'Pass\x20--tenant-code\x20<code>.');},async 'execute'(_0x16efb){const _0x2594ac=a245_0x5ebaed,_0x1dc5fe=_0x16efb[_0x2594ac(0x156)](_0x2594ac(0x154))[_0x2594ac(0x155)](),_0x34d065=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x1dc5fe,_0x34d065);const _0xa43974=projectTenantMembers(await listTenantDirectoryMembers(_0x1dc5fe));return{'ok':!![],'data':{'tenantCode':_0x1dc5fe,'items':_0xa43974,'totalCount':_0xa43974[_0x2594ac(0x153)]},'message':'Found\x20'+_0xa43974[_0x2594ac(0x153)]+'\x20tenant\x20member(s)'};}};
@@ -1 +1 @@
1
- (function(_0x371c5d,_0x5350b5){const _0x562487=a221_0xdc69,_0x409eb9=_0x371c5d();while(!![]){try{const _0x1c226f=parseInt(_0x562487(0x136))/0x1+parseInt(_0x562487(0x13f))/0x2*(-parseInt(_0x562487(0x12e))/0x3)+-parseInt(_0x562487(0x144))/0x4*(-parseInt(_0x562487(0x131))/0x5)+parseInt(_0x562487(0x13b))/0x6+parseInt(_0x562487(0x149))/0x7+parseInt(_0x562487(0x147))/0x8*(parseInt(_0x562487(0x13e))/0x9)+parseInt(_0x562487(0x137))/0xa*(-parseInt(_0x562487(0x13a))/0xb);if(_0x1c226f===_0x5350b5)break;else _0x409eb9['push'](_0x409eb9['shift']());}catch(_0x96e2e1){_0x409eb9['push'](_0x409eb9['shift']());}}}(a221_0x2a9e,0x2f7c3));function a221_0x2a9e(){const _0x52bdb6=['ADMIN','status','1749yYUxoS','sort','adminFlag','35aRfCQP','Tenant\x20\x22','userId','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','displayName','336608fJIWiQ','510BvaVgs','tenantCode','values','111991dgXqym','799686ipWyAg','isFinite','trim','9iqzNir','652LfPlTQ','role','nickname','validation','set','133412fqZrvd','\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','username','872232REOayL','some','639793LxARVA'];a221_0x2a9e=function(){return _0x52bdb6;};return a221_0x2a9e();}function a221_0xdc69(_0x5320fb,_0x1e8141){_0x5320fb=_0x5320fb-0x12c;const _0x2a9e34=a221_0x2a9e();let _0xdc69c0=_0x2a9e34[_0x5320fb];return _0xdc69c0;}import{CliErrors}from'../../errors.js';function textOrNull(_0x296b59){const _0xba809e=a221_0xdc69,_0x1db228=_0x296b59?.[_0xba809e(0x13d)]();return _0x1db228?_0x1db228:null;}export function projectTenantMembers(_0x17fa34){const _0x348bce=a221_0xdc69,_0x38f1bf=new Map();for(const _0x3a9df0 of _0x17fa34){const _0x5cbe42=Number(_0x3a9df0[_0x348bce(0x133)]);if(!Number[_0x348bce(0x13c)](_0x5cbe42)||_0x5cbe42<=0x0)continue;const _0x19f2da={'userId':_0x5cbe42,'username':textOrNull(_0x3a9df0[_0x348bce(0x146)]),'displayName':textOrNull(_0x3a9df0[_0x348bce(0x141)]),'role':_0x3a9df0[_0x348bce(0x130)]===!![]?'ADMIN':'MEMBER','status':textOrNull(_0x3a9df0[_0x348bce(0x12d)])},_0x4ac9ec=_0x38f1bf['get'](_0x5cbe42);if(!_0x4ac9ec){_0x38f1bf[_0x348bce(0x143)](_0x5cbe42,_0x19f2da);continue;}_0x4ac9ec[_0x348bce(0x146)]??=_0x19f2da[_0x348bce(0x146)],_0x4ac9ec['displayName']??=_0x19f2da[_0x348bce(0x135)],_0x4ac9ec[_0x348bce(0x12d)]??=_0x19f2da[_0x348bce(0x12d)];if(_0x19f2da[_0x348bce(0x140)]===_0x348bce(0x12c))_0x4ac9ec[_0x348bce(0x140)]='ADMIN';}return[..._0x38f1bf[_0x348bce(0x139)]()][_0x348bce(0x12f)]((_0x30a22b,_0x1fad7f)=>_0x30a22b[_0x348bce(0x133)]-_0x1fad7f['userId']);}export function assertTenantAccessible(_0x3fb6e6,_0x34bd11){const _0x1971b2=a221_0xdc69;if(_0x34bd11[_0x1971b2(0x148)](_0x4a0143=>_0x4a0143[_0x1971b2(0x138)]===_0x3fb6e6))return;throw CliErrors[_0x1971b2(0x142)](_0x1971b2(0x132)+_0x3fb6e6+_0x1971b2(0x145),_0x1971b2(0x134));}
1
+ (function(_0x101cfc,_0x41fb3b){const _0x3c8387=a246_0xe6ee,_0x1fcaff=_0x101cfc();while(!![]){try{const _0x108dfc=parseInt(_0x3c8387(0x1c1))/0x1*(-parseInt(_0x3c8387(0x1d2))/0x2)+parseInt(_0x3c8387(0x1d7))/0x3+parseInt(_0x3c8387(0x1d8))/0x4*(parseInt(_0x3c8387(0x1ca))/0x5)+-parseInt(_0x3c8387(0x1cc))/0x6+parseInt(_0x3c8387(0x1bf))/0x7+-parseInt(_0x3c8387(0x1ce))/0x8*(-parseInt(_0x3c8387(0x1d0))/0x9)+-parseInt(_0x3c8387(0x1c3))/0xa;if(_0x108dfc===_0x41fb3b)break;else _0x1fcaff['push'](_0x1fcaff['shift']());}catch(_0x33c17e){_0x1fcaff['push'](_0x1fcaff['shift']());}}}(a246_0xbfbc,0xd0b42));function a246_0xe6ee(_0x17401b,_0xb80a91){_0x17401b=_0x17401b-0x1bf;const _0xbfbc6e=a246_0xbfbc();let _0xe6eef6=_0xbfbc6e[_0x17401b];return _0xe6eef6;}function a246_0xbfbc(){const _0x547042=['ADMIN','7329888dzTdaE','status','8EbAuBG','userId','2612196xrUnru','tenantCode','12158efTSgn','get','username','values','set','2951583MadElN','109596NkRGYh','MEMBER','role','9564261cbKAGB','nickname','48ClImvt','displayName','7379210SMeCsp','trim','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','some','\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','validation','isFinite','85PWeEkC'];a246_0xbfbc=function(){return _0x547042;};return a246_0xbfbc();}import{CliErrors}from'../../errors.js';function textOrNull(_0x1a9e26){const _0xa969d0=a246_0xe6ee,_0x3cafb8=_0x1a9e26?.[_0xa969d0(0x1c4)]();return _0x3cafb8?_0x3cafb8:null;}export function projectTenantMembers(_0x50146b){const _0x73a908=a246_0xe6ee,_0x6fc41c=new Map();for(const _0x515c05 of _0x50146b){const _0x1cd048=Number(_0x515c05[_0x73a908(0x1cf)]);if(!Number[_0x73a908(0x1c9)](_0x1cd048)||_0x1cd048<=0x0)continue;const _0x5d5d8b={'userId':_0x1cd048,'username':textOrNull(_0x515c05[_0x73a908(0x1d4)]),'displayName':textOrNull(_0x515c05[_0x73a908(0x1c0)]),'role':_0x515c05['adminFlag']===!![]?_0x73a908(0x1cb):_0x73a908(0x1d9),'status':textOrNull(_0x515c05[_0x73a908(0x1cd)])},_0x5dc080=_0x6fc41c[_0x73a908(0x1d3)](_0x1cd048);if(!_0x5dc080){_0x6fc41c[_0x73a908(0x1d6)](_0x1cd048,_0x5d5d8b);continue;}_0x5dc080[_0x73a908(0x1d4)]??=_0x5d5d8b[_0x73a908(0x1d4)],_0x5dc080[_0x73a908(0x1c2)]??=_0x5d5d8b['displayName'],_0x5dc080[_0x73a908(0x1cd)]??=_0x5d5d8b[_0x73a908(0x1cd)];if(_0x5d5d8b[_0x73a908(0x1da)]===_0x73a908(0x1cb))_0x5dc080['role']=_0x73a908(0x1cb);}return[..._0x6fc41c[_0x73a908(0x1d5)]()]['sort']((_0x8ba009,_0x15853)=>_0x8ba009['userId']-_0x15853[_0x73a908(0x1cf)]);}export function assertTenantAccessible(_0x19d8b8,_0x33c821){const _0x393229=a246_0xe6ee;if(_0x33c821[_0x393229(0x1c6)](_0x322579=>_0x322579[_0x393229(0x1d1)]===_0x19d8b8))return;throw CliErrors[_0x393229(0x1c8)]('Tenant\x20\x22'+_0x19d8b8+_0x393229(0x1c7),_0x393229(0x1c5));}
@@ -1 +1 @@
1
- const a222_0xb52d8=a222_0x583d;function a222_0x583d(_0x270747,_0x4d6ccd){_0x270747=_0x270747-0x78;const _0xc8a9e7=a222_0xc8a9();let _0x583d29=_0xc8a9e7[_0x270747];return _0x583d29;}function a222_0xc8a9(){const _0x333ca3=['1278968mJpsTs','dingtalk','bind','49SSXqIh','user-account','string','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','32pFPqoW','5fdqpws','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','5360580KHGbYB','write','1169464uQgUlO','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.','POST','trim','validation','60NitRDO','48010WUKbVg','ding-talk-user-id','26098127TdKwpS','241578sRrsbP','4793874BRwXlJ','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','str','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','apiError'];a222_0xc8a9=function(){return _0x333ca3;};return a222_0xc8a9();}(function(_0x21efad,_0x31700c){const _0x28329a=a222_0x583d,_0x5d2391=_0x21efad();while(!![]){try{const _0x2b86e6=-parseInt(_0x28329a(0x7d))/0x1*(parseInt(_0x28329a(0x8e))/0x2)+parseInt(_0x28329a(0x81))/0x3+-parseInt(_0x28329a(0x87))/0x4*(parseInt(_0x28329a(0x8f))/0x5)+-parseInt(_0x28329a(0x91))/0x6+parseInt(_0x28329a(0x8a))/0x7*(-parseInt(_0x28329a(0x93))/0x8)+-parseInt(_0x28329a(0x80))/0x9*(parseInt(_0x28329a(0x7c))/0xa)+parseInt(_0x28329a(0x7f))/0xb;if(_0x2b86e6===_0x31700c)break;else _0x5d2391['push'](_0x5d2391['shift']());}catch(_0x287b5b){_0x5d2391['push'](_0x5d2391['shift']());}}}(a222_0xc8a9,0xc47f2));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_0xb52d8(0x88),CURRENT_BINDING_WARNING=a222_0xb52d8(0x90);function readDingTalkUserId(_0xcab41f){const _0x2d429f=a222_0xb52d8,_0x2352a1=_0xcab41f[_0x2d429f(0x84)](_0x2d429f(0x7e))[_0x2d429f(0x7a)]();if(!_0x2352a1)throw CliErrors[_0x2d429f(0x7b)]('--ding-talk-user-id\x20cannot\x20be\x20empty.',_0x2d429f(0x78));return _0x2352a1;}function buildBindingData(_0x170302,_0x58b46e){const _0x5a59a2=a222_0xb52d8;return{'operation':_0x5a59a2(0x89),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x170302},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x170302,'bound':!![]},'dryRun':_0x58b46e,'backend':{'method':_0x5a59a2(0x79),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a222_0xb52d8(0x8b),'command':'dingding-sandbox-bind','description':a222_0xb52d8(0x8d),'risk':a222_0xb52d8(0x92),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a222_0xb52d8(0x7e),'type':a222_0xb52d8(0x8c),'required':!![],'description':a222_0xb52d8(0x83)}],async 'validate'(_0x5c6b7b){readDingTalkUserId(_0x5c6b7b);},async 'dryRun'(_0x54fe83){const _0x5df6fd=a222_0xb52d8,_0xff1cbc=readDingTalkUserId(_0x54fe83);return asDryRunResult(buildBindingData(_0xff1cbc,!![]),{'method':_0x5df6fd(0x79),'url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x2988bf){const _0x270422=a222_0xb52d8,_0x4e9d24=readDingTalkUserId(_0x2988bf),_0x46c798=await bindDingTalkSandboxAccount(_0x4e9d24);if(_0x46c798!==!![])throw CliErrors[_0x270422(0x86)]('DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.',_0x270422(0x82));return{'ok':!![],'data':buildBindingData(_0x4e9d24,![]),'message':_0x270422(0x85)};}};
1
+ const a247_0x2d8be9=a247_0x4468;(function(_0x3c6ae7,_0x6571c){const _0x2393c4=a247_0x4468,_0x4bb231=_0x3c6ae7();while(!![]){try{const _0x189682=parseInt(_0x2393c4(0x1bf))/0x1*(-parseInt(_0x2393c4(0x1c7))/0x2)+-parseInt(_0x2393c4(0x1af))/0x3+-parseInt(_0x2393c4(0x1b0))/0x4+parseInt(_0x2393c4(0x1be))/0x5*(-parseInt(_0x2393c4(0x1bd))/0x6)+-parseInt(_0x2393c4(0x1ac))/0x7*(-parseInt(_0x2393c4(0x1b4))/0x8)+-parseInt(_0x2393c4(0x1b6))/0x9*(parseInt(_0x2393c4(0x1c3))/0xa)+-parseInt(_0x2393c4(0x1bc))/0xb*(-parseInt(_0x2393c4(0x1b1))/0xc);if(_0x189682===_0x6571c)break;else _0x4bb231['push'](_0x4bb231['shift']());}catch(_0x57860b){_0x4bb231['push'](_0x4bb231['shift']());}}}(a247_0x1450,0x5ec94));function a247_0x4468(_0x5449b2,_0x3ea267){_0x5449b2=_0x5449b2-0x1ac;const _0x14501c=a247_0x1450();let _0x446852=_0x14501c[_0x5449b2];return _0x446852;}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=a247_0x2d8be9(0x1b5),CURRENT_BINDING_WARNING=a247_0x2d8be9(0x1bb);function readDingTalkUserId(_0x1b08d0){const _0x300b4d=a247_0x2d8be9,_0x4df058=_0x1b08d0[_0x300b4d(0x1c1)](_0x300b4d(0x1b3))[_0x300b4d(0x1ba)]();if(!_0x4df058)throw CliErrors[_0x300b4d(0x1ae)](_0x300b4d(0x1b2),_0x300b4d(0x1b7));return _0x4df058;}function buildBindingData(_0xcc26a9,_0x193636){const _0xab62fb=a247_0x2d8be9;return{'operation':'bind','selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0xcc26a9},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0xcc26a9,'bound':!![]},'dryRun':_0x193636,'backend':{'method':_0xab62fb(0x1c6),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a247_0x2d8be9(0x1ad),'command':a247_0x2d8be9(0x1b8),'description':'Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','risk':a247_0x2d8be9(0x1b9),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a247_0x2d8be9(0x1b3),'type':'string','required':!![],'description':a247_0x2d8be9(0x1c5)}],async 'validate'(_0x4c99a3){readDingTalkUserId(_0x4c99a3);},async 'dryRun'(_0x327658){const _0x353d08=readDingTalkUserId(_0x327658);return asDryRunResult(buildBindingData(_0x353d08,!![]),{'method':'POST','url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x27eedc){const _0x12bae5=a247_0x2d8be9,_0x5aba08=readDingTalkUserId(_0x27eedc),_0x2c2691=await bindDingTalkSandboxAccount(_0x5aba08);if(_0x2c2691!==!![])throw CliErrors['apiError'](_0x12bae5(0x1c2),_0x12bae5(0x1c0));return{'ok':!![],'data':buildBindingData(_0x5aba08,![]),'message':_0x12bae5(0x1c4)};}};function a247_0x1450(){const _0x129a76=['ding-talk-user-id','8KifsPD','dingtalk','219717LwExKx','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.','dingding-sandbox-bind','write','trim','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','20190005aIiiba','35052PuTjRT','155pSSDxb','1dtbBgP','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','str','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','180erNGSL','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','POST','1308170OzTbkN','3043383tjyXCa','user-account','validation','1058685fasYPu','1017856ESJrYb','12RGxIFC','--ding-talk-user-id\x20cannot\x20be\x20empty.'];a247_0x1450=function(){return _0x129a76;};return a247_0x1450();}