@lovrabet/rabetbase-cli 2.5.1-beta.1 → 2.5.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/fetch-model-list.js +1 -1
  3. package/lib/api/generate-api-file.js +1 -1
  4. package/lib/api/generate-sdk-config-file.js +1 -1
  5. package/lib/auth/auth-server-ui.js +1 -1
  6. package/lib/auth/auth-server.js +1 -1
  7. package/lib/auth/constant.js +1 -1
  8. package/lib/auth/get-cookie.js +1 -1
  9. package/lib/auth/get-session-user.js +1 -1
  10. package/lib/auth/is-session-valid.js +1 -1
  11. package/lib/auth/login-success-html.js +1 -1
  12. package/lib/auth/logout.js +1 -1
  13. package/lib/cli-flags.js +1 -1
  14. package/lib/cli.js +1 -1
  15. package/lib/commands/api/generate.js +1 -1
  16. package/lib/commands/api/index.js +1 -1
  17. package/lib/commands/api/list.js +1 -1
  18. package/lib/commands/api/pull.js +1 -1
  19. package/lib/commands/api/shared.js +1 -1
  20. package/lib/commands/app/index.js +1 -1
  21. package/lib/commands/app/list.js +1 -1
  22. package/lib/commands/app/members-list.js +1 -1
  23. package/lib/commands/app/remote-directory.js +1 -1
  24. package/lib/commands/app/shared.js +1 -1
  25. package/lib/commands/app-config/delete.js +1 -1
  26. package/lib/commands/app-config/get.js +1 -1
  27. package/lib/commands/app-config/index.js +1 -1
  28. package/lib/commands/app-config/list.js +1 -1
  29. package/lib/commands/app-config/set.js +1 -1
  30. package/lib/commands/app-config/shared.js +1 -1
  31. package/lib/commands/auth/index.js +1 -1
  32. package/lib/commands/bff/create.js +1 -1
  33. package/lib/commands/bff/delete.js +1 -1
  34. package/lib/commands/bff/detail.js +1 -1
  35. package/lib/commands/bff/index.js +1 -1
  36. package/lib/commands/bff/list.js +1 -1
  37. package/lib/commands/bff/pull.js +1 -1
  38. package/lib/commands/bff/push.js +1 -1
  39. package/lib/commands/bff/status.js +1 -1
  40. package/lib/commands/cli-skill/index.js +1 -1
  41. package/lib/commands/cli-update.js +1 -1
  42. package/lib/commands/codegen/index.js +1 -1
  43. package/lib/commands/codegen/sdk.js +1 -1
  44. package/lib/commands/codegen/sql.js +1 -1
  45. package/lib/commands/common/app-registry.js +1 -1
  46. package/lib/commands/common/app-selector.js +1 -1
  47. package/lib/commands/common/async-task.js +1 -1
  48. package/lib/commands/common/dry-run.js +1 -1
  49. package/lib/commands/common/flags.js +1 -1
  50. package/lib/commands/common/local-file.js +1 -1
  51. package/lib/commands/common/validate.js +1 -1
  52. package/lib/commands/config/delete.js +1 -1
  53. package/lib/commands/config/get.js +1 -1
  54. package/lib/commands/config/index.js +1 -1
  55. package/lib/commands/config/init.js +1 -1
  56. package/lib/commands/config/list.js +1 -1
  57. package/lib/commands/config/set.js +1 -1
  58. package/lib/commands/config/shared.js +1 -1
  59. package/lib/commands/dataset/business-group-update.js +1 -1
  60. package/lib/commands/dataset/business-groups.js +1 -1
  61. package/lib/commands/dataset/capability.js +1 -1
  62. package/lib/commands/dataset/delete.js +1 -1
  63. package/lib/commands/dataset/detail.js +1 -1
  64. package/lib/commands/dataset/extend-update.js +1 -1
  65. package/lib/commands/dataset/field-restore.d.ts +107 -0
  66. package/lib/commands/dataset/field-restore.js +1 -0
  67. package/lib/commands/dataset/field-update.js +1 -1
  68. package/lib/commands/dataset/generate.js +1 -1
  69. package/lib/commands/dataset/index.js +1 -1
  70. package/lib/commands/dataset/list.js +1 -1
  71. package/lib/commands/dataset/operations.js +1 -1
  72. package/lib/commands/dataset/relation-audit.js +1 -1
  73. package/lib/commands/dataset/relation-create.js +1 -1
  74. package/lib/commands/dataset/relation-delete.js +1 -1
  75. package/lib/commands/dataset/relation-shared.js +1 -1
  76. package/lib/commands/dataset/relation-update.js +1 -1
  77. package/lib/commands/dataset/relations.js +1 -1
  78. package/lib/commands/dataset/rename.js +1 -1
  79. package/lib/commands/dataset/restore.js +1 -1
  80. package/lib/commands/dataset/user-deleted-field-list.d.ts +36 -0
  81. package/lib/commands/dataset/user-deleted-field-list.js +1 -0
  82. package/lib/commands/db/analysis-batching.js +1 -1
  83. package/lib/commands/db/analyze-batch-plan.js +1 -1
  84. package/lib/commands/db/analyze-cancel.js +1 -1
  85. package/lib/commands/db/analyze-start.js +1 -1
  86. package/lib/commands/db/analyze-status.js +1 -1
  87. package/lib/commands/db/create.js +1 -1
  88. package/lib/commands/db/delete.js +1 -1
  89. package/lib/commands/db/detail.js +1 -1
  90. package/lib/commands/db/diff-refresh-start.js +1 -1
  91. package/lib/commands/db/diff-refresh-status.js +1 -1
  92. package/lib/commands/db/diff.js +1 -1
  93. package/lib/commands/db/index.js +1 -1
  94. package/lib/commands/db/list.js +1 -1
  95. package/lib/commands/db/shared.js +1 -1
  96. package/lib/commands/db/table-diff-shared.js +1 -1
  97. package/lib/commands/db/tables.js +1 -1
  98. package/lib/commands/db/test.js +1 -1
  99. package/lib/commands/db/update.js +1 -1
  100. package/lib/commands/deployment/auto-sync.d.ts +28 -0
  101. package/lib/commands/deployment/auto-sync.js +1 -0
  102. package/lib/commands/deployment/index.d.ts +2 -0
  103. package/lib/commands/deployment/index.js +1 -0
  104. package/lib/commands/deployment/sync.d.ts +2 -0
  105. package/lib/commands/deployment/sync.js +1 -0
  106. package/lib/commands/doctor.js +1 -1
  107. package/lib/commands/file/index.js +1 -1
  108. package/lib/commands/issue/index.js +1 -1
  109. package/lib/commands/issue/nudge.js +1 -1
  110. package/lib/commands/issue/report.js +1 -1
  111. package/lib/commands/issue/shared.js +1 -1
  112. package/lib/commands/kb/create.js +1 -1
  113. package/lib/commands/kb/delete.js +1 -1
  114. package/lib/commands/kb/detail.js +1 -1
  115. package/lib/commands/kb/index.js +1 -1
  116. package/lib/commands/kb/list.js +1 -1
  117. package/lib/commands/kb/search.js +1 -1
  118. package/lib/commands/kb/shared.js +1 -1
  119. package/lib/commands/kb/update.js +1 -1
  120. package/lib/commands/logs/index.js +1 -1
  121. package/lib/commands/menu/asset-update.js +1 -1
  122. package/lib/commands/menu/delete.js +1 -1
  123. package/lib/commands/menu/external-link-create.js +1 -1
  124. package/lib/commands/menu/external-link-update.js +1 -1
  125. package/lib/commands/menu/group-create.js +1 -1
  126. package/lib/commands/menu/group-update.js +1 -1
  127. package/lib/commands/menu/index.js +1 -1
  128. package/lib/commands/menu/list.js +1 -1
  129. package/lib/commands/menu/move.js +1 -1
  130. package/lib/commands/menu/regroup-start.js +1 -1
  131. package/lib/commands/menu/rename.js +1 -1
  132. package/lib/commands/menu/shared/compare-table.js +1 -1
  133. package/lib/commands/menu/shared/delete-plan.js +1 -1
  134. package/lib/commands/menu/shared/facts.js +1 -1
  135. package/lib/commands/menu/shared/index.js +1 -1
  136. package/lib/commands/menu/shared/inquirer.js +1 -1
  137. package/lib/commands/menu/shared/local-pages.js +1 -1
  138. package/lib/commands/menu/shared/logic.js +1 -1
  139. package/lib/commands/menu/shared/mutations.js +1 -1
  140. package/lib/commands/menu/shared/service.js +1 -1
  141. package/lib/commands/menu/shared/sync-core.js +1 -1
  142. package/lib/commands/menu/shared/update-core.js +1 -1
  143. package/lib/commands/menu/shared/valid-url.js +1 -1
  144. package/lib/commands/menu/sync.js +1 -1
  145. package/lib/commands/menu/visibility-update.js +1 -1
  146. package/lib/commands/notification/config-create.js +1 -1
  147. package/lib/commands/notification/config-delete.js +1 -1
  148. package/lib/commands/notification/config-list.js +1 -1
  149. package/lib/commands/notification/config-update.js +1 -1
  150. package/lib/commands/notification/index.js +1 -1
  151. package/lib/commands/notification/shared.js +1 -1
  152. package/lib/commands/ocr/index.js +1 -1
  153. package/lib/commands/page/create.js +1 -1
  154. package/lib/commands/page/custom/detail.js +1 -1
  155. package/lib/commands/page/custom/list.js +1 -1
  156. package/lib/commands/page/custom/publish.js +1 -1
  157. package/lib/commands/page/custom/shared.js +1 -1
  158. package/lib/commands/page/custom/syntax.js +1 -1
  159. package/lib/commands/page/custom/template.js +1 -1
  160. package/lib/commands/page/custom/update.js +1 -1
  161. package/lib/commands/page/data-list-status.js +1 -1
  162. package/lib/commands/page/generate-start.js +1 -1
  163. package/lib/commands/page/generate-status.js +1 -1
  164. package/lib/commands/page/index.js +1 -1
  165. package/lib/commands/page/pull.js +1 -1
  166. package/lib/commands/page/push.js +1 -1
  167. package/lib/commands/page/relation-audit.js +1 -1
  168. package/lib/commands/page/restore.js +1 -1
  169. package/lib/commands/page/shared.js +1 -1
  170. package/lib/commands/page/sync.js +1 -1
  171. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  172. package/lib/commands/project/create/format-elapsed.js +1 -1
  173. package/lib/commands/project/create/main.js +1 -1
  174. package/lib/commands/project/create/materialize-project-template.js +1 -1
  175. package/lib/commands/project/create/project-name.js +1 -1
  176. package/lib/commands/project/create/project-template-archive.js +1 -1
  177. package/lib/commands/project/create/project-template-path.js +1 -1
  178. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  179. package/lib/commands/project/create/use-format-code.js +1 -1
  180. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  181. package/lib/commands/project/index.js +1 -1
  182. package/lib/commands/project/upgrade.js +1 -1
  183. package/lib/commands/registry.js +1 -1
  184. package/lib/commands/role/delete.js +1 -1
  185. package/lib/commands/role/detail.js +1 -1
  186. package/lib/commands/role/index.js +1 -1
  187. package/lib/commands/role/list.js +1 -1
  188. package/lib/commands/role/shared.js +1 -1
  189. package/lib/commands/role/update.js +1 -1
  190. package/lib/commands/role/user-add.js +1 -1
  191. package/lib/commands/role/user-remove.js +1 -1
  192. package/lib/commands/role/user-resolve.js +1 -1
  193. package/lib/commands/run/index.js +1 -1
  194. package/lib/commands/schema.js +1 -1
  195. package/lib/commands/sql/create.js +1 -1
  196. package/lib/commands/sql/delete.js +1 -1
  197. package/lib/commands/sql/detail.js +1 -1
  198. package/lib/commands/sql/exec.js +1 -1
  199. package/lib/commands/sql/index.js +1 -1
  200. package/lib/commands/sql/list.js +1 -1
  201. package/lib/commands/sql/pull.js +1 -1
  202. package/lib/commands/sql/push.js +1 -1
  203. package/lib/commands/sql/shared.js +1 -1
  204. package/lib/commands/sql/status.js +1 -1
  205. package/lib/commands/sql/validate.js +1 -1
  206. package/lib/commands/task/index.js +1 -1
  207. package/lib/commands/task/status.js +1 -1
  208. package/lib/commands/tenant/index.js +1 -1
  209. package/lib/commands/tenant/members-list.js +1 -1
  210. package/lib/commands/tenant/shared.js +1 -1
  211. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  212. package/lib/commands/user-account/index.js +1 -1
  213. package/lib/commands/workspace/add.js +1 -1
  214. package/lib/commands/workspace/index.js +1 -1
  215. package/lib/commands/workspace/remove.js +1 -1
  216. package/lib/config/deployment-sync.d.ts +10 -0
  217. package/lib/config/deployment-sync.js +1 -0
  218. package/lib/config/domain-config.js +1 -1
  219. package/lib/config/project-routing.js +1 -1
  220. package/lib/config/schema.js +1 -1
  221. package/lib/constant/cdn.js +1 -1
  222. package/lib/constant/cli.js +1 -1
  223. package/lib/constant/defaults.js +1 -1
  224. package/lib/constant/domain.js +1 -1
  225. package/lib/constant/env.js +1 -1
  226. package/lib/constant/output.js +1 -1
  227. package/lib/constant/paths.js +1 -1
  228. package/lib/constant/region.js +1 -1
  229. package/lib/constant/risk.js +1 -1
  230. package/lib/constant/routing-profile.js +1 -1
  231. package/lib/context/app-resolver.d.ts +2 -0
  232. package/lib/context/app-resolver.js +1 -1
  233. package/lib/context/auth-resolver.js +1 -1
  234. package/lib/context/config-loader.js +1 -1
  235. package/lib/context.js +1 -1
  236. package/lib/core/alias-resolver.js +1 -1
  237. package/lib/core/api-client.d.ts +35 -0
  238. package/lib/core/api-client.js +1 -1
  239. package/lib/core/bff/config.js +1 -1
  240. package/lib/core/bff/file-system.js +1 -1
  241. package/lib/core/bff/hash.js +1 -1
  242. package/lib/core/bff/lock.js +1 -1
  243. package/lib/core/bff/utils.js +1 -1
  244. package/lib/core/db-resolver.js +1 -1
  245. package/lib/core/page/file-system.js +1 -1
  246. package/lib/core/page/hash.js +1 -1
  247. package/lib/core/page/lock.js +1 -1
  248. package/lib/core/sql-index-auditor.js +1 -1
  249. package/lib/core/sql-sync/config.js +1 -1
  250. package/lib/core/sql-sync/file-system.js +1 -1
  251. package/lib/core/sql-sync/hash.js +1 -1
  252. package/lib/core/sql-sync/lock.js +1 -1
  253. package/lib/core/sql-sync/utils.js +1 -1
  254. package/lib/core/sql-validator.js +1 -1
  255. package/lib/errors.js +1 -1
  256. package/lib/framework/build-all-flags.js +1 -1
  257. package/lib/framework/error-output.js +1 -1
  258. package/lib/framework/explicit-yes.js +1 -1
  259. package/lib/framework/flags.js +1 -1
  260. package/lib/framework/help.js +1 -1
  261. package/lib/framework/index.js +1 -1
  262. package/lib/framework/output.js +1 -1
  263. package/lib/framework/response.js +1 -1
  264. package/lib/framework/runner-alias.js +1 -1
  265. package/lib/framework/runner.js +1 -1
  266. package/lib/framework/schema-export.js +1 -1
  267. package/lib/framework/types.d.ts +4 -0
  268. package/lib/framework/types.js +1 -1
  269. package/lib/generated/build-info.d.ts +4 -4
  270. package/lib/generated/build-info.js +1 -1
  271. package/lib/help.js +1 -1
  272. package/lib/postinstall.js +1 -1
  273. package/lib/runtime/confirmation.js +1 -1
  274. package/lib/runtime/event.js +1 -1
  275. package/lib/runtime/index.js +1 -1
  276. package/lib/runtime/queue.js +1 -1
  277. package/lib/runtime/resolve.js +1 -1
  278. package/lib/skills/builtin-skill.js +1 -1
  279. package/lib/skills/main.js +1 -1
  280. package/lib/skills/npx-skills-add.js +1 -1
  281. package/lib/skills/skill-presence.js +1 -1
  282. package/lib/telemetry/cli-command-trace.js +1 -1
  283. package/lib/telemetry/cli-help-trace.js +1 -1
  284. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  285. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  286. package/lib/telemetry/send-cli-trace-log.js +1 -1
  287. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  288. package/lib/utils/ai_config.js +1 -1
  289. package/lib/utils/apply-jq-filter.js +1 -1
  290. package/lib/utils/cdn-config.js +1 -1
  291. package/lib/utils/check-sdk-version.js +1 -1
  292. package/lib/utils/cli-version-check.js +1 -1
  293. package/lib/utils/cli-version-policy.js +1 -1
  294. package/lib/utils/config.js +1 -1
  295. package/lib/utils/entity-with-id.js +1 -1
  296. package/lib/utils/file-utils.js +1 -1
  297. package/lib/utils/guides-cdn.js +1 -1
  298. package/lib/utils/http-client.js +1 -1
  299. package/lib/utils/is-non-interactive.js +1 -1
  300. package/lib/utils/logger.js +1 -1
  301. package/lib/utils/params.js +1 -1
  302. package/lib/utils/platform.js +1 -1
  303. package/lib/utils/sleep.js +1 -1
  304. package/lib/utils/template-replacer.js +1 -1
  305. package/lib/utils/update-notice.js +1 -1
  306. package/lib/utils/version.js +1 -1
  307. package/lib/utils/with-active-cookie.js +1 -1
  308. package/lib/utils/write-cli-side-channel.js +1 -1
  309. package/package.json +1 -1
  310. package/skills/rabetbase/SKILL.md +11 -5
  311. package/skills/rabetbase/references/rabetbase-dataset-business-group-update.md +9 -9
  312. package/skills/rabetbase/references/rabetbase-dataset-business-groups.md +1 -1
  313. package/skills/rabetbase/references/rabetbase-dataset-field-restore.md +59 -0
  314. package/skills/rabetbase/references/rabetbase-dataset-user-deleted-field-list.md +47 -0
  315. package/skills/rabetbase/references/rabetbase-deployment-sync.md +92 -0
  316. package/skills/rabetbase.manifest.json +6 -3
