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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/README.md +99 -560
  2. package/lib/api/api-doc.js +1 -1
  3. package/lib/api/fetch-model-list.js +1 -1
  4. package/lib/api/generate-api-file.js +1 -1
  5. package/lib/auth/auth-server-ui.js +1 -1
  6. package/lib/auth/auth-server.js +1 -1
  7. package/lib/auth/constant.js +1 -1
  8. package/lib/auth/get-cookie.js +1 -1
  9. package/lib/auth/get-session-user.js +1 -1
  10. package/lib/auth/is-session-valid.js +1 -1
  11. package/lib/auth/login-success-html.js +1 -1
  12. package/lib/auth/logout.js +1 -1
  13. package/lib/cli-flags.js +1 -1
  14. package/lib/cli.js +1 -1
  15. package/lib/commands/api/generate.js +1 -1
  16. package/lib/commands/api/index.js +1 -1
  17. package/lib/commands/api/list.js +1 -1
  18. package/lib/commands/api/pull.js +1 -1
  19. package/lib/commands/api/shared.js +1 -1
  20. package/lib/commands/app/add.js +1 -1
  21. package/lib/commands/app/discover.js +1 -1
  22. package/lib/commands/app/index.js +1 -1
  23. package/lib/commands/app/list.js +1 -1
  24. package/lib/commands/app/remove.js +1 -1
  25. package/lib/commands/app/shared.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/generate.js +1 -1
  65. package/lib/commands/dataset/index.js +1 -1
  66. package/lib/commands/dataset/list.js +1 -1
  67. package/lib/commands/dataset/operations.js +1 -1
  68. package/lib/commands/dataset/relation-audit.js +1 -1
  69. package/lib/commands/dataset/relation-create.js +1 -1
  70. package/lib/commands/dataset/relation-delete.js +1 -1
  71. package/lib/commands/dataset/relation-shared.js +1 -1
  72. package/lib/commands/dataset/relation-update.js +1 -1
  73. package/lib/commands/dataset/relations.js +1 -1
  74. package/lib/commands/dataset/rename.js +1 -1
  75. package/lib/commands/dataset/restore.js +1 -1
  76. package/lib/commands/db/analyze-cancel.js +1 -1
  77. package/lib/commands/db/analyze-start.js +1 -1
  78. package/lib/commands/db/analyze-status.js +1 -1
  79. package/lib/commands/db/create.js +1 -1
  80. package/lib/commands/db/delete.js +1 -1
  81. package/lib/commands/db/detail.js +1 -1
  82. package/lib/commands/db/diff.js +1 -1
  83. package/lib/commands/db/index.js +1 -1
  84. package/lib/commands/db/list.js +1 -1
  85. package/lib/commands/db/shared.js +1 -1
  86. package/lib/commands/db/tables.js +1 -1
  87. package/lib/commands/db/test.js +1 -1
  88. package/lib/commands/db/update.js +1 -1
  89. package/lib/commands/doctor.js +1 -1
  90. package/lib/commands/init/index.js +1 -1
  91. package/lib/commands/issue/index.js +1 -1
  92. package/lib/commands/issue/nudge.js +1 -1
  93. package/lib/commands/issue/report.js +1 -1
  94. package/lib/commands/issue/shared.js +1 -1
  95. package/lib/commands/logs/index.js +1 -1
  96. package/lib/commands/menu/index.js +1 -1
  97. package/lib/commands/menu/list.js +1 -1
  98. package/lib/commands/menu/shared/compare-table.js +1 -1
  99. package/lib/commands/menu/shared/index.js +1 -1
  100. package/lib/commands/menu/shared/inquirer.js +1 -1
  101. package/lib/commands/menu/shared/local-pages.js +1 -1
  102. package/lib/commands/menu/shared/logic.js +1 -1
  103. package/lib/commands/menu/shared/service.js +1 -1
  104. package/lib/commands/menu/shared/sync-core.js +1 -1
  105. package/lib/commands/menu/shared/update-core.js +1 -1
  106. package/lib/commands/menu/shared/valid-url.js +1 -1
  107. package/lib/commands/menu/sync.js +1 -1
  108. package/lib/commands/menu/update.js +1 -1
  109. package/lib/commands/page/generate-start.js +1 -1
  110. package/lib/commands/page/generate-status.js +1 -1
  111. package/lib/commands/page/index.js +1 -1
  112. package/lib/commands/page/pull.js +1 -1
  113. package/lib/commands/page/push.js +1 -1
  114. package/lib/commands/page/relation-audit.js +1 -1
  115. package/lib/commands/page/shared.js +1 -1
  116. package/lib/commands/page/standard-page-status.js +1 -1
  117. package/lib/commands/page/sync.js +1 -1
  118. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  119. package/lib/commands/project/create/format-elapsed.js +1 -1
  120. package/lib/commands/project/create/main.js +1 -1
  121. package/lib/commands/project/create/non-interactive.js +1 -1
  122. package/lib/commands/project/create/project-template-path.js +1 -1
  123. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  124. package/lib/commands/project/create/use-format-code.js +1 -1
  125. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  126. package/lib/commands/project/index.js +1 -1
  127. package/lib/commands/project/init.js +1 -1
  128. package/lib/commands/project/upgrade.js +1 -1
  129. package/lib/commands/registry.js +1 -1
  130. package/lib/commands/run/index.js +1 -1
  131. package/lib/commands/schema.js +1 -1
  132. package/lib/commands/sql/create.js +1 -1
  133. package/lib/commands/sql/delete.js +1 -1
  134. package/lib/commands/sql/detail.js +1 -1
  135. package/lib/commands/sql/exec.js +1 -1
  136. package/lib/commands/sql/index.js +1 -1
  137. package/lib/commands/sql/list.js +1 -1
  138. package/lib/commands/sql/pull.js +1 -1
  139. package/lib/commands/sql/push.js +1 -1
  140. package/lib/commands/sql/save.js +1 -1
  141. package/lib/commands/sql/shared.js +1 -1
  142. package/lib/commands/sql/status.js +1 -1
  143. package/lib/commands/sql/validate.js +1 -1
  144. package/lib/commands/workspace/index.js +1 -1
  145. package/lib/config/schema.js +1 -1
  146. package/lib/constant/cdn.js +1 -1
  147. package/lib/constant/cli.js +1 -1
  148. package/lib/constant/defaults.js +1 -1
  149. package/lib/constant/domain.js +1 -1
  150. package/lib/constant/env.js +1 -1
  151. package/lib/constant/output.js +1 -1
  152. package/lib/constant/paths.js +1 -1
  153. package/lib/constant/risk.js +1 -1
  154. package/lib/context/app-resolver.js +1 -1
  155. package/lib/context/auth-resolver.js +1 -1
  156. package/lib/context/config-loader.js +1 -1
  157. package/lib/context.js +1 -1
  158. package/lib/core/alias-resolver.js +1 -1
  159. package/lib/core/api-client.js +1 -1
  160. package/lib/core/bff/config.js +1 -1
  161. package/lib/core/bff/file-system.js +1 -1
  162. package/lib/core/bff/hash.js +1 -1
  163. package/lib/core/bff/lock.js +1 -1
  164. package/lib/core/bff/utils.js +1 -1
  165. package/lib/core/db-resolver.js +1 -1
  166. package/lib/core/page/file-system.js +1 -1
  167. package/lib/core/page/hash.js +1 -1
  168. package/lib/core/page/lock.js +1 -1
  169. package/lib/core/sql-sync/config.js +1 -1
  170. package/lib/core/sql-sync/file-system.js +1 -1
  171. package/lib/core/sql-sync/hash.js +1 -1
  172. package/lib/core/sql-sync/lock.js +1 -1
  173. package/lib/core/sql-sync/utils.js +1 -1
  174. package/lib/core/sql-validator.js +1 -1
  175. package/lib/errors.js +1 -1
  176. package/lib/framework/build-all-flags.js +1 -1
  177. package/lib/framework/flags.js +1 -1
  178. package/lib/framework/help.js +1 -1
  179. package/lib/framework/index.js +1 -1
  180. package/lib/framework/output.js +1 -1
  181. package/lib/framework/response.js +1 -1
  182. package/lib/framework/runner-alias.js +1 -1
  183. package/lib/framework/runner.js +1 -1
  184. package/lib/framework/schema-export.js +1 -1
  185. package/lib/framework/types.js +1 -1
  186. package/lib/generated/build-info.js +1 -1
  187. package/lib/help.js +1 -1
  188. package/lib/skills/main.js +1 -1
  189. package/lib/skills/npx-skills-add.js +1 -1
  190. package/lib/telemetry/cli-command-trace.js +1 -1
  191. package/lib/telemetry/cli-help-trace.js +1 -1
  192. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  193. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  194. package/lib/telemetry/send-cli-trace-log.js +1 -1
  195. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  196. package/lib/utils/ai_config.js +1 -1
  197. package/lib/utils/apply-jq-filter.js +1 -1
  198. package/lib/utils/cdn-config.js +1 -1
  199. package/lib/utils/check-sdk-version.js +1 -1
  200. package/lib/utils/cli-version-check.js +1 -1
  201. package/lib/utils/cli-version-policy.js +1 -1
  202. package/lib/utils/config.js +1 -1
  203. package/lib/utils/copy-directory.js +1 -1
  204. package/lib/utils/entity-with-id.js +1 -1
  205. package/lib/utils/file-utils.js +1 -1
  206. package/lib/utils/guides-cdn.js +1 -1
  207. package/lib/utils/http-client.js +1 -1
  208. package/lib/utils/is-non-interactive.js +1 -1
  209. package/lib/utils/logger.js +1 -1
  210. package/lib/utils/params.js +1 -1
  211. package/lib/utils/platform.js +1 -1
  212. package/lib/utils/rules-cdn.js +1 -1
  213. package/lib/utils/sleep.js +1 -1
  214. package/lib/utils/template-replacer.js +1 -1
  215. package/lib/utils/update-notice.js +1 -1
  216. package/lib/utils/version.js +1 -1
  217. package/lib/utils/with-active-cookie.js +1 -1
  218. package/lib/utils/write-cli-side-channel.js +1 -1
  219. package/package.json +18 -2
