@lovrabet/rabetbase-cli 2.3.1-beta.2 → 2.3.2-beta.1

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 (218) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/fetch-model-list.js +1 -1
  3. package/lib/api/generate-api-file.js +1 -1
  4. package/lib/auth/auth-server-ui.js +1 -1
  5. package/lib/auth/auth-server.js +1 -1
  6. package/lib/auth/constant.js +1 -1
  7. package/lib/auth/get-cookie.js +1 -1
  8. package/lib/auth/get-session-user.js +1 -1
  9. package/lib/auth/is-session-valid.js +1 -1
  10. package/lib/auth/login-success-html.js +1 -1
  11. package/lib/auth/logout.js +1 -1
  12. package/lib/cli-flags.js +1 -1
  13. package/lib/cli.js +1 -1
  14. package/lib/commands/api/generate.js +1 -1
  15. package/lib/commands/api/index.js +1 -1
  16. package/lib/commands/api/list.js +1 -1
  17. package/lib/commands/api/pull.js +1 -1
  18. package/lib/commands/api/shared.js +1 -1
  19. package/lib/commands/app/add.js +1 -1
  20. package/lib/commands/app/discover.js +1 -1
  21. package/lib/commands/app/index.js +1 -1
  22. package/lib/commands/app/list.js +1 -1
  23. package/lib/commands/app/remove.js +1 -1
  24. package/lib/commands/app/shared.js +1 -1
  25. package/lib/commands/app/use.js +1 -1
  26. package/lib/commands/app-config/delete.js +1 -1
  27. package/lib/commands/app-config/get.js +1 -1
  28. package/lib/commands/app-config/index.js +1 -1
  29. package/lib/commands/app-config/list.js +1 -1
  30. package/lib/commands/app-config/set.js +1 -1
  31. package/lib/commands/app-config/shared.js +1 -1
  32. package/lib/commands/auth/index.js +1 -1
  33. package/lib/commands/bff/create.js +1 -1
  34. package/lib/commands/bff/delete.js +1 -1
  35. package/lib/commands/bff/detail.js +1 -1
  36. package/lib/commands/bff/index.js +1 -1
  37. package/lib/commands/bff/list.js +1 -1
  38. package/lib/commands/bff/pull.js +1 -1
  39. package/lib/commands/bff/push.js +1 -1
  40. package/lib/commands/bff/status.js +1 -1
  41. package/lib/commands/cli-skill/index.js +1 -1
  42. package/lib/commands/cli-update.js +1 -1
  43. package/lib/commands/codegen/index.js +1 -1
  44. package/lib/commands/codegen/sdk.js +1 -1
  45. package/lib/commands/codegen/sql.js +1 -1
  46. package/lib/commands/common/app-selector.js +1 -1
  47. package/lib/commands/common/flags.js +1 -1
  48. package/lib/commands/common/validate.js +1 -1
  49. package/lib/commands/config/get.js +1 -1
  50. package/lib/commands/config/index.js +1 -1
  51. package/lib/commands/config/list.js +1 -1
  52. package/lib/commands/config/set.js +1 -1
  53. package/lib/commands/config/shared.js +1 -1
  54. package/lib/commands/data/filter.js +1 -1
  55. package/lib/commands/data/getOne.js +1 -1
  56. package/lib/commands/data/index.js +1 -1
  57. package/lib/commands/data/shared.js +1 -1
  58. package/lib/commands/dataset/business-group-update.js +1 -1
  59. package/lib/commands/dataset/capability.js +1 -1
  60. package/lib/commands/dataset/delete.js +1 -1
  61. package/lib/commands/dataset/detail.js +1 -1
  62. package/lib/commands/dataset/extend-update.js +1 -1
  63. package/lib/commands/dataset/field-update.js +1 -1
  64. package/lib/commands/dataset/index.js +1 -1
  65. package/lib/commands/dataset/list.js +1 -1
  66. package/lib/commands/dataset/operations.js +1 -1
  67. package/lib/commands/dataset/relation-audit.js +1 -0
  68. package/lib/commands/dataset/relation-create.js +1 -1
  69. package/lib/commands/dataset/relation-delete.js +1 -1
  70. package/lib/commands/dataset/relation-shared.js +1 -1
  71. package/lib/commands/dataset/relation-update.js +1 -1
  72. package/lib/commands/dataset/relations.js +1 -1
  73. package/lib/commands/dataset/rename.js +1 -1
  74. package/lib/commands/dataset/restore.js +1 -1
  75. package/lib/commands/db/analyze-cancel.js +1 -1
  76. package/lib/commands/db/analyze-start.js +1 -1
  77. package/lib/commands/db/analyze-status.js +1 -1
  78. package/lib/commands/db/create.js +1 -1
  79. package/lib/commands/db/delete.js +1 -1
  80. package/lib/commands/db/detail.js +1 -1
  81. package/lib/commands/db/diff.js +1 -1
  82. package/lib/commands/db/index.js +1 -1
  83. package/lib/commands/db/list.js +1 -1
  84. package/lib/commands/db/shared.js +1 -1
  85. package/lib/commands/db/tables.js +1 -1
  86. package/lib/commands/db/test.js +1 -1
  87. package/lib/commands/db/update.js +1 -1
  88. package/lib/commands/doctor.js +1 -1
  89. package/lib/commands/init/index.js +1 -1
  90. package/lib/commands/issue/index.js +1 -1
  91. package/lib/commands/issue/nudge.js +1 -1
  92. package/lib/commands/issue/report.js +1 -1
  93. package/lib/commands/issue/shared.js +1 -1
  94. package/lib/commands/logs/index.js +1 -1
  95. package/lib/commands/menu/index.js +1 -1
  96. package/lib/commands/menu/list.js +1 -1
  97. package/lib/commands/menu/shared/compare-table.js +1 -1
  98. package/lib/commands/menu/shared/index.js +1 -1
  99. package/lib/commands/menu/shared/inquirer.js +1 -1
  100. package/lib/commands/menu/shared/local-pages.js +1 -1
  101. package/lib/commands/menu/shared/logic.js +1 -1
  102. package/lib/commands/menu/shared/service.js +1 -1
  103. package/lib/commands/menu/shared/sync-core.js +1 -1
  104. package/lib/commands/menu/shared/update-core.js +1 -1
  105. package/lib/commands/menu/shared/valid-url.js +1 -1
  106. package/lib/commands/menu/sync.js +1 -1
  107. package/lib/commands/menu/update.js +1 -1
  108. package/lib/commands/page/generate-start.js +1 -1
  109. package/lib/commands/page/generate-status.js +1 -1
  110. package/lib/commands/page/index.js +1 -1
  111. package/lib/commands/page/pull.js +1 -1
  112. package/lib/commands/page/push.js +1 -1
  113. package/lib/commands/page/relation-audit.js +1 -1
  114. package/lib/commands/page/shared.js +1 -1
  115. package/lib/commands/page/standard-page-status.js +1 -1
  116. package/lib/commands/page/sync.js +1 -1
  117. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  118. package/lib/commands/project/create/format-elapsed.js +1 -1
  119. package/lib/commands/project/create/main.js +1 -1
  120. package/lib/commands/project/create/non-interactive.js +1 -1
  121. package/lib/commands/project/create/project-template-path.js +1 -1
  122. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  123. package/lib/commands/project/create/use-format-code.js +1 -1
  124. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  125. package/lib/commands/project/index.js +1 -1
  126. package/lib/commands/project/init.js +1 -1
  127. package/lib/commands/project/upgrade.js +1 -1
  128. package/lib/commands/registry.js +1 -1
  129. package/lib/commands/run/index.js +1 -1
  130. package/lib/commands/schema.js +1 -1
  131. package/lib/commands/sql/create.js +1 -1
  132. package/lib/commands/sql/delete.js +1 -1
  133. package/lib/commands/sql/detail.js +1 -1
  134. package/lib/commands/sql/exec.js +1 -1
  135. package/lib/commands/sql/index.js +1 -1
  136. package/lib/commands/sql/list.js +1 -1
  137. package/lib/commands/sql/pull.js +1 -1
  138. package/lib/commands/sql/push.js +1 -1
  139. package/lib/commands/sql/save.js +1 -1
  140. package/lib/commands/sql/shared.js +1 -1
  141. package/lib/commands/sql/status.js +1 -1
  142. package/lib/commands/sql/validate.js +1 -1
  143. package/lib/commands/workspace/index.js +1 -1
  144. package/lib/config/schema.js +1 -1
  145. package/lib/constant/cdn.js +1 -1
  146. package/lib/constant/cli.js +1 -1
  147. package/lib/constant/defaults.js +1 -1
  148. package/lib/constant/domain.js +1 -1
  149. package/lib/constant/env.js +1 -1
  150. package/lib/constant/output.js +1 -1
  151. package/lib/constant/paths.js +1 -1
  152. package/lib/constant/risk.js +1 -1
  153. package/lib/context/app-resolver.js +1 -1
  154. package/lib/context/auth-resolver.js +1 -1
  155. package/lib/context/config-loader.js +1 -1
  156. package/lib/context.js +1 -1
  157. package/lib/core/alias-resolver.js +1 -1
  158. package/lib/core/api-client.js +1 -1
  159. package/lib/core/bff/config.js +1 -1
  160. package/lib/core/bff/file-system.js +1 -1
  161. package/lib/core/bff/hash.js +1 -1
  162. package/lib/core/bff/lock.js +1 -1
  163. package/lib/core/bff/utils.js +1 -1
  164. package/lib/core/db-resolver.js +1 -1
  165. package/lib/core/page/file-system.js +1 -1
  166. package/lib/core/page/hash.js +1 -1
  167. package/lib/core/page/lock.js +1 -1
  168. package/lib/core/sql-sync/config.js +1 -1
  169. package/lib/core/sql-sync/file-system.js +1 -1
  170. package/lib/core/sql-sync/hash.js +1 -1
  171. package/lib/core/sql-sync/lock.js +1 -1
  172. package/lib/core/sql-sync/utils.js +1 -1
  173. package/lib/core/sql-validator.js +1 -1
  174. package/lib/errors.js +1 -1
  175. package/lib/framework/build-all-flags.js +1 -1
  176. package/lib/framework/flags.js +1 -1
  177. package/lib/framework/help.js +1 -1
  178. package/lib/framework/index.js +1 -1
  179. package/lib/framework/output.js +1 -1
  180. package/lib/framework/response.js +1 -1
  181. package/lib/framework/runner-alias.js +1 -1
  182. package/lib/framework/runner.js +1 -1
  183. package/lib/framework/schema-export.js +1 -1
  184. package/lib/framework/types.js +1 -1
  185. package/lib/generated/build-info.js +1 -1
  186. package/lib/help.js +1 -1
  187. package/lib/skills/main.js +1 -1
  188. package/lib/skills/npx-skills-add.js +1 -1
  189. package/lib/telemetry/cli-command-trace.js +1 -1
  190. package/lib/telemetry/cli-help-trace.js +1 -1
  191. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  192. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  193. package/lib/telemetry/send-cli-trace-log.js +1 -1
  194. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  195. package/lib/utils/ai_config.js +1 -1
  196. package/lib/utils/apply-jq-filter.js +1 -1
  197. package/lib/utils/cdn-config.js +1 -1
  198. package/lib/utils/check-sdk-version.js +1 -1
  199. package/lib/utils/cli-version-check.js +1 -1
  200. package/lib/utils/cli-version-policy.js +1 -1
  201. package/lib/utils/config.js +1 -1
  202. package/lib/utils/copy-directory.js +1 -1
  203. package/lib/utils/entity-with-id.js +1 -1
  204. package/lib/utils/file-utils.js +1 -1
  205. package/lib/utils/guides-cdn.js +1 -1
  206. package/lib/utils/http-client.js +1 -1
  207. package/lib/utils/is-non-interactive.js +1 -1
  208. package/lib/utils/logger.js +1 -1
  209. package/lib/utils/params.js +1 -1
  210. package/lib/utils/platform.js +1 -1
  211. package/lib/utils/rules-cdn.js +1 -1
  212. package/lib/utils/sleep.js +1 -1
  213. package/lib/utils/template-replacer.js +1 -1
  214. package/lib/utils/update-notice.js +1 -1
  215. package/lib/utils/version.js +1 -1
  216. package/lib/utils/with-active-cookie.js +1 -1
  217. package/lib/utils/write-cli-side-channel.js +1 -1
  218. package/package.json +1 -1