@@ -1 +1 @@
1
- const a185_0x457397=a185_0x1823;(function(_0x330867,_0x3a8e84){const _0x15db39=a185_0x1823,_0x5dbd72=_0x330867();while(!![]){try{const _0x591371=-parseInt(_0x15db39(0x15e))/0x1+-parseInt(_0x15db39(0x158))/0x2+-parseInt(_0x15db39(0x17e))/0x3*(-parseInt(_0x15db39(0x163))/0x4)+-parseInt(_0x15db39(0x16a))/0x5*(-parseInt(_0x15db39(0x14f))/0x6)+parseInt(_0x15db39(0x167))/0x7*(-parseInt(_0x15db39(0x181))/0x8)+parseInt(_0x15db39(0x146))/0x9*(parseInt(_0x15db39(0x164))/0xa)+-parseInt(_0x15db39(0x17f))/0xb;if(_0x591371===_0x3a8e84)break;else _0x5dbd72['push'](_0x5dbd72['shift']());}catch(_0x4ec90f){_0x5dbd72['push'](_0x5dbd72['shift']());}}}(a185_0x2d78,0x4787e));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x2413ad){const _0xdb2d5a=a185_0x1823;if(_0x2413ad==='mybatisXml')return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0xdb2d5a(0x15c),_0xdb2d5a(0x147),'']['join']('\x0a');return[_0xdb2d5a(0x170),''][_0xdb2d5a(0x16f)]('\x0a');}export const sqlCreate={'service':a185_0x457397(0x149),'command':a185_0x457397(0x17a),'description':a185_0x457397(0x15a),'risk':a185_0x457397(0x165),'flags':[{'name':a185_0x457397(0x157),'type':a185_0x457397(0x169),'description':a185_0x457397(0x140)},{'name':a185_0x457397(0x176),'type':'number','description':a185_0x457397(0x171)},{'name':'mode','type':a185_0x457397(0x169),'enum':[a185_0x457397(0x149),'mybatisXml'],'description':a185_0x457397(0x17b)}],async 'validate'(_0x5d9b55){const _0x4fe34c=a185_0x457397;if(!_0x5d9b55[_0x4fe34c(0x150)])return;if(!_0x5d9b55['str']('name')[_0x4fe34c(0x16b)]())throw CliErrors[_0x4fe34c(0x16d)]('name',_0x4fe34c(0x178));const _0x1879bc=resolveProvidedDbId(_0x5d9b55);if(typeof _0x1879bc!==_0x4fe34c(0x161)||!Number[_0x4fe34c(0x148)](_0x1879bc)||_0x1879bc<=0x0)throw CliErrors['flagMissing'](_0x4fe34c(0x176),_0x4fe34c(0x14b));if(!_0x5d9b55[_0x4fe34c(0x159)]('mode')[_0x4fe34c(0x16b)]())throw CliErrors[_0x4fe34c(0x16d)](_0x4fe34c(0x180),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x40c745){const _0x5134de=a185_0x457397,_0x128a98=loadSqlProjectConfig(_0x40c745['appCode']),{sqlName:_0x38dad2,dbId:_0x2dcdde,dbName:_0x442028,mode:_0x2d345e}=await resolveSqlNewInputs(_0x40c745),_0x25e35a=buildSqlRelativePath('<server-generated-sqlCode>',_0x38dad2,_0x442028,_0x2d345e,_0x2dcdde),_0x1cd1c0=_0x128a98[_0x5134de(0x15f)]+'/'+_0x25e35a;return{'method':'POST','url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x40c745[_0x5134de(0x174)],'sqlName':_0x38dad2,'dbId':_0x2dcdde,'mode':_0x2d345e,'localPath':_0x1cd1c0},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x128a98[_0x5134de(0x15f)]};},async 'execute'(_0x1ae5f6){const _0x15bd31=a185_0x457397,_0x150bc6=loadSqlProjectConfig(_0x1ae5f6[_0x15bd31(0x174)]),{sqlName:_0x3043d5,dbId:_0x225040,dbName:_0x455f00,mode:_0x2f4f23}=await resolveSqlNewInputs(_0x1ae5f6),_0x703e80=generateSqlTemplate(_0x2f4f23),_0x5c085c=await createSqlQuery({'appCode':_0x1ae5f6[_0x15bd31(0x174)],'sqlName':_0x3043d5,'dbId':_0x225040,'sqlContent':_0x703e80}),_0x13d7ac=ensureRemoteSqlContent(_0x5c085c),_0x2044db=_0x455f00||await getDbName(_0x1ae5f6[_0x15bd31(0x174)],_0x225040)[_0x15bd31(0x145)](()=>undefined),_0x5db2b4=buildSqlRelativePath(_0x5c085c[_0x15bd31(0x141)],_0x5c085c[_0x15bd31(0x172)],_0x2044db,_0x2f4f23,_0x225040),_0x18f5be=_0x150bc6[_0x15bd31(0x15f)]+'/'+_0x5db2b4,_0x12641e=buildLocalSqlFileContent({'sqlCode':_0x5c085c[_0x15bd31(0x141)],'sqlName':_0x5c085c[_0x15bd31(0x172)],'dbId':_0x5c085c['dbId']},_0x13d7ac,{'dbName':_0x2044db,'mode':_0x2f4f23,'syncedAt':new Date()[_0x15bd31(0x16e)](),'description':_0x5c085c[_0x15bd31(0x144)]});if(await fileExists(_0x18f5be))throw CliErrors[_0x15bd31(0x182)](_0x15bd31(0x15d)+_0x18f5be);await ensureParentDirectory(_0x18f5be),await writeFile(_0x18f5be,_0x12641e,_0x15bd31(0x154));const _0x10f77a=await readSqlLockFile(_0x150bc6[_0x15bd31(0x17c)]),{lockData:_0x19416a,appLock:_0x2b11ea}=ensureSqlLockScope(_0x10f77a??createEmptySqlLock(),_0x150bc6['appCode'],_0x150bc6[_0x15bd31(0x142)],_0x15bd31(0x14c));return _0x2b11ea[_0x15bd31(0x14e)][_0x5c085c[_0x15bd31(0x141)]]={...buildSqlLockEntry(_0x5c085c,_0x13d7ac,computeSqlContentHash(_0x12641e),{'dbName':_0x2044db}),'path':_0x5db2b4,'mode':_0x2f4f23},_0x2b11ea[_0x15bd31(0x143)]=new Date()[_0x15bd31(0x16e)](),await writeSqlLockFile(_0x150bc6[_0x15bd31(0x17c)],_0x19416a),{'ok':!![],'data':{'id':_0x5c085c['id'],'sqlCode':_0x5c085c['sqlCode'],'sqlName':_0x5c085c[_0x15bd31(0x172)],'dbId':_0x5c085c[_0x15bd31(0x175)],'path':_0x18f5be,'mode':_0x2f4f23},'message':_0x15bd31(0x168)+_0x5c085c[_0x15bd31(0x141)]};}};async function resolveSqlNewInputs(_0x290592){const _0x1d399d=await resolveSqlNameInput(_0x290592),{dbId:_0x293ace,dbName:_0x133675}=await resolveDbSelection(_0x290592),_0x34ef92=await resolveSqlModeInput(_0x290592);return{'sqlName':_0x1d399d,'dbId':_0x293ace,'dbName':_0x133675,'mode':_0x34ef92};}async function resolveSqlNameInput(_0x43c169){const _0x3799bb=a185_0x457397,_0x593ef0=_0x43c169[_0x3799bb(0x159)](_0x3799bb(0x157))[_0x3799bb(0x16b)]();if(_0x593ef0)return _0x593ef0;if(_0x43c169['nonInteractive'])throw CliErrors[_0x3799bb(0x16d)](_0x3799bb(0x157),_0x3799bb(0x178));return(await input({'message':_0x3799bb(0x166),'validate':_0x5dc076=>_0x5dc076[_0x3799bb(0x16b)]()?!![]:_0x3799bb(0x160)}))['trim']();}async function resolveDbSelection(_0x58befc){const _0x9f8ca6=a185_0x457397,_0x530cd7=resolveProvidedDbId(_0x58befc);if(typeof _0x530cd7===_0x9f8ca6(0x161)&&Number[_0x9f8ca6(0x148)](_0x530cd7)&&_0x530cd7>0x0)return{'dbId':_0x530cd7,'dbName':await getDbName(_0x58befc[_0x9f8ca6(0x174)],_0x530cd7)[_0x9f8ca6(0x145)](()=>undefined)};if(_0x58befc[_0x9f8ca6(0x150)])throw CliErrors[_0x9f8ca6(0x16d)](_0x9f8ca6(0x176),_0x9f8ca6(0x14b));const _0x3775a4=await listDatabases(_0x58befc[_0x9f8ca6(0x174)])[_0x9f8ca6(0x145)](()=>[]);if(_0x3775a4[_0x9f8ca6(0x14d)]===0x1)return{'dbId':_0x3775a4[0x0][_0x9f8ca6(0x175)],'dbName':_0x3775a4[0x0]['dbName']};if(_0x3775a4[_0x9f8ca6(0x14d)]>0x1){const _0x48cd3e=await select({'message':_0x9f8ca6(0x15b),'choices':[..._0x3775a4[_0x9f8ca6(0x16c)](_0x44f265=>({'name':_0x44f265[_0x9f8ca6(0x179)]+'\x20('+_0x44f265['dbId']+')','value':serializeDbSelection(_0x44f265)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':_0x9f8ca6(0x152)}]});if(_0x48cd3e!=='__manual__')return deserializeDbSelection(_0x48cd3e);}const _0x3b0cac=await input({'message':'Target\x20database\x20dbId:','validate':_0x2c1d4c=>{const _0xdbbbe9=_0x9f8ca6,_0x2df917=_0x2c1d4c[_0xdbbbe9(0x16b)]();if(!_0x2df917)return _0xdbbbe9(0x173);const _0x52b5bf=Number(_0x2df917);if(!Number['isInteger'](_0x52b5bf)||_0x52b5bf<=0x0)return _0xdbbbe9(0x14a);return!![];}});return{'dbId':Number(_0x3b0cac[_0x9f8ca6(0x16b)]())};}async function resolveSqlModeInput(_0x5273df){const _0x13d386=a185_0x457397,_0x2aa072=_0x5273df[_0x13d386(0x159)](_0x13d386(0x180))[_0x13d386(0x16b)]();if(_0x2aa072===_0x13d386(0x149)||_0x2aa072===_0x13d386(0x153))return _0x2aa072;if(_0x5273df['nonInteractive'])throw CliErrors[_0x13d386(0x16d)](_0x13d386(0x180),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x13d386(0x177),'choices':[{'name':_0x13d386(0x13e),'value':_0x13d386(0x149),'description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x13d386(0x156),'value':'mybatisXml','description':_0x13d386(0x155)}]});}function serializeDbSelection(_0x1870cc){const _0x4df4a1=a185_0x457397;return JSON[_0x4df4a1(0x151)]({'dbId':_0x1870cc[_0x4df4a1(0x175)],'dbName':_0x1870cc['dbName']});}function a185_0x2d78(){const _0x559090=['SQL\x20query\x20display\x20name','sqlCode','sqlRoot','lastSync','description','catch','261693CkUnVs','</select>','isFinite','sql','dbId\x20must\x20be\x20a\x20positive\x20integer','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','new','length','sqls','18762DIyZul','nonInteractive','stringify','__manual__','mybatisXml','utf8','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','MyBatis\x20XML\x20(mybatisXml)','name','482978StMMix','str','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Select\x20the\x20target\x20database:','\x20\x20SELECT\x201\x20AS\x20id','File\x20already\x20exists:\x20','320915vKTQqR','sqlRootDir','SQL\x20name\x20cannot\x20be\x20empty','number','flag','304mjXrsD','170SwuASI','write','SQL\x20name:','35077iIzNPz','Created\x20SQL\x20query\x20','string','935cQQmdJ','trim','map','flagMissing','toISOString','join','SELECT\x201\x20AS\x20id;','Target\x20database\x20ID','sqlName','dbId\x20cannot\x20be\x20empty','appCode','dbId','db-id','Select\x20the\x20local\x20SQL\x20mode:','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','dbName','create','Local\x20SQL\x20file\x20mode','lockFilePath','Invalid\x20database\x20selection\x20payload:\x20','8013KnBIVk','2323057PqZlwl','mode','344bjtkKO','validation','Plain\x20SQL\x20(sql)','parse'];a185_0x2d78=function(){return _0x559090;};return a185_0x2d78();}function a185_0x1823(_0x2cafd5,_0x375de1){_0x2cafd5=_0x2cafd5-0x13e;const _0x2d78e1=a185_0x2d78();let _0x1823e7=_0x2d78e1[_0x2cafd5];return _0x1823e7;}function deserializeDbSelection(_0x4b0ae1){const _0x3e15a0=a185_0x457397;try{const _0x5296ba=JSON[_0x3e15a0(0x13f)](_0x4b0ae1);if(typeof _0x5296ba[_0x3e15a0(0x175)]===_0x3e15a0(0x161)&&Number[_0x3e15a0(0x148)](_0x5296ba[_0x3e15a0(0x175)]))return{'dbId':_0x5296ba['dbId'],'dbName':_0x5296ba[_0x3e15a0(0x179)]};}catch{}throw CliErrors[_0x3e15a0(0x182)](_0x3e15a0(0x17d)+_0x4b0ae1);}function resolveProvidedDbId(_0x1960c4){const _0x154ce0=a185_0x457397,_0x259c95=_0x1960c4[_0x154ce0(0x162)](_0x154ce0(0x176));if(typeof _0x259c95==='number'&&Number[_0x154ce0(0x148)](_0x259c95))return _0x259c95;return undefined;}
1
+ const a190_0x413c8f=a190_0x108a;(function(_0x4896f1,_0x35c12c){const _0x147b46=a190_0x108a,_0x3a548e=_0x4896f1();while(!![]){try{const _0x175378=-parseInt(_0x147b46(0x1bd))/0x1+parseInt(_0x147b46(0x1eb))/0x2+parseInt(_0x147b46(0x1da))/0x3+parseInt(_0x147b46(0x1cd))/0x4*(parseInt(_0x147b46(0x1c9))/0x5)+parseInt(_0x147b46(0x1db))/0x6+-parseInt(_0x147b46(0x1c3))/0x7*(parseInt(_0x147b46(0x1dc))/0x8)+parseInt(_0x147b46(0x1d6))/0x9;if(_0x175378===_0x35c12c)break;else _0x3a548e['push'](_0x3a548e['shift']());}catch(_0x15b26a){_0x3a548e['push'](_0x3a548e['shift']());}}}(a190_0x585b,0x3e864));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x36f816){const _0x137e01=a190_0x108a;if(_0x36f816===_0x137e01(0x1c1))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','\x20\x20SELECT\x201\x20AS\x20id',_0x137e01(0x1ba),''][_0x137e01(0x1c8)]('\x0a');return[_0x137e01(0x1e0),''][_0x137e01(0x1c8)]('\x0a');}export const sqlCreate={'service':a190_0x413c8f(0x1ce),'command':a190_0x413c8f(0x1be),'description':a190_0x413c8f(0x1b8),'risk':'write','flags':[{'name':'name','type':'string','description':'SQL\x20query\x20display\x20name'},{'name':a190_0x413c8f(0x1d9),'type':a190_0x413c8f(0x1ae),'description':a190_0x413c8f(0x1af)},{'name':a190_0x413c8f(0x1b4),'type':a190_0x413c8f(0x1df),'enum':['sql',a190_0x413c8f(0x1c1)],'description':a190_0x413c8f(0x1b0)}],async 'validate'(_0x3c29d4){const _0x474077=a190_0x413c8f;if(!_0x3c29d4[_0x474077(0x1c5)])return;if(!_0x3c29d4['str']('name')['trim']())throw CliErrors[_0x474077(0x1bb)](_0x474077(0x1e6),_0x474077(0x1cc));const _0x2a6439=resolveProvidedDbId(_0x3c29d4);if(typeof _0x2a6439!==_0x474077(0x1ae)||!Number[_0x474077(0x1e3)](_0x2a6439)||_0x2a6439<=0x0)throw CliErrors['flagMissing'](_0x474077(0x1d9),_0x474077(0x1e8));if(!_0x3c29d4['str'](_0x474077(0x1b4))[_0x474077(0x1ea)]())throw CliErrors[_0x474077(0x1bb)](_0x474077(0x1b4),_0x474077(0x1d7));},async 'dryRun'(_0x52e24f){const _0x121937=a190_0x413c8f,_0x30ed46=loadSqlProjectConfig(_0x52e24f[_0x121937(0x1b3)]),{sqlName:_0x27f176,dbId:_0x591c02,dbName:_0x540510,mode:_0x41ed9d}=await resolveSqlNewInputs(_0x52e24f),_0x547412=buildSqlRelativePath('<server-generated-sqlCode>',_0x27f176,_0x540510,_0x41ed9d,_0x591c02),_0x40f786=_0x30ed46[_0x121937(0x1d5)]+'/'+_0x547412;return{'method':'POST','url':_0x121937(0x1d4),'body':{'appCode':_0x52e24f[_0x121937(0x1b3)],'sqlName':_0x27f176,'dbId':_0x591c02,'mode':_0x41ed9d,'localPath':_0x40f786},'description':_0x121937(0x1de)+_0x30ed46[_0x121937(0x1d5)]};},async 'execute'(_0x1a56df){const _0x494a2f=a190_0x413c8f,_0x1cc002=loadSqlProjectConfig(_0x1a56df['appCode']),{sqlName:_0x448189,dbId:_0x421076,dbName:_0xf178b0,mode:_0x11afcb}=await resolveSqlNewInputs(_0x1a56df),_0x56c92e=generateSqlTemplate(_0x11afcb),_0x218a2c=await createSqlQuery({'appCode':_0x1a56df[_0x494a2f(0x1b3)],'sqlName':_0x448189,'dbId':_0x421076,'sqlContent':_0x56c92e}),_0x42c832=ensureRemoteSqlContent(_0x218a2c),_0x157ef7=_0xf178b0||await getDbName(_0x1a56df[_0x494a2f(0x1b3)],_0x421076)[_0x494a2f(0x1c7)](()=>undefined),_0x563bb4=buildSqlRelativePath(_0x218a2c[_0x494a2f(0x1e1)],_0x218a2c['sqlName'],_0x157ef7,_0x11afcb,_0x421076),_0x3a3b87=_0x1cc002[_0x494a2f(0x1d5)]+'/'+_0x563bb4,_0x656935=buildLocalSqlFileContent({'sqlCode':_0x218a2c[_0x494a2f(0x1e1)],'sqlName':_0x218a2c[_0x494a2f(0x1e5)],'dbId':_0x218a2c['dbId']},_0x42c832,{'dbName':_0x157ef7,'mode':_0x11afcb,'syncedAt':new Date()['toISOString'](),'description':_0x218a2c[_0x494a2f(0x1c2)]});if(await fileExists(_0x3a3b87))throw CliErrors[_0x494a2f(0x1c0)]('File\x20already\x20exists:\x20'+_0x3a3b87);await ensureParentDirectory(_0x3a3b87),await writeFile(_0x3a3b87,_0x656935,_0x494a2f(0x1e2));const _0x3a87d9=await readSqlLockFile(_0x1cc002[_0x494a2f(0x1d2)]),{lockData:_0x144833,appLock:_0x4e0e39}=ensureSqlLockScope(_0x3a87d9??createEmptySqlLock(),_0x1cc002[_0x494a2f(0x1b3)],_0x1cc002[_0x494a2f(0x1d1)],_0x494a2f(0x1ad));return _0x4e0e39['sqls'][_0x218a2c[_0x494a2f(0x1e1)]]={...buildSqlLockEntry(_0x218a2c,_0x42c832,computeSqlContentHash(_0x656935),{'dbName':_0x157ef7}),'path':_0x563bb4,'mode':_0x11afcb},_0x4e0e39[_0x494a2f(0x1cb)]=new Date()[_0x494a2f(0x1b1)](),await writeSqlLockFile(_0x1cc002[_0x494a2f(0x1d2)],_0x144833),{'ok':!![],'data':{'id':_0x218a2c['id'],'sqlCode':_0x218a2c[_0x494a2f(0x1e1)],'sqlName':_0x218a2c[_0x494a2f(0x1e5)],'dbId':_0x218a2c[_0x494a2f(0x1bc)],'path':_0x3a3b87,'mode':_0x11afcb},'message':'Created\x20SQL\x20query\x20'+_0x218a2c['sqlCode']};}};function a190_0x585b(){const _0x2bfffa=['sqlRootDir','1267614RUwRgZ','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','Plain\x20SQL\x20(sql)','db-id','342324aneCWL','2300316hjxzbw','20728eMbXnQ','Target\x20database\x20dbId:','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','string','SELECT\x201\x20AS\x20id;','sqlCode','utf8','isFinite','length','sqlName','name','str','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','trim','315564RFRNvg','✎\x20Enter\x20dbId\x20manually','new','number','Target\x20database\x20ID','Local\x20SQL\x20file\x20mode','toISOString','isInteger','appCode','mode','flag','dbId\x20cannot\x20be\x20empty','__manual__','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','</select>','flagMissing','dbId','397475LZPSgP','create','SQL\x20name:','validation','mybatisXml','description','847WwZHZH','Select\x20the\x20target\x20database:','nonInteractive','dbName','catch','join','94980ZyhFOc','parse','lastSync','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','36jTgxjh','sql','MyBatis\x20XML\x20(mybatisXml)','Select\x20the\x20local\x20SQL\x20mode:','sqlRoot','lockFilePath','SQL\x20name\x20cannot\x20be\x20empty','/smartapi/custom/saveUserCustomSql'];a190_0x585b=function(){return _0x2bfffa;};return a190_0x585b();}async function resolveSqlNewInputs(_0x455b26){const _0x13af89=await resolveSqlNameInput(_0x455b26),{dbId:_0x208dcb,dbName:_0x3bdb9a}=await resolveDbSelection(_0x455b26),_0x39213c=await resolveSqlModeInput(_0x455b26);return{'sqlName':_0x13af89,'dbId':_0x208dcb,'dbName':_0x3bdb9a,'mode':_0x39213c};}function a190_0x108a(_0x2bc7d9,_0x4972bb){_0x2bc7d9=_0x2bc7d9-0x1ad;const _0x585bb1=a190_0x585b();let _0x108ae4=_0x585bb1[_0x2bc7d9];return _0x108ae4;}async function resolveSqlNameInput(_0x5db6ec){const _0x2bb4a1=a190_0x413c8f,_0x1eb929=_0x5db6ec[_0x2bb4a1(0x1e7)](_0x2bb4a1(0x1e6))['trim']();if(_0x1eb929)return _0x1eb929;if(_0x5db6ec[_0x2bb4a1(0x1c5)])throw CliErrors[_0x2bb4a1(0x1bb)](_0x2bb4a1(0x1e6),_0x2bb4a1(0x1cc));return(await input({'message':_0x2bb4a1(0x1bf),'validate':_0x4348b8=>_0x4348b8[_0x2bb4a1(0x1ea)]()?!![]:_0x2bb4a1(0x1d3)}))[_0x2bb4a1(0x1ea)]();}async function resolveDbSelection(_0x423bcb){const _0x3f82e7=a190_0x413c8f,_0x261dd0=resolveProvidedDbId(_0x423bcb);if(typeof _0x261dd0==='number'&&Number[_0x3f82e7(0x1e3)](_0x261dd0)&&_0x261dd0>0x0)return{'dbId':_0x261dd0,'dbName':await getDbName(_0x423bcb[_0x3f82e7(0x1b3)],_0x261dd0)[_0x3f82e7(0x1c7)](()=>undefined)};if(_0x423bcb[_0x3f82e7(0x1c5)])throw CliErrors['flagMissing']('db-id',_0x3f82e7(0x1e8));const _0x5743a3=await listDatabases(_0x423bcb[_0x3f82e7(0x1b3)])[_0x3f82e7(0x1c7)](()=>[]);if(_0x5743a3[_0x3f82e7(0x1e4)]===0x1)return{'dbId':_0x5743a3[0x0][_0x3f82e7(0x1bc)],'dbName':_0x5743a3[0x0]['dbName']};if(_0x5743a3[_0x3f82e7(0x1e4)]>0x1){const _0x35d409=await select({'message':_0x3f82e7(0x1c4),'choices':[..._0x5743a3['map'](_0x3d3cc8=>({'name':_0x3d3cc8[_0x3f82e7(0x1c6)]+'\x20('+_0x3d3cc8[_0x3f82e7(0x1bc)]+')','value':serializeDbSelection(_0x3d3cc8)})),{'name':_0x3f82e7(0x1ec),'value':_0x3f82e7(0x1b7)}]});if(_0x35d409!==_0x3f82e7(0x1b7))return deserializeDbSelection(_0x35d409);}const _0x589c21=await input({'message':_0x3f82e7(0x1dd),'validate':_0x2b0d39=>{const _0x466a6c=_0x3f82e7,_0x1397c9=_0x2b0d39[_0x466a6c(0x1ea)]();if(!_0x1397c9)return _0x466a6c(0x1b6);const _0x2fdd90=Number(_0x1397c9);if(!Number[_0x466a6c(0x1b2)](_0x2fdd90)||_0x2fdd90<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x589c21[_0x3f82e7(0x1ea)]())};}async function resolveSqlModeInput(_0xf943b1){const _0x2b3267=a190_0x413c8f,_0x3a2ae3=_0xf943b1[_0x2b3267(0x1e7)](_0x2b3267(0x1b4))['trim']();if(_0x3a2ae3==='sql'||_0x3a2ae3==='mybatisXml')return _0x3a2ae3;if(_0xf943b1[_0x2b3267(0x1c5)])throw CliErrors[_0x2b3267(0x1bb)]('mode',_0x2b3267(0x1d7));return await select({'message':_0x2b3267(0x1d0),'choices':[{'name':_0x2b3267(0x1d8),'value':_0x2b3267(0x1ce),'description':_0x2b3267(0x1e9)},{'name':_0x2b3267(0x1cf),'value':_0x2b3267(0x1c1),'description':_0x2b3267(0x1b9)}]});}function serializeDbSelection(_0x20661d){const _0x583480=a190_0x413c8f;return JSON['stringify']({'dbId':_0x20661d[_0x583480(0x1bc)],'dbName':_0x20661d['dbName']});}function deserializeDbSelection(_0x265407){const _0x5e1321=a190_0x413c8f;try{const _0x4153e1=JSON[_0x5e1321(0x1ca)](_0x265407);if(typeof _0x4153e1[_0x5e1321(0x1bc)]===_0x5e1321(0x1ae)&&Number[_0x5e1321(0x1e3)](_0x4153e1[_0x5e1321(0x1bc)]))return{'dbId':_0x4153e1['dbId'],'dbName':_0x4153e1['dbName']};}catch{}throw CliErrors['validation']('Invalid\x20database\x20selection\x20payload:\x20'+_0x265407);}function resolveProvidedDbId(_0x447366){const _0x4637a6=a190_0x413c8f,_0x18842f=_0x447366[_0x4637a6(0x1b5)](_0x4637a6(0x1d9));if(typeof _0x18842f==='number'&&Number['isFinite'](_0x18842f))return _0x18842f;return undefined;}
@@ -1 +1 @@
1
- function a186_0x37de(_0x2566ce,_0x6e314a){_0x2566ce=_0x2566ce-0x96;const _0x17bbe1=a186_0x17bb();let _0x37de20=_0x17bbe1[_0x2566ce];return _0x37de20;}const a186_0x26778f=a186_0x37de;(function(_0x575aba,_0x3f123f){const _0x4b2c30=a186_0x37de,_0x208100=_0x575aba();while(!![]){try{const _0x3fd963=parseInt(_0x4b2c30(0xb1))/0x1+parseInt(_0x4b2c30(0x96))/0x2+parseInt(_0x4b2c30(0xa5))/0x3*(-parseInt(_0x4b2c30(0x9b))/0x4)+-parseInt(_0x4b2c30(0x98))/0x5+-parseInt(_0x4b2c30(0xa4))/0x6+parseInt(_0x4b2c30(0xaa))/0x7*(parseInt(_0x4b2c30(0xb4))/0x8)+parseInt(_0x4b2c30(0xb3))/0x9*(-parseInt(_0x4b2c30(0xa3))/0xa);if(_0x3fd963===_0x3f123f)break;else _0x208100['push'](_0x208100['shift']());}catch(_0x2e0423){_0x208100['push'](_0x208100['shift']());}}}(a186_0x17bb,0x6fa79));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';function a186_0x17bb(){const _0x383df7=['sql','str','toISOString','322373UYlUui','validation','3179871fHNirC','6516248PCEJmW','filter','length','remoteId','trashedTo','472094OqzRXU','entries','1464200adOuUf','replace','sqlRoot','8mhYauY','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','Deleted\x20','POST','sqlRootDir','sqlcode','lockFilePath','appCode','10xDgtiV','1470798QzGAhr','36483BsRreJ','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','projectRoot','delete','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','7ERIyxW','startsWith','sqls','trashDir'];a186_0x17bb=function(){return _0x383df7;};return a186_0x17bb();}import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a186_0x26778f(0xae),'command':a186_0x26778f(0xa8),'description':a186_0x26778f(0xa9),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x93c4b7){const _0x1ba423=a186_0x26778f,_0xf610de=loadSqlProjectConfig(_0x93c4b7[_0x1ba423(0xa2)]),_0x59f04a=await readSqlLockFile(_0xf610de[_0x1ba423(0xa1)]);if(!_0x59f04a)throw CliErrors['validation'](_0x1ba423(0xa6));},async 'dryRun'(_0x2169bb){const _0x355f9a=a186_0x26778f,_0x52814d=loadSqlProjectConfig(_0x2169bb[_0x355f9a(0xa2)]),_0x45b89e=await readSqlLockFile(_0x52814d[_0x355f9a(0xa1)]);if(!_0x45b89e)throw CliErrors[_0x355f9a(0xb2)](_0x355f9a(0xa6));const {appLock:_0x5bd1e0}=ensureSqlLockScope(_0x45b89e,_0x2169bb[_0x355f9a(0xa2)],_0x52814d[_0x355f9a(0x9a)],_0x355f9a(0xa8)),_0x32317f=_0x2169bb[_0x355f9a(0xaf)](_0x355f9a(0xa0)),_0x35bc67=_0x5bd1e0[_0x355f9a(0xac)][_0x32317f];if(!_0x35bc67)throw CliErrors[_0x355f9a(0xb2)](_0x355f9a(0x9c)+_0x32317f+'\x22.');return{'method':_0x355f9a(0x9e),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x32317f,'id':_0x35bc67['remoteId'],'localPath':resolveLocalSqlFilePath(_0x52814d,_0x32317f,_0x35bc67)},'description':'Would\x20delete\x20SQL\x20'+_0x32317f+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x52814d[_0x355f9a(0xad)]};},async 'execute'(_0x23834d){const _0x580758=a186_0x26778f,_0x1f5268=loadSqlProjectConfig(_0x23834d[_0x580758(0xa2)]),_0x5da37a=await readSqlLockFile(_0x1f5268[_0x580758(0xa1)]);if(!_0x5da37a)throw CliErrors[_0x580758(0xb2)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x2cafb0,appLock:_0x2f2345}=ensureSqlLockScope(_0x5da37a,_0x23834d[_0x580758(0xa2)],_0x1f5268['sqlRoot'],'delete'),_0x3c868e=_0x23834d[_0x580758(0xaf)]('sqlcode'),_0x2440a2=_0x2f2345[_0x580758(0xac)][_0x3c868e];if(!_0x2440a2)throw CliErrors['validation'](_0x580758(0x9c)+_0x3c868e+'\x22.');await deleteSqlQuery({'id':_0x2440a2[_0x580758(0xb7)],'sqlCode':_0x3c868e}),_0x2f2345['sqls']=Object['fromEntries'](Object[_0x580758(0x97)](_0x2f2345[_0x580758(0xac)])[_0x580758(0xb5)](([_0x22e129])=>_0x22e129!==_0x3c868e)),_0x2f2345['lastSync']=new Date()[_0x580758(0xb0)](),await writeSqlLockFile(_0x1f5268[_0x580758(0xa1)],_0x2cafb0);const _0x55674c=resolveLocalSqlFilePath(_0x1f5268,_0x3c868e,_0x2440a2);let _0x271572;await fileExists(_0x55674c)&&(_0x271572=await moveToTrash(_0x1f5268[_0x580758(0xa7)],_0x1f5268['trashDir'],_0x55674c),await cleanupEmptyDirectories(dirname(_0x55674c),_0x1f5268[_0x580758(0x9f)]));const _0x50e955={'deleted':_0x3c868e,'remoteId':_0x2440a2[_0x580758(0xb7)]};if(_0x271572)_0x50e955[_0x580758(0xb8)]=_0x271572;return{'ok':!![],'data':_0x50e955,'message':_0x580758(0x9d)+_0x3c868e+(_0x271572?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x1fb8cc,_0x43caa8,_0x3ca563){const _0x25b7d1=a186_0x26778f,_0x30e504=new Date()[_0x25b7d1(0xb0)]()[_0x25b7d1(0x99)](/[:.]/g,'-'),_0x6c099=relative(_0x1fb8cc,_0x3ca563),_0x3e79e4=join(_0x43caa8,_0x30e504,_0x6c099);return await mkdir(dirname(_0x3e79e4),{'recursive':!![]}),await rename(_0x3ca563,_0x3e79e4),_0x3e79e4;}async function cleanupEmptyDirectories(_0x1c7da5,_0x3bae9b){const _0x2b2c70=a186_0x26778f;let _0x7474d8=resolve(_0x1c7da5);const _0x55dfd3=resolve(_0x3bae9b);while(_0x7474d8[_0x2b2c70(0xab)](''+_0x55dfd3+sep)||_0x7474d8===_0x55dfd3){if(_0x7474d8===_0x55dfd3)return;try{const _0xe5e9a2=await readdir(_0x7474d8);if(_0xe5e9a2[_0x2b2c70(0xb6)]>0x0)return;await rmdir(_0x7474d8);}catch{return;}_0x7474d8=dirname(_0x7474d8);}}
1
+ const a191_0x3590d3=a191_0x2759;(function(_0x24847a,_0x42c8f8){const _0x2fc4eb=a191_0x2759,_0xdfccda=_0x24847a();while(!![]){try{const _0x1d9f91=-parseInt(_0x2fc4eb(0x15c))/0x1+parseInt(_0x2fc4eb(0x169))/0x2*(-parseInt(_0x2fc4eb(0x15e))/0x3)+parseInt(_0x2fc4eb(0x167))/0x4+-parseInt(_0x2fc4eb(0x15f))/0x5*(-parseInt(_0x2fc4eb(0x15b))/0x6)+parseInt(_0x2fc4eb(0x16c))/0x7*(parseInt(_0x2fc4eb(0x16a))/0x8)+-parseInt(_0x2fc4eb(0x163))/0x9+parseInt(_0x2fc4eb(0x166))/0xa*(-parseInt(_0x2fc4eb(0x14f))/0xb);if(_0x1d9f91===_0x42c8f8)break;else _0xdfccda['push'](_0xdfccda['shift']());}catch(_0x47b6eb){_0xdfccda['push'](_0xdfccda['shift']());}}}(a191_0x2d4c,0x98688));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a191_0x2759(_0x52f8bd,_0x2bb9c6){_0x52f8bd=_0x52f8bd-0x14c;const _0x2d4cc7=a191_0x2d4c();let _0x27597a=_0x2d4cc7[_0x52f8bd];return _0x27597a;}import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';function a191_0x2d4c(){const _0x25fefd=['lastSync','358ShBliv','40HKVcOo','/smartapi/custom/deleteUserCustomSql','1427342qIootE','entries','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','trashDir','sqls','filter','fromEntries','delete','sql','str','22OjjSAq','Would\x20delete\x20SQL\x20','appCode','validation','toISOString','\x20(local\x20file\x20moved\x20to\x20trash)','lockFilePath','length','remoteId','sqlRootDir','sqlRoot','POST','48NCmypV','112129CkcJFY','Deleted\x20','5151PjPBUL','451775FRAbFn','replace','startsWith','sqlcode','2896893PErLIM','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','3862200VfNThw','1582732AcGgsO'];a191_0x2d4c=function(){return _0x25fefd;};return a191_0x2d4c();}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':a191_0x3590d3(0x14d),'command':a191_0x3590d3(0x14c),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x50005b){const _0x4fe11a=a191_0x3590d3,_0x4dfc0b=loadSqlProjectConfig(_0x50005b[_0x4fe11a(0x151)]),_0x7ec027=await readSqlLockFile(_0x4dfc0b['lockFilePath']);if(!_0x7ec027)throw CliErrors['validation'](_0x4fe11a(0x164));},async 'dryRun'(_0x453847){const _0x14f26e=a191_0x3590d3,_0x141155=loadSqlProjectConfig(_0x453847['appCode']),_0xa65b15=await readSqlLockFile(_0x141155[_0x14f26e(0x155)]);if(!_0xa65b15)throw CliErrors[_0x14f26e(0x152)](_0x14f26e(0x164));const {appLock:_0x48bea9}=ensureSqlLockScope(_0xa65b15,_0x453847[_0x14f26e(0x151)],_0x141155[_0x14f26e(0x159)],_0x14f26e(0x14c)),_0x2d70bc=_0x453847[_0x14f26e(0x14e)]('sqlcode'),_0x4d8a60=_0x48bea9[_0x14f26e(0x170)][_0x2d70bc];if(!_0x4d8a60)throw CliErrors[_0x14f26e(0x152)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x2d70bc+'\x22.');return{'method':_0x14f26e(0x15a),'url':_0x14f26e(0x16b),'body':{'sqlCode':_0x2d70bc,'id':_0x4d8a60[_0x14f26e(0x157)],'localPath':resolveLocalSqlFilePath(_0x141155,_0x2d70bc,_0x4d8a60)},'description':_0x14f26e(0x150)+_0x2d70bc+_0x14f26e(0x16e)+_0x141155[_0x14f26e(0x16f)]};},async 'execute'(_0x2024f6){const _0x4500d0=a191_0x3590d3,_0x3125c9=loadSqlProjectConfig(_0x2024f6[_0x4500d0(0x151)]),_0x3fc2a5=await readSqlLockFile(_0x3125c9['lockFilePath']);if(!_0x3fc2a5)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0xb0c0f7,appLock:_0xb91739}=ensureSqlLockScope(_0x3fc2a5,_0x2024f6[_0x4500d0(0x151)],_0x3125c9[_0x4500d0(0x159)],'delete'),_0x48c8da=_0x2024f6[_0x4500d0(0x14e)](_0x4500d0(0x162)),_0x28f511=_0xb91739[_0x4500d0(0x170)][_0x48c8da];if(!_0x28f511)throw CliErrors[_0x4500d0(0x152)](_0x4500d0(0x165)+_0x48c8da+'\x22.');await deleteSqlQuery({'id':_0x28f511[_0x4500d0(0x157)],'sqlCode':_0x48c8da}),_0xb91739[_0x4500d0(0x170)]=Object[_0x4500d0(0x172)](Object[_0x4500d0(0x16d)](_0xb91739[_0x4500d0(0x170)])[_0x4500d0(0x171)](([_0x5744f0])=>_0x5744f0!==_0x48c8da)),_0xb91739[_0x4500d0(0x168)]=new Date()[_0x4500d0(0x153)](),await writeSqlLockFile(_0x3125c9['lockFilePath'],_0xb0c0f7);const _0x33dc58=resolveLocalSqlFilePath(_0x3125c9,_0x48c8da,_0x28f511);let _0x1a4335;await fileExists(_0x33dc58)&&(_0x1a4335=await moveToTrash(_0x3125c9['projectRoot'],_0x3125c9['trashDir'],_0x33dc58),await cleanupEmptyDirectories(dirname(_0x33dc58),_0x3125c9[_0x4500d0(0x158)]));const _0x3ee3c6={'deleted':_0x48c8da,'remoteId':_0x28f511['remoteId']};if(_0x1a4335)_0x3ee3c6['trashedTo']=_0x1a4335;return{'ok':!![],'data':_0x3ee3c6,'message':_0x4500d0(0x15d)+_0x48c8da+(_0x1a4335?_0x4500d0(0x154):'')};}};async function moveToTrash(_0x75e442,_0x99c74,_0x38109f){const _0x3d1fef=a191_0x3590d3,_0x24e0cc=new Date()[_0x3d1fef(0x153)]()[_0x3d1fef(0x160)](/[:.]/g,'-'),_0x3b179f=relative(_0x75e442,_0x38109f),_0x2539a1=join(_0x99c74,_0x24e0cc,_0x3b179f);return await mkdir(dirname(_0x2539a1),{'recursive':!![]}),await rename(_0x38109f,_0x2539a1),_0x2539a1;}async function cleanupEmptyDirectories(_0x13149a,_0x271acc){const _0x2957d5=a191_0x3590d3;let _0x4e7627=resolve(_0x13149a);const _0x2cd1b0=resolve(_0x271acc);while(_0x4e7627[_0x2957d5(0x161)](''+_0x2cd1b0+sep)||_0x4e7627===_0x2cd1b0){if(_0x4e7627===_0x2cd1b0)return;try{const _0xd990fb=await readdir(_0x4e7627);if(_0xd990fb[_0x2957d5(0x156)]>0x0)return;await rmdir(_0x4e7627);}catch{return;}_0x4e7627=dirname(_0x4e7627);}}
@@ -1 +1 @@
1
- const a187_0x424a89=a187_0x5629;function a187_0x5629(_0x278ab5,_0xb87336){_0x278ab5=_0x278ab5-0x8f;const _0x540e8d=a187_0x540e();let _0x5629d5=_0x540e8d[_0x278ab5];return _0x5629d5;}function a187_0x540e(){const _0x1697a9=['Return\x20full\x20raw\x20SQL\x20query\x20object','detail','sqlName','59474fbwsry','169593bJGxDM','sql','str','sqlcode','346040whNDmi','appCode','boolean','dbId','verbose','198lMOioO','9416oYZnUo','4977JWpUuH','3489110Mkwhby','795463xGOlBn','bool','12qZTTWP','sqlCode','4598760XYsCHc'];a187_0x540e=function(){return _0x1697a9;};return a187_0x540e();}(function(_0x28776f,_0x554fc9){const _0xaa07ec=a187_0x5629,_0x2628ee=_0x28776f();while(!![]){try{const _0x527632=parseInt(_0xaa07ec(0xa0))/0x1+-parseInt(_0xaa07ec(0x92))/0x2+-parseInt(_0xaa07ec(0x93))/0x3*(parseInt(_0xaa07ec(0xa2))/0x4)+parseInt(_0xaa07ec(0x9f))/0x5+-parseInt(_0xaa07ec(0xa4))/0x6+-parseInt(_0xaa07ec(0x9e))/0x7*(parseInt(_0xaa07ec(0x9d))/0x8)+-parseInt(_0xaa07ec(0x9c))/0x9*(-parseInt(_0xaa07ec(0x97))/0xa);if(_0x527632===_0x554fc9)break;else _0x2628ee['push'](_0x2628ee['shift']());}catch(_0x26c609){_0x2628ee['push'](_0x2628ee['shift']());}}}(a187_0x540e,0x6e560));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':a187_0x424a89(0x94),'command':a187_0x424a89(0x90),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':'read','flags':[SQLCODE_FLAG,{'name':a187_0x424a89(0x9b),'type':a187_0x424a89(0x99),'description':a187_0x424a89(0x8f)}],async 'execute'(_0x37584f){const _0x4f058b=a187_0x424a89,_0x3e1d46=await getSqlQueryInfo(_0x37584f[_0x4f058b(0x98)],_0x37584f[_0x4f058b(0x95)](_0x4f058b(0x96))),_0x574e21=_0x37584f[_0x4f058b(0xa1)](_0x4f058b(0x9b));if(_0x574e21)return{'ok':!![],'data':_0x3e1d46};const _0x51d680=_0x3e1d46[_0x4f058b(0x9a)]?await getDbName(_0x37584f[_0x4f058b(0x98)],_0x3e1d46[_0x4f058b(0x9a)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x3e1d46[_0x4f058b(0xa3)],'sqlName':_0x3e1d46[_0x4f058b(0x91)],'db':_0x51d680?_0x51d680+'\x20('+_0x3e1d46[_0x4f058b(0x9a)]+')':_0x3e1d46[_0x4f058b(0x9a)]??'','description':_0x3e1d46['description']??'','sqlContent':_0x3e1d46['sqlContent']??''}};}};
1
+ const a192_0x538664=a192_0x23c8;(function(_0x93c948,_0x37a0ed){const _0x509b60=a192_0x23c8,_0xaddb8a=_0x93c948();while(!![]){try{const _0x4e9c05=parseInt(_0x509b60(0x16d))/0x1+parseInt(_0x509b60(0x15e))/0x2*(parseInt(_0x509b60(0x16c))/0x3)+parseInt(_0x509b60(0x15d))/0x4+parseInt(_0x509b60(0x16a))/0x5*(-parseInt(_0x509b60(0x157))/0x6)+-parseInt(_0x509b60(0x163))/0x7*(parseInt(_0x509b60(0x15a))/0x8)+-parseInt(_0x509b60(0x168))/0x9+-parseInt(_0x509b60(0x165))/0xa;if(_0x4e9c05===_0x37a0ed)break;else _0xaddb8a['push'](_0xaddb8a['shift']());}catch(_0x3c45f6){_0xaddb8a['push'](_0xaddb8a['shift']());}}}(a192_0x2780,0x633db));function a192_0x23c8(_0x387e5b,_0xf39d81){_0x387e5b=_0x387e5b-0x157;const _0x27805a=a192_0x2780();let _0x23c8f5=_0x27805a[_0x387e5b];return _0x23c8f5;}import{getSqlQueryInfo}from'../../core/api-client.js';function a192_0x2780(){const _0x4a1cae=['description','Return\x20full\x20raw\x20SQL\x20query\x20object','str','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','68887cnbsCW','dbId','1781180LxGcXg','read','appCode','6365898wJJYJi','boolean','42260XmTznV','verbose','3zYkAqR','780513GuXFsc','264gVHqQO','sqlName','sqlCode','240BEVSGS','bool','sqlContent','2200060ghLYnH','1257042JKrdcw'];a192_0x2780=function(){return _0x4a1cae;};return a192_0x2780();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':'detail','description':a192_0x538664(0x162),'risk':a192_0x538664(0x166),'flags':[SQLCODE_FLAG,{'name':a192_0x538664(0x16b),'type':a192_0x538664(0x169),'description':a192_0x538664(0x160)}],async 'execute'(_0x2c2cd0){const _0x37b68d=a192_0x538664,_0xf0ad33=await getSqlQueryInfo(_0x2c2cd0[_0x37b68d(0x167)],_0x2c2cd0[_0x37b68d(0x161)]('sqlcode')),_0x50d2d3=_0x2c2cd0[_0x37b68d(0x15b)](_0x37b68d(0x16b));if(_0x50d2d3)return{'ok':!![],'data':_0xf0ad33};const _0x2b1761=_0xf0ad33[_0x37b68d(0x164)]?await getDbName(_0x2c2cd0[_0x37b68d(0x167)],_0xf0ad33[_0x37b68d(0x164)]):undefined;return{'ok':!![],'data':{'sqlCode':_0xf0ad33[_0x37b68d(0x159)],'sqlName':_0xf0ad33[_0x37b68d(0x158)],'db':_0x2b1761?_0x2b1761+'\x20('+_0xf0ad33['dbId']+')':_0xf0ad33['dbId']??'','description':_0xf0ad33[_0x37b68d(0x15f)]??'','sqlContent':_0xf0ad33[_0x37b68d(0x15c)]??''}};}};
@@ -1 +1 @@
1
- const a188_0x4e226d=a188_0x3b50;(function(_0x2ae646,_0x2ddf73){const _0x1fe714=a188_0x3b50,_0x4570ab=_0x2ae646();while(!![]){try{const _0x53ce5b=-parseInt(_0x1fe714(0x196))/0x1*(parseInt(_0x1fe714(0x1a1))/0x2)+parseInt(_0x1fe714(0x18e))/0x3+-parseInt(_0x1fe714(0x18c))/0x4*(parseInt(_0x1fe714(0x192))/0x5)+-parseInt(_0x1fe714(0x194))/0x6*(parseInt(_0x1fe714(0x189))/0x7)+-parseInt(_0x1fe714(0x195))/0x8*(parseInt(_0x1fe714(0x19d))/0x9)+parseInt(_0x1fe714(0x197))/0xa+parseInt(_0x1fe714(0x190))/0xb;if(_0x53ce5b===_0x2ddf73)break;else _0x4570ab['push'](_0x4570ab['shift']());}catch(_0x14dd73){_0x4570ab['push'](_0x4570ab['shift']());}}}(a188_0x5d37,0xe6bfd));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a188_0x5d37(){const _0x3f20a2=['SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','isArray','10720881EAZVfi','SQL\x20execution\x20failed','\x20row(s)\x20in\x20','Returned\x20','12418iRKBnw','execSuccess','sqlcode','11948153SHEtSA','params','appCode','143492mAdPQg','string','5013228vlBVzU','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','34573407PzMpFL','execResult','145dinTBE','sql','6euNbsh','8iFzjKD','151ZMpNWl','10070000sqccBp','str','length','execError'];a188_0x5d37=function(){return _0x3f20a2;};return a188_0x5d37();}function a188_0x3b50(_0x29bec6,_0xa956e1){_0x29bec6=_0x29bec6-0x187;const _0x5d3748=a188_0x5d37();let _0x3b5038=_0x5d3748[_0x29bec6];return _0x3b5038;}export const sqlExec={'service':a188_0x4e226d(0x193),'command':'exec','description':a188_0x4e226d(0x18f),'risk':'read','flags':[SQLCODE_FLAG,{'name':a188_0x4e226d(0x18a),'type':a188_0x4e226d(0x18d),'description':a188_0x4e226d(0x19b)}],async 'execute'(_0x17a6a8){const _0x2e947e=a188_0x4e226d,_0x529e00=parseJsonParams(_0x17a6a8[_0x2e947e(0x198)](_0x2e947e(0x18a))),_0x43b206=Date['now'](),_0x49e40f=await executeSql(_0x17a6a8[_0x2e947e(0x18b)],_0x17a6a8[_0x2e947e(0x198)](_0x2e947e(0x188)),_0x529e00),_0x8cd90d=Date['now']()-_0x43b206,_0x445e82=_0x49e40f?.[_0x2e947e(0x191)]??_0x49e40f,_0x149ec5=_0x49e40f?.[_0x2e947e(0x187)]??!![];if(!_0x149ec5)return{'ok':![],'data':{'error':_0x49e40f?.[_0x2e947e(0x19a)]||_0x2e947e(0x19e),'elapsed':_0x8cd90d},'message':_0x2e947e(0x19e)};const _0x1128f3=Array[_0x2e947e(0x19c)](_0x445e82)?_0x445e82:[];return{'ok':!![],'data':{'rows':_0x1128f3,'rowCount':_0x1128f3[_0x2e947e(0x199)],'elapsed':_0x8cd90d},'message':_0x2e947e(0x1a0)+_0x1128f3[_0x2e947e(0x199)]+_0x2e947e(0x19f)+_0x8cd90d+'ms'};}};
1
+ const a193_0x4a1d2a=a193_0x44db;(function(_0x4c7c1c,_0x40fdbc){const _0xa49edf=a193_0x44db,_0x46b313=_0x4c7c1c();while(!![]){try{const _0x5ac12a=parseInt(_0xa49edf(0x132))/0x1+parseInt(_0xa49edf(0x130))/0x2+-parseInt(_0xa49edf(0x131))/0x3*(parseInt(_0xa49edf(0x137))/0x4)+parseInt(_0xa49edf(0x134))/0x5*(parseInt(_0xa49edf(0x12d))/0x6)+-parseInt(_0xa49edf(0x12e))/0x7*(-parseInt(_0xa49edf(0x129))/0x8)+parseInt(_0xa49edf(0x126))/0x9+-parseInt(_0xa49edf(0x124))/0xa;if(_0x5ac12a===_0x40fdbc)break;else _0x46b313['push'](_0x46b313['shift']());}catch(_0x54e911){_0x46b313['push'](_0x46b313['shift']());}}}(a193_0x40e7,0xeff5f));function a193_0x44db(_0x213596,_0x2c2957){_0x213596=_0x213596-0x11f;const _0x40e73c=a193_0x40e7();let _0x44db43=_0x40e73c[_0x213596];return _0x44db43;}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a193_0x40e7(){const _0x48dbae=['14890830gyBkrl','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','2012409DDbZzm','execSuccess','sqlcode','8soSRcE','exec','now','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','210450lYlnFS','13267247TXKFFO','Returned\x20','257244oCBbWg','48gvxPHT','475414FmNqzZ','execError','180RgkCUU','str','sql','378424czKAPZ','length','read','\x20row(s)\x20in\x20','isArray','string'];a193_0x40e7=function(){return _0x48dbae;};return a193_0x40e7();}export const sqlExec={'service':a193_0x4a1d2a(0x136),'command':a193_0x4a1d2a(0x12a),'description':a193_0x4a1d2a(0x125),'risk':a193_0x4a1d2a(0x120),'flags':[SQLCODE_FLAG,{'name':'params','type':a193_0x4a1d2a(0x123),'description':a193_0x4a1d2a(0x12c)}],async 'execute'(_0x6d1972){const _0x271faf=a193_0x4a1d2a,_0x3e28a6=parseJsonParams(_0x6d1972[_0x271faf(0x135)]('params')),_0x40b75c=Date[_0x271faf(0x12b)](),_0x278c9f=await executeSql(_0x6d1972['appCode'],_0x6d1972[_0x271faf(0x135)](_0x271faf(0x128)),_0x3e28a6),_0x59529d=Date[_0x271faf(0x12b)]()-_0x40b75c,_0x63ac29=_0x278c9f?.['execResult']??_0x278c9f,_0x25d8c7=_0x278c9f?.[_0x271faf(0x127)]??!![];if(!_0x25d8c7)return{'ok':![],'data':{'error':_0x278c9f?.[_0x271faf(0x133)]||'SQL\x20execution\x20failed','elapsed':_0x59529d},'message':'SQL\x20execution\x20failed'};const _0x2b740e=Array[_0x271faf(0x122)](_0x63ac29)?_0x63ac29:[];return{'ok':!![],'data':{'rows':_0x2b740e,'rowCount':_0x2b740e['length'],'elapsed':_0x59529d},'message':_0x271faf(0x12f)+_0x2b740e[_0x271faf(0x11f)]+_0x271faf(0x121)+_0x59529d+'ms'};}};
@@ -1 +1 @@
1
- function a189_0x5832(){const _0x5a69a2=['48IvSKZQ','316PwjrMq','161544bRKfUD','2058110oPGXux','72401QEnybY','1149ATVsDd','398142uOFBEF','365PiXzvy','3352CSkPJK','51121PqmFAq'];a189_0x5832=function(){return _0x5a69a2;};return a189_0x5832();}(function(_0x57d52f,_0x357db8){const _0x34ad15=a189_0x578f,_0x5db901=_0x57d52f();while(!![]){try{const _0x1d2b45=parseInt(_0x34ad15(0x1d2))/0x1+-parseInt(_0x34ad15(0x1d4))/0x2*(parseInt(_0x34ad15(0x1ce))/0x3)+-parseInt(_0x34ad15(0x1d1))/0x4*(parseInt(_0x34ad15(0x1d0))/0x5)+-parseInt(_0x34ad15(0x1d3))/0x6*(-parseInt(_0x34ad15(0x1d7))/0x7)+-parseInt(_0x34ad15(0x1d5))/0x8+-parseInt(_0x34ad15(0x1cf))/0x9+parseInt(_0x34ad15(0x1d6))/0xa;if(_0x1d2b45===_0x357db8)break;else _0x5db901['push'](_0x5db901['shift']());}catch(_0x3fef89){_0x5db901['push'](_0x5db901['shift']());}}}(a189_0x5832,0x257d5));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';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';function a189_0x578f(_0x44097e,_0x4b38e5){_0x44097e=_0x44097e-0x1ce;const _0x5832f6=a189_0x5832();let _0x578fd9=_0x5832f6[_0x44097e];return _0x578fd9;}export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
1
+ function a194_0x1d0a(){const _0x1b39c6=['5972HlpKOv','220AasPLr','2368849tCkJAD','11ClQdCc','3591915giqPGn','239121RwuztO','5539035uGQICx','10429792qFRWfz','17376370UxQsbM','12sfEyty','4BNMyKh'];a194_0x1d0a=function(){return _0x1b39c6;};return a194_0x1d0a();}(function(_0x1e3b38,_0x3b60b7){const _0x21fecf=a194_0x3051,_0x5eab41=_0x1e3b38();while(!![]){try{const _0x145fc4=-parseInt(_0x21fecf(0x148))/0x1*(-parseInt(_0x21fecf(0x152))/0x2)+-parseInt(_0x21fecf(0x14b))/0x3+parseInt(_0x21fecf(0x151))/0x4*(-parseInt(_0x21fecf(0x14d))/0x5)+parseInt(_0x21fecf(0x150))/0x6*(-parseInt(_0x21fecf(0x149))/0x7)+parseInt(_0x21fecf(0x14e))/0x8+-parseInt(_0x21fecf(0x14c))/0x9+parseInt(_0x21fecf(0x14f))/0xa*(parseInt(_0x21fecf(0x14a))/0xb);if(_0x145fc4===_0x3b60b7)break;else _0x5eab41['push'](_0x5eab41['shift']());}catch(_0x38375b){_0x5eab41['push'](_0x5eab41['shift']());}}}(a194_0x1d0a,0xa867a));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a194_0x3051(_0x4aad77,_0x45d9fd){_0x4aad77=_0x4aad77-0x148;const _0x1d0a55=a194_0x1d0a();let _0x3051fe=_0x1d0a55[_0x4aad77];return _0x3051fe;}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 +1 @@
1
- function a190_0x5410(_0x3b5eeb,_0xd12afc){_0x3b5eeb=_0x3b5eeb-0x147;const _0x4ed60d=a190_0x4ed6();let _0x5410f6=_0x4ed60d[_0x3b5eeb];return _0x5410f6;}const a190_0x4e970f=a190_0x5410;(function(_0x15d14d,_0x51a72f){const _0x5bc308=a190_0x5410,_0x161761=_0x15d14d();while(!![]){try{const _0x222374=parseInt(_0x5bc308(0x163))/0x1+parseInt(_0x5bc308(0x153))/0x2+parseInt(_0x5bc308(0x14f))/0x3*(-parseInt(_0x5bc308(0x15d))/0x4)+parseInt(_0x5bc308(0x156))/0x5+-parseInt(_0x5bc308(0x155))/0x6+-parseInt(_0x5bc308(0x162))/0x7+parseInt(_0x5bc308(0x152))/0x8*(-parseInt(_0x5bc308(0x15e))/0x9);if(_0x222374===_0x51a72f)break;else _0x161761['push'](_0x161761['shift']());}catch(_0x4008e){_0x161761['push'](_0x161761['shift']());}}}(a190_0x4ed6,0xc52b7));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a190_0x4ed6(){const _0x504155=['name','Page\x20number','paging','List\x20custom\x20SQL\x20queries','read','136Njpzpu','4191939gTESCc','appCode','Filter\x20by\x20SQL\x20name','map','489615hicEXT','478335PsKHvV','pagesize','string','num','number','bool','sqlName','sqlcode','page','tableData','all','length','123666FJwYdy','\x20SQL\x20queries\x20(total:\x20','dbId','8TIRyqE','2654136BkidUD','boolean','996030TuKDjJ','5527365xTMNTA','verbose'];a190_0x4ed6=function(){return _0x504155;};return a190_0x4ed6();}export const sqlList={'service':'sql','command':'list','description':a190_0x4e970f(0x15b),'risk':a190_0x4e970f(0x15c),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a190_0x4e970f(0x158),'type':a190_0x4e970f(0x165),'description':a190_0x4e970f(0x160)},{'name':a190_0x4e970f(0x14b),'type':a190_0x4e970f(0x147),'description':a190_0x4e970f(0x159),'default':0x1},{'name':a190_0x4e970f(0x164),'type':a190_0x4e970f(0x147),'description':'Page\x20size'},{'name':a190_0x4e970f(0x157),'type':a190_0x4e970f(0x154),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x46b992){const _0x44b0b1=a190_0x4e970f,_0x174707=await listSqlQueries(_0x46b992[_0x44b0b1(0x15f)],{'sqlCode':_0x46b992['str'](_0x44b0b1(0x14a))||undefined,'sqlName':_0x46b992['str'](_0x44b0b1(0x158))||undefined,'currentPage':_0x46b992['num'](_0x44b0b1(0x14b)),'pageSize':_0x46b992[_0x44b0b1(0x166)](_0x44b0b1(0x164),0x32)}),_0x2eacaf=_0x46b992[_0x44b0b1(0x148)]('verbose'),_0x14a906=_0x174707[_0x44b0b1(0x14c)]??[],_0x3be15c=_0x174707[_0x44b0b1(0x15a)]?.['totalCount']??_0x14a906['length'];let _0x2bebb8;return _0x2eacaf?_0x2bebb8=_0x14a906:_0x2bebb8=await Promise[_0x44b0b1(0x14d)](_0x14a906[_0x44b0b1(0x161)](async _0x172397=>{const _0x53c662=_0x44b0b1;let _0x578689;try{_0x578689=_0x172397[_0x53c662(0x151)]?await getDbName(_0x46b992['appCode'],_0x172397['dbId']):undefined;}catch{}return{'sqlCode':_0x172397['sqlCode'],'sqlName':_0x172397[_0x53c662(0x149)],'description':_0x172397['description']??'','db':_0x578689?_0x578689+'\x20('+_0x172397['dbId']+')':_0x172397[_0x53c662(0x151)]??''};})),{'ok':!![],'data':_0x2bebb8,'message':_0x14a906[_0x44b0b1(0x14e)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':'Found\x20'+_0x14a906[_0x44b0b1(0x14e)]+_0x44b0b1(0x150)+_0x3be15c+').'};}};
1
+ const a195_0x2cc9bb=a195_0xf1d2;function a195_0x2b36(){const _0x59bb4d=['number','description','bool','1352cRydMG','appCode','2478QqkgZg','10895bJJnzd','num','length','List\x20custom\x20SQL\x20queries','1NIfhdv','sql','pagesize','sqlName','Found\x20','7398009noqrFn','paging','23254afonIx','3729218tVRUZR','verbose','Page\x20number','str','2975208HTiRhZ','sqlCode','totalCount','Page\x20size','dbId','28553DVhDNv','all','Filter\x20by\x20SQL\x20name','string','boolean','read','page','18490uCuadg','map','3603429bVGeEe'];a195_0x2b36=function(){return _0x59bb4d;};return a195_0x2b36();}(function(_0x61bdc4,_0x2ff698){const _0x3e94da=a195_0xf1d2,_0x1a7c82=_0x61bdc4();while(!![]){try{const _0x13f038=-parseInt(_0x3e94da(0x189))/0x1*(-parseInt(_0x3e94da(0x16c))/0x2)+parseInt(_0x3e94da(0x17e))/0x3+parseInt(_0x3e94da(0x170))/0x4+parseInt(_0x3e94da(0x185))/0x5*(parseInt(_0x3e94da(0x184))/0x6)+-parseInt(_0x3e94da(0x175))/0x7*(parseInt(_0x3e94da(0x182))/0x8)+parseInt(_0x3e94da(0x18e))/0x9+-parseInt(_0x3e94da(0x17c))/0xa*(parseInt(_0x3e94da(0x16b))/0xb);if(_0x13f038===_0x2ff698)break;else _0x1a7c82['push'](_0x1a7c82['shift']());}catch(_0x572050){_0x1a7c82['push'](_0x1a7c82['shift']());}}}(a195_0x2b36,0xe3de1));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a195_0xf1d2(_0x474ecb,_0x4378a9){_0x474ecb=_0x474ecb-0x16a;const _0x2b3658=a195_0x2b36();let _0xf1d2b0=_0x2b3658[_0x474ecb];return _0xf1d2b0;}export const sqlList={'service':a195_0x2cc9bb(0x18a),'command':'list','description':a195_0x2cc9bb(0x188),'risk':a195_0x2cc9bb(0x17a),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a195_0x2cc9bb(0x178),'description':a195_0x2cc9bb(0x177)},{'name':a195_0x2cc9bb(0x17b),'type':a195_0x2cc9bb(0x17f),'description':a195_0x2cc9bb(0x16e),'default':0x1},{'name':a195_0x2cc9bb(0x18b),'type':'number','description':a195_0x2cc9bb(0x173)},{'name':a195_0x2cc9bb(0x16d),'type':a195_0x2cc9bb(0x179),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x566ab7){const _0x19b509=a195_0x2cc9bb,_0x30d9df=await listSqlQueries(_0x566ab7[_0x19b509(0x183)],{'sqlCode':_0x566ab7[_0x19b509(0x16f)]('sqlcode')||undefined,'sqlName':_0x566ab7['str']('name')||undefined,'currentPage':_0x566ab7[_0x19b509(0x186)](_0x19b509(0x17b)),'pageSize':_0x566ab7[_0x19b509(0x186)](_0x19b509(0x18b),0x32)}),_0x3b4816=_0x566ab7[_0x19b509(0x181)](_0x19b509(0x16d)),_0x11ebef=_0x30d9df['tableData']??[],_0x47e2ee=_0x30d9df[_0x19b509(0x16a)]?.[_0x19b509(0x172)]??_0x11ebef['length'];let _0x4b61eb;return _0x3b4816?_0x4b61eb=_0x11ebef:_0x4b61eb=await Promise[_0x19b509(0x176)](_0x11ebef[_0x19b509(0x17d)](async _0x9ac343=>{const _0x1d0d7e=_0x19b509;let _0x422c3d;try{_0x422c3d=_0x9ac343[_0x1d0d7e(0x174)]?await getDbName(_0x566ab7[_0x1d0d7e(0x183)],_0x9ac343[_0x1d0d7e(0x174)]):undefined;}catch{}return{'sqlCode':_0x9ac343[_0x1d0d7e(0x171)],'sqlName':_0x9ac343[_0x1d0d7e(0x18c)],'description':_0x9ac343[_0x1d0d7e(0x180)]??'','db':_0x422c3d?_0x422c3d+'\x20('+_0x9ac343['dbId']+')':_0x9ac343[_0x1d0d7e(0x174)]??''};})),{'ok':!![],'data':_0x4b61eb,'message':_0x11ebef[_0x19b509(0x187)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x19b509(0x18d)+_0x11ebef[_0x19b509(0x187)]+'\x20SQL\x20queries\x20(total:\x20'+_0x47e2ee+').'};}};
@@ -1 +1 @@
1
- const a191_0x44e51d=a191_0xca86;(function(_0x18f892,_0x357557){const _0x5f009d=a191_0xca86,_0x1d8afb=_0x18f892();while(!![]){try{const _0x4b7121=-parseInt(_0x5f009d(0x116))/0x1+-parseInt(_0x5f009d(0x12d))/0x2+-parseInt(_0x5f009d(0x137))/0x3+-parseInt(_0x5f009d(0x150))/0x4*(parseInt(_0x5f009d(0x142))/0x5)+-parseInt(_0x5f009d(0x14a))/0x6*(-parseInt(_0x5f009d(0x13e))/0x7)+-parseInt(_0x5f009d(0x123))/0x8*(parseInt(_0x5f009d(0x138))/0x9)+parseInt(_0x5f009d(0x13f))/0xa;if(_0x4b7121===_0x357557)break;else _0x1d8afb['push'](_0x1d8afb['shift']());}catch(_0x28086f){_0x1d8afb['push'](_0x1d8afb['shift']());}}}(a191_0x422e,0x98ccf));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';function a191_0x422e(){const _0x3ed904=['6eXFPRT','string','str','split','sqlRootDir','Force\x20pull\x20cancelled.','43972NdJzyR','lastSync','local\x20differs\x20from\x20remote','Pull\x20complete:\x20','161204rnjMsy','nonInteractive','replace','length','skipped','description','cancelled','tableData','name','sqlContent','\x20SQL\x20file(s)\x20into\x20','pull','lockFilePath','8tGMueb','appCode','path','POST','sqlCode','push','sqls','sqlRoot','sql','No\x20remote\x20SQL\x20queries\x20matched.','76700ReoqpG','would_pull','bool','unchanged','test','\x20failed','force','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','\x20skipped,\x20','apps','392667yShVGZ','3100149geslQj','Force\x20overwrite\x20local\x20unsynced\x20changes','sqlName','paging','sqlcode','dbId','5428850NaYoEf','17234620gkrdSR','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','trimStart','545DhfHmb','utf8','Would\x20pull\x20','totalCount','mybatisXml','message','\x20written,\x20','toISOString'];a191_0x422e=function(){return _0x3ed904;};return a191_0x422e();}import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x293c49,_0x1651ad){const _0x300f86=a191_0xca86,_0x416b1f=[];let _0x1d1a25=0x1;while(!![]){const _0x12bf2e=await listSqlQueries(_0x293c49,{'currentPage':_0x1d1a25,'pageSize':PAGE_SIZE,'sqlCode':_0x1651ad['sqlCode'],'sqlName':_0x1651ad[_0x300f86(0x13a)]}),_0x347cc6=_0x12bf2e[_0x300f86(0x11d)]??[];_0x416b1f['push'](..._0x347cc6);if(_0x347cc6[_0x300f86(0x119)]===0x0)break;const _0x47a947=_0x12bf2e[_0x300f86(0x13b)]?.[_0x300f86(0x145)];if(_0x47a947!=null?_0x416b1f[_0x300f86(0x119)]>=_0x47a947:_0x347cc6[_0x300f86(0x119)]<PAGE_SIZE)break;_0x1d1a25++;}return _0x416b1f;}function a191_0xca86(_0x180b56,_0x5cac4b){_0x180b56=_0x180b56-0x116;const _0x422eb4=a191_0x422e();let _0xca86a8=_0x422eb4[_0x180b56];return _0xca86a8;}async function ensureSqlContent(_0x4cc500){const _0x3f323d=a191_0xca86;if(_0x4cc500[_0x3f323d(0x11f)]!=null&&String(_0x4cc500[_0x3f323d(0x11f)])[_0x3f323d(0x119)]>0x0)return _0x4cc500;return getSqlQueryDetail(_0x4cc500[_0x3f323d(0x127)]);}export const sqlPull={'service':a191_0x44e51d(0x12b),'command':a191_0x44e51d(0x121),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a191_0x44e51d(0x11e),'type':a191_0x44e51d(0x14b),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':'force','type':'boolean','description':a191_0x44e51d(0x139)}],async 'dryRun'(_0x4251e2){const _0x1f9495=a191_0x44e51d,_0x396026=loadSqlProjectConfig(_0x4251e2['appCode']),_0x2880d0=await readSqlLockFile(_0x396026['lockFilePath']),{appLock:_0x594334}=ensureSqlLockScope(_0x2880d0??createEmptySqlLock(),_0x396026['appCode'],_0x396026[_0x1f9495(0x12a)],_0x1f9495(0x121)),_0x513191=await fetchAllSqlQueries(_0x4251e2[_0x1f9495(0x124)],{'sqlCode':_0x4251e2['str'](_0x1f9495(0x13c))||undefined,'sqlName':_0x4251e2['str'](_0x1f9495(0x11e))||undefined}),_0x2fca68=[];for(const _0x1f0c80 of _0x513191){const _0x5c7688=await ensureSqlContent(_0x1f0c80),_0xc2b1fc=ensureRemoteSqlContent(_0x5c7688),_0x4a2945=detectModeFromSql(_0x5c7688),_0x4c09b0=_0x5c7688[_0x1f9495(0x13d)]?await getDbName(_0x4251e2['appCode'],Number(_0x5c7688['dbId']))['catch'](()=>undefined):undefined,_0x141f17=buildLocalSqlFileContent({'sqlCode':_0x5c7688[_0x1f9495(0x127)],'sqlName':_0x5c7688[_0x1f9495(0x13a)],'dbId':_0x5c7688[_0x1f9495(0x13d)]},_0xc2b1fc,{'dbName':_0x4c09b0,'mode':_0x4a2945,'syncedAt':new Date()[_0x1f9495(0x149)](),'description':_0x5c7688[_0x1f9495(0x11b)]}),_0x246c74=buildSqlLockEntry(_0x5c7688,_0xc2b1fc,'',{'dbName':_0x4c09b0}),_0x372678=resolveLocalSqlFilePath(_0x396026,_0x5c7688[_0x1f9495(0x127)],_0x246c74);let _0x436368=_0x1f9495(0x12e),_0x447086;if(await fileExists(_0x372678)){const _0x18f874=await readFile(_0x372678,'utf8');isEquivalentPulledSqlFile(_0x18f874,_0x141f17,_0x4a2945)?(_0x436368=_0x1f9495(0x11a),_0x447086='unchanged'):(_0x436368='conflict',_0x447086=_0x1f9495(0x134));}_0x2fca68['push']({'sqlCode':_0x5c7688['sqlCode'],'sqlName':_0x5c7688[_0x1f9495(0x13a)],'filePath':_0x372678,'status':_0x436368,'reason':_0x447086});}return{'method':_0x1f9495(0x126),'url':_0x1f9495(0x140),'body':{'appCode':_0x4251e2[_0x1f9495(0x124)],'sqlCode':_0x4251e2[_0x1f9495(0x14c)](_0x1f9495(0x13c))||null,'sqlName':_0x4251e2[_0x1f9495(0x14c)](_0x1f9495(0x11e))||null,'files':_0x2fca68},'description':_0x1f9495(0x144)+_0x2fca68[_0x1f9495(0x119)]+_0x1f9495(0x120)+_0x396026[_0x1f9495(0x14e)]};},async 'execute'(_0x12801f){const _0x59d690=a191_0x44e51d,_0x597e93=loadSqlProjectConfig(_0x12801f[_0x59d690(0x124)]),_0x5991cd=await readSqlLockFile(_0x597e93[_0x59d690(0x122)]),{lockData:_0x1c6916,appLock:_0x156d7c}=ensureSqlLockScope(_0x5991cd??createEmptySqlLock(),_0x597e93['appCode'],_0x597e93[_0x59d690(0x12a)],_0x59d690(0x121)),_0x8ac06=_0x12801f[_0x59d690(0x12f)](_0x59d690(0x133)),_0x371f3a=await fetchAllSqlQueries(_0x12801f['appCode'],{'sqlCode':_0x12801f[_0x59d690(0x14c)](_0x59d690(0x13c))||undefined,'sqlName':_0x12801f[_0x59d690(0x14c)](_0x59d690(0x11e))||undefined});if(_0x371f3a[_0x59d690(0x119)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x59d690(0x12c)};const _0x19b7fa=[],_0x2ac319=[];for(const _0x4c9862 of _0x371f3a){try{_0x19b7fa[_0x59d690(0x128)](await ensureSqlContent(_0x4c9862));}catch(_0x308bc2){_0x2ac319['push']({'sqlCode':_0x4c9862[_0x59d690(0x127)],'error':_0x308bc2 instanceof Error?_0x308bc2[_0x59d690(0x147)]:String(_0x308bc2)});}}if(_0x8ac06&&!_0x12801f[_0x59d690(0x117)]){let _0x50238b=![];for(const _0x4bf413 of _0x19b7fa){const _0x1becab=detectModeFromSql(_0x4bf413),_0xc79609=_0x4bf413['dbId']?await getDbName(_0x12801f[_0x59d690(0x124)],Number(_0x4bf413[_0x59d690(0x13d)]))['catch'](()=>undefined):undefined,_0x5d342d=buildLocalSqlFileContent({'sqlCode':_0x4bf413['sqlCode'],'sqlName':_0x4bf413[_0x59d690(0x13a)],'dbId':_0x4bf413['dbId']},ensureRemoteSqlContent(_0x4bf413),{'dbName':_0xc79609,'mode':_0x1becab,'syncedAt':new Date()[_0x59d690(0x149)](),'description':_0x4bf413[_0x59d690(0x11b)]}),_0x43c194=resolveLocalSqlFilePath(_0x597e93,_0x4bf413[_0x59d690(0x127)],buildSqlLockEntry(_0x4bf413,ensureRemoteSqlContent(_0x4bf413),'',{'dbName':_0xc79609}));if(await fileExists(_0x43c194)){const _0x5127fd=await readFile(_0x43c194,_0x59d690(0x143));if(!isEquivalentPulledSqlFile(_0x5127fd,_0x5d342d,_0x1becab)){_0x50238b=!![];break;}}}if(_0x50238b){const _0x1ff7a9=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x1ff7a9)throw CliErrors[_0x59d690(0x11c)](_0x59d690(0x14f));}}const _0x1abaf2=cloneSqlLockData(_0x1c6916),_0xe28760=_0x1abaf2[_0x59d690(0x136)][_0x597e93['appCode']],_0x329185=[],_0x55b992=[];for(const _0x2b4550 of _0x19b7fa){const _0x2638a4=_0xe28760[_0x59d690(0x129)][_0x2b4550[_0x59d690(0x127)]],_0xd8ed54=ensureRemoteSqlContent(_0x2b4550),_0x2c2558=detectModeFromSql(_0x2b4550),_0x8351c6=_0x2b4550[_0x59d690(0x13d)]?await getDbName(_0x12801f[_0x59d690(0x124)],Number(_0x2b4550[_0x59d690(0x13d)]))['catch'](()=>undefined):undefined,_0x532344=buildLocalSqlFileContent({'sqlCode':_0x2b4550['sqlCode'],'sqlName':_0x2b4550['sqlName'],'dbId':_0x2b4550['dbId']},_0xd8ed54,{'dbName':_0x8351c6,'mode':_0x2c2558,'syncedAt':new Date()[_0x59d690(0x149)](),'description':_0x2b4550[_0x59d690(0x11b)]}),_0x5853f5=buildSqlLockEntry(_0x2b4550,_0xd8ed54,computeSqlContentHash(_0x532344),{'dbName':_0x8351c6}),_0x8cbef9=_0x5853f5[_0x59d690(0x125)],_0x2dfe55=join(_0x597e93['sqlRootDir'],_0x8cbef9);try{if(await fileExists(_0x2dfe55)){const _0x4f3a34=await readFile(_0x2dfe55,_0x59d690(0x143));if(isEquivalentPulledSqlFile(_0x4f3a34,_0x532344,_0x2c2558)){_0x55b992[_0x59d690(0x128)]({'sqlCode':_0x2b4550['sqlCode'],'reason':_0x59d690(0x130)}),_0xe28760[_0x59d690(0x129)][_0x2b4550[_0x59d690(0x127)]]={..._0x5853f5,'hash':computeSqlContentHash(_0x4f3a34),'path':_0x8cbef9};continue;}if(!_0x8ac06){_0x55b992[_0x59d690(0x128)]({'sqlCode':_0x2b4550[_0x59d690(0x127)],'reason':_0x59d690(0x152)});continue;}}const _0x222ae9=_0x2638a4?.[_0x59d690(0x125)]?join(_0x597e93[_0x59d690(0x14e)],_0x2638a4[_0x59d690(0x125)]):undefined;_0x222ae9&&_0x222ae9!==_0x2dfe55&&await fileExists(_0x222ae9)&&await rm(_0x222ae9,{'force':!![]}),await ensureParentDirectory(_0x2dfe55),await writeFile(_0x2dfe55,_0x532344,_0x59d690(0x143)),_0xe28760[_0x59d690(0x129)][_0x2b4550[_0x59d690(0x127)]]={..._0x5853f5,'path':_0x8cbef9},_0x329185[_0x59d690(0x128)]({'sqlCode':_0x2b4550[_0x59d690(0x127)],'filePath':_0x2dfe55});}catch(_0x6fb4b7){_0x2ac319[_0x59d690(0x128)]({'sqlCode':_0x2b4550[_0x59d690(0x127)],'error':_0x6fb4b7 instanceof Error?_0x6fb4b7[_0x59d690(0x147)]:String(_0x6fb4b7)});}}return _0xe28760[_0x59d690(0x151)]=new Date()[_0x59d690(0x149)](),await writeSqlLockFile(_0x597e93[_0x59d690(0x122)],_0x1abaf2),{'ok':_0x2ac319[_0x59d690(0x119)]===0x0,'data':{'pulled':_0x329185,'skipped':_0x55b992,'failed':_0x2ac319},'message':_0x59d690(0x153)+_0x329185[_0x59d690(0x119)]+_0x59d690(0x148)+_0x55b992[_0x59d690(0x119)]+_0x59d690(0x135)+_0x2ac319['length']+_0x59d690(0x132)};}};function detectModeFromSql(_0x2e13ec){const _0x1585d0=a191_0x44e51d,_0x4855f0=ensureRemoteSqlContent(_0x2e13ec),_0x3dcadc=stripLocalSqlMetadata(_0x4855f0,_0x1585d0(0x146))[_0x1585d0(0x141)]();if(/^<(select|insert|update|delete)\b/i[_0x1585d0(0x131)](_0x3dcadc))return _0x1585d0(0x146);return _0x1585d0(0x12b);}function isEquivalentPulledSqlFile(_0x6671cd,_0x23de73,_0xfad5e8){return normalizePullComparableContent(_0x6671cd,_0xfad5e8)===normalizePullComparableContent(_0x23de73,_0xfad5e8);}function normalizePullComparableContent(_0x4ea976,_0x93a10){const _0x6588ea=a191_0x44e51d,_0x13aba5=_0x4ea976[_0x6588ea(0x118)](/\r\n/g,'\x0a')[_0x6588ea(0x14d)]('\x0a'),_0x380cc1=_0x13aba5['filter'](_0x4341b2=>!isSyncedAtMetadataLine(_0x4341b2,_0x93a10));return _0x380cc1['join']('\x0a');}function isSyncedAtMetadataLine(_0x274745,_0x408dc3){const _0x1a9091=a191_0x44e51d;if(_0x408dc3===_0x1a9091(0x146))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x1a9091(0x131)](_0x274745);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x1a9091(0x131)](_0x274745);}
1
+ const a196_0x140956=a196_0x5e5b;(function(_0x48778b,_0x39894b){const _0x33c571=a196_0x5e5b,_0xac0d7f=_0x48778b();while(!![]){try{const _0x18fb41=parseInt(_0x33c571(0x15b))/0x1*(parseInt(_0x33c571(0x14f))/0x2)+parseInt(_0x33c571(0x16d))/0x3+parseInt(_0x33c571(0x163))/0x4*(parseInt(_0x33c571(0x164))/0x5)+-parseInt(_0x33c571(0x160))/0x6+parseInt(_0x33c571(0x171))/0x7+parseInt(_0x33c571(0x159))/0x8+-parseInt(_0x33c571(0x13b))/0x9;if(_0x18fb41===_0x39894b)break;else _0xac0d7f['push'](_0xac0d7f['shift']());}catch(_0x31d7ed){_0xac0d7f['push'](_0xac0d7f['shift']());}}}(a196_0x4cfa,0xcacb4));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a196_0x5e5b(_0x41cea8,_0x27c5fa){_0x41cea8=_0x41cea8-0x13b;const _0x4cfa43=a196_0x4cfa();let _0x5e5b53=_0x4cfa43[_0x41cea8];return _0x5e5b53;}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';function a196_0x4cfa(){const _0xf975ae=['sqls','test','sqlName','Force\x20overwrite\x20local\x20unsynced\x20changes','POST','sqlcode','lockFilePath','sqlCode','catch','2725152wbMKAh','\x20SQL\x20file(s)\x20into\x20','181NEBhfz','length','sqlRootDir','force','str','4129032iXfDty','Would\x20pull\x20','paging','12lPaizT','185755jQVKVO','Filter\x20by\x20SQL\x20display\x20name','sqlContent','skipped','push','unchanged','sql','mybatisXml','string','1825074ZjJTgx','appCode','\x20failed','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','1362410LGkLAJ','path','\x20skipped,\x20','trimStart','totalCount','No\x20remote\x20SQL\x20queries\x20matched.','cancelled','Pull\x20complete:\x20','pull','6005997miBNsU','nonInteractive','Force\x20pull\x20cancelled.','lastSync','bool','tableData','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','toISOString','replace','dbId','\x20written,\x20','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','would_pull','local\x20differs\x20from\x20remote','name','split','sqlRoot','conflict','description','utf8','10288aJNWdT'];a196_0x4cfa=function(){return _0xf975ae;};return a196_0x4cfa();}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x1a3b2c,_0x37f37c){const _0x3a4c45=a196_0x5e5b,_0x4200f9=[];let _0x5bb847=0x1;while(!![]){const _0x41fac5=await listSqlQueries(_0x1a3b2c,{'currentPage':_0x5bb847,'pageSize':PAGE_SIZE,'sqlCode':_0x37f37c['sqlCode'],'sqlName':_0x37f37c[_0x3a4c45(0x152)]}),_0x571785=_0x41fac5[_0x3a4c45(0x140)]??[];_0x4200f9[_0x3a4c45(0x168)](..._0x571785);if(_0x571785['length']===0x0)break;const _0x248c08=_0x41fac5[_0x3a4c45(0x162)]?.[_0x3a4c45(0x175)];if(_0x248c08!=null?_0x4200f9[_0x3a4c45(0x15c)]>=_0x248c08:_0x571785[_0x3a4c45(0x15c)]<PAGE_SIZE)break;_0x5bb847++;}return _0x4200f9;}async function ensureSqlContent(_0x2f3c82){const _0x5d25ae=a196_0x5e5b;if(_0x2f3c82[_0x5d25ae(0x166)]!=null&&String(_0x2f3c82[_0x5d25ae(0x166)])[_0x5d25ae(0x15c)]>0x0)return _0x2f3c82;return getSqlQueryDetail(_0x2f3c82[_0x5d25ae(0x157)]);}export const sqlPull={'service':'sql','command':a196_0x140956(0x179),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a196_0x140956(0x149),'type':a196_0x140956(0x16c),'description':a196_0x140956(0x165)},{'name':a196_0x140956(0x15e),'type':'boolean','description':a196_0x140956(0x153)}],async 'dryRun'(_0x1a1057){const _0x4bdfcb=a196_0x140956,_0xe10764=loadSqlProjectConfig(_0x1a1057[_0x4bdfcb(0x16e)]),_0x3adb6f=await readSqlLockFile(_0xe10764[_0x4bdfcb(0x156)]),{appLock:_0x53fe8a}=ensureSqlLockScope(_0x3adb6f??createEmptySqlLock(),_0xe10764[_0x4bdfcb(0x16e)],_0xe10764['sqlRoot'],_0x4bdfcb(0x179)),_0x204afb=await fetchAllSqlQueries(_0x1a1057['appCode'],{'sqlCode':_0x1a1057[_0x4bdfcb(0x15f)]('sqlcode')||undefined,'sqlName':_0x1a1057[_0x4bdfcb(0x15f)](_0x4bdfcb(0x149))||undefined}),_0x5495ed=[];for(const _0x45071b of _0x204afb){const _0x4709f4=await ensureSqlContent(_0x45071b),_0x3140f1=ensureRemoteSqlContent(_0x4709f4),_0x3fec0f=detectModeFromSql(_0x4709f4),_0x4ae9b3=_0x4709f4[_0x4bdfcb(0x144)]?await getDbName(_0x1a1057['appCode'],Number(_0x4709f4[_0x4bdfcb(0x144)]))['catch'](()=>undefined):undefined,_0x3ae0de=buildLocalSqlFileContent({'sqlCode':_0x4709f4[_0x4bdfcb(0x157)],'sqlName':_0x4709f4[_0x4bdfcb(0x152)],'dbId':_0x4709f4[_0x4bdfcb(0x144)]},_0x3140f1,{'dbName':_0x4ae9b3,'mode':_0x3fec0f,'syncedAt':new Date()[_0x4bdfcb(0x142)](),'description':_0x4709f4[_0x4bdfcb(0x14d)]}),_0xd7fc5c=buildSqlLockEntry(_0x4709f4,_0x3140f1,'',{'dbName':_0x4ae9b3}),_0x1054b7=resolveLocalSqlFilePath(_0xe10764,_0x4709f4[_0x4bdfcb(0x157)],_0xd7fc5c);let _0x119790=_0x4bdfcb(0x147),_0x591068;if(await fileExists(_0x1054b7)){const _0x49e90a=await readFile(_0x1054b7,_0x4bdfcb(0x14e));isEquivalentPulledSqlFile(_0x49e90a,_0x3ae0de,_0x3fec0f)?(_0x119790=_0x4bdfcb(0x167),_0x591068=_0x4bdfcb(0x169)):(_0x119790=_0x4bdfcb(0x14c),_0x591068=_0x4bdfcb(0x141));}_0x5495ed[_0x4bdfcb(0x168)]({'sqlCode':_0x4709f4[_0x4bdfcb(0x157)],'sqlName':_0x4709f4[_0x4bdfcb(0x152)],'filePath':_0x1054b7,'status':_0x119790,'reason':_0x591068});}return{'method':_0x4bdfcb(0x154),'url':_0x4bdfcb(0x146),'body':{'appCode':_0x1a1057['appCode'],'sqlCode':_0x1a1057['str'](_0x4bdfcb(0x155))||null,'sqlName':_0x1a1057[_0x4bdfcb(0x15f)]('name')||null,'files':_0x5495ed},'description':_0x4bdfcb(0x161)+_0x5495ed[_0x4bdfcb(0x15c)]+_0x4bdfcb(0x15a)+_0xe10764[_0x4bdfcb(0x15d)]};},async 'execute'(_0x177575){const _0x52bf52=a196_0x140956,_0x14ac53=loadSqlProjectConfig(_0x177575[_0x52bf52(0x16e)]),_0x213376=await readSqlLockFile(_0x14ac53['lockFilePath']),{lockData:_0x4f6699,appLock:_0x499014}=ensureSqlLockScope(_0x213376??createEmptySqlLock(),_0x14ac53[_0x52bf52(0x16e)],_0x14ac53[_0x52bf52(0x14b)],'pull'),_0xaab0b5=_0x177575[_0x52bf52(0x13f)](_0x52bf52(0x15e)),_0x54078c=await fetchAllSqlQueries(_0x177575[_0x52bf52(0x16e)],{'sqlCode':_0x177575[_0x52bf52(0x15f)](_0x52bf52(0x155))||undefined,'sqlName':_0x177575[_0x52bf52(0x15f)]('name')||undefined});if(_0x54078c[_0x52bf52(0x15c)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x52bf52(0x176)};const _0xde0774=[],_0x4b4119=[];for(const _0x37edf7 of _0x54078c){try{_0xde0774[_0x52bf52(0x168)](await ensureSqlContent(_0x37edf7));}catch(_0x55bb63){_0x4b4119[_0x52bf52(0x168)]({'sqlCode':_0x37edf7[_0x52bf52(0x157)],'error':_0x55bb63 instanceof Error?_0x55bb63['message']:String(_0x55bb63)});}}if(_0xaab0b5&&!_0x177575[_0x52bf52(0x13c)]){let _0x57f9f6=![];for(const _0x38dbb0 of _0xde0774){const _0x4edf80=detectModeFromSql(_0x38dbb0),_0x33ef35=_0x38dbb0[_0x52bf52(0x144)]?await getDbName(_0x177575['appCode'],Number(_0x38dbb0[_0x52bf52(0x144)]))[_0x52bf52(0x158)](()=>undefined):undefined,_0x39f700=buildLocalSqlFileContent({'sqlCode':_0x38dbb0[_0x52bf52(0x157)],'sqlName':_0x38dbb0['sqlName'],'dbId':_0x38dbb0['dbId']},ensureRemoteSqlContent(_0x38dbb0),{'dbName':_0x33ef35,'mode':_0x4edf80,'syncedAt':new Date()[_0x52bf52(0x142)](),'description':_0x38dbb0['description']}),_0x4020ce=resolveLocalSqlFilePath(_0x14ac53,_0x38dbb0[_0x52bf52(0x157)],buildSqlLockEntry(_0x38dbb0,ensureRemoteSqlContent(_0x38dbb0),'',{'dbName':_0x33ef35}));if(await fileExists(_0x4020ce)){const _0x4fde77=await readFile(_0x4020ce,'utf8');if(!isEquivalentPulledSqlFile(_0x4fde77,_0x39f700,_0x4edf80)){_0x57f9f6=!![];break;}}}if(_0x57f9f6){const _0x105cfa=await confirmForceOverwrite(_0x52bf52(0x170));if(!_0x105cfa)throw CliErrors[_0x52bf52(0x177)](_0x52bf52(0x13d));}}const _0x5dd9c4=cloneSqlLockData(_0x4f6699),_0x58f940=_0x5dd9c4['apps'][_0x14ac53[_0x52bf52(0x16e)]],_0x3d4b17=[],_0x3237ec=[];for(const _0x464258 of _0xde0774){const _0x3b5aa6=_0x58f940[_0x52bf52(0x150)][_0x464258[_0x52bf52(0x157)]],_0x4a7014=ensureRemoteSqlContent(_0x464258),_0x3d4596=detectModeFromSql(_0x464258),_0x14396b=_0x464258[_0x52bf52(0x144)]?await getDbName(_0x177575[_0x52bf52(0x16e)],Number(_0x464258[_0x52bf52(0x144)]))[_0x52bf52(0x158)](()=>undefined):undefined,_0xd3d99e=buildLocalSqlFileContent({'sqlCode':_0x464258['sqlCode'],'sqlName':_0x464258['sqlName'],'dbId':_0x464258[_0x52bf52(0x144)]},_0x4a7014,{'dbName':_0x14396b,'mode':_0x3d4596,'syncedAt':new Date()['toISOString'](),'description':_0x464258[_0x52bf52(0x14d)]}),_0x3a4d78=buildSqlLockEntry(_0x464258,_0x4a7014,computeSqlContentHash(_0xd3d99e),{'dbName':_0x14396b}),_0x1ebd00=_0x3a4d78[_0x52bf52(0x172)],_0x3f798c=join(_0x14ac53['sqlRootDir'],_0x1ebd00);try{if(await fileExists(_0x3f798c)){const _0x5855f3=await readFile(_0x3f798c,_0x52bf52(0x14e));if(isEquivalentPulledSqlFile(_0x5855f3,_0xd3d99e,_0x3d4596)){_0x3237ec[_0x52bf52(0x168)]({'sqlCode':_0x464258[_0x52bf52(0x157)],'reason':_0x52bf52(0x169)}),_0x58f940[_0x52bf52(0x150)][_0x464258[_0x52bf52(0x157)]]={..._0x3a4d78,'hash':computeSqlContentHash(_0x5855f3),'path':_0x1ebd00};continue;}if(!_0xaab0b5){_0x3237ec[_0x52bf52(0x168)]({'sqlCode':_0x464258[_0x52bf52(0x157)],'reason':_0x52bf52(0x148)});continue;}}const _0x539123=_0x3b5aa6?.[_0x52bf52(0x172)]?join(_0x14ac53['sqlRootDir'],_0x3b5aa6[_0x52bf52(0x172)]):undefined;_0x539123&&_0x539123!==_0x3f798c&&await fileExists(_0x539123)&&await rm(_0x539123,{'force':!![]}),await ensureParentDirectory(_0x3f798c),await writeFile(_0x3f798c,_0xd3d99e,_0x52bf52(0x14e)),_0x58f940['sqls'][_0x464258['sqlCode']]={..._0x3a4d78,'path':_0x1ebd00},_0x3d4b17['push']({'sqlCode':_0x464258[_0x52bf52(0x157)],'filePath':_0x3f798c});}catch(_0x47b844){_0x4b4119[_0x52bf52(0x168)]({'sqlCode':_0x464258[_0x52bf52(0x157)],'error':_0x47b844 instanceof Error?_0x47b844['message']:String(_0x47b844)});}}return _0x58f940[_0x52bf52(0x13e)]=new Date()[_0x52bf52(0x142)](),await writeSqlLockFile(_0x14ac53[_0x52bf52(0x156)],_0x5dd9c4),{'ok':_0x4b4119[_0x52bf52(0x15c)]===0x0,'data':{'pulled':_0x3d4b17,'skipped':_0x3237ec,'failed':_0x4b4119},'message':_0x52bf52(0x178)+_0x3d4b17[_0x52bf52(0x15c)]+_0x52bf52(0x145)+_0x3237ec[_0x52bf52(0x15c)]+_0x52bf52(0x173)+_0x4b4119['length']+_0x52bf52(0x16f)};}};function detectModeFromSql(_0x5a6a53){const _0x29f152=a196_0x140956,_0x5e204e=ensureRemoteSqlContent(_0x5a6a53),_0x4bbb07=stripLocalSqlMetadata(_0x5e204e,'mybatisXml')[_0x29f152(0x174)]();if(/^<(select|insert|update|delete)\b/i[_0x29f152(0x151)](_0x4bbb07))return _0x29f152(0x16b);return _0x29f152(0x16a);}function isEquivalentPulledSqlFile(_0x5dfed9,_0x3c31a5,_0xc488c8){return normalizePullComparableContent(_0x5dfed9,_0xc488c8)===normalizePullComparableContent(_0x3c31a5,_0xc488c8);}function normalizePullComparableContent(_0x51bee8,_0x14cb17){const _0x5b7f21=a196_0x140956,_0x38f89d=_0x51bee8[_0x5b7f21(0x143)](/\r\n/g,'\x0a')[_0x5b7f21(0x14a)]('\x0a'),_0x57fb1c=_0x38f89d['filter'](_0x55854b=>!isSyncedAtMetadataLine(_0x55854b,_0x14cb17));return _0x57fb1c['join']('\x0a');}function isSyncedAtMetadataLine(_0x287977,_0x696135){const _0x13b9cd=a196_0x140956;if(_0x696135===_0x13b9cd(0x16b))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x13b9cd(0x151)](_0x287977);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x13b9cd(0x151)](_0x287977);}
@@ -1 +1 @@
1
- const a192_0x1a8dd6=a192_0x4a29;(function(_0x38abc9,_0x22d732){const _0x2faca5=a192_0x4a29,_0x3a9ba0=_0x38abc9();while(!![]){try{const _0x146ca4=parseInt(_0x2faca5(0xd1))/0x1+-parseInt(_0x2faca5(0xb9))/0x2+parseInt(_0x2faca5(0xac))/0x3+parseInt(_0x2faca5(0xcb))/0x4*(parseInt(_0x2faca5(0xb2))/0x5)+-parseInt(_0x2faca5(0xd0))/0x6+parseInt(_0x2faca5(0xcf))/0x7+parseInt(_0x2faca5(0xcc))/0x8*(parseInt(_0x2faca5(0xbc))/0x9);if(_0x146ca4===_0x22d732)break;else _0x3a9ba0['push'](_0x3a9ba0['shift']());}catch(_0x17ecef){_0x3a9ba0['push'](_0x3a9ba0['shift']());}}}(a192_0x390a,0xa0ea7));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';function a192_0x390a(){const _0x1274d3=['set','\x20failed','Local\x20SQL\x20not\x20found:\x20','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','utf8','push','2366116CayoIq','remoteId','\x20skipped,\x20','81SHAyfA','entries','No\x20database\x20matches\x20local\x20directory\x20\x22','length','toISOString','lockFilePath','isFinite','has','sqlName','dbId','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','boolean','trashDir','POST','dbDirectory','313428XgOhbW','249696yEgVjA','Push\x20local\x20SQL\x20files\x20to\x20remote','projectRoot','8827315RtgkFf','7221474nNmPuu','1117351MlwxKQ','\x20pushed,\x20','filePath','sql','filter','sqlRoot','force','dbName','lastSync','sqlCode','sqlcode','catch','appCode','join','hash','startsWith','validation','sqlRootDir','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','/smartapi/custom/updateUserCustomSql','replace','version','relativePath','path','\x22\x20for\x20sqlCode\x20','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','924261fQTnOI','Local\x20directory\x20\x22','bool','\x20SQL\x20file(s)','str','sqls','5PldhQE'];a192_0x390a=function(){return _0x1274d3;};return a192_0x390a();}async function getTargetSqlQueries(_0x1735de,_0x26f6bf,_0x2c6147){const _0x5249f5=a192_0x4a29,_0x4459fb=await scanLocalSqlQueries(_0x1735de),_0x1d1699=new Map();for(const _0x1b3032 of _0x4459fb){if(_0x2c6147&&_0x1b3032['sqlCode']!==_0x2c6147)continue;const _0x1ced25=_0x1d1699['get'](_0x1b3032['sqlCode'])??[];_0x1ced25[_0x5249f5(0xb8)](_0x1b3032),_0x1d1699[_0x5249f5(0xb3)](_0x1b3032[_0x5249f5(0x9b)],_0x1ced25);}if(_0x2c6147&&!_0x1d1699[_0x5249f5(0xc3)](_0x2c6147))throw CliErrors[_0x5249f5(0xa2)](_0x5249f5(0xb5)+_0x2c6147);const _0x266a58=[];for(const [_0x25d486,_0x7b6c94]of _0x1d1699[_0x5249f5(0xbd)]()){if(_0x7b6c94[_0x5249f5(0xbf)]===0x1){_0x266a58['push'](_0x7b6c94[0x0]);continue;}const _0x55bd1d=_0x26f6bf[_0x5249f5(0xb1)][_0x25d486],_0x3674d0=_0x55bd1d?.['path'],_0x46b9e5=_0x3674d0?_0x7b6c94[_0x5249f5(0xd5)](_0x298178=>_0x298178[_0x5249f5(0xa8)]!==_0x3674d0):_0x7b6c94;if(_0x55bd1d&&_0x46b9e5[_0x5249f5(0xbf)]===0x1){_0x266a58['push'](_0x46b9e5[0x0]);continue;}throw CliErrors[_0x5249f5(0xa2)](_0x5249f5(0xab)+_0x25d486+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x266a58;}export const sqlPush={'service':a192_0x1a8dd6(0xd4),'command':a192_0x1a8dd6(0xb8),'description':a192_0x1a8dd6(0xcd),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a192_0x1a8dd6(0xd7),'type':a192_0x1a8dd6(0xc7),'description':a192_0x1a8dd6(0xc6)}],async 'dryRun'(_0x1353c9){const _0x1ca0b4=a192_0x1a8dd6,_0x2bb05a=loadSqlProjectConfig(_0x1353c9[_0x1ca0b4(0x9e)]),_0x4e308b=await readSqlLockFile(_0x2bb05a[_0x1ca0b4(0xc1)]),{appLock:_0x7a65a5}=ensureSqlLockScope(_0x4e308b??createEmptySqlLock(),_0x1353c9['appCode'],_0x2bb05a[_0x1ca0b4(0xd6)],'push'),_0x1f5742=await getTargetSqlQueries(_0x2bb05a,_0x7a65a5,_0x1353c9[_0x1ca0b4(0xb0)](_0x1ca0b4(0x9c))||undefined),_0x22418a=[];for(const _0x5422c3 of _0x1f5742){const _0xe17c65=await computeSqlFileHash(_0x5422c3[_0x1ca0b4(0xd3)]),_0x338ea7=_0x7a65a5[_0x1ca0b4(0xb1)][_0x5422c3[_0x1ca0b4(0x9b)]],_0x2c9cfe=!!_0x338ea7&&(_0x338ea7['path']!==_0x5422c3[_0x1ca0b4(0xa8)]||!!_0x5422c3[_0x1ca0b4(0xc4)]&&_0x338ea7['sqlName']!==_0x5422c3[_0x1ca0b4(0xc4)]);if(!_0x1353c9[_0x1ca0b4(0xae)](_0x1ca0b4(0xd7))&&_0x338ea7&&_0x338ea7[_0x1ca0b4(0xa0)]===_0xe17c65&&!_0x2c9cfe)continue;_0x22418a[_0x1ca0b4(0xb8)](_0x5422c3[_0x1ca0b4(0x9b)]);}return{'method':_0x1ca0b4(0xc9),'url':_0x1ca0b4(0xa5),'body':{'sqlCodes':_0x22418a,'appCode':_0x1353c9[_0x1ca0b4(0x9e)]},'description':'Would\x20push\x20'+_0x22418a['length']+_0x1ca0b4(0xaf)};},async 'execute'(_0x18818a){const _0x1b3d25=a192_0x1a8dd6,_0x4fd967=loadSqlProjectConfig(_0x18818a[_0x1b3d25(0x9e)]),_0x18d550=await readSqlLockFile(_0x4fd967[_0x1b3d25(0xc1)]),{lockData:_0x460173,appLock:_0x413ac6}=ensureSqlLockScope(_0x18d550??createEmptySqlLock(),_0x18818a[_0x1b3d25(0x9e)],_0x4fd967[_0x1b3d25(0xd6)],'push'),_0x216f15=await getTargetSqlQueries(_0x4fd967,_0x413ac6,_0x18818a[_0x1b3d25(0xb0)](_0x1b3d25(0x9c))||undefined);if(_0x216f15[_0x1b3d25(0xbf)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x317427=[],_0x1df13c=[],_0x2ba667=[];for(const _0xd4f1a1 of _0x216f15){const _0x38f33b=_0x413ac6[_0x1b3d25(0xb1)][_0xd4f1a1[_0x1b3d25(0x9b)]];if(!_0x38f33b){_0x2ba667[_0x1b3d25(0xb8)]({'sqlCode':_0xd4f1a1['sqlCode'],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x139dd9=await computeSqlFileHash(_0xd4f1a1[_0x1b3d25(0xd3)]),_0x152314=_0x38f33b[_0x1b3d25(0xa9)]!==_0xd4f1a1[_0x1b3d25(0xa8)]||!!_0xd4f1a1['sqlName']&&_0x38f33b[_0x1b3d25(0xc4)]!==_0xd4f1a1[_0x1b3d25(0xc4)];if(!_0x18818a['bool'](_0x1b3d25(0xd7))&&_0x38f33b[_0x1b3d25(0xa0)]===_0x139dd9&&!_0x152314){_0x1df13c[_0x1b3d25(0xb8)]({'sqlCode':_0xd4f1a1[_0x1b3d25(0x9b)],'reason':'unchanged'});continue;}if(_0x38f33b['version']==null){_0x2ba667[_0x1b3d25(0xb8)]({'sqlCode':_0xd4f1a1[_0x1b3d25(0x9b)],'error':_0x1b3d25(0xb6)});continue;}const _0x32dd95=await readFile(_0xd4f1a1[_0x1b3d25(0xd3)],_0x1b3d25(0xb7)),_0x244f57=stripLocalSqlMetadata(_0x32dd95,_0xd4f1a1['mode']),_0xa1551f=_0xd4f1a1['sqlName']||_0x38f33b[_0x1b3d25(0xc4)],_0x6285a2=await resolveTargetDbBinding(_0x18818a[_0x1b3d25(0x9e)],_0xd4f1a1,_0x38f33b),_0x5522c5=await updateSqlQuery({'id':_0x38f33b[_0x1b3d25(0xba)],'appCode':_0x18818a[_0x1b3d25(0x9e)],'sqlCode':_0xd4f1a1[_0x1b3d25(0x9b)],'sqlName':_0xa1551f,'dbId':_0x6285a2[_0x1b3d25(0xc5)],'version':_0x38f33b[_0x1b3d25(0xa7)],'sqlContent':_0x244f57,'sqlConfig':_0x38f33b['sqlConfig']??undefined}),_0x16e86c=_0x5522c5[_0x1b3d25(0xc5)]?await getDbName(_0x18818a[_0x1b3d25(0x9e)],Number(_0x5522c5[_0x1b3d25(0xc5)]))[_0x1b3d25(0x9d)](()=>_0x6285a2[_0x1b3d25(0xd8)]):_0x6285a2[_0x1b3d25(0xd8)];_0x413ac6['sqls'][_0xd4f1a1[_0x1b3d25(0x9b)]]={...buildSqlLockEntry(_0x5522c5,_0x244f57,_0x139dd9,{'dbName':_0x16e86c}),'path':_0xd4f1a1[_0x1b3d25(0xa8)],'mode':_0x38f33b['mode']},await archivePreviousSqlFileIfNeeded(_0x4fd967,_0x38f33b[_0x1b3d25(0xa9)],_0xd4f1a1[_0x1b3d25(0xa8)]),_0x317427[_0x1b3d25(0xb8)]({'sqlCode':_0xd4f1a1[_0x1b3d25(0x9b)],'remoteId':_0x38f33b[_0x1b3d25(0xba)]});}catch(_0x1d8839){_0x2ba667[_0x1b3d25(0xb8)]({'sqlCode':_0xd4f1a1['sqlCode'],'error':_0x1d8839 instanceof Error?_0x1d8839['message']:String(_0x1d8839)});}}return _0x413ac6[_0x1b3d25(0x9a)]=new Date()['toISOString'](),await writeSqlLockFile(_0x4fd967[_0x1b3d25(0xc1)],_0x460173),{'ok':_0x2ba667[_0x1b3d25(0xbf)]===0x0,'data':{'pushed':_0x317427,'skipped':_0x1df13c,'failed':_0x2ba667},'message':'Push\x20complete:\x20'+_0x317427[_0x1b3d25(0xbf)]+_0x1b3d25(0xd2)+_0x1df13c[_0x1b3d25(0xbf)]+_0x1b3d25(0xbb)+_0x2ba667[_0x1b3d25(0xbf)]+_0x1b3d25(0xb4)};}};function a192_0x4a29(_0x191cdf,_0x2180aa){_0x191cdf=_0x191cdf-0x9a;const _0x390a17=a192_0x390a();let _0x4a29a4=_0x390a17[_0x191cdf];return _0x4a29a4;}async function archivePreviousSqlFileIfNeeded(_0x3bf7f8,_0x456c7e,_0x27b0da){const _0x59c4e1=a192_0x1a8dd6;if(!_0x456c7e||_0x456c7e===_0x27b0da)return;const _0x4590d4=join(_0x3bf7f8[_0x59c4e1(0xa3)],_0x456c7e);if(!await fileExists(_0x4590d4))return;const _0x4288b2=await moveToTrash(_0x3bf7f8[_0x59c4e1(0xce)],_0x3bf7f8[_0x59c4e1(0xc8)],_0x4590d4);await cleanupEmptyDirectories(dirname(_0x4590d4),_0x3bf7f8[_0x59c4e1(0xa3)]),void _0x4288b2;}async function moveToTrash(_0x5a9727,_0x1ac9cc,_0x20636e){const _0x4d305d=a192_0x1a8dd6,_0x449f54=new Date()[_0x4d305d(0xc0)]()[_0x4d305d(0xa6)](/[:.]/g,'-'),_0x460e93=relative(_0x5a9727,_0x20636e),_0x3ef3dd=join(_0x1ac9cc,_0x449f54,_0x460e93);return await mkdir(dirname(_0x3ef3dd),{'recursive':!![]}),await rename(_0x20636e,_0x3ef3dd),_0x3ef3dd;}async function cleanupEmptyDirectories(_0x12bd21,_0x40a24d){const _0x64d684=a192_0x1a8dd6;let _0x9472a7=resolve(_0x12bd21);const _0x321259=resolve(_0x40a24d);while(_0x9472a7[_0x64d684(0xa1)](''+_0x321259+sep)||_0x9472a7===_0x321259){if(_0x9472a7===_0x321259)return;try{const _0x1e2ced=await readdir(_0x9472a7);if(_0x1e2ced[_0x64d684(0xbf)]>0x0)return;await rmdir(_0x9472a7);}catch{return;}_0x9472a7=dirname(_0x9472a7);}}async function resolveTargetDbBinding(_0x17bf10,_0x2806cb,_0x1610b2){const _0x4963c2=a192_0x1a8dd6,_0x290f1d=_0x2806cb[_0x4963c2(0xca)];if(!_0x290f1d)return{'dbId':_0x1610b2[_0x4963c2(0xc5)],'dbName':_0x1610b2[_0x4963c2(0xd8)]};const _0x5dc8ff=buildDbDirectoryName(_0x1610b2[_0x4963c2(0xd8)],_0x1610b2[_0x4963c2(0xc5)]);if(_0x290f1d===_0x5dc8ff)return{'dbId':_0x1610b2[_0x4963c2(0xc5)],'dbName':_0x1610b2[_0x4963c2(0xd8)]};const _0x2496ad=parseExplicitDbDirectory(_0x290f1d);if(_0x2496ad!=null)return{'dbId':_0x2496ad,'dbName':await getDbName(_0x17bf10,_0x2496ad)[_0x4963c2(0x9d)](()=>undefined)};const _0x2f104a=await listDatabases(_0x17bf10),_0x1b34f3=_0x2f104a['filter'](_0x4a73f7=>buildDbDirectoryName(_0x4a73f7[_0x4963c2(0xd8)],_0x4a73f7['dbId'])===_0x290f1d);if(_0x1b34f3[_0x4963c2(0xbf)]===0x1)return{'dbId':_0x1b34f3[0x0][_0x4963c2(0xc5)],'dbName':_0x1b34f3[0x0][_0x4963c2(0xd8)]};if(_0x1b34f3[_0x4963c2(0xbf)]===0x0)throw CliErrors['validation'](_0x4963c2(0xbe)+_0x290f1d+_0x4963c2(0xaa)+_0x2806cb[_0x4963c2(0x9b)]+'.');const _0x206915=_0x1b34f3['map'](_0x50322f=>_0x50322f['dbName']+'\x20('+_0x50322f['dbId']+')')[_0x4963c2(0x9f)](',\x20');throw CliErrors[_0x4963c2(0xa2)](_0x4963c2(0xad)+_0x290f1d+_0x4963c2(0xa4)+_0x2806cb[_0x4963c2(0x9b)]+':\x20'+_0x206915);}function parseExplicitDbDirectory(_0x37d029){const _0x471c29=a192_0x1a8dd6,_0x1ee61a=/^db-(\d+)$/['exec'](_0x37d029);if(!_0x1ee61a)return null;const _0x917f7c=Number(_0x1ee61a[0x1]);return Number[_0x471c29(0xc2)](_0x917f7c)&&_0x917f7c>0x0?_0x917f7c:null;}
1
+ function a197_0x4f0f(){const _0x1753d3=['128eYCSCb','toISOString','join','8054900ADoTvT','sqls','map','/smartapi/custom/updateUserCustomSql','3NHzBlF','709502TWJzHb','dbName','mode','\x20SQL\x20file(s)','appCode','sqlName','dbId','278474bCDsLd','force','Local\x20SQL\x20not\x20found:\x20','utf8','validation','sqlRoot','dbDirectory',',\x20deployment\x20sync\x20','sql','isFinite','length','1298847izVEON','\x22\x20for\x20sqlCode\x20','catch','4188600ATcSOL','lockFilePath','hash','remoteId','push','sqlCode','boolean','\x20skipped,\x20','write','relativePath','6571805wSjQhy','sqlRootDir','6622230CynQih','str','exec','4cIBKRK','has','get','configured','version','entries','trashDir','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','filter','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','bool','filePath','status','Push\x20local\x20SQL\x20files\x20to\x20remote','No\x20local\x20SQL\x20files\x20found.','Push\x20complete:\x20','lastSync','path','startsWith','No\x20database\x20matches\x20local\x20directory\x20\x22'];a197_0x4f0f=function(){return _0x1753d3;};return a197_0x4f0f();}const a197_0xf27331=a197_0x1870;(function(_0x2b67de,_0x415ece){const _0x4be4fc=a197_0x1870,_0x5317f8=_0x2b67de();while(!![]){try{const _0x1d07ea=-parseInt(_0x4be4fc(0x14a))/0x1+-parseInt(_0x4be4fc(0x179))/0x2*(-parseInt(_0x4be4fc(0x178))/0x3)+parseInt(_0x4be4fc(0x15c))/0x4*(parseInt(_0x4be4fc(0x157))/0x5)+parseInt(_0x4be4fc(0x159))/0x6+parseInt(_0x4be4fc(0x13f))/0x7*(parseInt(_0x4be4fc(0x171))/0x8)+-parseInt(_0x4be4fc(0x14d))/0x9+-parseInt(_0x4be4fc(0x174))/0xa;if(_0x1d07ea===_0x415ece)break;else _0x5317f8['push'](_0x5317f8['shift']());}catch(_0x1ebd07){_0x5317f8['push'](_0x5317f8['shift']());}}}(a197_0x4f0f,0xccfa8));function a197_0x1870(_0xde3ef8,_0x55db89){_0xde3ef8=_0xde3ef8-0x13e;const _0x4f0f6a=a197_0x4f0f();let _0x1870c9=_0x4f0f6a[_0xde3ef8];return _0x1870c9;}import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';import{automaticDeploymentSyncSucceeded,buildAutomaticDeploymentSyncPreview,runAutomaticDeploymentSync,validateAutomaticDeploymentSync}from'../../commands/deployment/auto-sync.js';async function getTargetSqlQueries(_0x505e44,_0x310f06,_0x156e7f){const _0x1c969d=a197_0x1870,_0x533d43=await scanLocalSqlQueries(_0x505e44),_0x400ca6=new Map();for(const _0x64c33c of _0x533d43){if(_0x156e7f&&_0x64c33c[_0x1c969d(0x152)]!==_0x156e7f)continue;const _0x255395=_0x400ca6[_0x1c969d(0x15e)](_0x64c33c['sqlCode'])??[];_0x255395[_0x1c969d(0x151)](_0x64c33c),_0x400ca6['set'](_0x64c33c['sqlCode'],_0x255395);}if(_0x156e7f&&!_0x400ca6[_0x1c969d(0x15d)](_0x156e7f))throw CliErrors[_0x1c969d(0x143)](_0x1c969d(0x141)+_0x156e7f);const _0x2f9f30=[];for(const [_0x242338,_0x3d2b54]of _0x400ca6[_0x1c969d(0x161)]()){if(_0x3d2b54[_0x1c969d(0x149)]===0x1){_0x2f9f30[_0x1c969d(0x151)](_0x3d2b54[0x0]);continue;}const _0x5d5772=_0x310f06[_0x1c969d(0x175)][_0x242338],_0x38e869=_0x5d5772?.['path'],_0x136033=_0x38e869?_0x3d2b54['filter'](_0x22fff3=>_0x22fff3['relativePath']!==_0x38e869):_0x3d2b54;if(_0x5d5772&&_0x136033[_0x1c969d(0x149)]===0x1){_0x2f9f30[_0x1c969d(0x151)](_0x136033[0x0]);continue;}throw CliErrors[_0x1c969d(0x143)](_0x1c969d(0x166)+_0x242338+_0x1c969d(0x164));}return _0x2f9f30;}export const sqlPush={'service':a197_0xf27331(0x147),'command':a197_0xf27331(0x151),'description':a197_0xf27331(0x16a),'risk':a197_0xf27331(0x155),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a197_0xf27331(0x153),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'validate'(_0xa36dca){validateAutomaticDeploymentSync(_0xa36dca);},async 'dryRun'(_0x34d620){const _0x3fd39d=a197_0xf27331,_0x977ce4=loadSqlProjectConfig(_0x34d620['appCode']),_0x55bce9=await readSqlLockFile(_0x977ce4[_0x3fd39d(0x14e)]),{appLock:_0xc4deed}=ensureSqlLockScope(_0x55bce9??createEmptySqlLock(),_0x34d620['appCode'],_0x977ce4['sqlRoot'],_0x3fd39d(0x151)),_0x21c4cc=await getTargetSqlQueries(_0x977ce4,_0xc4deed,_0x34d620[_0x3fd39d(0x15a)]('sqlcode')||undefined),_0x21d4b7=[];for(const _0x2e4f07 of _0x21c4cc){const _0x1956b2=await computeSqlFileHash(_0x2e4f07[_0x3fd39d(0x168)]),_0x38b0f8=_0xc4deed[_0x3fd39d(0x175)][_0x2e4f07['sqlCode']],_0x4aef19=!!_0x38b0f8&&(_0x38b0f8['path']!==_0x2e4f07['relativePath']||!!_0x2e4f07[_0x3fd39d(0x17e)]&&_0x38b0f8['sqlName']!==_0x2e4f07[_0x3fd39d(0x17e)]);if(!_0x34d620['bool'](_0x3fd39d(0x140))&&_0x38b0f8&&_0x38b0f8[_0x3fd39d(0x14f)]===_0x1956b2&&!_0x4aef19)continue;_0x21d4b7['push'](_0x2e4f07['sqlCode']);}return{'method':'POST','url':_0x3fd39d(0x177),'deploymentSync':buildAutomaticDeploymentSyncPreview(_0x34d620,_0x3fd39d(0x147),_0x21d4b7),'body':{'sqlCodes':_0x21d4b7,'appCode':_0x34d620[_0x3fd39d(0x17d)]},'description':'Would\x20push\x20'+_0x21d4b7[_0x3fd39d(0x149)]+_0x3fd39d(0x17c)};},async 'execute'(_0x15a7ab){const _0x39dd94=a197_0xf27331,_0x16ea6e=loadSqlProjectConfig(_0x15a7ab[_0x39dd94(0x17d)]),_0x14de4d=await readSqlLockFile(_0x16ea6e['lockFilePath']),{lockData:_0x197423,appLock:_0x1d82f4}=ensureSqlLockScope(_0x14de4d??createEmptySqlLock(),_0x15a7ab[_0x39dd94(0x17d)],_0x16ea6e[_0x39dd94(0x144)],'push'),_0x8a71ac=await getTargetSqlQueries(_0x16ea6e,_0x1d82f4,_0x15a7ab[_0x39dd94(0x15a)]('sqlcode')||undefined);if(_0x8a71ac['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x39dd94(0x16b)};const _0x464382=[],_0x228aab=[],_0x208f5b=[];for(const _0x1dcedc of _0x8a71ac){const _0x139b1b=_0x1d82f4['sqls'][_0x1dcedc[_0x39dd94(0x152)]];if(!_0x139b1b){_0x208f5b[_0x39dd94(0x151)]({'sqlCode':_0x1dcedc[_0x39dd94(0x152)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x4134e6=await computeSqlFileHash(_0x1dcedc['filePath']),_0x36881b=_0x139b1b[_0x39dd94(0x16e)]!==_0x1dcedc[_0x39dd94(0x156)]||!!_0x1dcedc[_0x39dd94(0x17e)]&&_0x139b1b['sqlName']!==_0x1dcedc[_0x39dd94(0x17e)];if(!_0x15a7ab[_0x39dd94(0x167)](_0x39dd94(0x140))&&_0x139b1b[_0x39dd94(0x14f)]===_0x4134e6&&!_0x36881b){_0x228aab[_0x39dd94(0x151)]({'sqlCode':_0x1dcedc[_0x39dd94(0x152)],'reason':'unchanged'});continue;}if(_0x139b1b['version']==null){_0x208f5b[_0x39dd94(0x151)]({'sqlCode':_0x1dcedc[_0x39dd94(0x152)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x2cee26=await readFile(_0x1dcedc['filePath'],_0x39dd94(0x142)),_0x9879ca=stripLocalSqlMetadata(_0x2cee26,_0x1dcedc[_0x39dd94(0x17b)]),_0x217dae=_0x1dcedc['sqlName']||_0x139b1b[_0x39dd94(0x17e)],_0x3b12d1=await resolveTargetDbBinding(_0x15a7ab[_0x39dd94(0x17d)],_0x1dcedc,_0x139b1b),_0x410929=await updateSqlQuery({'id':_0x139b1b['remoteId'],'appCode':_0x15a7ab[_0x39dd94(0x17d)],'sqlCode':_0x1dcedc[_0x39dd94(0x152)],'sqlName':_0x217dae,'dbId':_0x3b12d1[_0x39dd94(0x13e)],'version':_0x139b1b[_0x39dd94(0x160)],'sqlContent':_0x9879ca,'sqlConfig':_0x139b1b['sqlConfig']??undefined}),_0xac0a1d=_0x410929[_0x39dd94(0x13e)]?await getDbName(_0x15a7ab[_0x39dd94(0x17d)],Number(_0x410929[_0x39dd94(0x13e)]))[_0x39dd94(0x14c)](()=>_0x3b12d1[_0x39dd94(0x17a)]):_0x3b12d1['dbName'];_0x1d82f4[_0x39dd94(0x175)][_0x1dcedc[_0x39dd94(0x152)]]={...buildSqlLockEntry(_0x410929,_0x9879ca,_0x4134e6,{'dbName':_0xac0a1d}),'path':_0x1dcedc[_0x39dd94(0x156)],'mode':_0x139b1b[_0x39dd94(0x17b)]},await archivePreviousSqlFileIfNeeded(_0x16ea6e,_0x139b1b[_0x39dd94(0x16e)],_0x1dcedc[_0x39dd94(0x156)]),_0x464382[_0x39dd94(0x151)]({'sqlCode':_0x1dcedc[_0x39dd94(0x152)],'remoteId':_0x139b1b[_0x39dd94(0x150)]});}catch(_0x439fd6){_0x208f5b[_0x39dd94(0x151)]({'sqlCode':_0x1dcedc[_0x39dd94(0x152)],'error':_0x439fd6 instanceof Error?_0x439fd6['message']:String(_0x439fd6)});}}_0x1d82f4[_0x39dd94(0x16d)]=new Date()[_0x39dd94(0x172)](),await writeSqlLockFile(_0x16ea6e[_0x39dd94(0x14e)],_0x197423);const _0x511ed5=_0x208f5b['length']===0x0,_0x13612e=await runAutomaticDeploymentSync(_0x15a7ab,_0x39dd94(0x147),_0x464382[_0x39dd94(0x176)](_0x420d9c=>_0x420d9c['sqlCode']),_0x511ed5),_0x1e07f3=_0x511ed5&&automaticDeploymentSyncSucceeded(_0x13612e),_0x4be12f=_0x13612e[_0x39dd94(0x15f)]?_0x39dd94(0x146)+_0x13612e[_0x39dd94(0x169)]:'';return{'ok':_0x1e07f3,'data':{'pushed':_0x464382,'skipped':_0x228aab,'failed':_0x208f5b,'deploymentSync':_0x13612e},'message':_0x39dd94(0x16c)+_0x464382[_0x39dd94(0x149)]+'\x20pushed,\x20'+_0x228aab[_0x39dd94(0x149)]+_0x39dd94(0x154)+_0x208f5b[_0x39dd94(0x149)]+'\x20failed'+_0x4be12f};}};async function archivePreviousSqlFileIfNeeded(_0x562aa4,_0x32f2a6,_0x28ee6f){const _0x262635=a197_0xf27331;if(!_0x32f2a6||_0x32f2a6===_0x28ee6f)return;const _0x281dee=join(_0x562aa4[_0x262635(0x158)],_0x32f2a6);if(!await fileExists(_0x281dee))return;const _0x2467e8=await moveToTrash(_0x562aa4['projectRoot'],_0x562aa4[_0x262635(0x162)],_0x281dee);await cleanupEmptyDirectories(dirname(_0x281dee),_0x562aa4['sqlRootDir']),void _0x2467e8;}async function moveToTrash(_0x38dd45,_0x3f1af9,_0x5bdebf){const _0x366213=new Date()['toISOString']()['replace'](/[:.]/g,'-'),_0x4b515d=relative(_0x38dd45,_0x5bdebf),_0x27a076=join(_0x3f1af9,_0x366213,_0x4b515d);return await mkdir(dirname(_0x27a076),{'recursive':!![]}),await rename(_0x5bdebf,_0x27a076),_0x27a076;}async function cleanupEmptyDirectories(_0x3e3a2a,_0x1827a4){const _0x4bf38d=a197_0xf27331;let _0x35f027=resolve(_0x3e3a2a);const _0x1dbd06=resolve(_0x1827a4);while(_0x35f027[_0x4bf38d(0x16f)](''+_0x1dbd06+sep)||_0x35f027===_0x1dbd06){if(_0x35f027===_0x1dbd06)return;try{const _0x47d1a8=await readdir(_0x35f027);if(_0x47d1a8[_0x4bf38d(0x149)]>0x0)return;await rmdir(_0x35f027);}catch{return;}_0x35f027=dirname(_0x35f027);}}async function resolveTargetDbBinding(_0x4d1fcb,_0x4bafc4,_0x18b398){const _0x50b49b=a197_0xf27331,_0x1c1c6e=_0x4bafc4[_0x50b49b(0x145)];if(!_0x1c1c6e)return{'dbId':_0x18b398['dbId'],'dbName':_0x18b398['dbName']};const _0x48a2dc=buildDbDirectoryName(_0x18b398[_0x50b49b(0x17a)],_0x18b398['dbId']);if(_0x1c1c6e===_0x48a2dc)return{'dbId':_0x18b398[_0x50b49b(0x13e)],'dbName':_0x18b398[_0x50b49b(0x17a)]};const _0x1d96b8=parseExplicitDbDirectory(_0x1c1c6e);if(_0x1d96b8!=null)return{'dbId':_0x1d96b8,'dbName':await getDbName(_0x4d1fcb,_0x1d96b8)[_0x50b49b(0x14c)](()=>undefined)};const _0x4f1fde=await listDatabases(_0x4d1fcb),_0x50faa1=_0x4f1fde[_0x50b49b(0x165)](_0x323db4=>buildDbDirectoryName(_0x323db4[_0x50b49b(0x17a)],_0x323db4[_0x50b49b(0x13e)])===_0x1c1c6e);if(_0x50faa1['length']===0x1)return{'dbId':_0x50faa1[0x0]['dbId'],'dbName':_0x50faa1[0x0][_0x50b49b(0x17a)]};if(_0x50faa1[_0x50b49b(0x149)]===0x0)throw CliErrors[_0x50b49b(0x143)](_0x50b49b(0x170)+_0x1c1c6e+_0x50b49b(0x14b)+_0x4bafc4['sqlCode']+'.');const _0x1ef4a6=_0x50faa1[_0x50b49b(0x176)](_0x2073ea=>_0x2073ea[_0x50b49b(0x17a)]+'\x20('+_0x2073ea['dbId']+')')[_0x50b49b(0x173)](',\x20');throw CliErrors[_0x50b49b(0x143)]('Local\x20directory\x20\x22'+_0x1c1c6e+_0x50b49b(0x163)+_0x4bafc4[_0x50b49b(0x152)]+':\x20'+_0x1ef4a6);}function parseExplicitDbDirectory(_0x3a5733){const _0x162c84=a197_0xf27331,_0xa428aa=/^db-(\d+)$/[_0x162c84(0x15b)](_0x3a5733);if(!_0xa428aa)return null;const _0x162aee=Number(_0xa428aa[0x1]);return Number[_0x162c84(0x148)](_0x162aee)&&_0x162aee>0x0?_0x162aee:null;}
@@ -1 +1 @@
1
- const a193_0x19fb25=a193_0x1293;(function(_0x1b943a,_0xd1f70f){const _0x4e9b9e=a193_0x1293,_0x4ea178=_0x1b943a();while(!![]){try{const _0x4de753=parseInt(_0x4e9b9e(0x1c1))/0x1*(-parseInt(_0x4e9b9e(0x1c0))/0x2)+parseInt(_0x4e9b9e(0x1c4))/0x3*(parseInt(_0x4e9b9e(0x1d7))/0x4)+parseInt(_0x4e9b9e(0x1da))/0x5+parseInt(_0x4e9b9e(0x1bf))/0x6+parseInt(_0x4e9b9e(0x1c2))/0x7+parseInt(_0x4e9b9e(0x1dc))/0x8+-parseInt(_0x4e9b9e(0x1c7))/0x9;if(_0x4de753===_0xd1f70f)break;else _0x4ea178['push'](_0x4ea178['shift']());}catch(_0x46d517){_0x4ea178['push'](_0x4ea178['shift']());}}}(a193_0x439d,0x4132c));function a193_0x1293(_0x2e7e4e,_0x2abb7d){_0x2e7e4e=_0x2e7e4e-0x1b6;const _0x439d82=a193_0x439d();let _0x129342=_0x439d82[_0x2e7e4e];return _0x129342;}function a193_0x439d(){const _0x418ffc=['sqlConfig','dbId','lastSync','map','sqlRoot','1928604MplspN','trim','filter','418035bMflzb','join','2078376FgLgWv','\x20[y/N]\x20','path','push','<!--\x20@lovrabet.','replace','fromEntries','sqlName','sqlCode','mybatisXml','entries','version','endsWith','.rabetbase/sql','length','3105408QuCqcz','2WamaNk','309517WKFgTf','2929346mgiihH','\x20-->','3mUPCPz','dbName','close','10665288ssskuy','mode','syncedAt','apps','toLowerCase','description','yes','stderr','test','--\x20@lovrabet.','question'];a193_0x439d=function(){return _0x418ffc;};return a193_0x439d();}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=a193_0x19fb25(0x1bd);export function buildSqlLockEntry(_0x28882c,_0x569f1a,_0x21e81d,_0x19f72f){const _0x31de26=a193_0x19fb25,_0x14685c=detectSqlMode(_0x569f1a);return{'path':buildSqlRelativePath(_0x28882c['sqlCode'],_0x28882c['sqlName'],_0x19f72f?.[_0x31de26(0x1c5)],_0x14685c,_0x28882c['dbId']),'hash':_0x21e81d,'remoteId':_0x28882c['id'],'version':_0x28882c[_0x31de26(0x1bb)],'dbId':Number(_0x28882c[_0x31de26(0x1d3)]),'dbName':_0x19f72f?.['dbName'],'sqlName':_0x28882c[_0x31de26(0x1b7)],'sqlConfig':_0x28882c[_0x31de26(0x1d2)]??undefined,'mode':_0x14685c};}export function cloneSqlLockData(_0xb7ea59){const _0xd5397e=a193_0x19fb25;return{'apps':Object[_0xd5397e(0x1b6)](Object[_0xd5397e(0x1ba)](_0xb7ea59[_0xd5397e(0x1ca)])[_0xd5397e(0x1d5)](([_0x298048,_0x40f985])=>[_0x298048,{'sqlRoot':_0x40f985[_0xd5397e(0x1d6)],'lastSync':_0x40f985[_0xd5397e(0x1d4)],'sqls':{..._0x40f985['sqls']}}]))};}export function ensureRemoteSqlContent(_0x2fc3df){return _0x2fc3df['sqlContent']??'';}export function buildLocalSqlFileContent(_0x2c8d18,_0x595dd4,_0x4b8fbc){const _0x4019df=a193_0x19fb25,_0x1d9a6d=_0x4b8fbc?.[_0x4019df(0x1c8)]??detectSqlMode(_0x595dd4),_0x4a076b=stripLocalSqlMetadata(_0x595dd4,_0x1d9a6d)[_0x4019df(0x1d8)](),_0x2be693=[...buildMetadataHeaderLines({'sqlCode':_0x2c8d18['sqlCode'],'sqlName':_0x2c8d18['sqlName'],'dbId':_0x2c8d18['dbId'],'dbName':_0x4b8fbc?.[_0x4019df(0x1c5)],'mode':_0x1d9a6d,'syncedAt':_0x4b8fbc?.[_0x4019df(0x1c9)],'description':_0x4b8fbc?.[_0x4019df(0x1cc)]},_0x1d9a6d),'',_0x4a076b],_0x5d49bf=_0x2be693[_0x4019df(0x1db)]('\x0a');return _0x5d49bf[_0x4019df(0x1bc)]('\x0a')?_0x5d49bf:_0x5d49bf+'\x0a';}export function stripLocalSqlMetadata(_0x1aa26c,_0xb12bb8){const _0xfc05f9=a193_0x19fb25,_0x46877a=_0x1aa26c[_0xfc05f9(0x1e1)](/\r\n/g,'\x0a')['split']('\x0a'),_0x52d3d1=[];let _0x3c2bb7=0x0;if(_0xb12bb8==='mybatisXml')while(_0x3c2bb7<_0x46877a[_0xfc05f9(0x1be)]){const _0x2674d6=_0x46877a[_0x3c2bb7]??'';if(/^\s*<!--\s*@lovrabet\./[_0xfc05f9(0x1cf)](_0x2674d6)){_0x3c2bb7++;continue;}if(_0x2674d6[_0xfc05f9(0x1d8)]()===''&&_0x3c2bb7>0x0){_0x3c2bb7++;continue;}break;}else while(_0x3c2bb7<_0x46877a['length']){const _0x4e29b8=_0x46877a[_0x3c2bb7]??'';if(/^\s*--\s*@lovrabet\./[_0xfc05f9(0x1cf)](_0x4e29b8)){_0x3c2bb7++;continue;}if(_0x4e29b8[_0xfc05f9(0x1d8)]()===''&&_0x3c2bb7>0x0){_0x3c2bb7++;continue;}break;}for(;_0x3c2bb7<_0x46877a[_0xfc05f9(0x1be)];_0x3c2bb7++){_0x52d3d1[_0xfc05f9(0x1df)](_0x46877a[_0x3c2bb7]);}return _0x52d3d1[_0xfc05f9(0x1db)]('\x0a')['trimStart']();}export function resolveSqlMode(_0x48e00c,_0x9a6820){if(_0x9a6820?.['mode'])return _0x9a6820['mode'];return detectSqlMode(_0x48e00c);}export function resolveSqlFileName(_0xe91673,_0x5861eb,_0x40f5db){const _0x3de8fa=a193_0x19fb25;if(_0x40f5db?.['path'])return _0x40f5db[_0x3de8fa(0x1de)];if(_0x40f5db?.[_0x3de8fa(0x1b7)]||_0x40f5db?.[_0x3de8fa(0x1c5)])return buildSqlRelativePath(_0xe91673,_0x40f5db?.['sqlName'],_0x40f5db?.[_0x3de8fa(0x1c5)],resolveSqlMode(_0x5861eb,_0x40f5db),_0x40f5db?.[_0x3de8fa(0x1d3)]);return buildDefaultSqlFileName(_0xe91673,resolveSqlMode(_0x5861eb,_0x40f5db));}export function resolveSqlLocalDir(_0x29fe92,_0x17a373){return join(_0x29fe92,SQL_LOCAL_REL_DIR,_0x17a373);}export async function confirmForceOverwrite(_0x17e7c8){const _0x316f65=a193_0x19fb25,_0x3de96d=createInterface({'input':process['stdin'],'output':process[_0x316f65(0x1ce)]}),_0x25af67=await new Promise(_0xc92090=>{const _0x1acb30=_0x316f65;_0x3de96d[_0x1acb30(0x1d1)](_0x17e7c8+_0x1acb30(0x1dd),_0xc92090);});return _0x3de96d[_0x316f65(0x1c6)](),['y',_0x316f65(0x1cd)]['includes'](_0x25af67[_0x316f65(0x1d8)]()[_0x316f65(0x1cb)]());}export function findSqlLockScope(_0x1e0ea4,_0x186978){const _0x348746=a193_0x19fb25;return _0x1e0ea4[_0x348746(0x1ca)][_0x186978];}function buildMetadataHeaderLines(_0x16412d,_0x467fc7){const _0x3d36dc=a193_0x19fb25,_0xcaa691=[['sqlCode',_0x16412d[_0x3d36dc(0x1b8)]],['sqlName',_0x16412d[_0x3d36dc(0x1b7)]],[_0x3d36dc(0x1d3),_0x16412d[_0x3d36dc(0x1d3)]],[_0x3d36dc(0x1c5),_0x16412d['dbName']],['mode',_0x16412d[_0x3d36dc(0x1c8)]],[_0x3d36dc(0x1c9),_0x16412d[_0x3d36dc(0x1c9)]],[_0x3d36dc(0x1cc),_0x16412d[_0x3d36dc(0x1cc)]]];if(_0x467fc7===_0x3d36dc(0x1b9))return _0xcaa691['filter'](([,_0x26ed98])=>_0x26ed98!==undefined&&_0x26ed98!==null&&String(_0x26ed98)[_0x3d36dc(0x1d8)]()!=='')[_0x3d36dc(0x1d5)](([_0x42eb0,_0x559f86])=>_0x3d36dc(0x1e0)+_0x42eb0+':\x20'+String(_0x559f86)+_0x3d36dc(0x1c3));return _0xcaa691[_0x3d36dc(0x1d9)](([,_0x48c84d])=>_0x48c84d!==undefined&&_0x48c84d!==null&&String(_0x48c84d)[_0x3d36dc(0x1d8)]()!=='')[_0x3d36dc(0x1d5)](([_0x57637f,_0x1922eb])=>_0x3d36dc(0x1d0)+_0x57637f+':\x20'+String(_0x1922eb));}
1
+ (function(_0x58c104,_0x22269e){const _0x4a2006=a198_0x1a0a,_0x1a4455=_0x58c104();while(!![]){try{const _0x542c40=-parseInt(_0x4a2006(0xb1))/0x1*(-parseInt(_0x4a2006(0xc2))/0x2)+-parseInt(_0x4a2006(0xb3))/0x3*(-parseInt(_0x4a2006(0xa1))/0x4)+parseInt(_0x4a2006(0xca))/0x5*(-parseInt(_0x4a2006(0xc8))/0x6)+parseInt(_0x4a2006(0x9e))/0x7+parseInt(_0x4a2006(0xcb))/0x8+-parseInt(_0x4a2006(0xb2))/0x9+parseInt(_0x4a2006(0xaf))/0xa*(-parseInt(_0x4a2006(0xa7))/0xb);if(_0x542c40===_0x22269e)break;else _0x1a4455['push'](_0x1a4455['shift']());}catch(_0x3fc343){_0x1a4455['push'](_0x1a4455['shift']());}}}(a198_0x3755,0x68965));import{createInterface}from'node:readline';function a198_0x3755(){const _0x54698c=['12FFVVoJ','endsWith','join','lastSync','description','trimStart','sqlCode','\x20[y/N]\x20','sqlName','trim','stderr','sqls','dbName','push','mode','10mKKbmY','sqlConfig','entries','sqlContent','dbId','--\x20@lovrabet.','18AXrKtA','length','624445LsgsrH','5785864KcYdRc','close','1486583ErNDjW','question','toLowerCase','23444DcFDaR','includes','apps','mybatisXml','replace','map','22tgEauT','path','split','fromEntries','version','stdin','syncedAt','\x20-->','981790dDDWyI','filter','86156rUfiXn','3513708YQfDfS'];a198_0x3755=function(){return _0x54698c;};return a198_0x3755();}function a198_0x1a0a(_0x563dc9,_0x5855c3){_0x563dc9=_0x563dc9-0x9d;const _0x3755e2=a198_0x3755();let _0x1a0a60=_0x3755e2[_0x563dc9];return _0x1a0a60;}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x1253af,_0xccac65,_0x508dd5,_0x2dea32){const _0xd09501=a198_0x1a0a,_0xaf6a4d=detectSqlMode(_0xccac65);return{'path':buildSqlRelativePath(_0x1253af['sqlCode'],_0x1253af['sqlName'],_0x2dea32?.[_0xd09501(0xbf)],_0xaf6a4d,_0x1253af[_0xd09501(0xc6)]),'hash':_0x508dd5,'remoteId':_0x1253af['id'],'version':_0x1253af[_0xd09501(0xab)],'dbId':Number(_0x1253af[_0xd09501(0xc6)]),'dbName':_0x2dea32?.[_0xd09501(0xbf)],'sqlName':_0x1253af[_0xd09501(0xbb)],'sqlConfig':_0x1253af[_0xd09501(0xc3)]??undefined,'mode':_0xaf6a4d};}export function cloneSqlLockData(_0x573e59){const _0x2ab69d=a198_0x1a0a;return{'apps':Object[_0x2ab69d(0xaa)](Object[_0x2ab69d(0xc4)](_0x573e59['apps'])[_0x2ab69d(0xa6)](([_0x5a1dde,_0x2d39cc])=>[_0x5a1dde,{'sqlRoot':_0x2d39cc['sqlRoot'],'lastSync':_0x2d39cc[_0x2ab69d(0xb6)],'sqls':{..._0x2d39cc[_0x2ab69d(0xbe)]}}]))};}export function ensureRemoteSqlContent(_0xa59f57){const _0x352492=a198_0x1a0a;return _0xa59f57[_0x352492(0xc5)]??'';}export function buildLocalSqlFileContent(_0x215ae9,_0x515141,_0x205108){const _0x2c79d5=a198_0x1a0a,_0xa784fd=_0x205108?.[_0x2c79d5(0xc1)]??detectSqlMode(_0x515141),_0x27018b=stripLocalSqlMetadata(_0x515141,_0xa784fd)[_0x2c79d5(0xbc)](),_0x173aac=[...buildMetadataHeaderLines({'sqlCode':_0x215ae9[_0x2c79d5(0xb9)],'sqlName':_0x215ae9['sqlName'],'dbId':_0x215ae9[_0x2c79d5(0xc6)],'dbName':_0x205108?.[_0x2c79d5(0xbf)],'mode':_0xa784fd,'syncedAt':_0x205108?.['syncedAt'],'description':_0x205108?.['description']},_0xa784fd),'',_0x27018b],_0x57afb6=_0x173aac[_0x2c79d5(0xb5)]('\x0a');return _0x57afb6[_0x2c79d5(0xb4)]('\x0a')?_0x57afb6:_0x57afb6+'\x0a';}export function stripLocalSqlMetadata(_0x45d965,_0x354294){const _0x3c16ff=a198_0x1a0a,_0x44c722=_0x45d965[_0x3c16ff(0xa5)](/\r\n/g,'\x0a')[_0x3c16ff(0xa9)]('\x0a'),_0x42e56b=[];let _0x347a44=0x0;if(_0x354294===_0x3c16ff(0xa4))while(_0x347a44<_0x44c722[_0x3c16ff(0xc9)]){const _0x168e14=_0x44c722[_0x347a44]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x168e14)){_0x347a44++;continue;}if(_0x168e14[_0x3c16ff(0xbc)]()===''&&_0x347a44>0x0){_0x347a44++;continue;}break;}else while(_0x347a44<_0x44c722[_0x3c16ff(0xc9)]){const _0x27d453=_0x44c722[_0x347a44]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x27d453)){_0x347a44++;continue;}if(_0x27d453[_0x3c16ff(0xbc)]()===''&&_0x347a44>0x0){_0x347a44++;continue;}break;}for(;_0x347a44<_0x44c722[_0x3c16ff(0xc9)];_0x347a44++){_0x42e56b[_0x3c16ff(0xc0)](_0x44c722[_0x347a44]);}return _0x42e56b[_0x3c16ff(0xb5)]('\x0a')[_0x3c16ff(0xb8)]();}export function resolveSqlMode(_0x17ab96,_0x50df80){const _0xf842be=a198_0x1a0a;if(_0x50df80?.[_0xf842be(0xc1)])return _0x50df80[_0xf842be(0xc1)];return detectSqlMode(_0x17ab96);}export function resolveSqlFileName(_0x8f230a,_0x5c0004,_0x96bf85){const _0x20e67f=a198_0x1a0a;if(_0x96bf85?.['path'])return _0x96bf85[_0x20e67f(0xa8)];if(_0x96bf85?.[_0x20e67f(0xbb)]||_0x96bf85?.['dbName'])return buildSqlRelativePath(_0x8f230a,_0x96bf85?.[_0x20e67f(0xbb)],_0x96bf85?.[_0x20e67f(0xbf)],resolveSqlMode(_0x5c0004,_0x96bf85),_0x96bf85?.[_0x20e67f(0xc6)]);return buildDefaultSqlFileName(_0x8f230a,resolveSqlMode(_0x5c0004,_0x96bf85));}export function resolveSqlLocalDir(_0xa38f74,_0x20f8ec){return join(_0xa38f74,SQL_LOCAL_REL_DIR,_0x20f8ec);}export async function confirmForceOverwrite(_0x1d63ff){const _0x5e778d=a198_0x1a0a,_0x4abdfe=createInterface({'input':process[_0x5e778d(0xac)],'output':process[_0x5e778d(0xbd)]}),_0x7dbe07=await new Promise(_0x41f2ae=>{const _0x1965bd=_0x5e778d;_0x4abdfe[_0x1965bd(0x9f)](_0x1d63ff+_0x1965bd(0xba),_0x41f2ae);});return _0x4abdfe[_0x5e778d(0x9d)](),['y','yes'][_0x5e778d(0xa2)](_0x7dbe07[_0x5e778d(0xbc)]()[_0x5e778d(0xa0)]());}export function findSqlLockScope(_0x5248d9,_0x3e7de9){const _0x340ae0=a198_0x1a0a;return _0x5248d9[_0x340ae0(0xa3)][_0x3e7de9];}function buildMetadataHeaderLines(_0x5621ba,_0x48de75){const _0x3067a9=a198_0x1a0a,_0x3a540c=[[_0x3067a9(0xb9),_0x5621ba[_0x3067a9(0xb9)]],[_0x3067a9(0xbb),_0x5621ba['sqlName']],[_0x3067a9(0xc6),_0x5621ba[_0x3067a9(0xc6)]],[_0x3067a9(0xbf),_0x5621ba[_0x3067a9(0xbf)]],[_0x3067a9(0xc1),_0x5621ba[_0x3067a9(0xc1)]],[_0x3067a9(0xad),_0x5621ba[_0x3067a9(0xad)]],['description',_0x5621ba[_0x3067a9(0xb7)]]];if(_0x48de75===_0x3067a9(0xa4))return _0x3a540c['filter'](([,_0x361cd4])=>_0x361cd4!==undefined&&_0x361cd4!==null&&String(_0x361cd4)[_0x3067a9(0xbc)]()!=='')[_0x3067a9(0xa6)](([_0x2cadc8,_0x3cd7bd])=>'<!--\x20@lovrabet.'+_0x2cadc8+':\x20'+String(_0x3cd7bd)+_0x3067a9(0xae));return _0x3a540c[_0x3067a9(0xb0)](([,_0x574a79])=>_0x574a79!==undefined&&_0x574a79!==null&&String(_0x574a79)[_0x3067a9(0xbc)]()!=='')['map'](([_0x59b09c,_0x10bee5])=>_0x3067a9(0xc7)+_0x59b09c+':\x20'+String(_0x10bee5));}
@@ -1 +1 @@
1
- const a194_0x1f760a=a194_0x5ae8;function a194_0x1d6c(){const _0xc6753b=['\x20added,\x20','20mcoRnt','map','15109919IUfGAb','push','591094ofAULg','read','boolean','appCode','length','\x20modified,\x20','status','All\x20SQL\x20queries\x20are\x20in\x20sync.','1281116dLoJMK','filePath','remote','sqls','sqlName','sqlRoot','has','lockFilePath','keys','1284065QqTUsS','6IIeTZp','\x20missing,\x20','sqlCode','364724mSpTIl','\x20unchanged','653288KjAZer','relativePath','hash','lockKey','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','bool','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','3AVycRy','8iQNYlB','12HcsQdT','1989675MIJkwI'];a194_0x1d6c=function(){return _0xc6753b;};return a194_0x1d6c();}(function(_0x190dd1,_0x2525e0){const _0x4aac51=a194_0x5ae8,_0x4c44ee=_0x190dd1();while(!![]){try{const _0x1c4fc1=parseInt(_0x4aac51(0x1d8))/0x1+parseInt(_0x4aac51(0x1cb))/0x2+-parseInt(_0x4aac51(0x1ba))/0x3*(-parseInt(_0x4aac51(0x1da))/0x4)+parseInt(_0x4aac51(0x1d4))/0x5*(parseInt(_0x4aac51(0x1d5))/0x6)+parseInt(_0x4aac51(0x1c3))/0x7*(-parseInt(_0x4aac51(0x1bb))/0x8)+parseInt(_0x4aac51(0x1bd))/0x9*(parseInt(_0x4aac51(0x1bf))/0xa)+parseInt(_0x4aac51(0x1c1))/0xb*(-parseInt(_0x4aac51(0x1bc))/0xc);if(_0x1c4fc1===_0x2525e0)break;else _0x4c44ee['push'](_0x4c44ee['shift']());}catch(_0x577922){_0x4c44ee['push'](_0x4c44ee['shift']());}}}(a194_0x1d6c,0x63f98));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';function a194_0x5ae8(_0x299dd7,_0x35ebe6){_0x299dd7=_0x299dd7-0x1b5;const _0x1d6c9d=a194_0x1d6c();let _0x5ae855=_0x1d6c9d[_0x299dd7];return _0x5ae855;}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x2dfd9f){const _0x13dc18=a194_0x5ae8,_0x2975a9=[];let _0x39ac06=0x1;while(!![]){const _0x439873=await listSqlQueries(_0x2dfd9f,{'currentPage':_0x39ac06,'pageSize':PAGE_SIZE}),_0x22507b=_0x439873['tableData']??[];_0x2975a9[_0x13dc18(0x1c2)](..._0x22507b[_0x13dc18(0x1c0)](_0x4ca9f9=>_0x4ca9f9[_0x13dc18(0x1d7)]));if(_0x22507b[_0x13dc18(0x1c7)]===0x0)break;const _0x33cb29=_0x439873['paging']?.['totalCount'];if(_0x33cb29!=null?_0x2975a9[_0x13dc18(0x1c7)]>=_0x33cb29:_0x22507b['length']<PAGE_SIZE)break;_0x39ac06++;}return _0x2975a9;}export const sqlStatus={'service':'sql','command':a194_0x1f760a(0x1c9),'description':a194_0x1f760a(0x1b7),'risk':a194_0x1f760a(0x1c4),'flags':[{'name':'remote','type':a194_0x1f760a(0x1c5),'description':a194_0x1f760a(0x1b9)}],async 'execute'(_0x2bcba2){const _0x418986=a194_0x1f760a,_0x1df7f1=loadSqlProjectConfig(_0x2bcba2[_0x418986(0x1c6)]),_0x56004c=await readSqlLockFile(_0x1df7f1[_0x418986(0x1d2)]),{appLock:_0x44db1c}=ensureSqlLockScope(_0x56004c??createEmptySqlLock(),_0x1df7f1[_0x418986(0x1c6)],_0x1df7f1[_0x418986(0x1d0)],_0x418986(0x1c9)),_0x3fc69c=await scanLocalSqlQueries(_0x1df7f1),_0x1bb6f8=[],_0x440433=[],_0x1deb85=[],_0x53f9df=[],_0x4bbb4a=new Set(_0x3fc69c[_0x418986(0x1c0)](_0x5d59ba=>_0x5d59ba['lockKey']));for(const _0x4706e6 of _0x3fc69c){const _0x2f3b25=await computeSqlFileHash(_0x4706e6[_0x418986(0x1cc)]),_0x24dc18=_0x44db1c[_0x418986(0x1ce)][_0x4706e6[_0x418986(0x1b6)]],_0x258a7d=!!_0x24dc18&&_0x24dc18['path']!==_0x4706e6[_0x418986(0x1db)],_0x768d7d=!!_0x24dc18&&!!_0x4706e6['sqlName']&&_0x24dc18[_0x418986(0x1cf)]!==_0x4706e6[_0x418986(0x1cf)];if(!_0x24dc18)_0x1bb6f8[_0x418986(0x1c2)](_0x4706e6[_0x418986(0x1b6)]);else _0x24dc18[_0x418986(0x1b5)]!==_0x2f3b25||_0x258a7d||_0x768d7d?_0x440433[_0x418986(0x1c2)](_0x4706e6[_0x418986(0x1b6)]):_0x1deb85['push'](_0x4706e6[_0x418986(0x1b6)]);}for(const _0x3a8019 of Object[_0x418986(0x1d3)](_0x44db1c[_0x418986(0x1ce)])){!_0x4bbb4a[_0x418986(0x1d1)](_0x3a8019)&&_0x53f9df['push'](_0x3a8019);}const _0x363f5c=[];if(_0x2bcba2[_0x418986(0x1b8)](_0x418986(0x1cd))){const _0x333799=await fetchAllSqlCodes(_0x2bcba2['appCode']);for(const _0x2545e5 of _0x333799){!_0x4bbb4a[_0x418986(0x1d1)](_0x2545e5)&&!_0x44db1c[_0x418986(0x1ce)][_0x2545e5]&&_0x363f5c[_0x418986(0x1c2)](_0x2545e5);}}const _0x3ecd4e=_0x1bb6f8[_0x418986(0x1c7)]===0x0&&_0x440433['length']===0x0&&_0x53f9df['length']===0x0&&_0x363f5c[_0x418986(0x1c7)]===0x0;return{'ok':!![],'data':{'added':_0x1bb6f8,'modified':_0x440433,'missing':_0x53f9df,'unchanged':_0x1deb85,'remoteOnly':_0x363f5c},'message':_0x3ecd4e?_0x418986(0x1ca):_0x1bb6f8['length']+_0x418986(0x1be)+_0x440433[_0x418986(0x1c7)]+_0x418986(0x1c8)+_0x53f9df[_0x418986(0x1c7)]+_0x418986(0x1d6)+_0x1deb85[_0x418986(0x1c7)]+_0x418986(0x1d9)+(_0x363f5c['length']>0x0?',\x20'+_0x363f5c[_0x418986(0x1c7)]+'\x20remote-only':'')};}};
1
+ function a199_0x42b9(_0x22e8cf,_0x564bd5){_0x22e8cf=_0x22e8cf-0x1ac;const _0x1b493d=a199_0x1b49();let _0x42b996=_0x1b493d[_0x22e8cf];return _0x42b996;}const a199_0x1ec86c=a199_0x42b9;(function(_0x1b2f95,_0x3ba5c3){const _0x2793ba=a199_0x42b9,_0x326a67=_0x1b2f95();while(!![]){try{const _0x355c82=parseInt(_0x2793ba(0x1d0))/0x1+-parseInt(_0x2793ba(0x1ce))/0x2+parseInt(_0x2793ba(0x1ca))/0x3*(parseInt(_0x2793ba(0x1bb))/0x4)+-parseInt(_0x2793ba(0x1cf))/0x5*(parseInt(_0x2793ba(0x1c1))/0x6)+parseInt(_0x2793ba(0x1b7))/0x7*(parseInt(_0x2793ba(0x1ba))/0x8)+-parseInt(_0x2793ba(0x1cd))/0x9*(parseInt(_0x2793ba(0x1af))/0xa)+parseInt(_0x2793ba(0x1ad))/0xb;if(_0x355c82===_0x3ba5c3)break;else _0x326a67['push'](_0x326a67['shift']());}catch(_0x3a1e6e){_0x326a67['push'](_0x326a67['shift']());}}}(a199_0x1b49,0x45908));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(_0x1a2710){const _0xe2de4d=a199_0x42b9,_0x2812bb=[];let _0x2fab3f=0x1;while(!![]){const _0x18797c=await listSqlQueries(_0x1a2710,{'currentPage':_0x2fab3f,'pageSize':PAGE_SIZE}),_0x22fe06=_0x18797c[_0xe2de4d(0x1ae)]??[];_0x2812bb['push'](..._0x22fe06['map'](_0x5c0aab=>_0x5c0aab[_0xe2de4d(0x1cc)]));if(_0x22fe06[_0xe2de4d(0x1cb)]===0x0)break;const _0x13e836=_0x18797c['paging']?.[_0xe2de4d(0x1c5)];if(_0x13e836!=null?_0x2812bb[_0xe2de4d(0x1cb)]>=_0x13e836:_0x22fe06['length']<PAGE_SIZE)break;_0x2fab3f++;}return _0x2812bb;}export const sqlStatus={'service':a199_0x1ec86c(0x1b8),'command':a199_0x1ec86c(0x1b9),'description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a199_0x1ec86c(0x1c8),'flags':[{'name':a199_0x1ec86c(0x1b4),'type':a199_0x1ec86c(0x1c7),'description':a199_0x1ec86c(0x1b2)}],async 'execute'(_0x5e5b63){const _0x28aff1=a199_0x1ec86c,_0x4e0b89=loadSqlProjectConfig(_0x5e5b63['appCode']),_0x564c2d=await readSqlLockFile(_0x4e0b89['lockFilePath']),{appLock:_0x384fb9}=ensureSqlLockScope(_0x564c2d??createEmptySqlLock(),_0x4e0b89[_0x28aff1(0x1b3)],_0x4e0b89[_0x28aff1(0x1d1)],_0x28aff1(0x1b9)),_0x40e076=await scanLocalSqlQueries(_0x4e0b89),_0x5d998c=[],_0x4e6243=[],_0x35937a=[],_0x5ebdfb=[],_0x524541=new Set(_0x40e076['map'](_0x116b50=>_0x116b50[_0x28aff1(0x1c6)]));for(const _0x4d79cd of _0x40e076){const _0x5055cb=await computeSqlFileHash(_0x4d79cd[_0x28aff1(0x1b0)]),_0x405349=_0x384fb9[_0x28aff1(0x1b1)][_0x4d79cd[_0x28aff1(0x1c6)]],_0x3db528=!!_0x405349&&_0x405349[_0x28aff1(0x1bd)]!==_0x4d79cd[_0x28aff1(0x1bc)],_0x2b9624=!!_0x405349&&!!_0x4d79cd['sqlName']&&_0x405349[_0x28aff1(0x1b6)]!==_0x4d79cd[_0x28aff1(0x1b6)];if(!_0x405349)_0x5d998c[_0x28aff1(0x1c0)](_0x4d79cd['lockKey']);else _0x405349[_0x28aff1(0x1b5)]!==_0x5055cb||_0x3db528||_0x2b9624?_0x4e6243[_0x28aff1(0x1c0)](_0x4d79cd[_0x28aff1(0x1c6)]):_0x35937a['push'](_0x4d79cd[_0x28aff1(0x1c6)]);}for(const _0x40f94a of Object[_0x28aff1(0x1be)](_0x384fb9[_0x28aff1(0x1b1)])){!_0x524541[_0x28aff1(0x1ac)](_0x40f94a)&&_0x5ebdfb['push'](_0x40f94a);}const _0xf81f9e=[];if(_0x5e5b63[_0x28aff1(0x1c4)](_0x28aff1(0x1b4))){const _0x1238b1=await fetchAllSqlCodes(_0x5e5b63[_0x28aff1(0x1b3)]);for(const _0x5e2cb0 of _0x1238b1){!_0x524541[_0x28aff1(0x1ac)](_0x5e2cb0)&&!_0x384fb9[_0x28aff1(0x1b1)][_0x5e2cb0]&&_0xf81f9e[_0x28aff1(0x1c0)](_0x5e2cb0);}}const _0x2d3a34=_0x5d998c[_0x28aff1(0x1cb)]===0x0&&_0x4e6243[_0x28aff1(0x1cb)]===0x0&&_0x5ebdfb[_0x28aff1(0x1cb)]===0x0&&_0xf81f9e[_0x28aff1(0x1cb)]===0x0;return{'ok':!![],'data':{'added':_0x5d998c,'modified':_0x4e6243,'missing':_0x5ebdfb,'unchanged':_0x35937a,'remoteOnly':_0xf81f9e},'message':_0x2d3a34?_0x28aff1(0x1c9):_0x5d998c[_0x28aff1(0x1cb)]+_0x28aff1(0x1bf)+_0x4e6243[_0x28aff1(0x1cb)]+'\x20modified,\x20'+_0x5ebdfb[_0x28aff1(0x1cb)]+_0x28aff1(0x1c3)+_0x35937a['length']+'\x20unchanged'+(_0xf81f9e[_0x28aff1(0x1cb)]>0x0?',\x20'+_0xf81f9e[_0x28aff1(0x1cb)]+_0x28aff1(0x1c2):'')};}};function a199_0x1b49(){const _0x528cc2=['\x20missing,\x20','bool','totalCount','lockKey','boolean','read','All\x20SQL\x20queries\x20are\x20in\x20sync.','6MIHXls','length','sqlCode','9gXJfLO','525384VODnOk','5060qSJmnV','305543fAogNK','sqlRoot','has','2140974sYSWrc','tableData','2131210zyoqFt','filePath','sqls','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','appCode','remote','hash','sqlName','606613IPRbHE','sql','status','32QkFHeS','18128oGQADV','relativePath','path','keys','\x20added,\x20','push','564wvlBGt','\x20remote-only'];a199_0x1b49=function(){return _0x528cc2;};return a199_0x1b49();}
@@ -1 +1 @@
1
- const a195_0x387d6d=a195_0xb141;(function(_0x2ba2a4,_0x1735f1){const _0x38175d=a195_0xb141,_0x2247ba=_0x2ba2a4();while(!![]){try{const _0x275d10=parseInt(_0x38175d(0xd2))/0x1*(-parseInt(_0x38175d(0xef))/0x2)+-parseInt(_0x38175d(0x10c))/0x3*(-parseInt(_0x38175d(0xcf))/0x4)+parseInt(_0x38175d(0xea))/0x5+-parseInt(_0x38175d(0xfd))/0x6*(-parseInt(_0x38175d(0xe8))/0x7)+-parseInt(_0x38175d(0xe3))/0x8+parseInt(_0x38175d(0xf6))/0x9+parseInt(_0x38175d(0x105))/0xa*(parseInt(_0x38175d(0xda))/0xb);if(_0x275d10===_0x1735f1)break;else _0x2247ba['push'](_0x2247ba['shift']());}catch(_0xbd7fde){_0x2247ba['push'](_0x2247ba['shift']());}}}(a195_0x2a44,0xdfec5));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 a195_0x2a44(){const _0x2f6da6=['Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','get','check-indexes','dbtableConfig','1210repilq','index_type','--check-indexes\x20requires\x20--schemas.','reason','cwd','length','isSelectOnly','find','parameters','12723928fxJMRp','validate','valid','pkField','dataset','537131tMREJD','schemas','4203185EfdRTy','str','type','sql','split','513914thjAHH','index_columns','File\x20not\x20found:\x20','fields','push','columns','filter','3268287dAPPbP','file','isArray','toLowerCase','Table\x20\x22','validation','SQL\x20schema\x20validation','12kcmLGi','boolean','flatMap','unshift','string','utf-8','map','bool','20010VEgmlz','from','flagMissing','tables','sqlType','columnNames','name','45NEbYBd','schemaWarnings','Provide\x20--file\x20or\x20--sql','Dataset\x20\x22','indexes','453652fkBIVW','primary','size','3tfuGDK','tableName','message','trim'];a195_0x2a44=function(){return _0x2f6da6;};return a195_0x2a44();}import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a195_0xb141(_0x1ae5f2,_0x145e8f){_0x1ae5f2=_0x1ae5f2-0xce;const _0x2a4475=a195_0x2a44();let _0xb1415b=_0x2a4475[_0x1ae5f2];return _0xb1415b;}import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a195_0x387d6d(0xed),'command':a195_0x387d6d(0xe4),'description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':'read','flags':[{'name':'file','type':a195_0x387d6d(0x101),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a195_0x387d6d(0xed),'type':a195_0x387d6d(0x101),'description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':a195_0x387d6d(0xe9),'type':a195_0x387d6d(0x101),'description':'Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against'},{'name':a195_0x387d6d(0xd8),'type':a195_0x387d6d(0xfe),'description':a195_0x387d6d(0xd6)}],async 'execute'(_0x5b1517){const _0x4fa6b5=a195_0x387d6d,_0x3e4c5c=_0x5b1517[_0x4fa6b5(0xeb)]('file'),_0x47781c=_0x5b1517[_0x4fa6b5(0xeb)](_0x4fa6b5(0xed)),_0xed022b=_0x5b1517[_0x4fa6b5(0xeb)](_0x4fa6b5(0xe9)),_0x508356=_0x5b1517[_0x4fa6b5(0x104)](_0x4fa6b5(0xd8));if(!_0x3e4c5c&&!_0x47781c)throw CliErrors[_0x4fa6b5(0x107)](_0x4fa6b5(0xf7),_0x4fa6b5(0x10e));if(_0x508356&&!_0xed022b)throw CliErrors[_0x4fa6b5(0xfb)](_0x4fa6b5(0xdc));let _0x4af58f;if(_0x3e4c5c){const _0x27e96c=resolve(process[_0x4fa6b5(0xde)](),_0x3e4c5c);if(!existsSync(_0x27e96c))throw CliErrors[_0x4fa6b5(0xfb)](_0x4fa6b5(0xf1)+_0x27e96c);_0x4af58f=readFileSync(_0x27e96c,_0x4fa6b5(0x102));}else _0x4af58f=_0x47781c;const _0x35a97c=validateSql(_0x4af58f),_0x38ecfc={'valid':_0x35a97c[_0x4fa6b5(0xe5)],'sqlType':_0x35a97c[_0x4fa6b5(0x109)][_0x4fa6b5(0xec)],'isSelectOnly':_0x35a97c['sqlType'][_0x4fa6b5(0xe0)],'isDangerous':_0x35a97c['sqlType']['isDangerous'],'tables':_0x35a97c[_0x4fa6b5(0x108)],'parameters':_0x35a97c[_0x4fa6b5(0xe2)],'message':_0x35a97c['message']};_0x35a97c['sqlType'][_0x4fa6b5(0xdd)]&&(_0x38ecfc[_0x4fa6b5(0xdd)]=_0x35a97c[_0x4fa6b5(0x109)]['reason']);if(_0xed022b&&_0x35a97c[_0x4fa6b5(0xe5)]){const _0xa5daf=_0xed022b['split'](',')[_0x4fa6b5(0x103)](_0x3ffd54=>_0x3ffd54[_0x4fa6b5(0xd5)]())['filter'](Boolean),_0x551141=[],_0x5fc5eb=[],_0xd10c70=filterDbTableBackedDatasets(await listDatasets(_0x5b1517['appCode'])),_0x2b5a8a=new Map(_0xd10c70['map'](_0x1eeced=>[_0x1eeced[_0x4fa6b5(0xd9)]?.[_0x4fa6b5(0xd3)]?.['toLowerCase'](),_0x1eeced]));for(const _0x3f4ed5 of _0x35a97c['tables']){const _0x1a179a=_0x2b5a8a[_0x4fa6b5(0xd7)](_0x3f4ed5[_0x4fa6b5(0xf9)]());!_0x1a179a&&_0x551141[_0x4fa6b5(0xf3)](_0x4fa6b5(0xfa)+_0x3f4ed5+'\x22\x20not\x20found\x20in\x20any\x20dataset');}for(const _0x3bddbc of _0xa5daf){let _0x4c67f6;try{_0x4c67f6=await getDatasetDetail(_0x3bddbc);}catch{_0x551141['push'](_0x4fa6b5(0x10f)+_0x3bddbc+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x4c67f6,_0x4fa6b5(0xfc));const _0x18a0b2=Array[_0x4fa6b5(0xf8)](_0x4c67f6['fields'])?_0x4c67f6[_0x4fa6b5(0xf2)]:[],_0x73904b=new Set(_0x18a0b2[_0x4fa6b5(0x103)](_0x53b704=>_0x53b704['name']?.[_0x4fa6b5(0xf9)]())),_0x20693f=_0x4c67f6[_0x4fa6b5(0xd9)]?.['tableName']||_0x4c67f6['tableName']||_0x3bddbc;_0x38ecfc['schema:'+_0x20693f]={'code':_0x3bddbc,'tableName':_0x20693f,'fieldCount':_0x73904b[_0x4fa6b5(0xd1)],'fields':Array[_0x4fa6b5(0x106)](_0x73904b)};if(_0x508356){const _0x4c811c=normalizeDatasetIndexes(_0x4c67f6);_0x5fc5eb[_0x4fa6b5(0xf3)]({'tableName':_0x20693f,..._0x4c811c});}}_0x551141['length']>0x0&&(_0x38ecfc[_0x4fa6b5(0x10d)]=_0x551141),_0x508356&&(_0x38ecfc['joinAudit']=auditSqlJoinIndexes(_0x4af58f,_0x5fc5eb));}return{'ok':_0x35a97c[_0x4fa6b5(0xe5)],'data':_0x38ecfc,'message':_0x35a97c[_0x4fa6b5(0xd4)]};}};function normalizeDatasetIndexes(_0x61048c){const _0x302c0f=a195_0x387d6d,_0x335720=Array[_0x302c0f(0xf8)](_0x61048c?.['dataset']?.[_0x302c0f(0xce)])?_0x61048c[_0x302c0f(0xe7)][_0x302c0f(0xce)]:Array[_0x302c0f(0xf8)](_0x61048c?.[_0x302c0f(0xce)])?_0x61048c[_0x302c0f(0xce)]:[],_0xf7e5e0=_0x335720[_0x302c0f(0xff)](_0x1094ba=>{const _0x371fb7=_0x302c0f,_0x3b2c06=Array[_0x371fb7(0xf8)](_0x1094ba?.[_0x371fb7(0xf0)])?_0x1094ba[_0x371fb7(0xf0)]:Array[_0x371fb7(0xf8)](_0x1094ba?.[_0x371fb7(0x10a)])?_0x1094ba[_0x371fb7(0x10a)]:Array[_0x371fb7(0xf8)](_0x1094ba?.[_0x371fb7(0xf4)])?_0x1094ba['columns']:[],_0x528790=_0x3b2c06['filter'](_0x36461b=>typeof _0x36461b===_0x371fb7(0x101))[_0x371fb7(0x103)](_0x55b179=>_0x55b179['trim']())[_0x371fb7(0xf5)](Boolean);if(_0x528790[_0x371fb7(0xdf)]===0x0)return[];const _0x3b7e20=[_0x1094ba?.['indexName'],_0x1094ba?.['index_name'],_0x1094ba?.[_0x371fb7(0x10b)]][_0x371fb7(0xe1)](_0x404a7a=>typeof _0x404a7a===_0x371fb7(0x101)&&_0x404a7a['trim']()),_0x6c7d89=[_0x1094ba?.[_0x371fb7(0xdb)],_0x1094ba?.[_0x371fb7(0xec)]][_0x371fb7(0xe1)](_0x4c90c3=>typeof _0x4c90c3===_0x371fb7(0x101)&&_0x4c90c3[_0x371fb7(0xd5)]());return[{..._0x3b7e20?{'name':_0x3b7e20[_0x371fb7(0xd5)]()}:{},..._0x6c7d89?{'type':_0x6c7d89[_0x371fb7(0xd5)]()}:{},'columns':_0x528790}];}),_0xf19915=[..._0xf7e5e0],_0x17a57c=typeof _0x61048c?.[_0x302c0f(0xd9)]?.[_0x302c0f(0xe6)]===_0x302c0f(0x101)?_0x61048c[_0x302c0f(0xd9)][_0x302c0f(0xe6)][_0x302c0f(0xee)](',')['map'](_0x4aa645=>_0x4aa645[_0x302c0f(0xd5)]())[_0x302c0f(0xf5)](Boolean):[];return _0x17a57c[_0x302c0f(0xdf)]>0x0&&_0xf19915[_0x302c0f(0x100)]({'type':_0x302c0f(0xd0),'columns':_0x17a57c}),{'indexes':_0xf19915,'metadataAvailable':_0xf7e5e0['length']>0x0};}
1
+ function a200_0x3d19(){const _0x5e8544=['type','dbtableConfig','7iCmqvG','tableName','schemas','find','joinAudit','primary','string','dataset','columnNames','sql','24DsiXAA','933510KLaOkU','605HScSVq','indexes','columns','Dataset\x20\x22','toLowerCase','isDangerous','\x22\x20not\x20found\x20or\x20not\x20accessible','tables','str','index_name','132200JTMvEY','get','validation','appCode','file','1326243TJWGJk','1022985zDYkzQ','read','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','Table\x20\x22','isArray','valid','9355956JLYVwv','pkField','validate','boolean','push','size','reason','split','isSelectOnly','message','utf-8','map','from','trim','index_type','--check-indexes\x20requires\x20--schemas.','sqlType','length','filter','125rhXTbX','250872myBmxi','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','name','indexName','8392JmClwB','index_columns'];a200_0x3d19=function(){return _0x5e8544;};return a200_0x3d19();}const a200_0x3c0717=a200_0x51b6;(function(_0x4c08cf,_0x57aec2){const _0x30c5c3=a200_0x51b6,_0x15cd07=_0x4c08cf();while(!![]){try{const _0x24ad33=-parseInt(_0x30c5c3(0x74))/0x1+-parseInt(_0x30c5c3(0x87))/0x2+parseInt(_0x30c5c3(0x97))/0x3+parseInt(_0x30c5c3(0x78))/0x4*(-parseInt(_0x30c5c3(0x73))/0x5)+parseInt(_0x30c5c3(0x9e))/0x6*(parseInt(_0x30c5c3(0x7c))/0x7)+-parseInt(_0x30c5c3(0x86))/0x8*(-parseInt(_0x30c5c3(0x98))/0x9)+-parseInt(_0x30c5c3(0x92))/0xa*(parseInt(_0x30c5c3(0x88))/0xb);if(_0x24ad33===_0x57aec2)break;else _0x15cd07['push'](_0x15cd07['shift']());}catch(_0x10e0da){_0x15cd07['push'](_0x15cd07['shift']());}}}(a200_0x3d19,0xce5a9));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a200_0x51b6(_0x476c9a,_0x292de6){_0x476c9a=_0x476c9a-0x64;const _0x3d197c=a200_0x3d19();let _0x51b692=_0x3d197c[_0x476c9a];return _0x51b692;}import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a200_0x3c0717(0x85),'command':a200_0x3c0717(0xa0),'description':a200_0x3c0717(0x9a),'risk':a200_0x3c0717(0x99),'flags':[{'name':a200_0x3c0717(0x96),'type':a200_0x3c0717(0x82),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a200_0x3c0717(0x85),'type':a200_0x3c0717(0x82),'description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':'schemas','type':a200_0x3c0717(0x82),'description':a200_0x3c0717(0x75)},{'name':'check-indexes','type':a200_0x3c0717(0xa1),'description':'Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'}],async 'execute'(_0x4c409c){const _0x349aa8=a200_0x3c0717,_0x5ca356=_0x4c409c[_0x349aa8(0x90)](_0x349aa8(0x96)),_0x581820=_0x4c409c['str'](_0x349aa8(0x85)),_0x1309d6=_0x4c409c[_0x349aa8(0x90)](_0x349aa8(0x7e)),_0x3a6f12=_0x4c409c['bool']('check-indexes');if(!_0x5ca356&&!_0x581820)throw CliErrors['flagMissing'](_0x349aa8(0x96),'Provide\x20--file\x20or\x20--sql');if(_0x3a6f12&&!_0x1309d6)throw CliErrors['validation'](_0x349aa8(0x6f));let _0x3001ed;if(_0x5ca356){const _0xdb281b=resolve(process['cwd'](),_0x5ca356);if(!existsSync(_0xdb281b))throw CliErrors[_0x349aa8(0x94)]('File\x20not\x20found:\x20'+_0xdb281b);_0x3001ed=readFileSync(_0xdb281b,_0x349aa8(0x6a));}else _0x3001ed=_0x581820;const _0x173ecc=validateSql(_0x3001ed),_0x1e84a={'valid':_0x173ecc[_0x349aa8(0x9d)],'sqlType':_0x173ecc['sqlType'][_0x349aa8(0x7a)],'isSelectOnly':_0x173ecc['sqlType'][_0x349aa8(0x68)],'isDangerous':_0x173ecc[_0x349aa8(0x70)][_0x349aa8(0x8d)],'tables':_0x173ecc[_0x349aa8(0x8f)],'parameters':_0x173ecc['parameters'],'message':_0x173ecc['message']};_0x173ecc[_0x349aa8(0x70)][_0x349aa8(0x66)]&&(_0x1e84a[_0x349aa8(0x66)]=_0x173ecc[_0x349aa8(0x70)]['reason']);if(_0x1309d6&&_0x173ecc['valid']){const _0x47ed64=_0x1309d6[_0x349aa8(0x67)](',')[_0x349aa8(0x6b)](_0x339572=>_0x339572[_0x349aa8(0x6d)]())[_0x349aa8(0x72)](Boolean),_0x5dcc68=[],_0x323cd8=[],_0x1653ae=filterDbTableBackedDatasets(await listDatasets(_0x4c409c[_0x349aa8(0x95)])),_0x48d0d0=new Map(_0x1653ae[_0x349aa8(0x6b)](_0x188778=>[_0x188778[_0x349aa8(0x7b)]?.[_0x349aa8(0x7d)]?.['toLowerCase'](),_0x188778]));for(const _0x87794f of _0x173ecc[_0x349aa8(0x8f)]){const _0x25b486=_0x48d0d0[_0x349aa8(0x93)](_0x87794f[_0x349aa8(0x8c)]());!_0x25b486&&_0x5dcc68['push'](_0x349aa8(0x9b)+_0x87794f+'\x22\x20not\x20found\x20in\x20any\x20dataset');}for(const _0x4e11a1 of _0x47ed64){let _0x38bf37;try{_0x38bf37=await getDatasetDetail(_0x4e11a1);}catch{_0x5dcc68[_0x349aa8(0x64)](_0x349aa8(0x8b)+_0x4e11a1+_0x349aa8(0x8e));continue;}assertDatasetIsDbTableBacked(_0x38bf37,'SQL\x20schema\x20validation');const _0x1f24ab=Array[_0x349aa8(0x9c)](_0x38bf37['fields'])?_0x38bf37['fields']:[],_0x39cdaa=new Set(_0x1f24ab['map'](_0x31e4a9=>_0x31e4a9[_0x349aa8(0x76)]?.[_0x349aa8(0x8c)]())),_0x5825a4=_0x38bf37[_0x349aa8(0x7b)]?.[_0x349aa8(0x7d)]||_0x38bf37['tableName']||_0x4e11a1;_0x1e84a['schema:'+_0x5825a4]={'code':_0x4e11a1,'tableName':_0x5825a4,'fieldCount':_0x39cdaa[_0x349aa8(0x65)],'fields':Array[_0x349aa8(0x6c)](_0x39cdaa)};if(_0x3a6f12){const _0x1a12be=normalizeDatasetIndexes(_0x38bf37);_0x323cd8[_0x349aa8(0x64)]({'tableName':_0x5825a4,..._0x1a12be});}}_0x5dcc68[_0x349aa8(0x71)]>0x0&&(_0x1e84a['schemaWarnings']=_0x5dcc68),_0x3a6f12&&(_0x1e84a[_0x349aa8(0x80)]=auditSqlJoinIndexes(_0x3001ed,_0x323cd8));}return{'ok':_0x173ecc[_0x349aa8(0x9d)],'data':_0x1e84a,'message':_0x173ecc[_0x349aa8(0x69)]};}};function normalizeDatasetIndexes(_0x497b10){const _0x25781d=a200_0x3c0717,_0x4ba835=Array['isArray'](_0x497b10?.[_0x25781d(0x83)]?.[_0x25781d(0x89)])?_0x497b10['dataset']['indexes']:Array['isArray'](_0x497b10?.[_0x25781d(0x89)])?_0x497b10[_0x25781d(0x89)]:[],_0x38f1d9=_0x4ba835['flatMap'](_0x3486c2=>{const _0x4a3946=_0x25781d,_0x12f32d=Array['isArray'](_0x3486c2?.[_0x4a3946(0x79)])?_0x3486c2[_0x4a3946(0x79)]:Array['isArray'](_0x3486c2?.[_0x4a3946(0x84)])?_0x3486c2[_0x4a3946(0x84)]:Array[_0x4a3946(0x9c)](_0x3486c2?.[_0x4a3946(0x8a)])?_0x3486c2[_0x4a3946(0x8a)]:[],_0x42e06c=_0x12f32d[_0x4a3946(0x72)](_0x446f1c=>typeof _0x446f1c===_0x4a3946(0x82))['map'](_0x2d135a=>_0x2d135a[_0x4a3946(0x6d)]())[_0x4a3946(0x72)](Boolean);if(_0x42e06c[_0x4a3946(0x71)]===0x0)return[];const _0x56beae=[_0x3486c2?.[_0x4a3946(0x77)],_0x3486c2?.[_0x4a3946(0x91)],_0x3486c2?.[_0x4a3946(0x76)]][_0x4a3946(0x7f)](_0x5d611b=>typeof _0x5d611b==='string'&&_0x5d611b[_0x4a3946(0x6d)]()),_0x11daed=[_0x3486c2?.[_0x4a3946(0x6e)],_0x3486c2?.[_0x4a3946(0x7a)]][_0x4a3946(0x7f)](_0x350fac=>typeof _0x350fac===_0x4a3946(0x82)&&_0x350fac[_0x4a3946(0x6d)]());return[{..._0x56beae?{'name':_0x56beae['trim']()}:{},..._0x11daed?{'type':_0x11daed['trim']()}:{},'columns':_0x42e06c}];}),_0x551705=[..._0x38f1d9],_0xbb38ac=typeof _0x497b10?.[_0x25781d(0x7b)]?.[_0x25781d(0x9f)]==='string'?_0x497b10['dbtableConfig'][_0x25781d(0x9f)][_0x25781d(0x67)](',')[_0x25781d(0x6b)](_0x5d93ad=>_0x5d93ad[_0x25781d(0x6d)]())[_0x25781d(0x72)](Boolean):[];return _0xbb38ac[_0x25781d(0x71)]>0x0&&_0x551705['unshift']({'type':_0x25781d(0x81),'columns':_0xbb38ac}),{'indexes':_0x551705,'metadataAvailable':_0x38f1d9[_0x25781d(0x71)]>0x0};}
@@ -1 +1 @@
1
- function a196_0x12aa(){const _0x5e2e18=['1648240eERGbI','9xoEdvY','7900ZmxKAx','17iCjLjC','449885rKcZmo','6jGaZMe','10175869JORHhG','45928ZFmkmS','747WUXVfO','12filJlG','3229219uvCKNI','389096ckcCOt'];a196_0x12aa=function(){return _0x5e2e18;};return a196_0x12aa();}(function(_0x140926,_0x37bd85){const _0x49f4d1=a196_0x390d,_0x17ca91=_0x140926();while(!![]){try{const _0x5e81b1=parseInt(_0x49f4d1(0x7c))/0x1*(-parseInt(_0x49f4d1(0x80))/0x2)+parseInt(_0x49f4d1(0x81))/0x3*(parseInt(_0x49f4d1(0x7b))/0x4)+-parseInt(_0x49f4d1(0x7d))/0x5+-parseInt(_0x49f4d1(0x7e))/0x6*(parseInt(_0x49f4d1(0x77))/0x7)+parseInt(_0x49f4d1(0x78))/0x8*(-parseInt(_0x49f4d1(0x7a))/0x9)+-parseInt(_0x49f4d1(0x79))/0xa+-parseInt(_0x49f4d1(0x7f))/0xb*(-parseInt(_0x49f4d1(0x82))/0xc);if(_0x5e81b1===_0x37bd85)break;else _0x17ca91['push'](_0x17ca91['shift']());}catch(_0x8ed79d){_0x17ca91['push'](_0x17ca91['shift']());}}}(a196_0x12aa,0x3fe4f));import{taskStatus}from'../../commands/task/status.js';function a196_0x390d(_0x101174,_0xf8481e){_0x101174=_0x101174-0x77;const _0x12aa05=a196_0x12aa();let _0x390dde=_0x12aa05[_0x101174];return _0x390dde;}export const taskDefinitions=[taskStatus];
1
+ (function(_0x29549f,_0x30170d){const _0x95153b=a201_0x5c2f,_0xea169b=_0x29549f();while(!![]){try{const _0x458f3a=parseInt(_0x95153b(0x1c8))/0x1*(parseInt(_0x95153b(0x1c6))/0x2)+parseInt(_0x95153b(0x1c5))/0x3+parseInt(_0x95153b(0x1c9))/0x4+parseInt(_0x95153b(0x1ca))/0x5*(parseInt(_0x95153b(0x1cb))/0x6)+parseInt(_0x95153b(0x1cc))/0x7*(-parseInt(_0x95153b(0x1cd))/0x8)+-parseInt(_0x95153b(0x1c3))/0x9*(parseInt(_0x95153b(0x1c7))/0xa)+-parseInt(_0x95153b(0x1c4))/0xb*(parseInt(_0x95153b(0x1ce))/0xc);if(_0x458f3a===_0x30170d)break;else _0xea169b['push'](_0xea169b['shift']());}catch(_0x24d013){_0xea169b['push'](_0xea169b['shift']());}}}(a201_0x34b2,0xea793));function a201_0x5c2f(_0x77fac2,_0x22f84e){_0x77fac2=_0x77fac2-0x1c3;const _0x34b2c7=a201_0x34b2();let _0x5c2f30=_0x34b2c7[_0x77fac2];return _0x5c2f30;}import{taskStatus}from'../../commands/task/status.js';function a201_0x34b2(){const _0x2abe60=['63540rdBNVj','9TLgGzV','1265WpftsA','147669kjHuRM','6428TdNypq','1688710sbAxOf','284hcxCgv','5493192oSojsK','145bVJNoj','147642FwNuDi','8141bxYspf','9016YSKeZp'];a201_0x34b2=function(){return _0x2abe60;};return a201_0x34b2();}export const taskDefinitions=[taskStatus];
@@ -1 +1 @@
1
- const a197_0x3f54bd=a197_0x458f;(function(_0x2ef6e2,_0x3bb41e){const _0x4f3c4a=a197_0x458f,_0x3aa940=_0x2ef6e2();while(!![]){try{const _0x41f559=-parseInt(_0x4f3c4a(0x203))/0x1*(parseInt(_0x4f3c4a(0x204))/0x2)+parseInt(_0x4f3c4a(0x1fb))/0x3*(parseInt(_0x4f3c4a(0x1fe))/0x4)+parseInt(_0x4f3c4a(0x205))/0x5+parseInt(_0x4f3c4a(0x1f2))/0x6+parseInt(_0x4f3c4a(0x206))/0x7+-parseInt(_0x4f3c4a(0x1fa))/0x8+-parseInt(_0x4f3c4a(0x1f9))/0x9;if(_0x41f559===_0x3bb41e)break;else _0x3aa940['push'](_0x3aa940['shift']());}catch(_0x2e11a0){_0x3aa940['push'](_0x3aa940['shift']());}}}(a197_0x18a8,0x75bf8));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';function a197_0x458f(_0x42cd65,_0x214cd1){_0x42cd65=_0x42cd65-0x1f0;const _0x18a814=a197_0x18a8();let _0x458f14=_0x18a814[_0x42cd65];return _0x458f14;}import{getAsyncTaskStatus}from'../../core/api-client.js';function a197_0x18a8(){const _0xf938fc=['2716398OmKjPt','3342208JxXlcE','141UcjCMW','isTerminal','task-id','33716aIWuWt','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','read','cookie','status','1sPaApc','1786662ENOspd','163695vnkKaZ','5742828xWMxJj','taskId','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','5075514Otqyat','str','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','task','appCode','trim','flagMissing'];a197_0x18a8=function(){return _0xf938fc;};return a197_0x18a8();}import{CliErrors}from'../../errors.js';export const taskStatus={'service':a197_0x3f54bd(0x1f5),'command':a197_0x3f54bd(0x202),'description':a197_0x3f54bd(0x1f4),'risk':a197_0x3f54bd(0x200),'defaultOutputFormat':'compress','structuredErrors':!![],'flags':[{'name':a197_0x3f54bd(0x1fd),'type':'string','required':!![],'description':a197_0x3f54bd(0x1ff)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x3e73e6){const _0x4283d0=a197_0x3f54bd;if(!_0x3e73e6[_0x4283d0(0x1f3)](_0x4283d0(0x1fd))[_0x4283d0(0x1f7)]())throw CliErrors[_0x4283d0(0x1f8)](_0x4283d0(0x1fd));},async 'execute'(_0x57788c){const _0x418664=a197_0x3f54bd,_0x9a4a=_0x57788c[_0x418664(0x1f3)](_0x418664(0x1fd))[_0x418664(0x1f7)](),_0x1dd6c8=normalizeAsyncTask(await getAsyncTaskStatus(_0x9a4a,_0x57788c[_0x418664(0x1f6)],_0x57788c[_0x418664(0x201)]));if(_0x1dd6c8['taskId']!==_0x9a4a)throw CliErrors['apiError'](_0x418664(0x1f1)+_0x9a4a+',\x20received\x20'+_0x1dd6c8[_0x418664(0x1f0)]+'.');const _0x1345c0=buildAsyncTaskStatusCommand(_0x1dd6c8['taskId'],_0x57788c['appCode']);return{'ok':!![],'message':asyncTaskMessage(_0x1dd6c8),'data':{'appCode':_0x57788c[_0x418664(0x1f6)],..._0x1dd6c8,'query':_0x1dd6c8[_0x418664(0x1fc)]?null:{'command':_0x1345c0}}};}};
1
+ const a202_0xce6005=a202_0x58f3;(function(_0xd772b3,_0x481c61){const _0x26b448=a202_0x58f3,_0x165555=_0xd772b3();while(!![]){try{const _0x48c5e6=-parseInt(_0x26b448(0xa3))/0x1+-parseInt(_0x26b448(0x94))/0x2+parseInt(_0x26b448(0x8b))/0x3+parseInt(_0x26b448(0x9d))/0x4+-parseInt(_0x26b448(0x90))/0x5*(-parseInt(_0x26b448(0x9b))/0x6)+-parseInt(_0x26b448(0x9c))/0x7*(-parseInt(_0x26b448(0x99))/0x8)+parseInt(_0x26b448(0xa2))/0x9*(-parseInt(_0x26b448(0x9e))/0xa);if(_0x48c5e6===_0x481c61)break;else _0x165555['push'](_0x165555['shift']());}catch(_0x53fa78){_0x165555['push'](_0x165555['shift']());}}}(a202_0x14b2,0x886ea));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';function a202_0x58f3(_0x5e0fc2,_0x3f7679){_0x5e0fc2=_0x5e0fc2-0x8a;const _0x14b2bd=a202_0x14b2();let _0x58f3f1=_0x14b2bd[_0x5e0fc2];return _0x58f3f1;}function a202_0x14b2(){const _0x56a563=['compress','204Mhtfvp','3096989DRTwGE','580416NyYXCt','10qJBGBz','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','taskId','appCode','6093963OEYfYT','965988LOyJCD','trim','2425608fNZycj','string',',\x20received\x20','status','str','62360NJqQTT','read','apiError','flagMissing','121242ghuamW','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','task-id','task','cookie','16IkLJce'];a202_0x14b2=function(){return _0x56a563;};return a202_0x14b2();}import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const taskStatus={'service':a202_0xce6005(0x97),'command':a202_0xce6005(0x8e),'description':a202_0xce6005(0x95),'risk':a202_0xce6005(0x91),'defaultOutputFormat':a202_0xce6005(0x9a),'structuredErrors':!![],'flags':[{'name':a202_0xce6005(0x96),'type':a202_0xce6005(0x8c),'required':!![],'description':a202_0xce6005(0x9f)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x17bbaf){const _0x329a34=a202_0xce6005;if(!_0x17bbaf[_0x329a34(0x8f)](_0x329a34(0x96))[_0x329a34(0x8a)]())throw CliErrors[_0x329a34(0x93)](_0x329a34(0x96));},async 'execute'(_0x3b03a2){const _0x100a01=a202_0xce6005,_0x4f139a=_0x3b03a2[_0x100a01(0x8f)](_0x100a01(0x96))[_0x100a01(0x8a)](),_0x3737ec=normalizeAsyncTask(await getAsyncTaskStatus(_0x4f139a,_0x3b03a2[_0x100a01(0xa1)],_0x3b03a2[_0x100a01(0x98)]));if(_0x3737ec[_0x100a01(0xa0)]!==_0x4f139a)throw CliErrors[_0x100a01(0x92)]('Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20'+_0x4f139a+_0x100a01(0x8d)+_0x3737ec[_0x100a01(0xa0)]+'.');const _0x5c5929=buildAsyncTaskStatusCommand(_0x3737ec[_0x100a01(0xa0)],_0x3b03a2['appCode']);return{'ok':!![],'message':asyncTaskMessage(_0x3737ec),'data':{'appCode':_0x3b03a2[_0x100a01(0xa1)],..._0x3737ec,'query':_0x3737ec['isTerminal']?null:{'command':_0x5c5929}}};}};
@@ -1 +1 @@
1
- (function(_0x7d415f,_0xb5e466){const _0x40285b=a198_0x5151,_0x1ef74d=_0x7d415f();while(!![]){try{const _0x6805d9=parseInt(_0x40285b(0x110))/0x1*(parseInt(_0x40285b(0x10e))/0x2)+parseInt(_0x40285b(0x114))/0x3*(-parseInt(_0x40285b(0x113))/0x4)+parseInt(_0x40285b(0x10d))/0x5+parseInt(_0x40285b(0x10f))/0x6+parseInt(_0x40285b(0x10c))/0x7+parseInt(_0x40285b(0x116))/0x8*(parseInt(_0x40285b(0x115))/0x9)+-parseInt(_0x40285b(0x112))/0xa*(parseInt(_0x40285b(0x111))/0xb);if(_0x6805d9===_0xb5e466)break;else _0x1ef74d['push'](_0x1ef74d['shift']());}catch(_0x5d55f4){_0x1ef74d['push'](_0x1ef74d['shift']());}}}(a198_0x2a66,0xe5ca8));function a198_0x5151(_0x4e27b8,_0x49731b){_0x4e27b8=_0x4e27b8-0x10c;const _0x2a66ec=a198_0x2a66();let _0x5151cc=_0x2a66ec[_0x4e27b8];return _0x5151cc;}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];function a198_0x2a66(){const _0x3bfe4a=['3431029qNsJqM','8898945oJxTJD','6IYlEJh','1175220PjozBe','216431LDmWRa','99ppoJDR','2175230ekxjHQ','28hgOXcm','182319frCmni','22689GKIYig','664QxiYNu'];a198_0x2a66=function(){return _0x3bfe4a;};return a198_0x2a66();}
1
+ (function(_0x27b187,_0x2db1ad){const _0x2160fa=a203_0x2b09,_0x531892=_0x27b187();while(!![]){try{const _0x4ec71d=-parseInt(_0x2160fa(0x19d))/0x1+parseInt(_0x2160fa(0x19e))/0x2*(-parseInt(_0x2160fa(0x199))/0x3)+-parseInt(_0x2160fa(0x198))/0x4*(-parseInt(_0x2160fa(0x19a))/0x5)+parseInt(_0x2160fa(0x195))/0x6*(-parseInt(_0x2160fa(0x19c))/0x7)+parseInt(_0x2160fa(0x19b))/0x8*(-parseInt(_0x2160fa(0x19f))/0x9)+parseInt(_0x2160fa(0x196))/0xa+parseInt(_0x2160fa(0x197))/0xb*(parseInt(_0x2160fa(0x194))/0xc);if(_0x4ec71d===_0x2db1ad)break;else _0x531892['push'](_0x531892['shift']());}catch(_0x34f5b1){_0x531892['push'](_0x531892['shift']());}}}(a203_0x5887,0xd3ca0));function a203_0x2b09(_0x183e6b,_0x3debdc){_0x183e6b=_0x183e6b-0x194;const _0x5887b8=a203_0x5887();let _0x2b09c8=_0x5887b8[_0x183e6b];return _0x2b09c8;}function a203_0x5887(){const _0x3cf437=['276iMNZKE','60ukdyah','5526720fQBQij','1320275UlYUlJ','4GWgakC','30uRCnNT','5501890DznjHi','8QCHbyO','1152571cYXqAi','919430FbJLGh','63338MruGVO','5971383HLkJAH'];a203_0x5887=function(){return _0x3cf437;};return a203_0x5887();}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];