@@ -1 +1 @@
1
- const a128_0x4e6cb3=a128_0x12ef;(function(_0xf252a2,_0x4e9d5b){const _0x16b4e4=a128_0x12ef,_0x1174ec=_0xf252a2();while(!![]){try{const _0x383509=parseInt(_0x16b4e4(0x10e))/0x1*(-parseInt(_0x16b4e4(0xfa))/0x2)+-parseInt(_0x16b4e4(0xfc))/0x3+parseInt(_0x16b4e4(0x105))/0x4*(-parseInt(_0x16b4e4(0x11b))/0x5)+-parseInt(_0x16b4e4(0x10c))/0x6+parseInt(_0x16b4e4(0x100))/0x7+-parseInt(_0x16b4e4(0x103))/0x8*(-parseInt(_0x16b4e4(0xf9))/0x9)+parseInt(_0x16b4e4(0x11f))/0xa;if(_0x383509===_0x4e9d5b)break;else _0x1174ec['push'](_0x1174ec['shift']());}catch(_0x4be0e4){_0x1174ec['push'](_0x1174ec['shift']());}}}(a128_0x3ada,0xb97be));function a128_0x12ef(_0x53b9fa,_0x443ae4){_0x53b9fa=_0x53b9fa-0xeb;const _0x3ada79=a128_0x3ada();let _0x12efa6=_0x3ada79[_0x53b9fa];return _0x12efa6;}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';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(_0x460194){const _0xbf3eaf=a128_0x12ef;for(const _0x277ba3 of _0x460194){definitions['set'](_0x277ba3['service']+':'+_0x277ba3[_0xbf3eaf(0xee)],_0x277ba3);let _0x184da5=serviceGroups[_0xbf3eaf(0xff)](_0x277ba3[_0xbf3eaf(0x122)]);!_0x184da5&&(_0x184da5=[],serviceGroups[_0xbf3eaf(0xf6)](_0x277ba3[_0xbf3eaf(0x122)],_0x184da5)),_0x184da5[_0xbf3eaf(0xeb)](_0x277ba3);}}function registerDeclarativeService(_0x1585e3,_0x234e8c,_0x2dd073){const _0x17fa26=a128_0x12ef;registerDefinitions(_0x234e8c);_0x2dd073?.[_0x17fa26(0x12b)]&&registerDefinitions([_0x2dd073[_0x17fa26(0x12b)]]);const _0x417eb1=_0x4700ec=>_0x4700ec===_0x17fa26(0xf8)?'':_0x4700ec===_0x17fa26(0x10b)?_0x17fa26(0x102):_0x17fa26(0x112),_0x3e457a={'service':_0x234e8c[0x0]['service'],'label':_0x1585e3,'commands':_0x234e8c[_0x17fa26(0x11c)](_0x362467=>({'command':_0x362467['command'],'description':_0x362467[_0x17fa26(0x127)],'tag':_0x417eb1(_0x362467[_0x17fa26(0x120)])})),'declarative':!![],'defaultCommand':_0x2dd073?.[_0x17fa26(0x101)]??(_0x2dd073?.[_0x17fa26(0x113)]?_0x234e8c[0x0][_0x17fa26(0xee)]:undefined),'wildcardDef':_0x2dd073?.['wildcardDef'],'isSingleCommand':_0x2dd073?.['isSingleCommand']};serviceRegistry[_0x17fa26(0xeb)](_0x3e457a),serviceByName[_0x17fa26(0xf6)](_0x3e457a['service'],_0x3e457a);}registerDeclarativeService(a128_0x4e6cb3(0x108),initDefinitions,{'defaultCommand':a128_0x4e6cb3(0xfe),'isSingleCommand':!![]}),registerDeclarativeService(a128_0x4e6cb3(0xef),projectDefinitions),registerDeclarativeService(a128_0x4e6cb3(0x10f),workspaceDefinitions),registerDeclarativeService(a128_0x4e6cb3(0xf3),appDefinitions),registerDeclarativeService(a128_0x4e6cb3(0x11d),authDefinitions,{'defaultCommand':'login'}),registerDeclarativeService(a128_0x4e6cb3(0x126),datasetDefinitions),registerDeclarativeService('Smart\x20List\x20Pages',pageDefinitions),registerDeclarativeService(a128_0x4e6cb3(0xf1),apiDefinitions),registerDeclarativeService('Instant\x20API',dataDefinitions),registerDeclarativeService('BFF\x20Scripts',bffDefinitions),registerDeclarativeService(a128_0x4e6cb3(0xf2),sqlDefinitions),registerDeclarativeService(a128_0x4e6cb3(0x11e),dbDefinitions),registerDeclarativeService(a128_0x4e6cb3(0xfb),menuDefinitions),registerDeclarativeService(a128_0x4e6cb3(0x12a),appConfigDefinitions),registerDeclarativeService('Platform\x20Issue',issueDefinitions),registerDeclarativeService(a128_0x4e6cb3(0xf5),codegenDefinitions),registerDeclarativeService(a128_0x4e6cb3(0xec),configDefinitions),registerDeclarativeService('Diagnostics',[doctorDefinition],{'isSingleCommand':!![]}),registerDeclarativeService(a128_0x4e6cb3(0xf4),[schemaDefinition],{'isSingleCommand':!![]}),registerDeclarativeService(a128_0x4e6cb3(0x115),[updateDefinition],{'isSingleCommand':!![]}),registerDeclarativeService('CLI\x20Built-in\x20Skill',cliSkillDefinitions,{'defaultCommand':'install'}),registerDeclarativeService(a128_0x4e6cb3(0x125),logsDefinitions,{'defaultCommand':'show'}),registerDeclarativeService(a128_0x4e6cb3(0x104),[runDefinition],{'wildcardDef':runDefinition});{const last=serviceRegistry[serviceRegistry[a128_0x4e6cb3(0xfd)]-0x1];last['commands']=[{'command':a128_0x4e6cb3(0xf7),'description':'Run\x20any\x20package.json\x20script','tag':''}];}export const deprecatedAliases={'create':{'service':a128_0x4e6cb3(0x121),'command':a128_0x4e6cb3(0x111)},'start':{'service':'run','command':a128_0x4e6cb3(0xf0)},'build':{'service':a128_0x4e6cb3(0xfe),'command':a128_0x4e6cb3(0x119)},'preview':{'service':'run','command':a128_0x4e6cb3(0x118)},'logout':{'service':'auth','command':a128_0x4e6cb3(0x116)}};const CLI_SKILL_INSTALL_REMOVED_HINT=a128_0x4e6cb3(0x10a),APP_REMOTE_REMOVED_HINT='Use\x20`rabetbase\x20app\x20list\x20--remote`\x20instead.',APP_USE_REMOVED_HINT=a128_0x4e6cb3(0x109);export function resolveRemovedCommand(_0x44f83f,_0x37e0c6){const _0x55d016=a128_0x4e6cb3;if(_0x44f83f===_0x55d016(0xed)){const _0x2e602a=_0x37e0c6?'skill\x20'+_0x37e0c6:_0x55d016(0xed);return{'command':_0x2e602a,'message':'`rabetbase\x20'+_0x2e602a+_0x55d016(0x129),'hint':CLI_SKILL_INSTALL_REMOVED_HINT};}if(_0x44f83f==='skills')return{'command':_0x55d016(0x10d),'message':_0x55d016(0x114),'hint':CLI_SKILL_INSTALL_REMOVED_HINT};if(_0x44f83f===_0x55d016(0x106)&&_0x37e0c6===_0x55d016(0x117))return{'command':'app\x20remote','message':'`rabetbase\x20app\x20remote`\x20has\x20been\x20removed.','hint':APP_REMOTE_REMOVED_HINT};if(_0x44f83f===_0x55d016(0x106)&&_0x37e0c6===_0x55d016(0x124))return{'command':_0x55d016(0x123),'message':_0x55d016(0x110),'hint':APP_USE_REMOVED_HINT};return undefined;}export const deprecatedSubcommands={'bff':{'new':a128_0x4e6cb3(0x111)},'sql':{'new':a128_0x4e6cb3(0x111)}};export function resolveDeprecatedSubcommand(_0x14c969,_0x573081){return deprecatedSubcommands[_0x14c969]?.[_0x573081];}function a128_0x3ada(){const _0x2529aa=['Menu','927960vnAZoI','length','run','get','620438xGLVvo','defaultCommand','\x20\x20[write]','49544TiQSzZ','Run\x20Scripts','326588eMWEYo','app','values','Quick\x20Start','Use\x20`rabetbase\x20workspace\x20use\x20--app\x20<name>`\x20instead.','Use\x20`rabetbase\x20cli-skill\x20install`\x20to\x20refresh\x20the\x20Rabetbase\x20CLI\x20Built-in\x20Skill.\x20To\x20install\x20business\x20Skills,\x20use\x20`lovrabet\x20skill\x20install`.','write','7126410OfvmeK','skills','1mmMYac','Workspace','`rabetbase\x20app\x20use`\x20has\x20been\x20removed.','create','\x20\x20[high-risk-write]','isSingleCommand','`rabetbase\x20skills`\x20has\x20been\x20removed.','Self\x20Update','logout','remote','preview','build','from','20lnYOZq','map','Authentication','Database\x20Connections','33250090AgFWSs','risk','project','service','app\x20use','use','Logs','Dataset\x20&\x20Operations','description','has','`\x20has\x20been\x20removed.','Runtime\x20App\x20Config\x20Management','wildcardDef','push','Configuration','skill','command','Project','start','API\x20Development','SQL\x20Queries','App\x20Management','Schema','Code\x20Generation','set','<script>','read','126uvZwvO','1833920lTxuTP'];a128_0x3ada=function(){return _0x2529aa;};return a128_0x3ada();}export function findDefinition(_0x386090,_0x2f0231){const _0x163536=a128_0x4e6cb3;return definitions[_0x163536(0xff)](_0x386090+':'+_0x2f0231);}export function isKnownService(_0xb75306){const _0x52d62b=a128_0x4e6cb3;return serviceByName[_0x52d62b(0x128)](_0xb75306);}export function isDeclarativeService(_0xc1fe64){const _0x130515=a128_0x4e6cb3;return serviceGroups[_0x130515(0x128)](_0xc1fe64)||serviceByName[_0x130515(0xff)](_0xc1fe64)?.[_0x130515(0x12b)]!==undefined;}export function getServiceEntry(_0x21d556){const _0x433fe2=a128_0x4e6cb3;return serviceByName[_0x433fe2(0xff)](_0x21d556);}export function getLegacyHandler(_0x3987c,_0x34701c){return undefined;}export function getAllDefinitions(){const _0x3125ce=a128_0x4e6cb3;return Array[_0x3125ce(0x11a)](definitions[_0x3125ce(0x107)]());}
1
+ const a128_0x38643d=a128_0x2ca2;(function(_0x3e1f46,_0x255fee){const _0x4bc15f=a128_0x2ca2,_0x337d2f=_0x3e1f46();while(!![]){try{const _0x2b228a=parseInt(_0x4bc15f(0x153))/0x1*(parseInt(_0x4bc15f(0x15a))/0x2)+-parseInt(_0x4bc15f(0x14e))/0x3*(parseInt(_0x4bc15f(0x146))/0x4)+-parseInt(_0x4bc15f(0x143))/0x5+-parseInt(_0x4bc15f(0x166))/0x6+parseInt(_0x4bc15f(0x16d))/0x7*(parseInt(_0x4bc15f(0x14b))/0x8)+-parseInt(_0x4bc15f(0x152))/0x9*(parseInt(_0x4bc15f(0x151))/0xa)+parseInt(_0x4bc15f(0x167))/0xb;if(_0x2b228a===_0x255fee)break;else _0x337d2f['push'](_0x337d2f['shift']());}catch(_0x4908f7){_0x337d2f['push'](_0x337d2f['shift']());}}}(a128_0x5999,0xbd0a0));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';function a128_0x5999(){const _0x4b3fc0=['15111877jaWdPs','CLI\x20Built-in\x20Skill','map','skill','Self\x20Update','Run\x20Scripts','21eoYRyl','Run\x20any\x20package.json\x20script','<script>','skills','read','Code\x20Generation','use','SQL\x20Queries','create','auth','`rabetbase\x20app\x20use`\x20has\x20been\x20removed.','install','start','description','API\x20Development','get','Use\x20`rabetbase\x20workspace\x20use\x20--app\x20<name>`\x20instead.','Database\x20Connections','commands','Platform\x20Issue','from','Project','defaultCommand','Runtime\x20App\x20Config\x20Management','risk','`rabetbase\x20app\x20remote`\x20has\x20been\x20removed.','Use\x20`rabetbase\x20cli-skill\x20install`\x20to\x20refresh\x20the\x20Rabetbase\x20CLI\x20Built-in\x20Skill.\x20To\x20install\x20business\x20Skills,\x20use\x20`lovrabet\x20skill\x20install`.','791245lhYJLi','login','set','4SIhCOl','Dataset\x20&\x20Operations','app\x20use','write','app','1083584NhjxvC','isSingleCommand','service','142257oedjZt','command','Smart\x20List\x20Pages','10RkyRep','13451166icsPfI','206616AKVEsL','Menu','Schema','app\x20remote','push','Authentication','`\x20has\x20been\x20removed.','8SWCaBV','skill\x20','`rabetbase\x20skills`\x20has\x20been\x20removed.','run','length','Logs','project','build','wildcardDef','has','BFF\x20Scripts','values','792414ecGCqO'];a128_0x5999=function(){return _0x4b3fc0;};return a128_0x5999();}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';function a128_0x2ca2(_0x1a53d3,_0x37accf){_0x1a53d3=_0x1a53d3-0x129;const _0x599913=a128_0x5999();let _0x2ca26e=_0x599913[_0x1a53d3];return _0x2ca26e;}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(_0x5ca97e){const _0xcb5663=a128_0x2ca2;for(const _0x44043d of _0x5ca97e){definitions[_0xcb5663(0x145)](_0x44043d[_0xcb5663(0x14d)]+':'+_0x44043d[_0xcb5663(0x14f)],_0x44043d);let _0x3b7197=serviceGroups[_0xcb5663(0x137)](_0x44043d['service']);!_0x3b7197&&(_0x3b7197=[],serviceGroups[_0xcb5663(0x145)](_0x44043d['service'],_0x3b7197)),_0x3b7197[_0xcb5663(0x157)](_0x44043d);}}function registerDeclarativeService(_0x3a9009,_0x13300a,_0x5b5180){const _0x17e362=a128_0x2ca2;registerDefinitions(_0x13300a);_0x5b5180?.['wildcardDef']&&registerDefinitions([_0x5b5180[_0x17e362(0x162)]]);const _0x1edb0c=_0x16675f=>_0x16675f===_0x17e362(0x12c)?'':_0x16675f===_0x17e362(0x149)?'\x20\x20[write]':'\x20\x20[high-risk-write]',_0x2cb695={'service':_0x13300a[0x0][_0x17e362(0x14d)],'label':_0x3a9009,'commands':_0x13300a[_0x17e362(0x169)](_0x57b0f0=>({'command':_0x57b0f0[_0x17e362(0x14f)],'description':_0x57b0f0[_0x17e362(0x135)],'tag':_0x1edb0c(_0x57b0f0[_0x17e362(0x140)])})),'declarative':!![],'defaultCommand':_0x5b5180?.[_0x17e362(0x13e)]??(_0x5b5180?.[_0x17e362(0x14c)]?_0x13300a[0x0][_0x17e362(0x14f)]:undefined),'wildcardDef':_0x5b5180?.[_0x17e362(0x162)],'isSingleCommand':_0x5b5180?.[_0x17e362(0x14c)]};serviceRegistry[_0x17e362(0x157)](_0x2cb695),serviceByName[_0x17e362(0x145)](_0x2cb695['service'],_0x2cb695);}registerDeclarativeService('Quick\x20Start',initDefinitions,{'defaultCommand':'run','isSingleCommand':!![]}),registerDeclarativeService(a128_0x38643d(0x13d),projectDefinitions),registerDeclarativeService('Workspace',workspaceDefinitions),registerDeclarativeService('App\x20Management',appDefinitions),registerDeclarativeService(a128_0x38643d(0x158),authDefinitions,{'defaultCommand':a128_0x38643d(0x144)}),registerDeclarativeService(a128_0x38643d(0x147),datasetDefinitions),registerDeclarativeService(a128_0x38643d(0x150),pageDefinitions),registerDeclarativeService(a128_0x38643d(0x136),apiDefinitions),registerDeclarativeService('Instant\x20API',dataDefinitions),registerDeclarativeService(a128_0x38643d(0x164),bffDefinitions),registerDeclarativeService(a128_0x38643d(0x12f),sqlDefinitions),registerDeclarativeService(a128_0x38643d(0x139),dbDefinitions),registerDeclarativeService(a128_0x38643d(0x154),menuDefinitions),registerDeclarativeService(a128_0x38643d(0x13f),appConfigDefinitions),registerDeclarativeService(a128_0x38643d(0x13b),issueDefinitions),registerDeclarativeService(a128_0x38643d(0x12d),codegenDefinitions),registerDeclarativeService('Configuration',configDefinitions),registerDeclarativeService('Diagnostics',[doctorDefinition],{'isSingleCommand':!![]}),registerDeclarativeService(a128_0x38643d(0x155),[schemaDefinition],{'isSingleCommand':!![]}),registerDeclarativeService(a128_0x38643d(0x16b),[updateDefinition],{'isSingleCommand':!![]}),registerDeclarativeService(a128_0x38643d(0x168),cliSkillDefinitions,{'defaultCommand':a128_0x38643d(0x133)}),registerDeclarativeService(a128_0x38643d(0x15f),logsDefinitions,{'defaultCommand':'show'}),registerDeclarativeService(a128_0x38643d(0x16c),[runDefinition],{'wildcardDef':runDefinition});{const last=serviceRegistry[serviceRegistry[a128_0x38643d(0x15e)]-0x1];last[a128_0x38643d(0x13a)]=[{'command':a128_0x38643d(0x12a),'description':a128_0x38643d(0x129),'tag':''}];}export const deprecatedAliases={'create':{'service':a128_0x38643d(0x160),'command':a128_0x38643d(0x130)},'start':{'service':a128_0x38643d(0x15d),'command':a128_0x38643d(0x134)},'build':{'service':a128_0x38643d(0x15d),'command':a128_0x38643d(0x161)},'preview':{'service':a128_0x38643d(0x15d),'command':'preview'},'logout':{'service':a128_0x38643d(0x131),'command':'logout'}};const CLI_SKILL_INSTALL_REMOVED_HINT=a128_0x38643d(0x142),APP_REMOTE_REMOVED_HINT='Use\x20`rabetbase\x20app\x20list\x20--remote`\x20instead.',APP_USE_REMOVED_HINT=a128_0x38643d(0x138);export function resolveRemovedCommand(_0xec4854,_0x3915e0){const _0x3ab021=a128_0x38643d;if(_0xec4854===_0x3ab021(0x16a)){const _0x1a4249=_0x3915e0?_0x3ab021(0x15b)+_0x3915e0:_0x3ab021(0x16a);return{'command':_0x1a4249,'message':'`rabetbase\x20'+_0x1a4249+_0x3ab021(0x159),'hint':CLI_SKILL_INSTALL_REMOVED_HINT};}if(_0xec4854===_0x3ab021(0x12b))return{'command':'skills','message':_0x3ab021(0x15c),'hint':CLI_SKILL_INSTALL_REMOVED_HINT};if(_0xec4854===_0x3ab021(0x14a)&&_0x3915e0==='remote')return{'command':_0x3ab021(0x156),'message':_0x3ab021(0x141),'hint':APP_REMOTE_REMOVED_HINT};if(_0xec4854===_0x3ab021(0x14a)&&_0x3915e0===_0x3ab021(0x12e))return{'command':_0x3ab021(0x148),'message':_0x3ab021(0x132),'hint':APP_USE_REMOVED_HINT};return undefined;}export const deprecatedSubcommands={'bff':{'new':a128_0x38643d(0x130)},'sql':{'new':'create'}};export function resolveDeprecatedSubcommand(_0xd62d7a,_0x5c6aaf){return deprecatedSubcommands[_0xd62d7a]?.[_0x5c6aaf];}export function findDefinition(_0x6e2a9d,_0x45c114){const _0x5af896=a128_0x38643d;return definitions[_0x5af896(0x137)](_0x6e2a9d+':'+_0x45c114);}export function isKnownService(_0x2e0377){const _0x26bb23=a128_0x38643d;return serviceByName[_0x26bb23(0x163)](_0x2e0377);}export function isDeclarativeService(_0x44fbca){const _0x1d01f3=a128_0x38643d;return serviceGroups['has'](_0x44fbca)||serviceByName[_0x1d01f3(0x137)](_0x44fbca)?.['wildcardDef']!==undefined;}export function getServiceEntry(_0x314803){const _0x229a96=a128_0x38643d;return serviceByName[_0x229a96(0x137)](_0x314803);}export function getLegacyHandler(_0x34532e,_0x40a341){return undefined;}export function getAllDefinitions(){const _0x3e82d5=a128_0x38643d;return Array[_0x3e82d5(0x13c)](definitions[_0x3e82d5(0x165)]());}
@@ -1 +1 @@
1
- const a129_0x72e06b=a129_0x3d55;(function(_0x54e745,_0x578ca4){const _0x1838a4=a129_0x3d55,_0x4b9bcb=_0x54e745();while(!![]){try{const _0x50d11d=parseInt(_0x1838a4(0x18d))/0x1+-parseInt(_0x1838a4(0x1a3))/0x2*(parseInt(_0x1838a4(0x19a))/0x3)+-parseInt(_0x1838a4(0x179))/0x4*(-parseInt(_0x1838a4(0x193))/0x5)+-parseInt(_0x1838a4(0x190))/0x6*(parseInt(_0x1838a4(0x19c))/0x7)+parseInt(_0x1838a4(0x177))/0x8+-parseInt(_0x1838a4(0x16b))/0x9+parseInt(_0x1838a4(0x171))/0xa;if(_0x50d11d===_0x578ca4)break;else _0x4b9bcb['push'](_0x4b9bcb['shift']());}catch(_0x1503e5){_0x4b9bcb['push'](_0x4b9bcb['shift']());}}}(a129_0x4e85,0x1e0bf));function a129_0x4e85(){const _0x3df6b7=['\x20\x20EXAMPLES','\x22\x20not\x20found\x20in\x20package.json.','198cWldlF','bool','script','5wEnITY','\x20run\x20<script>\x0a','log','validation','utf-8','bun.lockb','pnpm','128619QWqzMQ','Run\x20a\x20package.json\x20script','46298iZHoLn','\x0a\x20\x20Usage:\x20','needsUpgrade','Enable\x20watch\x20mode\x20for\x20preview','Script\x20name\x20defined\x20in\x20package.json','yarn.lock','.bin','2Hqiqym','vite\x20preview\x20exited\x20with\x20code\x20','\x20run\x20preview\x20--watch','build','No\x20package.json\x20found\x20in\x20current\x20directory.','2173365rlDGiZ','start','join','error','parse','inherit','5247620PzBZuK','\x20run\x20','yarn','all','read','close','712848YvUsji','slice','32436loZnTb','package.json','push','args','\x0a\x20\x20Available\x20scripts:\x0a','dev','npm','--watch','pnpm-lock.yaml','bun','vite','run','has','keys','boolean','\x20\x20\x20\x20','preview','\x20run\x20preview','node_modules','watch','3714gAbcAp'];a129_0x4e85=function(){return _0x3df6b7;};return a129_0x4e85();}import{readFileSync,existsSync}from'node:fs';function a129_0x3d55(_0x42c082,_0x47d6a6){_0x42c082=_0x42c082-0x16a;const _0x4e8532=a129_0x4e85();let _0x3d55b3=_0x4e8532[_0x42c082];return _0x3d55b3;}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_0x72e06b(0x16c),a129_0x72e06b(0x17e)]);function readPackageScripts(_0x1422b9){const _0x11fe8e=a129_0x72e06b,_0x3b889e=resolve(_0x1422b9,_0x11fe8e(0x17a));if(!existsSync(_0x3b889e))return null;try{const _0x74c69a=JSON[_0x11fe8e(0x16f)](readFileSync(_0x3b889e,_0x11fe8e(0x197)));return _0x74c69a['scripts']??{};}catch{return null;}}function detectPackageManager(_0x6c9436){const _0x50fb39=a129_0x72e06b;if(existsSync(resolve(_0x6c9436,_0x50fb39(0x198)))||existsSync(resolve(_0x6c9436,'bun.lock')))return _0x50fb39(0x182);if(existsSync(resolve(_0x6c9436,_0x50fb39(0x181))))return _0x50fb39(0x199);if(existsSync(resolve(_0x6c9436,_0x50fb39(0x1a1))))return _0x50fb39(0x173);return _0x50fb39(0x17f);}async function versionCheck(_0x5aac81){const _0x51763c=a129_0x72e06b,_0x41e3b4=await checkCliVersion();(_0x41e3b4[_0x51763c(0x19e)]||_0x41e3b4['belowMinimum'])&&(printCliUpgradeWarning(_0x41e3b4),assertCliVersionSupported(_0x41e3b4));const _0x5a2522=await checkSdkVersion(_0x5aac81);if(_0x5a2522[_0x51763c(0x19e)])printSdkUpgradeWarning(_0x5a2522);}function spawnScript(_0x413336,_0xeb922a,_0x42f1da,_0xbace04){return new Promise((_0x36ec4c,_0x430b63)=>{const _0x2a0434=a129_0x3d55,_0x5b1d19=[_0x2a0434(0x184),_0xeb922a,..._0x42f1da],_0x3b014d=spawn(_0x413336,_0x5b1d19,{'cwd':_0xbace04,'stdio':_0x2a0434(0x170),'shell':!![],'env':{...process.env,'PATH':''+join(_0xbace04,_0x2a0434(0x18b),'.bin')+delimiter+process.env.PATH}});_0x3b014d['on'](_0x2a0434(0x176),_0x4b4415=>{const _0x3d31a4=_0x2a0434;if(_0x4b4415===0x0||_0x4b4415===null)_0x36ec4c();else _0x430b63(new Error(_0x413336+_0x3d31a4(0x172)+_0xeb922a+'\x20exited\x20with\x20code\x20'+_0x4b4415));}),_0x3b014d['on'](_0x2a0434(0x16e),_0x430b63);});}function spawnViteBuildWatch(_0xd0f144){return new Promise((_0x297696,_0xc30ee0)=>{const _0x5b7ce6=a129_0x3d55,_0x22b7c2=spawn(_0x5b7ce6(0x183),[_0x5b7ce6(0x1a6),_0x5b7ce6(0x180)],{'cwd':_0xd0f144,'stdio':_0x5b7ce6(0x170),'shell':!![],'env':{...process.env,'PATH':''+join(_0xd0f144,_0x5b7ce6(0x18b),_0x5b7ce6(0x1a2))+delimiter+process.env.PATH}});_0x22b7c2['on']('close',_0x180165=>{if(_0x180165===0x0||_0x180165===null)_0x297696();else _0xc30ee0(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x180165));}),_0x22b7c2['on'](_0x5b7ce6(0x16e),_0xc30ee0);});}function spawnVitePreview(_0x57fa3e){return new Promise((_0x291480,_0x2dcf37)=>{const _0x2b6286=a129_0x3d55,_0x112864=spawn(_0x2b6286(0x183),[_0x2b6286(0x189)],{'cwd':_0x57fa3e,'stdio':_0x2b6286(0x170),'shell':!![],'env':{...process.env,'PATH':''+join(_0x57fa3e,_0x2b6286(0x18b),_0x2b6286(0x1a2))+delimiter+process.env.PATH}});_0x112864['on']('close',_0x235e36=>{const _0x1ca0e2=_0x2b6286;if(_0x235e36===0x0||_0x235e36===null)_0x291480();else _0x2dcf37(new Error(_0x1ca0e2(0x1a4)+_0x235e36));}),_0x112864['on'](_0x2b6286(0x16e),_0x2dcf37);});}const runFlags=[{'name':a129_0x72e06b(0x18c),'type':a129_0x72e06b(0x187),'description':a129_0x72e06b(0x19f),'default':![]}];export const runDefinition={'service':a129_0x72e06b(0x184),'command':'run','description':a129_0x72e06b(0x19b),'risk':a129_0x72e06b(0x175),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a129_0x72e06b(0x192),'description':a129_0x72e06b(0x1a0),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x2cb609=a129_0x72e06b,_0x1420be=[];return _0x1420be[_0x2cb609(0x17b)](_0x2cb609(0x18e)),_0x1420be['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20start'),_0x1420be['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20build'),_0x1420be[_0x2cb609(0x17b)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x2cb609(0x18a)),_0x1420be[_0x2cb609(0x17b)](_0x2cb609(0x188)+CLI_BIN_NAME+_0x2cb609(0x1a5)),_0x1420be[_0x2cb609(0x16d)]('\x0a');},async 'execute'(_0x235ea3){const _0x44e5c3=a129_0x72e06b,_0x2bcd1c=process['cwd'](),_0x4e2834=_0x235ea3[_0x44e5c3(0x17c)][0x0],_0x4aa8c2=_0x235ea3[_0x44e5c3(0x17c)][_0x44e5c3(0x178)](0x1),_0x29aa19=readPackageScripts(_0x2bcd1c);if(!_0x29aa19)throw CliErrors[_0x44e5c3(0x196)](_0x44e5c3(0x16a));if(!_0x4e2834){const _0x558538=Object[_0x44e5c3(0x186)](_0x29aa19);if(_0x558538['length']===0x0)console['log']('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x44e5c3(0x195)](_0x44e5c3(0x17d));for(const _0x49a446 of _0x558538){console[_0x44e5c3(0x195)](_0x44e5c3(0x188)+_0x49a446);}console[_0x44e5c3(0x195)](_0x44e5c3(0x19d)+CLI_BIN_NAME+_0x44e5c3(0x194));}return{'ok':!![]};}if(!_0x29aa19[_0x4e2834])throw CliErrors['validation']('Script\x20\x22'+_0x4e2834+_0x44e5c3(0x18f),'Available:\x20'+(Object[_0x44e5c3(0x186)](_0x29aa19)['join'](',\x20')||'(none)'));const _0x461fc3=detectPackageManager(_0x2bcd1c);VERSION_CHECK_SCRIPTS[_0x44e5c3(0x185)](_0x4e2834)&&await versionCheck(_0x2bcd1c);if(_0x4e2834===_0x44e5c3(0x189)&&_0x235ea3[_0x44e5c3(0x191)](_0x44e5c3(0x18c)))return await Promise[_0x44e5c3(0x174)]([spawnViteBuildWatch(_0x2bcd1c),spawnVitePreview(_0x2bcd1c)]),{'ok':!![]};return await spawnScript(_0x461fc3,_0x4e2834,_0x4aa8c2,_0x2bcd1c),{'ok':!![]};}};
1
+ const a129_0x4c7c43=a129_0x33f3;(function(_0x3e9259,_0x15cefe){const _0xd66249=a129_0x33f3,_0x4a6e42=_0x3e9259();while(!![]){try{const _0x1439aa=parseInt(_0xd66249(0x152))/0x1*(parseInt(_0xd66249(0x157))/0x2)+-parseInt(_0xd66249(0x151))/0x3+parseInt(_0xd66249(0x11f))/0x4+-parseInt(_0xd66249(0x128))/0x5*(-parseInt(_0xd66249(0x158))/0x6)+parseInt(_0xd66249(0x121))/0x7+-parseInt(_0xd66249(0x148))/0x8*(-parseInt(_0xd66249(0x12a))/0x9)+-parseInt(_0xd66249(0x15d))/0xa;if(_0x1439aa===_0x15cefe)break;else _0x4a6e42['push'](_0x4a6e42['shift']());}catch(_0x5b3fba){_0x4a6e42['push'](_0x4a6e42['shift']());}}}(a129_0x550e,0x446a5));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';function a129_0x33f3(_0x3b7acd,_0x144463){_0x3b7acd=_0x3b7acd-0x11c;const _0x550ea4=a129_0x550e();let _0x33f3af=_0x550ea4[_0x3b7acd];return _0x33f3af;}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(['start',a129_0x4c7c43(0x131)]);function readPackageScripts(_0x495fbf){const _0x2fd21f=a129_0x4c7c43,_0x1332f9=resolve(_0x495fbf,_0x2fd21f(0x140));if(!existsSync(_0x1332f9))return null;try{const _0x15d81f=JSON[_0x2fd21f(0x139)](readFileSync(_0x1332f9,'utf-8'));return _0x15d81f[_0x2fd21f(0x14f)]??{};}catch{return null;}}function detectPackageManager(_0xd0a5df){const _0x5f370a=a129_0x4c7c43;if(existsSync(resolve(_0xd0a5df,_0x5f370a(0x14b)))||existsSync(resolve(_0xd0a5df,_0x5f370a(0x145))))return _0x5f370a(0x13f);if(existsSync(resolve(_0xd0a5df,_0x5f370a(0x124))))return _0x5f370a(0x13a);if(existsSync(resolve(_0xd0a5df,_0x5f370a(0x156))))return _0x5f370a(0x126);return _0x5f370a(0x14a);}function a129_0x550e(){const _0x3c0c4e=['\x20run\x20start','pnpm-lock.yaml','length','yarn','Available:\x20','60765EJkqfR','\x20run\x20preview','3336363NSxzKa','keys','needsUpgrade','boolean','\x20\x20EXAMPLES','validation','\x20run\x20','dev','(none)','bool','\x0a\x20\x20Usage:\x20','join','log','Run\x20a\x20package.json\x20script','Enable\x20watch\x20mode\x20for\x20preview','parse','pnpm','.bin','\x22\x20not\x20found\x20in\x20package.json.','node_modules','\x20exited\x20with\x20code\x20','bun','package.json','vite\x20preview\x20exited\x20with\x20code\x20','close','vite','watch','bun.lock','\x20run\x20build','preview','8QacyAx','No\x20package.json\x20found\x20in\x20current\x20directory.','npm','bun.lockb','has','Script\x20name\x20defined\x20in\x20package.json','cwd','scripts','all','117972CnMJqW','11iFWxDd','--watch','inherit','error','yarn.lock','85322tZWWGC','156ayPWsY','\x20\x20\x20\x20','build','\x0a\x20\x20Available\x20scripts:\x0a','run','12554220ZDOeDT','push','script','\x20run\x20<script>\x0a','read','args','belowMinimum','1025880puMOWF','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','1137843OhptDA','\x20run\x20preview\x20--watch'];a129_0x550e=function(){return _0x3c0c4e;};return a129_0x550e();}async function versionCheck(_0x364aa3){const _0x55ce29=a129_0x4c7c43,_0x44bcec=await checkCliVersion();(_0x44bcec['needsUpgrade']||_0x44bcec[_0x55ce29(0x11e)])&&(printCliUpgradeWarning(_0x44bcec),assertCliVersionSupported(_0x44bcec));const _0x3bc452=await checkSdkVersion(_0x364aa3);if(_0x3bc452[_0x55ce29(0x12c)])printSdkUpgradeWarning(_0x3bc452);}function spawnScript(_0x1e2a0a,_0x4346d5,_0x2f0442,_0x564203){return new Promise((_0xcb2a0e,_0x5280c3)=>{const _0x598dc1=a129_0x33f3,_0x43136d=['run',_0x4346d5,..._0x2f0442],_0x1624fe=spawn(_0x1e2a0a,_0x43136d,{'cwd':_0x564203,'stdio':_0x598dc1(0x154),'shell':!![],'env':{...process.env,'PATH':''+join(_0x564203,'node_modules',_0x598dc1(0x13b))+delimiter+process.env.PATH}});_0x1624fe['on'](_0x598dc1(0x142),_0x343263=>{const _0x1e4898=_0x598dc1;if(_0x343263===0x0||_0x343263===null)_0xcb2a0e();else _0x5280c3(new Error(_0x1e2a0a+_0x1e4898(0x130)+_0x4346d5+_0x1e4898(0x13e)+_0x343263));}),_0x1624fe['on'](_0x598dc1(0x155),_0x5280c3);});}function spawnViteBuildWatch(_0x15a6f3){return new Promise((_0x44a0a3,_0x8ba148)=>{const _0xd2bd34=a129_0x33f3,_0x102219=spawn('vite',[_0xd2bd34(0x15a),_0xd2bd34(0x153)],{'cwd':_0x15a6f3,'stdio':_0xd2bd34(0x154),'shell':!![],'env':{...process.env,'PATH':''+join(_0x15a6f3,'node_modules','.bin')+delimiter+process.env.PATH}});_0x102219['on'](_0xd2bd34(0x142),_0x1929a0=>{const _0x38a945=_0xd2bd34;if(_0x1929a0===0x0||_0x1929a0===null)_0x44a0a3();else _0x8ba148(new Error(_0x38a945(0x120)+_0x1929a0));}),_0x102219['on'](_0xd2bd34(0x155),_0x8ba148);});}function spawnVitePreview(_0x1342b7){return new Promise((_0x2ebb3a,_0x145f84)=>{const _0x387fa2=a129_0x33f3,_0x1b82a1=spawn(_0x387fa2(0x143),[_0x387fa2(0x147)],{'cwd':_0x1342b7,'stdio':_0x387fa2(0x154),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1342b7,_0x387fa2(0x13d),_0x387fa2(0x13b))+delimiter+process.env.PATH}});_0x1b82a1['on'](_0x387fa2(0x142),_0x599430=>{const _0x307812=_0x387fa2;if(_0x599430===0x0||_0x599430===null)_0x2ebb3a();else _0x145f84(new Error(_0x307812(0x141)+_0x599430));}),_0x1b82a1['on']('error',_0x145f84);});}const runFlags=[{'name':a129_0x4c7c43(0x144),'type':a129_0x4c7c43(0x12d),'description':a129_0x4c7c43(0x138),'default':![]}];export const runDefinition={'service':a129_0x4c7c43(0x15c),'command':a129_0x4c7c43(0x15c),'description':a129_0x4c7c43(0x137),'risk':a129_0x4c7c43(0x11c),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a129_0x4c7c43(0x15f),'description':a129_0x4c7c43(0x14d),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x2bbee4=a129_0x4c7c43,_0x48b5b9=[];return _0x48b5b9[_0x2bbee4(0x15e)](_0x2bbee4(0x12e)),_0x48b5b9['push'](_0x2bbee4(0x159)+CLI_BIN_NAME+_0x2bbee4(0x123)),_0x48b5b9['push'](_0x2bbee4(0x159)+CLI_BIN_NAME+_0x2bbee4(0x146)),_0x48b5b9[_0x2bbee4(0x15e)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x2bbee4(0x129)),_0x48b5b9['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x2bbee4(0x122)),_0x48b5b9[_0x2bbee4(0x135)]('\x0a');},async 'execute'(_0x29cd38){const _0x3af351=a129_0x4c7c43,_0x2c81b6=process[_0x3af351(0x14e)](),_0x4cc76c=_0x29cd38[_0x3af351(0x11d)][0x0],_0x285257=_0x29cd38[_0x3af351(0x11d)]['slice'](0x1),_0x20eb23=readPackageScripts(_0x2c81b6);if(!_0x20eb23)throw CliErrors[_0x3af351(0x12f)](_0x3af351(0x149));if(!_0x4cc76c){const _0x43d980=Object[_0x3af351(0x12b)](_0x20eb23);if(_0x43d980[_0x3af351(0x125)]===0x0)console[_0x3af351(0x136)]('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x3af351(0x136)](_0x3af351(0x15b));for(const _0x2b29c6 of _0x43d980){console[_0x3af351(0x136)]('\x20\x20\x20\x20'+_0x2b29c6);}console[_0x3af351(0x136)](_0x3af351(0x134)+CLI_BIN_NAME+_0x3af351(0x160));}return{'ok':!![]};}if(!_0x20eb23[_0x4cc76c])throw CliErrors[_0x3af351(0x12f)]('Script\x20\x22'+_0x4cc76c+_0x3af351(0x13c),_0x3af351(0x127)+(Object['keys'](_0x20eb23)['join'](',\x20')||_0x3af351(0x132)));const _0x3b70a6=detectPackageManager(_0x2c81b6);VERSION_CHECK_SCRIPTS[_0x3af351(0x14c)](_0x4cc76c)&&await versionCheck(_0x2c81b6);if(_0x4cc76c===_0x3af351(0x147)&&_0x29cd38[_0x3af351(0x133)](_0x3af351(0x144)))return await Promise[_0x3af351(0x150)]([spawnViteBuildWatch(_0x2c81b6),spawnVitePreview(_0x2c81b6)]),{'ok':!![]};return await spawnScript(_0x3b70a6,_0x4cc76c,_0x285257,_0x2c81b6),{'ok':!![]};}};
@@ -1 +1 @@
1
- const a130_0x36fe87=a130_0x5e47;function a130_0x5ec3(){const _0x33247f=['17127salbel','11219362plnlEk','json','40043DzZPkL','8418465PjLYzz','read','3179124hPuotd','618ViUeVL','720bzQiQl','11516deSSNq','schema','141624XacVNU','Export\x20machine-readable\x20command\x20schema\x20(JSON)'];a130_0x5ec3=function(){return _0x33247f;};return a130_0x5ec3();}(function(_0x4537ef,_0x5e168f){const _0x28308f=a130_0x5e47,_0x1b6252=_0x4537ef();while(!![]){try{const _0x3c47c9=-parseInt(_0x28308f(0x8a))/0x1+parseInt(_0x28308f(0x85))/0x2+parseInt(_0x28308f(0x81))/0x3*(parseInt(_0x28308f(0x83))/0x4)+-parseInt(_0x28308f(0x7e))/0x5+parseInt(_0x28308f(0x80))/0x6+parseInt(_0x28308f(0x88))/0x7+-parseInt(_0x28308f(0x82))/0x8*(parseInt(_0x28308f(0x87))/0x9);if(_0x3c47c9===_0x5e168f)break;else _0x1b6252['push'](_0x1b6252['shift']());}catch(_0x1ea31c){_0x1b6252['push'](_0x1b6252['shift']());}}}(a130_0x5ec3,0xdc17c));import{buildSchemaPayload}from'../framework/schema-export.js';function a130_0x5e47(_0x34db7c,_0x59eaeb){_0x34db7c=_0x34db7c-0x7e;const _0x5ec3fc=a130_0x5ec3();let _0x5e4767=_0x5ec3fc[_0x34db7c];return _0x5e4767;}async function execute(_0x2df451){const _0x59215c=await buildSchemaPayload();return{'ok':!![],'data':_0x59215c};}export const schemaDefinition={'service':a130_0x36fe87(0x84),'command':'export','description':a130_0x36fe87(0x86),'risk':a130_0x36fe87(0x7f),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a130_0x36fe87(0x89),'flags':[],'execute':execute};
1
+ const a130_0x4b247=a130_0x45c1;function a130_0x45c1(_0x27bf5a,_0x2e2269){_0x27bf5a=_0x27bf5a-0xb0;const _0x568995=a130_0x5689();let _0x45c198=_0x568995[_0x27bf5a];return _0x45c198;}(function(_0x43d4de,_0x1762ec){const _0x5471d0=a130_0x45c1,_0x413a91=_0x43d4de();while(!![]){try{const _0x1e4e42=-parseInt(_0x5471d0(0xbb))/0x1+-parseInt(_0x5471d0(0xb8))/0x2*(parseInt(_0x5471d0(0xb3))/0x3)+-parseInt(_0x5471d0(0xb9))/0x4*(-parseInt(_0x5471d0(0xb7))/0x5)+parseInt(_0x5471d0(0xba))/0x6+parseInt(_0x5471d0(0xb1))/0x7*(parseInt(_0x5471d0(0xbe))/0x8)+-parseInt(_0x5471d0(0xbc))/0x9*(-parseInt(_0x5471d0(0xb2))/0xa)+-parseInt(_0x5471d0(0xbd))/0xb;if(_0x1e4e42===_0x1762ec)break;else _0x413a91['push'](_0x413a91['shift']());}catch(_0x1b4aa1){_0x413a91['push'](_0x413a91['shift']());}}}(a130_0x5689,0x6edcc));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x32bbde){const _0x2ff796=await buildSchemaPayload();return{'ok':!![],'data':_0x2ff796};}export const schemaDefinition={'service':a130_0x4b247(0xb0),'command':a130_0x4b247(0xb5),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a130_0x4b247(0xb4),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a130_0x4b247(0xb6),'flags':[],'execute':execute};function a130_0x5689(){const _0x2fb950=['7947500wtujuD','16600FBjetF','schema','2527ycbuwX','20DdqFTL','303RPPXnW','read','export','json','53005YyMHag','13276gqJkXu','276VbVbNx','4517802CFgTEH','768733CQdYTX','1720134MsmlwW'];a130_0x5689=function(){return _0x2fb950;};return a130_0x5689();}
@@ -1 +1 @@
1
- const a131_0x9936c7=a131_0x194a;(function(_0x31aad2,_0x52b8f5){const _0x5d808e=a131_0x194a,_0xaa8cbc=_0x31aad2();while(!![]){try{const _0x50dbad=parseInt(_0x5d808e(0x1c9))/0x1*(parseInt(_0x5d808e(0x1cb))/0x2)+-parseInt(_0x5d808e(0x1b1))/0x3+parseInt(_0x5d808e(0x1de))/0x4*(-parseInt(_0x5d808e(0x1e2))/0x5)+parseInt(_0x5d808e(0x1bc))/0x6+-parseInt(_0x5d808e(0x1cf))/0x7*(-parseInt(_0x5d808e(0x1ce))/0x8)+-parseInt(_0x5d808e(0x1a8))/0x9*(-parseInt(_0x5d808e(0x1b3))/0xa)+-parseInt(_0x5d808e(0x1ae))/0xb*(-parseInt(_0x5d808e(0x1b7))/0xc);if(_0x50dbad===_0x52b8f5)break;else _0xaa8cbc['push'](_0xaa8cbc['shift']());}catch(_0x52cdbf){_0xaa8cbc['push'](_0xaa8cbc['shift']());}}}(a131_0xe812,0x8c61f));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(_0x1e133f){const _0xed12b6=a131_0x194a;if(_0x1e133f===_0xed12b6(0x1ab))return[_0xed12b6(0x1d3),_0xed12b6(0x1c5),'</select>','']['join']('\x0a');return[_0xed12b6(0x1b6),''][_0xed12b6(0x1a5)]('\x0a');}export const sqlCreate={'service':a131_0x9936c7(0x1b9),'command':'create','description':a131_0x9936c7(0x1e4),'risk':a131_0x9936c7(0x1d6),'flags':[{'name':a131_0x9936c7(0x1a4),'type':'string','description':a131_0x9936c7(0x1ca)},{'name':a131_0x9936c7(0x1d1),'type':a131_0x9936c7(0x1d8),'description':a131_0x9936c7(0x1df)},{'name':a131_0x9936c7(0x1bb),'type':a131_0x9936c7(0x1ac),'enum':[a131_0x9936c7(0x1b9),a131_0x9936c7(0x1ab)],'description':a131_0x9936c7(0x1d2)}],async 'validate'(_0x2dd4b1){const _0x2caa92=a131_0x9936c7;if(!_0x2dd4b1[_0x2caa92(0x1c0)])return;if(!_0x2dd4b1['str'](_0x2caa92(0x1a4))[_0x2caa92(0x1b8)]())throw CliErrors['flagMissing']('name',_0x2caa92(0x1c4));const _0x99a22c=resolveProvidedDbId(_0x2dd4b1);if(typeof _0x99a22c!==_0x2caa92(0x1d8)||!Number[_0x2caa92(0x1c8)](_0x99a22c)||_0x99a22c<=0x0)throw CliErrors[_0x2caa92(0x1cc)]('db-id','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x2dd4b1[_0x2caa92(0x1a2)](_0x2caa92(0x1bb))[_0x2caa92(0x1b8)]())throw CliErrors[_0x2caa92(0x1cc)](_0x2caa92(0x1bb),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x5eab3d){const _0x28a6ba=a131_0x9936c7,_0x295160=loadSqlProjectConfig(_0x5eab3d[_0x28a6ba(0x1a7)]),{sqlName:_0xc09506,dbId:_0x5be8da,dbName:_0x38bc0f,mode:_0x1fd607}=await resolveSqlNewInputs(_0x5eab3d),_0x380d5e=buildSqlRelativePath(_0x28a6ba(0x1db),_0xc09506,_0x38bc0f,_0x1fd607,_0x5be8da),_0x57d06f=_0x295160[_0x28a6ba(0x1dc)]+'/'+_0x380d5e;return{'method':_0x28a6ba(0x1e1),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x5eab3d[_0x28a6ba(0x1a7)],'sqlName':_0xc09506,'dbId':_0x5be8da,'mode':_0x1fd607,'localPath':_0x57d06f},'description':_0x28a6ba(0x1ad)+_0x295160[_0x28a6ba(0x1dc)]};},async 'execute'(_0x52d874){const _0x715bbe=a131_0x9936c7,_0x32604e=loadSqlProjectConfig(_0x52d874[_0x715bbe(0x1a7)]),{sqlName:_0x1f85a0,dbId:_0x4ecd47,dbName:_0x354eff,mode:_0x1576f7}=await resolveSqlNewInputs(_0x52d874),_0x106198=generateSqlTemplate(_0x1576f7),_0x3c67ef=await createSqlQuery({'appCode':_0x52d874['appCode'],'sqlName':_0x1f85a0,'dbId':_0x4ecd47,'sqlContent':_0x106198}),_0x51229d=ensureRemoteSqlContent(_0x3c67ef),_0x23bcfa=_0x354eff||await getDbName(_0x52d874[_0x715bbe(0x1a7)],_0x4ecd47)[_0x715bbe(0x1c3)](()=>undefined),_0x3a1637=buildSqlRelativePath(_0x3c67ef[_0x715bbe(0x1cd)],_0x3c67ef[_0x715bbe(0x1af)],_0x23bcfa,_0x1576f7,_0x4ecd47),_0x1fdd86=_0x32604e['sqlRootDir']+'/'+_0x3a1637,_0x1031ff=buildLocalSqlFileContent({'sqlCode':_0x3c67ef[_0x715bbe(0x1cd)],'sqlName':_0x3c67ef[_0x715bbe(0x1af)],'dbId':_0x3c67ef['dbId']},_0x51229d,{'dbName':_0x23bcfa,'mode':_0x1576f7,'syncedAt':new Date()[_0x715bbe(0x1c2)](),'description':_0x3c67ef[_0x715bbe(0x1a9)]});if(await fileExists(_0x1fdd86))throw CliErrors[_0x715bbe(0x1d4)]('File\x20already\x20exists:\x20'+_0x1fdd86);await ensureParentDirectory(_0x1fdd86),await writeFile(_0x1fdd86,_0x1031ff,_0x715bbe(0x1a3));const _0x3d8da3=await readSqlLockFile(_0x32604e['lockFilePath']),{lockData:_0x25ff6c,appLock:_0x5b71b9}=ensureSqlLockScope(_0x3d8da3??createEmptySqlLock(),_0x32604e[_0x715bbe(0x1a7)],_0x32604e['sqlRoot'],'new');return _0x5b71b9[_0x715bbe(0x1e3)][_0x3c67ef[_0x715bbe(0x1cd)]]={...buildSqlLockEntry(_0x3c67ef,_0x51229d,computeSqlContentHash(_0x1031ff),{'dbName':_0x23bcfa}),'path':_0x3a1637,'mode':_0x1576f7},_0x5b71b9[_0x715bbe(0x1aa)]=new Date()['toISOString'](),await writeSqlLockFile(_0x32604e[_0x715bbe(0x1be)],_0x25ff6c),{'ok':!![],'data':{'id':_0x3c67ef['id'],'sqlCode':_0x3c67ef[_0x715bbe(0x1cd)],'sqlName':_0x3c67ef[_0x715bbe(0x1af)],'dbId':_0x3c67ef[_0x715bbe(0x1ba)],'path':_0x1fdd86,'mode':_0x1576f7},'message':'Created\x20SQL\x20query\x20'+_0x3c67ef[_0x715bbe(0x1cd)]};}};async function resolveSqlNewInputs(_0x522203){const _0x4c99b1=await resolveSqlNameInput(_0x522203),{dbId:_0x663b68,dbName:_0x54fabd}=await resolveDbSelection(_0x522203),_0x36fab6=await resolveSqlModeInput(_0x522203);return{'sqlName':_0x4c99b1,'dbId':_0x663b68,'dbName':_0x54fabd,'mode':_0x36fab6};}function a131_0x194a(_0x46219a,_0x11d8d7){_0x46219a=_0x46219a-0x1a1;const _0xe812c7=a131_0xe812();let _0x194a05=_0xe812c7[_0x46219a];return _0x194a05;}function a131_0xe812(){const _0x4b0ef7=['stringify','819009emdAEQ','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','10gKyQzI','dbId\x20不能为空','SQL\x20名称不能为空','SELECT\x201\x20AS\x20id;','228PcyraH','trim','sql','dbId','mode','602640uhZQTX','适合带动态标签的\x20MyBatis\x20XML\x20SQL','lockFilePath','请输入目标数据库\x20dbId:','nonInteractive','__manual__','toISOString','catch','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','\x20\x20SELECT\x201\x20AS\x20id','flag','isInteger','isFinite','113722SSFyoL','SQL\x20query\x20display\x20name','14DhYvKn','flagMissing','sqlCode','24xevGme','747285BfORiD','请选择本地\x20SQL\x20模式:','db-id','Local\x20SQL\x20file\x20mode','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','validation','Invalid\x20database\x20selection\x20payload:\x20','high-risk-write','parse','number','MyBatis\x20XML(mybatisXml)','请输入\x20SQL\x20名称:','<server-generated-sqlCode>','sqlRootDir','length','76ycSyVo','Target\x20database\x20ID','✎\x20手动输入\x20dbId','POST','197375cDlFvH','sqls','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','str','utf8','name','join','dbName','appCode','244899UIQRqq','description','lastSync','mybatisXml','string','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','204985okXpVY','sqlName'];a131_0xe812=function(){return _0x4b0ef7;};return a131_0xe812();}async function resolveSqlNameInput(_0x58d21b){const _0x44bbf1=a131_0x9936c7,_0x18b6f4=_0x58d21b['str'](_0x44bbf1(0x1a4))[_0x44bbf1(0x1b8)]();if(_0x18b6f4)return _0x18b6f4;if(_0x58d21b[_0x44bbf1(0x1c0)])throw CliErrors['flagMissing'](_0x44bbf1(0x1a4),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x44bbf1(0x1da),'validate':_0x2da0b8=>_0x2da0b8['trim']()?!![]:_0x44bbf1(0x1b5)}))[_0x44bbf1(0x1b8)]();}async function resolveDbSelection(_0x10548c){const _0x1ee96e=a131_0x9936c7,_0xf83287=resolveProvidedDbId(_0x10548c);if(typeof _0xf83287===_0x1ee96e(0x1d8)&&Number[_0x1ee96e(0x1c8)](_0xf83287)&&_0xf83287>0x0)return{'dbId':_0xf83287,'dbName':await getDbName(_0x10548c['appCode'],_0xf83287)['catch'](()=>undefined)};if(_0x10548c[_0x1ee96e(0x1c0)])throw CliErrors[_0x1ee96e(0x1cc)](_0x1ee96e(0x1d1),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x1dc9bb=await listDatabases(_0x10548c[_0x1ee96e(0x1a7)])[_0x1ee96e(0x1c3)](()=>[]);if(_0x1dc9bb[_0x1ee96e(0x1dd)]===0x1)return{'dbId':_0x1dc9bb[0x0][_0x1ee96e(0x1ba)],'dbName':_0x1dc9bb[0x0]['dbName']};if(_0x1dc9bb[_0x1ee96e(0x1dd)]>0x1){const _0x28fd58=await select({'message':'请选择目标数据库:','choices':[..._0x1dc9bb['map'](_0x5e6b07=>({'name':_0x5e6b07[_0x1ee96e(0x1a6)]+'\x20('+_0x5e6b07[_0x1ee96e(0x1ba)]+')','value':serializeDbSelection(_0x5e6b07)})),{'name':_0x1ee96e(0x1e0),'value':_0x1ee96e(0x1c1)}]});if(_0x28fd58!==_0x1ee96e(0x1c1))return deserializeDbSelection(_0x28fd58);}const _0x3a4abe=await input({'message':_0x1ee96e(0x1bf),'validate':_0x1e45f9=>{const _0x2ab102=_0x1ee96e,_0x2f5918=_0x1e45f9[_0x2ab102(0x1b8)]();if(!_0x2f5918)return _0x2ab102(0x1b4);const _0x582177=Number(_0x2f5918);if(!Number[_0x2ab102(0x1c7)](_0x582177)||_0x582177<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x3a4abe[_0x1ee96e(0x1b8)]())};}async function resolveSqlModeInput(_0x486ddb){const _0x5dc999=a131_0x9936c7,_0x35909f=_0x486ddb['str'](_0x5dc999(0x1bb))[_0x5dc999(0x1b8)]();if(_0x35909f===_0x5dc999(0x1b9)||_0x35909f===_0x5dc999(0x1ab))return _0x35909f;if(_0x486ddb[_0x5dc999(0x1c0)])throw CliErrors[_0x5dc999(0x1cc)](_0x5dc999(0x1bb),_0x5dc999(0x1b2));return await select({'message':_0x5dc999(0x1d0),'choices':[{'name':'普通\x20SQL(sql)','value':_0x5dc999(0x1b9),'description':_0x5dc999(0x1a1)},{'name':_0x5dc999(0x1d9),'value':'mybatisXml','description':_0x5dc999(0x1bd)}]});}function serializeDbSelection(_0x91ee9f){const _0x5200a1=a131_0x9936c7;return JSON[_0x5200a1(0x1b0)]({'dbId':_0x91ee9f[_0x5200a1(0x1ba)],'dbName':_0x91ee9f[_0x5200a1(0x1a6)]});}function deserializeDbSelection(_0x2527bf){const _0x34a7a0=a131_0x9936c7;try{const _0x460800=JSON[_0x34a7a0(0x1d7)](_0x2527bf);if(typeof _0x460800[_0x34a7a0(0x1ba)]===_0x34a7a0(0x1d8)&&Number[_0x34a7a0(0x1c8)](_0x460800[_0x34a7a0(0x1ba)]))return{'dbId':_0x460800['dbId'],'dbName':_0x460800['dbName']};}catch{}throw CliErrors[_0x34a7a0(0x1d4)](_0x34a7a0(0x1d5)+_0x2527bf);}function resolveProvidedDbId(_0x2f0a8b){const _0x2d0bf5=a131_0x9936c7,_0x134e26=_0x2f0a8b[_0x2d0bf5(0x1c6)](_0x2d0bf5(0x1d1));if(typeof _0x134e26===_0x2d0bf5(0x1d8)&&Number[_0x2d0bf5(0x1c8)](_0x134e26))return _0x134e26;return undefined;}
1
+ const a131_0x3427f5=a131_0x50ef;(function(_0x2929eb,_0xdd56a0){const _0x51ef1a=a131_0x50ef,_0x3e3969=_0x2929eb();while(!![]){try{const _0x301774=-parseInt(_0x51ef1a(0xc0))/0x1+parseInt(_0x51ef1a(0xc3))/0x2+parseInt(_0x51ef1a(0xf1))/0x3+parseInt(_0x51ef1a(0xfc))/0x4*(parseInt(_0x51ef1a(0xf4))/0x5)+-parseInt(_0x51ef1a(0xd7))/0x6*(parseInt(_0x51ef1a(0xd9))/0x7)+-parseInt(_0x51ef1a(0xef))/0x8+parseInt(_0x51ef1a(0xcc))/0x9*(parseInt(_0x51ef1a(0xe7))/0xa);if(_0x301774===_0xdd56a0)break;else _0x3e3969['push'](_0x3e3969['shift']());}catch(_0x6e40ea){_0x3e3969['push'](_0x3e3969['shift']());}}}(a131_0x3881,0x3fc40));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';function a131_0x50ef(_0x4ef6f5,_0x5d10b4){_0x4ef6f5=_0x4ef6f5-0xc0;const _0x388105=a131_0x3881();let _0x50efd1=_0x388105[_0x4ef6f5];return _0x50efd1;}import{createSqlQuery}from'../../core/api-client.js';function a131_0x3881(){const _0xe7146f=['dbName','mode','stringify','length','join','1359sMvNZd','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','sqlRootDir','Target\x20database\x20ID','sql','SQL\x20名称不能为空','string','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','number','932304cNpJeq','请选择本地\x20SQL\x20模式:','21IfUziT','POST','MyBatis\x20XML(mybatisXml)','File\x20already\x20exists:\x20','isFinite','适合带动态标签的\x20MyBatis\x20XML\x20SQL','sqlName','appCode','sqlCode','\x20\x20SELECT\x201\x20AS\x20id','dbId\x20必须为正整数','name','flagMissing','toISOString','5930KFKNdh','✎\x20手动输入\x20dbId','trim','map','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','lastSync','catch','dbId','3526912fYaYlG','validation','1347309auptub','utf8','description','10QiRfrU','flag','/smartapi/custom/saveUserCustomSql','请输入\x20SQL\x20名称:','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','普通\x20SQL(sql)','mybatisXml','nonInteractive','534220llAWMK','create','dbId\x20不能为空','__manual__','sqls','db-id','453QMvwXV','str','high-risk-write','725794wWnSkO','<server-generated-sqlCode>','isInteger','SELECT\x201\x20AS\x20id;'];a131_0x3881=function(){return _0xe7146f;};return a131_0x3881();}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(_0x47b86c){const _0xabcced=a131_0x50ef;if(_0x47b86c==='mybatisXml')return[_0xabcced(0xf8),_0xabcced(0xe2),'</select>',''][_0xabcced(0xcb)]('\x0a');return[_0xabcced(0xc6),'']['join']('\x0a');}export const sqlCreate={'service':a131_0x3427f5(0xd2),'command':a131_0x3427f5(0xfd),'description':a131_0x3427f5(0xcf),'risk':a131_0x3427f5(0xc2),'flags':[{'name':a131_0x3427f5(0xe4),'type':'string','description':'SQL\x20query\x20display\x20name'},{'name':'db-id','type':a131_0x3427f5(0xd6),'description':a131_0x3427f5(0xd1)},{'name':a131_0x3427f5(0xc8),'type':a131_0x3427f5(0xd4),'enum':[a131_0x3427f5(0xd2),a131_0x3427f5(0xfa)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x7ca8e0){const _0x12910e=a131_0x3427f5;if(!_0x7ca8e0[_0x12910e(0xfb)])return;if(!_0x7ca8e0['str'](_0x12910e(0xe4))[_0x12910e(0xe9)]())throw CliErrors[_0x12910e(0xe5)](_0x12910e(0xe4),_0x12910e(0xcd));const _0x5a633b=resolveProvidedDbId(_0x7ca8e0);if(typeof _0x5a633b!==_0x12910e(0xd6)||!Number[_0x12910e(0xdd)](_0x5a633b)||_0x5a633b<=0x0)throw CliErrors['flagMissing']('db-id',_0x12910e(0xce));if(!_0x7ca8e0[_0x12910e(0xc1)]('mode')[_0x12910e(0xe9)]())throw CliErrors['flagMissing']('mode',_0x12910e(0xd5));},async 'dryRun'(_0x261cc4){const _0x498034=a131_0x3427f5,_0x258460=loadSqlProjectConfig(_0x261cc4['appCode']),{sqlName:_0x4b5f7b,dbId:_0x25aadf,dbName:_0x29a5c4,mode:_0x345d4d}=await resolveSqlNewInputs(_0x261cc4),_0x1ab4b3=buildSqlRelativePath(_0x498034(0xc4),_0x4b5f7b,_0x29a5c4,_0x345d4d,_0x25aadf),_0x55e820=_0x258460[_0x498034(0xd0)]+'/'+_0x1ab4b3;return{'method':_0x498034(0xda),'url':_0x498034(0xf6),'body':{'appCode':_0x261cc4[_0x498034(0xe0)],'sqlName':_0x4b5f7b,'dbId':_0x25aadf,'mode':_0x345d4d,'localPath':_0x55e820},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x258460[_0x498034(0xd0)]};},async 'execute'(_0x512f1e){const _0xf77d5f=a131_0x3427f5,_0x54a232=loadSqlProjectConfig(_0x512f1e[_0xf77d5f(0xe0)]),{sqlName:_0x13beb6,dbId:_0x23ed71,dbName:_0x56bdb7,mode:_0x48452e}=await resolveSqlNewInputs(_0x512f1e),_0x4be0db=generateSqlTemplate(_0x48452e),_0x16ba5a=await createSqlQuery({'appCode':_0x512f1e[_0xf77d5f(0xe0)],'sqlName':_0x13beb6,'dbId':_0x23ed71,'sqlContent':_0x4be0db}),_0x5c3e43=ensureRemoteSqlContent(_0x16ba5a),_0x5202d9=_0x56bdb7||await getDbName(_0x512f1e['appCode'],_0x23ed71)['catch'](()=>undefined),_0x5d0b25=buildSqlRelativePath(_0x16ba5a['sqlCode'],_0x16ba5a[_0xf77d5f(0xdf)],_0x5202d9,_0x48452e,_0x23ed71),_0xabb95b=_0x54a232[_0xf77d5f(0xd0)]+'/'+_0x5d0b25,_0x3e185e=buildLocalSqlFileContent({'sqlCode':_0x16ba5a['sqlCode'],'sqlName':_0x16ba5a[_0xf77d5f(0xdf)],'dbId':_0x16ba5a[_0xf77d5f(0xee)]},_0x5c3e43,{'dbName':_0x5202d9,'mode':_0x48452e,'syncedAt':new Date()[_0xf77d5f(0xe6)](),'description':_0x16ba5a[_0xf77d5f(0xf3)]});if(await fileExists(_0xabb95b))throw CliErrors[_0xf77d5f(0xf0)](_0xf77d5f(0xdc)+_0xabb95b);await ensureParentDirectory(_0xabb95b),await writeFile(_0xabb95b,_0x3e185e,_0xf77d5f(0xf2));const _0xd05958=await readSqlLockFile(_0x54a232['lockFilePath']),{lockData:_0x5a2fa2,appLock:_0x1579b3}=ensureSqlLockScope(_0xd05958??createEmptySqlLock(),_0x54a232['appCode'],_0x54a232['sqlRoot'],'new');return _0x1579b3[_0xf77d5f(0x100)][_0x16ba5a[_0xf77d5f(0xe1)]]={...buildSqlLockEntry(_0x16ba5a,_0x5c3e43,computeSqlContentHash(_0x3e185e),{'dbName':_0x5202d9}),'path':_0x5d0b25,'mode':_0x48452e},_0x1579b3[_0xf77d5f(0xec)]=new Date()[_0xf77d5f(0xe6)](),await writeSqlLockFile(_0x54a232['lockFilePath'],_0x5a2fa2),{'ok':!![],'data':{'id':_0x16ba5a['id'],'sqlCode':_0x16ba5a[_0xf77d5f(0xe1)],'sqlName':_0x16ba5a[_0xf77d5f(0xdf)],'dbId':_0x16ba5a[_0xf77d5f(0xee)],'path':_0xabb95b,'mode':_0x48452e},'message':'Created\x20SQL\x20query\x20'+_0x16ba5a[_0xf77d5f(0xe1)]};}};async function resolveSqlNewInputs(_0x394504){const _0x58c2a5=await resolveSqlNameInput(_0x394504),{dbId:_0x49a90d,dbName:_0x2b4fbe}=await resolveDbSelection(_0x394504),_0x3a07b3=await resolveSqlModeInput(_0x394504);return{'sqlName':_0x58c2a5,'dbId':_0x49a90d,'dbName':_0x2b4fbe,'mode':_0x3a07b3};}async function resolveSqlNameInput(_0x50d184){const _0x1bc9e1=a131_0x3427f5,_0x32e53d=_0x50d184['str'](_0x1bc9e1(0xe4))[_0x1bc9e1(0xe9)]();if(_0x32e53d)return _0x32e53d;if(_0x50d184[_0x1bc9e1(0xfb)])throw CliErrors[_0x1bc9e1(0xe5)]('name',_0x1bc9e1(0xcd));return(await input({'message':_0x1bc9e1(0xf7),'validate':_0x37e69c=>_0x37e69c['trim']()?!![]:_0x1bc9e1(0xd3)}))['trim']();}async function resolveDbSelection(_0x34890c){const _0x56bbe3=a131_0x3427f5,_0x23d10a=resolveProvidedDbId(_0x34890c);if(typeof _0x23d10a===_0x56bbe3(0xd6)&&Number[_0x56bbe3(0xdd)](_0x23d10a)&&_0x23d10a>0x0)return{'dbId':_0x23d10a,'dbName':await getDbName(_0x34890c[_0x56bbe3(0xe0)],_0x23d10a)['catch'](()=>undefined)};if(_0x34890c[_0x56bbe3(0xfb)])throw CliErrors[_0x56bbe3(0xe5)](_0x56bbe3(0x101),_0x56bbe3(0xce));const _0x568fb2=await listDatabases(_0x34890c[_0x56bbe3(0xe0)])[_0x56bbe3(0xed)](()=>[]);if(_0x568fb2[_0x56bbe3(0xca)]===0x1)return{'dbId':_0x568fb2[0x0][_0x56bbe3(0xee)],'dbName':_0x568fb2[0x0][_0x56bbe3(0xc7)]};if(_0x568fb2[_0x56bbe3(0xca)]>0x1){const _0x284f8b=await select({'message':'请选择目标数据库:','choices':[..._0x568fb2[_0x56bbe3(0xea)](_0x4191f7=>({'name':_0x4191f7['dbName']+'\x20('+_0x4191f7[_0x56bbe3(0xee)]+')','value':serializeDbSelection(_0x4191f7)})),{'name':_0x56bbe3(0xe8),'value':_0x56bbe3(0xff)}]});if(_0x284f8b!==_0x56bbe3(0xff))return deserializeDbSelection(_0x284f8b);}const _0x35ba13=await input({'message':'请输入目标数据库\x20dbId:','validate':_0x54f635=>{const _0xa00d2b=_0x56bbe3,_0x2c2614=_0x54f635[_0xa00d2b(0xe9)]();if(!_0x2c2614)return _0xa00d2b(0xfe);const _0x339989=Number(_0x2c2614);if(!Number[_0xa00d2b(0xc5)](_0x339989)||_0x339989<=0x0)return _0xa00d2b(0xe3);return!![];}});return{'dbId':Number(_0x35ba13[_0x56bbe3(0xe9)]())};}async function resolveSqlModeInput(_0x399551){const _0x39be3e=a131_0x3427f5,_0x55aecd=_0x399551[_0x39be3e(0xc1)](_0x39be3e(0xc8))[_0x39be3e(0xe9)]();if(_0x55aecd==='sql'||_0x55aecd===_0x39be3e(0xfa))return _0x55aecd;if(_0x399551[_0x39be3e(0xfb)])throw CliErrors[_0x39be3e(0xe5)]('mode',_0x39be3e(0xd5));return await select({'message':_0x39be3e(0xd8),'choices':[{'name':_0x39be3e(0xf9),'value':_0x39be3e(0xd2),'description':_0x39be3e(0xeb)},{'name':_0x39be3e(0xdb),'value':_0x39be3e(0xfa),'description':_0x39be3e(0xde)}]});}function serializeDbSelection(_0xed473a){const _0x5919e0=a131_0x3427f5;return JSON[_0x5919e0(0xc9)]({'dbId':_0xed473a[_0x5919e0(0xee)],'dbName':_0xed473a[_0x5919e0(0xc7)]});}function deserializeDbSelection(_0x59258f){const _0xfa6f48=a131_0x3427f5;try{const _0x1c7995=JSON['parse'](_0x59258f);if(typeof _0x1c7995[_0xfa6f48(0xee)]===_0xfa6f48(0xd6)&&Number[_0xfa6f48(0xdd)](_0x1c7995['dbId']))return{'dbId':_0x1c7995[_0xfa6f48(0xee)],'dbName':_0x1c7995[_0xfa6f48(0xc7)]};}catch{}throw CliErrors[_0xfa6f48(0xf0)]('Invalid\x20database\x20selection\x20payload:\x20'+_0x59258f);}function resolveProvidedDbId(_0x5c6088){const _0x13c663=a131_0x3427f5,_0x514bf8=_0x5c6088[_0x13c663(0xf5)](_0x13c663(0x101));if(typeof _0x514bf8===_0x13c663(0xd6)&&Number['isFinite'](_0x514bf8))return _0x514bf8;return undefined;}
@@ -1 +1 @@
1
- const a132_0x14f117=a132_0x15e8;(function(_0xa992f2,_0x468651){const _0xeb3288=a132_0x15e8,_0x40cf3c=_0xa992f2();while(!![]){try{const _0x5ae1a4=parseInt(_0xeb3288(0x97))/0x1+parseInt(_0xeb3288(0x89))/0x2+-parseInt(_0xeb3288(0x85))/0x3+parseInt(_0xeb3288(0x96))/0x4+parseInt(_0xeb3288(0xa1))/0x5*(-parseInt(_0xeb3288(0x91))/0x6)+parseInt(_0xeb3288(0x90))/0x7*(parseInt(_0xeb3288(0xa0))/0x8)+parseInt(_0xeb3288(0xa4))/0x9*(-parseInt(_0xeb3288(0x9b))/0xa);if(_0x5ae1a4===_0x468651)break;else _0x40cf3c['push'](_0x40cf3c['shift']());}catch(_0x260936){_0x40cf3c['push'](_0x40cf3c['shift']());}}}(a132_0x1faf,0x6e8f8));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_0x15e8(_0x4d399d,_0xeb2053){_0x4d399d=_0x4d399d-0x85;const _0x1faf24=a132_0x1faf();let _0x15e85b=_0x1faf24[_0x4d399d];return _0x15e85b;}function a132_0x1faf(){const _0x148a5c=['validation','sqlRoot','1234098WBUpKx','str','replace','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','sqlRootDir','projectRoot','sql','7JLxFAH','31854GCmdIK','startsWith','entries','sqlcode','lockFilePath','1333268RcWJJR','759308xVuqNr','high-risk-write','sqls','/smartapi/custom/deleteUserCustomSql','10LOCIYw','trashedTo','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','remoteId','delete','2892064WONACt','10wLdGxU','Would\x20delete\x20SQL\x20','trashDir','13175928XxtNhI','appCode','431148nKopFN','toISOString'];a132_0x1faf=function(){return _0x148a5c;};return a132_0x1faf();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a132_0x14f117(0x8f),'command':'delete','description':a132_0x14f117(0x9d),'risk':a132_0x14f117(0x98),'flags':[SQLCODE_FLAG],async 'validate'(_0xd2b135){const _0x14dab9=a132_0x14f117,_0x5b82b0=loadSqlProjectConfig(_0xd2b135[_0x14dab9(0xa5)]),_0x33fd1a=await readSqlLockFile(_0x5b82b0['lockFilePath']);if(!_0x33fd1a)throw CliErrors[_0x14dab9(0x87)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x11f90c){const _0xc451a4=a132_0x14f117,_0x13b979=loadSqlProjectConfig(_0x11f90c[_0xc451a4(0xa5)]),_0x787c65=await readSqlLockFile(_0x13b979[_0xc451a4(0x95)]);if(!_0x787c65)throw CliErrors[_0xc451a4(0x87)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x26d69b}=ensureSqlLockScope(_0x787c65,_0x11f90c[_0xc451a4(0xa5)],_0x13b979[_0xc451a4(0x88)],_0xc451a4(0x9f)),_0x43c80f=_0x11f90c[_0xc451a4(0x8a)]('sqlcode'),_0x446c4f=_0x26d69b[_0xc451a4(0x99)][_0x43c80f];if(!_0x446c4f)throw CliErrors[_0xc451a4(0x87)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x43c80f+'\x22.');return{'method':'POST','url':_0xc451a4(0x9a),'body':{'sqlCode':_0x43c80f,'id':_0x446c4f[_0xc451a4(0x9e)],'localPath':resolveLocalSqlFilePath(_0x13b979,_0x43c80f,_0x446c4f)},'description':_0xc451a4(0xa2)+_0x43c80f+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x13b979[_0xc451a4(0xa3)]};},async 'execute'(_0x5b45ef){const _0x49e77c=a132_0x14f117,_0x516ee0=loadSqlProjectConfig(_0x5b45ef[_0x49e77c(0xa5)]),_0x67fc9c=await readSqlLockFile(_0x516ee0[_0x49e77c(0x95)]);if(!_0x67fc9c)throw CliErrors[_0x49e77c(0x87)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x2f04f3,appLock:_0x502d0f}=ensureSqlLockScope(_0x67fc9c,_0x5b45ef[_0x49e77c(0xa5)],_0x516ee0[_0x49e77c(0x88)],_0x49e77c(0x9f)),_0x1309a0=_0x5b45ef[_0x49e77c(0x8a)](_0x49e77c(0x94)),_0x33de90=_0x502d0f['sqls'][_0x1309a0];if(!_0x33de90)throw CliErrors[_0x49e77c(0x87)](_0x49e77c(0x8c)+_0x1309a0+'\x22.');await deleteSqlQuery({'id':_0x33de90[_0x49e77c(0x9e)],'sqlCode':_0x1309a0}),_0x502d0f[_0x49e77c(0x99)]=Object['fromEntries'](Object[_0x49e77c(0x93)](_0x502d0f[_0x49e77c(0x99)])['filter'](([_0x92cd31])=>_0x92cd31!==_0x1309a0)),_0x502d0f['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x516ee0[_0x49e77c(0x95)],_0x2f04f3);const _0x5bf879=resolveLocalSqlFilePath(_0x516ee0,_0x1309a0,_0x33de90);let _0x4f82d3;await fileExists(_0x5bf879)&&(_0x4f82d3=await moveToTrash(_0x516ee0[_0x49e77c(0x8e)],_0x516ee0[_0x49e77c(0xa3)],_0x5bf879),await cleanupEmptyDirectories(dirname(_0x5bf879),_0x516ee0[_0x49e77c(0x8d)]));const _0x215748={'deleted':_0x1309a0,'remoteId':_0x33de90['remoteId']};if(_0x4f82d3)_0x215748[_0x49e77c(0x9c)]=_0x4f82d3;return{'ok':!![],'data':_0x215748,'message':'Deleted\x20'+_0x1309a0+(_0x4f82d3?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x407dcb,_0x537b03,_0x671901){const _0x549a84=a132_0x14f117,_0x5d41eb=new Date()[_0x549a84(0x86)]()[_0x549a84(0x8b)](/[:.]/g,'-'),_0x46482c=relative(_0x407dcb,_0x671901),_0x40a79f=join(_0x537b03,_0x5d41eb,_0x46482c);return await mkdir(dirname(_0x40a79f),{'recursive':!![]}),await rename(_0x671901,_0x40a79f),_0x40a79f;}async function cleanupEmptyDirectories(_0x28c272,_0x295ea4){const _0x46d43b=a132_0x14f117;let _0xc27030=resolve(_0x28c272);const _0x2b9ac0=resolve(_0x295ea4);while(_0xc27030[_0x46d43b(0x92)](''+_0x2b9ac0+sep)||_0xc27030===_0x2b9ac0){if(_0xc27030===_0x2b9ac0)return;try{const _0x4a72ba=await readdir(_0xc27030);if(_0x4a72ba['length']>0x0)return;await rmdir(_0xc27030);}catch{return;}_0xc27030=dirname(_0xc27030);}}
1
+ function a132_0xb1e7(){const _0x1c56bf=['str','lockFilePath','663AYdPhm','12JytzZH','remoteId','startsWith','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','36160MxCzYB','trashedTo','10089992jByKRm','replace','sqls','toISOString','sqlcode','validation','appCode','fromEntries','Would\x20delete\x20SQL\x20','1688320cpePfn','length','/smartapi/custom/deleteUserCustomSql','9782UxkPMO','\x20(local\x20file\x20moved\x20to\x20trash)','2556vRzfZu','entries','20IAfJzj','high-risk-write','POST','sqlRoot','delete','lastSync','trashDir','24JhMqyN','SQL\x20lock\x20file\x20not\x20found.','168677frXgAH','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','filter','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','3477754ZXyehz','226448rTmOtm'];a132_0xb1e7=function(){return _0x1c56bf;};return a132_0xb1e7();}const a132_0x7fb04b=a132_0x3f0b;(function(_0x2fbca7,_0x383bf1){const _0x314dbd=a132_0x3f0b,_0x1de328=_0x2fbca7();while(!![]){try{const _0x229d54=-parseInt(_0x314dbd(0x182))/0x1+parseInt(_0x314dbd(0x19d))/0x2*(-parseInt(_0x314dbd(0x18a))/0x3)+-parseInt(_0x314dbd(0x187))/0x4*(parseInt(_0x314dbd(0x179))/0x5)+parseInt(_0x314dbd(0x18b))/0x6*(-parseInt(_0x314dbd(0x186))/0x7)+parseInt(_0x314dbd(0x19a))/0x8+parseInt(_0x314dbd(0x19f))/0x9*(parseInt(_0x314dbd(0x18f))/0xa)+-parseInt(_0x314dbd(0x191))/0xb*(-parseInt(_0x314dbd(0x180))/0xc);if(_0x229d54===_0x383bf1)break;else _0x1de328['push'](_0x1de328['shift']());}catch(_0x102c7a){_0x1de328['push'](_0x1de328['shift']());}}}(a132_0xb1e7,0x932e0));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_0x3f0b(_0x37efc1,_0x5b8dd7){_0x37efc1=_0x37efc1-0x178;const _0xb1e749=a132_0xb1e7();let _0x3f0b4c=_0xb1e749[_0x37efc1];return _0x3f0b4c;}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':'sql','command':a132_0x7fb04b(0x17d),'description':a132_0x7fb04b(0x185),'risk':a132_0x7fb04b(0x17a),'flags':[SQLCODE_FLAG],async 'validate'(_0x58bfcf){const _0x3c8a04=a132_0x7fb04b,_0x25a398=loadSqlProjectConfig(_0x58bfcf[_0x3c8a04(0x197)]),_0x59b8ff=await readSqlLockFile(_0x25a398[_0x3c8a04(0x189)]);if(!_0x59b8ff)throw CliErrors[_0x3c8a04(0x196)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x11dee8){const _0xdcf8d7=a132_0x7fb04b,_0xf85a0=loadSqlProjectConfig(_0x11dee8[_0xdcf8d7(0x197)]),_0x41a537=await readSqlLockFile(_0xf85a0[_0xdcf8d7(0x189)]);if(!_0x41a537)throw CliErrors[_0xdcf8d7(0x196)](_0xdcf8d7(0x183));const {appLock:_0x4f0a1d}=ensureSqlLockScope(_0x41a537,_0x11dee8['appCode'],_0xf85a0[_0xdcf8d7(0x17c)],'delete'),_0x51df2f=_0x11dee8[_0xdcf8d7(0x188)]('sqlcode'),_0x5f19b0=_0x4f0a1d[_0xdcf8d7(0x193)][_0x51df2f];if(!_0x5f19b0)throw CliErrors[_0xdcf8d7(0x196)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x51df2f+'\x22.');return{'method':_0xdcf8d7(0x17b),'url':_0xdcf8d7(0x19c),'body':{'sqlCode':_0x51df2f,'id':_0x5f19b0[_0xdcf8d7(0x18c)],'localPath':resolveLocalSqlFilePath(_0xf85a0,_0x51df2f,_0x5f19b0)},'description':_0xdcf8d7(0x199)+_0x51df2f+_0xdcf8d7(0x18e)+_0xf85a0[_0xdcf8d7(0x17f)]};},async 'execute'(_0x563d4a){const _0x5a82d3=a132_0x7fb04b,_0x3deb14=loadSqlProjectConfig(_0x563d4a['appCode']),_0x433108=await readSqlLockFile(_0x3deb14[_0x5a82d3(0x189)]);if(!_0x433108)throw CliErrors[_0x5a82d3(0x196)](_0x5a82d3(0x181));const {lockData:_0x25acaf,appLock:_0x24f260}=ensureSqlLockScope(_0x433108,_0x563d4a[_0x5a82d3(0x197)],_0x3deb14[_0x5a82d3(0x17c)],_0x5a82d3(0x17d)),_0x82161c=_0x563d4a[_0x5a82d3(0x188)](_0x5a82d3(0x195)),_0x1fdc12=_0x24f260[_0x5a82d3(0x193)][_0x82161c];if(!_0x1fdc12)throw CliErrors['validation']('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x82161c+'\x22.');await deleteSqlQuery({'id':_0x1fdc12['remoteId'],'sqlCode':_0x82161c}),_0x24f260[_0x5a82d3(0x193)]=Object[_0x5a82d3(0x198)](Object[_0x5a82d3(0x178)](_0x24f260[_0x5a82d3(0x193)])[_0x5a82d3(0x184)](([_0x3b8003])=>_0x3b8003!==_0x82161c)),_0x24f260[_0x5a82d3(0x17e)]=new Date()[_0x5a82d3(0x194)](),await writeSqlLockFile(_0x3deb14[_0x5a82d3(0x189)],_0x25acaf);const _0x41d8d7=resolveLocalSqlFilePath(_0x3deb14,_0x82161c,_0x1fdc12);let _0x2f15b5;await fileExists(_0x41d8d7)&&(_0x2f15b5=await moveToTrash(_0x3deb14['projectRoot'],_0x3deb14[_0x5a82d3(0x17f)],_0x41d8d7),await cleanupEmptyDirectories(dirname(_0x41d8d7),_0x3deb14['sqlRootDir']));const _0x319956={'deleted':_0x82161c,'remoteId':_0x1fdc12[_0x5a82d3(0x18c)]};if(_0x2f15b5)_0x319956[_0x5a82d3(0x190)]=_0x2f15b5;return{'ok':!![],'data':_0x319956,'message':'Deleted\x20'+_0x82161c+(_0x2f15b5?_0x5a82d3(0x19e):'')};}};async function moveToTrash(_0x54b652,_0x12c6fc,_0x58379d){const _0x4f424b=a132_0x7fb04b,_0x3df5e9=new Date()[_0x4f424b(0x194)]()[_0x4f424b(0x192)](/[:.]/g,'-'),_0x271e4e=relative(_0x54b652,_0x58379d),_0x3868c7=join(_0x12c6fc,_0x3df5e9,_0x271e4e);return await mkdir(dirname(_0x3868c7),{'recursive':!![]}),await rename(_0x58379d,_0x3868c7),_0x3868c7;}async function cleanupEmptyDirectories(_0x493455,_0xb6903d){const _0x1c7de0=a132_0x7fb04b;let _0xf16583=resolve(_0x493455);const _0x43688e=resolve(_0xb6903d);while(_0xf16583[_0x1c7de0(0x18d)](''+_0x43688e+sep)||_0xf16583===_0x43688e){if(_0xf16583===_0x43688e)return;try{const _0x21f47c=await readdir(_0xf16583);if(_0x21f47c[_0x1c7de0(0x19b)]>0x0)return;await rmdir(_0xf16583);}catch{return;}_0xf16583=dirname(_0xf16583);}}
@@ -1 +1 @@
1
- const a133_0x2b2fbd=a133_0xec5a;(function(_0x32656c,_0x34895a){const _0x4f6c17=a133_0xec5a,_0x31cc5a=_0x32656c();while(!![]){try{const _0x2f4317=-parseInt(_0x4f6c17(0xc4))/0x1+-parseInt(_0x4f6c17(0xc7))/0x2*(parseInt(_0x4f6c17(0xc1))/0x3)+-parseInt(_0x4f6c17(0xb8))/0x4+-parseInt(_0x4f6c17(0xc2))/0x5+-parseInt(_0x4f6c17(0xb4))/0x6*(parseInt(_0x4f6c17(0xb5))/0x7)+-parseInt(_0x4f6c17(0xc6))/0x8+-parseInt(_0x4f6c17(0xbe))/0x9*(-parseInt(_0x4f6c17(0xbd))/0xa);if(_0x2f4317===_0x34895a)break;else _0x31cc5a['push'](_0x31cc5a['shift']());}catch(_0x389c61){_0x31cc5a['push'](_0x31cc5a['shift']());}}}(a133_0x39ea,0x70b87));import{getSqlQueryInfo}from'../../core/api-client.js';function a133_0x39ea(){const _0x19d30b=['str','1966180QAKNkL','sql','appCode','read','boolean','40063490SOthyr','9URcJMc','sqlName','verbose','3RivKJQ','4539765LlhGpb','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','304457YugaDS','Return\x20full\x20raw\x20SQL\x20query\x20object','4819312BEfvDk','1795934DEmgNR','sqlContent','2041860imJYsu','7KhGVAE','dbId'];a133_0x39ea=function(){return _0x19d30b;};return a133_0x39ea();}import{getDbName}from'../../core/db-resolver.js';function a133_0xec5a(_0x4e9bab,_0x129a0f){_0x4e9bab=_0x4e9bab-0xb4;const _0x39ea1c=a133_0x39ea();let _0xec5a19=_0x39ea1c[_0x4e9bab];return _0xec5a19;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a133_0x2b2fbd(0xb9),'command':'detail','description':a133_0x2b2fbd(0xc3),'risk':a133_0x2b2fbd(0xbb),'flags':[SQLCODE_FLAG,{'name':a133_0x2b2fbd(0xc0),'type':a133_0x2b2fbd(0xbc),'description':a133_0x2b2fbd(0xc5)}],async 'execute'(_0x5ab407){const _0x1ea8fa=a133_0x2b2fbd,_0x29af61=await getSqlQueryInfo(_0x5ab407[_0x1ea8fa(0xba)],_0x5ab407[_0x1ea8fa(0xb7)]('sqlcode')),_0xffeb70=_0x5ab407['bool'](_0x1ea8fa(0xc0));if(_0xffeb70)return{'ok':!![],'data':_0x29af61};const _0x1ed9ce=_0x29af61[_0x1ea8fa(0xb6)]?await getDbName(_0x5ab407['appCode'],_0x29af61[_0x1ea8fa(0xb6)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x29af61['sqlCode'],'sqlName':_0x29af61[_0x1ea8fa(0xbf)],'db':_0x1ed9ce?_0x1ed9ce+'\x20('+_0x29af61['dbId']+')':_0x29af61[_0x1ea8fa(0xb6)]??'','description':_0x29af61['description']??'','sqlContent':_0x29af61[_0x1ea8fa(0xc8)]??''}};}};
1
+ function a133_0x25bf(_0x4626c1,_0x2de781){_0x4626c1=_0x4626c1-0x1f3;const _0x54971d=a133_0x5497();let _0x25bf30=_0x54971d[_0x4626c1];return _0x25bf30;}function a133_0x5497(){const _0x6388e2=['sqlName','Return\x20full\x20raw\x20SQL\x20query\x20object','9275144xtJruK','sqlCode','sql','read','838496DpMBJt','18lyvRoc','verbose','147417vBaoYg','sqlcode','bool','1047861qCUCwX','1714690EvwkAY','sqlContent','7929120DoCWtd','boolean','str','52elYWeC','dbId','5803182bJrYOk','detail','7IOmjdl'];a133_0x5497=function(){return _0x6388e2;};return a133_0x5497();}const a133_0x522e50=a133_0x25bf;(function(_0x3969b8,_0x5047f2){const _0x57c82c=a133_0x25bf,_0x1bd193=_0x3969b8();while(!![]){try{const _0x205359=parseInt(_0x57c82c(0x1fb))/0x1+-parseInt(_0x57c82c(0x1f5))/0x2+parseInt(_0x57c82c(0x1f8))/0x3*(-parseInt(_0x57c82c(0x201))/0x4)+-parseInt(_0x57c82c(0x1fc))/0x5*(-parseInt(_0x57c82c(0x1f6))/0x6)+parseInt(_0x57c82c(0x205))/0x7*(parseInt(_0x57c82c(0x208))/0x8)+-parseInt(_0x57c82c(0x203))/0x9+-parseInt(_0x57c82c(0x1fe))/0xa;if(_0x205359===_0x5047f2)break;else _0x1bd193['push'](_0x1bd193['shift']());}catch(_0x5d46e8){_0x1bd193['push'](_0x1bd193['shift']());}}}(a133_0x5497,0xb4bcf));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a133_0x522e50(0x1f3),'command':a133_0x522e50(0x204),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a133_0x522e50(0x1f4),'flags':[SQLCODE_FLAG,{'name':a133_0x522e50(0x1f7),'type':a133_0x522e50(0x1ff),'description':a133_0x522e50(0x207)}],async 'execute'(_0x37c85e){const _0x1aa3c4=a133_0x522e50,_0x1610be=await getSqlQueryInfo(_0x37c85e['appCode'],_0x37c85e[_0x1aa3c4(0x200)](_0x1aa3c4(0x1f9))),_0x3f23fb=_0x37c85e[_0x1aa3c4(0x1fa)](_0x1aa3c4(0x1f7));if(_0x3f23fb)return{'ok':!![],'data':_0x1610be};const _0x581cc7=_0x1610be[_0x1aa3c4(0x202)]?await getDbName(_0x37c85e['appCode'],_0x1610be[_0x1aa3c4(0x202)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x1610be[_0x1aa3c4(0x209)],'sqlName':_0x1610be[_0x1aa3c4(0x206)],'db':_0x581cc7?_0x581cc7+'\x20('+_0x1610be[_0x1aa3c4(0x202)]+')':_0x1610be[_0x1aa3c4(0x202)]??'','description':_0x1610be['description']??'','sqlContent':_0x1610be[_0x1aa3c4(0x1fd)]??''}};}};
@@ -1 +1 @@
1
- const a134_0x25ccde=a134_0x17ad;function a134_0x5ebd(){const _0x2da873=['3249210rmaPjm','now','execResult','617085klNxnl','str','sql','appCode','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','params','30684lggqKz','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','56SCwLyg','\x20row(s)\x20in\x20','6GjbnAH','length','sqlcode','isArray','40768880pyMFXw','SQL\x20execution\x20failed','4359870pYzEHg','879869ExbURI','execError','395OsNOdc','Returned\x20','1979924xkpKXB'];a134_0x5ebd=function(){return _0x2da873;};return a134_0x5ebd();}(function(_0x5b59d4,_0x4fb363){const _0x76d87f=a134_0x17ad,_0x31a4db=_0x5b59d4();while(!![]){try{const _0x3e3fe7=parseInt(_0x76d87f(0xc4))/0x1+-parseInt(_0x76d87f(0xc9))/0x2+-parseInt(_0x76d87f(0xbd))/0x3*(parseInt(_0x76d87f(0xc8))/0x4)+parseInt(_0x76d87f(0xc6))/0x5*(-parseInt(_0x76d87f(0xd2))/0x6)+-parseInt(_0x76d87f(0xcc))/0x7*(parseInt(_0x76d87f(0xd4))/0x8)+-parseInt(_0x76d87f(0xc3))/0x9+parseInt(_0x76d87f(0xc1))/0xa;if(_0x3e3fe7===_0x4fb363)break;else _0x31a4db['push'](_0x31a4db['shift']());}catch(_0x11f267){_0x31a4db['push'](_0x31a4db['shift']());}}}(a134_0x5ebd,0xcc43d));import{executeSql}from'../../core/api-client.js';function a134_0x17ad(_0x4660e7,_0x503fb3){_0x4660e7=_0x4660e7-0xbd;const _0x5ebd88=a134_0x5ebd();let _0x17ad2=_0x5ebd88[_0x4660e7];return _0x17ad2;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a134_0x25ccde(0xce),'command':'exec','description':a134_0x25ccde(0xd0),'risk':'read','flags':[SQLCODE_FLAG,{'name':a134_0x25ccde(0xd1),'type':'string','description':a134_0x25ccde(0xd3)}],async 'execute'(_0x1ceeed){const _0xc80293=a134_0x25ccde,_0x30d0b2=parseJsonParams(_0x1ceeed[_0xc80293(0xcd)](_0xc80293(0xd1))),_0x1e9ec8=Date[_0xc80293(0xca)](),_0x5ca742=await executeSql(_0x1ceeed[_0xc80293(0xcf)],_0x1ceeed['str'](_0xc80293(0xbf)),_0x30d0b2),_0x309313=Date[_0xc80293(0xca)]()-_0x1e9ec8,_0x313b6f=_0x5ca742?.[_0xc80293(0xcb)]??_0x5ca742,_0x29bab2=_0x5ca742?.['execSuccess']??!![];if(!_0x29bab2)return{'ok':![],'data':{'error':_0x5ca742?.[_0xc80293(0xc5)]||_0xc80293(0xc2),'elapsed':_0x309313},'message':'SQL\x20execution\x20failed'};const _0x511e63=Array[_0xc80293(0xc0)](_0x313b6f)?_0x313b6f:[];return{'ok':!![],'data':{'rows':_0x511e63,'rowCount':_0x511e63[_0xc80293(0xbe)],'elapsed':_0x309313},'message':_0xc80293(0xc7)+_0x511e63['length']+_0xc80293(0xd5)+_0x309313+'ms'};}};
1
+ const a134_0x4454a2=a134_0x26da;function a134_0x26da(_0x335665,_0x59a2a2){_0x335665=_0x335665-0x104;const _0x283d90=a134_0x283d();let _0x26da58=_0x283d90[_0x335665];return _0x26da58;}(function(_0x4ff681,_0xc27c17){const _0x3c855c=a134_0x26da,_0x3081d6=_0x4ff681();while(!![]){try{const _0x4747e4=parseInt(_0x3c855c(0x117))/0x1+-parseInt(_0x3c855c(0x114))/0x2*(parseInt(_0x3c855c(0x109))/0x3)+parseInt(_0x3c855c(0x105))/0x4+-parseInt(_0x3c855c(0x118))/0x5*(parseInt(_0x3c855c(0x10f))/0x6)+-parseInt(_0x3c855c(0x112))/0x7+parseInt(_0x3c855c(0x11b))/0x8+-parseInt(_0x3c855c(0x113))/0x9*(-parseInt(_0x3c855c(0x111))/0xa);if(_0x4747e4===_0xc27c17)break;else _0x3081d6['push'](_0x3081d6['shift']());}catch(_0xc91d34){_0x3081d6['push'](_0x3081d6['shift']());}}}(a134_0x283d,0x2b776));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':'sql','command':a134_0x4454a2(0x10c),'description':a134_0x4454a2(0x10e),'risk':a134_0x4454a2(0x115),'flags':[SQLCODE_FLAG,{'name':a134_0x4454a2(0x106),'type':a134_0x4454a2(0x10b),'description':a134_0x4454a2(0x110)}],async 'execute'(_0x107a71){const _0x4a7b53=a134_0x4454a2,_0x2e8557=parseJsonParams(_0x107a71['str'](_0x4a7b53(0x106))),_0xbb1f8f=Date[_0x4a7b53(0x104)](),_0x387801=await executeSql(_0x107a71[_0x4a7b53(0x10a)],_0x107a71['str'](_0x4a7b53(0x108)),_0x2e8557),_0x2c2155=Date[_0x4a7b53(0x104)]()-_0xbb1f8f,_0x3073f5=_0x387801?.[_0x4a7b53(0x107)]??_0x387801,_0x5d38f5=_0x387801?.[_0x4a7b53(0x11c)]??!![];if(!_0x5d38f5)return{'ok':![],'data':{'error':_0x387801?.[_0x4a7b53(0x11d)]||_0x4a7b53(0x10d),'elapsed':_0x2c2155},'message':_0x4a7b53(0x10d)};const _0x46a2b1=Array[_0x4a7b53(0x116)](_0x3073f5)?_0x3073f5:[];return{'ok':!![],'data':{'rows':_0x46a2b1,'rowCount':_0x46a2b1[_0x4a7b53(0x119)],'elapsed':_0x2c2155},'message':'Returned\x20'+_0x46a2b1['length']+_0x4a7b53(0x11a)+_0x2c2155+'ms'};}};function a134_0x283d(){const _0x4f2b31=['now','649928iyzTJY','params','execResult','sqlcode','6SjyiXP','appCode','string','exec','SQL\x20execution\x20failed','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','1572930UKGkrc','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','860kDvLbu','1899079wEjbVR','10494wMaOCP','82698jkIRDc','read','isArray','201820sfqemf','5SDjKsZ','length','\x20row(s)\x20in\x20','2636880goSNqO','execSuccess','execError'];a134_0x283d=function(){return _0x4f2b31;};return a134_0x283d();}
@@ -1 +1 @@
1
- (function(_0x13fe68,_0x165ea5){const _0x2440b5=a135_0x1e1d,_0x2a90c4=_0x13fe68();while(!![]){try{const _0x1c973c=-parseInt(_0x2440b5(0x84))/0x1*(parseInt(_0x2440b5(0x87))/0x2)+-parseInt(_0x2440b5(0x7f))/0x3+parseInt(_0x2440b5(0x86))/0x4+-parseInt(_0x2440b5(0x7d))/0x5*(-parseInt(_0x2440b5(0x81))/0x6)+parseInt(_0x2440b5(0x82))/0x7*(parseInt(_0x2440b5(0x80))/0x8)+-parseInt(_0x2440b5(0x83))/0x9*(parseInt(_0x2440b5(0x7c))/0xa)+-parseInt(_0x2440b5(0x7e))/0xb*(-parseInt(_0x2440b5(0x85))/0xc);if(_0x1c973c===_0x165ea5)break;else _0x2a90c4['push'](_0x2a90c4['shift']());}catch(_0x230787){_0x2a90c4['push'](_0x2a90c4['shift']());}}}(a135_0x3d23,0x1aa35));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';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';function a135_0x1e1d(_0x3462c7,_0x406243){_0x3462c7=_0x3462c7-0x7c;const _0x3d230f=a135_0x3d23();let _0x1e1dfd=_0x3d230f[_0x3462c7];return _0x1e1dfd;}import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';function a135_0x3d23(){const _0x363de8=['21zTPrkN','9iUVJRN','19196QEWjlK','12hJdMdJ','196456NvVnDy','16IVQBHK','1475520FiJWfc','169555mToQYQ','4251533gMPXGD','434466LgnxtB','137632TfIObO','12PzlyHC'];a135_0x3d23=function(){return _0x363de8;};return a135_0x3d23();}import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x4b56f2,_0x37b07c){const _0x2c52b6=a135_0x2762,_0x4453c6=_0x4b56f2();while(!![]){try{const _0x498e68=parseInt(_0x2c52b6(0x173))/0x1*(parseInt(_0x2c52b6(0x175))/0x2)+-parseInt(_0x2c52b6(0x16f))/0x3*(parseInt(_0x2c52b6(0x16d))/0x4)+parseInt(_0x2c52b6(0x171))/0x5+-parseInt(_0x2c52b6(0x16e))/0x6*(parseInt(_0x2c52b6(0x174))/0x7)+-parseInt(_0x2c52b6(0x172))/0x8*(parseInt(_0x2c52b6(0x170))/0x9)+-parseInt(_0x2c52b6(0x16b))/0xa*(parseInt(_0x2c52b6(0x16a))/0xb)+parseInt(_0x2c52b6(0x16c))/0xc;if(_0x498e68===_0x37b07c)break;else _0x4453c6['push'](_0x4453c6['shift']());}catch(_0xbf2bea){_0x4453c6['push'](_0x4453c6['shift']());}}}(a135_0x5629,0x3f40d));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';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';function a135_0x2762(_0x2f2760,_0x5dd14e){_0x2f2760=_0x2f2760-0x16a;const _0x562906=a135_0x5629();let _0x2762d0=_0x562906[_0x2f2760];return _0x2762d0;}import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';function a135_0x5629(){const _0x13ea9a=['432JNzqVk','11YOGxFi','899230njUxQc','9763344bYMHSp','541636wqrPKC','24KWCByI','3plUrKw','9YnLzST','179230IHigeJ','2153576fvoIjI','1054ifysHE','566139HgtIbG'];a135_0x5629=function(){return _0x13ea9a;};return a135_0x5629();}import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a136_0x47336e=a136_0x3bdd;(function(_0x59775a,_0x2d784d){const _0x4dc760=a136_0x3bdd,_0xf1df19=_0x59775a();while(!![]){try{const _0x4fac39=parseInt(_0x4dc760(0x12d))/0x1+parseInt(_0x4dc760(0x111))/0x2*(parseInt(_0x4dc760(0x124))/0x3)+parseInt(_0x4dc760(0x133))/0x4*(-parseInt(_0x4dc760(0x11d))/0x5)+parseInt(_0x4dc760(0x130))/0x6+-parseInt(_0x4dc760(0x12a))/0x7+-parseInt(_0x4dc760(0x115))/0x8+parseInt(_0x4dc760(0x12b))/0x9;if(_0x4fac39===_0x2d784d)break;else _0xf1df19['push'](_0xf1df19['shift']());}catch(_0x557ddd){_0xf1df19['push'](_0xf1df19['shift']());}}}(a136_0x3e73,0xec028));import{listSqlQueries}from'../../core/api-client.js';function a136_0x3bdd(_0x2d780d,_0x2d9b8e){_0x2d780d=_0x2d780d-0x110;const _0x3e736c=a136_0x3e73();let _0x3bdd98=_0x3e736c[_0x2d780d];return _0x3bdd98;}function a136_0x3e73(){const _0x1cf118=['sqlName','sqlcode','9404654xtNGuR','11230506ORJMnj','length','675908uDGKsM','Page\x20number','sqlCode','498522GYpYQx','sql','Page\x20size','8zrbUho','number','2627844MYkLEA','\x20SQL\x20queries\x20(total:\x20','bool','dbId','986200jFjOHe','name','verbose','all','List\x20custom\x20SQL\x20queries','paging','appCode','pagesize','2218145hEyiYs','read','tableData','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','str','num','Filter\x20by\x20SQL\x20name','3IVFYIt','map','boolean','page'];a136_0x3e73=function(){return _0x1cf118;};return a136_0x3e73();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a136_0x47336e(0x131),'command':'list','description':a136_0x47336e(0x119),'risk':a136_0x47336e(0x11e),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a136_0x47336e(0x116),'type':'string','description':a136_0x47336e(0x123)},{'name':a136_0x47336e(0x127),'type':a136_0x47336e(0x110),'description':a136_0x47336e(0x12e),'default':0x1},{'name':'pagesize','type':a136_0x47336e(0x110),'description':a136_0x47336e(0x132)},{'name':a136_0x47336e(0x117),'type':a136_0x47336e(0x126),'description':a136_0x47336e(0x120)}],async 'execute'(_0x45b30b){const _0x2829b2=a136_0x47336e,_0x22072c=await listSqlQueries(_0x45b30b[_0x2829b2(0x11b)],{'sqlCode':_0x45b30b['str'](_0x2829b2(0x129))||undefined,'sqlName':_0x45b30b[_0x2829b2(0x121)](_0x2829b2(0x116))||undefined,'currentPage':_0x45b30b[_0x2829b2(0x122)](_0x2829b2(0x127)),'pageSize':_0x45b30b[_0x2829b2(0x122)](_0x2829b2(0x11c),0x32)}),_0x5b5795=_0x45b30b[_0x2829b2(0x113)](_0x2829b2(0x117)),_0x3857f5=_0x22072c[_0x2829b2(0x11f)]??[],_0x5a80f8=_0x22072c[_0x2829b2(0x11a)]?.['totalCount']??_0x3857f5['length'];let _0x486dfe;return _0x5b5795?_0x486dfe=_0x3857f5:_0x486dfe=await Promise[_0x2829b2(0x118)](_0x3857f5[_0x2829b2(0x125)](async _0x209f16=>{const _0x2248fd=_0x2829b2;let _0x5209f5;try{_0x5209f5=_0x209f16['dbId']?await getDbName(_0x45b30b[_0x2248fd(0x11b)],_0x209f16[_0x2248fd(0x114)]):undefined;}catch{}return{'sqlCode':_0x209f16[_0x2248fd(0x12f)],'sqlName':_0x209f16[_0x2248fd(0x128)],'description':_0x209f16['description']??'','db':_0x5209f5?_0x5209f5+'\x20('+_0x209f16[_0x2248fd(0x114)]+')':_0x209f16[_0x2248fd(0x114)]??''};})),{'ok':!![],'data':_0x486dfe,'message':_0x3857f5[_0x2829b2(0x12c)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':'Found\x20'+_0x3857f5['length']+_0x2829b2(0x112)+_0x5a80f8+').'};}};
1
+ const a136_0x724fe0=a136_0x1d14;(function(_0x227536,_0x5e39be){const _0x446b2e=a136_0x1d14,_0xbb84c4=_0x227536();while(!![]){try{const _0x306fc1=-parseInt(_0x446b2e(0x126))/0x1*(-parseInt(_0x446b2e(0x132))/0x2)+-parseInt(_0x446b2e(0x113))/0x3+parseInt(_0x446b2e(0x115))/0x4*(-parseInt(_0x446b2e(0x125))/0x5)+-parseInt(_0x446b2e(0x130))/0x6*(parseInt(_0x446b2e(0x111))/0x7)+-parseInt(_0x446b2e(0x138))/0x8*(-parseInt(_0x446b2e(0x139))/0x9)+-parseInt(_0x446b2e(0x136))/0xa*(parseInt(_0x446b2e(0x112))/0xb)+parseInt(_0x446b2e(0x128))/0xc;if(_0x306fc1===_0x5e39be)break;else _0xbb84c4['push'](_0xbb84c4['shift']());}catch(_0x3fe2f4){_0xbb84c4['push'](_0xbb84c4['shift']());}}}(a136_0x4b2f,0x8145b));function a136_0x1d14(_0xde906e,_0x155393){_0xde906e=_0xde906e-0x111;const _0x4b2f1b=a136_0x4b2f();let _0x1d1497=_0x4b2f1b[_0xde906e];return _0x1d1497;}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a136_0x4b2f(){const _0x57bb01=['Filter\x20by\x20SQL\x20name','length','\x20SQL\x20queries\x20(total:\x20','verbose','Page\x20number','dbId','str','description','No\x20custom\x20SQL\x20queries\x20found.','tableData','sqlCode','all','boolean','num','35ZIVjvU','212SKHSlL','map','35143728cGaPvk','read','bool','page','list','number','appCode','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','30390DdgBwM','name','4040LpDdjM','pagesize','sql','paging','1030aHUndd','sqlName','53736dXhBJZ','909MzeqWE','1428ZKqOPk','87659FBSktK','1950420lWvwGy','string','572340bRKIOU','sqlcode'];a136_0x4b2f=function(){return _0x57bb01;};return a136_0x4b2f();}export const sqlList={'service':a136_0x724fe0(0x134),'command':a136_0x724fe0(0x12c),'description':'List\x20custom\x20SQL\x20queries','risk':a136_0x724fe0(0x129),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a136_0x724fe0(0x131),'type':a136_0x724fe0(0x114),'description':a136_0x724fe0(0x117)},{'name':a136_0x724fe0(0x12b),'type':a136_0x724fe0(0x12d),'description':a136_0x724fe0(0x11b),'default':0x1},{'name':a136_0x724fe0(0x133),'type':a136_0x724fe0(0x12d),'description':'Page\x20size'},{'name':a136_0x724fe0(0x11a),'type':a136_0x724fe0(0x123),'description':a136_0x724fe0(0x12f)}],async 'execute'(_0x566219){const _0x289749=a136_0x724fe0,_0x2d743e=await listSqlQueries(_0x566219[_0x289749(0x12e)],{'sqlCode':_0x566219[_0x289749(0x11d)](_0x289749(0x116))||undefined,'sqlName':_0x566219['str'](_0x289749(0x131))||undefined,'currentPage':_0x566219[_0x289749(0x124)](_0x289749(0x12b)),'pageSize':_0x566219[_0x289749(0x124)](_0x289749(0x133),0x32)}),_0x3c6566=_0x566219[_0x289749(0x12a)]('verbose'),_0x1bf3bf=_0x2d743e[_0x289749(0x120)]??[],_0x3fd4d4=_0x2d743e[_0x289749(0x135)]?.['totalCount']??_0x1bf3bf[_0x289749(0x118)];let _0x7302fb;return _0x3c6566?_0x7302fb=_0x1bf3bf:_0x7302fb=await Promise[_0x289749(0x122)](_0x1bf3bf[_0x289749(0x127)](async _0x1b62bb=>{const _0x15c4d8=_0x289749;let _0x5b8f79;try{_0x5b8f79=_0x1b62bb[_0x15c4d8(0x11c)]?await getDbName(_0x566219[_0x15c4d8(0x12e)],_0x1b62bb[_0x15c4d8(0x11c)]):undefined;}catch{}return{'sqlCode':_0x1b62bb[_0x15c4d8(0x121)],'sqlName':_0x1b62bb[_0x15c4d8(0x137)],'description':_0x1b62bb[_0x15c4d8(0x11e)]??'','db':_0x5b8f79?_0x5b8f79+'\x20('+_0x1b62bb[_0x15c4d8(0x11c)]+')':_0x1b62bb[_0x15c4d8(0x11c)]??''};})),{'ok':!![],'data':_0x7302fb,'message':_0x1bf3bf[_0x289749(0x118)]===0x0?_0x289749(0x11f):'Found\x20'+_0x1bf3bf['length']+_0x289749(0x119)+_0x3fd4d4+').'};}};
@@ -1 +1 @@
1
- const a137_0x442a42=a137_0x24aa;(function(_0x123f2a,_0x4cd3ba){const _0x3e9254=a137_0x24aa,_0x2c338f=_0x123f2a();while(!![]){try{const _0x360635=-parseInt(_0x3e9254(0xd4))/0x1*(parseInt(_0x3e9254(0xc7))/0x2)+-parseInt(_0x3e9254(0xba))/0x3*(parseInt(_0x3e9254(0xcd))/0x4)+parseInt(_0x3e9254(0xd2))/0x5*(parseInt(_0x3e9254(0xcc))/0x6)+-parseInt(_0x3e9254(0xb9))/0x7+-parseInt(_0x3e9254(0xe1))/0x8+parseInt(_0x3e9254(0xc6))/0x9+parseInt(_0x3e9254(0xbe))/0xa;if(_0x360635===_0x4cd3ba)break;else _0x2c338f['push'](_0x2c338f['shift']());}catch(_0x54084b){_0x2c338f['push'](_0x2c338f['shift']());}}}(a137_0x29f1,0x47ebc));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';function a137_0x29f1(){const _0x20aa3f=['appCode','utf8','nonInteractive','path','sqlRoot','dbId','test','\x20skipped,\x20','Pull\x20complete:\x20','str','2208736iJROuV','write','bool','description','\x20SQL\x20file(s)\x20into\x20','join','cancelled','trimStart','local\x20differs\x20from\x20remote','totalCount','would_pull','sqlCode','toISOString','tableData','message','string','lastSync','filter','split','unchanged','865060xmGwYs','76647oHvhtL','sql','length','skipped','12054380VFTQlx','replace','pull','Force\x20overwrite\x20local\x20unsynced\x20changes','push','Force\x20pull\x20cancelled.','name','sqlcode','480861PppoVH','2WpvYJv','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sqlContent','sqls','sqlName','6ipemJS','84TFLQFR','lockFilePath','Would\x20pull\x20','sqlRootDir','mybatisXml','587720fuFnXL','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','145622XWflCV','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','conflict'];a137_0x29f1=function(){return _0x20aa3f;};return a137_0x29f1();}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(_0xb883,_0x20c3a4){const _0x14d03b=a137_0x24aa,_0x30cc68=[];let _0x2d62a9=0x1;while(!![]){const _0x151aa0=await listSqlQueries(_0xb883,{'currentPage':_0x2d62a9,'pageSize':PAGE_SIZE,'sqlCode':_0x20c3a4['sqlCode'],'sqlName':_0x20c3a4[_0x14d03b(0xcb)]}),_0x287572=_0x151aa0[_0x14d03b(0xb2)]??[];_0x30cc68['push'](..._0x287572);if(_0x287572[_0x14d03b(0xbc)]===0x0)break;const _0xd3d5b3=_0x151aa0['paging']?.[_0x14d03b(0xae)];if(_0xd3d5b3!=null?_0x30cc68['length']>=_0xd3d5b3:_0x287572[_0x14d03b(0xbc)]<PAGE_SIZE)break;_0x2d62a9++;}return _0x30cc68;}function a137_0x24aa(_0x593947,_0x3dba2b){_0x593947=_0x593947-0xad;const _0x29f13e=a137_0x29f1();let _0x24aafe=_0x29f13e[_0x593947];return _0x24aafe;}async function ensureSqlContent(_0x1a2e3c){const _0x3200b8=a137_0x24aa;if(_0x1a2e3c[_0x3200b8(0xc9)]!=null&&String(_0x1a2e3c[_0x3200b8(0xc9)])[_0x3200b8(0xbc)]>0x0)return _0x1a2e3c;return getSqlQueryDetail(_0x1a2e3c[_0x3200b8(0xb0)]);}export const sqlPull={'service':a137_0x442a42(0xbb),'command':a137_0x442a42(0xc0),'description':a137_0x442a42(0xd5),'risk':a137_0x442a42(0xe2),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a137_0x442a42(0xc4),'type':a137_0x442a42(0xb4),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':'force','type':'boolean','description':a137_0x442a42(0xc1)}],async 'dryRun'(_0x460717){const _0x450713=a137_0x442a42,_0x7a1b56=loadSqlProjectConfig(_0x460717[_0x450713(0xd7)]),_0xb243bd=await readSqlLockFile(_0x7a1b56['lockFilePath']),{appLock:_0x17a30e}=ensureSqlLockScope(_0xb243bd??createEmptySqlLock(),_0x7a1b56[_0x450713(0xd7)],_0x7a1b56[_0x450713(0xdb)],_0x450713(0xc0)),_0x171149=await fetchAllSqlQueries(_0x460717['appCode'],{'sqlCode':_0x460717['str'](_0x450713(0xc5))||undefined,'sqlName':_0x460717['str'](_0x450713(0xc4))||undefined}),_0x300638=[];for(const _0x3d0be5 of _0x171149){const _0x59f696=await ensureSqlContent(_0x3d0be5),_0x5be776=ensureRemoteSqlContent(_0x59f696),_0x546866=detectModeFromSql(_0x59f696),_0x2fc3b3=_0x59f696[_0x450713(0xdc)]?await getDbName(_0x460717[_0x450713(0xd7)],Number(_0x59f696['dbId']))['catch'](()=>undefined):undefined,_0x1adb58=buildLocalSqlFileContent({'sqlCode':_0x59f696[_0x450713(0xb0)],'sqlName':_0x59f696[_0x450713(0xcb)],'dbId':_0x59f696[_0x450713(0xdc)]},_0x5be776,{'dbName':_0x2fc3b3,'mode':_0x546866,'syncedAt':new Date()[_0x450713(0xb1)](),'description':_0x59f696['description']}),_0x441988=buildSqlLockEntry(_0x59f696,_0x5be776,'',{'dbName':_0x2fc3b3}),_0x2dbcd8=resolveLocalSqlFilePath(_0x7a1b56,_0x59f696[_0x450713(0xb0)],_0x441988);let _0x10c2c5=_0x450713(0xaf),_0x229b50;if(await fileExists(_0x2dbcd8)){const _0x3309eb=await readFile(_0x2dbcd8,'utf8');isEquivalentPulledSqlFile(_0x3309eb,_0x1adb58,_0x546866)?(_0x10c2c5=_0x450713(0xbd),_0x229b50=_0x450713(0xb8)):(_0x10c2c5=_0x450713(0xd6),_0x229b50=_0x450713(0xc8));}_0x300638['push']({'sqlCode':_0x59f696[_0x450713(0xb0)],'sqlName':_0x59f696[_0x450713(0xcb)],'filePath':_0x2dbcd8,'status':_0x10c2c5,'reason':_0x229b50});}return{'method':'POST','url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x460717[_0x450713(0xd7)],'sqlCode':_0x460717['str'](_0x450713(0xc5))||null,'sqlName':_0x460717[_0x450713(0xe0)](_0x450713(0xc4))||null,'files':_0x300638},'description':_0x450713(0xcf)+_0x300638[_0x450713(0xbc)]+_0x450713(0xe5)+_0x7a1b56[_0x450713(0xd0)]};},async 'execute'(_0x3ad8a8){const _0x487424=a137_0x442a42,_0x2a2995=loadSqlProjectConfig(_0x3ad8a8[_0x487424(0xd7)]),_0x127ba7=await readSqlLockFile(_0x2a2995[_0x487424(0xce)]),{lockData:_0x298597,appLock:_0x5df18b}=ensureSqlLockScope(_0x127ba7??createEmptySqlLock(),_0x2a2995[_0x487424(0xd7)],_0x2a2995[_0x487424(0xdb)],_0x487424(0xc0)),_0x144b76=_0x3ad8a8[_0x487424(0xe3)]('force'),_0x19e26c=await fetchAllSqlQueries(_0x3ad8a8[_0x487424(0xd7)],{'sqlCode':_0x3ad8a8[_0x487424(0xe0)](_0x487424(0xc5))||undefined,'sqlName':_0x3ad8a8[_0x487424(0xe0)](_0x487424(0xc4))||undefined});if(_0x19e26c[_0x487424(0xbc)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x59691d=[],_0x5d89b3=[];for(const _0x2a3fbb of _0x19e26c){try{_0x59691d[_0x487424(0xc2)](await ensureSqlContent(_0x2a3fbb));}catch(_0x683a13){_0x5d89b3['push']({'sqlCode':_0x2a3fbb[_0x487424(0xb0)],'error':_0x683a13 instanceof Error?_0x683a13[_0x487424(0xb3)]:String(_0x683a13)});}}if(_0x144b76&&!_0x3ad8a8[_0x487424(0xd9)]){let _0x4fa69f=![];for(const _0x384469 of _0x59691d){const _0x2d049f=detectModeFromSql(_0x384469),_0x445ed4=_0x384469[_0x487424(0xdc)]?await getDbName(_0x3ad8a8[_0x487424(0xd7)],Number(_0x384469[_0x487424(0xdc)]))['catch'](()=>undefined):undefined,_0x2f0e63=buildLocalSqlFileContent({'sqlCode':_0x384469[_0x487424(0xb0)],'sqlName':_0x384469[_0x487424(0xcb)],'dbId':_0x384469[_0x487424(0xdc)]},ensureRemoteSqlContent(_0x384469),{'dbName':_0x445ed4,'mode':_0x2d049f,'syncedAt':new Date()[_0x487424(0xb1)](),'description':_0x384469['description']}),_0x3bfc87=resolveLocalSqlFilePath(_0x2a2995,_0x384469['sqlCode'],buildSqlLockEntry(_0x384469,ensureRemoteSqlContent(_0x384469),'',{'dbName':_0x445ed4}));if(await fileExists(_0x3bfc87)){const _0x2a443d=await readFile(_0x3bfc87,_0x487424(0xd8));if(!isEquivalentPulledSqlFile(_0x2a443d,_0x2f0e63,_0x2d049f)){_0x4fa69f=!![];break;}}}if(_0x4fa69f){const _0x300d52=await confirmForceOverwrite(_0x487424(0xd3));if(!_0x300d52)throw CliErrors[_0x487424(0xe7)](_0x487424(0xc3));}}const _0x4274c4=cloneSqlLockData(_0x298597),_0x3006a6=_0x4274c4['apps'][_0x2a2995['appCode']],_0xa432e5=[],_0x21b7de=[];for(const _0x3ae6d0 of _0x59691d){const _0x218784=_0x3006a6['sqls'][_0x3ae6d0[_0x487424(0xb0)]],_0xea8c25=ensureRemoteSqlContent(_0x3ae6d0),_0x20be56=detectModeFromSql(_0x3ae6d0),_0x194211=_0x3ae6d0[_0x487424(0xdc)]?await getDbName(_0x3ad8a8[_0x487424(0xd7)],Number(_0x3ae6d0[_0x487424(0xdc)]))['catch'](()=>undefined):undefined,_0x2ccfaf=buildLocalSqlFileContent({'sqlCode':_0x3ae6d0[_0x487424(0xb0)],'sqlName':_0x3ae6d0['sqlName'],'dbId':_0x3ae6d0[_0x487424(0xdc)]},_0xea8c25,{'dbName':_0x194211,'mode':_0x20be56,'syncedAt':new Date()['toISOString'](),'description':_0x3ae6d0[_0x487424(0xe4)]}),_0x71d41f=buildSqlLockEntry(_0x3ae6d0,_0xea8c25,computeSqlContentHash(_0x2ccfaf),{'dbName':_0x194211}),_0x495b01=_0x71d41f['path'],_0x4d8f6b=join(_0x2a2995['sqlRootDir'],_0x495b01);try{if(await fileExists(_0x4d8f6b)){const _0x254d5e=await readFile(_0x4d8f6b,_0x487424(0xd8));if(isEquivalentPulledSqlFile(_0x254d5e,_0x2ccfaf,_0x20be56)){_0x21b7de[_0x487424(0xc2)]({'sqlCode':_0x3ae6d0[_0x487424(0xb0)],'reason':'unchanged'}),_0x3006a6[_0x487424(0xca)][_0x3ae6d0['sqlCode']]={..._0x71d41f,'hash':computeSqlContentHash(_0x254d5e),'path':_0x495b01};continue;}if(!_0x144b76){_0x21b7de[_0x487424(0xc2)]({'sqlCode':_0x3ae6d0[_0x487424(0xb0)],'reason':_0x487424(0xad)});continue;}}const _0x11d7f7=_0x218784?.[_0x487424(0xda)]?join(_0x2a2995[_0x487424(0xd0)],_0x218784[_0x487424(0xda)]):undefined;_0x11d7f7&&_0x11d7f7!==_0x4d8f6b&&await fileExists(_0x11d7f7)&&await rm(_0x11d7f7,{'force':!![]}),await ensureParentDirectory(_0x4d8f6b),await writeFile(_0x4d8f6b,_0x2ccfaf,'utf8'),_0x3006a6[_0x487424(0xca)][_0x3ae6d0['sqlCode']]={..._0x71d41f,'path':_0x495b01},_0xa432e5[_0x487424(0xc2)]({'sqlCode':_0x3ae6d0[_0x487424(0xb0)],'filePath':_0x4d8f6b});}catch(_0x79a231){_0x5d89b3[_0x487424(0xc2)]({'sqlCode':_0x3ae6d0[_0x487424(0xb0)],'error':_0x79a231 instanceof Error?_0x79a231['message']:String(_0x79a231)});}}return _0x3006a6[_0x487424(0xb5)]=new Date()['toISOString'](),await writeSqlLockFile(_0x2a2995['lockFilePath'],_0x4274c4),{'ok':_0x5d89b3[_0x487424(0xbc)]===0x0,'data':{'pulled':_0xa432e5,'skipped':_0x21b7de,'failed':_0x5d89b3},'message':_0x487424(0xdf)+_0xa432e5[_0x487424(0xbc)]+'\x20written,\x20'+_0x21b7de[_0x487424(0xbc)]+_0x487424(0xde)+_0x5d89b3[_0x487424(0xbc)]+'\x20failed'};}};function detectModeFromSql(_0x4db731){const _0x46b49f=a137_0x442a42,_0x4afa03=ensureRemoteSqlContent(_0x4db731),_0x3849ad=stripLocalSqlMetadata(_0x4afa03,_0x46b49f(0xd1))[_0x46b49f(0xe8)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x3849ad))return _0x46b49f(0xd1);return _0x46b49f(0xbb);}function isEquivalentPulledSqlFile(_0x5e24e9,_0x1e4a73,_0x4dd3b8){return normalizePullComparableContent(_0x5e24e9,_0x4dd3b8)===normalizePullComparableContent(_0x1e4a73,_0x4dd3b8);}function normalizePullComparableContent(_0xd24155,_0x1ce4cc){const _0xa9af90=a137_0x442a42,_0x2565d2=_0xd24155[_0xa9af90(0xbf)](/\r\n/g,'\x0a')[_0xa9af90(0xb7)]('\x0a'),_0x5dc53d=_0x2565d2[_0xa9af90(0xb6)](_0x44a607=>!isSyncedAtMetadataLine(_0x44a607,_0x1ce4cc));return _0x5dc53d[_0xa9af90(0xe6)]('\x0a');}function isSyncedAtMetadataLine(_0x2e1b01,_0x334e15){const _0x4b73e0=a137_0x442a42;if(_0x334e15===_0x4b73e0(0xd1))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x2e1b01);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x4b73e0(0xdd)](_0x2e1b01);}
1
+ const a137_0x5ac735=a137_0x43e0;(function(_0x44c018,_0x2d0890){const _0x5e4b27=a137_0x43e0,_0x19f4a8=_0x44c018();while(!![]){try{const _0x421e34=-parseInt(_0x5e4b27(0x210))/0x1*(parseInt(_0x5e4b27(0x20e))/0x2)+-parseInt(_0x5e4b27(0x1e5))/0x3+-parseInt(_0x5e4b27(0x1f8))/0x4+-parseInt(_0x5e4b27(0x214))/0x5+-parseInt(_0x5e4b27(0x213))/0x6*(parseInt(_0x5e4b27(0x216))/0x7)+-parseInt(_0x5e4b27(0x21d))/0x8*(-parseInt(_0x5e4b27(0x21a))/0x9)+parseInt(_0x5e4b27(0x1f3))/0xa*(parseInt(_0x5e4b27(0x21c))/0xb);if(_0x421e34===_0x2d0890)break;else _0x19f4a8['push'](_0x19f4a8['shift']());}catch(_0x2c5f16){_0x19f4a8['push'](_0x19f4a8['shift']());}}}(a137_0x2aa7,0x256b2));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a137_0x2aa7(){const _0x545493=['push','boolean','tableData','nonInteractive','str','message','catch','\x20failed','sqls','\x20SQL\x20file(s)\x20into\x20','appCode','name','Would\x20pull\x20','lastSync','dbId','bool','2NlBExP','sqlCode','255763CAuJWk','conflict','filter','1788FtOMaU','726440JmpTri','test','3437fPRgWV','Pull\x20complete:\x20','skipped','description','4905kTljUd','totalCount','6987112AfPLml','3800WSDPZA','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','utf8','would_pull','unchanged','mybatisXml','path','string','toISOString','force','paging','157470vcvfix','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','\x20written,\x20','sql','sqlName','sqlRootDir','cancelled','pull','split','local\x20differs\x20from\x20remote','No\x20remote\x20SQL\x20queries\x20matched.','Force\x20pull\x20cancelled.','Force\x20overwrite\x20local\x20unsynced\x20changes','sqlContent','10DGUmkg','sqlRoot','length','write','apps','563768ThDGoX','trimStart','Filter\x20by\x20SQL\x20display\x20name','lockFilePath','sqlcode','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql'];a137_0x2aa7=function(){return _0x545493;};return a137_0x2aa7();}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(_0x456c30,_0x4158c5){const _0x23d724=a137_0x43e0,_0x3e38dc=[];let _0x240bdc=0x1;while(!![]){const _0x4b5e35=await listSqlQueries(_0x456c30,{'currentPage':_0x240bdc,'pageSize':PAGE_SIZE,'sqlCode':_0x4158c5['sqlCode'],'sqlName':_0x4158c5[_0x23d724(0x1e9)]}),_0x1b5d10=_0x4b5e35[_0x23d724(0x200)]??[];_0x3e38dc[_0x23d724(0x1fe)](..._0x1b5d10);if(_0x1b5d10[_0x23d724(0x1f5)]===0x0)break;const _0x4a6f8e=_0x4b5e35[_0x23d724(0x1e4)]?.[_0x23d724(0x21b)];if(_0x4a6f8e!=null?_0x3e38dc[_0x23d724(0x1f5)]>=_0x4a6f8e:_0x1b5d10[_0x23d724(0x1f5)]<PAGE_SIZE)break;_0x240bdc++;}return _0x3e38dc;}async function ensureSqlContent(_0x3ddf81){const _0x5da8d4=a137_0x43e0;if(_0x3ddf81['sqlContent']!=null&&String(_0x3ddf81[_0x5da8d4(0x1f2)])[_0x5da8d4(0x1f5)]>0x0)return _0x3ddf81;return getSqlQueryDetail(_0x3ddf81[_0x5da8d4(0x20f)]);}export const sqlPull={'service':a137_0x5ac735(0x1e8),'command':a137_0x5ac735(0x1ec),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a137_0x5ac735(0x1f6),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a137_0x5ac735(0x209),'type':a137_0x5ac735(0x224),'description':a137_0x5ac735(0x1fa)},{'name':'force','type':a137_0x5ac735(0x1ff),'description':a137_0x5ac735(0x1f1)}],async 'dryRun'(_0x2db893){const _0x3c0363=a137_0x5ac735,_0x591cfb=loadSqlProjectConfig(_0x2db893['appCode']),_0x3f3f63=await readSqlLockFile(_0x591cfb[_0x3c0363(0x1fb)]),{appLock:_0x143de0}=ensureSqlLockScope(_0x3f3f63??createEmptySqlLock(),_0x591cfb[_0x3c0363(0x208)],_0x591cfb[_0x3c0363(0x1f4)],_0x3c0363(0x1ec)),_0x58ad65=await fetchAllSqlQueries(_0x2db893['appCode'],{'sqlCode':_0x2db893[_0x3c0363(0x202)](_0x3c0363(0x1fc))||undefined,'sqlName':_0x2db893[_0x3c0363(0x202)](_0x3c0363(0x209))||undefined}),_0x3f8c3f=[];for(const _0xba71ce of _0x58ad65){const _0x5c3f9d=await ensureSqlContent(_0xba71ce),_0x5a9ad6=ensureRemoteSqlContent(_0x5c3f9d),_0x39dfa0=detectModeFromSql(_0x5c3f9d),_0xe332ff=_0x5c3f9d[_0x3c0363(0x20c)]?await getDbName(_0x2db893[_0x3c0363(0x208)],Number(_0x5c3f9d[_0x3c0363(0x20c)]))[_0x3c0363(0x204)](()=>undefined):undefined,_0x2012c7=buildLocalSqlFileContent({'sqlCode':_0x5c3f9d[_0x3c0363(0x20f)],'sqlName':_0x5c3f9d[_0x3c0363(0x1e9)],'dbId':_0x5c3f9d[_0x3c0363(0x20c)]},_0x5a9ad6,{'dbName':_0xe332ff,'mode':_0x39dfa0,'syncedAt':new Date()[_0x3c0363(0x225)](),'description':_0x5c3f9d[_0x3c0363(0x219)]}),_0x37ffaf=buildSqlLockEntry(_0x5c3f9d,_0x5a9ad6,'',{'dbName':_0xe332ff}),_0x10bbfd=resolveLocalSqlFilePath(_0x591cfb,_0x5c3f9d[_0x3c0363(0x20f)],_0x37ffaf);let _0x4195bc=_0x3c0363(0x220),_0x5b24c6;if(await fileExists(_0x10bbfd)){const _0xbbe1a6=await readFile(_0x10bbfd,_0x3c0363(0x21f));isEquivalentPulledSqlFile(_0xbbe1a6,_0x2012c7,_0x39dfa0)?(_0x4195bc=_0x3c0363(0x218),_0x5b24c6=_0x3c0363(0x221)):(_0x4195bc=_0x3c0363(0x211),_0x5b24c6=_0x3c0363(0x1e6));}_0x3f8c3f[_0x3c0363(0x1fe)]({'sqlCode':_0x5c3f9d[_0x3c0363(0x20f)],'sqlName':_0x5c3f9d[_0x3c0363(0x1e9)],'filePath':_0x10bbfd,'status':_0x4195bc,'reason':_0x5b24c6});}return{'method':'POST','url':_0x3c0363(0x1fd),'body':{'appCode':_0x2db893['appCode'],'sqlCode':_0x2db893[_0x3c0363(0x202)](_0x3c0363(0x1fc))||null,'sqlName':_0x2db893[_0x3c0363(0x202)]('name')||null,'files':_0x3f8c3f},'description':_0x3c0363(0x20a)+_0x3f8c3f[_0x3c0363(0x1f5)]+_0x3c0363(0x207)+_0x591cfb[_0x3c0363(0x1ea)]};},async 'execute'(_0x377fb2){const _0x3a0fb5=a137_0x5ac735,_0x3f0a2a=loadSqlProjectConfig(_0x377fb2[_0x3a0fb5(0x208)]),_0x147ace=await readSqlLockFile(_0x3f0a2a[_0x3a0fb5(0x1fb)]),{lockData:_0x32dc58,appLock:_0x3da8f9}=ensureSqlLockScope(_0x147ace??createEmptySqlLock(),_0x3f0a2a['appCode'],_0x3f0a2a[_0x3a0fb5(0x1f4)],'pull'),_0x441494=_0x377fb2[_0x3a0fb5(0x20d)](_0x3a0fb5(0x1e3)),_0x12d9d8=await fetchAllSqlQueries(_0x377fb2[_0x3a0fb5(0x208)],{'sqlCode':_0x377fb2[_0x3a0fb5(0x202)](_0x3a0fb5(0x1fc))||undefined,'sqlName':_0x377fb2[_0x3a0fb5(0x202)](_0x3a0fb5(0x209))||undefined});if(_0x12d9d8[_0x3a0fb5(0x1f5)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x3a0fb5(0x1ef)};const _0x1039ce=[],_0x3d2f93=[];for(const _0x259e72 of _0x12d9d8){try{_0x1039ce[_0x3a0fb5(0x1fe)](await ensureSqlContent(_0x259e72));}catch(_0x3b15d8){_0x3d2f93[_0x3a0fb5(0x1fe)]({'sqlCode':_0x259e72[_0x3a0fb5(0x20f)],'error':_0x3b15d8 instanceof Error?_0x3b15d8[_0x3a0fb5(0x203)]:String(_0x3b15d8)});}}if(_0x441494&&!_0x377fb2[_0x3a0fb5(0x201)]){let _0x5e5fa6=![];for(const _0x13018c of _0x1039ce){const _0x507580=detectModeFromSql(_0x13018c),_0x16acce=_0x13018c[_0x3a0fb5(0x20c)]?await getDbName(_0x377fb2['appCode'],Number(_0x13018c[_0x3a0fb5(0x20c)]))[_0x3a0fb5(0x204)](()=>undefined):undefined,_0xc3224b=buildLocalSqlFileContent({'sqlCode':_0x13018c[_0x3a0fb5(0x20f)],'sqlName':_0x13018c[_0x3a0fb5(0x1e9)],'dbId':_0x13018c[_0x3a0fb5(0x20c)]},ensureRemoteSqlContent(_0x13018c),{'dbName':_0x16acce,'mode':_0x507580,'syncedAt':new Date()['toISOString'](),'description':_0x13018c['description']}),_0x49ba53=resolveLocalSqlFilePath(_0x3f0a2a,_0x13018c['sqlCode'],buildSqlLockEntry(_0x13018c,ensureRemoteSqlContent(_0x13018c),'',{'dbName':_0x16acce}));if(await fileExists(_0x49ba53)){const _0x1b672d=await readFile(_0x49ba53,'utf8');if(!isEquivalentPulledSqlFile(_0x1b672d,_0xc3224b,_0x507580)){_0x5e5fa6=!![];break;}}}if(_0x5e5fa6){const _0x1ef041=await confirmForceOverwrite(_0x3a0fb5(0x21e));if(!_0x1ef041)throw CliErrors[_0x3a0fb5(0x1eb)](_0x3a0fb5(0x1f0));}}const _0x211132=cloneSqlLockData(_0x32dc58),_0xb24bc3=_0x211132[_0x3a0fb5(0x1f7)][_0x3f0a2a[_0x3a0fb5(0x208)]],_0x292c71=[],_0x4a5021=[];for(const _0x4216b5 of _0x1039ce){const _0x1c8d87=_0xb24bc3[_0x3a0fb5(0x206)][_0x4216b5[_0x3a0fb5(0x20f)]],_0x15f19b=ensureRemoteSqlContent(_0x4216b5),_0x30286d=detectModeFromSql(_0x4216b5),_0x5d6eb5=_0x4216b5[_0x3a0fb5(0x20c)]?await getDbName(_0x377fb2['appCode'],Number(_0x4216b5['dbId']))[_0x3a0fb5(0x204)](()=>undefined):undefined,_0x9919c5=buildLocalSqlFileContent({'sqlCode':_0x4216b5['sqlCode'],'sqlName':_0x4216b5[_0x3a0fb5(0x1e9)],'dbId':_0x4216b5[_0x3a0fb5(0x20c)]},_0x15f19b,{'dbName':_0x5d6eb5,'mode':_0x30286d,'syncedAt':new Date()[_0x3a0fb5(0x225)](),'description':_0x4216b5['description']}),_0x5d3bb9=buildSqlLockEntry(_0x4216b5,_0x15f19b,computeSqlContentHash(_0x9919c5),{'dbName':_0x5d6eb5}),_0x233bc3=_0x5d3bb9[_0x3a0fb5(0x223)],_0x33f518=join(_0x3f0a2a[_0x3a0fb5(0x1ea)],_0x233bc3);try{if(await fileExists(_0x33f518)){const _0x271979=await readFile(_0x33f518,'utf8');if(isEquivalentPulledSqlFile(_0x271979,_0x9919c5,_0x30286d)){_0x4a5021[_0x3a0fb5(0x1fe)]({'sqlCode':_0x4216b5[_0x3a0fb5(0x20f)],'reason':_0x3a0fb5(0x221)}),_0xb24bc3[_0x3a0fb5(0x206)][_0x4216b5['sqlCode']]={..._0x5d3bb9,'hash':computeSqlContentHash(_0x271979),'path':_0x233bc3};continue;}if(!_0x441494){_0x4a5021[_0x3a0fb5(0x1fe)]({'sqlCode':_0x4216b5[_0x3a0fb5(0x20f)],'reason':_0x3a0fb5(0x1ee)});continue;}}const _0x117736=_0x1c8d87?.[_0x3a0fb5(0x223)]?join(_0x3f0a2a['sqlRootDir'],_0x1c8d87[_0x3a0fb5(0x223)]):undefined;_0x117736&&_0x117736!==_0x33f518&&await fileExists(_0x117736)&&await rm(_0x117736,{'force':!![]}),await ensureParentDirectory(_0x33f518),await writeFile(_0x33f518,_0x9919c5,_0x3a0fb5(0x21f)),_0xb24bc3[_0x3a0fb5(0x206)][_0x4216b5[_0x3a0fb5(0x20f)]]={..._0x5d3bb9,'path':_0x233bc3},_0x292c71[_0x3a0fb5(0x1fe)]({'sqlCode':_0x4216b5[_0x3a0fb5(0x20f)],'filePath':_0x33f518});}catch(_0x2bd08c){_0x3d2f93[_0x3a0fb5(0x1fe)]({'sqlCode':_0x4216b5[_0x3a0fb5(0x20f)],'error':_0x2bd08c instanceof Error?_0x2bd08c[_0x3a0fb5(0x203)]:String(_0x2bd08c)});}}return _0xb24bc3[_0x3a0fb5(0x20b)]=new Date()[_0x3a0fb5(0x225)](),await writeSqlLockFile(_0x3f0a2a[_0x3a0fb5(0x1fb)],_0x211132),{'ok':_0x3d2f93['length']===0x0,'data':{'pulled':_0x292c71,'skipped':_0x4a5021,'failed':_0x3d2f93},'message':_0x3a0fb5(0x217)+_0x292c71[_0x3a0fb5(0x1f5)]+_0x3a0fb5(0x1e7)+_0x4a5021[_0x3a0fb5(0x1f5)]+'\x20skipped,\x20'+_0x3d2f93[_0x3a0fb5(0x1f5)]+_0x3a0fb5(0x205)};}};function a137_0x43e0(_0x4f093d,_0x964f0f){_0x4f093d=_0x4f093d-0x1e3;const _0x2aa7e5=a137_0x2aa7();let _0x43e088=_0x2aa7e5[_0x4f093d];return _0x43e088;}function detectModeFromSql(_0x6914c1){const _0xd56a2c=a137_0x5ac735,_0xe9d3bf=ensureRemoteSqlContent(_0x6914c1),_0x17bad1=stripLocalSqlMetadata(_0xe9d3bf,_0xd56a2c(0x222))[_0xd56a2c(0x1f9)]();if(/^<(select|insert|update|delete)\b/i[_0xd56a2c(0x215)](_0x17bad1))return _0xd56a2c(0x222);return _0xd56a2c(0x1e8);}function isEquivalentPulledSqlFile(_0x82e77b,_0x255f19,_0xeae1c0){return normalizePullComparableContent(_0x82e77b,_0xeae1c0)===normalizePullComparableContent(_0x255f19,_0xeae1c0);}function normalizePullComparableContent(_0x8950d0,_0x4e9fec){const _0xd3b64d=a137_0x5ac735,_0x56faa2=_0x8950d0['replace'](/\r\n/g,'\x0a')[_0xd3b64d(0x1ed)]('\x0a'),_0x21102c=_0x56faa2[_0xd3b64d(0x212)](_0x101a74=>!isSyncedAtMetadataLine(_0x101a74,_0x4e9fec));return _0x21102c['join']('\x0a');}function isSyncedAtMetadataLine(_0x96096c,_0x145da9){const _0x121fbd=a137_0x5ac735;if(_0x145da9==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x121fbd(0x215)](_0x96096c);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x121fbd(0x215)](_0x96096c);}
@@ -1 +1 @@
1
- function a138_0x35f3(_0x23b9ff,_0x5a25e5){_0x23b9ff=_0x23b9ff-0xd3;const _0x2588eb=a138_0x2588();let _0x35f3ca=_0x2588eb[_0x23b9ff];return _0x35f3ca;}const a138_0x5c5a72=a138_0x35f3;(function(_0x4dbb71,_0xaaece5){const _0x4f6955=a138_0x35f3,_0x455bf8=_0x4dbb71();while(!![]){try{const _0x42183e=-parseInt(_0x4f6955(0xfa))/0x1*(-parseInt(_0x4f6955(0xd5))/0x2)+-parseInt(_0x4f6955(0xf9))/0x3+-parseInt(_0x4f6955(0xeb))/0x4+parseInt(_0x4f6955(0xd4))/0x5*(-parseInt(_0x4f6955(0x10c))/0x6)+parseInt(_0x4f6955(0xe1))/0x7+-parseInt(_0x4f6955(0xe5))/0x8+parseInt(_0x4f6955(0xe0))/0x9;if(_0x42183e===_0xaaece5)break;else _0x455bf8['push'](_0x455bf8['shift']());}catch(_0x3f8a7c){_0x455bf8['push'](_0x455bf8['shift']());}}}(a138_0x2588,0x98ffa));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';function a138_0x2588(){const _0x4d409c=['trashDir','boolean','Local\x20directory\x20\x22','remoteId','relativePath','17955252OEvXvN','5080544qeIyfn','sqlcode','force','filePath','6401592qygjfu','\x20failed','Local\x20SQL\x20not\x20found:\x20','dbDirectory','path','map','4402492ufbErj','sqlRootDir','No\x20database\x20matches\x20local\x20directory\x20\x22','dbId','has','Push\x20local\x20SQL\x20files\x20to\x20remote','validation','bool','exec','catch','filter','replace','POST','length','412623ySwluf','2732qSPAgL','Push\x20complete:\x20','sqlName','dbName','appCode','sqlRoot','sqlCode','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','lockFilePath','\x22\x20for\x20sqlCode\x20','utf8','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','push','entries','sqlConfig','hash','version','unchanged','165282lMNvMO','high-risk-write','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','join','/smartapi/custom/updateUserCustomSql','lastSync','toISOString','get','25tFRlwz','60foBBbE','message','No\x20local\x20SQL\x20files\x20found.','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','sqls','\x20skipped,\x20'];a138_0x2588=function(){return _0x4d409c;};return a138_0x2588();}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(_0x4d2b05,_0x37750f,_0x34d739){const _0x179b09=a138_0x35f3,_0x4ea35d=await scanLocalSqlQueries(_0x4d2b05),_0x927eb2=new Map();for(const _0x3b97a1 of _0x4ea35d){if(_0x34d739&&_0x3b97a1[_0x179b09(0x100)]!==_0x34d739)continue;const _0x38bd45=_0x927eb2[_0x179b09(0xd3)](_0x3b97a1['sqlCode'])??[];_0x38bd45[_0x179b09(0x106)](_0x3b97a1),_0x927eb2['set'](_0x3b97a1['sqlCode'],_0x38bd45);}if(_0x34d739&&!_0x927eb2[_0x179b09(0xef)](_0x34d739))throw CliErrors['validation'](_0x179b09(0xe7)+_0x34d739);const _0x18fe6b=[];for(const [_0x4bed0e,_0x33b79e]of _0x927eb2[_0x179b09(0x107)]()){if(_0x33b79e[_0x179b09(0xf8)]===0x1){_0x18fe6b['push'](_0x33b79e[0x0]);continue;}const _0x599881=_0x37750f[_0x179b09(0xd9)][_0x4bed0e],_0xb71d08=_0x599881?.[_0x179b09(0xe9)],_0x2bff06=_0xb71d08?_0x33b79e[_0x179b09(0xf5)](_0x455003=>_0x455003[_0x179b09(0xdf)]!==_0xb71d08):_0x33b79e;if(_0x599881&&_0x2bff06[_0x179b09(0xf8)]===0x1){_0x18fe6b[_0x179b09(0x106)](_0x2bff06[0x0]);continue;}throw CliErrors[_0x179b09(0xf1)](_0x179b09(0x105)+_0x4bed0e+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x18fe6b;}export const sqlPush={'service':'sql','command':a138_0x5c5a72(0x106),'description':a138_0x5c5a72(0xf0),'risk':a138_0x5c5a72(0x10d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a138_0x5c5a72(0xe3),'type':a138_0x5c5a72(0xdc),'description':a138_0x5c5a72(0x10e)}],async 'dryRun'(_0x5db9c3){const _0x4df48b=a138_0x5c5a72,_0x231611=loadSqlProjectConfig(_0x5db9c3[_0x4df48b(0xfe)]),_0x3e1891=await readSqlLockFile(_0x231611['lockFilePath']),{appLock:_0x1f8e43}=ensureSqlLockScope(_0x3e1891??createEmptySqlLock(),_0x5db9c3[_0x4df48b(0xfe)],_0x231611[_0x4df48b(0xff)],_0x4df48b(0x106)),_0x276290=await getTargetSqlQueries(_0x231611,_0x1f8e43,_0x5db9c3['str'](_0x4df48b(0xe2))||undefined),_0x32b7e3=[];for(const _0xb8f41f of _0x276290){const _0x1b1af3=await computeSqlFileHash(_0xb8f41f[_0x4df48b(0xe4)]),_0x704f9b=_0x1f8e43[_0x4df48b(0xd9)][_0xb8f41f[_0x4df48b(0x100)]],_0x1e2da6=!!_0x704f9b&&(_0x704f9b['path']!==_0xb8f41f[_0x4df48b(0xdf)]||!!_0xb8f41f['sqlName']&&_0x704f9b[_0x4df48b(0xfc)]!==_0xb8f41f['sqlName']);if(!_0x5db9c3[_0x4df48b(0xf2)](_0x4df48b(0xe3))&&_0x704f9b&&_0x704f9b[_0x4df48b(0x109)]===_0x1b1af3&&!_0x1e2da6)continue;_0x32b7e3[_0x4df48b(0x106)](_0xb8f41f[_0x4df48b(0x100)]);}return{'method':_0x4df48b(0xf7),'url':_0x4df48b(0x110),'body':{'sqlCodes':_0x32b7e3,'appCode':_0x5db9c3[_0x4df48b(0xfe)]},'description':'Would\x20push\x20'+_0x32b7e3[_0x4df48b(0xf8)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x49d5de){const _0xc64a0d=a138_0x5c5a72,_0x138277=loadSqlProjectConfig(_0x49d5de[_0xc64a0d(0xfe)]),_0x59abe1=await readSqlLockFile(_0x138277[_0xc64a0d(0x102)]),{lockData:_0x40ff8f,appLock:_0x4ea8ef}=ensureSqlLockScope(_0x59abe1??createEmptySqlLock(),_0x49d5de['appCode'],_0x138277[_0xc64a0d(0xff)],_0xc64a0d(0x106)),_0x41da2b=await getTargetSqlQueries(_0x138277,_0x4ea8ef,_0x49d5de['str']('sqlcode')||undefined);if(_0x41da2b[_0xc64a0d(0xf8)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0xc64a0d(0xd7)};const _0x42a7b1=[],_0x4e14ce=[],_0x5e234b=[];for(const _0x277813 of _0x41da2b){const _0xfd56e5=_0x4ea8ef[_0xc64a0d(0xd9)][_0x277813['sqlCode']];if(!_0xfd56e5){_0x5e234b[_0xc64a0d(0x106)]({'sqlCode':_0x277813[_0xc64a0d(0x100)],'error':_0xc64a0d(0xd8)});continue;}try{const _0x573676=await computeSqlFileHash(_0x277813[_0xc64a0d(0xe4)]),_0x41a316=_0xfd56e5[_0xc64a0d(0xe9)]!==_0x277813[_0xc64a0d(0xdf)]||!!_0x277813['sqlName']&&_0xfd56e5[_0xc64a0d(0xfc)]!==_0x277813['sqlName'];if(!_0x49d5de[_0xc64a0d(0xf2)](_0xc64a0d(0xe3))&&_0xfd56e5[_0xc64a0d(0x109)]===_0x573676&&!_0x41a316){_0x4e14ce[_0xc64a0d(0x106)]({'sqlCode':_0x277813[_0xc64a0d(0x100)],'reason':_0xc64a0d(0x10b)});continue;}if(_0xfd56e5[_0xc64a0d(0x10a)]==null){_0x5e234b[_0xc64a0d(0x106)]({'sqlCode':_0x277813[_0xc64a0d(0x100)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x20e8ce=await readFile(_0x277813[_0xc64a0d(0xe4)],_0xc64a0d(0x104)),_0x290985=stripLocalSqlMetadata(_0x20e8ce,_0x277813['mode']),_0x43577a=_0x277813['sqlName']||_0xfd56e5[_0xc64a0d(0xfc)],_0x12fdaf=await resolveTargetDbBinding(_0x49d5de[_0xc64a0d(0xfe)],_0x277813,_0xfd56e5),_0x4c06ea=await updateSqlQuery({'id':_0xfd56e5[_0xc64a0d(0xde)],'appCode':_0x49d5de[_0xc64a0d(0xfe)],'sqlCode':_0x277813[_0xc64a0d(0x100)],'sqlName':_0x43577a,'dbId':_0x12fdaf[_0xc64a0d(0xee)],'version':_0xfd56e5['version'],'sqlContent':_0x290985,'sqlConfig':_0xfd56e5[_0xc64a0d(0x108)]??undefined}),_0x2b6e40=_0x4c06ea[_0xc64a0d(0xee)]?await getDbName(_0x49d5de[_0xc64a0d(0xfe)],Number(_0x4c06ea[_0xc64a0d(0xee)]))[_0xc64a0d(0xf4)](()=>_0x12fdaf[_0xc64a0d(0xfd)]):_0x12fdaf['dbName'];_0x4ea8ef[_0xc64a0d(0xd9)][_0x277813[_0xc64a0d(0x100)]]={...buildSqlLockEntry(_0x4c06ea,_0x290985,_0x573676,{'dbName':_0x2b6e40}),'path':_0x277813[_0xc64a0d(0xdf)],'mode':_0xfd56e5['mode']},await archivePreviousSqlFileIfNeeded(_0x138277,_0xfd56e5[_0xc64a0d(0xe9)],_0x277813[_0xc64a0d(0xdf)]),_0x42a7b1[_0xc64a0d(0x106)]({'sqlCode':_0x277813[_0xc64a0d(0x100)],'remoteId':_0xfd56e5[_0xc64a0d(0xde)]});}catch(_0x4f46fc){_0x5e234b[_0xc64a0d(0x106)]({'sqlCode':_0x277813[_0xc64a0d(0x100)],'error':_0x4f46fc instanceof Error?_0x4f46fc[_0xc64a0d(0xd6)]:String(_0x4f46fc)});}}return _0x4ea8ef[_0xc64a0d(0x111)]=new Date()['toISOString'](),await writeSqlLockFile(_0x138277[_0xc64a0d(0x102)],_0x40ff8f),{'ok':_0x5e234b[_0xc64a0d(0xf8)]===0x0,'data':{'pushed':_0x42a7b1,'skipped':_0x4e14ce,'failed':_0x5e234b},'message':_0xc64a0d(0xfb)+_0x42a7b1[_0xc64a0d(0xf8)]+'\x20pushed,\x20'+_0x4e14ce[_0xc64a0d(0xf8)]+_0xc64a0d(0xda)+_0x5e234b[_0xc64a0d(0xf8)]+_0xc64a0d(0xe6)};}};async function archivePreviousSqlFileIfNeeded(_0x371966,_0x40c59a,_0x54fcec){const _0x4ef99e=a138_0x5c5a72;if(!_0x40c59a||_0x40c59a===_0x54fcec)return;const _0x1851c7=join(_0x371966[_0x4ef99e(0xec)],_0x40c59a);if(!await fileExists(_0x1851c7))return;const _0x5d184c=await moveToTrash(_0x371966['projectRoot'],_0x371966[_0x4ef99e(0xdb)],_0x1851c7);await cleanupEmptyDirectories(dirname(_0x1851c7),_0x371966[_0x4ef99e(0xec)]),void _0x5d184c;}async function moveToTrash(_0x22d4fe,_0xd15fff,_0x5283e4){const _0x548161=a138_0x5c5a72,_0x4a23e7=new Date()[_0x548161(0x112)]()[_0x548161(0xf6)](/[:.]/g,'-'),_0x5d8ce3=relative(_0x22d4fe,_0x5283e4),_0xb457d5=join(_0xd15fff,_0x4a23e7,_0x5d8ce3);return await mkdir(dirname(_0xb457d5),{'recursive':!![]}),await rename(_0x5283e4,_0xb457d5),_0xb457d5;}async function cleanupEmptyDirectories(_0x126216,_0x4e0163){const _0x2de1bd=a138_0x5c5a72;let _0x237bdc=resolve(_0x126216);const _0x29a75a=resolve(_0x4e0163);while(_0x237bdc['startsWith'](''+_0x29a75a+sep)||_0x237bdc===_0x29a75a){if(_0x237bdc===_0x29a75a)return;try{const _0x59a933=await readdir(_0x237bdc);if(_0x59a933[_0x2de1bd(0xf8)]>0x0)return;await rmdir(_0x237bdc);}catch{return;}_0x237bdc=dirname(_0x237bdc);}}async function resolveTargetDbBinding(_0x29d78d,_0x898e8d,_0xac178e){const _0x1e2426=a138_0x5c5a72,_0xf96ebb=_0x898e8d[_0x1e2426(0xe8)];if(!_0xf96ebb)return{'dbId':_0xac178e[_0x1e2426(0xee)],'dbName':_0xac178e['dbName']};const _0x396f90=buildDbDirectoryName(_0xac178e[_0x1e2426(0xfd)],_0xac178e['dbId']);if(_0xf96ebb===_0x396f90)return{'dbId':_0xac178e[_0x1e2426(0xee)],'dbName':_0xac178e[_0x1e2426(0xfd)]};const _0x4397c2=parseExplicitDbDirectory(_0xf96ebb);if(_0x4397c2!=null)return{'dbId':_0x4397c2,'dbName':await getDbName(_0x29d78d,_0x4397c2)['catch'](()=>undefined)};const _0x2a0510=await listDatabases(_0x29d78d),_0x57a75e=_0x2a0510[_0x1e2426(0xf5)](_0x113506=>buildDbDirectoryName(_0x113506[_0x1e2426(0xfd)],_0x113506[_0x1e2426(0xee)])===_0xf96ebb);if(_0x57a75e[_0x1e2426(0xf8)]===0x1)return{'dbId':_0x57a75e[0x0]['dbId'],'dbName':_0x57a75e[0x0][_0x1e2426(0xfd)]};if(_0x57a75e[_0x1e2426(0xf8)]===0x0)throw CliErrors[_0x1e2426(0xf1)](_0x1e2426(0xed)+_0xf96ebb+_0x1e2426(0x103)+_0x898e8d[_0x1e2426(0x100)]+'.');const _0x23f010=_0x57a75e[_0x1e2426(0xea)](_0x2eb4f3=>_0x2eb4f3[_0x1e2426(0xfd)]+'\x20('+_0x2eb4f3[_0x1e2426(0xee)]+')')[_0x1e2426(0x10f)](',\x20');throw CliErrors['validation'](_0x1e2426(0xdd)+_0xf96ebb+_0x1e2426(0x101)+_0x898e8d[_0x1e2426(0x100)]+':\x20'+_0x23f010);}function parseExplicitDbDirectory(_0x4d8aca){const _0x20394f=a138_0x5c5a72,_0x5eb66b=/^db-(\d+)$/[_0x20394f(0xf3)](_0x4d8aca);if(!_0x5eb66b)return null;const _0x40ba7c=Number(_0x5eb66b[0x1]);return Number['isFinite'](_0x40ba7c)&&_0x40ba7c>0x0?_0x40ba7c:null;}
1
+ const a138_0x1cb83b=a138_0x21ba;(function(_0x31f658,_0x1ae7a5){const _0x59eb0f=a138_0x21ba,_0x2d447e=_0x31f658();while(!![]){try{const _0x359f35=-parseInt(_0x59eb0f(0xd8))/0x1+-parseInt(_0x59eb0f(0xf5))/0x2+parseInt(_0x59eb0f(0xf3))/0x3+parseInt(_0x59eb0f(0xef))/0x4*(parseInt(_0x59eb0f(0xfe))/0x5)+-parseInt(_0x59eb0f(0xfc))/0x6+-parseInt(_0x59eb0f(0xc1))/0x7+-parseInt(_0x59eb0f(0xe6))/0x8*(-parseInt(_0x59eb0f(0xdf))/0x9);if(_0x359f35===_0x1ae7a5)break;else _0x2d447e['push'](_0x2d447e['shift']());}catch(_0x569946){_0x2d447e['push'](_0x2d447e['shift']());}}}(a138_0x1eed,0x4a6f7));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';function a138_0x1eed(){const _0x4702a8=['\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','mode','dbDirectory','projectRoot','Push\x20local\x20SQL\x20files\x20to\x20remote','146010fTtbeW','path','validation','\x20SQL\x20file(s)','sqlRootDir','sqlcode','relativePath','1491795YChspd','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','appCode','\x22\x20for\x20sqlCode\x20','map','startsWith','entries','8mCLOrw','dbName','Would\x20push\x20','push','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','bool','unchanged','trashDir','sqlRoot','8816JuKLFl','catch','length','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','1643112hzNTwZ','sqls','481286uIvoxt','sqlCode','hash','filter','str','lastSync','\x20pushed,\x20','1821726McDGYI','lockFilePath','1055mXDFgN','Local\x20SQL\x20not\x20found:\x20','dbId','toISOString','filePath','1283394GcBnRn','exec','/smartapi/custom/updateUserCustomSql','set','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','POST','remoteId','has','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','boolean','join','version','sql','get','\x20skipped,\x20','sqlName','utf8','force'];a138_0x1eed=function(){return _0x4702a8;};return a138_0x1eed();}import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a138_0x21ba(_0x1b663d,_0x158bc5){_0x1b663d=_0x1b663d-0xc0;const _0x1eed54=a138_0x1eed();let _0x21bab4=_0x1eed54[_0x1b663d];return _0x21bab4;}import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x5100fc,_0xb7832e,_0x5e4f44){const _0x37f0b2=a138_0x21ba,_0x196a41=await scanLocalSqlQueries(_0x5100fc),_0x449253=new Map();for(const _0x4e2090 of _0x196a41){if(_0x5e4f44&&_0x4e2090['sqlCode']!==_0x5e4f44)continue;const _0x5afbc7=_0x449253[_0x37f0b2(0xce)](_0x4e2090[_0x37f0b2(0xf6)])??[];_0x5afbc7[_0x37f0b2(0xe9)](_0x4e2090),_0x449253[_0x37f0b2(0xc4)](_0x4e2090['sqlCode'],_0x5afbc7);}if(_0x5e4f44&&!_0x449253[_0x37f0b2(0xc8)](_0x5e4f44))throw CliErrors[_0x37f0b2(0xda)](_0x37f0b2(0xff)+_0x5e4f44);const _0x155682=[];for(const [_0x37a498,_0x4131ac]of _0x449253[_0x37f0b2(0xe5)]()){if(_0x4131ac[_0x37f0b2(0xf1)]===0x1){_0x155682['push'](_0x4131ac[0x0]);continue;}const _0x4210ab=_0xb7832e[_0x37f0b2(0xf4)][_0x37a498],_0x28e0ba=_0x4210ab?.[_0x37f0b2(0xd9)],_0x462d02=_0x28e0ba?_0x4131ac[_0x37f0b2(0xf8)](_0x593f00=>_0x593f00[_0x37f0b2(0xde)]!==_0x28e0ba):_0x4131ac;if(_0x4210ab&&_0x462d02[_0x37f0b2(0xf1)]===0x1){_0x155682[_0x37f0b2(0xe9)](_0x462d02[0x0]);continue;}throw CliErrors['validation'](_0x37f0b2(0xc9)+_0x37a498+_0x37f0b2(0xf2));}return _0x155682;}export const sqlPush={'service':a138_0x1cb83b(0xcd),'command':a138_0x1cb83b(0xe9),'description':a138_0x1cb83b(0xd7),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a138_0x1cb83b(0xca),'description':a138_0x1cb83b(0xc5)}],async 'dryRun'(_0x531263){const _0x2861d7=a138_0x1cb83b,_0x34b564=loadSqlProjectConfig(_0x531263[_0x2861d7(0xe1)]),_0xe3c257=await readSqlLockFile(_0x34b564[_0x2861d7(0xfd)]),{appLock:_0x35e8db}=ensureSqlLockScope(_0xe3c257??createEmptySqlLock(),_0x531263[_0x2861d7(0xe1)],_0x34b564[_0x2861d7(0xee)],_0x2861d7(0xe9)),_0x4ee891=await getTargetSqlQueries(_0x34b564,_0x35e8db,_0x531263['str'](_0x2861d7(0xdd))||undefined),_0x1662d6=[];for(const _0x3439ba of _0x4ee891){const _0x52f1da=await computeSqlFileHash(_0x3439ba[_0x2861d7(0xc0)]),_0x3ce62f=_0x35e8db[_0x2861d7(0xf4)][_0x3439ba[_0x2861d7(0xf6)]],_0x56ef21=!!_0x3ce62f&&(_0x3ce62f[_0x2861d7(0xd9)]!==_0x3439ba[_0x2861d7(0xde)]||!!_0x3439ba[_0x2861d7(0xd0)]&&_0x3ce62f[_0x2861d7(0xd0)]!==_0x3439ba[_0x2861d7(0xd0)]);if(!_0x531263[_0x2861d7(0xeb)](_0x2861d7(0xd2))&&_0x3ce62f&&_0x3ce62f['hash']===_0x52f1da&&!_0x56ef21)continue;_0x1662d6['push'](_0x3439ba['sqlCode']);}return{'method':_0x2861d7(0xc6),'url':_0x2861d7(0xc3),'body':{'sqlCodes':_0x1662d6,'appCode':_0x531263['appCode']},'description':_0x2861d7(0xe8)+_0x1662d6[_0x2861d7(0xf1)]+_0x2861d7(0xdb)};},async 'execute'(_0x1a3690){const _0x1b6eb8=a138_0x1cb83b,_0x5f535f=loadSqlProjectConfig(_0x1a3690[_0x1b6eb8(0xe1)]),_0x2ab7fa=await readSqlLockFile(_0x5f535f[_0x1b6eb8(0xfd)]),{lockData:_0x2c345b,appLock:_0x143690}=ensureSqlLockScope(_0x2ab7fa??createEmptySqlLock(),_0x1a3690[_0x1b6eb8(0xe1)],_0x5f535f[_0x1b6eb8(0xee)],_0x1b6eb8(0xe9)),_0x305b0a=await getTargetSqlQueries(_0x5f535f,_0x143690,_0x1a3690[_0x1b6eb8(0xf9)](_0x1b6eb8(0xdd))||undefined);if(_0x305b0a[_0x1b6eb8(0xf1)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x12af47=[],_0x41fbb7=[],_0x309078=[];for(const _0x47a0b7 of _0x305b0a){const _0x3e011f=_0x143690[_0x1b6eb8(0xf4)][_0x47a0b7[_0x1b6eb8(0xf6)]];if(!_0x3e011f){_0x309078[_0x1b6eb8(0xe9)]({'sqlCode':_0x47a0b7[_0x1b6eb8(0xf6)],'error':_0x1b6eb8(0xe0)});continue;}try{const _0x220a45=await computeSqlFileHash(_0x47a0b7[_0x1b6eb8(0xc0)]),_0x506f73=_0x3e011f['path']!==_0x47a0b7[_0x1b6eb8(0xde)]||!!_0x47a0b7[_0x1b6eb8(0xd0)]&&_0x3e011f['sqlName']!==_0x47a0b7['sqlName'];if(!_0x1a3690[_0x1b6eb8(0xeb)](_0x1b6eb8(0xd2))&&_0x3e011f[_0x1b6eb8(0xf7)]===_0x220a45&&!_0x506f73){_0x41fbb7['push']({'sqlCode':_0x47a0b7[_0x1b6eb8(0xf6)],'reason':_0x1b6eb8(0xec)});continue;}if(_0x3e011f[_0x1b6eb8(0xcc)]==null){_0x309078[_0x1b6eb8(0xe9)]({'sqlCode':_0x47a0b7[_0x1b6eb8(0xf6)],'error':_0x1b6eb8(0xea)});continue;}const _0x2599a9=await readFile(_0x47a0b7['filePath'],_0x1b6eb8(0xd1)),_0x134866=stripLocalSqlMetadata(_0x2599a9,_0x47a0b7['mode']),_0x316995=_0x47a0b7[_0x1b6eb8(0xd0)]||_0x3e011f['sqlName'],_0x2017f8=await resolveTargetDbBinding(_0x1a3690[_0x1b6eb8(0xe1)],_0x47a0b7,_0x3e011f),_0x160d9e=await updateSqlQuery({'id':_0x3e011f[_0x1b6eb8(0xc7)],'appCode':_0x1a3690[_0x1b6eb8(0xe1)],'sqlCode':_0x47a0b7[_0x1b6eb8(0xf6)],'sqlName':_0x316995,'dbId':_0x2017f8['dbId'],'version':_0x3e011f[_0x1b6eb8(0xcc)],'sqlContent':_0x134866,'sqlConfig':_0x3e011f['sqlConfig']??undefined}),_0x18bf65=_0x160d9e[_0x1b6eb8(0x100)]?await getDbName(_0x1a3690[_0x1b6eb8(0xe1)],Number(_0x160d9e['dbId']))['catch'](()=>_0x2017f8[_0x1b6eb8(0xe7)]):_0x2017f8[_0x1b6eb8(0xe7)];_0x143690[_0x1b6eb8(0xf4)][_0x47a0b7['sqlCode']]={...buildSqlLockEntry(_0x160d9e,_0x134866,_0x220a45,{'dbName':_0x18bf65}),'path':_0x47a0b7[_0x1b6eb8(0xde)],'mode':_0x3e011f[_0x1b6eb8(0xd4)]},await archivePreviousSqlFileIfNeeded(_0x5f535f,_0x3e011f[_0x1b6eb8(0xd9)],_0x47a0b7[_0x1b6eb8(0xde)]),_0x12af47['push']({'sqlCode':_0x47a0b7[_0x1b6eb8(0xf6)],'remoteId':_0x3e011f['remoteId']});}catch(_0x4eace4){_0x309078['push']({'sqlCode':_0x47a0b7[_0x1b6eb8(0xf6)],'error':_0x4eace4 instanceof Error?_0x4eace4['message']:String(_0x4eace4)});}}return _0x143690[_0x1b6eb8(0xfa)]=new Date()[_0x1b6eb8(0x101)](),await writeSqlLockFile(_0x5f535f[_0x1b6eb8(0xfd)],_0x2c345b),{'ok':_0x309078[_0x1b6eb8(0xf1)]===0x0,'data':{'pushed':_0x12af47,'skipped':_0x41fbb7,'failed':_0x309078},'message':'Push\x20complete:\x20'+_0x12af47[_0x1b6eb8(0xf1)]+_0x1b6eb8(0xfb)+_0x41fbb7[_0x1b6eb8(0xf1)]+_0x1b6eb8(0xcf)+_0x309078[_0x1b6eb8(0xf1)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x5d912d,_0x45b398,_0x470831){const _0x1b0fd4=a138_0x1cb83b;if(!_0x45b398||_0x45b398===_0x470831)return;const _0x26855b=join(_0x5d912d['sqlRootDir'],_0x45b398);if(!await fileExists(_0x26855b))return;const _0x43f4e4=await moveToTrash(_0x5d912d[_0x1b0fd4(0xd6)],_0x5d912d[_0x1b0fd4(0xed)],_0x26855b);await cleanupEmptyDirectories(dirname(_0x26855b),_0x5d912d[_0x1b0fd4(0xdc)]),void _0x43f4e4;}async function moveToTrash(_0x43f996,_0x3e41a4,_0x17745a){const _0x508ef3=a138_0x1cb83b,_0x5742dd=new Date()[_0x508ef3(0x101)]()['replace'](/[:.]/g,'-'),_0x593d28=relative(_0x43f996,_0x17745a),_0x58b1c8=join(_0x3e41a4,_0x5742dd,_0x593d28);return await mkdir(dirname(_0x58b1c8),{'recursive':!![]}),await rename(_0x17745a,_0x58b1c8),_0x58b1c8;}async function cleanupEmptyDirectories(_0x339f1c,_0x5e15d9){const _0x1f5bf5=a138_0x1cb83b;let _0x7bfdc0=resolve(_0x339f1c);const _0x53e1eb=resolve(_0x5e15d9);while(_0x7bfdc0[_0x1f5bf5(0xe4)](''+_0x53e1eb+sep)||_0x7bfdc0===_0x53e1eb){if(_0x7bfdc0===_0x53e1eb)return;try{const _0x2e2a2f=await readdir(_0x7bfdc0);if(_0x2e2a2f[_0x1f5bf5(0xf1)]>0x0)return;await rmdir(_0x7bfdc0);}catch{return;}_0x7bfdc0=dirname(_0x7bfdc0);}}async function resolveTargetDbBinding(_0x15853a,_0x25031d,_0x5533a5){const _0x3f21b4=a138_0x1cb83b,_0x1d550c=_0x25031d[_0x3f21b4(0xd5)];if(!_0x1d550c)return{'dbId':_0x5533a5[_0x3f21b4(0x100)],'dbName':_0x5533a5[_0x3f21b4(0xe7)]};const _0x59110e=buildDbDirectoryName(_0x5533a5[_0x3f21b4(0xe7)],_0x5533a5[_0x3f21b4(0x100)]);if(_0x1d550c===_0x59110e)return{'dbId':_0x5533a5[_0x3f21b4(0x100)],'dbName':_0x5533a5['dbName']};const _0x18db81=parseExplicitDbDirectory(_0x1d550c);if(_0x18db81!=null)return{'dbId':_0x18db81,'dbName':await getDbName(_0x15853a,_0x18db81)[_0x3f21b4(0xf0)](()=>undefined)};const _0x1f3192=await listDatabases(_0x15853a),_0x4f634a=_0x1f3192[_0x3f21b4(0xf8)](_0x28cab0=>buildDbDirectoryName(_0x28cab0['dbName'],_0x28cab0[_0x3f21b4(0x100)])===_0x1d550c);if(_0x4f634a[_0x3f21b4(0xf1)]===0x1)return{'dbId':_0x4f634a[0x0]['dbId'],'dbName':_0x4f634a[0x0][_0x3f21b4(0xe7)]};if(_0x4f634a[_0x3f21b4(0xf1)]===0x0)throw CliErrors[_0x3f21b4(0xda)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x1d550c+_0x3f21b4(0xe2)+_0x25031d['sqlCode']+'.');const _0x44269a=_0x4f634a[_0x3f21b4(0xe3)](_0x595814=>_0x595814[_0x3f21b4(0xe7)]+'\x20('+_0x595814[_0x3f21b4(0x100)]+')')[_0x3f21b4(0xcb)](',\x20');throw CliErrors['validation']('Local\x20directory\x20\x22'+_0x1d550c+_0x3f21b4(0xd3)+_0x25031d[_0x3f21b4(0xf6)]+':\x20'+_0x44269a);}function parseExplicitDbDirectory(_0x4b7404){const _0x43bffd=a138_0x1cb83b,_0x54ab57=/^db-(\d+)$/[_0x43bffd(0xc2)](_0x4b7404);if(!_0x54ab57)return null;const _0x1132e6=Number(_0x54ab57[0x1]);return Number['isFinite'](_0x1132e6)&&_0x1132e6>0x0?_0x1132e6:null;}
@@ -1 +1 @@
1
- const a139_0x33d44b=a139_0x1d0b;(function(_0x4baacc,_0x20725d){const _0x585b80=a139_0x1d0b,_0xd9d2ce=_0x4baacc();while(!![]){try{const _0x5802b2=parseInt(_0x585b80(0xa6))/0x1+parseInt(_0x585b80(0x9b))/0x2+-parseInt(_0x585b80(0xa0))/0x3+parseInt(_0x585b80(0xa1))/0x4*(parseInt(_0x585b80(0xaa))/0x5)+parseInt(_0x585b80(0x9d))/0x6+-parseInt(_0x585b80(0xa2))/0x7*(-parseInt(_0x585b80(0xa3))/0x8)+parseInt(_0x585b80(0xaf))/0x9*(-parseInt(_0x585b80(0xab))/0xa);if(_0x5802b2===_0x20725d)break;else _0xd9d2ce['push'](_0xd9d2ce['shift']());}catch(_0x43b0d5){_0xd9d2ce['push'](_0xd9d2ce['shift']());}}}(a139_0xe55b,0x9461b));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a139_0x1d0b(_0x1732e4,_0x4bc82f){_0x1732e4=_0x1732e4-0x99;const _0xe55b9e=a139_0xe55b();let _0x1d0bd3=_0xe55b9e[_0x1732e4];return _0x1d0bd3;}const SQL_SAVE_DEPRECATED_HINT=[a139_0x33d44b(0xac),a139_0x33d44b(0x9c),a139_0x33d44b(0xa4)][a139_0x33d44b(0xa5)]('\x0a');export const sqlSave={'service':a139_0x33d44b(0xb0),'command':a139_0x33d44b(0xad),'description':a139_0x33d44b(0x9f),'risk':a139_0x33d44b(0x99),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a139_0x33d44b(0xa8),'type':a139_0x33d44b(0x9e),'required':!![],'description':a139_0x33d44b(0xa9)},SQLCODE_FLAG_OPTIONAL,{'name':a139_0x33d44b(0xae),'type':a139_0x33d44b(0x9e),'description':a139_0x33d44b(0x9a)},{'name':'db','type':'string','description':'Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)'},{'name':a139_0x33d44b(0xa7),'type':a139_0x33d44b(0x9e),'description':'Query\x20description'}],async 'validate'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);}};function a139_0xe55b(){const _0x32c944=['410EFbHgP','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','save','sqlname','397008VaSkEd','sql','write','SQL\x20query\x20display\x20name','134038MTsDHA','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','2866968QixEiY','string','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','393843xtFmUn','870644WVyKvJ','42WVYxLn','1004952xGuXxh','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','378439bowaWx','description','file','Path\x20to\x20the\x20SQL\x20file','20BrtVrv'];a139_0xe55b=function(){return _0x32c944;};return a139_0xe55b();}
1
+ const a139_0x4fc306=a139_0x9435;function a139_0x9435(_0x2d4235,_0x2c4aeb){_0x2d4235=_0x2d4235-0x14a;const _0x424ea8=a139_0x424e();let _0x9435cc=_0x424ea8[_0x2d4235];return _0x9435cc;}function a139_0x424e(){const _0x165c97=['5tOpzZx','save','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','4243492lCJdGA','join','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','sql','validation','Query\x20description','SQL\x20query\x20display\x20name','1673030KubiQf','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`.','10727504velsTC','Path\x20to\x20the\x20SQL\x20file','description','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','3XaawTL','sqlname','string','10273032nizcVk','988692fmVuBN','43452bHRUkt','2317770OmpURt'];a139_0x424e=function(){return _0x165c97;};return a139_0x424e();}(function(_0x6860b9,_0x3441f9){const _0x5d9d16=a139_0x9435,_0x3630ce=_0x6860b9();while(!![]){try{const _0x18ecd3=parseInt(_0x5d9d16(0x15c))/0x1+parseInt(_0x5d9d16(0x14f))/0x2+-parseInt(_0x5d9d16(0x14a))/0x3*(parseInt(_0x5d9d16(0x154))/0x4)+-parseInt(_0x5d9d16(0x151))/0x5*(-parseInt(_0x5d9d16(0x14e))/0x6)+-parseInt(_0x5d9d16(0x14d))/0x7+parseInt(_0x5d9d16(0x15e))/0x8+parseInt(_0x5d9d16(0x150))/0x9;if(_0x18ecd3===_0x3441f9)break;else _0x3630ce['push'](_0x3630ce['shift']());}catch(_0x2af732){_0x3630ce['push'](_0x3630ce['shift']());}}}(a139_0x424e,0xe2f15));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a139_0x4fc306(0x156),a139_0x4fc306(0x161),a139_0x4fc306(0x15d)][a139_0x4fc306(0x155)]('\x0a');export const sqlSave={'service':a139_0x4fc306(0x158),'command':a139_0x4fc306(0x152),'description':a139_0x4fc306(0x157),'risk':'write','requiresAuth':![],'requiresAppCode':![],'flags':[{'name':'file','type':a139_0x4fc306(0x14c),'required':!![],'description':a139_0x4fc306(0x15f)},SQLCODE_FLAG_OPTIONAL,{'name':a139_0x4fc306(0x14b),'type':a139_0x4fc306(0x14c),'description':a139_0x4fc306(0x15b)},{'name':'db','type':a139_0x4fc306(0x14c),'description':a139_0x4fc306(0x153)},{'name':a139_0x4fc306(0x160),'type':a139_0x4fc306(0x14c),'description':a139_0x4fc306(0x15a)}],async 'validate'(){const _0x32d50e=a139_0x4fc306;throw CliErrors[_0x32d50e(0x159)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x2683dd=a139_0x4fc306;throw CliErrors[_0x2683dd(0x159)](SQL_SAVE_DEPRECATED_HINT);}};
@@ -1 +1 @@
1
- const a140_0x8fc09e=a140_0x17d1;(function(_0x4e069b,_0x4b8b83){const _0xb25897=a140_0x17d1,_0x391c72=_0x4e069b();while(!![]){try{const _0x493730=parseInt(_0xb25897(0xf8))/0x1*(parseInt(_0xb25897(0xf3))/0x2)+-parseInt(_0xb25897(0x104))/0x3+-parseInt(_0xb25897(0x102))/0x4*(-parseInt(_0xb25897(0x10a))/0x5)+-parseInt(_0xb25897(0xfa))/0x6+parseInt(_0xb25897(0x10e))/0x7+-parseInt(_0xb25897(0x114))/0x8*(-parseInt(_0xb25897(0x10d))/0x9)+parseInt(_0xb25897(0xf5))/0xa*(parseInt(_0xb25897(0x101))/0xb);if(_0x493730===_0x4b8b83)break;else _0x391c72['push'](_0x391c72['shift']());}catch(_0x20a4da){_0x391c72['push'](_0x391c72['shift']());}}}(a140_0x35f8,0x4ace4));import{createInterface}from'node:readline';function a140_0x17d1(_0x1632d6,_0x55da63){_0x1632d6=_0x1632d6-0xf2;const _0x35f8cd=a140_0x35f8();let _0x17d177=_0x35f8cd[_0x1632d6];return _0x17d177;}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a140_0x8fc09e(0xf4);function a140_0x35f8(){const _0x3074c7=['\x20[y/N]\x20','filter','lastSync','split','8UljhPc','includes','version','map','sqlName','mybatisXml','sqlContent','length','push','dbName','dbId','yes','syncedAt','trim','740978TyqJYl','.rabetbase/sql','430PsGywh','description','entries','1AgRlsC','question','2657760jhOFFV','--\x20@lovrabet.','\x20-->','path','sqls','test','sqlRoot','45991LQFXYg','452cNWuVg','mode','745887HFdVRY','trimStart','close','sqlConfig','replace','sqlCode','9850LsBeTt','<!--\x20@lovrabet.','apps','506988iHDSmb','1181453xPhLrR','join'];a140_0x35f8=function(){return _0x3074c7;};return a140_0x35f8();}export function buildSqlLockEntry(_0x39e589,_0x1b9554,_0x5ea9a4,_0x4fd401){const _0x62874b=a140_0x8fc09e,_0x404060=detectSqlMode(_0x1b9554);return{'path':buildSqlRelativePath(_0x39e589[_0x62874b(0x109)],_0x39e589[_0x62874b(0x118)],_0x4fd401?.[_0x62874b(0x11d)],_0x404060,_0x39e589[_0x62874b(0x11e)]),'hash':_0x5ea9a4,'remoteId':_0x39e589['id'],'version':_0x39e589[_0x62874b(0x116)],'dbId':Number(_0x39e589[_0x62874b(0x11e)]),'dbName':_0x4fd401?.['dbName'],'sqlName':_0x39e589[_0x62874b(0x118)],'sqlConfig':_0x39e589[_0x62874b(0x107)]??undefined,'mode':_0x404060};}export function cloneSqlLockData(_0x5dcc5c){const _0x12d962=a140_0x8fc09e;return{'apps':Object['fromEntries'](Object[_0x12d962(0xf7)](_0x5dcc5c['apps'])[_0x12d962(0x117)](([_0x43c9f4,_0x5934ca])=>[_0x43c9f4,{'sqlRoot':_0x5934ca[_0x12d962(0x100)],'lastSync':_0x5934ca[_0x12d962(0x112)],'sqls':{..._0x5934ca[_0x12d962(0xfe)]}}]))};}export function ensureRemoteSqlContent(_0x5f1667){const _0x4880f5=a140_0x8fc09e;return _0x5f1667[_0x4880f5(0x11a)]??'';}export function buildLocalSqlFileContent(_0x17e1cc,_0xe3a948,_0x5284bf){const _0x357da4=a140_0x8fc09e,_0x337c32=_0x5284bf?.['mode']??detectSqlMode(_0xe3a948),_0x89ba14=stripLocalSqlMetadata(_0xe3a948,_0x337c32)['trim'](),_0x393587=[...buildMetadataHeaderLines({'sqlCode':_0x17e1cc[_0x357da4(0x109)],'sqlName':_0x17e1cc[_0x357da4(0x118)],'dbId':_0x17e1cc[_0x357da4(0x11e)],'dbName':_0x5284bf?.[_0x357da4(0x11d)],'mode':_0x337c32,'syncedAt':_0x5284bf?.[_0x357da4(0x120)],'description':_0x5284bf?.['description']},_0x337c32),'',_0x89ba14],_0x3f9aab=_0x393587[_0x357da4(0x10f)]('\x0a');return _0x3f9aab['endsWith']('\x0a')?_0x3f9aab:_0x3f9aab+'\x0a';}export function stripLocalSqlMetadata(_0x449ea6,_0x5a5a28){const _0x4dd481=a140_0x8fc09e,_0x57bdc0=_0x449ea6[_0x4dd481(0x108)](/\r\n/g,'\x0a')[_0x4dd481(0x113)]('\x0a'),_0x21244e=[];let _0x5c4463=0x0;if(_0x5a5a28===_0x4dd481(0x119))while(_0x5c4463<_0x57bdc0['length']){const _0x4e0c79=_0x57bdc0[_0x5c4463]??'';if(/^\s*<!--\s*@lovrabet\./[_0x4dd481(0xff)](_0x4e0c79)){_0x5c4463++;continue;}if(_0x4e0c79[_0x4dd481(0xf2)]()===''&&_0x5c4463>0x0){_0x5c4463++;continue;}break;}else while(_0x5c4463<_0x57bdc0[_0x4dd481(0x11b)]){const _0x2a2637=_0x57bdc0[_0x5c4463]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x2a2637)){_0x5c4463++;continue;}if(_0x2a2637[_0x4dd481(0xf2)]()===''&&_0x5c4463>0x0){_0x5c4463++;continue;}break;}for(;_0x5c4463<_0x57bdc0['length'];_0x5c4463++){_0x21244e[_0x4dd481(0x11c)](_0x57bdc0[_0x5c4463]);}return _0x21244e[_0x4dd481(0x10f)]('\x0a')[_0x4dd481(0x105)]();}export function resolveSqlMode(_0x970a3e,_0x3865ce){const _0x3d945e=a140_0x8fc09e;if(_0x3865ce?.[_0x3d945e(0x103)])return _0x3865ce[_0x3d945e(0x103)];return detectSqlMode(_0x970a3e);}export function resolveSqlFileName(_0x1dcc9a,_0x4ed7b4,_0x4515e9){const _0x2e774f=a140_0x8fc09e;if(_0x4515e9?.[_0x2e774f(0xfd)])return _0x4515e9[_0x2e774f(0xfd)];if(_0x4515e9?.[_0x2e774f(0x118)]||_0x4515e9?.['dbName'])return buildSqlRelativePath(_0x1dcc9a,_0x4515e9?.['sqlName'],_0x4515e9?.['dbName'],resolveSqlMode(_0x4ed7b4,_0x4515e9),_0x4515e9?.[_0x2e774f(0x11e)]);return buildDefaultSqlFileName(_0x1dcc9a,resolveSqlMode(_0x4ed7b4,_0x4515e9));}export function resolveSqlLocalDir(_0x3ba0ad,_0x3e7744){return join(_0x3ba0ad,SQL_LOCAL_REL_DIR,_0x3e7744);}export async function confirmForceOverwrite(_0x1689bd){const _0x31fa70=a140_0x8fc09e,_0x51917b=createInterface({'input':process['stdin'],'output':process['stderr']}),_0x589a71=await new Promise(_0x40c3ed=>{const _0xa73e89=a140_0x17d1;_0x51917b[_0xa73e89(0xf9)](_0x1689bd+_0xa73e89(0x110),_0x40c3ed);});return _0x51917b[_0x31fa70(0x106)](),['y',_0x31fa70(0x11f)][_0x31fa70(0x115)](_0x589a71[_0x31fa70(0xf2)]()['toLowerCase']());}export function findSqlLockScope(_0x396b13,_0x9d1b37){const _0x2e4410=a140_0x8fc09e;return _0x396b13[_0x2e4410(0x10c)][_0x9d1b37];}function buildMetadataHeaderLines(_0x53bdf6,_0x201229){const _0x50ed32=a140_0x8fc09e,_0x11fa90=[[_0x50ed32(0x109),_0x53bdf6[_0x50ed32(0x109)]],['sqlName',_0x53bdf6['sqlName']],[_0x50ed32(0x11e),_0x53bdf6[_0x50ed32(0x11e)]],['dbName',_0x53bdf6['dbName']],[_0x50ed32(0x103),_0x53bdf6['mode']],[_0x50ed32(0x120),_0x53bdf6[_0x50ed32(0x120)]],['description',_0x53bdf6[_0x50ed32(0xf6)]]];if(_0x201229===_0x50ed32(0x119))return _0x11fa90[_0x50ed32(0x111)](([,_0x23e7d5])=>_0x23e7d5!==undefined&&_0x23e7d5!==null&&String(_0x23e7d5)[_0x50ed32(0xf2)]()!=='')[_0x50ed32(0x117)](([_0x769aeb,_0x3c2d72])=>_0x50ed32(0x10b)+_0x769aeb+':\x20'+String(_0x3c2d72)+_0x50ed32(0xfc));return _0x11fa90[_0x50ed32(0x111)](([,_0x10e8e8])=>_0x10e8e8!==undefined&&_0x10e8e8!==null&&String(_0x10e8e8)[_0x50ed32(0xf2)]()!=='')[_0x50ed32(0x117)](([_0x5cebf8,_0x5d59c6])=>_0x50ed32(0xfb)+_0x5cebf8+':\x20'+String(_0x5d59c6));}
1
+ const a140_0xbd1f96=a140_0x2117;(function(_0x306b35,_0x188cf4){const _0x52dca2=a140_0x2117,_0x121f65=_0x306b35();while(!![]){try{const _0x3b25b6=parseInt(_0x52dca2(0x19a))/0x1+parseInt(_0x52dca2(0x18b))/0x2+-parseInt(_0x52dca2(0x18e))/0x3+-parseInt(_0x52dca2(0x1aa))/0x4*(parseInt(_0x52dca2(0x194))/0x5)+-parseInt(_0x52dca2(0x19f))/0x6+-parseInt(_0x52dca2(0x199))/0x7*(parseInt(_0x52dca2(0x196))/0x8)+parseInt(_0x52dca2(0x1a6))/0x9*(parseInt(_0x52dca2(0x19e))/0xa);if(_0x3b25b6===_0x188cf4)break;else _0x121f65['push'](_0x121f65['shift']());}catch(_0x1dc697){_0x121f65['push'](_0x121f65['shift']());}}}(a140_0x42a6,0x724c2));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=a140_0xbd1f96(0x19c);export function buildSqlLockEntry(_0x31cb73,_0x1b57a6,_0x408b7c,_0xe96808){const _0x3d7625=a140_0xbd1f96,_0xb428c9=detectSqlMode(_0x1b57a6);return{'path':buildSqlRelativePath(_0x31cb73[_0x3d7625(0x183)],_0x31cb73[_0x3d7625(0x191)],_0xe96808?.[_0x3d7625(0x18d)],_0xb428c9,_0x31cb73[_0x3d7625(0x1a5)]),'hash':_0x408b7c,'remoteId':_0x31cb73['id'],'version':_0x31cb73['version'],'dbId':Number(_0x31cb73['dbId']),'dbName':_0xe96808?.[_0x3d7625(0x18d)],'sqlName':_0x31cb73[_0x3d7625(0x191)],'sqlConfig':_0x31cb73[_0x3d7625(0x184)]??undefined,'mode':_0xb428c9};}function a140_0x42a6(){const _0x5a3f85=['333652DROImf','includes','.rabetbase/sql','sqls','6621180amawEG','3373848fogbVr','mybatisXml','length','sqlContent','stdin','trimStart','dbId','18xWvULV','--\x20@lovrabet.','sqlRoot','apps','13492iOTVtl','question','syncedAt','filter','sqlCode','sqlConfig','path','map','\x20[y/N]\x20','mode','replace','split','157764hbXiJG','join','dbName','1013439oMPlOY','endsWith','yes','sqlName','<!--\x20@lovrabet.','\x20-->','120FTfsdM','stderr','79320iOqEpj','trim','toLowerCase','203rWsOmr'];a140_0x42a6=function(){return _0x5a3f85;};return a140_0x42a6();}export function cloneSqlLockData(_0x26b7cf){const _0x3a3887=a140_0xbd1f96;return{'apps':Object['fromEntries'](Object['entries'](_0x26b7cf[_0x3a3887(0x1a9)])[_0x3a3887(0x186)](([_0x4691b5,_0x23b026])=>[_0x4691b5,{'sqlRoot':_0x23b026[_0x3a3887(0x1a8)],'lastSync':_0x23b026['lastSync'],'sqls':{..._0x23b026[_0x3a3887(0x19d)]}}]))};}export function ensureRemoteSqlContent(_0x2cf258){const _0x320db2=a140_0xbd1f96;return _0x2cf258[_0x320db2(0x1a2)]??'';}export function buildLocalSqlFileContent(_0x8d1471,_0x40008a,_0x207071){const _0x3d0404=a140_0xbd1f96,_0x32d73d=_0x207071?.['mode']??detectSqlMode(_0x40008a),_0x4bd12c=stripLocalSqlMetadata(_0x40008a,_0x32d73d)[_0x3d0404(0x197)](),_0x94c019=[...buildMetadataHeaderLines({'sqlCode':_0x8d1471[_0x3d0404(0x183)],'sqlName':_0x8d1471[_0x3d0404(0x191)],'dbId':_0x8d1471[_0x3d0404(0x1a5)],'dbName':_0x207071?.[_0x3d0404(0x18d)],'mode':_0x32d73d,'syncedAt':_0x207071?.[_0x3d0404(0x181)],'description':_0x207071?.['description']},_0x32d73d),'',_0x4bd12c],_0x3022ee=_0x94c019[_0x3d0404(0x18c)]('\x0a');return _0x3022ee[_0x3d0404(0x18f)]('\x0a')?_0x3022ee:_0x3022ee+'\x0a';}export function stripLocalSqlMetadata(_0x584ced,_0x3a42ba){const _0x194578=a140_0xbd1f96,_0x6db6f3=_0x584ced[_0x194578(0x189)](/\r\n/g,'\x0a')[_0x194578(0x18a)]('\x0a'),_0x3831d7=[];let _0x3381d9=0x0;if(_0x3a42ba==='mybatisXml')while(_0x3381d9<_0x6db6f3[_0x194578(0x1a1)]){const _0x2d2751=_0x6db6f3[_0x3381d9]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x2d2751)){_0x3381d9++;continue;}if(_0x2d2751[_0x194578(0x197)]()===''&&_0x3381d9>0x0){_0x3381d9++;continue;}break;}else while(_0x3381d9<_0x6db6f3[_0x194578(0x1a1)]){const _0x124cf0=_0x6db6f3[_0x3381d9]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x124cf0)){_0x3381d9++;continue;}if(_0x124cf0['trim']()===''&&_0x3381d9>0x0){_0x3381d9++;continue;}break;}for(;_0x3381d9<_0x6db6f3['length'];_0x3381d9++){_0x3831d7['push'](_0x6db6f3[_0x3381d9]);}return _0x3831d7[_0x194578(0x18c)]('\x0a')[_0x194578(0x1a4)]();}export function resolveSqlMode(_0xa06b5a,_0x2b0d54){const _0xe94298=a140_0xbd1f96;if(_0x2b0d54?.[_0xe94298(0x188)])return _0x2b0d54['mode'];return detectSqlMode(_0xa06b5a);}export function resolveSqlFileName(_0x46269b,_0x300c1e,_0x592096){const _0x5be257=a140_0xbd1f96;if(_0x592096?.[_0x5be257(0x185)])return _0x592096[_0x5be257(0x185)];if(_0x592096?.['sqlName']||_0x592096?.[_0x5be257(0x18d)])return buildSqlRelativePath(_0x46269b,_0x592096?.['sqlName'],_0x592096?.[_0x5be257(0x18d)],resolveSqlMode(_0x300c1e,_0x592096),_0x592096?.['dbId']);return buildDefaultSqlFileName(_0x46269b,resolveSqlMode(_0x300c1e,_0x592096));}export function resolveSqlLocalDir(_0xd431db,_0x20a3b6){return join(_0xd431db,SQL_LOCAL_REL_DIR,_0x20a3b6);}export async function confirmForceOverwrite(_0x134bf9){const _0x442561=a140_0xbd1f96,_0x531ebc=createInterface({'input':process[_0x442561(0x1a3)],'output':process[_0x442561(0x195)]}),_0x20e108=await new Promise(_0x298a5c=>{const _0x407a85=_0x442561;_0x531ebc[_0x407a85(0x1ab)](_0x134bf9+_0x407a85(0x187),_0x298a5c);});return _0x531ebc['close'](),['y',_0x442561(0x190)][_0x442561(0x19b)](_0x20e108[_0x442561(0x197)]()[_0x442561(0x198)]());}function a140_0x2117(_0x4d1af0,_0x26b290){_0x4d1af0=_0x4d1af0-0x181;const _0x42a67a=a140_0x42a6();let _0x211704=_0x42a67a[_0x4d1af0];return _0x211704;}export function findSqlLockScope(_0x1dbd51,_0x26077a){const _0x3ba434=a140_0xbd1f96;return _0x1dbd51[_0x3ba434(0x1a9)][_0x26077a];}function buildMetadataHeaderLines(_0x21f687,_0x432260){const _0x12cc6a=a140_0xbd1f96,_0x341e97=[[_0x12cc6a(0x183),_0x21f687[_0x12cc6a(0x183)]],[_0x12cc6a(0x191),_0x21f687[_0x12cc6a(0x191)]],['dbId',_0x21f687[_0x12cc6a(0x1a5)]],[_0x12cc6a(0x18d),_0x21f687[_0x12cc6a(0x18d)]],['mode',_0x21f687[_0x12cc6a(0x188)]],[_0x12cc6a(0x181),_0x21f687[_0x12cc6a(0x181)]],['description',_0x21f687['description']]];if(_0x432260===_0x12cc6a(0x1a0))return _0x341e97['filter'](([,_0x406e3d])=>_0x406e3d!==undefined&&_0x406e3d!==null&&String(_0x406e3d)[_0x12cc6a(0x197)]()!=='')[_0x12cc6a(0x186)](([_0x14c5b2,_0xfe8dea])=>_0x12cc6a(0x192)+_0x14c5b2+':\x20'+String(_0xfe8dea)+_0x12cc6a(0x193));return _0x341e97[_0x12cc6a(0x182)](([,_0x1cc641])=>_0x1cc641!==undefined&&_0x1cc641!==null&&String(_0x1cc641)[_0x12cc6a(0x197)]()!=='')[_0x12cc6a(0x186)](([_0xb5a444,_0xc22c56])=>_0x12cc6a(0x1a7)+_0xb5a444+':\x20'+String(_0xc22c56));}