@@ -1 +1 @@
1
- const a127_0x3de416=a127_0x3e41;(function(_0x2384bc,_0x595332){const _0x40809c=a127_0x3e41,_0x16f661=_0x2384bc();while(!![]){try{const _0x50c94a=parseInt(_0x40809c(0x1eb))/0x1*(-parseInt(_0x40809c(0x214))/0x2)+-parseInt(_0x40809c(0x20e))/0x3*(parseInt(_0x40809c(0x1e7))/0x4)+parseInt(_0x40809c(0x1dc))/0x5+-parseInt(_0x40809c(0x200))/0x6+parseInt(_0x40809c(0x20b))/0x7+-parseInt(_0x40809c(0x205))/0x8*(-parseInt(_0x40809c(0x1ff))/0x9)+-parseInt(_0x40809c(0x1f0))/0xa*(-parseInt(_0x40809c(0x1f9))/0xb);if(_0x50c94a===_0x595332)break;else _0x16f661['push'](_0x16f661['shift']());}catch(_0x21140b){_0x16f661['push'](_0x16f661['shift']());}}}(a127_0x96ab,0xde06a));import{apiDefinitions}from'../commands/api/index.js';import{bffDefinitions}from'../commands/bff/index.js';function a127_0x3e41(_0x3dead1,_0x1df3b6){_0x3dead1=_0x3dead1-0x1d5;const _0x96ab2a=a127_0x96ab();let _0x3e4185=_0x96ab2a[_0x3dead1];return _0x3e4185;}import{sqlDefinitions}from'../commands/sql/index.js';import{datasetDefinitions}from'../commands/dataset/index.js';import{pageDefinitions}from'../commands/page/index.js';import{dataDefinitions}from'../commands/data/index.js';import{dbDefinitions}from'../commands/db/index.js';import{codegenDefinitions}from'../commands/codegen/index.js';import{menuDefinitions}from'../commands/menu/index.js';import{appDefinitions}from'../commands/app/index.js';import{appConfigDefinitions}from'../commands/app-config/index.js';import{workspaceDefinitions}from'../commands/workspace/index.js';import{configDefinitions}from'../commands/config/index.js';import{doctorDefinition}from'../commands/doctor.js';import{updateDefinition}from'../commands/cli-update.js';import{schemaDefinition}from'../commands/schema.js';import{issueDefinitions}from'../commands/issue/index.js';import{cliSkillDefinitions}from'../commands/cli-skill/index.js';import{authDefinitions}from'../commands/auth/index.js';import{logsDefinitions}from'../commands/logs/index.js';import{projectDefinitions}from'../commands/project/index.js';import{initDefinitions}from'../commands/init/index.js';import{runDefinition}from'../commands/run/index.js';export const serviceRegistry=[];const serviceByName=new Map();export const definitions=new Map();export const serviceGroups=new Map();function registerDefinitions(_0x159d26){const _0x11809f=a127_0x3e41;for(const _0xb457b4 of _0x159d26){definitions['set'](_0xb457b4['service']+':'+_0xb457b4[_0x11809f(0x1f2)],_0xb457b4);let _0x5009cf=serviceGroups[_0x11809f(0x212)](_0xb457b4[_0x11809f(0x1ef)]);!_0x5009cf&&(_0x5009cf=[],serviceGroups[_0x11809f(0x20a)](_0xb457b4['service'],_0x5009cf)),_0x5009cf[_0x11809f(0x20c)](_0xb457b4);}}function registerDeclarativeService(_0x212623,_0x1ccab7,_0x3719a7){const _0x31279f=a127_0x3e41;registerDefinitions(_0x1ccab7);_0x3719a7?.['wildcardDef']&&registerDefinitions([_0x3719a7['wildcardDef']]);const _0x55e924=_0x22b9ba=>_0x22b9ba===_0x31279f(0x1fc)?'':_0x22b9ba===_0x31279f(0x1fb)?_0x31279f(0x209):_0x31279f(0x1fa),_0x5b052d={'service':_0x1ccab7[0x0]['service'],'label':_0x212623,'commands':_0x1ccab7[_0x31279f(0x201)](_0x224468=>({'command':_0x224468[_0x31279f(0x1f2)],'description':_0x224468[_0x31279f(0x1e5)],'tag':_0x55e924(_0x224468[_0x31279f(0x203)])})),'declarative':!![],'defaultCommand':_0x3719a7?.[_0x31279f(0x1fe)]??(_0x3719a7?.[_0x31279f(0x202)]?_0x1ccab7[0x0][_0x31279f(0x1f2)]:undefined),'wildcardDef':_0x3719a7?.['wildcardDef'],'isSingleCommand':_0x3719a7?.[_0x31279f(0x202)]};serviceRegistry[_0x31279f(0x20c)](_0x5b052d),serviceByName['set'](_0x5b052d['service'],_0x5b052d);}registerDeclarativeService(a127_0x3de416(0x1dd),initDefinitions,{'defaultCommand':a127_0x3de416(0x1fd),'isSingleCommand':!![]}),registerDeclarativeService(a127_0x3de416(0x1f7),projectDefinitions),registerDeclarativeService(a127_0x3de416(0x20d),workspaceDefinitions),registerDeclarativeService(a127_0x3de416(0x1f5),appDefinitions),registerDeclarativeService(a127_0x3de416(0x1d5),[runDefinition],{'wildcardDef':runDefinition});{const last=serviceRegistry[serviceRegistry[a127_0x3de416(0x207)]-0x1];last[a127_0x3de416(0x1da)]=[{'command':a127_0x3de416(0x1ed),'description':'Run\x20any\x20package.json\x20script','tag':''}];}registerDeclarativeService('Authentication',authDefinitions,{'defaultCommand':a127_0x3de416(0x1f4)}),registerDeclarativeService(a127_0x3de416(0x1e0),[updateDefinition],{'isSingleCommand':!![]}),registerDeclarativeService(a127_0x3de416(0x215),[doctorDefinition],{'isSingleCommand':!![]}),registerDeclarativeService(a127_0x3de416(0x1f3),[schemaDefinition],{'isSingleCommand':!![]}),registerDeclarativeService('Configuration',configDefinitions),registerDeclarativeService(a127_0x3de416(0x1df),appConfigDefinitions),registerDeclarativeService('Platform\x20Issue',issueDefinitions),registerDeclarativeService(a127_0x3de416(0x1d7),apiDefinitions),registerDeclarativeService(a127_0x3de416(0x204),menuDefinitions),registerDeclarativeService('Database\x20Connections',dbDefinitions),registerDeclarativeService('Dataset\x20&\x20Operations',datasetDefinitions),registerDeclarativeService(a127_0x3de416(0x1d6),pageDefinitions),registerDeclarativeService(a127_0x3de416(0x1e4),dataDefinitions),registerDeclarativeService('BFF\x20Scripts',bffDefinitions),registerDeclarativeService(a127_0x3de416(0x1ec),sqlDefinitions),registerDeclarativeService(a127_0x3de416(0x210),codegenDefinitions),registerDeclarativeService(a127_0x3de416(0x1db),cliSkillDefinitions,{'defaultCommand':a127_0x3de416(0x1e1)}),registerDeclarativeService(a127_0x3de416(0x1f1),logsDefinitions,{'defaultCommand':a127_0x3de416(0x1ee)});function a127_0x96ab(){const _0x188dd1=['Code\x20Generation','auth','get','`rabetbase\x20skills`\x20has\x20been\x20removed.','2MyjHKW','Diagnostics','Run\x20Scripts','Smart\x20List\x20Pages','API','has','wildcardDef','commands','CLI\x20Built-in\x20Skill','1661710CCKGXB','Quick\x20Start','`\x20has\x20been\x20removed.','Remote\x20App\x20Config','Self\x20Update','install','start','preview','Instant\x20API','description','skill','1796bVcYte','create','`rabetbase\x20','values','176346AogSHB','SQL\x20Queries','<script>','show','service','10OvLdwf','Logs','command','Schema','login','App\x20Management','skills','Project','from','1307394uupCVH','\x20\x20[high-risk-write]','write','read','run','defaultCommand','1269nusPrg','2344134dreYfZ','map','isSingleCommand','risk','Menu','32FHojDh','skill\x20','length','Use\x20`rabetbase\x20cli-skill\x20install`\x20to\x20refresh\x20the\x20Rabetbase\x20CLI\x20Built-in\x20Skill.\x20To\x20install\x20business\x20Skills,\x20use\x20`lovrabet\x20skill\x20install`.','\x20\x20[write]','set','7273427iebCyb','push','Workspace','96QUycTa','build'];a127_0x96ab=function(){return _0x188dd1;};return a127_0x96ab();}export const deprecatedAliases={'create':{'service':'project','command':'create'},'start':{'service':a127_0x3de416(0x1fd),'command':a127_0x3de416(0x1e2)},'build':{'service':a127_0x3de416(0x1fd),'command':a127_0x3de416(0x20f)},'preview':{'service':'run','command':a127_0x3de416(0x1e3)},'logout':{'service':a127_0x3de416(0x211),'command':'logout'}};const CLI_SKILL_INSTALL_REMOVED_HINT=a127_0x3de416(0x208);export function resolveRemovedCommand(_0x57de09,_0x412a0f){const _0xa3996e=a127_0x3de416;if(_0x57de09===_0xa3996e(0x1e6)){const _0x5b790c=_0x412a0f?_0xa3996e(0x206)+_0x412a0f:_0xa3996e(0x1e6);return{'command':_0x5b790c,'message':_0xa3996e(0x1e9)+_0x5b790c+_0xa3996e(0x1de),'hint':CLI_SKILL_INSTALL_REMOVED_HINT};}if(_0x57de09==='skills')return{'command':_0xa3996e(0x1f6),'message':_0xa3996e(0x213),'hint':CLI_SKILL_INSTALL_REMOVED_HINT};return undefined;}export const deprecatedSubcommands={'bff':{'new':a127_0x3de416(0x1e8)},'sql':{'new':a127_0x3de416(0x1e8)}};export function resolveDeprecatedSubcommand(_0x15bcf6,_0x7c627f){return deprecatedSubcommands[_0x15bcf6]?.[_0x7c627f];}export function findDefinition(_0x5e0af3,_0x4a0c69){const _0x287149=a127_0x3de416;return definitions[_0x287149(0x212)](_0x5e0af3+':'+_0x4a0c69);}export function isKnownService(_0x35b0eb){return serviceByName['has'](_0x35b0eb);}export function isDeclarativeService(_0x74dcb3){const _0xa76be7=a127_0x3de416;return serviceGroups[_0xa76be7(0x1d8)](_0x74dcb3)||serviceByName[_0xa76be7(0x212)](_0x74dcb3)?.[_0xa76be7(0x1d9)]!==undefined;}export function getServiceEntry(_0x4db9fd){return serviceByName['get'](_0x4db9fd);}export function getLegacyHandler(_0x466d07,_0x5351af){return undefined;}export function getAllDefinitions(){const _0x39320b=a127_0x3de416;return Array[_0x39320b(0x1f8)](definitions[_0x39320b(0x1ea)]());}
1
+ const a128_0x5c6a9f=a128_0x250a;(function(_0x365fce,_0x21893b){const _0x26e01d=a128_0x250a,_0x35d5d3=_0x365fce();while(!![]){try{const _0xb2d14e=-parseInt(_0x26e01d(0x106))/0x1*(parseInt(_0x26e01d(0xf5))/0x2)+-parseInt(_0x26e01d(0xd1))/0x3*(-parseInt(_0x26e01d(0x108))/0x4)+parseInt(_0x26e01d(0x102))/0x5+-parseInt(_0x26e01d(0xe3))/0x6+-parseInt(_0x26e01d(0x10e))/0x7+-parseInt(_0x26e01d(0xe5))/0x8*(-parseInt(_0x26e01d(0xfa))/0x9)+parseInt(_0x26e01d(0xef))/0xa;if(_0xb2d14e===_0x21893b)break;else _0x35d5d3['push'](_0x35d5d3['shift']());}catch(_0x187bf2){_0x35d5d3['push'](_0x35d5d3['shift']());}}}(a128_0x4d0d,0x7c260));import{apiDefinitions}from'../commands/api/index.js';import{bffDefinitions}from'../commands/bff/index.js';import{sqlDefinitions}from'../commands/sql/index.js';import{datasetDefinitions}from'../commands/dataset/index.js';import{pageDefinitions}from'../commands/page/index.js';import{dataDefinitions}from'../commands/data/index.js';import{dbDefinitions}from'../commands/db/index.js';import{codegenDefinitions}from'../commands/codegen/index.js';import{menuDefinitions}from'../commands/menu/index.js';import{appDefinitions}from'../commands/app/index.js';import{appConfigDefinitions}from'../commands/app-config/index.js';function a128_0x4d0d(){const _0x39576e=['from','12614860MAykJV','wildcardDef','start','command','CLI\x20Built-in\x20Skill','Logs','2WHqMxz','Diagnostics','install','Authentication','BFF\x20Scripts','3879msUfeK','build','`rabetbase\x20','skill','set','API','\x20\x20[write]','run','4550915blFZSv','logout','auth','length','892091cLXlXV','SQL\x20Queries','79388zHWYda','Project','has','risk','Code\x20Generation','description','7006769opUZTl','push','117uLLvox','Dataset\x20&\x20Operations','values','Use\x20`rabetbase\x20cli-skill\x20install`\x20to\x20refresh\x20the\x20Rabetbase\x20CLI\x20Built-in\x20Skill.\x20To\x20install\x20business\x20Skills,\x20use\x20`lovrabet\x20skill\x20install`.','write','Quick\x20Start','defaultCommand','project','get','service','Database\x20Connections','Remote\x20App\x20Config','`\x20has\x20been\x20removed.','isSingleCommand','create','`rabetbase\x20skills`\x20has\x20been\x20removed.','\x20\x20[high-risk-write]','commands','5139642udBRLK','login','5800VoneiN','skill\x20','Workspace','App\x20Management','skills','preview','Self\x20Update','Instant\x20API','Schema'];a128_0x4d0d=function(){return _0x39576e;};return a128_0x4d0d();}import{workspaceDefinitions}from'../commands/workspace/index.js';import{configDefinitions}from'../commands/config/index.js';import{doctorDefinition}from'../commands/doctor.js';import{updateDefinition}from'../commands/cli-update.js';import{schemaDefinition}from'../commands/schema.js';import{issueDefinitions}from'../commands/issue/index.js';import{cliSkillDefinitions}from'../commands/cli-skill/index.js';import{authDefinitions}from'../commands/auth/index.js';import{logsDefinitions}from'../commands/logs/index.js';import{projectDefinitions}from'../commands/project/index.js';import{initDefinitions}from'../commands/init/index.js';import{runDefinition}from'../commands/run/index.js';export const serviceRegistry=[];const serviceByName=new Map();export const definitions=new Map();export const serviceGroups=new Map();function registerDefinitions(_0x475d94){const _0x5ab4fd=a128_0x250a;for(const _0x1e2efe of _0x475d94){definitions[_0x5ab4fd(0xfe)](_0x1e2efe[_0x5ab4fd(0xda)]+':'+_0x1e2efe[_0x5ab4fd(0xf2)],_0x1e2efe);let _0x3a5625=serviceGroups[_0x5ab4fd(0xd9)](_0x1e2efe[_0x5ab4fd(0xda)]);!_0x3a5625&&(_0x3a5625=[],serviceGroups[_0x5ab4fd(0xfe)](_0x1e2efe[_0x5ab4fd(0xda)],_0x3a5625)),_0x3a5625['push'](_0x1e2efe);}}function registerDeclarativeService(_0x5735ac,_0x191148,_0x174c1c){const _0x35d50d=a128_0x250a;registerDefinitions(_0x191148);_0x174c1c?.[_0x35d50d(0xf0)]&&registerDefinitions([_0x174c1c[_0x35d50d(0xf0)]]);const _0x17f911=_0x4ef2f7=>_0x4ef2f7==='read'?'':_0x4ef2f7===_0x35d50d(0xd5)?_0x35d50d(0x100):_0x35d50d(0xe1),_0x1d2581={'service':_0x191148[0x0][_0x35d50d(0xda)],'label':_0x5735ac,'commands':_0x191148['map'](_0x54e648=>({'command':_0x54e648[_0x35d50d(0xf2)],'description':_0x54e648[_0x35d50d(0x10d)],'tag':_0x17f911(_0x54e648[_0x35d50d(0x10b)])})),'declarative':!![],'defaultCommand':_0x174c1c?.[_0x35d50d(0xd7)]??(_0x174c1c?.[_0x35d50d(0xde)]?_0x191148[0x0][_0x35d50d(0xf2)]:undefined),'wildcardDef':_0x174c1c?.['wildcardDef'],'isSingleCommand':_0x174c1c?.[_0x35d50d(0xde)]};serviceRegistry[_0x35d50d(0xd0)](_0x1d2581),serviceByName[_0x35d50d(0xfe)](_0x1d2581[_0x35d50d(0xda)],_0x1d2581);}function a128_0x250a(_0x1e26fe,_0xca166d){_0x1e26fe=_0x1e26fe-0xd0;const _0x4d0de9=a128_0x4d0d();let _0x250a5d=_0x4d0de9[_0x1e26fe];return _0x250a5d;}registerDeclarativeService(a128_0x5c6a9f(0xd6),initDefinitions,{'defaultCommand':a128_0x5c6a9f(0x101),'isSingleCommand':!![]}),registerDeclarativeService(a128_0x5c6a9f(0x109),projectDefinitions),registerDeclarativeService(a128_0x5c6a9f(0xe7),workspaceDefinitions),registerDeclarativeService(a128_0x5c6a9f(0xe8),appDefinitions),registerDeclarativeService('Run\x20Scripts',[runDefinition],{'wildcardDef':runDefinition});{const last=serviceRegistry[serviceRegistry[a128_0x5c6a9f(0x105)]-0x1];last[a128_0x5c6a9f(0xe2)]=[{'command':'<script>','description':'Run\x20any\x20package.json\x20script','tag':''}];}registerDeclarativeService(a128_0x5c6a9f(0xf8),authDefinitions,{'defaultCommand':a128_0x5c6a9f(0xe4)}),registerDeclarativeService(a128_0x5c6a9f(0xeb),[updateDefinition],{'isSingleCommand':!![]}),registerDeclarativeService(a128_0x5c6a9f(0xf6),[doctorDefinition],{'isSingleCommand':!![]}),registerDeclarativeService(a128_0x5c6a9f(0xed),[schemaDefinition],{'isSingleCommand':!![]}),registerDeclarativeService('Configuration',configDefinitions),registerDeclarativeService(a128_0x5c6a9f(0xdc),appConfigDefinitions),registerDeclarativeService('Platform\x20Issue',issueDefinitions),registerDeclarativeService(a128_0x5c6a9f(0xff),apiDefinitions),registerDeclarativeService('Menu',menuDefinitions),registerDeclarativeService(a128_0x5c6a9f(0xdb),dbDefinitions),registerDeclarativeService(a128_0x5c6a9f(0xd2),datasetDefinitions),registerDeclarativeService('Smart\x20List\x20Pages',pageDefinitions),registerDeclarativeService(a128_0x5c6a9f(0xec),dataDefinitions),registerDeclarativeService(a128_0x5c6a9f(0xf9),bffDefinitions),registerDeclarativeService(a128_0x5c6a9f(0x107),sqlDefinitions),registerDeclarativeService(a128_0x5c6a9f(0x10c),codegenDefinitions),registerDeclarativeService(a128_0x5c6a9f(0xf3),cliSkillDefinitions,{'defaultCommand':a128_0x5c6a9f(0xf7)}),registerDeclarativeService(a128_0x5c6a9f(0xf4),logsDefinitions,{'defaultCommand':'show'});export const deprecatedAliases={'create':{'service':a128_0x5c6a9f(0xd8),'command':a128_0x5c6a9f(0xdf)},'start':{'service':a128_0x5c6a9f(0x101),'command':a128_0x5c6a9f(0xf1)},'build':{'service':a128_0x5c6a9f(0x101),'command':a128_0x5c6a9f(0xfb)},'preview':{'service':a128_0x5c6a9f(0x101),'command':a128_0x5c6a9f(0xea)},'logout':{'service':a128_0x5c6a9f(0x104),'command':a128_0x5c6a9f(0x103)}};const CLI_SKILL_INSTALL_REMOVED_HINT=a128_0x5c6a9f(0xd4);export function resolveRemovedCommand(_0x284249,_0x570563){const _0xe6b30=a128_0x5c6a9f;if(_0x284249===_0xe6b30(0xfd)){const _0x74bb44=_0x570563?_0xe6b30(0xe6)+_0x570563:_0xe6b30(0xfd);return{'command':_0x74bb44,'message':_0xe6b30(0xfc)+_0x74bb44+_0xe6b30(0xdd),'hint':CLI_SKILL_INSTALL_REMOVED_HINT};}if(_0x284249===_0xe6b30(0xe9))return{'command':_0xe6b30(0xe9),'message':_0xe6b30(0xe0),'hint':CLI_SKILL_INSTALL_REMOVED_HINT};return undefined;}export const deprecatedSubcommands={'bff':{'new':a128_0x5c6a9f(0xdf)},'sql':{'new':a128_0x5c6a9f(0xdf)}};export function resolveDeprecatedSubcommand(_0x37f941,_0x124946){return deprecatedSubcommands[_0x37f941]?.[_0x124946];}export function findDefinition(_0x3bd97d,_0x5c81e3){return definitions['get'](_0x3bd97d+':'+_0x5c81e3);}export function isKnownService(_0x4a3f5c){const _0x4be0a8=a128_0x5c6a9f;return serviceByName[_0x4be0a8(0x10a)](_0x4a3f5c);}export function isDeclarativeService(_0x2d1fdb){const _0xc12a6=a128_0x5c6a9f;return serviceGroups[_0xc12a6(0x10a)](_0x2d1fdb)||serviceByName[_0xc12a6(0xd9)](_0x2d1fdb)?.[_0xc12a6(0xf0)]!==undefined;}export function getServiceEntry(_0x2b67d4){const _0x411ed7=a128_0x5c6a9f;return serviceByName[_0x411ed7(0xd9)](_0x2b67d4);}export function getLegacyHandler(_0x4e6668,_0x53cd08){return undefined;}export function getAllDefinitions(){const _0x104bdf=a128_0x5c6a9f;return Array[_0x104bdf(0xee)](definitions[_0x104bdf(0xd3)]());}
@@ -1 +1 @@
1
- const a128_0x233e1d=a128_0x4b31;(function(_0x5060e0,_0x184cdd){const _0x4018da=a128_0x4b31,_0x333df4=_0x5060e0();while(!![]){try{const _0x572a1d=parseInt(_0x4018da(0xec))/0x1+-parseInt(_0x4018da(0xf3))/0x2*(-parseInt(_0x4018da(0xf7))/0x3)+-parseInt(_0x4018da(0xfb))/0x4+parseInt(_0x4018da(0xf6))/0x5+parseInt(_0x4018da(0x10c))/0x6*(-parseInt(_0x4018da(0x101))/0x7)+-parseInt(_0x4018da(0xe5))/0x8+parseInt(_0x4018da(0x121))/0x9;if(_0x572a1d===_0x184cdd)break;else _0x333df4['push'](_0x333df4['shift']());}catch(_0x7df3e5){_0x333df4['push'](_0x333df4['shift']());}}}(a128_0x4aac,0x7747d));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';function a128_0x4b31(_0x36eff0,_0x40f964){_0x36eff0=_0x36eff0-0xe4;const _0x4aacb1=a128_0x4aac();let _0x4b3142=_0x4aacb1[_0x36eff0];return _0x4b3142;}import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a128_0x233e1d(0xf0),a128_0x233e1d(0x102)]);function a128_0x4aac(){const _0x2d5d2b=['read','scripts','\x20run\x20<script>\x0a','log','parse','pnpm','3346497BQouSC','preview','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','bool','\x20run\x20','6190864rYphMC','\x22\x20not\x20found\x20in\x20package.json.','bun.lockb','script','run','\x20\x20AVAILABLE\x20SCRIPTS\x20\x20(current\x20project)','max','359966MzIPpQ','padEnd','inherit','push','start','close','\x20run\x20preview','525304yXWLlX','bun.lock','Available:\x20','2966900IKCcrc','9yfOUGT','npm','pnpm-lock.yaml','map','820920LGMivr','Enable\x20watch\x20mode\x20for\x20preview','.bin','yarn','length','error','14fKzWGL','dev','No\x20scripts\x20defined\x20in\x20package.json.','cwd','validation','all','\x0a\x20\x20Available\x20scripts:\x0a','boolean','join','node_modules','needsUpgrade','1936422rPCHNC','\x20run\x20build','\x20\x20\x20\x20','vite\x20preview\x20exited\x20with\x20code\x20','yarn.lock','No\x20package.json\x20found\x20in\x20current\x20directory.','\x20run\x20preview\x20--watch\x20\x20\x20#\x20parallel\x20build\x20--watch\x20+\x20preview','build','args','keys','(none)','entries','\x0a\x20\x20Usage:\x20','watch','Script\x20name\x20defined\x20in\x20package.json'];a128_0x4aac=function(){return _0x2d5d2b;};return a128_0x4aac();}function readPackageScripts(_0x2301a1){const _0x3fd4aa=a128_0x233e1d,_0x441ce2=resolve(_0x2301a1,'package.json');if(!existsSync(_0x441ce2))return null;try{const _0x1927c2=JSON[_0x3fd4aa(0x11f)](readFileSync(_0x441ce2,'utf-8'));return _0x1927c2[_0x3fd4aa(0x11c)]??{};}catch{return null;}}function detectPackageManager(_0x22f216){const _0xf20946=a128_0x233e1d;if(existsSync(resolve(_0x22f216,_0xf20946(0xe7)))||existsSync(resolve(_0x22f216,_0xf20946(0xf4))))return'bun';if(existsSync(resolve(_0x22f216,_0xf20946(0xf9))))return _0xf20946(0x120);if(existsSync(resolve(_0x22f216,_0xf20946(0x110))))return _0xf20946(0xfe);return _0xf20946(0xf8);}async function versionCheck(_0x396135){const _0x1ad869=a128_0x233e1d,_0x588e8f=await checkCliVersion();(_0x588e8f['needsUpgrade']||_0x588e8f['belowMinimum'])&&(printCliUpgradeWarning(_0x588e8f),assertCliVersionSupported(_0x588e8f));const _0x1a8873=await checkSdkVersion(_0x396135);if(_0x1a8873[_0x1ad869(0x10b)])printSdkUpgradeWarning(_0x1a8873);}function spawnScript(_0x556652,_0x318e2c,_0x408a85,_0x48e086){return new Promise((_0x484ce0,_0x22e32a)=>{const _0x15a95e=a128_0x4b31,_0x3338c5=[_0x15a95e(0xe9),_0x318e2c,..._0x408a85],_0x2ad510=spawn(_0x556652,_0x3338c5,{'cwd':_0x48e086,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x48e086,_0x15a95e(0x10a),_0x15a95e(0xfd))+delimiter+process.env.PATH}});_0x2ad510['on'](_0x15a95e(0xf1),_0x41a42f=>{const _0x21b6af=_0x15a95e;if(_0x41a42f===0x0||_0x41a42f===null)_0x484ce0();else _0x22e32a(new Error(_0x556652+_0x21b6af(0xe4)+_0x318e2c+'\x20exited\x20with\x20code\x20'+_0x41a42f));}),_0x2ad510['on'](_0x15a95e(0x100),_0x22e32a);});}function spawnViteBuildWatch(_0x140188){return new Promise((_0x316218,_0xe58370)=>{const _0x22749c=a128_0x4b31,_0x5e67ff=spawn('vite',[_0x22749c(0x113),'--watch'],{'cwd':_0x140188,'stdio':_0x22749c(0xee),'shell':!![],'env':{...process.env,'PATH':''+join(_0x140188,_0x22749c(0x10a),_0x22749c(0xfd))+delimiter+process.env.PATH}});_0x5e67ff['on']('close',_0x2356a0=>{const _0xff9611=_0x22749c;if(_0x2356a0===0x0||_0x2356a0===null)_0x316218();else _0xe58370(new Error(_0xff9611(0x123)+_0x2356a0));}),_0x5e67ff['on'](_0x22749c(0x100),_0xe58370);});}function spawnVitePreview(_0x343062){return new Promise((_0x274ea9,_0x54943d)=>{const _0x3cdd64=a128_0x4b31,_0x1b436a=spawn('vite',[_0x3cdd64(0x122)],{'cwd':_0x343062,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x343062,_0x3cdd64(0x10a),_0x3cdd64(0xfd))+delimiter+process.env.PATH}});_0x1b436a['on']('close',_0x1e67a6=>{const _0x2eaccc=_0x3cdd64;if(_0x1e67a6===0x0||_0x1e67a6===null)_0x274ea9();else _0x54943d(new Error(_0x2eaccc(0x10f)+_0x1e67a6));}),_0x1b436a['on'](_0x3cdd64(0x100),_0x54943d);});}const runFlags=[{'name':a128_0x233e1d(0x119),'type':a128_0x233e1d(0x108),'description':a128_0x233e1d(0xfc),'default':![]}];export const runDefinition={'service':a128_0x233e1d(0xe9),'command':a128_0x233e1d(0xe9),'description':'Run\x20a\x20package.json\x20script','risk':a128_0x233e1d(0x11b),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a128_0x233e1d(0xe8),'description':a128_0x233e1d(0x11a),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0xeff23e=a128_0x233e1d,_0xe711cc=readPackageScripts(process[_0xeff23e(0x104)]()),_0x203aa7=[];if(_0xe711cc&&Object['keys'](_0xe711cc)[_0xeff23e(0xff)]>0x0){const _0x1d30b0=Object['keys'](_0xe711cc),_0x687cb6=Math[_0xeff23e(0xeb)](..._0x1d30b0[_0xeff23e(0xfa)](_0x27f6fa=>_0x27f6fa['length']));_0x203aa7[_0xeff23e(0xef)](_0xeff23e(0xea));for(const [_0x107d3e,_0x2b19f2]of Object[_0xeff23e(0x117)](_0xe711cc)){_0x203aa7[_0xeff23e(0xef)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20'+_0x107d3e['padEnd'](_0x687cb6+0x2)+'#\x20'+_0x2b19f2);}}else _0x203aa7['push']('\x20\x20EXAMPLES'),_0x203aa7['push'](_0xeff23e(0x10e)+CLI_BIN_NAME+'\x20run\x20start'),_0x203aa7['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0xeff23e(0x10d)),_0x203aa7[_0xeff23e(0xef)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0xeff23e(0xf2)),_0x203aa7[_0xeff23e(0xef)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0xeff23e(0x112));return _0x203aa7[_0xeff23e(0x109)]('\x0a');},async 'execute'(_0x1f85ca){const _0x5ba309=a128_0x233e1d,_0x17c278=process['cwd'](),_0x30118a=_0x1f85ca[_0x5ba309(0x114)][0x0],_0x334483=_0x1f85ca['args']['slice'](0x1),_0x1ff233=readPackageScripts(_0x17c278);if(!_0x1ff233)throw CliErrors[_0x5ba309(0x105)](_0x5ba309(0x111));if(!_0x30118a){const _0x186286=Object['keys'](_0x1ff233);if(_0x186286['length']===0x0)console[_0x5ba309(0x11e)](_0x5ba309(0x103));else{console[_0x5ba309(0x11e)](_0x5ba309(0x107));const _0x4cfa4d=Math[_0x5ba309(0xeb)](..._0x186286[_0x5ba309(0xfa)](_0x5181b2=>_0x5181b2[_0x5ba309(0xff)]));for(const [_0x3f5aec,_0xded09]of Object[_0x5ba309(0x117)](_0x1ff233)){console[_0x5ba309(0x11e)](_0x5ba309(0x10e)+_0x3f5aec[_0x5ba309(0xed)](_0x4cfa4d+0x2)+_0xded09);}console[_0x5ba309(0x11e)](_0x5ba309(0x118)+CLI_BIN_NAME+_0x5ba309(0x11d));}return{'ok':!![]};}if(!_0x1ff233[_0x30118a])throw CliErrors[_0x5ba309(0x105)]('Script\x20\x22'+_0x30118a+_0x5ba309(0xe6),_0x5ba309(0xf5)+(Object[_0x5ba309(0x115)](_0x1ff233)[_0x5ba309(0x109)](',\x20')||_0x5ba309(0x116)));const _0x2291ce=detectPackageManager(_0x17c278);VERSION_CHECK_SCRIPTS['has'](_0x30118a)&&await versionCheck(_0x17c278);if(_0x30118a==='preview'&&_0x1f85ca[_0x5ba309(0x124)](_0x5ba309(0x119)))return await Promise[_0x5ba309(0x106)]([spawnViteBuildWatch(_0x17c278),spawnVitePreview(_0x17c278)]),{'ok':!![]};return await spawnScript(_0x2291ce,_0x30118a,_0x334483,_0x17c278),{'ok':!![]};}};
1
+ const a129_0x29d65a=a129_0x5de8;function a129_0x5de8(_0x5750cb,_0x1323f1){_0x5750cb=_0x5750cb-0x65;const _0x383f3d=a129_0x383f();let _0x5de887=_0x383f3d[_0x5750cb];return _0x5de887;}(function(_0x41b404,_0x140c7b){const _0x2e81d3=a129_0x5de8,_0x4b7be1=_0x41b404();while(!![]){try{const _0x30cb58=parseInt(_0x2e81d3(0x93))/0x1*(parseInt(_0x2e81d3(0x78))/0x2)+parseInt(_0x2e81d3(0x7c))/0x3*(-parseInt(_0x2e81d3(0x7e))/0x4)+parseInt(_0x2e81d3(0x8f))/0x5+parseInt(_0x2e81d3(0x9d))/0x6*(-parseInt(_0x2e81d3(0x98))/0x7)+parseInt(_0x2e81d3(0x80))/0x8*(-parseInt(_0x2e81d3(0x95))/0x9)+-parseInt(_0x2e81d3(0xa1))/0xa*(parseInt(_0x2e81d3(0x8b))/0xb)+parseInt(_0x2e81d3(0xa6))/0xc;if(_0x30cb58===_0x140c7b)break;else _0x4b7be1['push'](_0x4b7be1['shift']());}catch(_0x5b4761){_0x4b7be1['push'](_0x4b7be1['shift']());}}}(a129_0x383f,0xf2961));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a129_0x29d65a(0x67),'dev']);function readPackageScripts(_0x43ef84){const _0x11ce02=a129_0x29d65a,_0x164448=resolve(_0x43ef84,_0x11ce02(0x7b));if(!existsSync(_0x164448))return null;try{const _0x18b1b1=JSON[_0x11ce02(0x65)](readFileSync(_0x164448,'utf-8'));return _0x18b1b1[_0x11ce02(0x89)]??{};}catch{return null;}}function detectPackageManager(_0x3455f){const _0x18924e=a129_0x29d65a;if(existsSync(resolve(_0x3455f,'bun.lockb'))||existsSync(resolve(_0x3455f,'bun.lock')))return _0x18924e(0x6e);if(existsSync(resolve(_0x3455f,'pnpm-lock.yaml')))return'pnpm';if(existsSync(resolve(_0x3455f,_0x18924e(0x76))))return _0x18924e(0xaa);return'npm';}async function versionCheck(_0x19b293){const _0x5b97fd=a129_0x29d65a,_0x5aea6e=await checkCliVersion();(_0x5aea6e[_0x5b97fd(0x88)]||_0x5aea6e[_0x5b97fd(0x72)])&&(printCliUpgradeWarning(_0x5aea6e),assertCliVersionSupported(_0x5aea6e));const _0x4fc322=await checkSdkVersion(_0x19b293);if(_0x4fc322['needsUpgrade'])printSdkUpgradeWarning(_0x4fc322);}function spawnScript(_0x105ed4,_0x369526,_0x46e2cc,_0x411f54){return new Promise((_0x176511,_0x4c8996)=>{const _0x5091b7=a129_0x5de8,_0x20171b=[_0x5091b7(0x75),_0x369526,..._0x46e2cc],_0x251edc=spawn(_0x105ed4,_0x20171b,{'cwd':_0x411f54,'stdio':_0x5091b7(0xa7),'shell':!![],'env':{...process.env,'PATH':''+join(_0x411f54,'node_modules',_0x5091b7(0x66))+delimiter+process.env.PATH}});_0x251edc['on'](_0x5091b7(0x81),_0x1ccca8=>{const _0xefd2ea=_0x5091b7;if(_0x1ccca8===0x0||_0x1ccca8===null)_0x176511();else _0x4c8996(new Error(_0x105ed4+'\x20run\x20'+_0x369526+_0xefd2ea(0x87)+_0x1ccca8));}),_0x251edc['on']('error',_0x4c8996);});}function spawnViteBuildWatch(_0x56bb80){return new Promise((_0x4aefe6,_0x12c8d6)=>{const _0xf6a01c=a129_0x5de8,_0x13c414=spawn('vite',[_0xf6a01c(0x94),_0xf6a01c(0x7d)],{'cwd':_0x56bb80,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x56bb80,_0xf6a01c(0x83),_0xf6a01c(0x66))+delimiter+process.env.PATH}});_0x13c414['on'](_0xf6a01c(0x81),_0x5729f4=>{const _0x5743a6=_0xf6a01c;if(_0x5729f4===0x0||_0x5729f4===null)_0x4aefe6();else _0x12c8d6(new Error(_0x5743a6(0x86)+_0x5729f4));}),_0x13c414['on'](_0xf6a01c(0x6d),_0x12c8d6);});}function spawnVitePreview(_0x4a5d79){return new Promise((_0x41b30e,_0x570500)=>{const _0x573338=a129_0x5de8,_0x2bdd37=spawn('vite',[_0x573338(0x90)],{'cwd':_0x4a5d79,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x4a5d79,'node_modules',_0x573338(0x66))+delimiter+process.env.PATH}});_0x2bdd37['on'](_0x573338(0x81),_0x2e3712=>{const _0x3eeba7=_0x573338;if(_0x2e3712===0x0||_0x2e3712===null)_0x41b30e();else _0x570500(new Error(_0x3eeba7(0x7f)+_0x2e3712));}),_0x2bdd37['on'](_0x573338(0x6d),_0x570500);});}const runFlags=[{'name':'watch','type':a129_0x29d65a(0x79),'description':a129_0x29d65a(0x68),'default':![]}];function a129_0x383f(){const _0x2d6e2c=['parse','.bin','start','Enable\x20watch\x20mode\x20for\x20preview','Script\x20name\x20defined\x20in\x20package.json','watch','\x22\x20not\x20found\x20in\x20package.json.','padEnd','error','bun','validation','read','has','belowMinimum','\x20run\x20<script>\x0a','entries','run','yarn.lock','map','8LiGACb','boolean','Script\x20\x22','package.json','42ToiCwF','--watch','101388rnBwfP','vite\x20preview\x20exited\x20with\x20code\x20','16QrodMy','close','cwd','node_modules','\x20run\x20start','\x20run\x20build','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','\x20exited\x20with\x20code\x20','needsUpgrade','scripts','script','385lyXwIn','Available:\x20','No\x20package.json\x20found\x20in\x20current\x20directory.','max','3740965PxoyXp','preview','(none)','\x0a\x20\x20Usage:\x20','341017eOacXT','build','5709681rufhuM','all','slice','7HkCgFS','\x20run\x20preview','No\x20scripts\x20defined\x20in\x20package.json.','bool','\x0a\x20\x20Available\x20scripts:\x0a','11854254qRMoaJ','keys','args','\x20\x20EXAMPLES','167650djOHkG','\x20\x20\x20\x20','push','log','\x20run\x20preview\x20--watch\x20\x20\x20#\x20parallel\x20build\x20--watch\x20+\x20preview','36810384EPYHjo','inherit','join','length','yarn'];a129_0x383f=function(){return _0x2d6e2c;};return a129_0x383f();}export const runDefinition={'service':'run','command':a129_0x29d65a(0x75),'description':'Run\x20a\x20package.json\x20script','risk':a129_0x29d65a(0x70),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a129_0x29d65a(0x8a),'description':a129_0x29d65a(0x69),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x2e6f69=a129_0x29d65a,_0x450e43=readPackageScripts(process['cwd']()),_0xf8907c=[];if(_0x450e43&&Object[_0x2e6f69(0x9e)](_0x450e43)[_0x2e6f69(0xa9)]>0x0){const _0x1f4123=Object['keys'](_0x450e43),_0x2b4fba=Math[_0x2e6f69(0x8e)](..._0x1f4123['map'](_0x192c85=>_0x192c85['length']));_0xf8907c[_0x2e6f69(0xa3)]('\x20\x20AVAILABLE\x20SCRIPTS\x20\x20(current\x20project)');for(const [_0xf19b9c,_0x44e82b]of Object[_0x2e6f69(0x74)](_0x450e43)){_0xf8907c['push'](_0x2e6f69(0xa2)+CLI_BIN_NAME+'\x20run\x20'+_0xf19b9c[_0x2e6f69(0x6c)](_0x2b4fba+0x2)+'#\x20'+_0x44e82b);}}else _0xf8907c[_0x2e6f69(0xa3)](_0x2e6f69(0xa0)),_0xf8907c[_0x2e6f69(0xa3)](_0x2e6f69(0xa2)+CLI_BIN_NAME+_0x2e6f69(0x84)),_0xf8907c[_0x2e6f69(0xa3)](_0x2e6f69(0xa2)+CLI_BIN_NAME+_0x2e6f69(0x85)),_0xf8907c[_0x2e6f69(0xa3)](_0x2e6f69(0xa2)+CLI_BIN_NAME+_0x2e6f69(0x99)),_0xf8907c[_0x2e6f69(0xa3)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x2e6f69(0xa5));return _0xf8907c[_0x2e6f69(0xa8)]('\x0a');},async 'execute'(_0x2078fa){const _0x1c329d=a129_0x29d65a,_0x524205=process[_0x1c329d(0x82)](),_0x2f5e90=_0x2078fa[_0x1c329d(0x9f)][0x0],_0x36c1d7=_0x2078fa[_0x1c329d(0x9f)][_0x1c329d(0x97)](0x1),_0x47af4d=readPackageScripts(_0x524205);if(!_0x47af4d)throw CliErrors['validation'](_0x1c329d(0x8d));if(!_0x2f5e90){const _0x32b7a3=Object[_0x1c329d(0x9e)](_0x47af4d);if(_0x32b7a3[_0x1c329d(0xa9)]===0x0)console[_0x1c329d(0xa4)](_0x1c329d(0x9a));else{console['log'](_0x1c329d(0x9c));const _0x311443=Math['max'](..._0x32b7a3[_0x1c329d(0x77)](_0x22a7ca=>_0x22a7ca['length']));for(const [_0x44ae13,_0x417657]of Object[_0x1c329d(0x74)](_0x47af4d)){console[_0x1c329d(0xa4)]('\x20\x20\x20\x20'+_0x44ae13['padEnd'](_0x311443+0x2)+_0x417657);}console[_0x1c329d(0xa4)](_0x1c329d(0x92)+CLI_BIN_NAME+_0x1c329d(0x73));}return{'ok':!![]};}if(!_0x47af4d[_0x2f5e90])throw CliErrors[_0x1c329d(0x6f)](_0x1c329d(0x7a)+_0x2f5e90+_0x1c329d(0x6b),_0x1c329d(0x8c)+(Object['keys'](_0x47af4d)[_0x1c329d(0xa8)](',\x20')||_0x1c329d(0x91)));const _0xea547f=detectPackageManager(_0x524205);VERSION_CHECK_SCRIPTS[_0x1c329d(0x71)](_0x2f5e90)&&await versionCheck(_0x524205);if(_0x2f5e90===_0x1c329d(0x90)&&_0x2078fa[_0x1c329d(0x9b)](_0x1c329d(0x6a)))return await Promise[_0x1c329d(0x96)]([spawnViteBuildWatch(_0x524205),spawnVitePreview(_0x524205)]),{'ok':!![]};return await spawnScript(_0xea547f,_0x2f5e90,_0x36c1d7,_0x524205),{'ok':!![]};}};
@@ -1 +1 @@
1
- function a129_0x47e0(){const _0x586653=['schema','20VHqvmT','2tefjCB','381933kobnNc','5GCXOZy','161245iXGdPX','1980996uFWTIa','2755344WyuGlo','json','7LEYFqe','1072808ImaiHX','1749093UgNxZW','export','96PGsqph','read','1210868rNPrFb'];a129_0x47e0=function(){return _0x586653;};return a129_0x47e0();}const a129_0x2c5ccb=a129_0x8380;function a129_0x8380(_0x4f83c2,_0x12396d){_0x4f83c2=_0x4f83c2-0x116;const _0x47e0e5=a129_0x47e0();let _0x83802c=_0x47e0e5[_0x4f83c2];return _0x83802c;}(function(_0x310cc0,_0x29e00c){const _0x2c28ff=a129_0x8380,_0x16967d=_0x310cc0();while(!![]){try{const _0x4cd966=parseInt(_0x2c28ff(0x11e))/0x1+parseInt(_0x2c28ff(0x11b))/0x2*(-parseInt(_0x2c28ff(0x124))/0x3)+parseInt(_0x2c28ff(0x118))/0x4*(parseInt(_0x2c28ff(0x11d))/0x5)+parseInt(_0x2c28ff(0x11f))/0x6*(parseInt(_0x2c28ff(0x122))/0x7)+-parseInt(_0x2c28ff(0x116))/0x8*(-parseInt(_0x2c28ff(0x11c))/0x9)+-parseInt(_0x2c28ff(0x11a))/0xa*(parseInt(_0x2c28ff(0x123))/0xb)+-parseInt(_0x2c28ff(0x120))/0xc;if(_0x4cd966===_0x29e00c)break;else _0x16967d['push'](_0x16967d['shift']());}catch(_0x48bf53){_0x16967d['push'](_0x16967d['shift']());}}}(a129_0x47e0,0x482f9));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x5c4073){const _0xa81244=await buildSchemaPayload();return{'ok':!![],'data':_0xa81244};}export const schemaDefinition={'service':a129_0x2c5ccb(0x119),'command':a129_0x2c5ccb(0x125),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a129_0x2c5ccb(0x117),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a129_0x2c5ccb(0x121),'flags':[],'execute':execute};
1
+ const a130_0x4634e8=a130_0x2f6f;(function(_0x59983a,_0x60d59a){const _0x111a70=a130_0x2f6f,_0x49d23b=_0x59983a();while(!![]){try{const _0x5c518e=parseInt(_0x111a70(0x134))/0x1+-parseInt(_0x111a70(0x132))/0x2+-parseInt(_0x111a70(0x136))/0x3+-parseInt(_0x111a70(0x13d))/0x4*(parseInt(_0x111a70(0x138))/0x5)+-parseInt(_0x111a70(0x13b))/0x6+-parseInt(_0x111a70(0x139))/0x7+-parseInt(_0x111a70(0x13f))/0x8*(-parseInt(_0x111a70(0x135))/0x9);if(_0x5c518e===_0x60d59a)break;else _0x49d23b['push'](_0x49d23b['shift']());}catch(_0x1d3efa){_0x49d23b['push'](_0x49d23b['shift']());}}}(a130_0x3b49,0xd5ddc));function a130_0x3b49(){const _0x47f5f6=['Export\x20machine-readable\x20command\x20schema\x20(JSON)','1117390Pahmil','657NNaueb','1246833OvVOHG','schema','2725YtdOCD','656754vGSzEV','read','5328558lfzrsV','export','6312XNxmPA','json','329920kNZdZe','1988756tOVumH'];a130_0x3b49=function(){return _0x47f5f6;};return a130_0x3b49();}function a130_0x2f6f(_0x171b0c,_0xf47454){_0x171b0c=_0x171b0c-0x132;const _0x3b49fd=a130_0x3b49();let _0x2f6fe7=_0x3b49fd[_0x171b0c];return _0x2f6fe7;}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x24270e){const _0x3bf580=await buildSchemaPayload();return{'ok':!![],'data':_0x3bf580};}export const schemaDefinition={'service':a130_0x4634e8(0x137),'command':a130_0x4634e8(0x13c),'description':a130_0x4634e8(0x133),'risk':a130_0x4634e8(0x13a),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a130_0x4634e8(0x13e),'flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a130_0x371a44=a130_0x2580;(function(_0x2aea06,_0x4e4599){const _0x9d8d9f=a130_0x2580,_0x57b674=_0x2aea06();while(!![]){try{const _0x9330f3=-parseInt(_0x9d8d9f(0x1e2))/0x1+parseInt(_0x9d8d9f(0x1e4))/0x2*(parseInt(_0x9d8d9f(0x1e8))/0x3)+-parseInt(_0x9d8d9f(0x1ed))/0x4*(-parseInt(_0x9d8d9f(0x1fc))/0x5)+parseInt(_0x9d8d9f(0x1c8))/0x6*(parseInt(_0x9d8d9f(0x1ec))/0x7)+parseInt(_0x9d8d9f(0x1f4))/0x8+parseInt(_0x9d8d9f(0x1cc))/0x9*(-parseInt(_0x9d8d9f(0x1f8))/0xa)+parseInt(_0x9d8d9f(0x1f9))/0xb;if(_0x9330f3===_0x4e4599)break;else _0x57b674['push'](_0x57b674['shift']());}catch(_0x1ad25a){_0x57b674['push'](_0x57b674['shift']());}}}(a130_0x3435,0x47cfc));function a130_0x2580(_0x412fc4,_0x2d98dc){_0x412fc4=_0x412fc4-0x1c4;const _0x343558=a130_0x3435();let _0x2580a9=_0x343558[_0x412fc4];return _0x2580a9;}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(_0x50becd){const _0x31e1cb=a130_0x2580;if(_0x50becd===_0x31e1cb(0x1ea))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','\x20\x20SELECT\x201\x20AS\x20id','</select>','']['join']('\x0a');return['SELECT\x201\x20AS\x20id;','']['join']('\x0a');}export const sqlCreate={'service':a130_0x371a44(0x1f3),'command':a130_0x371a44(0x1f2),'description':a130_0x371a44(0x1dd),'risk':a130_0x371a44(0x1cf),'flags':[{'name':a130_0x371a44(0x1d9),'type':'string','description':'SQL\x20query\x20display\x20name'},{'name':a130_0x371a44(0x1df),'type':a130_0x371a44(0x1f0),'description':'Target\x20database\x20ID'},{'name':a130_0x371a44(0x1ce),'type':a130_0x371a44(0x1ef),'enum':[a130_0x371a44(0x1f3),a130_0x371a44(0x1ea)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x441079){const _0xd55c3e=a130_0x371a44;if(!_0x441079[_0xd55c3e(0x1d0)])return;if(!_0x441079[_0xd55c3e(0x1e1)]('name')['trim']())throw CliErrors['flagMissing'](_0xd55c3e(0x1d9),_0xd55c3e(0x1fb));const _0x307071=resolveProvidedDbId(_0x441079);if(typeof _0x307071!=='number'||!Number['isFinite'](_0x307071)||_0x307071<=0x0)throw CliErrors[_0xd55c3e(0x1d4)](_0xd55c3e(0x1df),_0xd55c3e(0x1f5));if(!_0x441079[_0xd55c3e(0x1e1)](_0xd55c3e(0x1ce))[_0xd55c3e(0x1d2)]())throw CliErrors['flagMissing'](_0xd55c3e(0x1ce),_0xd55c3e(0x201));},async 'dryRun'(_0x34ef62){const _0x94b256=a130_0x371a44,_0x41bfde=loadSqlProjectConfig(_0x34ef62[_0x94b256(0x1cb)]),{sqlName:_0xb96757,dbId:_0x254648,dbName:_0x3769ba,mode:_0x4ef298}=await resolveSqlNewInputs(_0x34ef62),_0x45554e=buildSqlRelativePath('<server-generated-sqlCode>',_0xb96757,_0x3769ba,_0x4ef298,_0x254648),_0x15d041=_0x41bfde['sqlRootDir']+'/'+_0x45554e;return{'method':'POST','url':_0x94b256(0x1fe),'body':{'appCode':_0x34ef62[_0x94b256(0x1cb)],'sqlName':_0xb96757,'dbId':_0x254648,'mode':_0x4ef298,'localPath':_0x15d041},'description':_0x94b256(0x1d5)+_0x41bfde[_0x94b256(0x1e7)]};},async 'execute'(_0xb285f2){const _0x49840a=a130_0x371a44,_0x170fd1=loadSqlProjectConfig(_0xb285f2[_0x49840a(0x1cb)]),{sqlName:_0x280dcd,dbId:_0x592221,dbName:_0x50ce59,mode:_0x19b2db}=await resolveSqlNewInputs(_0xb285f2),_0x1894a9=generateSqlTemplate(_0x19b2db),_0x3c121a=await createSqlQuery({'appCode':_0xb285f2[_0x49840a(0x1cb)],'sqlName':_0x280dcd,'dbId':_0x592221,'sqlContent':_0x1894a9}),_0x18034f=ensureRemoteSqlContent(_0x3c121a),_0x2bbc38=_0x50ce59||await getDbName(_0xb285f2[_0x49840a(0x1cb)],_0x592221)[_0x49840a(0x1cd)](()=>undefined),_0x1f4fa8=buildSqlRelativePath(_0x3c121a[_0x49840a(0x1c9)],_0x3c121a[_0x49840a(0x1e3)],_0x2bbc38,_0x19b2db,_0x592221),_0x446da0=_0x170fd1['sqlRootDir']+'/'+_0x1f4fa8,_0x5e1504=buildLocalSqlFileContent({'sqlCode':_0x3c121a[_0x49840a(0x1c9)],'sqlName':_0x3c121a[_0x49840a(0x1e3)],'dbId':_0x3c121a[_0x49840a(0x1de)]},_0x18034f,{'dbName':_0x2bbc38,'mode':_0x19b2db,'syncedAt':new Date()[_0x49840a(0x1fd)](),'description':_0x3c121a[_0x49840a(0x1ff)]});if(await fileExists(_0x446da0))throw CliErrors[_0x49840a(0x1c7)](_0x49840a(0x1d8)+_0x446da0);await ensureParentDirectory(_0x446da0),await writeFile(_0x446da0,_0x5e1504,_0x49840a(0x1f7));const _0x21c123=await readSqlLockFile(_0x170fd1[_0x49840a(0x1dc)]),{lockData:_0x42596d,appLock:_0x2b9d63}=ensureSqlLockScope(_0x21c123??createEmptySqlLock(),_0x170fd1[_0x49840a(0x1cb)],_0x170fd1['sqlRoot'],_0x49840a(0x1db));return _0x2b9d63[_0x49840a(0x202)][_0x3c121a[_0x49840a(0x1c9)]]={...buildSqlLockEntry(_0x3c121a,_0x18034f,computeSqlContentHash(_0x5e1504),{'dbName':_0x2bbc38}),'path':_0x1f4fa8,'mode':_0x19b2db},_0x2b9d63[_0x49840a(0x1c4)]=new Date()[_0x49840a(0x1fd)](),await writeSqlLockFile(_0x170fd1[_0x49840a(0x1dc)],_0x42596d),{'ok':!![],'data':{'id':_0x3c121a['id'],'sqlCode':_0x3c121a['sqlCode'],'sqlName':_0x3c121a[_0x49840a(0x1e3)],'dbId':_0x3c121a[_0x49840a(0x1de)],'path':_0x446da0,'mode':_0x19b2db},'message':_0x49840a(0x1e6)+_0x3c121a[_0x49840a(0x1c9)]};}};async function resolveSqlNewInputs(_0x375fba){const _0x506251=await resolveSqlNameInput(_0x375fba),{dbId:_0x53cc31,dbName:_0x2c76b7}=await resolveDbSelection(_0x375fba),_0x5c083b=await resolveSqlModeInput(_0x375fba);return{'sqlName':_0x506251,'dbId':_0x53cc31,'dbName':_0x2c76b7,'mode':_0x5c083b};}async function resolveSqlNameInput(_0x16403f){const _0x1165fd=a130_0x371a44,_0x34aebd=_0x16403f[_0x1165fd(0x1e1)](_0x1165fd(0x1d9))[_0x1165fd(0x1d2)]();if(_0x34aebd)return _0x34aebd;if(_0x16403f[_0x1165fd(0x1d0)])throw CliErrors[_0x1165fd(0x1d4)]('name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x1165fd(0x1fa),'validate':_0xa75931=>_0xa75931[_0x1165fd(0x1d2)]()?!![]:_0x1165fd(0x1e0)}))[_0x1165fd(0x1d2)]();}async function resolveDbSelection(_0x1e5e3a){const _0x1bcd66=a130_0x371a44,_0x48ab6e=resolveProvidedDbId(_0x1e5e3a);if(typeof _0x48ab6e===_0x1bcd66(0x1f0)&&Number[_0x1bcd66(0x1c5)](_0x48ab6e)&&_0x48ab6e>0x0)return{'dbId':_0x48ab6e,'dbName':await getDbName(_0x1e5e3a[_0x1bcd66(0x1cb)],_0x48ab6e)[_0x1bcd66(0x1cd)](()=>undefined)};if(_0x1e5e3a[_0x1bcd66(0x1d0)])throw CliErrors['flagMissing'](_0x1bcd66(0x1df),_0x1bcd66(0x1f5));const _0x2939f7=await listDatabases(_0x1e5e3a[_0x1bcd66(0x1cb)])[_0x1bcd66(0x1cd)](()=>[]);if(_0x2939f7['length']===0x1)return{'dbId':_0x2939f7[0x0]['dbId'],'dbName':_0x2939f7[0x0]['dbName']};if(_0x2939f7['length']>0x1){const _0x5daf15=await select({'message':_0x1bcd66(0x1da),'choices':[..._0x2939f7[_0x1bcd66(0x1d1)](_0x22861e=>({'name':_0x22861e[_0x1bcd66(0x1eb)]+'\x20('+_0x22861e['dbId']+')','value':serializeDbSelection(_0x22861e)})),{'name':'✎\x20手动输入\x20dbId','value':'__manual__'}]});if(_0x5daf15!==_0x1bcd66(0x1ee))return deserializeDbSelection(_0x5daf15);}const _0x3a17f3=await input({'message':_0x1bcd66(0x1d6),'validate':_0x2eb322=>{const _0xa56c67=_0x1bcd66,_0x2512da=_0x2eb322['trim']();if(!_0x2512da)return'dbId\x20不能为空';const _0x5056ca=Number(_0x2512da);if(!Number['isInteger'](_0x5056ca)||_0x5056ca<=0x0)return _0xa56c67(0x1e9);return!![];}});return{'dbId':Number(_0x3a17f3['trim']())};}function a130_0x3435(){const _0x5dfa20=['description','MyBatis\x20XML(mybatisXml)','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','sqls','lastSync','isFinite','parse','validation','6oZAzEm','sqlCode','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','appCode','162jgklFI','catch','mode','high-risk-write','nonInteractive','map','trim','Invalid\x20database\x20selection\x20payload:\x20','flagMissing','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','请输入目标数据库\x20dbId:','flag','File\x20already\x20exists:\x20','name','请选择目标数据库:','new','lockFilePath','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','dbId','db-id','SQL\x20名称不能为空','str','202046aTheRC','sqlName','2386UcwATF','适合带动态标签的\x20MyBatis\x20XML\x20SQL','Created\x20SQL\x20query\x20','sqlRootDir','489gutRZK','dbId\x20必须为正整数','mybatisXml','dbName','1506953BsWjFW','20EkKHKc','__manual__','string','number','普通\x20SQL(sql)','create','sql','3518248cryHTQ','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','stringify','utf8','298790SZfMYp','1652024hwOMVb','请输入\x20SQL\x20名称:','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','34305QeXDXM','toISOString','/smartapi/custom/saveUserCustomSql'];a130_0x3435=function(){return _0x5dfa20;};return a130_0x3435();}async function resolveSqlModeInput(_0x644cd3){const _0x1fa333=a130_0x371a44,_0x121144=_0x644cd3[_0x1fa333(0x1e1)](_0x1fa333(0x1ce))[_0x1fa333(0x1d2)]();if(_0x121144==='sql'||_0x121144==='mybatisXml')return _0x121144;if(_0x644cd3[_0x1fa333(0x1d0)])throw CliErrors[_0x1fa333(0x1d4)]('mode',_0x1fa333(0x201));return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':_0x1fa333(0x1f1),'value':_0x1fa333(0x1f3),'description':_0x1fa333(0x1ca)},{'name':_0x1fa333(0x200),'value':_0x1fa333(0x1ea),'description':_0x1fa333(0x1e5)}]});}function serializeDbSelection(_0x2c2214){const _0x40b38a=a130_0x371a44;return JSON[_0x40b38a(0x1f6)]({'dbId':_0x2c2214[_0x40b38a(0x1de)],'dbName':_0x2c2214[_0x40b38a(0x1eb)]});}function deserializeDbSelection(_0x20bca0){const _0x27ea8a=a130_0x371a44;try{const _0x4be340=JSON[_0x27ea8a(0x1c6)](_0x20bca0);if(typeof _0x4be340[_0x27ea8a(0x1de)]===_0x27ea8a(0x1f0)&&Number[_0x27ea8a(0x1c5)](_0x4be340[_0x27ea8a(0x1de)]))return{'dbId':_0x4be340[_0x27ea8a(0x1de)],'dbName':_0x4be340['dbName']};}catch{}throw CliErrors[_0x27ea8a(0x1c7)](_0x27ea8a(0x1d3)+_0x20bca0);}function resolveProvidedDbId(_0x56fc24){const _0x247866=a130_0x371a44,_0x3c469f=_0x56fc24[_0x247866(0x1d7)](_0x247866(0x1df));if(typeof _0x3c469f===_0x247866(0x1f0)&&Number[_0x247866(0x1c5)](_0x3c469f))return _0x3c469f;return undefined;}
1
+ const a131_0x4fc094=a131_0x5bd6;(function(_0x4ac013,_0x4e626b){const _0x3af314=a131_0x5bd6,_0x464fed=_0x4ac013();while(!![]){try{const _0x5f470f=parseInt(_0x3af314(0x164))/0x1*(-parseInt(_0x3af314(0x18c))/0x2)+-parseInt(_0x3af314(0x181))/0x3+parseInt(_0x3af314(0x192))/0x4+-parseInt(_0x3af314(0x163))/0x5+-parseInt(_0x3af314(0x18e))/0x6+-parseInt(_0x3af314(0x16f))/0x7*(parseInt(_0x3af314(0x18a))/0x8)+parseInt(_0x3af314(0x18d))/0x9;if(_0x5f470f===_0x4e626b)break;else _0x464fed['push'](_0x464fed['shift']());}catch(_0x5006f9){_0x464fed['push'](_0x464fed['shift']());}}}(a131_0x458d,0x575ba));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';function a131_0x458d(){const _0x277c0e=['请输入目标数据库\x20dbId:','<server-generated-sqlCode>','dbId\x20不能为空','1484785ObcoOA','38653ycGBbm','str','mybatisXml','POST','parse','trim','high-risk-write','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','mode','appCode','utf8','3756571zwPXYW','Created\x20SQL\x20query\x20','dbName','Local\x20SQL\x20file\x20mode','请输入\x20SQL\x20名称:','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','lockFilePath','请选择本地\x20SQL\x20模式:','普通\x20SQL(sql)','number','dbId','</select>','lastSync','flagMissing','isInteger','__manual__','join','db-id','521424NxNMNG','Invalid\x20database\x20selection\x20payload:\x20','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','/smartapi/custom/saveUserCustomSql','flag','length','SQL\x20query\x20display\x20name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlRootDir','8ueKLOn','toISOString','16fnEwhx','16703100HoBULt','3293898Kawqqg','nonInteractive','sql','sqlCode','1470172MdWScn','catch','stringify','name','isFinite','string','validation','适合带动态标签的\x20MyBatis\x20XML\x20SQL','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Target\x20database\x20ID','new','File\x20already\x20exists:\x20','sqlName','SELECT\x201\x20AS\x20id;'];a131_0x458d=function(){return _0x277c0e;};return a131_0x458d();}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(_0x57d7d8){const _0x1fd21a=a131_0x5bd6;if(_0x57d7d8===_0x1fd21a(0x166))return[_0x1fd21a(0x16b),'\x20\x20SELECT\x201\x20AS\x20id',_0x1fd21a(0x17a),''][_0x1fd21a(0x17f)]('\x0a');return[_0x1fd21a(0x15f),''][_0x1fd21a(0x17f)]('\x0a');}export const sqlCreate={'service':a131_0x4fc094(0x190),'command':'create','description':a131_0x4fc094(0x15a),'risk':a131_0x4fc094(0x16a),'flags':[{'name':a131_0x4fc094(0x195),'type':a131_0x4fc094(0x197),'description':a131_0x4fc094(0x187)},{'name':a131_0x4fc094(0x180),'type':'number','description':a131_0x4fc094(0x15b)},{'name':a131_0x4fc094(0x16c),'type':a131_0x4fc094(0x197),'enum':[a131_0x4fc094(0x190),a131_0x4fc094(0x166)],'description':a131_0x4fc094(0x172)}],async 'validate'(_0x516172){const _0xe53b1d=a131_0x4fc094;if(!_0x516172[_0xe53b1d(0x18f)])return;if(!_0x516172['str'](_0xe53b1d(0x195))[_0xe53b1d(0x169)]())throw CliErrors[_0xe53b1d(0x17c)](_0xe53b1d(0x195),_0xe53b1d(0x188));const _0x5881de=resolveProvidedDbId(_0x516172);if(typeof _0x5881de!==_0xe53b1d(0x178)||!Number[_0xe53b1d(0x196)](_0x5881de)||_0x5881de<=0x0)throw CliErrors['flagMissing'](_0xe53b1d(0x180),_0xe53b1d(0x183));if(!_0x516172[_0xe53b1d(0x165)](_0xe53b1d(0x16c))[_0xe53b1d(0x169)]())throw CliErrors[_0xe53b1d(0x17c)](_0xe53b1d(0x16c),_0xe53b1d(0x174));},async 'dryRun'(_0x50c20c){const _0x449ae3=a131_0x4fc094,_0x3e617c=loadSqlProjectConfig(_0x50c20c[_0x449ae3(0x16d)]),{sqlName:_0xb8f81a,dbId:_0x3f3beb,dbName:_0x5d784e,mode:_0x3cb711}=await resolveSqlNewInputs(_0x50c20c),_0x2cd8d3=buildSqlRelativePath(_0x449ae3(0x161),_0xb8f81a,_0x5d784e,_0x3cb711,_0x3f3beb),_0x4801de=_0x3e617c[_0x449ae3(0x189)]+'/'+_0x2cd8d3;return{'method':_0x449ae3(0x167),'url':_0x449ae3(0x184),'body':{'appCode':_0x50c20c['appCode'],'sqlName':_0xb8f81a,'dbId':_0x3f3beb,'mode':_0x3cb711,'localPath':_0x4801de},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x3e617c[_0x449ae3(0x189)]};},async 'execute'(_0x1a7ec0){const _0x4d3b82=a131_0x4fc094,_0x58519d=loadSqlProjectConfig(_0x1a7ec0[_0x4d3b82(0x16d)]),{sqlName:_0x4b32c8,dbId:_0x5970f5,dbName:_0x3f53cf,mode:_0x3adbcd}=await resolveSqlNewInputs(_0x1a7ec0),_0xdd420e=generateSqlTemplate(_0x3adbcd),_0x153c6a=await createSqlQuery({'appCode':_0x1a7ec0[_0x4d3b82(0x16d)],'sqlName':_0x4b32c8,'dbId':_0x5970f5,'sqlContent':_0xdd420e}),_0x1dd37e=ensureRemoteSqlContent(_0x153c6a),_0x547159=_0x3f53cf||await getDbName(_0x1a7ec0[_0x4d3b82(0x16d)],_0x5970f5)[_0x4d3b82(0x193)](()=>undefined),_0x3c649c=buildSqlRelativePath(_0x153c6a[_0x4d3b82(0x191)],_0x153c6a['sqlName'],_0x547159,_0x3adbcd,_0x5970f5),_0x3b0816=_0x58519d['sqlRootDir']+'/'+_0x3c649c,_0x473b3e=buildLocalSqlFileContent({'sqlCode':_0x153c6a['sqlCode'],'sqlName':_0x153c6a[_0x4d3b82(0x15e)],'dbId':_0x153c6a[_0x4d3b82(0x179)]},_0x1dd37e,{'dbName':_0x547159,'mode':_0x3adbcd,'syncedAt':new Date()[_0x4d3b82(0x18b)](),'description':_0x153c6a['description']});if(await fileExists(_0x3b0816))throw CliErrors[_0x4d3b82(0x198)](_0x4d3b82(0x15d)+_0x3b0816);await ensureParentDirectory(_0x3b0816),await writeFile(_0x3b0816,_0x473b3e,_0x4d3b82(0x16e));const _0x44af44=await readSqlLockFile(_0x58519d[_0x4d3b82(0x175)]),{lockData:_0x3c2d96,appLock:_0x3821a9}=ensureSqlLockScope(_0x44af44??createEmptySqlLock(),_0x58519d[_0x4d3b82(0x16d)],_0x58519d['sqlRoot'],_0x4d3b82(0x15c));return _0x3821a9['sqls'][_0x153c6a[_0x4d3b82(0x191)]]={...buildSqlLockEntry(_0x153c6a,_0x1dd37e,computeSqlContentHash(_0x473b3e),{'dbName':_0x547159}),'path':_0x3c649c,'mode':_0x3adbcd},_0x3821a9[_0x4d3b82(0x17b)]=new Date()['toISOString'](),await writeSqlLockFile(_0x58519d[_0x4d3b82(0x175)],_0x3c2d96),{'ok':!![],'data':{'id':_0x153c6a['id'],'sqlCode':_0x153c6a['sqlCode'],'sqlName':_0x153c6a[_0x4d3b82(0x15e)],'dbId':_0x153c6a['dbId'],'path':_0x3b0816,'mode':_0x3adbcd},'message':_0x4d3b82(0x170)+_0x153c6a[_0x4d3b82(0x191)]};}};async function resolveSqlNewInputs(_0x2fd76d){const _0x401cd3=await resolveSqlNameInput(_0x2fd76d),{dbId:_0x412987,dbName:_0x308bf5}=await resolveDbSelection(_0x2fd76d),_0x3eb433=await resolveSqlModeInput(_0x2fd76d);return{'sqlName':_0x401cd3,'dbId':_0x412987,'dbName':_0x308bf5,'mode':_0x3eb433};}async function resolveSqlNameInput(_0x522a24){const _0x4e6247=a131_0x4fc094,_0x29acf0=_0x522a24[_0x4e6247(0x165)](_0x4e6247(0x195))['trim']();if(_0x29acf0)return _0x29acf0;if(_0x522a24[_0x4e6247(0x18f)])throw CliErrors[_0x4e6247(0x17c)](_0x4e6247(0x195),_0x4e6247(0x188));return(await input({'message':_0x4e6247(0x173),'validate':_0x4b21df=>_0x4b21df['trim']()?!![]:'SQL\x20名称不能为空'}))[_0x4e6247(0x169)]();}async function resolveDbSelection(_0x383f93){const _0x2edab2=a131_0x4fc094,_0x5be936=resolveProvidedDbId(_0x383f93);if(typeof _0x5be936===_0x2edab2(0x178)&&Number[_0x2edab2(0x196)](_0x5be936)&&_0x5be936>0x0)return{'dbId':_0x5be936,'dbName':await getDbName(_0x383f93[_0x2edab2(0x16d)],_0x5be936)[_0x2edab2(0x193)](()=>undefined)};if(_0x383f93[_0x2edab2(0x18f)])throw CliErrors[_0x2edab2(0x17c)](_0x2edab2(0x180),_0x2edab2(0x183));const _0x15dbf8=await listDatabases(_0x383f93['appCode'])[_0x2edab2(0x193)](()=>[]);if(_0x15dbf8[_0x2edab2(0x186)]===0x1)return{'dbId':_0x15dbf8[0x0][_0x2edab2(0x179)],'dbName':_0x15dbf8[0x0]['dbName']};if(_0x15dbf8[_0x2edab2(0x186)]>0x1){const _0x3e6e93=await select({'message':'请选择目标数据库:','choices':[..._0x15dbf8['map'](_0x539696=>({'name':_0x539696[_0x2edab2(0x171)]+'\x20('+_0x539696[_0x2edab2(0x179)]+')','value':serializeDbSelection(_0x539696)})),{'name':'✎\x20手动输入\x20dbId','value':_0x2edab2(0x17e)}]});if(_0x3e6e93!==_0x2edab2(0x17e))return deserializeDbSelection(_0x3e6e93);}const _0x1cf025=await input({'message':_0x2edab2(0x160),'validate':_0x5f2105=>{const _0x18f883=_0x2edab2,_0x38583c=_0x5f2105[_0x18f883(0x169)]();if(!_0x38583c)return _0x18f883(0x162);const _0x4a942b=Number(_0x38583c);if(!Number[_0x18f883(0x17d)](_0x4a942b)||_0x4a942b<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x1cf025[_0x2edab2(0x169)]())};}function a131_0x5bd6(_0xf89780,_0x2be4ec){_0xf89780=_0xf89780-0x159;const _0x458d25=a131_0x458d();let _0x5bd615=_0x458d25[_0xf89780];return _0x5bd615;}async function resolveSqlModeInput(_0x3134cd){const _0x16320d=a131_0x4fc094,_0x5119c3=_0x3134cd[_0x16320d(0x165)](_0x16320d(0x16c))[_0x16320d(0x169)]();if(_0x5119c3===_0x16320d(0x190)||_0x5119c3===_0x16320d(0x166))return _0x5119c3;if(_0x3134cd[_0x16320d(0x18f)])throw CliErrors[_0x16320d(0x17c)](_0x16320d(0x16c),_0x16320d(0x174));return await select({'message':_0x16320d(0x176),'choices':[{'name':_0x16320d(0x177),'value':_0x16320d(0x190),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':'MyBatis\x20XML(mybatisXml)','value':_0x16320d(0x166),'description':_0x16320d(0x159)}]});}function serializeDbSelection(_0x57f316){const _0x5cb4b6=a131_0x4fc094;return JSON[_0x5cb4b6(0x194)]({'dbId':_0x57f316[_0x5cb4b6(0x179)],'dbName':_0x57f316[_0x5cb4b6(0x171)]});}function deserializeDbSelection(_0x324a9f){const _0x3edd6e=a131_0x4fc094;try{const _0x26afdf=JSON[_0x3edd6e(0x168)](_0x324a9f);if(typeof _0x26afdf[_0x3edd6e(0x179)]===_0x3edd6e(0x178)&&Number[_0x3edd6e(0x196)](_0x26afdf['dbId']))return{'dbId':_0x26afdf[_0x3edd6e(0x179)],'dbName':_0x26afdf['dbName']};}catch{}throw CliErrors['validation'](_0x3edd6e(0x182)+_0x324a9f);}function resolveProvidedDbId(_0x2789c2){const _0x3067d6=a131_0x4fc094,_0x578f09=_0x2789c2[_0x3067d6(0x185)](_0x3067d6(0x180));if(typeof _0x578f09===_0x3067d6(0x178)&&Number['isFinite'](_0x578f09))return _0x578f09;return undefined;}
@@ -1 +1 @@
1
- const a131_0x1a026d=a131_0xba61;(function(_0x263978,_0x5ccafd){const _0x317e44=a131_0xba61,_0x4f411c=_0x263978();while(!![]){try{const _0x3b0917=parseInt(_0x317e44(0xdc))/0x1+-parseInt(_0x317e44(0xd9))/0x2+-parseInt(_0x317e44(0xcc))/0x3+-parseInt(_0x317e44(0xe1))/0x4+parseInt(_0x317e44(0xd3))/0x5*(-parseInt(_0x317e44(0xc5))/0x6)+parseInt(_0x317e44(0xd7))/0x7*(-parseInt(_0x317e44(0xcb))/0x8)+parseInt(_0x317e44(0xda))/0x9;if(_0x3b0917===_0x5ccafd)break;else _0x4f411c['push'](_0x4f411c['shift']());}catch(_0xc3af95){_0x4f411c['push'](_0x4f411c['shift']());}}}(a131_0x593b,0x882d8));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a131_0xba61(_0x37008e,_0x17b9cc){_0x37008e=_0x37008e-0xc4;const _0x593b57=a131_0x593b();let _0xba61f0=_0x593b57[_0x37008e];return _0xba61f0;}import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';function a131_0x593b(){const _0xe63632=['POST','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','lockFilePath','1534520dVLCpZ','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','replace','entries','sqlcode','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','delete','toISOString','6QRVHiF','trashDir','remoteId','Would\x20delete\x20SQL\x20','sqls','\x20(local\x20file\x20moved\x20to\x20trash)','56PMsiBl','441027hzcXKS','sqlRoot','startsWith','appCode','lastSync','length','validation','1074415mpgUua','sql','fromEntries','trashedTo','631491wuaElW','str','1686066gXTPgj','20393901KixHiT','filter','511841ANjavz','/smartapi/custom/deleteUserCustomSql'];a131_0x593b=function(){return _0xe63632;};return a131_0x593b();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a131_0x1a026d(0xd4),'command':a131_0x1a026d(0xe7),'description':a131_0x1a026d(0xe2),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x40f002){const _0x5e7aac=a131_0x1a026d,_0x56b4ad=loadSqlProjectConfig(_0x40f002[_0x5e7aac(0xcf)]),_0x3ec5d3=await readSqlLockFile(_0x56b4ad['lockFilePath']);if(!_0x3ec5d3)throw CliErrors[_0x5e7aac(0xd2)](_0x5e7aac(0xe6));},async 'dryRun'(_0xc98ec7){const _0x5e572d=a131_0x1a026d,_0x5d08ef=loadSqlProjectConfig(_0xc98ec7['appCode']),_0x1d02f5=await readSqlLockFile(_0x5d08ef[_0x5e572d(0xe0)]);if(!_0x1d02f5)throw CliErrors[_0x5e572d(0xd2)](_0x5e572d(0xe6));const {appLock:_0x19f8c0}=ensureSqlLockScope(_0x1d02f5,_0xc98ec7['appCode'],_0x5d08ef['sqlRoot'],_0x5e572d(0xe7)),_0x582191=_0xc98ec7[_0x5e572d(0xd8)](_0x5e572d(0xe5)),_0x44aa76=_0x19f8c0['sqls'][_0x582191];if(!_0x44aa76)throw CliErrors[_0x5e572d(0xd2)](_0x5e572d(0xdf)+_0x582191+'\x22.');return{'method':_0x5e572d(0xde),'url':_0x5e572d(0xdd),'body':{'sqlCode':_0x582191,'id':_0x44aa76[_0x5e572d(0xc7)],'localPath':resolveLocalSqlFilePath(_0x5d08ef,_0x582191,_0x44aa76)},'description':_0x5e572d(0xc8)+_0x582191+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x5d08ef[_0x5e572d(0xc6)]};},async 'execute'(_0x2321a3){const _0x5d66e7=a131_0x1a026d,_0x24369f=loadSqlProjectConfig(_0x2321a3[_0x5d66e7(0xcf)]),_0x274917=await readSqlLockFile(_0x24369f[_0x5d66e7(0xe0)]);if(!_0x274917)throw CliErrors[_0x5d66e7(0xd2)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x379dda,appLock:_0x4cc77a}=ensureSqlLockScope(_0x274917,_0x2321a3[_0x5d66e7(0xcf)],_0x24369f[_0x5d66e7(0xcd)],_0x5d66e7(0xe7)),_0x41c7eb=_0x2321a3[_0x5d66e7(0xd8)]('sqlcode'),_0x477a23=_0x4cc77a[_0x5d66e7(0xc9)][_0x41c7eb];if(!_0x477a23)throw CliErrors[_0x5d66e7(0xd2)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x41c7eb+'\x22.');await deleteSqlQuery({'id':_0x477a23[_0x5d66e7(0xc7)],'sqlCode':_0x41c7eb}),_0x4cc77a[_0x5d66e7(0xc9)]=Object[_0x5d66e7(0xd5)](Object[_0x5d66e7(0xe4)](_0x4cc77a[_0x5d66e7(0xc9)])[_0x5d66e7(0xdb)](([_0x250f59])=>_0x250f59!==_0x41c7eb)),_0x4cc77a[_0x5d66e7(0xd0)]=new Date()[_0x5d66e7(0xc4)](),await writeSqlLockFile(_0x24369f[_0x5d66e7(0xe0)],_0x379dda);const _0x4701eb=resolveLocalSqlFilePath(_0x24369f,_0x41c7eb,_0x477a23);let _0xb216fd;await fileExists(_0x4701eb)&&(_0xb216fd=await moveToTrash(_0x24369f['projectRoot'],_0x24369f[_0x5d66e7(0xc6)],_0x4701eb),await cleanupEmptyDirectories(dirname(_0x4701eb),_0x24369f['sqlRootDir']));const _0x3f8a0c={'deleted':_0x41c7eb,'remoteId':_0x477a23[_0x5d66e7(0xc7)]};if(_0xb216fd)_0x3f8a0c[_0x5d66e7(0xd6)]=_0xb216fd;return{'ok':!![],'data':_0x3f8a0c,'message':'Deleted\x20'+_0x41c7eb+(_0xb216fd?_0x5d66e7(0xca):'')};}};async function moveToTrash(_0x1eb2d9,_0x48ae59,_0xee8f0){const _0x5d5c59=a131_0x1a026d,_0x2f9326=new Date()[_0x5d5c59(0xc4)]()[_0x5d5c59(0xe3)](/[:.]/g,'-'),_0x404dab=relative(_0x1eb2d9,_0xee8f0),_0x3a4bd1=join(_0x48ae59,_0x2f9326,_0x404dab);return await mkdir(dirname(_0x3a4bd1),{'recursive':!![]}),await rename(_0xee8f0,_0x3a4bd1),_0x3a4bd1;}async function cleanupEmptyDirectories(_0x4fb892,_0x5e6a97){const _0x2f1f25=a131_0x1a026d;let _0x33b1a1=resolve(_0x4fb892);const _0x57a3c4=resolve(_0x5e6a97);while(_0x33b1a1[_0x2f1f25(0xce)](''+_0x57a3c4+sep)||_0x33b1a1===_0x57a3c4){if(_0x33b1a1===_0x57a3c4)return;try{const _0x3f3d6b=await readdir(_0x33b1a1);if(_0x3f3d6b[_0x2f1f25(0xd1)]>0x0)return;await rmdir(_0x33b1a1);}catch{return;}_0x33b1a1=dirname(_0x33b1a1);}}
1
+ const a132_0x19748a=a132_0x359b;(function(_0x23633f,_0x4be2d5){const _0x408f3b=a132_0x359b,_0x17666a=_0x23633f();while(!![]){try{const _0x2a0de8=parseInt(_0x408f3b(0xe4))/0x1*(-parseInt(_0x408f3b(0x102))/0x2)+-parseInt(_0x408f3b(0xf1))/0x3+-parseInt(_0x408f3b(0x107))/0x4+parseInt(_0x408f3b(0x108))/0x5*(parseInt(_0x408f3b(0xec))/0x6)+-parseInt(_0x408f3b(0xf6))/0x7*(parseInt(_0x408f3b(0x104))/0x8)+parseInt(_0x408f3b(0xf7))/0x9*(parseInt(_0x408f3b(0xf8))/0xa)+-parseInt(_0x408f3b(0xfd))/0xb*(-parseInt(_0x408f3b(0x101))/0xc);if(_0x2a0de8===_0x4be2d5)break;else _0x17666a['push'](_0x17666a['shift']());}catch(_0x3e4b84){_0x17666a['push'](_0x17666a['shift']());}}}(a132_0x1468,0x37ae2));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a132_0x1468(){const _0x4f887e=['sqlRootDir','appCode','809404AGqgSH','1535XNBxbw','sqls','fromEntries','Would\x20delete\x20SQL\x20','SQL\x20lock\x20file\x20not\x20found.','13TCpfZb','filter','projectRoot','str','validation','sql','POST','remoteId','2658MBWfLQ','high-risk-write','lockFilePath','lastSync','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','410709ieCDvo','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','delete','entries','toISOString','1501941pxbfye','160713HuOsHv','100uFKTKc','trashDir','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','sqlcode','11THAZbC','Deleted\x20','length','sqlRoot','6253428zlUnGR','8278tchgGl','replace','8rsjqyU'];a132_0x1468=function(){return _0x4f887e;};return a132_0x1468();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a132_0x19748a(0xe9),'command':a132_0x19748a(0xf3),'description':a132_0x19748a(0xf2),'risk':a132_0x19748a(0xed),'flags':[SQLCODE_FLAG],async 'validate'(_0x547d3e){const _0x4ec519=a132_0x19748a,_0x17204e=loadSqlProjectConfig(_0x547d3e[_0x4ec519(0x106)]),_0x3e63d1=await readSqlLockFile(_0x17204e[_0x4ec519(0xee)]);if(!_0x3e63d1)throw CliErrors['validation'](_0x4ec519(0xfa));},async 'dryRun'(_0x387f0e){const _0x26f271=a132_0x19748a,_0x16ec97=loadSqlProjectConfig(_0x387f0e[_0x26f271(0x106)]),_0x3562c9=await readSqlLockFile(_0x16ec97[_0x26f271(0xee)]);if(!_0x3562c9)throw CliErrors[_0x26f271(0xe8)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x27282f}=ensureSqlLockScope(_0x3562c9,_0x387f0e[_0x26f271(0x106)],_0x16ec97['sqlRoot'],'delete'),_0x37e2d2=_0x387f0e[_0x26f271(0xe7)](_0x26f271(0xfc)),_0x5f01df=_0x27282f['sqls'][_0x37e2d2];if(!_0x5f01df)throw CliErrors[_0x26f271(0xe8)](_0x26f271(0xf0)+_0x37e2d2+'\x22.');return{'method':_0x26f271(0xea),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x37e2d2,'id':_0x5f01df[_0x26f271(0xeb)],'localPath':resolveLocalSqlFilePath(_0x16ec97,_0x37e2d2,_0x5f01df)},'description':_0x26f271(0xe2)+_0x37e2d2+_0x26f271(0xfb)+_0x16ec97[_0x26f271(0xf9)]};},async 'execute'(_0x2a355d){const _0x24e9cf=a132_0x19748a,_0x1ca51d=loadSqlProjectConfig(_0x2a355d[_0x24e9cf(0x106)]),_0x3be289=await readSqlLockFile(_0x1ca51d['lockFilePath']);if(!_0x3be289)throw CliErrors[_0x24e9cf(0xe8)](_0x24e9cf(0xe3));const {lockData:_0x444506,appLock:_0x42065a}=ensureSqlLockScope(_0x3be289,_0x2a355d[_0x24e9cf(0x106)],_0x1ca51d[_0x24e9cf(0x100)],_0x24e9cf(0xf3)),_0x527afa=_0x2a355d[_0x24e9cf(0xe7)]('sqlcode'),_0x109278=_0x42065a[_0x24e9cf(0xe0)][_0x527afa];if(!_0x109278)throw CliErrors[_0x24e9cf(0xe8)](_0x24e9cf(0xf0)+_0x527afa+'\x22.');await deleteSqlQuery({'id':_0x109278[_0x24e9cf(0xeb)],'sqlCode':_0x527afa}),_0x42065a[_0x24e9cf(0xe0)]=Object[_0x24e9cf(0xe1)](Object[_0x24e9cf(0xf4)](_0x42065a[_0x24e9cf(0xe0)])[_0x24e9cf(0xe5)](([_0x25782b])=>_0x25782b!==_0x527afa)),_0x42065a[_0x24e9cf(0xef)]=new Date()[_0x24e9cf(0xf5)](),await writeSqlLockFile(_0x1ca51d[_0x24e9cf(0xee)],_0x444506);const _0x1add17=resolveLocalSqlFilePath(_0x1ca51d,_0x527afa,_0x109278);let _0x12a95c;await fileExists(_0x1add17)&&(_0x12a95c=await moveToTrash(_0x1ca51d[_0x24e9cf(0xe6)],_0x1ca51d[_0x24e9cf(0xf9)],_0x1add17),await cleanupEmptyDirectories(dirname(_0x1add17),_0x1ca51d[_0x24e9cf(0x105)]));const _0x57d239={'deleted':_0x527afa,'remoteId':_0x109278['remoteId']};if(_0x12a95c)_0x57d239['trashedTo']=_0x12a95c;return{'ok':!![],'data':_0x57d239,'message':_0x24e9cf(0xfe)+_0x527afa+(_0x12a95c?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x2ac96a,_0x5c2298,_0x3017ce){const _0x24cecb=a132_0x19748a,_0x2994b1=new Date()[_0x24cecb(0xf5)]()[_0x24cecb(0x103)](/[:.]/g,'-'),_0x4b64e6=relative(_0x2ac96a,_0x3017ce),_0x4984e9=join(_0x5c2298,_0x2994b1,_0x4b64e6);return await mkdir(dirname(_0x4984e9),{'recursive':!![]}),await rename(_0x3017ce,_0x4984e9),_0x4984e9;}function a132_0x359b(_0x3d10e3,_0x286983){_0x3d10e3=_0x3d10e3-0xe0;const _0x146843=a132_0x1468();let _0x359b9c=_0x146843[_0x3d10e3];return _0x359b9c;}async function cleanupEmptyDirectories(_0x38f4aa,_0x58da6b){const _0x22f4e6=a132_0x19748a;let _0x481395=resolve(_0x38f4aa);const _0x25988e=resolve(_0x58da6b);while(_0x481395['startsWith'](''+_0x25988e+sep)||_0x481395===_0x25988e){if(_0x481395===_0x25988e)return;try{const _0x351f6c=await readdir(_0x481395);if(_0x351f6c[_0x22f4e6(0xff)]>0x0)return;await rmdir(_0x481395);}catch{return;}_0x481395=dirname(_0x481395);}}
@@ -1 +1 @@
1
- const a132_0x22d0e1=a132_0x2ed9;function a132_0x2ed9(_0x3a5548,_0x1b7b55){_0x3a5548=_0x3a5548-0xc7;const _0x43be1f=a132_0x43be();let _0x2ed996=_0x43be1f[_0x3a5548];return _0x2ed996;}(function(_0x593126,_0x1dc95d){const _0x875487=a132_0x2ed9,_0x1d05e9=_0x593126();while(!![]){try{const _0x541fac=-parseInt(_0x875487(0xc8))/0x1+parseInt(_0x875487(0xd7))/0x2+parseInt(_0x875487(0xd2))/0x3*(-parseInt(_0x875487(0xdd))/0x4)+-parseInt(_0x875487(0xd0))/0x5*(-parseInt(_0x875487(0xdc))/0x6)+parseInt(_0x875487(0xdf))/0x7+parseInt(_0x875487(0xd3))/0x8+parseInt(_0x875487(0xc7))/0x9*(-parseInt(_0x875487(0xcc))/0xa);if(_0x541fac===_0x1dc95d)break;else _0x1d05e9['push'](_0x1d05e9['shift']());}catch(_0x27dc2b){_0x1d05e9['push'](_0x1d05e9['shift']());}}}(a132_0x43be,0x42b1e));import{getSqlQueryInfo}from'../../core/api-client.js';function a132_0x43be(){const _0x182be9=['verbose','bool','36535RAKWev','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','51AEOofX','2618792oxAHkB','sqlName','appCode','read','769116MTTxlN','sqlcode','str','sqlContent','sql','402rJQjWO','35172WhQDVC','dbId','615328XYmtRU','144QfuOmd','469629EttEOZ','detail','Return\x20full\x20raw\x20SQL\x20query\x20object','sqlCode','248180qnCfMS','boolean'];a132_0x43be=function(){return _0x182be9;};return a132_0x43be();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a132_0x22d0e1(0xdb),'command':a132_0x22d0e1(0xc9),'description':a132_0x22d0e1(0xd1),'risk':a132_0x22d0e1(0xd6),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a132_0x22d0e1(0xcd),'description':a132_0x22d0e1(0xca)}],async 'execute'(_0x4a86a9){const _0x199b39=a132_0x22d0e1,_0x4976e3=await getSqlQueryInfo(_0x4a86a9['appCode'],_0x4a86a9[_0x199b39(0xd9)](_0x199b39(0xd8))),_0x33a7df=_0x4a86a9[_0x199b39(0xcf)](_0x199b39(0xce));if(_0x33a7df)return{'ok':!![],'data':_0x4976e3};const _0x10685c=_0x4976e3['dbId']?await getDbName(_0x4a86a9[_0x199b39(0xd5)],_0x4976e3['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x4976e3[_0x199b39(0xcb)],'sqlName':_0x4976e3[_0x199b39(0xd4)],'db':_0x10685c?_0x10685c+'\x20('+_0x4976e3[_0x199b39(0xde)]+')':_0x4976e3['dbId']??'','description':_0x4976e3['description']??'','sqlContent':_0x4976e3[_0x199b39(0xda)]??''}};}};
1
+ const a133_0x1095d3=a133_0x3ec0;(function(_0x1fcf43,_0x640c9c){const _0x3a2c3e=a133_0x3ec0,_0x38d907=_0x1fcf43();while(!![]){try{const _0x3dbe0a=parseInt(_0x3a2c3e(0x8c))/0x1*(parseInt(_0x3a2c3e(0x7f))/0x2)+parseInt(_0x3a2c3e(0x7e))/0x3*(-parseInt(_0x3a2c3e(0x85))/0x4)+-parseInt(_0x3a2c3e(0x81))/0x5*(parseInt(_0x3a2c3e(0x8b))/0x6)+parseInt(_0x3a2c3e(0x8a))/0x7+parseInt(_0x3a2c3e(0x8e))/0x8*(-parseInt(_0x3a2c3e(0x82))/0x9)+-parseInt(_0x3a2c3e(0x8d))/0xa*(parseInt(_0x3a2c3e(0x80))/0xb)+parseInt(_0x3a2c3e(0x93))/0xc*(parseInt(_0x3a2c3e(0x86))/0xd);if(_0x3dbe0a===_0x640c9c)break;else _0x38d907['push'](_0x38d907['shift']());}catch(_0x11ae0a){_0x38d907['push'](_0x38d907['shift']());}}}(a133_0x131a,0x950ed));function a133_0x3ec0(_0xa8b361,_0xe384db){_0xa8b361=_0xa8b361-0x7e;const _0x131ac4=a133_0x131a();let _0x3ec0af=_0x131ac4[_0xa8b361];return _0x3ec0af;}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a133_0x131a(){const _0x1c785a=['13RmRBNA','sqlName','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','boolean','4537547YLzpTg','61278mZhEQz','49017CiiWGl','2890oQSPrz','8hxbrPd','dbId','appCode','description','str','26124612OjaWMg','3qsWXtM','6HwMThy','23903BGisSj','155ljmNPk','9856206wnqLFt','verbose','sqlContent','1288192ipVCiT'];a133_0x131a=function(){return _0x1c785a;};return a133_0x131a();}export const sqlDetail={'service':'sql','command':'detail','description':a133_0x1095d3(0x88),'risk':'read','flags':[SQLCODE_FLAG,{'name':a133_0x1095d3(0x83),'type':a133_0x1095d3(0x89),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x5cb5c1){const _0x388628=a133_0x1095d3,_0x1a76a4=await getSqlQueryInfo(_0x5cb5c1[_0x388628(0x90)],_0x5cb5c1[_0x388628(0x92)]('sqlcode')),_0x390eeb=_0x5cb5c1['bool'](_0x388628(0x83));if(_0x390eeb)return{'ok':!![],'data':_0x1a76a4};const _0x3aad45=_0x1a76a4['dbId']?await getDbName(_0x5cb5c1[_0x388628(0x90)],_0x1a76a4[_0x388628(0x8f)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x1a76a4['sqlCode'],'sqlName':_0x1a76a4[_0x388628(0x87)],'db':_0x3aad45?_0x3aad45+'\x20('+_0x1a76a4[_0x388628(0x8f)]+')':_0x1a76a4[_0x388628(0x8f)]??'','description':_0x1a76a4[_0x388628(0x91)]??'','sqlContent':_0x1a76a4[_0x388628(0x84)]??''}};}};
@@ -1 +1 @@
1
- const a133_0x5b7fae=a133_0xaed9;(function(_0x4bd2ce,_0x356790){const _0x5828fc=a133_0xaed9,_0x5acd71=_0x4bd2ce();while(!![]){try{const _0x40ceef=-parseInt(_0x5828fc(0x7f))/0x1+-parseInt(_0x5828fc(0x8b))/0x2*(-parseInt(_0x5828fc(0x88))/0x3)+parseInt(_0x5828fc(0x87))/0x4+parseInt(_0x5828fc(0x8e))/0x5+-parseInt(_0x5828fc(0x8a))/0x6+parseInt(_0x5828fc(0x80))/0x7+parseInt(_0x5828fc(0x85))/0x8*(parseInt(_0x5828fc(0x7c))/0x9);if(_0x40ceef===_0x356790)break;else _0x5acd71['push'](_0x5acd71['shift']());}catch(_0x570a89){_0x5acd71['push'](_0x5acd71['shift']());}}}(a133_0x536f,0x4f6a3));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a133_0x536f(){const _0x152b22=['now','16KOhoNy','sqlcode','270908aGHhMz','105MkdvBY','sql','3623034dIiegN','7258rTwgxi','SQL\x20execution\x20failed','execError','2656980RfJDhl','length','appCode','\x20row(s)\x20in\x20','1402425xwGWru','str','params','599796YkEMVP','3437910BsuSck','string','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','execSuccess'];a133_0x536f=function(){return _0x152b22;};return a133_0x536f();}function a133_0xaed9(_0x40f4e1,_0x4b0feb){_0x40f4e1=_0x40f4e1-0x7c;const _0x536f9e=a133_0x536f();let _0xaed9d5=_0x536f9e[_0x40f4e1];return _0xaed9d5;}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a133_0x5b7fae(0x89),'command':'exec','description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':'read','flags':[SQLCODE_FLAG,{'name':'params','type':a133_0x5b7fae(0x81),'description':a133_0x5b7fae(0x82)}],async 'execute'(_0x4ae3fe){const _0x1e88d6=a133_0x5b7fae,_0x20a7b1=parseJsonParams(_0x4ae3fe['str'](_0x1e88d6(0x7e))),_0x2ab0a0=Date['now'](),_0x1c2b50=await executeSql(_0x4ae3fe[_0x1e88d6(0x90)],_0x4ae3fe[_0x1e88d6(0x7d)](_0x1e88d6(0x86)),_0x20a7b1),_0x536877=Date[_0x1e88d6(0x84)]()-_0x2ab0a0,_0x4b705=_0x1c2b50?.['execResult']??_0x1c2b50,_0x3d5382=_0x1c2b50?.[_0x1e88d6(0x83)]??!![];if(!_0x3d5382)return{'ok':![],'data':{'error':_0x1c2b50?.[_0x1e88d6(0x8d)]||'SQL\x20execution\x20failed','elapsed':_0x536877},'message':_0x1e88d6(0x8c)};const _0x3a180d=Array['isArray'](_0x4b705)?_0x4b705:[];return{'ok':!![],'data':{'rows':_0x3a180d,'rowCount':_0x3a180d[_0x1e88d6(0x8f)],'elapsed':_0x536877},'message':'Returned\x20'+_0x3a180d['length']+_0x1e88d6(0x91)+_0x536877+'ms'};}};
1
+ const a134_0x50eec7=a134_0x5f1c;function a134_0x5f1c(_0x71d25b,_0x4f87be){_0x71d25b=_0x71d25b-0xf2;const _0x1cbab6=a134_0x1cba();let _0x5f1c69=_0x1cbab6[_0x71d25b];return _0x5f1c69;}(function(_0x486d96,_0x1244d0){const _0x38a868=a134_0x5f1c,_0x2516da=_0x486d96();while(!![]){try{const _0x307995=parseInt(_0x38a868(0x10b))/0x1+-parseInt(_0x38a868(0xf3))/0x2*(parseInt(_0x38a868(0xf5))/0x3)+-parseInt(_0x38a868(0xf6))/0x4*(-parseInt(_0x38a868(0x105))/0x5)+parseInt(_0x38a868(0x109))/0x6+parseInt(_0x38a868(0xff))/0x7*(-parseInt(_0x38a868(0x102))/0x8)+parseInt(_0x38a868(0x107))/0x9*(parseInt(_0x38a868(0xfa))/0xa)+parseInt(_0x38a868(0xfb))/0xb*(-parseInt(_0x38a868(0x100))/0xc);if(_0x307995===_0x1244d0)break;else _0x2516da['push'](_0x2516da['shift']());}catch(_0x320966){_0x2516da['push'](_0x2516da['shift']());}}}(a134_0x1cba,0x46068));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a134_0x1cba(){const _0x3ab28a=['str','413198YEZSRn','SQL\x20execution\x20failed','3xWNaGw','7492EqHFVK','execResult','sql','string','264670nYxSVh','11fMxHXW','Returned\x20','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','length','14QEfOul','6675636KreKOn','execSuccess','672416QHhiGr','params','read','1310CHKTNz','isArray','45RoCQgY','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','275580bUAfqQ','appCode','548839CFhrcM'];a134_0x1cba=function(){return _0x3ab28a;};return a134_0x1cba();}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a134_0x50eec7(0xf8),'command':'exec','description':a134_0x50eec7(0xfd),'risk':a134_0x50eec7(0x104),'flags':[SQLCODE_FLAG,{'name':a134_0x50eec7(0x103),'type':a134_0x50eec7(0xf9),'description':a134_0x50eec7(0x108)}],async 'execute'(_0x224a2c){const _0x6788f9=a134_0x50eec7,_0x46e187=parseJsonParams(_0x224a2c[_0x6788f9(0xf2)](_0x6788f9(0x103))),_0x848ccd=Date['now'](),_0x8b9f7c=await executeSql(_0x224a2c[_0x6788f9(0x10a)],_0x224a2c[_0x6788f9(0xf2)]('sqlcode'),_0x46e187),_0x1e2272=Date['now']()-_0x848ccd,_0x15f048=_0x8b9f7c?.[_0x6788f9(0xf7)]??_0x8b9f7c,_0x333a38=_0x8b9f7c?.[_0x6788f9(0x101)]??!![];if(!_0x333a38)return{'ok':![],'data':{'error':_0x8b9f7c?.['execError']||_0x6788f9(0xf4),'elapsed':_0x1e2272},'message':'SQL\x20execution\x20failed'};const _0x588a10=Array[_0x6788f9(0x106)](_0x15f048)?_0x15f048:[];return{'ok':!![],'data':{'rows':_0x588a10,'rowCount':_0x588a10['length'],'elapsed':_0x1e2272},'message':_0x6788f9(0xfc)+_0x588a10[_0x6788f9(0xfe)]+'\x20row(s)\x20in\x20'+_0x1e2272+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x15975a,_0x2ccd36){const _0x58ce89=a134_0xb5f5,_0x3aa22e=_0x15975a();while(!![]){try{const _0x194b14=parseInt(_0x58ce89(0x117))/0x1+parseInt(_0x58ce89(0x11c))/0x2*(parseInt(_0x58ce89(0x116))/0x3)+-parseInt(_0x58ce89(0x114))/0x4+-parseInt(_0x58ce89(0x118))/0x5+-parseInt(_0x58ce89(0x119))/0x6*(-parseInt(_0x58ce89(0x11d))/0x7)+parseInt(_0x58ce89(0x11a))/0x8+parseInt(_0x58ce89(0x115))/0x9*(-parseInt(_0x58ce89(0x11b))/0xa);if(_0x194b14===_0x2ccd36)break;else _0x3aa22e['push'](_0x3aa22e['shift']());}catch(_0x2d4a1b){_0x3aa22e['push'](_0x3aa22e['shift']());}}}(a134_0x33e2,0xf4148));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';function a134_0x33e2(){const _0xdfc915=['1905792ZUlFaJ','31495599TTLERQ','39JBqcoM','1115045PzYSTj','2007835AEHpRO','486PeGePC','14051080efLtiM','10gQBbPA','146266xJtpRL','134393BpiRKz'];a134_0x33e2=function(){return _0xdfc915;};return a134_0x33e2();}import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';function a134_0xb5f5(_0x2f90bb,_0x30b4af){_0x2f90bb=_0x2f90bb-0x114;const _0x33e233=a134_0x33e2();let _0xb5f57c=_0x33e233[_0x2f90bb];return _0xb5f57c;}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,sqlSave,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x4579ab,_0x221dfc){const _0x4538aa=a135_0x1852,_0x14a91c=_0x4579ab();while(!![]){try{const _0x4a029d=parseInt(_0x4538aa(0x72))/0x1*(parseInt(_0x4538aa(0x78))/0x2)+-parseInt(_0x4538aa(0x75))/0x3+parseInt(_0x4538aa(0x79))/0x4+-parseInt(_0x4538aa(0x73))/0x5*(-parseInt(_0x4538aa(0x74))/0x6)+-parseInt(_0x4538aa(0x71))/0x7*(parseInt(_0x4538aa(0x7a))/0x8)+parseInt(_0x4538aa(0x7b))/0x9*(parseInt(_0x4538aa(0x77))/0xa)+parseInt(_0x4538aa(0x76))/0xb;if(_0x4a029d===_0x221dfc)break;else _0x14a91c['push'](_0x14a91c['shift']());}catch(_0x263773){_0x14a91c['push'](_0x14a91c['shift']());}}}(a135_0x223f,0x5e8cc));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a135_0x1852(_0x41281e,_0x47c5af){_0x41281e=_0x41281e-0x71;const _0x223fa8=a135_0x223f();let _0x185285=_0x223fa8[_0x41281e];return _0x185285;}import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';function a135_0x223f(){const _0x243d12=['1305695jethjB','6JhzCel','636273jolamL','3965346AaHPHq','28260mBltwB','338LqUppN','881388aSbmIO','864232eFCIkA','603yFROwp','28szEyyd','1QXWKkd'];a135_0x223f=function(){return _0x243d12;};return a135_0x223f();}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,sqlSave,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a135_0x3b34cf=a135_0xaffc;(function(_0x2625a6,_0x1c9c0d){const _0x5ebad9=a135_0xaffc,_0x25723e=_0x2625a6();while(!![]){try{const _0x592605=parseInt(_0x5ebad9(0xed))/0x1+parseInt(_0x5ebad9(0xee))/0x2+-parseInt(_0x5ebad9(0xff))/0x3+-parseInt(_0x5ebad9(0xea))/0x4*(parseInt(_0x5ebad9(0x10a))/0x5)+parseInt(_0x5ebad9(0xf4))/0x6*(-parseInt(_0x5ebad9(0xfd))/0x7)+-parseInt(_0x5ebad9(0xf5))/0x8+parseInt(_0x5ebad9(0x107))/0x9;if(_0x592605===_0x1c9c0d)break;else _0x25723e['push'](_0x25723e['shift']());}catch(_0x399cee){_0x25723e['push'](_0x25723e['shift']());}}}(a135_0x12b8,0xa1f6e));function a135_0x12b8(){const _0x5a258a=['list','page','length','all','boolean','sqlcode','11790801eMBxZT','read','name','3935ZBQsFq','appCode','No\x20custom\x20SQL\x20queries\x20found.','sqlName','paging','Filter\x20by\x20SQL\x20name','2636iBbtVo','List\x20custom\x20SQL\x20queries','pagesize','865268bfedOY','2164100GtKaeb','Page\x20size','number','verbose','bool','num','1386FZVFBu','6390632EWNcOG','map','Found\x20','totalCount','dbId','Page\x20number','str','\x20SQL\x20queries\x20(total:\x20','22295DKtlsT','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','1622412VRvvAs','sqlCode'];a135_0x12b8=function(){return _0x5a258a;};return a135_0x12b8();}import{listSqlQueries}from'../../core/api-client.js';function a135_0xaffc(_0x58c199,_0x5e9c84){_0x58c199=_0x58c199-0xe7;const _0x12b82b=a135_0x12b8();let _0xaffcbf=_0x12b82b[_0x58c199];return _0xaffcbf;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a135_0x3b34cf(0x101),'description':a135_0x3b34cf(0xeb),'risk':a135_0x3b34cf(0x108),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a135_0x3b34cf(0x109),'type':'string','description':a135_0x3b34cf(0xe9)},{'name':'page','type':a135_0x3b34cf(0xf0),'description':a135_0x3b34cf(0xfa),'default':0x1},{'name':a135_0x3b34cf(0xec),'type':a135_0x3b34cf(0xf0),'description':a135_0x3b34cf(0xef)},{'name':a135_0x3b34cf(0xf1),'type':a135_0x3b34cf(0x105),'description':a135_0x3b34cf(0xfe)}],async 'execute'(_0x306808){const _0x4b1df4=a135_0x3b34cf,_0x5ca5cc=await listSqlQueries(_0x306808[_0x4b1df4(0x10b)],{'sqlCode':_0x306808[_0x4b1df4(0xfb)](_0x4b1df4(0x106))||undefined,'sqlName':_0x306808['str'](_0x4b1df4(0x109))||undefined,'currentPage':_0x306808['num'](_0x4b1df4(0x102)),'pageSize':_0x306808[_0x4b1df4(0xf3)]('pagesize',0x32)}),_0x26f24d=_0x306808[_0x4b1df4(0xf2)](_0x4b1df4(0xf1)),_0x1626fb=_0x5ca5cc['tableData']??[],_0x3e1536=_0x5ca5cc[_0x4b1df4(0xe8)]?.[_0x4b1df4(0xf8)]??_0x1626fb['length'];let _0x5d627a;return _0x26f24d?_0x5d627a=_0x1626fb:_0x5d627a=await Promise[_0x4b1df4(0x104)](_0x1626fb[_0x4b1df4(0xf6)](async _0x32ed03=>{const _0x517083=_0x4b1df4;let _0x408970;try{_0x408970=_0x32ed03[_0x517083(0xf9)]?await getDbName(_0x306808[_0x517083(0x10b)],_0x32ed03['dbId']):undefined;}catch{}return{'sqlCode':_0x32ed03[_0x517083(0x100)],'sqlName':_0x32ed03[_0x517083(0xe7)],'description':_0x32ed03['description']??'','db':_0x408970?_0x408970+'\x20('+_0x32ed03[_0x517083(0xf9)]+')':_0x32ed03[_0x517083(0xf9)]??''};})),{'ok':!![],'data':_0x5d627a,'message':_0x1626fb[_0x4b1df4(0x103)]===0x0?_0x4b1df4(0x10c):_0x4b1df4(0xf7)+_0x1626fb[_0x4b1df4(0x103)]+_0x4b1df4(0xfc)+_0x3e1536+').'};}};
1
+ const a136_0x3ac9a6=a136_0x52a5;function a136_0x58ac(){const _0xe8499=['list','6jEmXIm','description','totalCount','read','sqlcode','str','map','all','pagesize','7381323dvWbZR','sqlName','page','dbId','347345aoJJOq','913209tTuXQm','num','Found\x20','name','paging','sql','644706ObdpYM','List\x20custom\x20SQL\x20queries','296okflYX','3199KtcGJn','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','1453195UuwvZA','Page\x20size','verbose','sqlCode','appCode','string','length','number','1229176XYjOyL'];a136_0x58ac=function(){return _0xe8499;};return a136_0x58ac();}(function(_0x1df098,_0x95516d){const _0x17f1aa=a136_0x52a5,_0x145cd1=_0x1df098();while(!![]){try{const _0x9efaae=parseInt(_0x17f1aa(0x1bb))/0x1+parseInt(_0x17f1aa(0x19f))/0x2+parseInt(_0x17f1aa(0x1bc))/0x3+parseInt(_0x17f1aa(0x1ac))/0x4+parseInt(_0x17f1aa(0x1a4))/0x5*(-parseInt(_0x17f1aa(0x1ae))/0x6)+-parseInt(_0x17f1aa(0x1a2))/0x7*(-parseInt(_0x17f1aa(0x1a1))/0x8)+-parseInt(_0x17f1aa(0x1b7))/0x9;if(_0x9efaae===_0x95516d)break;else _0x145cd1['push'](_0x145cd1['shift']());}catch(_0x289a6f){_0x145cd1['push'](_0x145cd1['shift']());}}}(a136_0x58ac,0x2dc7e));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a136_0x52a5(_0x45c975,_0x4c98a8){_0x45c975=_0x45c975-0x19d;const _0x58aca0=a136_0x58ac();let _0x52a5c2=_0x58aca0[_0x45c975];return _0x52a5c2;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a136_0x3ac9a6(0x19e),'command':a136_0x3ac9a6(0x1ad),'description':a136_0x3ac9a6(0x1a0),'risk':a136_0x3ac9a6(0x1b1),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a136_0x3ac9a6(0x1bf),'type':a136_0x3ac9a6(0x1a9),'description':'Filter\x20by\x20SQL\x20name'},{'name':a136_0x3ac9a6(0x1b9),'type':'number','description':'Page\x20number','default':0x1},{'name':a136_0x3ac9a6(0x1b6),'type':a136_0x3ac9a6(0x1ab),'description':a136_0x3ac9a6(0x1a5)},{'name':a136_0x3ac9a6(0x1a6),'type':'boolean','description':a136_0x3ac9a6(0x1a3)}],async 'execute'(_0x105a7f){const _0x4c64fa=a136_0x3ac9a6,_0x4e53dc=await listSqlQueries(_0x105a7f[_0x4c64fa(0x1a8)],{'sqlCode':_0x105a7f['str'](_0x4c64fa(0x1b2))||undefined,'sqlName':_0x105a7f[_0x4c64fa(0x1b3)](_0x4c64fa(0x1bf))||undefined,'currentPage':_0x105a7f['num'](_0x4c64fa(0x1b9)),'pageSize':_0x105a7f[_0x4c64fa(0x1bd)](_0x4c64fa(0x1b6),0x32)}),_0x309296=_0x105a7f['bool'](_0x4c64fa(0x1a6)),_0x4f8d7e=_0x4e53dc['tableData']??[],_0x1f6f40=_0x4e53dc[_0x4c64fa(0x19d)]?.[_0x4c64fa(0x1b0)]??_0x4f8d7e[_0x4c64fa(0x1aa)];let _0x1ebbc6;return _0x309296?_0x1ebbc6=_0x4f8d7e:_0x1ebbc6=await Promise[_0x4c64fa(0x1b5)](_0x4f8d7e[_0x4c64fa(0x1b4)](async _0x2cf969=>{const _0x2eb36a=_0x4c64fa;let _0x4fb6ef;try{_0x4fb6ef=_0x2cf969[_0x2eb36a(0x1ba)]?await getDbName(_0x105a7f[_0x2eb36a(0x1a8)],_0x2cf969[_0x2eb36a(0x1ba)]):undefined;}catch{}return{'sqlCode':_0x2cf969[_0x2eb36a(0x1a7)],'sqlName':_0x2cf969[_0x2eb36a(0x1b8)],'description':_0x2cf969[_0x2eb36a(0x1af)]??'','db':_0x4fb6ef?_0x4fb6ef+'\x20('+_0x2cf969[_0x2eb36a(0x1ba)]+')':_0x2cf969[_0x2eb36a(0x1ba)]??''};})),{'ok':!![],'data':_0x1ebbc6,'message':_0x4f8d7e[_0x4c64fa(0x1aa)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x4c64fa(0x1be)+_0x4f8d7e[_0x4c64fa(0x1aa)]+'\x20SQL\x20queries\x20(total:\x20'+_0x1f6f40+').'};}};
@@ -1 +1 @@
1
- const a136_0x5549d3=a136_0x24b6;(function(_0x14ead0,_0x28d9fa){const _0x4e2093=a136_0x24b6,_0x444f2b=_0x14ead0();while(!![]){try{const _0x540678=-parseInt(_0x4e2093(0x11d))/0x1+parseInt(_0x4e2093(0x12f))/0x2*(-parseInt(_0x4e2093(0x103))/0x3)+parseInt(_0x4e2093(0x112))/0x4*(parseInt(_0x4e2093(0x12e))/0x5)+-parseInt(_0x4e2093(0x127))/0x6+parseInt(_0x4e2093(0x13b))/0x7+-parseInt(_0x4e2093(0x111))/0x8+parseInt(_0x4e2093(0x131))/0x9;if(_0x540678===_0x28d9fa)break;else _0x444f2b['push'](_0x444f2b['shift']());}catch(_0x2b4844){_0x444f2b['push'](_0x444f2b['shift']());}}}(a136_0x4085,0x7e4f2));function a136_0x24b6(_0x472b5a,_0x2ee63a){_0x472b5a=_0x472b5a-0x101;const _0x408526=a136_0x4085();let _0x24b66c=_0x408526[_0x472b5a];return _0x24b66c;}import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';function a136_0x4085(){const _0x11b4ef=['mybatisXml','Would\x20pull\x20','POST','Force\x20overwrite\x20local\x20unsynced\x20changes','skipped','catch','833165Krepiq','58WzFaEp','totalCount','3878118iaOSWA','pull','lockFilePath','Filter\x20by\x20SQL\x20display\x20name','sqlContent','filter','bool','description','local\x20differs\x20from\x20remote','sqlRoot','3735543IvtVJI','split','sqlcode','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','boolean','60633YPBvbP','\x20SQL\x20file(s)\x20into\x20','sql','dbId','test','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','force','No\x20remote\x20SQL\x20queries\x20matched.','would_pull','Force\x20pull\x20cancelled.','utf8','\x20written,\x20','Pull\x20complete:\x20','sqlRootDir','1841064IDKUTL','20OhwFEd','write','lastSync','unchanged','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','name','push','tableData','string','str','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','92345DAsWOa','paging','sqlName','length','cancelled','toISOString','sqlCode','path','\x20skipped,\x20','appCode','2230542eutmIx'];a136_0x4085=function(){return _0x11b4ef;};return a136_0x4085();}import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x45c9c7,_0x4ba87f){const _0x1212df=a136_0x24b6,_0x5e728d=[];let _0xbc7fe0=0x1;while(!![]){const _0x5ead64=await listSqlQueries(_0x45c9c7,{'currentPage':_0xbc7fe0,'pageSize':PAGE_SIZE,'sqlCode':_0x4ba87f[_0x1212df(0x123)],'sqlName':_0x4ba87f[_0x1212df(0x11f)]}),_0x4d0529=_0x5ead64[_0x1212df(0x119)]??[];_0x5e728d['push'](..._0x4d0529);if(_0x4d0529[_0x1212df(0x120)]===0x0)break;const _0x281c98=_0x5ead64[_0x1212df(0x11e)]?.[_0x1212df(0x130)];if(_0x281c98!=null?_0x5e728d[_0x1212df(0x120)]>=_0x281c98:_0x4d0529['length']<PAGE_SIZE)break;_0xbc7fe0++;}return _0x5e728d;}async function ensureSqlContent(_0x445242){const _0x2e328d=a136_0x24b6;if(_0x445242[_0x2e328d(0x135)]!=null&&String(_0x445242[_0x2e328d(0x135)])['length']>0x0)return _0x445242;return getSqlQueryDetail(_0x445242[_0x2e328d(0x123)]);}export const sqlPull={'service':a136_0x5549d3(0x105),'command':a136_0x5549d3(0x132),'description':a136_0x5549d3(0x116),'risk':a136_0x5549d3(0x113),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a136_0x5549d3(0x117),'type':a136_0x5549d3(0x11a),'description':a136_0x5549d3(0x134)},{'name':'force','type':a136_0x5549d3(0x102),'description':a136_0x5549d3(0x12b)}],async 'dryRun'(_0x4a9e25){const _0x210da6=a136_0x5549d3,_0xc38489=loadSqlProjectConfig(_0x4a9e25['appCode']),_0x76bc58=await readSqlLockFile(_0xc38489[_0x210da6(0x133)]),{appLock:_0x5462a8}=ensureSqlLockScope(_0x76bc58??createEmptySqlLock(),_0xc38489[_0x210da6(0x126)],_0xc38489['sqlRoot'],'pull'),_0x377dc0=await fetchAllSqlQueries(_0x4a9e25[_0x210da6(0x126)],{'sqlCode':_0x4a9e25['str'](_0x210da6(0x13d))||undefined,'sqlName':_0x4a9e25[_0x210da6(0x11b)]('name')||undefined}),_0x394521=[];for(const _0x47661e of _0x377dc0){const _0x16349a=await ensureSqlContent(_0x47661e),_0x5e8395=ensureRemoteSqlContent(_0x16349a),_0x2db08a=detectModeFromSql(_0x16349a),_0x29b55d=_0x16349a[_0x210da6(0x106)]?await getDbName(_0x4a9e25['appCode'],Number(_0x16349a[_0x210da6(0x106)]))['catch'](()=>undefined):undefined,_0x2da5f6=buildLocalSqlFileContent({'sqlCode':_0x16349a[_0x210da6(0x123)],'sqlName':_0x16349a['sqlName'],'dbId':_0x16349a['dbId']},_0x5e8395,{'dbName':_0x29b55d,'mode':_0x2db08a,'syncedAt':new Date()[_0x210da6(0x122)](),'description':_0x16349a[_0x210da6(0x138)]}),_0x321309=buildSqlLockEntry(_0x16349a,_0x5e8395,'',{'dbName':_0x29b55d}),_0x57e96a=resolveLocalSqlFilePath(_0xc38489,_0x16349a[_0x210da6(0x123)],_0x321309);let _0xcd85e2=_0x210da6(0x10b),_0x46c4eb;if(await fileExists(_0x57e96a)){const _0x1f0a59=await readFile(_0x57e96a,_0x210da6(0x10d));isEquivalentPulledSqlFile(_0x1f0a59,_0x2da5f6,_0x2db08a)?(_0xcd85e2=_0x210da6(0x12c),_0x46c4eb=_0x210da6(0x115)):(_0xcd85e2='conflict',_0x46c4eb=_0x210da6(0x101));}_0x394521['push']({'sqlCode':_0x16349a['sqlCode'],'sqlName':_0x16349a[_0x210da6(0x11f)],'filePath':_0x57e96a,'status':_0xcd85e2,'reason':_0x46c4eb});}return{'method':_0x210da6(0x12a),'url':_0x210da6(0x11c),'body':{'appCode':_0x4a9e25[_0x210da6(0x126)],'sqlCode':_0x4a9e25['str']('sqlcode')||null,'sqlName':_0x4a9e25[_0x210da6(0x11b)](_0x210da6(0x117))||null,'files':_0x394521},'description':_0x210da6(0x129)+_0x394521[_0x210da6(0x120)]+_0x210da6(0x104)+_0xc38489['sqlRootDir']};},async 'execute'(_0x44eee6){const _0x49adab=a136_0x5549d3,_0x54e6b8=loadSqlProjectConfig(_0x44eee6[_0x49adab(0x126)]),_0x1a6d30=await readSqlLockFile(_0x54e6b8['lockFilePath']),{lockData:_0x4f366b,appLock:_0x5561cb}=ensureSqlLockScope(_0x1a6d30??createEmptySqlLock(),_0x54e6b8[_0x49adab(0x126)],_0x54e6b8[_0x49adab(0x13a)],'pull'),_0x908636=_0x44eee6[_0x49adab(0x137)](_0x49adab(0x109)),_0x455ec4=await fetchAllSqlQueries(_0x44eee6[_0x49adab(0x126)],{'sqlCode':_0x44eee6[_0x49adab(0x11b)](_0x49adab(0x13d))||undefined,'sqlName':_0x44eee6['str'](_0x49adab(0x117))||undefined});if(_0x455ec4[_0x49adab(0x120)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x49adab(0x10a)};const _0x477aeb=[],_0x59963d=[];for(const _0x340ab4 of _0x455ec4){try{_0x477aeb[_0x49adab(0x118)](await ensureSqlContent(_0x340ab4));}catch(_0x42b0cd){_0x59963d['push']({'sqlCode':_0x340ab4[_0x49adab(0x123)],'error':_0x42b0cd instanceof Error?_0x42b0cd['message']:String(_0x42b0cd)});}}if(_0x908636&&!_0x44eee6['nonInteractive']){let _0x381ebb=![];for(const _0x503270 of _0x477aeb){const _0x598dfc=detectModeFromSql(_0x503270),_0x1b1ad9=_0x503270[_0x49adab(0x106)]?await getDbName(_0x44eee6[_0x49adab(0x126)],Number(_0x503270[_0x49adab(0x106)]))['catch'](()=>undefined):undefined,_0x3b6e25=buildLocalSqlFileContent({'sqlCode':_0x503270[_0x49adab(0x123)],'sqlName':_0x503270['sqlName'],'dbId':_0x503270['dbId']},ensureRemoteSqlContent(_0x503270),{'dbName':_0x1b1ad9,'mode':_0x598dfc,'syncedAt':new Date()[_0x49adab(0x122)](),'description':_0x503270[_0x49adab(0x138)]}),_0x27e0ff=resolveLocalSqlFilePath(_0x54e6b8,_0x503270[_0x49adab(0x123)],buildSqlLockEntry(_0x503270,ensureRemoteSqlContent(_0x503270),'',{'dbName':_0x1b1ad9}));if(await fileExists(_0x27e0ff)){const _0x346cc0=await readFile(_0x27e0ff,_0x49adab(0x10d));if(!isEquivalentPulledSqlFile(_0x346cc0,_0x3b6e25,_0x598dfc)){_0x381ebb=!![];break;}}}if(_0x381ebb){const _0x3b4097=await confirmForceOverwrite(_0x49adab(0x108));if(!_0x3b4097)throw CliErrors[_0x49adab(0x121)](_0x49adab(0x10c));}}const _0x56752d=cloneSqlLockData(_0x4f366b),_0x27ea4c=_0x56752d['apps'][_0x54e6b8[_0x49adab(0x126)]],_0x301933=[],_0x484f1a=[];for(const _0x148e39 of _0x477aeb){const _0x3af83a=_0x27ea4c['sqls'][_0x148e39[_0x49adab(0x123)]],_0xb3f5a=ensureRemoteSqlContent(_0x148e39),_0x4ad4dc=detectModeFromSql(_0x148e39),_0x1fd6c7=_0x148e39[_0x49adab(0x106)]?await getDbName(_0x44eee6[_0x49adab(0x126)],Number(_0x148e39[_0x49adab(0x106)]))[_0x49adab(0x12d)](()=>undefined):undefined,_0x169fd9=buildLocalSqlFileContent({'sqlCode':_0x148e39['sqlCode'],'sqlName':_0x148e39[_0x49adab(0x11f)],'dbId':_0x148e39[_0x49adab(0x106)]},_0xb3f5a,{'dbName':_0x1fd6c7,'mode':_0x4ad4dc,'syncedAt':new Date()[_0x49adab(0x122)](),'description':_0x148e39[_0x49adab(0x138)]}),_0x1ac33e=buildSqlLockEntry(_0x148e39,_0xb3f5a,computeSqlContentHash(_0x169fd9),{'dbName':_0x1fd6c7}),_0xe216a7=_0x1ac33e[_0x49adab(0x124)],_0x45f202=join(_0x54e6b8[_0x49adab(0x110)],_0xe216a7);try{if(await fileExists(_0x45f202)){const _0x33efe9=await readFile(_0x45f202,_0x49adab(0x10d));if(isEquivalentPulledSqlFile(_0x33efe9,_0x169fd9,_0x4ad4dc)){_0x484f1a[_0x49adab(0x118)]({'sqlCode':_0x148e39[_0x49adab(0x123)],'reason':_0x49adab(0x115)}),_0x27ea4c['sqls'][_0x148e39[_0x49adab(0x123)]]={..._0x1ac33e,'hash':computeSqlContentHash(_0x33efe9),'path':_0xe216a7};continue;}if(!_0x908636){_0x484f1a['push']({'sqlCode':_0x148e39[_0x49adab(0x123)],'reason':_0x49adab(0x139)});continue;}}const _0x3e82e0=_0x3af83a?.[_0x49adab(0x124)]?join(_0x54e6b8[_0x49adab(0x110)],_0x3af83a[_0x49adab(0x124)]):undefined;_0x3e82e0&&_0x3e82e0!==_0x45f202&&await fileExists(_0x3e82e0)&&await rm(_0x3e82e0,{'force':!![]}),await ensureParentDirectory(_0x45f202),await writeFile(_0x45f202,_0x169fd9,_0x49adab(0x10d)),_0x27ea4c['sqls'][_0x148e39[_0x49adab(0x123)]]={..._0x1ac33e,'path':_0xe216a7},_0x301933[_0x49adab(0x118)]({'sqlCode':_0x148e39[_0x49adab(0x123)],'filePath':_0x45f202});}catch(_0x2b8786){_0x59963d[_0x49adab(0x118)]({'sqlCode':_0x148e39[_0x49adab(0x123)],'error':_0x2b8786 instanceof Error?_0x2b8786['message']:String(_0x2b8786)});}}return _0x27ea4c[_0x49adab(0x114)]=new Date()[_0x49adab(0x122)](),await writeSqlLockFile(_0x54e6b8[_0x49adab(0x133)],_0x56752d),{'ok':_0x59963d[_0x49adab(0x120)]===0x0,'data':{'pulled':_0x301933,'skipped':_0x484f1a,'failed':_0x59963d},'message':_0x49adab(0x10f)+_0x301933[_0x49adab(0x120)]+_0x49adab(0x10e)+_0x484f1a['length']+_0x49adab(0x125)+_0x59963d[_0x49adab(0x120)]+'\x20failed'};}};function detectModeFromSql(_0x4f1fee){const _0x2542f5=a136_0x5549d3,_0x46823c=ensureRemoteSqlContent(_0x4f1fee),_0x45c8b8=stripLocalSqlMetadata(_0x46823c,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i['test'](_0x45c8b8))return'mybatisXml';return _0x2542f5(0x105);}function isEquivalentPulledSqlFile(_0x35fe42,_0x39d971,_0x5394a5){return normalizePullComparableContent(_0x35fe42,_0x5394a5)===normalizePullComparableContent(_0x39d971,_0x5394a5);}function normalizePullComparableContent(_0x704cab,_0x5eaa55){const _0x58b9d2=a136_0x5549d3,_0x13f9c3=_0x704cab['replace'](/\r\n/g,'\x0a')[_0x58b9d2(0x13c)]('\x0a'),_0x3f8f51=_0x13f9c3[_0x58b9d2(0x136)](_0x3beece=>!isSyncedAtMetadataLine(_0x3beece,_0x5eaa55));return _0x3f8f51['join']('\x0a');}function isSyncedAtMetadataLine(_0xae767c,_0x2ac8cb){const _0x507ad5=a136_0x5549d3;if(_0x2ac8cb===_0x507ad5(0x128))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0xae767c);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x507ad5(0x107)](_0xae767c);}
1
+ const a137_0x2be09e=a137_0x345b;(function(_0x2cb352,_0x513887){const _0x17e040=a137_0x345b,_0x140708=_0x2cb352();while(!![]){try{const _0x23c5d1=-parseInt(_0x17e040(0x169))/0x1+-parseInt(_0x17e040(0x18f))/0x2*(parseInt(_0x17e040(0x162))/0x3)+parseInt(_0x17e040(0x16a))/0x4+-parseInt(_0x17e040(0x16c))/0x5*(parseInt(_0x17e040(0x17f))/0x6)+parseInt(_0x17e040(0x16b))/0x7*(parseInt(_0x17e040(0x190))/0x8)+parseInt(_0x17e040(0x186))/0x9*(parseInt(_0x17e040(0x170))/0xa)+-parseInt(_0x17e040(0x178))/0xb*(parseInt(_0x17e040(0x173))/0xc);if(_0x23c5d1===_0x513887)break;else _0x140708['push'](_0x140708['shift']());}catch(_0x2af112){_0x140708['push'](_0x140708['shift']());}}}(a137_0x3e05,0xd0779));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';function a137_0x345b(_0x23f26b,_0x58c6e0){_0x23f26b=_0x23f26b-0x153;const _0x3e050a=a137_0x3e05();let _0x345bda=_0x3e050a[_0x23f26b];return _0x345bda;}function a137_0x3e05(){const _0x36a354=['POST','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','lockFilePath','conflict','replace','111sLpuME','cancelled','toISOString','mybatisXml','pull','sqlRootDir','sql','346470XFctke','6135936GCrsSq','49kewtCd','665XSxKZY','sqlRoot','description','sqlcode','930pIcVTR','name','\x20SQL\x20file(s)\x20into\x20','72360ewelOA','sqlCode','\x20failed','Pull\x20complete:\x20','appCode','2981UoecFX','str','unchanged','No\x20remote\x20SQL\x20queries\x20matched.','lastSync','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','7458kigwuI','test','push','bool','nonInteractive','Filter\x20by\x20SQL\x20display\x20name','utf8','147240okpXTQ','tableData','length','catch','write','Would\x20pull\x20','totalCount','sqls','message','24458TUnIBy','453496uwpqSg','local\x20differs\x20from\x20remote','\x20written,\x20','sqlName','boolean','skipped','join','sqlContent','force','path','dbId','would_pull'];a137_0x3e05=function(){return _0x36a354;};return a137_0x3e05();}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0xc1973f,_0xa622de){const _0x3c7619=a137_0x345b,_0x3846de=[];let _0x306ff8=0x1;while(!![]){const _0x351238=await listSqlQueries(_0xc1973f,{'currentPage':_0x306ff8,'pageSize':PAGE_SIZE,'sqlCode':_0xa622de['sqlCode'],'sqlName':_0xa622de[_0x3c7619(0x154)]}),_0x317ccd=_0x351238[_0x3c7619(0x187)]??[];_0x3846de[_0x3c7619(0x181)](..._0x317ccd);if(_0x317ccd[_0x3c7619(0x188)]===0x0)break;const _0x2e15b1=_0x351238['paging']?.[_0x3c7619(0x18c)];if(_0x2e15b1!=null?_0x3846de[_0x3c7619(0x188)]>=_0x2e15b1:_0x317ccd[_0x3c7619(0x188)]<PAGE_SIZE)break;_0x306ff8++;}return _0x3846de;}async function ensureSqlContent(_0x38381b){const _0x27a297=a137_0x345b;if(_0x38381b[_0x27a297(0x158)]!=null&&String(_0x38381b[_0x27a297(0x158)])[_0x27a297(0x188)]>0x0)return _0x38381b;return getSqlQueryDetail(_0x38381b[_0x27a297(0x174)]);}export const sqlPull={'service':'sql','command':a137_0x2be09e(0x166),'description':a137_0x2be09e(0x17d),'risk':a137_0x2be09e(0x18a),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a137_0x2be09e(0x171),'type':'string','description':a137_0x2be09e(0x184)},{'name':a137_0x2be09e(0x159),'type':a137_0x2be09e(0x155),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x81d779){const _0x1658bb=a137_0x2be09e,_0x331653=loadSqlProjectConfig(_0x81d779['appCode']),_0x41173f=await readSqlLockFile(_0x331653[_0x1658bb(0x15f)]),{appLock:_0x49cd6b}=ensureSqlLockScope(_0x41173f??createEmptySqlLock(),_0x331653['appCode'],_0x331653[_0x1658bb(0x16d)],_0x1658bb(0x166)),_0x392814=await fetchAllSqlQueries(_0x81d779[_0x1658bb(0x177)],{'sqlCode':_0x81d779['str']('sqlcode')||undefined,'sqlName':_0x81d779[_0x1658bb(0x179)](_0x1658bb(0x171))||undefined}),_0x3f7e8d=[];for(const _0x5998fe of _0x392814){const _0x456e70=await ensureSqlContent(_0x5998fe),_0x5a67b6=ensureRemoteSqlContent(_0x456e70),_0x4f4674=detectModeFromSql(_0x456e70),_0x56265f=_0x456e70[_0x1658bb(0x15b)]?await getDbName(_0x81d779[_0x1658bb(0x177)],Number(_0x456e70[_0x1658bb(0x15b)]))[_0x1658bb(0x189)](()=>undefined):undefined,_0x3baff9=buildLocalSqlFileContent({'sqlCode':_0x456e70['sqlCode'],'sqlName':_0x456e70['sqlName'],'dbId':_0x456e70[_0x1658bb(0x15b)]},_0x5a67b6,{'dbName':_0x56265f,'mode':_0x4f4674,'syncedAt':new Date()[_0x1658bb(0x164)](),'description':_0x456e70['description']}),_0x2d7b45=buildSqlLockEntry(_0x456e70,_0x5a67b6,'',{'dbName':_0x56265f}),_0x1a4032=resolveLocalSqlFilePath(_0x331653,_0x456e70[_0x1658bb(0x174)],_0x2d7b45);let _0x189ccf=_0x1658bb(0x15c),_0x12bfa1;if(await fileExists(_0x1a4032)){const _0x5d2f5d=await readFile(_0x1a4032,_0x1658bb(0x185));isEquivalentPulledSqlFile(_0x5d2f5d,_0x3baff9,_0x4f4674)?(_0x189ccf=_0x1658bb(0x156),_0x12bfa1=_0x1658bb(0x17a)):(_0x189ccf=_0x1658bb(0x160),_0x12bfa1=_0x1658bb(0x17e));}_0x3f7e8d[_0x1658bb(0x181)]({'sqlCode':_0x456e70[_0x1658bb(0x174)],'sqlName':_0x456e70['sqlName'],'filePath':_0x1a4032,'status':_0x189ccf,'reason':_0x12bfa1});}return{'method':_0x1658bb(0x15d),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x81d779['appCode'],'sqlCode':_0x81d779[_0x1658bb(0x179)](_0x1658bb(0x16f))||null,'sqlName':_0x81d779['str'](_0x1658bb(0x171))||null,'files':_0x3f7e8d},'description':_0x1658bb(0x18b)+_0x3f7e8d[_0x1658bb(0x188)]+_0x1658bb(0x172)+_0x331653[_0x1658bb(0x167)]};},async 'execute'(_0x561eaf){const _0x8bcba1=a137_0x2be09e,_0xe36566=loadSqlProjectConfig(_0x561eaf[_0x8bcba1(0x177)]),_0x29d396=await readSqlLockFile(_0xe36566[_0x8bcba1(0x15f)]),{lockData:_0x28acff,appLock:_0x2801bc}=ensureSqlLockScope(_0x29d396??createEmptySqlLock(),_0xe36566[_0x8bcba1(0x177)],_0xe36566[_0x8bcba1(0x16d)],_0x8bcba1(0x166)),_0x24a15f=_0x561eaf[_0x8bcba1(0x182)](_0x8bcba1(0x159)),_0x222815=await fetchAllSqlQueries(_0x561eaf[_0x8bcba1(0x177)],{'sqlCode':_0x561eaf[_0x8bcba1(0x179)](_0x8bcba1(0x16f))||undefined,'sqlName':_0x561eaf[_0x8bcba1(0x179)](_0x8bcba1(0x171))||undefined});if(_0x222815[_0x8bcba1(0x188)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x8bcba1(0x17b)};const _0x2820b1=[],_0x17d007=[];for(const _0x483e61 of _0x222815){try{_0x2820b1[_0x8bcba1(0x181)](await ensureSqlContent(_0x483e61));}catch(_0xe9c406){_0x17d007[_0x8bcba1(0x181)]({'sqlCode':_0x483e61[_0x8bcba1(0x174)],'error':_0xe9c406 instanceof Error?_0xe9c406[_0x8bcba1(0x18e)]:String(_0xe9c406)});}}if(_0x24a15f&&!_0x561eaf[_0x8bcba1(0x183)]){let _0x5423bb=![];for(const _0x1e1554 of _0x2820b1){const _0x1b3095=detectModeFromSql(_0x1e1554),_0x18bf96=_0x1e1554[_0x8bcba1(0x15b)]?await getDbName(_0x561eaf['appCode'],Number(_0x1e1554[_0x8bcba1(0x15b)]))['catch'](()=>undefined):undefined,_0x11db52=buildLocalSqlFileContent({'sqlCode':_0x1e1554[_0x8bcba1(0x174)],'sqlName':_0x1e1554[_0x8bcba1(0x154)],'dbId':_0x1e1554['dbId']},ensureRemoteSqlContent(_0x1e1554),{'dbName':_0x18bf96,'mode':_0x1b3095,'syncedAt':new Date()['toISOString'](),'description':_0x1e1554['description']}),_0x542dfd=resolveLocalSqlFilePath(_0xe36566,_0x1e1554[_0x8bcba1(0x174)],buildSqlLockEntry(_0x1e1554,ensureRemoteSqlContent(_0x1e1554),'',{'dbName':_0x18bf96}));if(await fileExists(_0x542dfd)){const _0x2f3575=await readFile(_0x542dfd,'utf8');if(!isEquivalentPulledSqlFile(_0x2f3575,_0x11db52,_0x1b3095)){_0x5423bb=!![];break;}}}if(_0x5423bb){const _0x3a5d3f=await confirmForceOverwrite(_0x8bcba1(0x15e));if(!_0x3a5d3f)throw CliErrors[_0x8bcba1(0x163)]('Force\x20pull\x20cancelled.');}}const _0x114f52=cloneSqlLockData(_0x28acff),_0x42f700=_0x114f52['apps'][_0xe36566[_0x8bcba1(0x177)]],_0xf4d08=[],_0x49add7=[];for(const _0x1bd92f of _0x2820b1){const _0x116783=_0x42f700[_0x8bcba1(0x18d)][_0x1bd92f[_0x8bcba1(0x174)]],_0x3d800f=ensureRemoteSqlContent(_0x1bd92f),_0x5e5f1e=detectModeFromSql(_0x1bd92f),_0x285961=_0x1bd92f[_0x8bcba1(0x15b)]?await getDbName(_0x561eaf[_0x8bcba1(0x177)],Number(_0x1bd92f[_0x8bcba1(0x15b)]))[_0x8bcba1(0x189)](()=>undefined):undefined,_0x3b1aec=buildLocalSqlFileContent({'sqlCode':_0x1bd92f[_0x8bcba1(0x174)],'sqlName':_0x1bd92f[_0x8bcba1(0x154)],'dbId':_0x1bd92f[_0x8bcba1(0x15b)]},_0x3d800f,{'dbName':_0x285961,'mode':_0x5e5f1e,'syncedAt':new Date()[_0x8bcba1(0x164)](),'description':_0x1bd92f[_0x8bcba1(0x16e)]}),_0x1b79a0=buildSqlLockEntry(_0x1bd92f,_0x3d800f,computeSqlContentHash(_0x3b1aec),{'dbName':_0x285961}),_0x2f274d=_0x1b79a0[_0x8bcba1(0x15a)],_0x2f6ab5=join(_0xe36566['sqlRootDir'],_0x2f274d);try{if(await fileExists(_0x2f6ab5)){const _0x9487ee=await readFile(_0x2f6ab5,_0x8bcba1(0x185));if(isEquivalentPulledSqlFile(_0x9487ee,_0x3b1aec,_0x5e5f1e)){_0x49add7[_0x8bcba1(0x181)]({'sqlCode':_0x1bd92f['sqlCode'],'reason':_0x8bcba1(0x17a)}),_0x42f700['sqls'][_0x1bd92f['sqlCode']]={..._0x1b79a0,'hash':computeSqlContentHash(_0x9487ee),'path':_0x2f274d};continue;}if(!_0x24a15f){_0x49add7[_0x8bcba1(0x181)]({'sqlCode':_0x1bd92f[_0x8bcba1(0x174)],'reason':_0x8bcba1(0x191)});continue;}}const _0x1af162=_0x116783?.[_0x8bcba1(0x15a)]?join(_0xe36566['sqlRootDir'],_0x116783['path']):undefined;_0x1af162&&_0x1af162!==_0x2f6ab5&&await fileExists(_0x1af162)&&await rm(_0x1af162,{'force':!![]}),await ensureParentDirectory(_0x2f6ab5),await writeFile(_0x2f6ab5,_0x3b1aec,_0x8bcba1(0x185)),_0x42f700['sqls'][_0x1bd92f[_0x8bcba1(0x174)]]={..._0x1b79a0,'path':_0x2f274d},_0xf4d08['push']({'sqlCode':_0x1bd92f['sqlCode'],'filePath':_0x2f6ab5});}catch(_0x2ff5e9){_0x17d007['push']({'sqlCode':_0x1bd92f[_0x8bcba1(0x174)],'error':_0x2ff5e9 instanceof Error?_0x2ff5e9['message']:String(_0x2ff5e9)});}}return _0x42f700[_0x8bcba1(0x17c)]=new Date()['toISOString'](),await writeSqlLockFile(_0xe36566['lockFilePath'],_0x114f52),{'ok':_0x17d007[_0x8bcba1(0x188)]===0x0,'data':{'pulled':_0xf4d08,'skipped':_0x49add7,'failed':_0x17d007},'message':_0x8bcba1(0x176)+_0xf4d08[_0x8bcba1(0x188)]+_0x8bcba1(0x153)+_0x49add7['length']+'\x20skipped,\x20'+_0x17d007[_0x8bcba1(0x188)]+_0x8bcba1(0x175)};}};function detectModeFromSql(_0x1c3391){const _0x22c649=a137_0x2be09e,_0x1cfb01=ensureRemoteSqlContent(_0x1c3391),_0x3ba20d=stripLocalSqlMetadata(_0x1cfb01,_0x22c649(0x165))['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x22c649(0x180)](_0x3ba20d))return _0x22c649(0x165);return _0x22c649(0x168);}function isEquivalentPulledSqlFile(_0x53a306,_0x39b7bb,_0x4cf746){return normalizePullComparableContent(_0x53a306,_0x4cf746)===normalizePullComparableContent(_0x39b7bb,_0x4cf746);}function normalizePullComparableContent(_0x41f4dd,_0xe1d8fa){const _0xdbe6f3=a137_0x2be09e,_0x70e121=_0x41f4dd[_0xdbe6f3(0x161)](/\r\n/g,'\x0a')['split']('\x0a'),_0x22c48e=_0x70e121['filter'](_0x4788ba=>!isSyncedAtMetadataLine(_0x4788ba,_0xe1d8fa));return _0x22c48e[_0xdbe6f3(0x157)]('\x0a');}function isSyncedAtMetadataLine(_0x126061,_0x33f50f){const _0x27f09a=a137_0x2be09e;if(_0x33f50f===_0x27f09a(0x165))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x27f09a(0x180)](_0x126061);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x126061);}
@@ -1 +1 @@
1
- const a137_0x212dcb=a137_0x4618;function a137_0x4618(_0x3eee4a,_0x5e46f5){_0x3eee4a=_0x3eee4a-0xb6;const _0x1adf53=a137_0x1adf();let _0x4618b6=_0x1adf53[_0x3eee4a];return _0x4618b6;}(function(_0x156658,_0x14fe7c){const _0x1593a9=a137_0x4618,_0x39525c=_0x156658();while(!![]){try{const _0x1c9fc5=-parseInt(_0x1593a9(0xb9))/0x1*(-parseInt(_0x1593a9(0xdd))/0x2)+parseInt(_0x1593a9(0xee))/0x3*(parseInt(_0x1593a9(0xbd))/0x4)+-parseInt(_0x1593a9(0xc7))/0x5*(-parseInt(_0x1593a9(0xf1))/0x6)+-parseInt(_0x1593a9(0xc1))/0x7+-parseInt(_0x1593a9(0xde))/0x8+parseInt(_0x1593a9(0xbe))/0x9*(parseInt(_0x1593a9(0xc3))/0xa)+-parseInt(_0x1593a9(0xf6))/0xb;if(_0x1c9fc5===_0x14fe7c)break;else _0x39525c['push'](_0x39525c['shift']());}catch(_0x47c3aa){_0x39525c['push'](_0x39525c['shift']());}}}(a137_0x1adf,0x7b8a3));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 a137_0x1adf(){const _0x33b419=['path','join','Push\x20local\x20SQL\x20files\x20to\x20remote','utf8','sqls','isFinite','Local\x20SQL\x20not\x20found:\x20','Push\x20complete:\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','\x20failed','unchanged','dbDirectory','sqlRoot','No\x20database\x20matches\x20local\x20directory\x20\x22','sqlCode','293466NmEyzF','boolean','entries','618sgujuY','exec','lockFilePath','relativePath','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','7602639zHSYjt','hash','str','catch','mode','\x20skipped,\x20','185cJqSOz','push','dbName','\x20SQL\x20file(s)','12rIrSIf','228141YoTYMx','force','/smartapi/custom/updateUserCustomSql','1271669oZSVIj','filePath','210BmlyFp','get','startsWith','lastSync','15445mXvCKe','appCode','version','remoteId','sqlName','\x22\x20for\x20sqlCode\x20','bool','trashDir','POST','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','replace','sqlcode','\x20pushed,\x20','filter','sqlRootDir','length','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','dbId','sql','map','validation','No\x20local\x20SQL\x20files\x20found.','6710ExqgJd','3086416BBJMij'];a137_0x1adf=function(){return _0x33b419;};return a137_0x1adf();}async function getTargetSqlQueries(_0x3d6f71,_0x17706e,_0x5c0225){const _0x310b55=a137_0x4618,_0x30ef00=await scanLocalSqlQueries(_0x3d6f71),_0x51a686=new Map();for(const _0x48dc26 of _0x30ef00){if(_0x5c0225&&_0x48dc26[_0x310b55(0xed)]!==_0x5c0225)continue;const _0x222c32=_0x51a686[_0x310b55(0xc4)](_0x48dc26[_0x310b55(0xed)])??[];_0x222c32['push'](_0x48dc26),_0x51a686['set'](_0x48dc26[_0x310b55(0xed)],_0x222c32);}if(_0x5c0225&&!_0x51a686['has'](_0x5c0225))throw CliErrors['validation'](_0x310b55(0xe5)+_0x5c0225);const _0x288f8c=[];for(const [_0x131ead,_0x1c2a6e]of _0x51a686[_0x310b55(0xf0)]()){if(_0x1c2a6e[_0x310b55(0xd6)]===0x1){_0x288f8c[_0x310b55(0xba)](_0x1c2a6e[0x0]);continue;}const _0x5b246=_0x17706e[_0x310b55(0xe3)][_0x131ead],_0x2907f8=_0x5b246?.[_0x310b55(0xdf)],_0xfefbeb=_0x2907f8?_0x1c2a6e[_0x310b55(0xd4)](_0x570cb6=>_0x570cb6['relativePath']!==_0x2907f8):_0x1c2a6e;if(_0x5b246&&_0xfefbeb[_0x310b55(0xd6)]===0x1){_0x288f8c['push'](_0xfefbeb[0x0]);continue;}throw CliErrors['validation'](_0x310b55(0xd7)+_0x131ead+_0x310b55(0xe7));}return _0x288f8c;}export const sqlPush={'service':a137_0x212dcb(0xd9),'command':a137_0x212dcb(0xba),'description':a137_0x212dcb(0xe1),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a137_0x212dcb(0xbf),'type':a137_0x212dcb(0xef),'description':a137_0x212dcb(0xf5)}],async 'dryRun'(_0x6c0d17){const _0xcebc04=a137_0x212dcb,_0x10014d=loadSqlProjectConfig(_0x6c0d17[_0xcebc04(0xc8)]),_0x2d32cf=await readSqlLockFile(_0x10014d['lockFilePath']),{appLock:_0x3f5e9e}=ensureSqlLockScope(_0x2d32cf??createEmptySqlLock(),_0x6c0d17['appCode'],_0x10014d[_0xcebc04(0xeb)],_0xcebc04(0xba)),_0x2202d6=await getTargetSqlQueries(_0x10014d,_0x3f5e9e,_0x6c0d17[_0xcebc04(0xf8)](_0xcebc04(0xd2))||undefined),_0xd79cb0=[];for(const _0x166754 of _0x2202d6){const _0x53f108=await computeSqlFileHash(_0x166754[_0xcebc04(0xc2)]),_0x443663=_0x3f5e9e[_0xcebc04(0xe3)][_0x166754[_0xcebc04(0xed)]],_0x6ffb0c=!!_0x443663&&(_0x443663[_0xcebc04(0xdf)]!==_0x166754[_0xcebc04(0xf4)]||!!_0x166754[_0xcebc04(0xcb)]&&_0x443663['sqlName']!==_0x166754['sqlName']);if(!_0x6c0d17[_0xcebc04(0xcd)](_0xcebc04(0xbf))&&_0x443663&&_0x443663[_0xcebc04(0xf7)]===_0x53f108&&!_0x6ffb0c)continue;_0xd79cb0[_0xcebc04(0xba)](_0x166754[_0xcebc04(0xed)]);}return{'method':_0xcebc04(0xcf),'url':_0xcebc04(0xc0),'body':{'sqlCodes':_0xd79cb0,'appCode':_0x6c0d17[_0xcebc04(0xc8)]},'description':'Would\x20push\x20'+_0xd79cb0['length']+_0xcebc04(0xbc)};},async 'execute'(_0x284fb9){const _0x3817e6=a137_0x212dcb,_0x51999e=loadSqlProjectConfig(_0x284fb9[_0x3817e6(0xc8)]),_0x1e734e=await readSqlLockFile(_0x51999e[_0x3817e6(0xf3)]),{lockData:_0x201191,appLock:_0x2fde1d}=ensureSqlLockScope(_0x1e734e??createEmptySqlLock(),_0x284fb9[_0x3817e6(0xc8)],_0x51999e[_0x3817e6(0xeb)],_0x3817e6(0xba)),_0x42cced=await getTargetSqlQueries(_0x51999e,_0x2fde1d,_0x284fb9['str'](_0x3817e6(0xd2))||undefined);if(_0x42cced['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x3817e6(0xdc)};const _0x32f83d=[],_0x2d333a=[],_0x3ff874=[];for(const _0x32d2a9 of _0x42cced){const _0x53982b=_0x2fde1d[_0x3817e6(0xe3)][_0x32d2a9['sqlCode']];if(!_0x53982b){_0x3ff874[_0x3817e6(0xba)]({'sqlCode':_0x32d2a9[_0x3817e6(0xed)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x444ee7=await computeSqlFileHash(_0x32d2a9[_0x3817e6(0xc2)]),_0x48540f=_0x53982b[_0x3817e6(0xdf)]!==_0x32d2a9[_0x3817e6(0xf4)]||!!_0x32d2a9[_0x3817e6(0xcb)]&&_0x53982b[_0x3817e6(0xcb)]!==_0x32d2a9[_0x3817e6(0xcb)];if(!_0x284fb9['bool'](_0x3817e6(0xbf))&&_0x53982b[_0x3817e6(0xf7)]===_0x444ee7&&!_0x48540f){_0x2d333a[_0x3817e6(0xba)]({'sqlCode':_0x32d2a9['sqlCode'],'reason':_0x3817e6(0xe9)});continue;}if(_0x53982b[_0x3817e6(0xc9)]==null){_0x3ff874['push']({'sqlCode':_0x32d2a9[_0x3817e6(0xed)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x22d7f4=await readFile(_0x32d2a9[_0x3817e6(0xc2)],_0x3817e6(0xe2)),_0x406b88=stripLocalSqlMetadata(_0x22d7f4,_0x32d2a9[_0x3817e6(0xb7)]),_0x3bd1ce=_0x32d2a9['sqlName']||_0x53982b[_0x3817e6(0xcb)],_0x161d22=await resolveTargetDbBinding(_0x284fb9[_0x3817e6(0xc8)],_0x32d2a9,_0x53982b),_0x28115e=await updateSqlQuery({'id':_0x53982b[_0x3817e6(0xca)],'appCode':_0x284fb9[_0x3817e6(0xc8)],'sqlCode':_0x32d2a9['sqlCode'],'sqlName':_0x3bd1ce,'dbId':_0x161d22[_0x3817e6(0xd8)],'version':_0x53982b[_0x3817e6(0xc9)],'sqlContent':_0x406b88,'sqlConfig':_0x53982b['sqlConfig']??undefined}),_0x175b9a=_0x28115e[_0x3817e6(0xd8)]?await getDbName(_0x284fb9['appCode'],Number(_0x28115e['dbId']))[_0x3817e6(0xb6)](()=>_0x161d22['dbName']):_0x161d22[_0x3817e6(0xbb)];_0x2fde1d[_0x3817e6(0xe3)][_0x32d2a9[_0x3817e6(0xed)]]={...buildSqlLockEntry(_0x28115e,_0x406b88,_0x444ee7,{'dbName':_0x175b9a}),'path':_0x32d2a9[_0x3817e6(0xf4)],'mode':_0x53982b[_0x3817e6(0xb7)]},await archivePreviousSqlFileIfNeeded(_0x51999e,_0x53982b[_0x3817e6(0xdf)],_0x32d2a9['relativePath']),_0x32f83d[_0x3817e6(0xba)]({'sqlCode':_0x32d2a9[_0x3817e6(0xed)],'remoteId':_0x53982b[_0x3817e6(0xca)]});}catch(_0x15f4d9){_0x3ff874[_0x3817e6(0xba)]({'sqlCode':_0x32d2a9[_0x3817e6(0xed)],'error':_0x15f4d9 instanceof Error?_0x15f4d9['message']:String(_0x15f4d9)});}}return _0x2fde1d[_0x3817e6(0xc6)]=new Date()['toISOString'](),await writeSqlLockFile(_0x51999e['lockFilePath'],_0x201191),{'ok':_0x3ff874[_0x3817e6(0xd6)]===0x0,'data':{'pushed':_0x32f83d,'skipped':_0x2d333a,'failed':_0x3ff874},'message':_0x3817e6(0xe6)+_0x32f83d[_0x3817e6(0xd6)]+_0x3817e6(0xd3)+_0x2d333a[_0x3817e6(0xd6)]+_0x3817e6(0xb8)+_0x3ff874[_0x3817e6(0xd6)]+_0x3817e6(0xe8)};}};async function archivePreviousSqlFileIfNeeded(_0x4eed95,_0x247404,_0x3b061f){const _0x3a3754=a137_0x212dcb;if(!_0x247404||_0x247404===_0x3b061f)return;const _0x1a1bea=join(_0x4eed95[_0x3a3754(0xd5)],_0x247404);if(!await fileExists(_0x1a1bea))return;const _0x2366c0=await moveToTrash(_0x4eed95['projectRoot'],_0x4eed95[_0x3a3754(0xce)],_0x1a1bea);await cleanupEmptyDirectories(dirname(_0x1a1bea),_0x4eed95[_0x3a3754(0xd5)]),void _0x2366c0;}async function moveToTrash(_0x555ed7,_0x5a69c8,_0x308925){const _0x31bcde=a137_0x212dcb,_0x7e1148=new Date()['toISOString']()[_0x31bcde(0xd1)](/[:.]/g,'-'),_0x1bdd22=relative(_0x555ed7,_0x308925),_0x595993=join(_0x5a69c8,_0x7e1148,_0x1bdd22);return await mkdir(dirname(_0x595993),{'recursive':!![]}),await rename(_0x308925,_0x595993),_0x595993;}async function cleanupEmptyDirectories(_0x256662,_0x19f85c){const _0x1421bc=a137_0x212dcb;let _0x6a6fea=resolve(_0x256662);const _0x51869c=resolve(_0x19f85c);while(_0x6a6fea[_0x1421bc(0xc5)](''+_0x51869c+sep)||_0x6a6fea===_0x51869c){if(_0x6a6fea===_0x51869c)return;try{const _0x266411=await readdir(_0x6a6fea);if(_0x266411[_0x1421bc(0xd6)]>0x0)return;await rmdir(_0x6a6fea);}catch{return;}_0x6a6fea=dirname(_0x6a6fea);}}async function resolveTargetDbBinding(_0x1027e3,_0x4f9140,_0x17f9a8){const _0x55b21c=a137_0x212dcb,_0x2c9176=_0x4f9140[_0x55b21c(0xea)];if(!_0x2c9176)return{'dbId':_0x17f9a8[_0x55b21c(0xd8)],'dbName':_0x17f9a8[_0x55b21c(0xbb)]};const _0x56a05a=buildDbDirectoryName(_0x17f9a8[_0x55b21c(0xbb)],_0x17f9a8[_0x55b21c(0xd8)]);if(_0x2c9176===_0x56a05a)return{'dbId':_0x17f9a8[_0x55b21c(0xd8)],'dbName':_0x17f9a8[_0x55b21c(0xbb)]};const _0x41a82c=parseExplicitDbDirectory(_0x2c9176);if(_0x41a82c!=null)return{'dbId':_0x41a82c,'dbName':await getDbName(_0x1027e3,_0x41a82c)['catch'](()=>undefined)};const _0x262413=await listDatabases(_0x1027e3),_0x74bef5=_0x262413[_0x55b21c(0xd4)](_0x37e111=>buildDbDirectoryName(_0x37e111['dbName'],_0x37e111[_0x55b21c(0xd8)])===_0x2c9176);if(_0x74bef5['length']===0x1)return{'dbId':_0x74bef5[0x0][_0x55b21c(0xd8)],'dbName':_0x74bef5[0x0]['dbName']};if(_0x74bef5[_0x55b21c(0xd6)]===0x0)throw CliErrors[_0x55b21c(0xdb)](_0x55b21c(0xec)+_0x2c9176+_0x55b21c(0xcc)+_0x4f9140[_0x55b21c(0xed)]+'.');const _0x5d2200=_0x74bef5[_0x55b21c(0xda)](_0x13e6dd=>_0x13e6dd[_0x55b21c(0xbb)]+'\x20('+_0x13e6dd[_0x55b21c(0xd8)]+')')[_0x55b21c(0xe0)](',\x20');throw CliErrors['validation']('Local\x20directory\x20\x22'+_0x2c9176+_0x55b21c(0xd0)+_0x4f9140[_0x55b21c(0xed)]+':\x20'+_0x5d2200);}function parseExplicitDbDirectory(_0x491f2a){const _0x4f8556=a137_0x212dcb,_0x3c5e38=/^db-(\d+)$/[_0x4f8556(0xf2)](_0x491f2a);if(!_0x3c5e38)return null;const _0x416609=Number(_0x3c5e38[0x1]);return Number[_0x4f8556(0xe4)](_0x416609)&&_0x416609>0x0?_0x416609:null;}
1
+ const a138_0x992a5d=a138_0x56dc;(function(_0xabb1ca,_0x1d0ade){const _0x219c6f=a138_0x56dc,_0x55f2e9=_0xabb1ca();while(!![]){try{const _0x474287=parseInt(_0x219c6f(0xca))/0x1+-parseInt(_0x219c6f(0xa1))/0x2*(parseInt(_0x219c6f(0xa0))/0x3)+-parseInt(_0x219c6f(0x9f))/0x4+-parseInt(_0x219c6f(0xa4))/0x5*(-parseInt(_0x219c6f(0xa8))/0x6)+parseInt(_0x219c6f(0xb1))/0x7+parseInt(_0x219c6f(0xb2))/0x8*(parseInt(_0x219c6f(0xb6))/0x9)+-parseInt(_0x219c6f(0xcf))/0xa*(parseInt(_0x219c6f(0xa3))/0xb);if(_0x474287===_0x1d0ade)break;else _0x55f2e9['push'](_0x55f2e9['shift']());}catch(_0xca767d){_0x55f2e9['push'](_0x55f2e9['shift']());}}}(a138_0x4a37,0xb7f8c));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';function a138_0x4a37(){const _0x5a30c6=['toISOString','str','\x20failed','Local\x20SQL\x20not\x20found:\x20','\x20pushed,\x20','exec','relativePath','get','projectRoot','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','3307756BgLeui','1204899ZEFpnR','4iHOjgm','trashDir','22EmAkJx','100SJyLVd','sqlName','\x22\x20for\x20sqlCode\x20','dbName','53466GtPeUM','entries','utf8','sqlcode','mode','sqls','unchanged','/smartapi/custom/updateUserCustomSql','Would\x20push\x20','9598162yfBpLW','8Hwmrdi','Local\x20directory\x20\x22','length','bool','3342537xUcjNw','hash','No\x20database\x20matches\x20local\x20directory\x20\x22','validation','\x20SQL\x20file(s)','lastSync','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','catch','dbId','force','lockFilePath','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','sqlRoot','boolean','push','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','Push\x20local\x20SQL\x20files\x20to\x20remote','filePath','sqlCode','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','731140rUrRqj','remoteId','isFinite','appCode','join','1340830rCkQZF','filter','set','sqlConfig','sqlRootDir','\x20skipped,\x20','dbDirectory','Push\x20complete:\x20','version','POST','path','No\x20local\x20SQL\x20files\x20found.'];a138_0x4a37=function(){return _0x5a30c6;};return a138_0x4a37();}import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x20266b,_0x1b4236,_0x58804e){const _0x36a872=a138_0x56dc,_0x1d606d=await scanLocalSqlQueries(_0x20266b),_0x4b91c4=new Map();for(const _0x3c267c of _0x1d606d){if(_0x58804e&&_0x3c267c[_0x36a872(0xc8)]!==_0x58804e)continue;const _0x500867=_0x4b91c4[_0x36a872(0x9c)](_0x3c267c[_0x36a872(0xc8)])??[];_0x500867[_0x36a872(0xc4)](_0x3c267c),_0x4b91c4[_0x36a872(0xd1)](_0x3c267c[_0x36a872(0xc8)],_0x500867);}if(_0x58804e&&!_0x4b91c4['has'](_0x58804e))throw CliErrors[_0x36a872(0xb9)](_0x36a872(0x98)+_0x58804e);const _0x34272d=[];for(const [_0x239c34,_0x21b93c]of _0x4b91c4[_0x36a872(0xa9)]()){if(_0x21b93c['length']===0x1){_0x34272d['push'](_0x21b93c[0x0]);continue;}const _0x136407=_0x1b4236[_0x36a872(0xad)][_0x239c34],_0x7ea3dd=_0x136407?.['path'],_0x513c00=_0x7ea3dd?_0x21b93c['filter'](_0x2b5c6c=>_0x2b5c6c[_0x36a872(0x9b)]!==_0x7ea3dd):_0x21b93c;if(_0x136407&&_0x513c00[_0x36a872(0xb4)]===0x1){_0x34272d[_0x36a872(0xc4)](_0x513c00[0x0]);continue;}throw CliErrors[_0x36a872(0xb9)](_0x36a872(0xc5)+_0x239c34+_0x36a872(0xc9));}return _0x34272d;}export const sqlPush={'service':'sql','command':a138_0x992a5d(0xc4),'description':a138_0x992a5d(0xc6),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a138_0x992a5d(0xbf),'type':a138_0x992a5d(0xc3),'description':a138_0x992a5d(0x9e)}],async 'dryRun'(_0x29ad44){const _0x23f9ca=a138_0x992a5d,_0x24c8ec=loadSqlProjectConfig(_0x29ad44[_0x23f9ca(0xcd)]),_0xf192eb=await readSqlLockFile(_0x24c8ec[_0x23f9ca(0xc0)]),{appLock:_0x50cef3}=ensureSqlLockScope(_0xf192eb??createEmptySqlLock(),_0x29ad44[_0x23f9ca(0xcd)],_0x24c8ec['sqlRoot'],'push'),_0x67b2cb=await getTargetSqlQueries(_0x24c8ec,_0x50cef3,_0x29ad44['str'](_0x23f9ca(0xab))||undefined),_0x238f23=[];for(const _0x36d14d of _0x67b2cb){const _0x4f99b2=await computeSqlFileHash(_0x36d14d[_0x23f9ca(0xc7)]),_0x55a01a=_0x50cef3[_0x23f9ca(0xad)][_0x36d14d[_0x23f9ca(0xc8)]],_0x1d440c=!!_0x55a01a&&(_0x55a01a['path']!==_0x36d14d[_0x23f9ca(0x9b)]||!!_0x36d14d['sqlName']&&_0x55a01a['sqlName']!==_0x36d14d[_0x23f9ca(0xa5)]);if(!_0x29ad44[_0x23f9ca(0xb5)](_0x23f9ca(0xbf))&&_0x55a01a&&_0x55a01a['hash']===_0x4f99b2&&!_0x1d440c)continue;_0x238f23[_0x23f9ca(0xc4)](_0x36d14d[_0x23f9ca(0xc8)]);}return{'method':_0x23f9ca(0x92),'url':_0x23f9ca(0xaf),'body':{'sqlCodes':_0x238f23,'appCode':_0x29ad44[_0x23f9ca(0xcd)]},'description':_0x23f9ca(0xb0)+_0x238f23['length']+_0x23f9ca(0xba)};},async 'execute'(_0x341eac){const _0x28c3e2=a138_0x992a5d,_0x441c13=loadSqlProjectConfig(_0x341eac[_0x28c3e2(0xcd)]),_0x2d7075=await readSqlLockFile(_0x441c13[_0x28c3e2(0xc0)]),{lockData:_0x26c9d8,appLock:_0x20e346}=ensureSqlLockScope(_0x2d7075??createEmptySqlLock(),_0x341eac[_0x28c3e2(0xcd)],_0x441c13[_0x28c3e2(0xc2)],_0x28c3e2(0xc4)),_0x834495=await getTargetSqlQueries(_0x441c13,_0x20e346,_0x341eac[_0x28c3e2(0x96)](_0x28c3e2(0xab))||undefined);if(_0x834495[_0x28c3e2(0xb4)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x28c3e2(0x94)};const _0x477a13=[],_0x1037dd=[],_0x10bf05=[];for(const _0x32a85e of _0x834495){const _0x59df45=_0x20e346[_0x28c3e2(0xad)][_0x32a85e[_0x28c3e2(0xc8)]];if(!_0x59df45){_0x10bf05[_0x28c3e2(0xc4)]({'sqlCode':_0x32a85e['sqlCode'],'error':_0x28c3e2(0xc1)});continue;}try{const _0x1d9e6b=await computeSqlFileHash(_0x32a85e[_0x28c3e2(0xc7)]),_0x498ddc=_0x59df45[_0x28c3e2(0x93)]!==_0x32a85e[_0x28c3e2(0x9b)]||!!_0x32a85e[_0x28c3e2(0xa5)]&&_0x59df45[_0x28c3e2(0xa5)]!==_0x32a85e[_0x28c3e2(0xa5)];if(!_0x341eac['bool'](_0x28c3e2(0xbf))&&_0x59df45[_0x28c3e2(0xb7)]===_0x1d9e6b&&!_0x498ddc){_0x1037dd[_0x28c3e2(0xc4)]({'sqlCode':_0x32a85e[_0x28c3e2(0xc8)],'reason':_0x28c3e2(0xae)});continue;}if(_0x59df45[_0x28c3e2(0x91)]==null){_0x10bf05[_0x28c3e2(0xc4)]({'sqlCode':_0x32a85e[_0x28c3e2(0xc8)],'error':_0x28c3e2(0xbc)});continue;}const _0x15d4a4=await readFile(_0x32a85e[_0x28c3e2(0xc7)],_0x28c3e2(0xaa)),_0x1d7014=stripLocalSqlMetadata(_0x15d4a4,_0x32a85e[_0x28c3e2(0xac)]),_0x4576fb=_0x32a85e[_0x28c3e2(0xa5)]||_0x59df45[_0x28c3e2(0xa5)],_0x47b840=await resolveTargetDbBinding(_0x341eac[_0x28c3e2(0xcd)],_0x32a85e,_0x59df45),_0x584ddb=await updateSqlQuery({'id':_0x59df45[_0x28c3e2(0xcb)],'appCode':_0x341eac['appCode'],'sqlCode':_0x32a85e[_0x28c3e2(0xc8)],'sqlName':_0x4576fb,'dbId':_0x47b840[_0x28c3e2(0xbe)],'version':_0x59df45[_0x28c3e2(0x91)],'sqlContent':_0x1d7014,'sqlConfig':_0x59df45[_0x28c3e2(0xd2)]??undefined}),_0x3da6bd=_0x584ddb[_0x28c3e2(0xbe)]?await getDbName(_0x341eac[_0x28c3e2(0xcd)],Number(_0x584ddb[_0x28c3e2(0xbe)]))['catch'](()=>_0x47b840[_0x28c3e2(0xa7)]):_0x47b840[_0x28c3e2(0xa7)];_0x20e346[_0x28c3e2(0xad)][_0x32a85e['sqlCode']]={...buildSqlLockEntry(_0x584ddb,_0x1d7014,_0x1d9e6b,{'dbName':_0x3da6bd}),'path':_0x32a85e[_0x28c3e2(0x9b)],'mode':_0x59df45['mode']},await archivePreviousSqlFileIfNeeded(_0x441c13,_0x59df45[_0x28c3e2(0x93)],_0x32a85e[_0x28c3e2(0x9b)]),_0x477a13[_0x28c3e2(0xc4)]({'sqlCode':_0x32a85e['sqlCode'],'remoteId':_0x59df45[_0x28c3e2(0xcb)]});}catch(_0x244364){_0x10bf05['push']({'sqlCode':_0x32a85e[_0x28c3e2(0xc8)],'error':_0x244364 instanceof Error?_0x244364['message']:String(_0x244364)});}}return _0x20e346[_0x28c3e2(0xbb)]=new Date()['toISOString'](),await writeSqlLockFile(_0x441c13[_0x28c3e2(0xc0)],_0x26c9d8),{'ok':_0x10bf05[_0x28c3e2(0xb4)]===0x0,'data':{'pushed':_0x477a13,'skipped':_0x1037dd,'failed':_0x10bf05},'message':_0x28c3e2(0x90)+_0x477a13[_0x28c3e2(0xb4)]+_0x28c3e2(0x99)+_0x1037dd[_0x28c3e2(0xb4)]+_0x28c3e2(0x8e)+_0x10bf05[_0x28c3e2(0xb4)]+_0x28c3e2(0x97)};}};async function archivePreviousSqlFileIfNeeded(_0x2e6250,_0x454483,_0x470f4b){const _0xfcc9c0=a138_0x992a5d;if(!_0x454483||_0x454483===_0x470f4b)return;const _0xfd885c=join(_0x2e6250[_0xfcc9c0(0x8d)],_0x454483);if(!await fileExists(_0xfd885c))return;const _0x37ff9d=await moveToTrash(_0x2e6250[_0xfcc9c0(0x9d)],_0x2e6250[_0xfcc9c0(0xa2)],_0xfd885c);await cleanupEmptyDirectories(dirname(_0xfd885c),_0x2e6250[_0xfcc9c0(0x8d)]),void _0x37ff9d;}async function moveToTrash(_0x272b29,_0x3498c3,_0x36d56c){const _0x39a0d3=a138_0x992a5d,_0x112461=new Date()[_0x39a0d3(0x95)]()['replace'](/[:.]/g,'-'),_0x180c5f=relative(_0x272b29,_0x36d56c),_0xc187db=join(_0x3498c3,_0x112461,_0x180c5f);return await mkdir(dirname(_0xc187db),{'recursive':!![]}),await rename(_0x36d56c,_0xc187db),_0xc187db;}async function cleanupEmptyDirectories(_0x3c15c8,_0x5c8531){const _0x1cd547=a138_0x992a5d;let _0x476e4b=resolve(_0x3c15c8);const _0x4428b6=resolve(_0x5c8531);while(_0x476e4b['startsWith'](''+_0x4428b6+sep)||_0x476e4b===_0x4428b6){if(_0x476e4b===_0x4428b6)return;try{const _0x420e70=await readdir(_0x476e4b);if(_0x420e70[_0x1cd547(0xb4)]>0x0)return;await rmdir(_0x476e4b);}catch{return;}_0x476e4b=dirname(_0x476e4b);}}function a138_0x56dc(_0x370e61,_0x4dc4b9){_0x370e61=_0x370e61-0x8d;const _0x4a3793=a138_0x4a37();let _0x56dc6c=_0x4a3793[_0x370e61];return _0x56dc6c;}async function resolveTargetDbBinding(_0x2758b1,_0x57fcde,_0x174f8b){const _0x25164a=a138_0x992a5d,_0x3fca5e=_0x57fcde[_0x25164a(0x8f)];if(!_0x3fca5e)return{'dbId':_0x174f8b[_0x25164a(0xbe)],'dbName':_0x174f8b[_0x25164a(0xa7)]};const _0x40c529=buildDbDirectoryName(_0x174f8b[_0x25164a(0xa7)],_0x174f8b[_0x25164a(0xbe)]);if(_0x3fca5e===_0x40c529)return{'dbId':_0x174f8b[_0x25164a(0xbe)],'dbName':_0x174f8b[_0x25164a(0xa7)]};const _0x4b4d05=parseExplicitDbDirectory(_0x3fca5e);if(_0x4b4d05!=null)return{'dbId':_0x4b4d05,'dbName':await getDbName(_0x2758b1,_0x4b4d05)[_0x25164a(0xbd)](()=>undefined)};const _0x1bf87e=await listDatabases(_0x2758b1),_0x641522=_0x1bf87e[_0x25164a(0xd0)](_0x428e2f=>buildDbDirectoryName(_0x428e2f[_0x25164a(0xa7)],_0x428e2f[_0x25164a(0xbe)])===_0x3fca5e);if(_0x641522[_0x25164a(0xb4)]===0x1)return{'dbId':_0x641522[0x0][_0x25164a(0xbe)],'dbName':_0x641522[0x0]['dbName']};if(_0x641522[_0x25164a(0xb4)]===0x0)throw CliErrors[_0x25164a(0xb9)](_0x25164a(0xb8)+_0x3fca5e+_0x25164a(0xa6)+_0x57fcde[_0x25164a(0xc8)]+'.');const _0xad0161=_0x641522['map'](_0x5f04d6=>_0x5f04d6[_0x25164a(0xa7)]+'\x20('+_0x5f04d6[_0x25164a(0xbe)]+')')[_0x25164a(0xce)](',\x20');throw CliErrors['validation'](_0x25164a(0xb3)+_0x3fca5e+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x57fcde[_0x25164a(0xc8)]+':\x20'+_0xad0161);}function parseExplicitDbDirectory(_0x104279){const _0x4fbe21=a138_0x992a5d,_0x54fef9=/^db-(\d+)$/[_0x4fbe21(0x9a)](_0x104279);if(!_0x54fef9)return null;const _0x3c49a6=Number(_0x54fef9[0x1]);return Number[_0x4fbe21(0xcc)](_0x3c49a6)&&_0x3c49a6>0x0?_0x3c49a6:null;}
@@ -1 +1 @@
1
- const a138_0x4d36eb=a138_0x289a;(function(_0x30c9b8,_0x381440){const _0x37e339=a138_0x289a,_0x2457fa=_0x30c9b8();while(!![]){try{const _0x3d5091=-parseInt(_0x37e339(0xc6))/0x1+-parseInt(_0x37e339(0xc8))/0x2+-parseInt(_0x37e339(0xce))/0x3+-parseInt(_0x37e339(0xd8))/0x4*(-parseInt(_0x37e339(0xd5))/0x5)+-parseInt(_0x37e339(0xcc))/0x6*(parseInt(_0x37e339(0xd9))/0x7)+-parseInt(_0x37e339(0xc2))/0x8+parseInt(_0x37e339(0xc4))/0x9*(parseInt(_0x37e339(0xc7))/0xa);if(_0x3d5091===_0x381440)break;else _0x2457fa['push'](_0x2457fa['shift']());}catch(_0x28fc08){_0x2457fa['push'](_0x2457fa['shift']());}}}(a138_0x46eb,0xdde60));import{CliErrors}from'../../errors.js';function a138_0x46eb(){const _0x283c37=['`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','SQL\x20query\x20display\x20name','sqlname','Query\x20description','string','130eWmWBd','save','Path\x20to\x20the\x20SQL\x20file','77176rddhax','2320661dEdmZn','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','790832HdfhKz','write','38690559OIBRZX','file','927952qMsCQA','10DLWlEG','3248270JWYjeb','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','validation','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','6vQONMb','sql','2727705fBobNb','description'];a138_0x46eb=function(){return _0x283c37;};return a138_0x46eb();}function a138_0x289a(_0x774d5f,_0x8e0b5e){_0x774d5f=_0x774d5f-0xc2;const _0x46eb30=a138_0x46eb();let _0x289a56=_0x46eb30[_0x774d5f];return _0x289a56;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a138_0x4d36eb(0xd0),a138_0x4d36eb(0xc9),'Update\x20existing\x20SQL\x20by\x20editing\x20the\x20synced\x20file\x20under\x20`.rabetbase/sql/<appCode>/<dbName|db-<id>>/`\x20and\x20then\x20running\x20`rabetbase\x20sql\x20push\x20--sqlcode\x20<code>\x20--yes`.']['join']('\x0a');export const sqlSave={'service':a138_0x4d36eb(0xcd),'command':a138_0x4d36eb(0xd6),'description':a138_0x4d36eb(0xda),'risk':a138_0x4d36eb(0xc3),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a138_0x4d36eb(0xc5),'type':a138_0x4d36eb(0xd4),'required':!![],'description':a138_0x4d36eb(0xd7)},SQLCODE_FLAG_OPTIONAL,{'name':a138_0x4d36eb(0xd2),'type':a138_0x4d36eb(0xd4),'description':a138_0x4d36eb(0xd1)},{'name':'db','type':a138_0x4d36eb(0xd4),'description':a138_0x4d36eb(0xcb)},{'name':a138_0x4d36eb(0xcf),'type':a138_0x4d36eb(0xd4),'description':a138_0x4d36eb(0xd3)}],async 'validate'(){const _0x530fc6=a138_0x4d36eb;throw CliErrors[_0x530fc6(0xca)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x9daf32=a138_0x4d36eb;throw CliErrors[_0x9daf32(0xca)](SQL_SAVE_DEPRECATED_HINT);}};
1
+ function a139_0x4b59(){const _0x50f186=['Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','1639472HmiAer','file','287932CiXPBz','80cYpTvS','write','Update\x20existing\x20SQL\x20by\x20editing\x20the\x20synced\x20file\x20under\x20`.rabetbase/sql/<appCode>/<dbName|db-<id>>/`\x20and\x20then\x20running\x20`rabetbase\x20sql\x20push\x20--sqlcode\x20<code>\x20--yes`.','join','string','Query\x20description','7518aEfMOv','1122720AvIGht','240400hblZkF','validation','description','sqlname','90116mXsKMy','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','1252320aARyOx','9IbMUgM','Path\x20to\x20the\x20SQL\x20file','SQL\x20query\x20display\x20name','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','72GVIctC'];a139_0x4b59=function(){return _0x50f186;};return a139_0x4b59();}function a139_0xc6e5(_0x5275df,_0xe6bbe2){_0x5275df=_0x5275df-0x1e3;const _0x4b591b=a139_0x4b59();let _0xc6e546=_0x4b591b[_0x5275df];return _0xc6e546;}const a139_0xb5f71=a139_0xc6e5;(function(_0x1034ce,_0x1d3f3c){const _0x1b583b=a139_0xc6e5,_0x282104=_0x1034ce();while(!![]){try{const _0x3ac20b=-parseInt(_0x1b583b(0x1f2))/0x1+parseInt(_0x1b583b(0x1e9))/0x2+parseInt(_0x1b583b(0x1f1))/0x3+-parseInt(_0x1b583b(0x1f6))/0x4*(-parseInt(_0x1b583b(0x1ea))/0x5)+-parseInt(_0x1b583b(0x1e5))/0x6*(parseInt(_0x1b583b(0x1f0))/0x7)+-parseInt(_0x1b583b(0x1e7))/0x8*(parseInt(_0x1b583b(0x1f9))/0x9)+-parseInt(_0x1b583b(0x1f8))/0xa;if(_0x3ac20b===_0x1d3f3c)break;else _0x282104['push'](_0x282104['shift']());}catch(_0x4c8764){_0x282104['push'](_0x282104['shift']());}}}(a139_0x4b59,0x48130));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a139_0xb5f71(0x1f7),'Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.',a139_0xb5f71(0x1ec)][a139_0xb5f71(0x1ed)]('\x0a');export const sqlSave={'service':'sql','command':'save','description':a139_0xb5f71(0x1e4),'risk':a139_0xb5f71(0x1eb),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a139_0xb5f71(0x1e8),'type':a139_0xb5f71(0x1ee),'required':!![],'description':a139_0xb5f71(0x1fa)},SQLCODE_FLAG_OPTIONAL,{'name':a139_0xb5f71(0x1f5),'type':a139_0xb5f71(0x1ee),'description':a139_0xb5f71(0x1e3)},{'name':'db','type':a139_0xb5f71(0x1ee),'description':a139_0xb5f71(0x1e6)},{'name':a139_0xb5f71(0x1f4),'type':a139_0xb5f71(0x1ee),'description':a139_0xb5f71(0x1ef)}],async 'validate'(){const _0xaeafaf=a139_0xb5f71;throw CliErrors[_0xaeafaf(0x1f3)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x42f9cc=a139_0xb5f71;throw CliErrors[_0x42f9cc(0x1f3)](SQL_SAVE_DEPRECATED_HINT);}};
@@ -1 +1 @@
1
- (function(_0x139db4,_0x41c2a8){const _0x40038b=a139_0x33b7,_0x4e4734=_0x139db4();while(!![]){try{const _0x20074a=parseInt(_0x40038b(0x10c))/0x1+-parseInt(_0x40038b(0x123))/0x2*(-parseInt(_0x40038b(0x114))/0x3)+-parseInt(_0x40038b(0x10e))/0x4*(parseInt(_0x40038b(0x116))/0x5)+parseInt(_0x40038b(0x113))/0x6+parseInt(_0x40038b(0x10b))/0x7+parseInt(_0x40038b(0x105))/0x8+-parseInt(_0x40038b(0x10a))/0x9*(parseInt(_0x40038b(0x11d))/0xa);if(_0x20074a===_0x41c2a8)break;else _0x4e4734['push'](_0x4e4734['shift']());}catch(_0x3cc9e6){_0x4e4734['push'](_0x4e4734['shift']());}}}(a139_0x55e5,0x61dcf));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='.rabetbase/sql';export function buildSqlLockEntry(_0x2e910d,_0x431ca8,_0x607993,_0x53f90a){const _0x957146=a139_0x33b7,_0xe45536=detectSqlMode(_0x431ca8);return{'path':buildSqlRelativePath(_0x2e910d[_0x957146(0x106)],_0x2e910d[_0x957146(0x110)],_0x53f90a?.[_0x957146(0x122)],_0xe45536,_0x2e910d['dbId']),'hash':_0x607993,'remoteId':_0x2e910d['id'],'version':_0x2e910d[_0x957146(0x11a)],'dbId':Number(_0x2e910d[_0x957146(0x117)]),'dbName':_0x53f90a?.['dbName'],'sqlName':_0x2e910d[_0x957146(0x110)],'sqlConfig':_0x2e910d[_0x957146(0x125)]??undefined,'mode':_0xe45536};}export function cloneSqlLockData(_0x1f2937){const _0x586208=a139_0x33b7;return{'apps':Object[_0x586208(0x118)](Object[_0x586208(0x11e)](_0x1f2937[_0x586208(0x119)])['map'](([_0xb11dea,_0x4fefa2])=>[_0xb11dea,{'sqlRoot':_0x4fefa2['sqlRoot'],'lastSync':_0x4fefa2['lastSync'],'sqls':{..._0x4fefa2['sqls']}}]))};}export function ensureRemoteSqlContent(_0x3167e5){const _0x1fadee=a139_0x33b7;return _0x3167e5[_0x1fadee(0x109)]??'';}export function buildLocalSqlFileContent(_0x1fca36,_0x2c3c6d,_0x588e73){const _0x91fa9e=a139_0x33b7,_0x53de58=_0x588e73?.[_0x91fa9e(0x128)]??detectSqlMode(_0x2c3c6d),_0x28c7a0=stripLocalSqlMetadata(_0x2c3c6d,_0x53de58)[_0x91fa9e(0x104)](),_0x1c14ce=[...buildMetadataHeaderLines({'sqlCode':_0x1fca36[_0x91fa9e(0x106)],'sqlName':_0x1fca36[_0x91fa9e(0x110)],'dbId':_0x1fca36['dbId'],'dbName':_0x588e73?.[_0x91fa9e(0x122)],'mode':_0x53de58,'syncedAt':_0x588e73?.[_0x91fa9e(0x10f)],'description':_0x588e73?.[_0x91fa9e(0x112)]},_0x53de58),'',_0x28c7a0],_0x5d1293=_0x1c14ce[_0x91fa9e(0x11f)]('\x0a');return _0x5d1293[_0x91fa9e(0x102)]('\x0a')?_0x5d1293:_0x5d1293+'\x0a';}export function stripLocalSqlMetadata(_0x442f7f,_0x521ee8){const _0x27123b=a139_0x33b7,_0x5bb8ef=_0x442f7f['replace'](/\r\n/g,'\x0a')[_0x27123b(0x108)]('\x0a'),_0x349523=[];let _0x2813c4=0x0;if(_0x521ee8==='mybatisXml')while(_0x2813c4<_0x5bb8ef[_0x27123b(0x111)]){const _0x58c882=_0x5bb8ef[_0x2813c4]??'';if(/^\s*<!--\s*@lovrabet\./[_0x27123b(0x100)](_0x58c882)){_0x2813c4++;continue;}if(_0x58c882[_0x27123b(0x104)]()===''&&_0x2813c4>0x0){_0x2813c4++;continue;}break;}else while(_0x2813c4<_0x5bb8ef[_0x27123b(0x111)]){const _0x505378=_0x5bb8ef[_0x2813c4]??'';if(/^\s*--\s*@lovrabet\./[_0x27123b(0x100)](_0x505378)){_0x2813c4++;continue;}if(_0x505378[_0x27123b(0x104)]()===''&&_0x2813c4>0x0){_0x2813c4++;continue;}break;}for(;_0x2813c4<_0x5bb8ef[_0x27123b(0x111)];_0x2813c4++){_0x349523[_0x27123b(0x107)](_0x5bb8ef[_0x2813c4]);}return _0x349523[_0x27123b(0x11f)]('\x0a')[_0x27123b(0x115)]();}export function resolveSqlMode(_0x23ce60,_0xfd0980){const _0x3fe85a=a139_0x33b7;if(_0xfd0980?.[_0x3fe85a(0x128)])return _0xfd0980[_0x3fe85a(0x128)];return detectSqlMode(_0x23ce60);}function a139_0x33b7(_0x9c73f0,_0x28566f){_0x9c73f0=_0x9c73f0-0x100;const _0x55e526=a139_0x55e5();let _0x33b7f2=_0x55e526[_0x9c73f0];return _0x33b7f2;}export function resolveSqlFileName(_0x48039e,_0x119390,_0x527a52){const _0x1d921a=a139_0x33b7;if(_0x527a52?.['path'])return _0x527a52['path'];if(_0x527a52?.[_0x1d921a(0x110)]||_0x527a52?.[_0x1d921a(0x122)])return buildSqlRelativePath(_0x48039e,_0x527a52?.['sqlName'],_0x527a52?.['dbName'],resolveSqlMode(_0x119390,_0x527a52),_0x527a52?.[_0x1d921a(0x117)]);return buildDefaultSqlFileName(_0x48039e,resolveSqlMode(_0x119390,_0x527a52));}export function resolveSqlLocalDir(_0x525bef,_0x1a1500){return join(_0x525bef,SQL_LOCAL_REL_DIR,_0x1a1500);}export async function confirmForceOverwrite(_0xb62cc5){const _0x55b81f=a139_0x33b7,_0x5ca9c9=createInterface({'input':process[_0x55b81f(0x11c)],'output':process[_0x55b81f(0x120)]}),_0x14302b=await new Promise(_0x54f843=>{const _0x4bf138=_0x55b81f;_0x5ca9c9[_0x4bf138(0x124)](_0xb62cc5+_0x4bf138(0x101),_0x54f843);});return _0x5ca9c9['close'](),['y','yes'][_0x55b81f(0x10d)](_0x14302b[_0x55b81f(0x104)]()[_0x55b81f(0x129)]());}function a139_0x55e5(){const _0x462590=['2631cQPtAG','trimStart','5FwzlJv','dbId','fromEntries','apps','version','mybatisXml','stdin','10yFzyml','entries','join','stderr','<!--\x20@lovrabet.','dbName','334CLwzmY','question','sqlConfig','filter','\x20-->','mode','toLowerCase','test','\x20[y/N]\x20','endsWith','map','trim','580136MpRsyt','sqlCode','push','split','sqlContent','10983753LuErHy','4672948wTSAuI','486648HdtBtc','includes','72916kbVJBA','syncedAt','sqlName','length','description','1597830vQxZcy'];a139_0x55e5=function(){return _0x462590;};return a139_0x55e5();}export function findSqlLockScope(_0x5bbe21,_0x87526b){return _0x5bbe21['apps'][_0x87526b];}function buildMetadataHeaderLines(_0x3b5f15,_0x374f6d){const _0x415576=a139_0x33b7,_0x5d85bb=[['sqlCode',_0x3b5f15[_0x415576(0x106)]],[_0x415576(0x110),_0x3b5f15[_0x415576(0x110)]],['dbId',_0x3b5f15[_0x415576(0x117)]],[_0x415576(0x122),_0x3b5f15[_0x415576(0x122)]],[_0x415576(0x128),_0x3b5f15[_0x415576(0x128)]],[_0x415576(0x10f),_0x3b5f15[_0x415576(0x10f)]],['description',_0x3b5f15[_0x415576(0x112)]]];if(_0x374f6d===_0x415576(0x11b))return _0x5d85bb[_0x415576(0x126)](([,_0x538c53])=>_0x538c53!==undefined&&_0x538c53!==null&&String(_0x538c53)[_0x415576(0x104)]()!=='')['map'](([_0x255b81,_0xdab581])=>_0x415576(0x121)+_0x255b81+':\x20'+String(_0xdab581)+_0x415576(0x127));return _0x5d85bb[_0x415576(0x126)](([,_0x1f6037])=>_0x1f6037!==undefined&&_0x1f6037!==null&&String(_0x1f6037)[_0x415576(0x104)]()!=='')[_0x415576(0x103)](([_0x3c5cbd,_0x1adef2])=>'--\x20@lovrabet.'+_0x3c5cbd+':\x20'+String(_0x1adef2));}
1
+ const a140_0x2e5371=a140_0x31de;(function(_0x1b5ccd,_0x1a83b9){const _0x447eb9=a140_0x31de,_0x4383ef=_0x1b5ccd();while(!![]){try{const _0x1c3b6a=parseInt(_0x447eb9(0x125))/0x1+-parseInt(_0x447eb9(0xfd))/0x2*(-parseInt(_0x447eb9(0x114))/0x3)+-parseInt(_0x447eb9(0x11d))/0x4+parseInt(_0x447eb9(0x121))/0x5+-parseInt(_0x447eb9(0x123))/0x6*(-parseInt(_0x447eb9(0x10f))/0x7)+parseInt(_0x447eb9(0x103))/0x8+-parseInt(_0x447eb9(0xfa))/0x9*(parseInt(_0x447eb9(0x11f))/0xa);if(_0x1c3b6a===_0x1a83b9)break;else _0x4383ef['push'](_0x4383ef['shift']());}catch(_0x2279de){_0x4383ef['push'](_0x4383ef['shift']());}}}(a140_0x37e8,0xc51ec));import{createInterface}from'node:readline';function a140_0x37e8(){const _0x1bd0aa=['test','description','9NELRwG','syncedAt','lastSync','\x20[y/N]\x20','endsWith','mybatisXml','trim','<!--\x20@lovrabet.','version','3998888XRERSl','toLowerCase','3623530gvDgSV','map','6239250WRyjmR','apps','2982CKylNV','includes','278394qGsAAf','27HCbbBp','stderr','split','262674ZtkNYO','sqlContent','dbName','\x20-->','--\x20@lovrabet.','dbId','3167352DZXcCj','sqlRoot','filter','join','close','sqlName','entries','.rabetbase/sql','sqlCode','mode','sqlConfig','length','8141EGUwXl','path','question'];a140_0x37e8=function(){return _0x1bd0aa;};return a140_0x37e8();}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a140_0x2e5371(0x10a);export function buildSqlLockEntry(_0x137eb6,_0x3d7ea8,_0x49a286,_0x4683d3){const _0x481ecc=a140_0x2e5371,_0x5814d3=detectSqlMode(_0x3d7ea8);return{'path':buildSqlRelativePath(_0x137eb6[_0x481ecc(0x10b)],_0x137eb6[_0x481ecc(0x108)],_0x4683d3?.['dbName'],_0x5814d3,_0x137eb6[_0x481ecc(0x102)]),'hash':_0x49a286,'remoteId':_0x137eb6['id'],'version':_0x137eb6[_0x481ecc(0x11c)],'dbId':Number(_0x137eb6['dbId']),'dbName':_0x4683d3?.[_0x481ecc(0xff)],'sqlName':_0x137eb6[_0x481ecc(0x108)],'sqlConfig':_0x137eb6[_0x481ecc(0x10d)]??undefined,'mode':_0x5814d3};}export function cloneSqlLockData(_0x3be6cb){const _0x482abc=a140_0x2e5371;return{'apps':Object['fromEntries'](Object[_0x482abc(0x109)](_0x3be6cb[_0x482abc(0x122)])[_0x482abc(0x120)](([_0x422dca,_0x3fe03f])=>[_0x422dca,{'sqlRoot':_0x3fe03f[_0x482abc(0x104)],'lastSync':_0x3fe03f[_0x482abc(0x116)],'sqls':{..._0x3fe03f['sqls']}}]))};}export function ensureRemoteSqlContent(_0x3bc037){const _0x1cc6d5=a140_0x2e5371;return _0x3bc037[_0x1cc6d5(0xfe)]??'';}export function buildLocalSqlFileContent(_0x23f5f2,_0x5bdd3b,_0x1567a6){const _0x3dd1bf=a140_0x2e5371,_0x401527=_0x1567a6?.['mode']??detectSqlMode(_0x5bdd3b),_0x448e51=stripLocalSqlMetadata(_0x5bdd3b,_0x401527)[_0x3dd1bf(0x11a)](),_0x32e24e=[...buildMetadataHeaderLines({'sqlCode':_0x23f5f2[_0x3dd1bf(0x10b)],'sqlName':_0x23f5f2['sqlName'],'dbId':_0x23f5f2[_0x3dd1bf(0x102)],'dbName':_0x1567a6?.[_0x3dd1bf(0xff)],'mode':_0x401527,'syncedAt':_0x1567a6?.[_0x3dd1bf(0x115)],'description':_0x1567a6?.[_0x3dd1bf(0x113)]},_0x401527),'',_0x448e51],_0x40529=_0x32e24e['join']('\x0a');return _0x40529[_0x3dd1bf(0x118)]('\x0a')?_0x40529:_0x40529+'\x0a';}export function stripLocalSqlMetadata(_0x20b45f,_0x402373){const _0x5f0267=a140_0x2e5371,_0x288ae5=_0x20b45f['replace'](/\r\n/g,'\x0a')[_0x5f0267(0xfc)]('\x0a'),_0x407549=[];let _0x38ef1f=0x0;if(_0x402373===_0x5f0267(0x119))while(_0x38ef1f<_0x288ae5['length']){const _0xafeba6=_0x288ae5[_0x38ef1f]??'';if(/^\s*<!--\s*@lovrabet\./[_0x5f0267(0x112)](_0xafeba6)){_0x38ef1f++;continue;}if(_0xafeba6[_0x5f0267(0x11a)]()===''&&_0x38ef1f>0x0){_0x38ef1f++;continue;}break;}else while(_0x38ef1f<_0x288ae5[_0x5f0267(0x10e)]){const _0x30813e=_0x288ae5[_0x38ef1f]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x30813e)){_0x38ef1f++;continue;}if(_0x30813e[_0x5f0267(0x11a)]()===''&&_0x38ef1f>0x0){_0x38ef1f++;continue;}break;}for(;_0x38ef1f<_0x288ae5['length'];_0x38ef1f++){_0x407549['push'](_0x288ae5[_0x38ef1f]);}return _0x407549[_0x5f0267(0x106)]('\x0a')['trimStart']();}export function resolveSqlMode(_0x1311fe,_0x2c8fec){const _0x2b00b7=a140_0x2e5371;if(_0x2c8fec?.[_0x2b00b7(0x10c)])return _0x2c8fec['mode'];return detectSqlMode(_0x1311fe);}export function resolveSqlFileName(_0x57ce8f,_0x169d7f,_0x3ae2b4){const _0x9d18ec=a140_0x2e5371;if(_0x3ae2b4?.[_0x9d18ec(0x110)])return _0x3ae2b4['path'];if(_0x3ae2b4?.[_0x9d18ec(0x108)]||_0x3ae2b4?.[_0x9d18ec(0xff)])return buildSqlRelativePath(_0x57ce8f,_0x3ae2b4?.['sqlName'],_0x3ae2b4?.[_0x9d18ec(0xff)],resolveSqlMode(_0x169d7f,_0x3ae2b4),_0x3ae2b4?.[_0x9d18ec(0x102)]);return buildDefaultSqlFileName(_0x57ce8f,resolveSqlMode(_0x169d7f,_0x3ae2b4));}export function resolveSqlLocalDir(_0x1b2c03,_0x243145){return join(_0x1b2c03,SQL_LOCAL_REL_DIR,_0x243145);}export async function confirmForceOverwrite(_0x2ba946){const _0x1bcb3e=a140_0x2e5371,_0x3beb5c=createInterface({'input':process['stdin'],'output':process[_0x1bcb3e(0xfb)]}),_0x559552=await new Promise(_0x4e5226=>{const _0x1ed2a7=_0x1bcb3e;_0x3beb5c[_0x1ed2a7(0x111)](_0x2ba946+_0x1ed2a7(0x117),_0x4e5226);});return _0x3beb5c[_0x1bcb3e(0x107)](),['y','yes'][_0x1bcb3e(0x124)](_0x559552[_0x1bcb3e(0x11a)]()[_0x1bcb3e(0x11e)]());}function a140_0x31de(_0x2c8303,_0x216d16){_0x2c8303=_0x2c8303-0xfa;const _0x37e869=a140_0x37e8();let _0x31de08=_0x37e869[_0x2c8303];return _0x31de08;}export function findSqlLockScope(_0x536e7d,_0xd9e8){return _0x536e7d['apps'][_0xd9e8];}function buildMetadataHeaderLines(_0x4dfb64,_0x5908f1){const _0x48e970=a140_0x2e5371,_0x56e8d1=[['sqlCode',_0x4dfb64[_0x48e970(0x10b)]],[_0x48e970(0x108),_0x4dfb64[_0x48e970(0x108)]],['dbId',_0x4dfb64[_0x48e970(0x102)]],[_0x48e970(0xff),_0x4dfb64[_0x48e970(0xff)]],[_0x48e970(0x10c),_0x4dfb64['mode']],[_0x48e970(0x115),_0x4dfb64['syncedAt']],[_0x48e970(0x113),_0x4dfb64['description']]];if(_0x5908f1==='mybatisXml')return _0x56e8d1['filter'](([,_0x28d242])=>_0x28d242!==undefined&&_0x28d242!==null&&String(_0x28d242)[_0x48e970(0x11a)]()!=='')['map'](([_0x157664,_0x55b571])=>_0x48e970(0x11b)+_0x157664+':\x20'+String(_0x55b571)+_0x48e970(0x100));return _0x56e8d1[_0x48e970(0x105)](([,_0x1968b5])=>_0x1968b5!==undefined&&_0x1968b5!==null&&String(_0x1968b5)[_0x48e970(0x11a)]()!=='')[_0x48e970(0x120)](([_0xa402ad,_0xae9b69])=>_0x48e970(0x101)+_0xa402ad+':\x20'+String(_0xae9b69));}