@lovrabet/rabetbase-cli 2.2.4-beta.2 → 2.2.4-beta.4

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 (207) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/fetch-model-list.js +1 -1
  3. package/lib/api/generate-api-file.js +1 -1
  4. package/lib/auth/auth-server-ui.js +1 -1
  5. package/lib/auth/auth-server.js +1 -1
  6. package/lib/auth/constant.js +1 -1
  7. package/lib/auth/get-cookie.js +1 -1
  8. package/lib/auth/get-session-user.js +1 -1
  9. package/lib/auth/is-session-valid.js +1 -1
  10. package/lib/auth/login-success-html.js +1 -1
  11. package/lib/auth/logout.js +1 -1
  12. package/lib/cli-flags.js +1 -1
  13. package/lib/cli.js +1 -1
  14. package/lib/commands/api/generate.js +1 -1
  15. package/lib/commands/api/index.js +1 -1
  16. package/lib/commands/api/list.js +1 -1
  17. package/lib/commands/api/pull.js +1 -1
  18. package/lib/commands/api/shared.js +1 -1
  19. package/lib/commands/app/add.js +1 -1
  20. package/lib/commands/app/discover.js +1 -1
  21. package/lib/commands/app/index.js +1 -1
  22. package/lib/commands/app/list.js +1 -1
  23. package/lib/commands/app/remove.js +1 -1
  24. package/lib/commands/app/shared.js +1 -1
  25. package/lib/commands/app/use.js +1 -1
  26. package/lib/commands/auth/index.js +1 -1
  27. package/lib/commands/bff/create.js +1 -1
  28. package/lib/commands/bff/delete.js +1 -1
  29. package/lib/commands/bff/detail.js +1 -1
  30. package/lib/commands/bff/index.js +1 -1
  31. package/lib/commands/bff/list.js +1 -1
  32. package/lib/commands/bff/pull.js +1 -1
  33. package/lib/commands/bff/push.js +1 -1
  34. package/lib/commands/bff/status.js +1 -1
  35. package/lib/commands/cli-update.js +1 -1
  36. package/lib/commands/codegen/index.js +1 -1
  37. package/lib/commands/codegen/sdk.js +1 -1
  38. package/lib/commands/codegen/sql.js +1 -1
  39. package/lib/commands/common/app-selector.js +1 -1
  40. package/lib/commands/common/flags.js +1 -1
  41. package/lib/commands/common/validate.js +1 -1
  42. package/lib/commands/config/get.js +1 -1
  43. package/lib/commands/config/index.js +1 -1
  44. package/lib/commands/config/list.js +1 -1
  45. package/lib/commands/config/set.js +1 -1
  46. package/lib/commands/config/shared.js +1 -1
  47. package/lib/commands/data/filter.js +1 -1
  48. package/lib/commands/data/getOne.js +1 -1
  49. package/lib/commands/data/index.js +1 -1
  50. package/lib/commands/data/shared.js +1 -1
  51. package/lib/commands/dataset/capability.js +1 -1
  52. package/lib/commands/dataset/delete.js +1 -1
  53. package/lib/commands/dataset/detail.js +1 -1
  54. package/lib/commands/dataset/extend-update.js +1 -1
  55. package/lib/commands/dataset/field-update.js +1 -1
  56. package/lib/commands/dataset/index.js +1 -1
  57. package/lib/commands/dataset/list.js +1 -1
  58. package/lib/commands/dataset/operations.js +1 -1
  59. package/lib/commands/dataset/relation-create.js +1 -1
  60. package/lib/commands/dataset/relation-delete.js +1 -1
  61. package/lib/commands/dataset/relation-shared.js +1 -1
  62. package/lib/commands/dataset/relation-update.js +1 -1
  63. package/lib/commands/dataset/relations.js +1 -1
  64. package/lib/commands/dataset/rename.js +1 -1
  65. package/lib/commands/db/analyze-cancel.js +1 -1
  66. package/lib/commands/db/analyze-start.js +1 -1
  67. package/lib/commands/db/analyze-status.js +1 -1
  68. package/lib/commands/db/create.js +1 -1
  69. package/lib/commands/db/delete.js +1 -1
  70. package/lib/commands/db/detail.js +1 -1
  71. package/lib/commands/db/diff.js +1 -1
  72. package/lib/commands/db/index.js +1 -1
  73. package/lib/commands/db/list.js +1 -1
  74. package/lib/commands/db/shared.js +1 -1
  75. package/lib/commands/db/tables.js +1 -1
  76. package/lib/commands/db/test.js +1 -1
  77. package/lib/commands/db/update.js +1 -1
  78. package/lib/commands/doctor.js +1 -1
  79. package/lib/commands/init/index.js +1 -1
  80. package/lib/commands/issue/index.js +1 -1
  81. package/lib/commands/issue/nudge.js +1 -1
  82. package/lib/commands/issue/report.js +1 -1
  83. package/lib/commands/issue/shared.js +1 -1
  84. package/lib/commands/logs/index.js +1 -1
  85. package/lib/commands/menu/index.js +1 -1
  86. package/lib/commands/menu/list.js +1 -1
  87. package/lib/commands/menu/shared/compare-table.js +1 -1
  88. package/lib/commands/menu/shared/index.js +1 -1
  89. package/lib/commands/menu/shared/inquirer.js +1 -1
  90. package/lib/commands/menu/shared/local-pages.js +1 -1
  91. package/lib/commands/menu/shared/logic.js +1 -1
  92. package/lib/commands/menu/shared/service.js +1 -1
  93. package/lib/commands/menu/shared/sync-core.js +1 -1
  94. package/lib/commands/menu/shared/update-core.js +1 -1
  95. package/lib/commands/menu/shared/valid-url.js +1 -1
  96. package/lib/commands/menu/sync.js +1 -1
  97. package/lib/commands/menu/update.js +1 -1
  98. package/lib/commands/page/generate-start.js +1 -1
  99. package/lib/commands/page/generate-status.js +1 -1
  100. package/lib/commands/page/index.js +1 -1
  101. package/lib/commands/page/pull.js +1 -1
  102. package/lib/commands/page/push.js +1 -1
  103. package/lib/commands/page/relation-audit.js +1 -1
  104. package/lib/commands/page/shared.js +1 -1
  105. package/lib/commands/page/standard-page-status.js +1 -1
  106. package/lib/commands/page/sync.js +1 -1
  107. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  108. package/lib/commands/project/create/format-elapsed.js +1 -1
  109. package/lib/commands/project/create/main.js +1 -1
  110. package/lib/commands/project/create/non-interactive.js +1 -1
  111. package/lib/commands/project/create/project-template-path.js +1 -1
  112. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  113. package/lib/commands/project/create/use-format-code.js +1 -1
  114. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  115. package/lib/commands/project/index.js +1 -1
  116. package/lib/commands/project/init.js +1 -1
  117. package/lib/commands/project/upgrade.js +1 -1
  118. package/lib/commands/registry.js +1 -1
  119. package/lib/commands/run/index.js +1 -1
  120. package/lib/commands/schema.js +1 -1
  121. package/lib/commands/skill/index.js +1 -1
  122. package/lib/commands/sql/create.js +1 -1
  123. package/lib/commands/sql/delete.js +1 -1
  124. package/lib/commands/sql/detail.js +1 -1
  125. package/lib/commands/sql/exec.js +1 -1
  126. package/lib/commands/sql/index.js +1 -1
  127. package/lib/commands/sql/list.js +1 -1
  128. package/lib/commands/sql/pull.js +1 -1
  129. package/lib/commands/sql/push.js +1 -1
  130. package/lib/commands/sql/save.js +1 -1
  131. package/lib/commands/sql/shared.js +1 -1
  132. package/lib/commands/sql/status.js +1 -1
  133. package/lib/commands/sql/validate.js +1 -1
  134. package/lib/config/schema.js +1 -1
  135. package/lib/constant/cdn.js +1 -1
  136. package/lib/constant/cli.js +1 -1
  137. package/lib/constant/defaults.js +1 -1
  138. package/lib/constant/domain.js +1 -1
  139. package/lib/constant/env.js +1 -1
  140. package/lib/constant/output.js +1 -1
  141. package/lib/constant/paths.js +1 -1
  142. package/lib/constant/risk.js +1 -1
  143. package/lib/context.js +1 -1
  144. package/lib/core/alias-resolver.js +1 -1
  145. package/lib/core/api-client.js +1 -1
  146. package/lib/core/bff/config.js +1 -1
  147. package/lib/core/bff/file-system.js +1 -1
  148. package/lib/core/bff/hash.js +1 -1
  149. package/lib/core/bff/lock.js +1 -1
  150. package/lib/core/bff/utils.js +1 -1
  151. package/lib/core/db-resolver.js +1 -1
  152. package/lib/core/page/file-system.js +1 -1
  153. package/lib/core/page/hash.js +1 -1
  154. package/lib/core/page/lock.js +1 -1
  155. package/lib/core/sql-sync/config.js +1 -1
  156. package/lib/core/sql-sync/file-system.js +1 -1
  157. package/lib/core/sql-sync/hash.js +1 -1
  158. package/lib/core/sql-sync/lock.js +1 -1
  159. package/lib/core/sql-sync/utils.js +1 -1
  160. package/lib/core/sql-validator.js +1 -1
  161. package/lib/errors.js +1 -1
  162. package/lib/framework/build-all-flags.js +1 -1
  163. package/lib/framework/flags.js +1 -1
  164. package/lib/framework/help.js +1 -1
  165. package/lib/framework/index.js +1 -1
  166. package/lib/framework/output.js +1 -1
  167. package/lib/framework/response.js +1 -1
  168. package/lib/framework/runner-alias.js +1 -1
  169. package/lib/framework/runner.js +1 -1
  170. package/lib/framework/schema-export.js +1 -1
  171. package/lib/framework/types.js +1 -1
  172. package/lib/generated/build-info.js +1 -1
  173. package/lib/help.js +1 -1
  174. package/lib/skills/main.js +1 -1
  175. package/lib/skills/npx-skills-add.js +1 -1
  176. package/lib/telemetry/cli-command-trace.js +1 -1
  177. package/lib/telemetry/cli-help-trace.js +1 -1
  178. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  179. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  180. package/lib/telemetry/send-cli-trace-log.js +1 -1
  181. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  182. package/lib/utils/ai_config.js +1 -1
  183. package/lib/utils/apply-jq-filter.js +1 -1
  184. package/lib/utils/cdn-config.js +1 -1
  185. package/lib/utils/check-sdk-version.js +1 -1
  186. package/lib/utils/cli-version-check.js +1 -1
  187. package/lib/utils/cli-version-policy.js +1 -1
  188. package/lib/utils/config.js +1 -1
  189. package/lib/utils/copy-directory.js +1 -1
  190. package/lib/utils/entity-with-id.js +1 -1
  191. package/lib/utils/file-utils.js +1 -1
  192. package/lib/utils/guides-cdn.js +1 -1
  193. package/lib/utils/http-client.js +1 -1
  194. package/lib/utils/is-non-interactive.js +1 -1
  195. package/lib/utils/logger.js +1 -1
  196. package/lib/utils/params.js +1 -1
  197. package/lib/utils/platform.js +1 -1
  198. package/lib/utils/rules-cdn.js +1 -1
  199. package/lib/utils/sleep.js +1 -1
  200. package/lib/utils/template-replacer.js +1 -1
  201. package/lib/utils/update-notice.js +1 -1
  202. package/lib/utils/version.js +1 -1
  203. package/lib/utils/with-active-cookie.js +1 -1
  204. package/lib/utils/write-cli-side-channel.js +1 -1
  205. package/package.json +2 -2
  206. package/templates/projects/sub-app-react-demo/src/vite-env.d.ts +1 -1
  207. package/templates/rules/lovrabet_rules.mdc.tpl +3 -1
@@ -1 +1 @@
1
- const a123_0x414378=a123_0x1665;(function(_0x3e365a,_0x32319a){const _0x5b5c94=a123_0x1665,_0xd43214=_0x3e365a();while(!![]){try{const _0x38ee49=parseInt(_0x5b5c94(0x175))/0x1+-parseInt(_0x5b5c94(0x16e))/0x2*(parseInt(_0x5b5c94(0x17d))/0x3)+parseInt(_0x5b5c94(0x158))/0x4*(-parseInt(_0x5b5c94(0x16d))/0x5)+-parseInt(_0x5b5c94(0x17e))/0x6*(-parseInt(_0x5b5c94(0x162))/0x7)+-parseInt(_0x5b5c94(0x16f))/0x8*(-parseInt(_0x5b5c94(0x174))/0x9)+parseInt(_0x5b5c94(0x177))/0xa+parseInt(_0x5b5c94(0x160))/0xb*(parseInt(_0x5b5c94(0x169))/0xc);if(_0x38ee49===_0x32319a)break;else _0xd43214['push'](_0xd43214['shift']());}catch(_0x12c2e4){_0xd43214['push'](_0xd43214['shift']());}}}(a123_0x2e1d,0x61a72));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';function a123_0x2e1d(){const _0x588f1e=['lockFilePath','Would\x20delete\x20SQL\x20','filter','5RsUxtG','17482piHrUq','48512rbMwII','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','appCode','\x20(local\x20file\x20moved\x20to\x20trash)','396ohOXCy','576977LooEqC','Deleted\x20','1178580ekMWDK','SQL\x20lock\x20file\x20not\x20found.','trashDir','POST','high-risk-write','trashedTo','237uABEBh','74988PWuiQO','lastSync','length','validation','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','toISOString','433308ZChILp','entries','/smartapi/custom/deleteUserCustomSql','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','remoteId','projectRoot','sqlRootDir','sqlcode','28127XGDQdQ','sqls','77WBaLMk','sql','delete','str','sqlRoot','fromEntries','startsWith','468AiqLnx'];a123_0x2e1d=function(){return _0x588f1e;};return a123_0x2e1d();}import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a123_0x414378(0x163),'command':a123_0x414378(0x164),'description':a123_0x414378(0x15b),'risk':a123_0x414378(0x17b),'flags':[SQLCODE_FLAG],async 'validate'(_0xb2c34d){const _0x45964c=a123_0x414378,_0x142d6d=loadSqlProjectConfig(_0xb2c34d[_0x45964c(0x172)]),_0x161372=await readSqlLockFile(_0x142d6d[_0x45964c(0x16a)]);if(!_0x161372)throw CliErrors[_0x45964c(0x155)](_0x45964c(0x171));},async 'dryRun'(_0x386be6){const _0xa86dd9=a123_0x414378,_0x351188=loadSqlProjectConfig(_0x386be6[_0xa86dd9(0x172)]),_0x58b35c=await readSqlLockFile(_0x351188[_0xa86dd9(0x16a)]);if(!_0x58b35c)throw CliErrors['validation']('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x1e6a6e}=ensureSqlLockScope(_0x58b35c,_0x386be6[_0xa86dd9(0x172)],_0x351188[_0xa86dd9(0x166)],_0xa86dd9(0x164)),_0x3c5fb3=_0x386be6[_0xa86dd9(0x165)](_0xa86dd9(0x15f)),_0xa4aa88=_0x1e6a6e['sqls'][_0x3c5fb3];if(!_0xa4aa88)throw CliErrors[_0xa86dd9(0x155)]('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x3c5fb3+'\x22.');return{'method':_0xa86dd9(0x17a),'url':_0xa86dd9(0x15a),'body':{'sqlCode':_0x3c5fb3,'id':_0xa4aa88[_0xa86dd9(0x15c)],'localPath':resolveLocalSqlFilePath(_0x351188,_0x3c5fb3,_0xa4aa88)},'description':_0xa86dd9(0x16b)+_0x3c5fb3+_0xa86dd9(0x156)+_0x351188[_0xa86dd9(0x179)]};},async 'execute'(_0x1dbbc7){const _0x5e2405=a123_0x414378,_0x2429c8=loadSqlProjectConfig(_0x1dbbc7[_0x5e2405(0x172)]),_0x5e2418=await readSqlLockFile(_0x2429c8[_0x5e2405(0x16a)]);if(!_0x5e2418)throw CliErrors[_0x5e2405(0x155)](_0x5e2405(0x178));const {lockData:_0x186b95,appLock:_0x1c24d7}=ensureSqlLockScope(_0x5e2418,_0x1dbbc7['appCode'],_0x2429c8[_0x5e2405(0x166)],_0x5e2405(0x164)),_0x4e6da5=_0x1dbbc7['str']('sqlcode'),_0x567158=_0x1c24d7[_0x5e2405(0x161)][_0x4e6da5];if(!_0x567158)throw CliErrors[_0x5e2405(0x155)](_0x5e2405(0x170)+_0x4e6da5+'\x22.');await deleteSqlQuery({'id':_0x567158[_0x5e2405(0x15c)],'sqlCode':_0x4e6da5}),_0x1c24d7[_0x5e2405(0x161)]=Object[_0x5e2405(0x167)](Object[_0x5e2405(0x159)](_0x1c24d7[_0x5e2405(0x161)])[_0x5e2405(0x16c)](([_0x3b1f54])=>_0x3b1f54!==_0x4e6da5)),_0x1c24d7[_0x5e2405(0x17f)]=new Date()[_0x5e2405(0x157)](),await writeSqlLockFile(_0x2429c8[_0x5e2405(0x16a)],_0x186b95);const _0x803682=resolveLocalSqlFilePath(_0x2429c8,_0x4e6da5,_0x567158);let _0x1f4da5;await fileExists(_0x803682)&&(_0x1f4da5=await moveToTrash(_0x2429c8[_0x5e2405(0x15d)],_0x2429c8[_0x5e2405(0x179)],_0x803682),await cleanupEmptyDirectories(dirname(_0x803682),_0x2429c8[_0x5e2405(0x15e)]));const _0x47ebac={'deleted':_0x4e6da5,'remoteId':_0x567158[_0x5e2405(0x15c)]};if(_0x1f4da5)_0x47ebac[_0x5e2405(0x17c)]=_0x1f4da5;return{'ok':!![],'data':_0x47ebac,'message':_0x5e2405(0x176)+_0x4e6da5+(_0x1f4da5?_0x5e2405(0x173):'')};}};async function moveToTrash(_0xa80044,_0x10beb5,_0x52a62e){const _0x2bc125=a123_0x414378,_0x122383=new Date()[_0x2bc125(0x157)]()['replace'](/[:.]/g,'-'),_0x2a4eab=relative(_0xa80044,_0x52a62e),_0x287241=join(_0x10beb5,_0x122383,_0x2a4eab);return await mkdir(dirname(_0x287241),{'recursive':!![]}),await rename(_0x52a62e,_0x287241),_0x287241;}function a123_0x1665(_0x4278ea,_0xf15464){_0x4278ea=_0x4278ea-0x154;const _0x2e1d6d=a123_0x2e1d();let _0x16656d=_0x2e1d6d[_0x4278ea];return _0x16656d;}async function cleanupEmptyDirectories(_0x12ca1b,_0x3865e7){const _0x217955=a123_0x414378;let _0x27b254=resolve(_0x12ca1b);const _0x38206b=resolve(_0x3865e7);while(_0x27b254[_0x217955(0x168)](''+_0x38206b+sep)||_0x27b254===_0x38206b){if(_0x27b254===_0x38206b)return;try{const _0x4e2654=await readdir(_0x27b254);if(_0x4e2654[_0x217955(0x154)]>0x0)return;await rmdir(_0x27b254);}catch{return;}_0x27b254=dirname(_0x27b254);}}
1
+ const a123_0x30cfc4=a123_0x4d2a;(function(_0x8aac6f,_0x327dab){const _0x5a4bc8=a123_0x4d2a,_0xf7dca0=_0x8aac6f();while(!![]){try{const _0x4c9ef7=parseInt(_0x5a4bc8(0x1f2))/0x1*(parseInt(_0x5a4bc8(0x1f4))/0x2)+parseInt(_0x5a4bc8(0x1dc))/0x3*(parseInt(_0x5a4bc8(0x1ee))/0x4)+-parseInt(_0x5a4bc8(0x1d8))/0x5*(parseInt(_0x5a4bc8(0x1f9))/0x6)+parseInt(_0x5a4bc8(0x1de))/0x7*(parseInt(_0x5a4bc8(0x1ec))/0x8)+parseInt(_0x5a4bc8(0x1f3))/0x9*(-parseInt(_0x5a4bc8(0x1e6))/0xa)+parseInt(_0x5a4bc8(0x1da))/0xb+parseInt(_0x5a4bc8(0x1e3))/0xc*(-parseInt(_0x5a4bc8(0x1ef))/0xd);if(_0x4c9ef7===_0x327dab)break;else _0xf7dca0['push'](_0xf7dca0['shift']());}catch(_0x520f7a){_0xf7dca0['push'](_0xf7dca0['shift']());}}}(a123_0x58e2,0x53543));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a123_0x4d2a(_0x2bac49,_0x322260){_0x2bac49=_0x2bac49-0x1d2;const _0x58e2a7=a123_0x58e2();let _0x4d2ad7=_0x58e2a7[_0x2bac49];return _0x4d2ad7;}import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':'sql','command':'delete','description':a123_0x30cfc4(0x1ea),'risk':a123_0x30cfc4(0x1d7),'flags':[SQLCODE_FLAG],async 'validate'(_0x11ebd5){const _0x2f80fb=a123_0x30cfc4,_0x3ec7b0=loadSqlProjectConfig(_0x11ebd5[_0x2f80fb(0x1e8)]),_0x5bdf3e=await readSqlLockFile(_0x3ec7b0[_0x2f80fb(0x1db)]);if(!_0x5bdf3e)throw CliErrors['validation'](_0x2f80fb(0x1d3));},async 'dryRun'(_0x373da7){const _0x52cf2e=a123_0x30cfc4,_0x3ceee3=loadSqlProjectConfig(_0x373da7[_0x52cf2e(0x1e8)]),_0x4604fa=await readSqlLockFile(_0x3ceee3[_0x52cf2e(0x1db)]);if(!_0x4604fa)throw CliErrors[_0x52cf2e(0x1d6)](_0x52cf2e(0x1d3));const {appLock:_0x3d985a}=ensureSqlLockScope(_0x4604fa,_0x373da7[_0x52cf2e(0x1e8)],_0x3ceee3[_0x52cf2e(0x1dd)],_0x52cf2e(0x1f0)),_0x58d962=_0x373da7[_0x52cf2e(0x1eb)](_0x52cf2e(0x1f6)),_0x3f3825=_0x3d985a[_0x52cf2e(0x1d4)][_0x58d962];if(!_0x3f3825)throw CliErrors[_0x52cf2e(0x1d6)](_0x52cf2e(0x1e7)+_0x58d962+'\x22.');return{'method':'POST','url':_0x52cf2e(0x1fa),'body':{'sqlCode':_0x58d962,'id':_0x3f3825[_0x52cf2e(0x1ed)],'localPath':resolveLocalSqlFilePath(_0x3ceee3,_0x58d962,_0x3f3825)},'description':_0x52cf2e(0x1f5)+_0x58d962+_0x52cf2e(0x1df)+_0x3ceee3[_0x52cf2e(0x1d9)]};},async 'execute'(_0x4909f7){const _0x13408e=a123_0x30cfc4,_0x416555=loadSqlProjectConfig(_0x4909f7[_0x13408e(0x1e8)]),_0x10bc3d=await readSqlLockFile(_0x416555[_0x13408e(0x1db)]);if(!_0x10bc3d)throw CliErrors[_0x13408e(0x1d6)](_0x13408e(0x1d2));const {lockData:_0x392e07,appLock:_0xc60b1e}=ensureSqlLockScope(_0x10bc3d,_0x4909f7['appCode'],_0x416555['sqlRoot'],_0x13408e(0x1f0)),_0x14d02e=_0x4909f7[_0x13408e(0x1eb)]('sqlcode'),_0x5d3028=_0xc60b1e[_0x13408e(0x1d4)][_0x14d02e];if(!_0x5d3028)throw CliErrors[_0x13408e(0x1d6)](_0x13408e(0x1e7)+_0x14d02e+'\x22.');await deleteSqlQuery({'id':_0x5d3028[_0x13408e(0x1ed)],'sqlCode':_0x14d02e}),_0xc60b1e[_0x13408e(0x1d4)]=Object[_0x13408e(0x1e4)](Object[_0x13408e(0x1f7)](_0xc60b1e[_0x13408e(0x1d4)])[_0x13408e(0x1e0)](([_0x4afffc])=>_0x4afffc!==_0x14d02e)),_0xc60b1e[_0x13408e(0x1e9)]=new Date()[_0x13408e(0x1e5)](),await writeSqlLockFile(_0x416555[_0x13408e(0x1db)],_0x392e07);const _0x200483=resolveLocalSqlFilePath(_0x416555,_0x14d02e,_0x5d3028);let _0x45b355;await fileExists(_0x200483)&&(_0x45b355=await moveToTrash(_0x416555['projectRoot'],_0x416555[_0x13408e(0x1d9)],_0x200483),await cleanupEmptyDirectories(dirname(_0x200483),_0x416555[_0x13408e(0x1e2)]));const _0x1e58c6={'deleted':_0x14d02e,'remoteId':_0x5d3028[_0x13408e(0x1ed)]};if(_0x45b355)_0x1e58c6[_0x13408e(0x1e1)]=_0x45b355;return{'ok':!![],'data':_0x1e58c6,'message':_0x13408e(0x1f8)+_0x14d02e+(_0x45b355?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function a123_0x58e2(){const _0x8487f6=['No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','appCode','lastSync','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','str','2604584VxlOoQ','remoteId','10156vAAkat','13cvsSPs','delete','startsWith','107EZlUlH','36iMNJoj','2186CudEgU','Would\x20delete\x20SQL\x20','sqlcode','entries','Deleted\x20','138PRFVew','/smartapi/custom/deleteUserCustomSql','SQL\x20lock\x20file\x20not\x20found.','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','sqls','replace','validation','high-risk-write','137195JrgGHf','trashDir','5832805BrBeVQ','lockFilePath','507fDchjZ','sqlRoot','14grGWko','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','filter','trashedTo','sqlRootDir','5340516wCseqf','fromEntries','toISOString','774970LzwQLA'];a123_0x58e2=function(){return _0x8487f6;};return a123_0x58e2();}async function moveToTrash(_0xf93f1d,_0x4723a2,_0x2b35c0){const _0x523506=a123_0x30cfc4,_0x25cf81=new Date()['toISOString']()[_0x523506(0x1d5)](/[:.]/g,'-'),_0x48a34a=relative(_0xf93f1d,_0x2b35c0),_0x663401=join(_0x4723a2,_0x25cf81,_0x48a34a);return await mkdir(dirname(_0x663401),{'recursive':!![]}),await rename(_0x2b35c0,_0x663401),_0x663401;}async function cleanupEmptyDirectories(_0x42d9e5,_0x4d76f1){const _0x2308e1=a123_0x30cfc4;let _0x25f2a2=resolve(_0x42d9e5);const _0x387325=resolve(_0x4d76f1);while(_0x25f2a2[_0x2308e1(0x1f1)](''+_0x387325+sep)||_0x25f2a2===_0x387325){if(_0x25f2a2===_0x387325)return;try{const _0x1bce33=await readdir(_0x25f2a2);if(_0x1bce33['length']>0x0)return;await rmdir(_0x25f2a2);}catch{return;}_0x25f2a2=dirname(_0x25f2a2);}}
@@ -1 +1 @@
1
- const a124_0x73a7db=a124_0x1d2a;(function(_0x5e250b,_0x15dbf9){const _0x2a3af7=a124_0x1d2a,_0x5a4edb=_0x5e250b();while(!![]){try{const _0x12631b=parseInt(_0x2a3af7(0xd8))/0x1+parseInt(_0x2a3af7(0xcf))/0x2*(parseInt(_0x2a3af7(0xd9))/0x3)+parseInt(_0x2a3af7(0xd2))/0x4+-parseInt(_0x2a3af7(0xcd))/0x5*(-parseInt(_0x2a3af7(0xc5))/0x6)+-parseInt(_0x2a3af7(0xda))/0x7*(-parseInt(_0x2a3af7(0xc8))/0x8)+parseInt(_0x2a3af7(0xc9))/0x9+-parseInt(_0x2a3af7(0xd4))/0xa*(parseInt(_0x2a3af7(0xcc))/0xb);if(_0x12631b===_0x15dbf9)break;else _0x5a4edb['push'](_0x5a4edb['shift']());}catch(_0x32da47){_0x5a4edb['push'](_0x5a4edb['shift']());}}}(a124_0xa763,0x91ecd));import{getSqlQueryInfo}from'../../core/api-client.js';function a124_0x1d2a(_0x45bf7e,_0x3878ea){_0x45bf7e=_0x45bf7e-0xc5;const _0xa7630b=a124_0xa763();let _0x1d2a98=_0xa7630b[_0x45bf7e];return _0x1d2a98;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a124_0x73a7db(0xcb),'command':a124_0x73a7db(0xd5),'description':a124_0x73a7db(0xd3),'risk':'read','flags':[SQLCODE_FLAG,{'name':a124_0x73a7db(0xc7),'type':'boolean','description':a124_0x73a7db(0xdd)}],async 'execute'(_0x168427){const _0x5b235f=a124_0x73a7db,_0x3ff640=await getSqlQueryInfo(_0x168427[_0x5b235f(0xd7)],_0x168427[_0x5b235f(0xce)](_0x5b235f(0xd6))),_0xe12b8a=_0x168427[_0x5b235f(0xdb)](_0x5b235f(0xc7));if(_0xe12b8a)return{'ok':!![],'data':_0x3ff640};const _0x47f1da=_0x3ff640[_0x5b235f(0xca)]?await getDbName(_0x168427['appCode'],_0x3ff640[_0x5b235f(0xca)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x3ff640[_0x5b235f(0xd0)],'sqlName':_0x3ff640[_0x5b235f(0xc6)],'db':_0x47f1da?_0x47f1da+'\x20('+_0x3ff640[_0x5b235f(0xca)]+')':_0x3ff640[_0x5b235f(0xca)]??'','description':_0x3ff640[_0x5b235f(0xd1)]??'','sqlContent':_0x3ff640[_0x5b235f(0xdc)]??''}};}};function a124_0xa763(){const _0x451c42=['3862872iKeQmV','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','1040pVShLc','detail','sqlcode','appCode','86421wJYLtg','377499ttkuwa','126WqNcHq','bool','sqlContent','Return\x20full\x20raw\x20SQL\x20query\x20object','3174YdnmWE','sqlName','verbose','137872LmAppO','817713XsvZAv','dbId','sql','213334trOYLy','7410cVMmoQ','str','6GxhNYS','sqlCode','description'];a124_0xa763=function(){return _0x451c42;};return a124_0xa763();}
1
+ const a124_0x4dc0fc=a124_0xf435;function a124_0x499e(){const _0x354a67=['read','87zlvIHr','appCode','sqlcode','3481175LHHfvy','7825188UwKjmH','35132jYgJPT','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','637188XOItoZ','sqlCode','verbose','str','dbId','boolean','422716JtRJDj','45CeDwYX','32CVfHMl','sqlName','sqlContent','197332AXiLiZ','bool','1118570WFShtN','Return\x20full\x20raw\x20SQL\x20query\x20object'];a124_0x499e=function(){return _0x354a67;};return a124_0x499e();}(function(_0x4ebf47,_0x410759){const _0x4db086=a124_0xf435,_0x5d522e=_0x4ebf47();while(!![]){try{const _0x3a0a1c=-parseInt(_0x4db086(0x1e3))/0x1+parseInt(_0x4db086(0x1ef))/0x2+-parseInt(_0x4db086(0x1e8))/0x3*(-parseInt(_0x4db086(0x1ed))/0x4)+-parseInt(_0x4db086(0x1eb))/0x5+parseInt(_0x4db086(0x1ec))/0x6+-parseInt(_0x4db086(0x1f5))/0x7*(-parseInt(_0x4db086(0x1f7))/0x8)+-parseInt(_0x4db086(0x1f6))/0x9*(parseInt(_0x4db086(0x1e5))/0xa);if(_0x3a0a1c===_0x410759)break;else _0x5d522e['push'](_0x5d522e['shift']());}catch(_0x25c810){_0x5d522e['push'](_0x5d522e['shift']());}}}(a124_0x499e,0xa2a57));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a124_0xf435(_0x4b4ef8,_0x1d3c88){_0x4b4ef8=_0x4b4ef8-0x1e1;const _0x499e89=a124_0x499e();let _0xf43581=_0x499e89[_0x4b4ef8];return _0xf43581;}export const sqlDetail={'service':'sql','command':'detail','description':a124_0x4dc0fc(0x1ee),'risk':a124_0x4dc0fc(0x1e7),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a124_0x4dc0fc(0x1f4),'description':a124_0x4dc0fc(0x1e6)}],async 'execute'(_0x316a77){const _0x5b4bac=a124_0x4dc0fc,_0x2c02fa=await getSqlQueryInfo(_0x316a77[_0x5b4bac(0x1e9)],_0x316a77[_0x5b4bac(0x1f2)](_0x5b4bac(0x1ea))),_0x2b318e=_0x316a77[_0x5b4bac(0x1e4)](_0x5b4bac(0x1f1));if(_0x2b318e)return{'ok':!![],'data':_0x2c02fa};const _0x5bcf62=_0x2c02fa[_0x5b4bac(0x1f3)]?await getDbName(_0x316a77['appCode'],_0x2c02fa[_0x5b4bac(0x1f3)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x2c02fa[_0x5b4bac(0x1f0)],'sqlName':_0x2c02fa[_0x5b4bac(0x1e1)],'db':_0x5bcf62?_0x5bcf62+'\x20('+_0x2c02fa[_0x5b4bac(0x1f3)]+')':_0x2c02fa['dbId']??'','description':_0x2c02fa['description']??'','sqlContent':_0x2c02fa[_0x5b4bac(0x1e2)]??''}};}};
@@ -1 +1 @@
1
- const a125_0x417cc5=a125_0x4e0e;function a125_0x4e0e(_0x386301,_0x4547e){_0x386301=_0x386301-0x1d2;const _0x4e52db=a125_0x4e52();let _0x4e0e1d=_0x4e52db[_0x386301];return _0x4e0e1d;}(function(_0x5cc41d,_0x9fad97){const _0x4b4ff4=a125_0x4e0e,_0xacf4af=_0x5cc41d();while(!![]){try{const _0x3c5762=parseInt(_0x4b4ff4(0x1dc))/0x1*(parseInt(_0x4b4ff4(0x1dd))/0x2)+parseInt(_0x4b4ff4(0x1e6))/0x3+parseInt(_0x4b4ff4(0x1db))/0x4+parseInt(_0x4b4ff4(0x1d7))/0x5*(-parseInt(_0x4b4ff4(0x1e7))/0x6)+-parseInt(_0x4b4ff4(0x1e8))/0x7+parseInt(_0x4b4ff4(0x1d4))/0x8+parseInt(_0x4b4ff4(0x1de))/0x9;if(_0x3c5762===_0x9fad97)break;else _0xacf4af['push'](_0xacf4af['shift']());}catch(_0x3a05a0){_0xacf4af['push'](_0xacf4af['shift']());}}}(a125_0x4e52,0x6eb3d));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a125_0x4e52(){const _0xeb24b5=['length','Returned\x20','2380856yTJEdU','sqlcode','string','550gzVDur','appCode','sql','execResult','1408600UTzTkk','17457bFWTdd','22XpOZyQ','2628450lmLEeO','str','read','params','SQL\x20execution\x20failed','execSuccess','exec','now','724563JxLWnS','10362XumQdK','5123636vFuUmC'];a125_0x4e52=function(){return _0xeb24b5;};return a125_0x4e52();}export const sqlExec={'service':a125_0x417cc5(0x1d9),'command':a125_0x417cc5(0x1e4),'description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a125_0x417cc5(0x1e0),'flags':[SQLCODE_FLAG,{'name':a125_0x417cc5(0x1e1),'type':a125_0x417cc5(0x1d6),'description':'SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'}],async 'execute'(_0x48ab00){const _0x1c229a=a125_0x417cc5,_0x867b38=parseJsonParams(_0x48ab00['str'](_0x1c229a(0x1e1))),_0x5d5a5b=Date[_0x1c229a(0x1e5)](),_0x52b018=await executeSql(_0x48ab00[_0x1c229a(0x1d8)],_0x48ab00[_0x1c229a(0x1df)](_0x1c229a(0x1d5)),_0x867b38),_0x5366f7=Date[_0x1c229a(0x1e5)]()-_0x5d5a5b,_0x302bae=_0x52b018?.[_0x1c229a(0x1da)]??_0x52b018,_0x48c716=_0x52b018?.[_0x1c229a(0x1e3)]??!![];if(!_0x48c716)return{'ok':![],'data':{'error':_0x52b018?.['execError']||_0x1c229a(0x1e2),'elapsed':_0x5366f7},'message':_0x1c229a(0x1e2)};const _0x4c349a=Array['isArray'](_0x302bae)?_0x302bae:[];return{'ok':!![],'data':{'rows':_0x4c349a,'rowCount':_0x4c349a[_0x1c229a(0x1d2)],'elapsed':_0x5366f7},'message':_0x1c229a(0x1d3)+_0x4c349a['length']+'\x20row(s)\x20in\x20'+_0x5366f7+'ms'};}};
1
+ const a125_0xbb75ec=a125_0x2dc0;(function(_0x225fbe,_0x3fb117){const _0x515534=a125_0x2dc0,_0x14941f=_0x225fbe();while(!![]){try{const _0x5bd769=-parseInt(_0x515534(0x1d1))/0x1*(-parseInt(_0x515534(0x1d7))/0x2)+parseInt(_0x515534(0x1d5))/0x3+-parseInt(_0x515534(0x1dd))/0x4*(-parseInt(_0x515534(0x1df))/0x5)+-parseInt(_0x515534(0x1ce))/0x6*(parseInt(_0x515534(0x1db))/0x7)+parseInt(_0x515534(0x1e0))/0x8+-parseInt(_0x515534(0x1d4))/0x9*(parseInt(_0x515534(0x1e3))/0xa)+-parseInt(_0x515534(0x1e4))/0xb*(parseInt(_0x515534(0x1de))/0xc);if(_0x5bd769===_0x3fb117)break;else _0x14941f['push'](_0x14941f['shift']());}catch(_0x38ee4e){_0x14941f['push'](_0x14941f['shift']());}}}(a125_0x443a,0xc1bf6));import{executeSql}from'../../core/api-client.js';function a125_0x443a(){const _0x2230da=['params','isArray','7443aVORUC','2059974iyVxHj','str','708602oaUCVC','now','length','SQL\x20execution\x20failed','10353XeiJng','sql','4deBBlU','24xtDdpI','4407665GHCfTy','7396616LNHynU','execResult','sqlcode','930EEzEhf','11981926kRIJfd','\x20row(s)\x20in\x20','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','appCode','read','exec','618SobXUR','execError','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','2tcQjwl'];a125_0x443a=function(){return _0x2230da;};return a125_0x443a();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a125_0x2dc0(_0x1783df,_0x3e0aa3){_0x1783df=_0x1783df-0x1ca;const _0x443a56=a125_0x443a();let _0x2dc0c1=_0x443a56[_0x1783df];return _0x2dc0c1;}export const sqlExec={'service':a125_0xbb75ec(0x1dc),'command':a125_0xbb75ec(0x1cd),'description':a125_0xbb75ec(0x1d0),'risk':a125_0xbb75ec(0x1cc),'flags':[SQLCODE_FLAG,{'name':a125_0xbb75ec(0x1d2),'type':'string','description':a125_0xbb75ec(0x1ca)}],async 'execute'(_0x5234cd){const _0x400c6c=a125_0xbb75ec,_0xf70d6d=parseJsonParams(_0x5234cd[_0x400c6c(0x1d6)](_0x400c6c(0x1d2))),_0x52794d=Date[_0x400c6c(0x1d8)](),_0x1b9edf=await executeSql(_0x5234cd[_0x400c6c(0x1cb)],_0x5234cd[_0x400c6c(0x1d6)](_0x400c6c(0x1e2)),_0xf70d6d),_0x5344ba=Date[_0x400c6c(0x1d8)]()-_0x52794d,_0x2279d3=_0x1b9edf?.[_0x400c6c(0x1e1)]??_0x1b9edf,_0x1ad09e=_0x1b9edf?.['execSuccess']??!![];if(!_0x1ad09e)return{'ok':![],'data':{'error':_0x1b9edf?.[_0x400c6c(0x1cf)]||_0x400c6c(0x1da),'elapsed':_0x5344ba},'message':_0x400c6c(0x1da)};const _0x2f9ce6=Array[_0x400c6c(0x1d3)](_0x2279d3)?_0x2279d3:[];return{'ok':!![],'data':{'rows':_0x2f9ce6,'rowCount':_0x2f9ce6[_0x400c6c(0x1d9)],'elapsed':_0x5344ba},'message':'Returned\x20'+_0x2f9ce6['length']+_0x400c6c(0x1e5)+_0x5344ba+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x177bb2,_0x6b0328){const _0x3e40ef=a126_0x566c,_0x3ca309=_0x177bb2();while(!![]){try{const _0x36b44a=-parseInt(_0x3e40ef(0xd0))/0x1*(parseInt(_0x3e40ef(0xcf))/0x2)+-parseInt(_0x3e40ef(0xd2))/0x3*(parseInt(_0x3e40ef(0xd4))/0x4)+parseInt(_0x3e40ef(0xd1))/0x5*(parseInt(_0x3e40ef(0xd7))/0x6)+parseInt(_0x3e40ef(0xd6))/0x7*(parseInt(_0x3e40ef(0xd3))/0x8)+parseInt(_0x3e40ef(0xd5))/0x9+parseInt(_0x3e40ef(0xce))/0xa+-parseInt(_0x3e40ef(0xcd))/0xb*(parseInt(_0x3e40ef(0xd8))/0xc);if(_0x36b44a===_0x6b0328)break;else _0x3ca309['push'](_0x3ca309['shift']());}catch(_0x327796){_0x3ca309['push'](_0x3ca309['shift']());}}}(a126_0x2ebc,0x97f68));function a126_0x2ebc(){const _0x12d9af=['745296AiiquP','1672eEirgY','5360463OjEeOV','7fxghMK','5537076INbJvH','4708164gkiWEu','44gaBRDc','10364350zBeeEu','736rqlPlI','523PTNYaR','5usRJWE','1893mDZrvL'];a126_0x2ebc=function(){return _0x12d9af;};return a126_0x2ebc();}import{sqlList}from'../../commands/sql/list.js';function a126_0x566c(_0x37a8ab,_0x8a5720){_0x37a8ab=_0x37a8ab-0xcd;const _0x2ebc80=a126_0x2ebc();let _0x566c27=_0x2ebc80[_0x37a8ab];return _0x566c27;}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';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
1
+ function a126_0x2993(_0x1a8a06,_0x301530){_0x1a8a06=_0x1a8a06-0xa7;const _0x50d160=a126_0x50d1();let _0x299344=_0x50d160[_0x1a8a06];return _0x299344;}(function(_0x4a9c95,_0x4847d7){const _0x2db427=a126_0x2993,_0x592729=_0x4a9c95();while(!![]){try{const _0x3b8adf=-parseInt(_0x2db427(0xab))/0x1+parseInt(_0x2db427(0xaf))/0x2+-parseInt(_0x2db427(0xaa))/0x3+parseInt(_0x2db427(0xad))/0x4+-parseInt(_0x2db427(0xa9))/0x5*(parseInt(_0x2db427(0xa7))/0x6)+parseInt(_0x2db427(0xa8))/0x7+parseInt(_0x2db427(0xac))/0x8*(parseInt(_0x2db427(0xae))/0x9);if(_0x3b8adf===_0x4847d7)break;else _0x592729['push'](_0x592729['shift']());}catch(_0x285534){_0x592729['push'](_0x592729['shift']());}}}(a126_0x50d1,0x5cf39));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';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';function a126_0x50d1(){const _0x426d2c=['710760xIaECD','6KkkieG','1665335GifSjc','1683775AcOPtu','660756LtDPQC','744594tlnyjK','344ditDHs','690688qNCiud','191799LGpiHg'];a126_0x50d1=function(){return _0x426d2c;};return a126_0x50d1();}import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a127_0x221d5b=a127_0x1016;function a127_0x1016(_0x7f3506,_0x49ae60){_0x7f3506=_0x7f3506-0x1f2;const _0x32dd23=a127_0x32dd();let _0x101673=_0x32dd23[_0x7f3506];return _0x101673;}(function(_0x4b8a7c,_0xdd3ed3){const _0x31657b=a127_0x1016,_0x3e4380=_0x4b8a7c();while(!![]){try{const _0x520e7c=-parseInt(_0x31657b(0x1f6))/0x1*(-parseInt(_0x31657b(0x1f4))/0x2)+-parseInt(_0x31657b(0x202))/0x3*(-parseInt(_0x31657b(0x1fa))/0x4)+-parseInt(_0x31657b(0x206))/0x5*(-parseInt(_0x31657b(0x20b))/0x6)+parseInt(_0x31657b(0x209))/0x7+parseInt(_0x31657b(0x207))/0x8+parseInt(_0x31657b(0x1fd))/0x9+-parseInt(_0x31657b(0x208))/0xa;if(_0x520e7c===_0xdd3ed3)break;else _0x3e4380['push'](_0x3e4380['shift']());}catch(_0x36a0a3){_0x3e4380['push'](_0x3e4380['shift']());}}}(a127_0x32dd,0x2dcda));import{listSqlQueries}from'../../core/api-client.js';function a127_0x32dd(){const _0x4c45a8=['name','number','56226hfIttT','sqlCode','num','list','1379630BdMnrb','200136RmfJEU','6424010hykewr','2034662tuhTkX','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','6tCmhUY','sqlcode','paging','totalCount','length','bool','appCode','4BfPhwD','dbId','70754IEcpfU','No\x20custom\x20SQL\x20queries\x20found.','map','sql','4WJLnDZ','description','page','703368MRzFsW','str','all'];a127_0x32dd=function(){return _0x4c45a8;};return a127_0x32dd();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a127_0x221d5b(0x1f9),'command':a127_0x221d5b(0x205),'description':'List\x20custom\x20SQL\x20queries','risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a127_0x221d5b(0x200),'type':'string','description':'Filter\x20by\x20SQL\x20name'},{'name':a127_0x221d5b(0x1fc),'type':a127_0x221d5b(0x201),'description':'Page\x20number','default':0x1},{'name':'pagesize','type':a127_0x221d5b(0x201),'description':'Page\x20size'},{'name':'verbose','type':'boolean','description':a127_0x221d5b(0x20a)}],async 'execute'(_0x53b7f1){const _0x1a9a84=a127_0x221d5b,_0x23ea9f=await listSqlQueries(_0x53b7f1[_0x1a9a84(0x1f3)],{'sqlCode':_0x53b7f1[_0x1a9a84(0x1fe)](_0x1a9a84(0x20c))||undefined,'sqlName':_0x53b7f1[_0x1a9a84(0x1fe)](_0x1a9a84(0x200))||undefined,'currentPage':_0x53b7f1['num'](_0x1a9a84(0x1fc)),'pageSize':_0x53b7f1[_0x1a9a84(0x204)]('pagesize',0x32)}),_0x145a2f=_0x53b7f1[_0x1a9a84(0x1f2)]('verbose'),_0x1f3547=_0x23ea9f['tableData']??[],_0x3b29dc=_0x23ea9f[_0x1a9a84(0x20d)]?.[_0x1a9a84(0x20e)]??_0x1f3547[_0x1a9a84(0x20f)];let _0x1cf9c7;return _0x145a2f?_0x1cf9c7=_0x1f3547:_0x1cf9c7=await Promise[_0x1a9a84(0x1ff)](_0x1f3547[_0x1a9a84(0x1f8)](async _0x4a565c=>{const _0x59d2f5=_0x1a9a84;let _0x1ff6c9;try{_0x1ff6c9=_0x4a565c[_0x59d2f5(0x1f5)]?await getDbName(_0x53b7f1['appCode'],_0x4a565c[_0x59d2f5(0x1f5)]):undefined;}catch{}return{'sqlCode':_0x4a565c[_0x59d2f5(0x203)],'sqlName':_0x4a565c['sqlName'],'description':_0x4a565c[_0x59d2f5(0x1fb)]??'','db':_0x1ff6c9?_0x1ff6c9+'\x20('+_0x4a565c[_0x59d2f5(0x1f5)]+')':_0x4a565c[_0x59d2f5(0x1f5)]??''};})),{'ok':!![],'data':_0x1cf9c7,'message':_0x1f3547[_0x1a9a84(0x20f)]===0x0?_0x1a9a84(0x1f7):'Found\x20'+_0x1f3547[_0x1a9a84(0x20f)]+'\x20SQL\x20queries\x20(total:\x20'+_0x3b29dc+').'};}};
1
+ function a127_0x2eb4(_0x244322,_0x1e13a0){_0x244322=_0x244322-0x13c;const _0x11a1c6=a127_0x11a1();let _0x2eb4d3=_0x11a1c6[_0x244322];return _0x2eb4d3;}const a127_0x316fdc=a127_0x2eb4;(function(_0x439f95,_0x4c6f82){const _0x321a06=a127_0x2eb4,_0xce37fb=_0x439f95();while(!![]){try{const _0x108023=parseInt(_0x321a06(0x15b))/0x1*(-parseInt(_0x321a06(0x15d))/0x2)+-parseInt(_0x321a06(0x149))/0x3+parseInt(_0x321a06(0x13e))/0x4*(-parseInt(_0x321a06(0x151))/0x5)+parseInt(_0x321a06(0x159))/0x6*(-parseInt(_0x321a06(0x13f))/0x7)+-parseInt(_0x321a06(0x157))/0x8+-parseInt(_0x321a06(0x148))/0x9*(parseInt(_0x321a06(0x143))/0xa)+parseInt(_0x321a06(0x144))/0xb;if(_0x108023===_0x4c6f82)break;else _0xce37fb['push'](_0xce37fb['shift']());}catch(_0x52cc66){_0xce37fb['push'](_0xce37fb['shift']());}}}(a127_0x11a1,0x463c3));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a127_0x11a1(){const _0x38be9d=['26723257AlOGQc','list','string','all','21321BqilcS','1679454xTxwaE','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','str','sqlCode','sqlName','read','appCode','map','345jIpoBh','boolean','pagesize','name','Page\x20size','tableData','3317168CYxxil','verbose','6oxsQyR','description','147983UrKglv','Page\x20number','6YCQahu','length','dbId','num','Filter\x20by\x20SQL\x20name','Found\x20','24436HrHCyh','1598317IpCYwM','number','page','paging','310UnSnWm'];a127_0x11a1=function(){return _0x38be9d;};return a127_0x11a1();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a127_0x316fdc(0x145),'description':'List\x20custom\x20SQL\x20queries','risk':a127_0x316fdc(0x14e),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a127_0x316fdc(0x154),'type':a127_0x316fdc(0x146),'description':a127_0x316fdc(0x13c)},{'name':a127_0x316fdc(0x141),'type':a127_0x316fdc(0x140),'description':a127_0x316fdc(0x15c),'default':0x1},{'name':a127_0x316fdc(0x153),'type':a127_0x316fdc(0x140),'description':a127_0x316fdc(0x155)},{'name':'verbose','type':a127_0x316fdc(0x152),'description':a127_0x316fdc(0x14a)}],async 'execute'(_0x3b00ad){const _0xfc10c=a127_0x316fdc,_0xfab049=await listSqlQueries(_0x3b00ad[_0xfc10c(0x14f)],{'sqlCode':_0x3b00ad[_0xfc10c(0x14b)]('sqlcode')||undefined,'sqlName':_0x3b00ad[_0xfc10c(0x14b)](_0xfc10c(0x154))||undefined,'currentPage':_0x3b00ad[_0xfc10c(0x160)]('page'),'pageSize':_0x3b00ad[_0xfc10c(0x160)](_0xfc10c(0x153),0x32)}),_0x301dc2=_0x3b00ad['bool'](_0xfc10c(0x158)),_0x4749ae=_0xfab049[_0xfc10c(0x156)]??[],_0x4001ee=_0xfab049[_0xfc10c(0x142)]?.['totalCount']??_0x4749ae[_0xfc10c(0x15e)];let _0x27b31e;return _0x301dc2?_0x27b31e=_0x4749ae:_0x27b31e=await Promise[_0xfc10c(0x147)](_0x4749ae[_0xfc10c(0x150)](async _0x2b488a=>{const _0x2626a5=_0xfc10c;let _0x6e619e;try{_0x6e619e=_0x2b488a['dbId']?await getDbName(_0x3b00ad['appCode'],_0x2b488a[_0x2626a5(0x15f)]):undefined;}catch{}return{'sqlCode':_0x2b488a[_0x2626a5(0x14c)],'sqlName':_0x2b488a[_0x2626a5(0x14d)],'description':_0x2b488a[_0x2626a5(0x15a)]??'','db':_0x6e619e?_0x6e619e+'\x20('+_0x2b488a[_0x2626a5(0x15f)]+')':_0x2b488a[_0x2626a5(0x15f)]??''};})),{'ok':!![],'data':_0x27b31e,'message':_0x4749ae[_0xfc10c(0x15e)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0xfc10c(0x13d)+_0x4749ae['length']+'\x20SQL\x20queries\x20(total:\x20'+_0x4001ee+').'};}};
@@ -1 +1 @@
1
- const a128_0x5d1edb=a128_0x2c59;(function(_0xd5bee9,_0x169852){const _0x195fc2=a128_0x2c59,_0x90245a=_0xd5bee9();while(!![]){try{const _0x1e6b1f=-parseInt(_0x195fc2(0x1f3))/0x1*(-parseInt(_0x195fc2(0x204))/0x2)+parseInt(_0x195fc2(0x22b))/0x3+-parseInt(_0x195fc2(0x211))/0x4*(-parseInt(_0x195fc2(0x1f0))/0x5)+-parseInt(_0x195fc2(0x20f))/0x6+parseInt(_0x195fc2(0x221))/0x7+-parseInt(_0x195fc2(0x1f7))/0x8+-parseInt(_0x195fc2(0x22e))/0x9;if(_0x1e6b1f===_0x169852)break;else _0x90245a['push'](_0x90245a['shift']());}catch(_0x543951){_0x90245a['push'](_0x90245a['shift']());}}}(a128_0x3802,0xb14c2));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;function a128_0x3802(){const _0x400490=['unchanged','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','\x20SQL\x20file(s)\x20into\x20','appCode','lastSync','sqlRoot','POST','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','name','sql','122SnpkVW','Force\x20pull\x20cancelled.','totalCount','path','tableData','toISOString','utf8','sqlName','message','description','\x20written,\x20','2586114oJDcHT','pull','535140KyGEND','split','bool','sqlcode','write','skipped','lockFilePath','sqlRootDir','str','test','sqlContent','mybatisXml','trimStart','local\x20differs\x20from\x20remote','filter','Filter\x20by\x20SQL\x20display\x20name','5640586KGAmFf','push','sqlCode','paging','No\x20remote\x20SQL\x20queries\x20matched.','Would\x20pull\x20','sqls','Force\x20overwrite\x20local\x20unsynced\x20changes','dbId','would_pull','3393585mweotA','\x20failed','length','15000183bKakqG','catch','nonInteractive','join','15kAUGiW','apps','Pull\x20complete:\x20','8538jTTfUO','force','conflict','string','282000XKQbkP','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)'];a128_0x3802=function(){return _0x400490;};return a128_0x3802();}function a128_0x2c59(_0x5b9415,_0xa9e157){_0x5b9415=_0x5b9415-0x1ef;const _0x38027b=a128_0x3802();let _0x2c591d=_0x38027b[_0x5b9415];return _0x2c591d;}async function fetchAllSqlQueries(_0x424ab9,_0x239867){const _0x1e0ce4=a128_0x2c59,_0x5dcda0=[];let _0x40163c=0x1;while(!![]){const _0x193351=await listSqlQueries(_0x424ab9,{'currentPage':_0x40163c,'pageSize':PAGE_SIZE,'sqlCode':_0x239867['sqlCode'],'sqlName':_0x239867['sqlName']}),_0x194a6d=_0x193351[_0x1e0ce4(0x208)]??[];_0x5dcda0['push'](..._0x194a6d);if(_0x194a6d['length']===0x0)break;const _0x134ce7=_0x193351[_0x1e0ce4(0x224)]?.[_0x1e0ce4(0x206)];if(_0x134ce7!=null?_0x5dcda0[_0x1e0ce4(0x22d)]>=_0x134ce7:_0x194a6d[_0x1e0ce4(0x22d)]<PAGE_SIZE)break;_0x40163c++;}return _0x5dcda0;}async function ensureSqlContent(_0x2a1927){const _0x1931b0=a128_0x2c59;if(_0x2a1927[_0x1931b0(0x21b)]!=null&&String(_0x2a1927[_0x1931b0(0x21b)])['length']>0x0)return _0x2a1927;return getSqlQueryDetail(_0x2a1927[_0x1931b0(0x223)]);}export const sqlPull={'service':a128_0x5d1edb(0x203),'command':a128_0x5d1edb(0x210),'description':a128_0x5d1edb(0x1fb),'risk':a128_0x5d1edb(0x215),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a128_0x5d1edb(0x202),'type':a128_0x5d1edb(0x1f6),'description':a128_0x5d1edb(0x220)},{'name':a128_0x5d1edb(0x1f4),'type':'boolean','description':a128_0x5d1edb(0x228)}],async 'dryRun'(_0x1e4719){const _0xddd9de=a128_0x5d1edb,_0x5dd25c=loadSqlProjectConfig(_0x1e4719[_0xddd9de(0x1fd)]),_0x5ecfa5=await readSqlLockFile(_0x5dd25c[_0xddd9de(0x217)]),{appLock:_0x35585f}=ensureSqlLockScope(_0x5ecfa5??createEmptySqlLock(),_0x5dd25c['appCode'],_0x5dd25c[_0xddd9de(0x1ff)],_0xddd9de(0x210)),_0x5f4604=await fetchAllSqlQueries(_0x1e4719[_0xddd9de(0x1fd)],{'sqlCode':_0x1e4719[_0xddd9de(0x219)](_0xddd9de(0x214))||undefined,'sqlName':_0x1e4719[_0xddd9de(0x219)](_0xddd9de(0x202))||undefined}),_0x4c03d6=[];for(const _0x2e2426 of _0x5f4604){const _0x5ec6b0=await ensureSqlContent(_0x2e2426),_0x7c193f=ensureRemoteSqlContent(_0x5ec6b0),_0x12ffc2=detectModeFromSql(_0x5ec6b0),_0x1a17ab=_0x5ec6b0[_0xddd9de(0x229)]?await getDbName(_0x1e4719[_0xddd9de(0x1fd)],Number(_0x5ec6b0[_0xddd9de(0x229)]))[_0xddd9de(0x22f)](()=>undefined):undefined,_0x226190=buildLocalSqlFileContent({'sqlCode':_0x5ec6b0[_0xddd9de(0x223)],'sqlName':_0x5ec6b0[_0xddd9de(0x20b)],'dbId':_0x5ec6b0[_0xddd9de(0x229)]},_0x7c193f,{'dbName':_0x1a17ab,'mode':_0x12ffc2,'syncedAt':new Date()['toISOString'](),'description':_0x5ec6b0[_0xddd9de(0x20d)]}),_0x2d6432=buildSqlLockEntry(_0x5ec6b0,_0x7c193f,'',{'dbName':_0x1a17ab}),_0x3bceab=resolveLocalSqlFilePath(_0x5dd25c,_0x5ec6b0[_0xddd9de(0x223)],_0x2d6432);let _0x420c02=_0xddd9de(0x22a),_0x10cbfe;if(await fileExists(_0x3bceab)){const _0x1ef6b4=await readFile(_0x3bceab,'utf8');isEquivalentPulledSqlFile(_0x1ef6b4,_0x226190,_0x12ffc2)?(_0x420c02=_0xddd9de(0x216),_0x10cbfe=_0xddd9de(0x1f9)):(_0x420c02=_0xddd9de(0x1f5),_0x10cbfe=_0xddd9de(0x1f8));}_0x4c03d6[_0xddd9de(0x222)]({'sqlCode':_0x5ec6b0[_0xddd9de(0x223)],'sqlName':_0x5ec6b0[_0xddd9de(0x20b)],'filePath':_0x3bceab,'status':_0x420c02,'reason':_0x10cbfe});}return{'method':_0xddd9de(0x200),'url':_0xddd9de(0x201),'body':{'appCode':_0x1e4719[_0xddd9de(0x1fd)],'sqlCode':_0x1e4719[_0xddd9de(0x219)](_0xddd9de(0x214))||null,'sqlName':_0x1e4719[_0xddd9de(0x219)](_0xddd9de(0x202))||null,'files':_0x4c03d6},'description':_0xddd9de(0x226)+_0x4c03d6[_0xddd9de(0x22d)]+_0xddd9de(0x1fc)+_0x5dd25c[_0xddd9de(0x218)]};},async 'execute'(_0x131474){const _0x5f1cf1=a128_0x5d1edb,_0x35f3d5=loadSqlProjectConfig(_0x131474[_0x5f1cf1(0x1fd)]),_0xce58c=await readSqlLockFile(_0x35f3d5[_0x5f1cf1(0x217)]),{lockData:_0x1a683a,appLock:_0x46940d}=ensureSqlLockScope(_0xce58c??createEmptySqlLock(),_0x35f3d5[_0x5f1cf1(0x1fd)],_0x35f3d5[_0x5f1cf1(0x1ff)],_0x5f1cf1(0x210)),_0x17a92d=_0x131474[_0x5f1cf1(0x213)]('force'),_0x43ed89=await fetchAllSqlQueries(_0x131474[_0x5f1cf1(0x1fd)],{'sqlCode':_0x131474[_0x5f1cf1(0x219)](_0x5f1cf1(0x214))||undefined,'sqlName':_0x131474[_0x5f1cf1(0x219)](_0x5f1cf1(0x202))||undefined});if(_0x43ed89['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x5f1cf1(0x225)};const _0x1c5fd8=[],_0x16ba46=[];for(const _0x48f73d of _0x43ed89){try{_0x1c5fd8[_0x5f1cf1(0x222)](await ensureSqlContent(_0x48f73d));}catch(_0x43633d){_0x16ba46[_0x5f1cf1(0x222)]({'sqlCode':_0x48f73d[_0x5f1cf1(0x223)],'error':_0x43633d instanceof Error?_0x43633d[_0x5f1cf1(0x20c)]:String(_0x43633d)});}}if(_0x17a92d&&!_0x131474[_0x5f1cf1(0x230)]){let _0x5a464b=![];for(const _0x54a1b6 of _0x1c5fd8){const _0x5e51e9=detectModeFromSql(_0x54a1b6),_0x3deabd=_0x54a1b6['dbId']?await getDbName(_0x131474[_0x5f1cf1(0x1fd)],Number(_0x54a1b6['dbId']))['catch'](()=>undefined):undefined,_0x205a75=buildLocalSqlFileContent({'sqlCode':_0x54a1b6['sqlCode'],'sqlName':_0x54a1b6['sqlName'],'dbId':_0x54a1b6[_0x5f1cf1(0x229)]},ensureRemoteSqlContent(_0x54a1b6),{'dbName':_0x3deabd,'mode':_0x5e51e9,'syncedAt':new Date()[_0x5f1cf1(0x209)](),'description':_0x54a1b6[_0x5f1cf1(0x20d)]}),_0x31351f=resolveLocalSqlFilePath(_0x35f3d5,_0x54a1b6[_0x5f1cf1(0x223)],buildSqlLockEntry(_0x54a1b6,ensureRemoteSqlContent(_0x54a1b6),'',{'dbName':_0x3deabd}));if(await fileExists(_0x31351f)){const _0x1a4c60=await readFile(_0x31351f,'utf8');if(!isEquivalentPulledSqlFile(_0x1a4c60,_0x205a75,_0x5e51e9)){_0x5a464b=!![];break;}}}if(_0x5a464b){const _0x319a32=await confirmForceOverwrite(_0x5f1cf1(0x1fa));if(!_0x319a32)throw CliErrors['cancelled'](_0x5f1cf1(0x205));}}const _0x33f5e0=cloneSqlLockData(_0x1a683a),_0x27ad73=_0x33f5e0[_0x5f1cf1(0x1f1)][_0x35f3d5[_0x5f1cf1(0x1fd)]],_0x519a6a=[],_0xe8eaf9=[];for(const _0x34d5d2 of _0x1c5fd8){const _0x3bffb5=_0x27ad73['sqls'][_0x34d5d2['sqlCode']],_0x2b49b6=ensureRemoteSqlContent(_0x34d5d2),_0x3556f2=detectModeFromSql(_0x34d5d2),_0x13dcac=_0x34d5d2[_0x5f1cf1(0x229)]?await getDbName(_0x131474['appCode'],Number(_0x34d5d2[_0x5f1cf1(0x229)]))[_0x5f1cf1(0x22f)](()=>undefined):undefined,_0x1fd6c0=buildLocalSqlFileContent({'sqlCode':_0x34d5d2['sqlCode'],'sqlName':_0x34d5d2[_0x5f1cf1(0x20b)],'dbId':_0x34d5d2[_0x5f1cf1(0x229)]},_0x2b49b6,{'dbName':_0x13dcac,'mode':_0x3556f2,'syncedAt':new Date()[_0x5f1cf1(0x209)](),'description':_0x34d5d2[_0x5f1cf1(0x20d)]}),_0x172b11=buildSqlLockEntry(_0x34d5d2,_0x2b49b6,computeSqlContentHash(_0x1fd6c0),{'dbName':_0x13dcac}),_0x22b926=_0x172b11[_0x5f1cf1(0x207)],_0x359ec0=join(_0x35f3d5[_0x5f1cf1(0x218)],_0x22b926);try{if(await fileExists(_0x359ec0)){const _0x218a54=await readFile(_0x359ec0,_0x5f1cf1(0x20a));if(isEquivalentPulledSqlFile(_0x218a54,_0x1fd6c0,_0x3556f2)){_0xe8eaf9[_0x5f1cf1(0x222)]({'sqlCode':_0x34d5d2[_0x5f1cf1(0x223)],'reason':'unchanged'}),_0x27ad73[_0x5f1cf1(0x227)][_0x34d5d2[_0x5f1cf1(0x223)]]={..._0x172b11,'hash':computeSqlContentHash(_0x218a54),'path':_0x22b926};continue;}if(!_0x17a92d){_0xe8eaf9[_0x5f1cf1(0x222)]({'sqlCode':_0x34d5d2[_0x5f1cf1(0x223)],'reason':_0x5f1cf1(0x21e)});continue;}}const _0x1ae123=_0x3bffb5?.[_0x5f1cf1(0x207)]?join(_0x35f3d5['sqlRootDir'],_0x3bffb5[_0x5f1cf1(0x207)]):undefined;_0x1ae123&&_0x1ae123!==_0x359ec0&&await fileExists(_0x1ae123)&&await rm(_0x1ae123,{'force':!![]}),await ensureParentDirectory(_0x359ec0),await writeFile(_0x359ec0,_0x1fd6c0,_0x5f1cf1(0x20a)),_0x27ad73[_0x5f1cf1(0x227)][_0x34d5d2['sqlCode']]={..._0x172b11,'path':_0x22b926},_0x519a6a[_0x5f1cf1(0x222)]({'sqlCode':_0x34d5d2[_0x5f1cf1(0x223)],'filePath':_0x359ec0});}catch(_0x9eb56f){_0x16ba46['push']({'sqlCode':_0x34d5d2['sqlCode'],'error':_0x9eb56f instanceof Error?_0x9eb56f[_0x5f1cf1(0x20c)]:String(_0x9eb56f)});}}return _0x27ad73[_0x5f1cf1(0x1fe)]=new Date()[_0x5f1cf1(0x209)](),await writeSqlLockFile(_0x35f3d5['lockFilePath'],_0x33f5e0),{'ok':_0x16ba46[_0x5f1cf1(0x22d)]===0x0,'data':{'pulled':_0x519a6a,'skipped':_0xe8eaf9,'failed':_0x16ba46},'message':_0x5f1cf1(0x1f2)+_0x519a6a['length']+_0x5f1cf1(0x20e)+_0xe8eaf9[_0x5f1cf1(0x22d)]+'\x20skipped,\x20'+_0x16ba46['length']+_0x5f1cf1(0x22c)};}};function detectModeFromSql(_0x1758f7){const _0xb87dc6=a128_0x5d1edb,_0x54ea88=ensureRemoteSqlContent(_0x1758f7),_0x562f92=stripLocalSqlMetadata(_0x54ea88,_0xb87dc6(0x21c))[_0xb87dc6(0x21d)]();if(/^<(select|insert|update|delete)\b/i[_0xb87dc6(0x21a)](_0x562f92))return _0xb87dc6(0x21c);return'sql';}function isEquivalentPulledSqlFile(_0x27099f,_0x3530f6,_0x23f242){return normalizePullComparableContent(_0x27099f,_0x23f242)===normalizePullComparableContent(_0x3530f6,_0x23f242);}function normalizePullComparableContent(_0x56f27d,_0x30bdad){const _0x23bdab=a128_0x5d1edb,_0x552274=_0x56f27d['replace'](/\r\n/g,'\x0a')[_0x23bdab(0x212)]('\x0a'),_0x38c4df=_0x552274[_0x23bdab(0x21f)](_0x2b3f45=>!isSyncedAtMetadataLine(_0x2b3f45,_0x30bdad));return _0x38c4df[_0x23bdab(0x1ef)]('\x0a');}function isSyncedAtMetadataLine(_0x115ae1,_0x12cd26){const _0x3fbf0d=a128_0x5d1edb;if(_0x12cd26===_0x3fbf0d(0x21c))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x3fbf0d(0x21a)](_0x115ae1);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x115ae1);}
1
+ function a128_0x4279(_0x3b4079,_0xab6774){_0x3b4079=_0x3b4079-0x80;const _0xef5f1f=a128_0xef5f();let _0x42790a=_0xef5f1f[_0x3b4079];return _0x42790a;}const a128_0x441d12=a128_0x4279;function a128_0xef5f(){const _0x3b8591=['catch','nonInteractive','\x20written,\x20','message','\x20SQL\x20file(s)\x20into\x20','push','split','conflict','name','4046610IzmHtY','sqlName','2170050dgofhB','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','dbId','695616qyWdRj','unchanged','342531dgKqmF','length','toISOString','1489785VtphwD','pull','apps','\x20failed','mybatisXml','boolean','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','force','Force\x20overwrite\x20local\x20unsynced\x20changes','sqlRoot','test','replace','4366852OFENGq','skipped','Force\x20pull\x20cancelled.','Filter\x20by\x20SQL\x20display\x20name','path','join','sql','4UpMJnU','sqls','appCode','5AJgQTB','8OhgToK','string','str','POST','write','description','lockFilePath','utf8','373497VdFvKw','27lXmgWy','sqlRootDir','lastSync','local\x20differs\x20from\x20remote','No\x20remote\x20SQL\x20queries\x20matched.','sqlCode','would_pull','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlcode','filter'];a128_0xef5f=function(){return _0x3b8591;};return a128_0xef5f();}(function(_0x542164,_0x3ca987){const _0x5a19dc=a128_0x4279,_0x7dcb50=_0x542164();while(!![]){try{const _0x20e76b=-parseInt(_0x5a19dc(0xae))/0x1*(-parseInt(_0x5a19dc(0x87))/0x2)+parseInt(_0x5a19dc(0x93))/0x3*(-parseInt(_0x5a19dc(0x8b))/0x4)+-parseInt(_0x5a19dc(0x8a))/0x5*(-parseInt(_0x5a19dc(0xa7))/0x6)+-parseInt(_0x5a19dc(0x80))/0x7+-parseInt(_0x5a19dc(0xac))/0x8*(-parseInt(_0x5a19dc(0x94))/0x9)+-parseInt(_0x5a19dc(0xa9))/0xa+-parseInt(_0x5a19dc(0xb1))/0xb;if(_0x20e76b===_0x3ca987)break;else _0x7dcb50['push'](_0x7dcb50['shift']());}catch(_0x18720b){_0x7dcb50['push'](_0x7dcb50['shift']());}}}(a128_0xef5f,0x60747));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x2cbee8,_0xa05a23){const _0x3851a9=a128_0x4279,_0x2fd8ec=[];let _0x2a5c3b=0x1;while(!![]){const _0x57ae9c=await listSqlQueries(_0x2cbee8,{'currentPage':_0x2a5c3b,'pageSize':PAGE_SIZE,'sqlCode':_0xa05a23[_0x3851a9(0x99)],'sqlName':_0xa05a23['sqlName']}),_0x57376c=_0x57ae9c['tableData']??[];_0x2fd8ec[_0x3851a9(0xa3)](..._0x57376c);if(_0x57376c[_0x3851a9(0xaf)]===0x0)break;const _0x4d7797=_0x57ae9c['paging']?.['totalCount'];if(_0x4d7797!=null?_0x2fd8ec['length']>=_0x4d7797:_0x57376c[_0x3851a9(0xaf)]<PAGE_SIZE)break;_0x2a5c3b++;}return _0x2fd8ec;}async function ensureSqlContent(_0x46ae41){const _0x4abdae=a128_0x4279;if(_0x46ae41['sqlContent']!=null&&String(_0x46ae41['sqlContent'])[_0x4abdae(0xaf)]>0x0)return _0x46ae41;return getSqlQueryDetail(_0x46ae41['sqlCode']);}export const sqlPull={'service':'sql','command':a128_0x441d12(0xb2),'description':a128_0x441d12(0x9b),'risk':a128_0x441d12(0x8f),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a128_0x441d12(0xa6),'type':a128_0x441d12(0x8c),'description':a128_0x441d12(0x83)},{'name':a128_0x441d12(0xb8),'type':a128_0x441d12(0xb6),'description':a128_0x441d12(0xb9)}],async 'dryRun'(_0x4f20b5){const _0x4ce122=a128_0x441d12,_0x15e227=loadSqlProjectConfig(_0x4f20b5['appCode']),_0xf9f114=await readSqlLockFile(_0x15e227['lockFilePath']),{appLock:_0x375d59}=ensureSqlLockScope(_0xf9f114??createEmptySqlLock(),_0x15e227[_0x4ce122(0x89)],_0x15e227[_0x4ce122(0xba)],_0x4ce122(0xb2)),_0x21f461=await fetchAllSqlQueries(_0x4f20b5[_0x4ce122(0x89)],{'sqlCode':_0x4f20b5['str'](_0x4ce122(0x9c))||undefined,'sqlName':_0x4f20b5[_0x4ce122(0x8d)](_0x4ce122(0xa6))||undefined}),_0x2e4568=[];for(const _0x1fe39a of _0x21f461){const _0x33c4a1=await ensureSqlContent(_0x1fe39a),_0x1a8543=ensureRemoteSqlContent(_0x33c4a1),_0x6325d2=detectModeFromSql(_0x33c4a1),_0xf6a89f=_0x33c4a1[_0x4ce122(0xab)]?await getDbName(_0x4f20b5[_0x4ce122(0x89)],Number(_0x33c4a1['dbId']))[_0x4ce122(0x9e)](()=>undefined):undefined,_0x219b75=buildLocalSqlFileContent({'sqlCode':_0x33c4a1[_0x4ce122(0x99)],'sqlName':_0x33c4a1[_0x4ce122(0xa8)],'dbId':_0x33c4a1[_0x4ce122(0xab)]},_0x1a8543,{'dbName':_0xf6a89f,'mode':_0x6325d2,'syncedAt':new Date()[_0x4ce122(0xb0)](),'description':_0x33c4a1[_0x4ce122(0x90)]}),_0x1734ef=buildSqlLockEntry(_0x33c4a1,_0x1a8543,'',{'dbName':_0xf6a89f}),_0xf5fd14=resolveLocalSqlFilePath(_0x15e227,_0x33c4a1[_0x4ce122(0x99)],_0x1734ef);let _0x1b6946=_0x4ce122(0x9a),_0x1fe5bd;if(await fileExists(_0xf5fd14)){const _0x5014eb=await readFile(_0xf5fd14,_0x4ce122(0x92));isEquivalentPulledSqlFile(_0x5014eb,_0x219b75,_0x6325d2)?(_0x1b6946=_0x4ce122(0x81),_0x1fe5bd=_0x4ce122(0xad)):(_0x1b6946=_0x4ce122(0xa5),_0x1fe5bd=_0x4ce122(0xaa));}_0x2e4568['push']({'sqlCode':_0x33c4a1[_0x4ce122(0x99)],'sqlName':_0x33c4a1[_0x4ce122(0xa8)],'filePath':_0xf5fd14,'status':_0x1b6946,'reason':_0x1fe5bd});}return{'method':_0x4ce122(0x8e),'url':_0x4ce122(0xb7),'body':{'appCode':_0x4f20b5[_0x4ce122(0x89)],'sqlCode':_0x4f20b5[_0x4ce122(0x8d)](_0x4ce122(0x9c))||null,'sqlName':_0x4f20b5['str']('name')||null,'files':_0x2e4568},'description':'Would\x20pull\x20'+_0x2e4568['length']+_0x4ce122(0xa2)+_0x15e227[_0x4ce122(0x95)]};},async 'execute'(_0x5d2fd1){const _0x53522f=a128_0x441d12,_0x702dd0=loadSqlProjectConfig(_0x5d2fd1[_0x53522f(0x89)]),_0x491bfa=await readSqlLockFile(_0x702dd0[_0x53522f(0x91)]),{lockData:_0x313632,appLock:_0x9e7b9a}=ensureSqlLockScope(_0x491bfa??createEmptySqlLock(),_0x702dd0[_0x53522f(0x89)],_0x702dd0[_0x53522f(0xba)],_0x53522f(0xb2)),_0x35ffc3=_0x5d2fd1['bool'](_0x53522f(0xb8)),_0x54115c=await fetchAllSqlQueries(_0x5d2fd1[_0x53522f(0x89)],{'sqlCode':_0x5d2fd1[_0x53522f(0x8d)](_0x53522f(0x9c))||undefined,'sqlName':_0x5d2fd1[_0x53522f(0x8d)](_0x53522f(0xa6))||undefined});if(_0x54115c[_0x53522f(0xaf)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x53522f(0x98)};const _0x41da6c=[],_0xfc339f=[];for(const _0x1c5217 of _0x54115c){try{_0x41da6c[_0x53522f(0xa3)](await ensureSqlContent(_0x1c5217));}catch(_0x355bdd){_0xfc339f[_0x53522f(0xa3)]({'sqlCode':_0x1c5217[_0x53522f(0x99)],'error':_0x355bdd instanceof Error?_0x355bdd[_0x53522f(0xa1)]:String(_0x355bdd)});}}if(_0x35ffc3&&!_0x5d2fd1[_0x53522f(0x9f)]){let _0x1daa23=![];for(const _0x1dd56d of _0x41da6c){const _0x522eb8=detectModeFromSql(_0x1dd56d),_0x3b83fb=_0x1dd56d['dbId']?await getDbName(_0x5d2fd1['appCode'],Number(_0x1dd56d[_0x53522f(0xab)]))[_0x53522f(0x9e)](()=>undefined):undefined,_0xb2c263=buildLocalSqlFileContent({'sqlCode':_0x1dd56d[_0x53522f(0x99)],'sqlName':_0x1dd56d[_0x53522f(0xa8)],'dbId':_0x1dd56d['dbId']},ensureRemoteSqlContent(_0x1dd56d),{'dbName':_0x3b83fb,'mode':_0x522eb8,'syncedAt':new Date()['toISOString'](),'description':_0x1dd56d['description']}),_0xb29569=resolveLocalSqlFilePath(_0x702dd0,_0x1dd56d[_0x53522f(0x99)],buildSqlLockEntry(_0x1dd56d,ensureRemoteSqlContent(_0x1dd56d),'',{'dbName':_0x3b83fb}));if(await fileExists(_0xb29569)){const _0x243b42=await readFile(_0xb29569,_0x53522f(0x92));if(!isEquivalentPulledSqlFile(_0x243b42,_0xb2c263,_0x522eb8)){_0x1daa23=!![];break;}}}if(_0x1daa23){const _0x4fdb74=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x4fdb74)throw CliErrors['cancelled'](_0x53522f(0x82));}}const _0xdd64ce=cloneSqlLockData(_0x313632),_0x3aecf4=_0xdd64ce[_0x53522f(0xb3)][_0x702dd0[_0x53522f(0x89)]],_0x67eed7=[],_0x29ef4e=[];for(const _0x5e1f5b of _0x41da6c){const _0x47b743=_0x3aecf4['sqls'][_0x5e1f5b[_0x53522f(0x99)]],_0x323de9=ensureRemoteSqlContent(_0x5e1f5b),_0x4b1eb6=detectModeFromSql(_0x5e1f5b),_0x22a984=_0x5e1f5b[_0x53522f(0xab)]?await getDbName(_0x5d2fd1[_0x53522f(0x89)],Number(_0x5e1f5b[_0x53522f(0xab)]))[_0x53522f(0x9e)](()=>undefined):undefined,_0x108eca=buildLocalSqlFileContent({'sqlCode':_0x5e1f5b[_0x53522f(0x99)],'sqlName':_0x5e1f5b['sqlName'],'dbId':_0x5e1f5b[_0x53522f(0xab)]},_0x323de9,{'dbName':_0x22a984,'mode':_0x4b1eb6,'syncedAt':new Date()[_0x53522f(0xb0)](),'description':_0x5e1f5b[_0x53522f(0x90)]}),_0x43e550=buildSqlLockEntry(_0x5e1f5b,_0x323de9,computeSqlContentHash(_0x108eca),{'dbName':_0x22a984}),_0x133071=_0x43e550['path'],_0x45b4a9=join(_0x702dd0['sqlRootDir'],_0x133071);try{if(await fileExists(_0x45b4a9)){const _0x513bc7=await readFile(_0x45b4a9,_0x53522f(0x92));if(isEquivalentPulledSqlFile(_0x513bc7,_0x108eca,_0x4b1eb6)){_0x29ef4e[_0x53522f(0xa3)]({'sqlCode':_0x5e1f5b['sqlCode'],'reason':'unchanged'}),_0x3aecf4[_0x53522f(0x88)][_0x5e1f5b[_0x53522f(0x99)]]={..._0x43e550,'hash':computeSqlContentHash(_0x513bc7),'path':_0x133071};continue;}if(!_0x35ffc3){_0x29ef4e[_0x53522f(0xa3)]({'sqlCode':_0x5e1f5b['sqlCode'],'reason':_0x53522f(0x97)});continue;}}const _0x2cc351=_0x47b743?.[_0x53522f(0x84)]?join(_0x702dd0[_0x53522f(0x95)],_0x47b743[_0x53522f(0x84)]):undefined;_0x2cc351&&_0x2cc351!==_0x45b4a9&&await fileExists(_0x2cc351)&&await rm(_0x2cc351,{'force':!![]}),await ensureParentDirectory(_0x45b4a9),await writeFile(_0x45b4a9,_0x108eca,_0x53522f(0x92)),_0x3aecf4[_0x53522f(0x88)][_0x5e1f5b['sqlCode']]={..._0x43e550,'path':_0x133071},_0x67eed7[_0x53522f(0xa3)]({'sqlCode':_0x5e1f5b['sqlCode'],'filePath':_0x45b4a9});}catch(_0x23c7f5){_0xfc339f[_0x53522f(0xa3)]({'sqlCode':_0x5e1f5b[_0x53522f(0x99)],'error':_0x23c7f5 instanceof Error?_0x23c7f5[_0x53522f(0xa1)]:String(_0x23c7f5)});}}return _0x3aecf4[_0x53522f(0x96)]=new Date()[_0x53522f(0xb0)](),await writeSqlLockFile(_0x702dd0['lockFilePath'],_0xdd64ce),{'ok':_0xfc339f['length']===0x0,'data':{'pulled':_0x67eed7,'skipped':_0x29ef4e,'failed':_0xfc339f},'message':'Pull\x20complete:\x20'+_0x67eed7[_0x53522f(0xaf)]+_0x53522f(0xa0)+_0x29ef4e['length']+'\x20skipped,\x20'+_0xfc339f[_0x53522f(0xaf)]+_0x53522f(0xb4)};}};function detectModeFromSql(_0x369098){const _0x4a1a2d=a128_0x441d12,_0x1fb84b=ensureRemoteSqlContent(_0x369098),_0x1275be=stripLocalSqlMetadata(_0x1fb84b,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x4a1a2d(0xbb)](_0x1275be))return _0x4a1a2d(0xb5);return _0x4a1a2d(0x86);}function isEquivalentPulledSqlFile(_0x3769ab,_0x9a2677,_0x5abc9c){return normalizePullComparableContent(_0x3769ab,_0x5abc9c)===normalizePullComparableContent(_0x9a2677,_0x5abc9c);}function normalizePullComparableContent(_0x5e5b9a,_0x17a93d){const _0x3e7794=a128_0x441d12,_0xb0d3f1=_0x5e5b9a[_0x3e7794(0xbc)](/\r\n/g,'\x0a')[_0x3e7794(0xa4)]('\x0a'),_0x488f03=_0xb0d3f1[_0x3e7794(0x9d)](_0x35eb81=>!isSyncedAtMetadataLine(_0x35eb81,_0x17a93d));return _0x488f03[_0x3e7794(0x85)]('\x0a');}function isSyncedAtMetadataLine(_0x24d38b,_0x1f194b){const _0x595d4f=a128_0x441d12;if(_0x1f194b===_0x595d4f(0xb5))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x595d4f(0xbb)](_0x24d38b);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x24d38b);}
@@ -1 +1 @@
1
- const a129_0xb7ea13=a129_0x197a;(function(_0x22a4a8,_0x116482){const _0x33287b=a129_0x197a,_0x1238bc=_0x22a4a8();while(!![]){try{const _0x5360a4=parseInt(_0x33287b(0x1e7))/0x1*(-parseInt(_0x33287b(0x1df))/0x2)+parseInt(_0x33287b(0x1be))/0x3*(-parseInt(_0x33287b(0x1c6))/0x4)+parseInt(_0x33287b(0x1c1))/0x5+parseInt(_0x33287b(0x1e2))/0x6*(-parseInt(_0x33287b(0x1e5))/0x7)+parseInt(_0x33287b(0x1c3))/0x8+-parseInt(_0x33287b(0x1b6))/0x9+parseInt(_0x33287b(0x1ba))/0xa*(parseInt(_0x33287b(0x1d0))/0xb);if(_0x5360a4===_0x116482)break;else _0x1238bc['push'](_0x1238bc['shift']());}catch(_0x2e7a8b){_0x1238bc['push'](_0x1238bc['shift']());}}}(a129_0x1e99,0x236ff));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a129_0x197a(_0x52e2d3,_0xf3408){_0x52e2d3=_0x52e2d3-0x1b1;const _0x1e9921=a129_0x1e99();let _0x197a31=_0x1e9921[_0x52e2d3];return _0x197a31;}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x3144e4,_0x1d2474,_0x14d3d5){const _0x411697=a129_0x197a,_0x501d20=await scanLocalSqlQueries(_0x3144e4),_0x3028ef=new Map();for(const _0x4a1da7 of _0x501d20){if(_0x14d3d5&&_0x4a1da7[_0x411697(0x1cb)]!==_0x14d3d5)continue;const _0x47f040=_0x3028ef['get'](_0x4a1da7[_0x411697(0x1cb)])??[];_0x47f040[_0x411697(0x1ed)](_0x4a1da7),_0x3028ef[_0x411697(0x1c2)](_0x4a1da7[_0x411697(0x1cb)],_0x47f040);}if(_0x14d3d5&&!_0x3028ef[_0x411697(0x1b3)](_0x14d3d5))throw CliErrors[_0x411697(0x1f5)](_0x411697(0x1ef)+_0x14d3d5);const _0x49b72d=[];for(const [_0x280f79,_0x2ecb23]of _0x3028ef[_0x411697(0x1f2)]()){if(_0x2ecb23[_0x411697(0x1dd)]===0x1){_0x49b72d[_0x411697(0x1ed)](_0x2ecb23[0x0]);continue;}const _0x52e74a=_0x1d2474['sqls'][_0x280f79],_0x37eedb=_0x52e74a?.[_0x411697(0x1d6)],_0x34c195=_0x37eedb?_0x2ecb23[_0x411697(0x1b8)](_0x51f9f8=>_0x51f9f8[_0x411697(0x1b2)]!==_0x37eedb):_0x2ecb23;if(_0x52e74a&&_0x34c195[_0x411697(0x1dd)]===0x1){_0x49b72d[_0x411697(0x1ed)](_0x34c195[0x0]);continue;}throw CliErrors[_0x411697(0x1f5)](_0x411697(0x1f0)+_0x280f79+_0x411697(0x1bd));}return _0x49b72d;}export const sqlPush={'service':a129_0xb7ea13(0x1d8),'command':'push','description':a129_0xb7ea13(0x1da),'risk':a129_0xb7ea13(0x1ee),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a129_0xb7ea13(0x1ca),'type':a129_0xb7ea13(0x1cc),'description':a129_0xb7ea13(0x1bf)}],async 'dryRun'(_0x51e520){const _0x1d8ab0=a129_0xb7ea13,_0x3b2140=loadSqlProjectConfig(_0x51e520['appCode']),_0xfb17a0=await readSqlLockFile(_0x3b2140[_0x1d8ab0(0x1f6)]),{appLock:_0x31c7b9}=ensureSqlLockScope(_0xfb17a0??createEmptySqlLock(),_0x51e520['appCode'],_0x3b2140['sqlRoot'],'push'),_0x187b73=await getTargetSqlQueries(_0x3b2140,_0x31c7b9,_0x51e520[_0x1d8ab0(0x1b7)](_0x1d8ab0(0x1e0))||undefined),_0x577405=[];for(const _0x1d1d01 of _0x187b73){const _0x403265=await computeSqlFileHash(_0x1d1d01[_0x1d8ab0(0x1cf)]),_0x5134d5=_0x31c7b9[_0x1d8ab0(0x1c9)][_0x1d1d01[_0x1d8ab0(0x1cb)]],_0x587395=!!_0x5134d5&&(_0x5134d5[_0x1d8ab0(0x1d6)]!==_0x1d1d01['relativePath']||!!_0x1d1d01['sqlName']&&_0x5134d5[_0x1d8ab0(0x1c7)]!==_0x1d1d01['sqlName']);if(!_0x51e520[_0x1d8ab0(0x1c4)]('force')&&_0x5134d5&&_0x5134d5[_0x1d8ab0(0x1d9)]===_0x403265&&!_0x587395)continue;_0x577405[_0x1d8ab0(0x1ed)](_0x1d1d01[_0x1d8ab0(0x1cb)]);}return{'method':_0x1d8ab0(0x1e6),'url':_0x1d8ab0(0x1bc),'body':{'sqlCodes':_0x577405,'appCode':_0x51e520[_0x1d8ab0(0x1e4)]},'description':_0x1d8ab0(0x1d7)+_0x577405['length']+_0x1d8ab0(0x1db)};},async 'execute'(_0x38da69){const _0x293bbc=a129_0xb7ea13,_0x51e330=loadSqlProjectConfig(_0x38da69[_0x293bbc(0x1e4)]),_0x3743a0=await readSqlLockFile(_0x51e330['lockFilePath']),{lockData:_0x3ecbc2,appLock:_0x45dba1}=ensureSqlLockScope(_0x3743a0??createEmptySqlLock(),_0x38da69[_0x293bbc(0x1e4)],_0x51e330[_0x293bbc(0x1d4)],_0x293bbc(0x1ed)),_0x1f7581=await getTargetSqlQueries(_0x51e330,_0x45dba1,_0x38da69[_0x293bbc(0x1b7)](_0x293bbc(0x1e0))||undefined);if(_0x1f7581[_0x293bbc(0x1dd)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x293bbc(0x1c5)};const _0x5d1230=[],_0x5d836c=[],_0x3d9492=[];for(const _0x2b4536 of _0x1f7581){const _0x3ee408=_0x45dba1[_0x293bbc(0x1c9)][_0x2b4536[_0x293bbc(0x1cb)]];if(!_0x3ee408){_0x3d9492['push']({'sqlCode':_0x2b4536['sqlCode'],'error':_0x293bbc(0x1d1)});continue;}try{const _0x42fff7=await computeSqlFileHash(_0x2b4536[_0x293bbc(0x1cf)]),_0xfcf610=_0x3ee408[_0x293bbc(0x1d6)]!==_0x2b4536[_0x293bbc(0x1b2)]||!!_0x2b4536[_0x293bbc(0x1c7)]&&_0x3ee408[_0x293bbc(0x1c7)]!==_0x2b4536[_0x293bbc(0x1c7)];if(!_0x38da69[_0x293bbc(0x1c4)](_0x293bbc(0x1ca))&&_0x3ee408['hash']===_0x42fff7&&!_0xfcf610){_0x5d836c['push']({'sqlCode':_0x2b4536[_0x293bbc(0x1cb)],'reason':'unchanged'});continue;}if(_0x3ee408[_0x293bbc(0x1d2)]==null){_0x3d9492[_0x293bbc(0x1ed)]({'sqlCode':_0x2b4536[_0x293bbc(0x1cb)],'error':_0x293bbc(0x1ec)});continue;}const _0x1fa04a=await readFile(_0x2b4536[_0x293bbc(0x1cf)],_0x293bbc(0x1d3)),_0x3c60bb=stripLocalSqlMetadata(_0x1fa04a,_0x2b4536[_0x293bbc(0x1ea)]),_0x676e72=_0x2b4536[_0x293bbc(0x1c7)]||_0x3ee408[_0x293bbc(0x1c7)],_0x52597c=await resolveTargetDbBinding(_0x38da69['appCode'],_0x2b4536,_0x3ee408),_0x1af240=await updateSqlQuery({'id':_0x3ee408[_0x293bbc(0x1de)],'appCode':_0x38da69[_0x293bbc(0x1e4)],'sqlCode':_0x2b4536['sqlCode'],'sqlName':_0x676e72,'dbId':_0x52597c[_0x293bbc(0x1c0)],'version':_0x3ee408[_0x293bbc(0x1d2)],'sqlContent':_0x3c60bb,'sqlConfig':_0x3ee408[_0x293bbc(0x1e9)]??undefined}),_0x115c0e=_0x1af240[_0x293bbc(0x1c0)]?await getDbName(_0x38da69[_0x293bbc(0x1e4)],Number(_0x1af240[_0x293bbc(0x1c0)]))[_0x293bbc(0x1f1)](()=>_0x52597c['dbName']):_0x52597c[_0x293bbc(0x1b1)];_0x45dba1[_0x293bbc(0x1c9)][_0x2b4536[_0x293bbc(0x1cb)]]={...buildSqlLockEntry(_0x1af240,_0x3c60bb,_0x42fff7,{'dbName':_0x115c0e}),'path':_0x2b4536['relativePath'],'mode':_0x3ee408['mode']},await archivePreviousSqlFileIfNeeded(_0x51e330,_0x3ee408['path'],_0x2b4536[_0x293bbc(0x1b2)]),_0x5d1230['push']({'sqlCode':_0x2b4536['sqlCode'],'remoteId':_0x3ee408[_0x293bbc(0x1de)]});}catch(_0x2dd7ae){_0x3d9492['push']({'sqlCode':_0x2b4536[_0x293bbc(0x1cb)],'error':_0x2dd7ae instanceof Error?_0x2dd7ae['message']:String(_0x2dd7ae)});}}return _0x45dba1['lastSync']=new Date()[_0x293bbc(0x1b5)](),await writeSqlLockFile(_0x51e330[_0x293bbc(0x1f6)],_0x3ecbc2),{'ok':_0x3d9492['length']===0x0,'data':{'pushed':_0x5d1230,'skipped':_0x5d836c,'failed':_0x3d9492},'message':_0x293bbc(0x1cd)+_0x5d1230[_0x293bbc(0x1dd)]+_0x293bbc(0x1b9)+_0x5d836c['length']+_0x293bbc(0x1bb)+_0x3d9492[_0x293bbc(0x1dd)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x4fae7f,_0x5e4c80,_0x4c3b95){const _0x160cd5=a129_0xb7ea13;if(!_0x5e4c80||_0x5e4c80===_0x4c3b95)return;const _0x1965c1=join(_0x4fae7f['sqlRootDir'],_0x5e4c80);if(!await fileExists(_0x1965c1))return;const _0x2ed16b=await moveToTrash(_0x4fae7f[_0x160cd5(0x1b4)],_0x4fae7f[_0x160cd5(0x1dc)],_0x1965c1);await cleanupEmptyDirectories(dirname(_0x1965c1),_0x4fae7f[_0x160cd5(0x1c8)]),void _0x2ed16b;}function a129_0x1e99(){const _0x45b828=['set','577680rtuorp','bool','No\x20local\x20SQL\x20files\x20found.','38188PYAivh','sqlName','sqlRootDir','sqls','force','sqlCode','boolean','Push\x20complete:\x20','Local\x20directory\x20\x22','filePath','6813829hWlBjN','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','version','utf8','sqlRoot','join','path','Would\x20push\x20','sql','hash','Push\x20local\x20SQL\x20files\x20to\x20remote','\x20SQL\x20file(s)','trashDir','length','remoteId','502952WeFVGn','sqlcode','isFinite','12waNgDx','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','appCode','186578FutAIZ','POST','1MTfrHe','startsWith','sqlConfig','mode','\x22\x20for\x20sqlCode\x20','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','push','high-risk-write','Local\x20SQL\x20not\x20found:\x20','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','catch','entries','map','replace','validation','lockFilePath','dbName','relativePath','has','projectRoot','toISOString','1592091oljLpn','str','filter','\x20pushed,\x20','10Kvezdr','\x20skipped,\x20','/smartapi/custom/updateUserCustomSql','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','48yrmHuH','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','dbId','439685ODbdtA'];a129_0x1e99=function(){return _0x45b828;};return a129_0x1e99();}async function moveToTrash(_0xfaeeb3,_0x4b4a36,_0x370c31){const _0x2acfa2=a129_0xb7ea13,_0x5a5c62=new Date()[_0x2acfa2(0x1b5)]()[_0x2acfa2(0x1f4)](/[:.]/g,'-'),_0x8c9dde=relative(_0xfaeeb3,_0x370c31),_0x58e2e9=join(_0x4b4a36,_0x5a5c62,_0x8c9dde);return await mkdir(dirname(_0x58e2e9),{'recursive':!![]}),await rename(_0x370c31,_0x58e2e9),_0x58e2e9;}async function cleanupEmptyDirectories(_0x2f16fe,_0x10d08c){const _0x565e60=a129_0xb7ea13;let _0x13b3e7=resolve(_0x2f16fe);const _0x2bafd4=resolve(_0x10d08c);while(_0x13b3e7[_0x565e60(0x1e8)](''+_0x2bafd4+sep)||_0x13b3e7===_0x2bafd4){if(_0x13b3e7===_0x2bafd4)return;try{const _0x2c1baf=await readdir(_0x13b3e7);if(_0x2c1baf[_0x565e60(0x1dd)]>0x0)return;await rmdir(_0x13b3e7);}catch{return;}_0x13b3e7=dirname(_0x13b3e7);}}async function resolveTargetDbBinding(_0x2ad0ed,_0x277c7f,_0x181145){const _0xd844a7=a129_0xb7ea13,_0x2ef1db=_0x277c7f['dbDirectory'];if(!_0x2ef1db)return{'dbId':_0x181145[_0xd844a7(0x1c0)],'dbName':_0x181145[_0xd844a7(0x1b1)]};const _0xf8c380=buildDbDirectoryName(_0x181145[_0xd844a7(0x1b1)],_0x181145['dbId']);if(_0x2ef1db===_0xf8c380)return{'dbId':_0x181145[_0xd844a7(0x1c0)],'dbName':_0x181145['dbName']};const _0x1471ea=parseExplicitDbDirectory(_0x2ef1db);if(_0x1471ea!=null)return{'dbId':_0x1471ea,'dbName':await getDbName(_0x2ad0ed,_0x1471ea)['catch'](()=>undefined)};const _0x2fb4dd=await listDatabases(_0x2ad0ed),_0x52821a=_0x2fb4dd[_0xd844a7(0x1b8)](_0x137ad5=>buildDbDirectoryName(_0x137ad5['dbName'],_0x137ad5[_0xd844a7(0x1c0)])===_0x2ef1db);if(_0x52821a[_0xd844a7(0x1dd)]===0x1)return{'dbId':_0x52821a[0x0]['dbId'],'dbName':_0x52821a[0x0][_0xd844a7(0x1b1)]};if(_0x52821a[_0xd844a7(0x1dd)]===0x0)throw CliErrors[_0xd844a7(0x1f5)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x2ef1db+_0xd844a7(0x1eb)+_0x277c7f[_0xd844a7(0x1cb)]+'.');const _0x5cd09b=_0x52821a[_0xd844a7(0x1f3)](_0x47dd72=>_0x47dd72['dbName']+'\x20('+_0x47dd72['dbId']+')')[_0xd844a7(0x1d5)](',\x20');throw CliErrors[_0xd844a7(0x1f5)](_0xd844a7(0x1ce)+_0x2ef1db+_0xd844a7(0x1e3)+_0x277c7f['sqlCode']+':\x20'+_0x5cd09b);}function parseExplicitDbDirectory(_0x1ee2e8){const _0x165c2a=a129_0xb7ea13,_0x11c661=/^db-(\d+)$/['exec'](_0x1ee2e8);if(!_0x11c661)return null;const _0x1e0aa5=Number(_0x11c661[0x1]);return Number[_0x165c2a(0x1e1)](_0x1e0aa5)&&_0x1e0aa5>0x0?_0x1e0aa5:null;}
1
+ const a129_0x5c1252=a129_0x12e4;(function(_0x1bac51,_0x2f73da){const _0x3ddd33=a129_0x12e4,_0x53ed96=_0x1bac51();while(!![]){try{const _0xeb6d2=parseInt(_0x3ddd33(0x1a4))/0x1*(-parseInt(_0x3ddd33(0x1b7))/0x2)+-parseInt(_0x3ddd33(0x197))/0x3+-parseInt(_0x3ddd33(0x1ad))/0x4+-parseInt(_0x3ddd33(0x1d0))/0x5*(parseInt(_0x3ddd33(0x196))/0x6)+parseInt(_0x3ddd33(0x1c8))/0x7*(-parseInt(_0x3ddd33(0x1c2))/0x8)+-parseInt(_0x3ddd33(0x1c6))/0x9+parseInt(_0x3ddd33(0x1ce))/0xa;if(_0xeb6d2===_0x2f73da)break;else _0x53ed96['push'](_0x53ed96['shift']());}catch(_0x4b5f0b){_0x53ed96['push'](_0x53ed96['shift']());}}}(a129_0x2e77,0x26783));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0xdd8533,_0x975d80,_0x499635){const _0x457623=a129_0x12e4,_0x55b5cd=await scanLocalSqlQueries(_0xdd8533),_0x160f47=new Map();for(const _0x26b840 of _0x55b5cd){if(_0x499635&&_0x26b840['sqlCode']!==_0x499635)continue;const _0x57b39a=_0x160f47[_0x457623(0x1a0)](_0x26b840['sqlCode'])??[];_0x57b39a[_0x457623(0x1ae)](_0x26b840),_0x160f47[_0x457623(0x190)](_0x26b840[_0x457623(0x1ab)],_0x57b39a);}if(_0x499635&&!_0x160f47[_0x457623(0x18e)](_0x499635))throw CliErrors[_0x457623(0x1b0)](_0x457623(0x1a3)+_0x499635);const _0x4daff0=[];for(const [_0x134c6c,_0x1fbe87]of _0x160f47[_0x457623(0x1aa)]()){if(_0x1fbe87[_0x457623(0x1cf)]===0x1){_0x4daff0[_0x457623(0x1ae)](_0x1fbe87[0x0]);continue;}const _0x2d6a40=_0x975d80[_0x457623(0x18c)][_0x134c6c],_0x521d3a=_0x2d6a40?.[_0x457623(0x19f)],_0x15530a=_0x521d3a?_0x1fbe87[_0x457623(0x1a1)](_0x591c95=>_0x591c95[_0x457623(0x1ca)]!==_0x521d3a):_0x1fbe87;if(_0x2d6a40&&_0x15530a[_0x457623(0x1cf)]===0x1){_0x4daff0['push'](_0x15530a[0x0]);continue;}throw CliErrors[_0x457623(0x1b0)](_0x457623(0x1b2)+_0x134c6c+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x4daff0;}export const sqlPush={'service':a129_0x5c1252(0x1c9),'command':a129_0x5c1252(0x1ae),'description':a129_0x5c1252(0x1d1),'risk':a129_0x5c1252(0x1af),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a129_0x5c1252(0x1bb),'type':a129_0x5c1252(0x19c),'description':a129_0x5c1252(0x1b6)}],async 'dryRun'(_0x1741c8){const _0x588da6=a129_0x5c1252,_0x455862=loadSqlProjectConfig(_0x1741c8['appCode']),_0x232eab=await readSqlLockFile(_0x455862[_0x588da6(0x1cc)]),{appLock:_0x21bad8}=ensureSqlLockScope(_0x232eab??createEmptySqlLock(),_0x1741c8[_0x588da6(0x18a)],_0x455862[_0x588da6(0x1c7)],_0x588da6(0x1ae)),_0x36137f=await getTargetSqlQueries(_0x455862,_0x21bad8,_0x1741c8[_0x588da6(0x189)](_0x588da6(0x1b1))||undefined),_0x51d82e=[];for(const _0x454ee6 of _0x36137f){const _0x3d86cc=await computeSqlFileHash(_0x454ee6[_0x588da6(0x198)]),_0x1694a0=_0x21bad8[_0x588da6(0x18c)][_0x454ee6[_0x588da6(0x1ab)]],_0x424e1f=!!_0x1694a0&&(_0x1694a0[_0x588da6(0x19f)]!==_0x454ee6[_0x588da6(0x1ca)]||!!_0x454ee6[_0x588da6(0x1b9)]&&_0x1694a0[_0x588da6(0x1b9)]!==_0x454ee6[_0x588da6(0x1b9)]);if(!_0x1741c8[_0x588da6(0x1b4)](_0x588da6(0x1bb))&&_0x1694a0&&_0x1694a0[_0x588da6(0x194)]===_0x3d86cc&&!_0x424e1f)continue;_0x51d82e[_0x588da6(0x1ae)](_0x454ee6['sqlCode']);}return{'method':_0x588da6(0x1bc),'url':_0x588da6(0x1a9),'body':{'sqlCodes':_0x51d82e,'appCode':_0x1741c8['appCode']},'description':_0x588da6(0x1bf)+_0x51d82e[_0x588da6(0x1cf)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x4ab478){const _0xb5e8cc=a129_0x5c1252,_0x2fec91=loadSqlProjectConfig(_0x4ab478[_0xb5e8cc(0x18a)]),_0x21f3b7=await readSqlLockFile(_0x2fec91[_0xb5e8cc(0x1cc)]),{lockData:_0x1781c9,appLock:_0xbe3ad4}=ensureSqlLockScope(_0x21f3b7??createEmptySqlLock(),_0x4ab478[_0xb5e8cc(0x18a)],_0x2fec91[_0xb5e8cc(0x1c7)],_0xb5e8cc(0x1ae)),_0x4cd6c3=await getTargetSqlQueries(_0x2fec91,_0xbe3ad4,_0x4ab478[_0xb5e8cc(0x189)](_0xb5e8cc(0x1b1))||undefined);if(_0x4cd6c3[_0xb5e8cc(0x1cf)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0xb5e8cc(0x1c0)};const _0x57e800=[],_0x2e4265=[],_0x5115ca=[];for(const _0x2b432f of _0x4cd6c3){const _0xab24bd=_0xbe3ad4['sqls'][_0x2b432f['sqlCode']];if(!_0xab24bd){_0x5115ca[_0xb5e8cc(0x1ae)]({'sqlCode':_0x2b432f[_0xb5e8cc(0x1ab)],'error':_0xb5e8cc(0x1be)});continue;}try{const _0x181ae1=await computeSqlFileHash(_0x2b432f[_0xb5e8cc(0x198)]),_0x2395fd=_0xab24bd[_0xb5e8cc(0x19f)]!==_0x2b432f[_0xb5e8cc(0x1ca)]||!!_0x2b432f[_0xb5e8cc(0x1b9)]&&_0xab24bd[_0xb5e8cc(0x1b9)]!==_0x2b432f[_0xb5e8cc(0x1b9)];if(!_0x4ab478[_0xb5e8cc(0x1b4)](_0xb5e8cc(0x1bb))&&_0xab24bd[_0xb5e8cc(0x194)]===_0x181ae1&&!_0x2395fd){_0x2e4265[_0xb5e8cc(0x1ae)]({'sqlCode':_0x2b432f[_0xb5e8cc(0x1ab)],'reason':_0xb5e8cc(0x1b3)});continue;}if(_0xab24bd[_0xb5e8cc(0x19e)]==null){_0x5115ca[_0xb5e8cc(0x1ae)]({'sqlCode':_0x2b432f[_0xb5e8cc(0x1ab)],'error':_0xb5e8cc(0x193)});continue;}const _0x1f781a=await readFile(_0x2b432f[_0xb5e8cc(0x198)],_0xb5e8cc(0x1a5)),_0x59b621=stripLocalSqlMetadata(_0x1f781a,_0x2b432f[_0xb5e8cc(0x1b8)]),_0x24ea21=_0x2b432f[_0xb5e8cc(0x1b9)]||_0xab24bd['sqlName'],_0xe6e18b=await resolveTargetDbBinding(_0x4ab478['appCode'],_0x2b432f,_0xab24bd),_0x332261=await updateSqlQuery({'id':_0xab24bd[_0xb5e8cc(0x18b)],'appCode':_0x4ab478[_0xb5e8cc(0x18a)],'sqlCode':_0x2b432f['sqlCode'],'sqlName':_0x24ea21,'dbId':_0xe6e18b[_0xb5e8cc(0x1ba)],'version':_0xab24bd[_0xb5e8cc(0x19e)],'sqlContent':_0x59b621,'sqlConfig':_0xab24bd[_0xb5e8cc(0x1c1)]??undefined}),_0x499c40=_0x332261['dbId']?await getDbName(_0x4ab478[_0xb5e8cc(0x18a)],Number(_0x332261['dbId']))[_0xb5e8cc(0x1ac)](()=>_0xe6e18b[_0xb5e8cc(0x191)]):_0xe6e18b[_0xb5e8cc(0x191)];_0xbe3ad4[_0xb5e8cc(0x18c)][_0x2b432f[_0xb5e8cc(0x1ab)]]={...buildSqlLockEntry(_0x332261,_0x59b621,_0x181ae1,{'dbName':_0x499c40}),'path':_0x2b432f[_0xb5e8cc(0x1ca)],'mode':_0xab24bd['mode']},await archivePreviousSqlFileIfNeeded(_0x2fec91,_0xab24bd['path'],_0x2b432f[_0xb5e8cc(0x1ca)]),_0x57e800[_0xb5e8cc(0x1ae)]({'sqlCode':_0x2b432f[_0xb5e8cc(0x1ab)],'remoteId':_0xab24bd['remoteId']});}catch(_0x221a17){_0x5115ca[_0xb5e8cc(0x1ae)]({'sqlCode':_0x2b432f[_0xb5e8cc(0x1ab)],'error':_0x221a17 instanceof Error?_0x221a17[_0xb5e8cc(0x1a7)]:String(_0x221a17)});}}return _0xbe3ad4[_0xb5e8cc(0x199)]=new Date()[_0xb5e8cc(0x1cd)](),await writeSqlLockFile(_0x2fec91['lockFilePath'],_0x1781c9),{'ok':_0x5115ca[_0xb5e8cc(0x1cf)]===0x0,'data':{'pushed':_0x57e800,'skipped':_0x2e4265,'failed':_0x5115ca},'message':_0xb5e8cc(0x1a6)+_0x57e800['length']+'\x20pushed,\x20'+_0x2e4265[_0xb5e8cc(0x1cf)]+'\x20skipped,\x20'+_0x5115ca['length']+_0xb5e8cc(0x19b)};}};async function archivePreviousSqlFileIfNeeded(_0x5d2de2,_0x4ea180,_0x558a80){const _0x30f551=a129_0x5c1252;if(!_0x4ea180||_0x4ea180===_0x558a80)return;const _0x281f5e=join(_0x5d2de2[_0x30f551(0x18d)],_0x4ea180);if(!await fileExists(_0x281f5e))return;const _0x1cdf25=await moveToTrash(_0x5d2de2[_0x30f551(0x1a2)],_0x5d2de2[_0x30f551(0x1b5)],_0x281f5e);await cleanupEmptyDirectories(dirname(_0x281f5e),_0x5d2de2['sqlRootDir']),void _0x1cdf25;}async function moveToTrash(_0x47a974,_0x15d16c,_0x506062){const _0x2a82e3=a129_0x5c1252,_0x393785=new Date()['toISOString']()[_0x2a82e3(0x1cb)](/[:.]/g,'-'),_0x58beee=relative(_0x47a974,_0x506062),_0x51dc86=join(_0x15d16c,_0x393785,_0x58beee);return await mkdir(dirname(_0x51dc86),{'recursive':!![]}),await rename(_0x506062,_0x51dc86),_0x51dc86;}async function cleanupEmptyDirectories(_0x214ed4,_0x2a0f8e){const _0x12a9f3=a129_0x5c1252;let _0x48566a=resolve(_0x214ed4);const _0x56435f=resolve(_0x2a0f8e);while(_0x48566a[_0x12a9f3(0x1bd)](''+_0x56435f+sep)||_0x48566a===_0x56435f){if(_0x48566a===_0x56435f)return;try{const _0x1b8c26=await readdir(_0x48566a);if(_0x1b8c26[_0x12a9f3(0x1cf)]>0x0)return;await rmdir(_0x48566a);}catch{return;}_0x48566a=dirname(_0x48566a);}}async function resolveTargetDbBinding(_0x1d4d9b,_0x8ac4ad,_0x4d181a){const _0x1b3840=a129_0x5c1252,_0x596387=_0x8ac4ad[_0x1b3840(0x1c5)];if(!_0x596387)return{'dbId':_0x4d181a['dbId'],'dbName':_0x4d181a[_0x1b3840(0x191)]};const _0xda734=buildDbDirectoryName(_0x4d181a[_0x1b3840(0x191)],_0x4d181a[_0x1b3840(0x1ba)]);if(_0x596387===_0xda734)return{'dbId':_0x4d181a[_0x1b3840(0x1ba)],'dbName':_0x4d181a[_0x1b3840(0x191)]};const _0x596eec=parseExplicitDbDirectory(_0x596387);if(_0x596eec!=null)return{'dbId':_0x596eec,'dbName':await getDbName(_0x1d4d9b,_0x596eec)[_0x1b3840(0x1ac)](()=>undefined)};const _0x5dea56=await listDatabases(_0x1d4d9b),_0x23e84c=_0x5dea56[_0x1b3840(0x1a1)](_0x2b1a9f=>buildDbDirectoryName(_0x2b1a9f[_0x1b3840(0x191)],_0x2b1a9f[_0x1b3840(0x1ba)])===_0x596387);if(_0x23e84c[_0x1b3840(0x1cf)]===0x1)return{'dbId':_0x23e84c[0x0][_0x1b3840(0x1ba)],'dbName':_0x23e84c[0x0]['dbName']};if(_0x23e84c[_0x1b3840(0x1cf)]===0x0)throw CliErrors[_0x1b3840(0x1b0)](_0x1b3840(0x1c4)+_0x596387+_0x1b3840(0x1c3)+_0x8ac4ad[_0x1b3840(0x1ab)]+'.');const _0x4064bf=_0x23e84c[_0x1b3840(0x19d)](_0x5a58db=>_0x5a58db[_0x1b3840(0x191)]+'\x20('+_0x5a58db[_0x1b3840(0x1ba)]+')')[_0x1b3840(0x19a)](',\x20');throw CliErrors[_0x1b3840(0x1b0)](_0x1b3840(0x18f)+_0x596387+_0x1b3840(0x192)+_0x8ac4ad[_0x1b3840(0x1ab)]+':\x20'+_0x4064bf);}function a129_0x2e77(){const _0x58a808=['unchanged','bool','trashDir','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','101526povHHS','mode','sqlName','dbId','force','POST','startsWith','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','Would\x20push\x20','No\x20local\x20SQL\x20files\x20found.','sqlConfig','8QBRMmq','\x22\x20for\x20sqlCode\x20','No\x20database\x20matches\x20local\x20directory\x20\x22','dbDirectory','1036359pYXuUe','sqlRoot','164017lgTROI','sql','relativePath','replace','lockFilePath','toISOString','6028290zBcEsO','length','51215PtiXLS','Push\x20local\x20SQL\x20files\x20to\x20remote','str','appCode','remoteId','sqls','sqlRootDir','has','Local\x20directory\x20\x22','set','dbName','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','hash','isFinite','12zlaeUt','141549RZUUFj','filePath','lastSync','join','\x20failed','boolean','map','version','path','get','filter','projectRoot','Local\x20SQL\x20not\x20found:\x20','3jPFPfU','utf8','Push\x20complete:\x20','message','exec','/smartapi/custom/updateUserCustomSql','entries','sqlCode','catch','346872ZOthxJ','push','high-risk-write','validation','sqlcode','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'];a129_0x2e77=function(){return _0x58a808;};return a129_0x2e77();}function a129_0x12e4(_0x2947cd,_0x5d99e4){_0x2947cd=_0x2947cd-0x189;const _0x2e77ed=a129_0x2e77();let _0x12e48a=_0x2e77ed[_0x2947cd];return _0x12e48a;}function parseExplicitDbDirectory(_0x597bda){const _0x321d7e=a129_0x5c1252,_0x3c1eb0=/^db-(\d+)$/[_0x321d7e(0x1a8)](_0x597bda);if(!_0x3c1eb0)return null;const _0xfb6bb0=Number(_0x3c1eb0[0x1]);return Number[_0x321d7e(0x195)](_0xfb6bb0)&&_0xfb6bb0>0x0?_0xfb6bb0:null;}
@@ -1 +1 @@
1
- const a130_0x4650c3=a130_0x4acc;(function(_0x35103e,_0x4ba946){const _0x48a794=a130_0x4acc,_0x256986=_0x35103e();while(!![]){try{const _0x5ba814=-parseInt(_0x48a794(0x15d))/0x1+parseInt(_0x48a794(0x150))/0x2*(-parseInt(_0x48a794(0x156))/0x3)+parseInt(_0x48a794(0x151))/0x4*(parseInt(_0x48a794(0x15f))/0x5)+parseInt(_0x48a794(0x162))/0x6+parseInt(_0x48a794(0x152))/0x7*(-parseInt(_0x48a794(0x163))/0x8)+-parseInt(_0x48a794(0x15e))/0x9+parseInt(_0x48a794(0x164))/0xa;if(_0x5ba814===_0x4ba946)break;else _0x256986['push'](_0x256986['shift']());}catch(_0x21da71){_0x256986['push'](_0x256986['shift']());}}}(a130_0x121a,0x4fb75));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a130_0x4acc(_0x466a91,_0x106c4b){_0x466a91=_0x466a91-0x150;const _0x121afd=a130_0x121a();let _0x4acc79=_0x121afd[_0x466a91];return _0x4acc79;}function a130_0x121a(){const _0x53f37d=['sql','SQL\x20query\x20display\x20name','file','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','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`.','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','135214XRPrVi','214416aoXKOs','5VvwYcO','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','Path\x20to\x20the\x20SQL\x20file','87942KrSHDZ','3648yBgMUm','2726620AtBEwv','78WICNUL','1711700sQkhQd','399UgURLA','validation','write','string','15669Pvjrhl'];a130_0x121a=function(){return _0x53f37d;};return a130_0x121a();}const SQL_SAVE_DEPRECATED_HINT=[a130_0x4650c3(0x15c),'Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.',a130_0x4650c3(0x15b)]['join']('\x0a');export const sqlSave={'service':a130_0x4650c3(0x157),'command':'save','description':a130_0x4650c3(0x160),'risk':a130_0x4650c3(0x154),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a130_0x4650c3(0x159),'type':a130_0x4650c3(0x155),'required':!![],'description':a130_0x4650c3(0x161)},SQLCODE_FLAG_OPTIONAL,{'name':'sqlname','type':a130_0x4650c3(0x155),'description':a130_0x4650c3(0x158)},{'name':'db','type':a130_0x4650c3(0x155),'description':a130_0x4650c3(0x15a)},{'name':'description','type':a130_0x4650c3(0x155),'description':'Query\x20description'}],async 'validate'(){const _0x5aa31e=a130_0x4650c3;throw CliErrors[_0x5aa31e(0x153)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x4b5261=a130_0x4650c3;throw CliErrors[_0x4b5261(0x153)](SQL_SAVE_DEPRECATED_HINT);}};
1
+ const a130_0x470860=a130_0x3dfd;(function(_0x3144b4,_0xe18012){const _0x18d559=a130_0x3dfd,_0x27feb9=_0x3144b4();while(!![]){try{const _0x47d267=-parseInt(_0x18d559(0x18a))/0x1+parseInt(_0x18d559(0x185))/0x2+-parseInt(_0x18d559(0x182))/0x3*(parseInt(_0x18d559(0x184))/0x4)+-parseInt(_0x18d559(0x18d))/0x5*(-parseInt(_0x18d559(0x186))/0x6)+-parseInt(_0x18d559(0x18e))/0x7+parseInt(_0x18d559(0x195))/0x8+parseInt(_0x18d559(0x183))/0x9;if(_0x47d267===_0xe18012)break;else _0x27feb9['push'](_0x27feb9['shift']());}catch(_0x2c7447){_0x27feb9['push'](_0x27feb9['shift']());}}}(a130_0xbd63,0xe1fa4));import{CliErrors}from'../../errors.js';function a130_0xbd63(){const _0xebb1fa=['sql','10jlBiWc','10750257SRciEq','string','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','join','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','Query\x20description','validation','120968SVqWLP','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','2199NFcjuw','38276424EMgLLe','6196KMZGbD','1202048OmEkGC','1527624VKKtMF','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','Path\x20to\x20the\x20SQL\x20file','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`.','1781517zPkcTu','description'];a130_0xbd63=function(){return _0xebb1fa;};return a130_0xbd63();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a130_0x3dfd(_0x4da1b2,_0x3e0580){_0x4da1b2=_0x4da1b2-0x182;const _0xbd6398=a130_0xbd63();let _0x3dfde8=_0xbd6398[_0x4da1b2];return _0x3dfde8;}const SQL_SAVE_DEPRECATED_HINT=[a130_0x470860(0x190),a130_0x470860(0x196),a130_0x470860(0x189)][a130_0x470860(0x191)]('\x0a');export const sqlSave={'service':a130_0x470860(0x18c),'command':'save','description':a130_0x470860(0x192),'risk':'write','requiresAuth':![],'requiresAppCode':![],'flags':[{'name':'file','type':a130_0x470860(0x18f),'required':!![],'description':a130_0x470860(0x188)},SQLCODE_FLAG_OPTIONAL,{'name':'sqlname','type':'string','description':'SQL\x20query\x20display\x20name'},{'name':'db','type':'string','description':a130_0x470860(0x187)},{'name':a130_0x470860(0x18b),'type':'string','description':a130_0x470860(0x193)}],async 'validate'(){const _0x58038d=a130_0x470860;throw CliErrors[_0x58038d(0x194)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);}};
@@ -1 +1 @@
1
- (function(_0x426c22,_0x3dfe4c){const _0x249fa5=a131_0x2a15,_0x3899a4=_0x426c22();while(!![]){try{const _0x1d086e=parseInt(_0x249fa5(0x103))/0x1+parseInt(_0x249fa5(0x11d))/0x2+-parseInt(_0x249fa5(0x11f))/0x3*(parseInt(_0x249fa5(0xfc))/0x4)+-parseInt(_0x249fa5(0x126))/0x5*(parseInt(_0x249fa5(0x123))/0x6)+parseInt(_0x249fa5(0x11a))/0x7+-parseInt(_0x249fa5(0x10b))/0x8+-parseInt(_0x249fa5(0x112))/0x9;if(_0x1d086e===_0x3dfe4c)break;else _0x3899a4['push'](_0x3899a4['shift']());}catch(_0x1cbd8b){_0x3899a4['push'](_0x3899a4['shift']());}}}(a131_0x2a2d,0x29fb2));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x231375,_0x15aea3,_0x2c161f,_0x38b3b7){const _0x3677be=a131_0x2a15,_0x1ec040=detectSqlMode(_0x15aea3);return{'path':buildSqlRelativePath(_0x231375[_0x3677be(0x106)],_0x231375[_0x3677be(0x115)],_0x38b3b7?.['dbName'],_0x1ec040,_0x231375['dbId']),'hash':_0x2c161f,'remoteId':_0x231375['id'],'version':_0x231375[_0x3677be(0x107)],'dbId':Number(_0x231375[_0x3677be(0x100)]),'dbName':_0x38b3b7?.[_0x3677be(0x10e)],'sqlName':_0x231375[_0x3677be(0x115)],'sqlConfig':_0x231375[_0x3677be(0x117)]??undefined,'mode':_0x1ec040};}export function cloneSqlLockData(_0x286275){const _0x8be37c=a131_0x2a15;return{'apps':Object[_0x8be37c(0x125)](Object[_0x8be37c(0xfe)](_0x286275[_0x8be37c(0x11b)])['map'](([_0x464730,_0x144861])=>[_0x464730,{'sqlRoot':_0x144861[_0x8be37c(0x11c)],'lastSync':_0x144861[_0x8be37c(0x111)],'sqls':{..._0x144861['sqls']}}]))};}export function ensureRemoteSqlContent(_0x432eb7){return _0x432eb7['sqlContent']??'';}export function buildLocalSqlFileContent(_0x178fff,_0xaa1bec,_0x247a41){const _0x33268b=a131_0x2a15,_0x1b6d14=_0x247a41?.[_0x33268b(0x124)]??detectSqlMode(_0xaa1bec),_0x4bd41b=stripLocalSqlMetadata(_0xaa1bec,_0x1b6d14)[_0x33268b(0xff)](),_0x53039b=[...buildMetadataHeaderLines({'sqlCode':_0x178fff['sqlCode'],'sqlName':_0x178fff[_0x33268b(0x115)],'dbId':_0x178fff[_0x33268b(0x100)],'dbName':_0x247a41?.[_0x33268b(0x10e)],'mode':_0x1b6d14,'syncedAt':_0x247a41?.[_0x33268b(0x110)],'description':_0x247a41?.[_0x33268b(0x104)]},_0x1b6d14),'',_0x4bd41b],_0x4ec157=_0x53039b[_0x33268b(0x10f)]('\x0a');return _0x4ec157['endsWith']('\x0a')?_0x4ec157:_0x4ec157+'\x0a';}export function stripLocalSqlMetadata(_0x3b2467,_0x46a261){const _0x1dcdfc=a131_0x2a15,_0x4541f8=_0x3b2467[_0x1dcdfc(0x10c)](/\r\n/g,'\x0a')[_0x1dcdfc(0x108)]('\x0a'),_0x127d00=[];let _0x3434e4=0x0;if(_0x46a261===_0x1dcdfc(0x102))while(_0x3434e4<_0x4541f8[_0x1dcdfc(0x119)]){const _0x5db850=_0x4541f8[_0x3434e4]??'';if(/^\s*<!--\s*@lovrabet\./[_0x1dcdfc(0x121)](_0x5db850)){_0x3434e4++;continue;}if(_0x5db850[_0x1dcdfc(0xff)]()===''&&_0x3434e4>0x0){_0x3434e4++;continue;}break;}else while(_0x3434e4<_0x4541f8['length']){const _0x357f64=_0x4541f8[_0x3434e4]??'';if(/^\s*--\s*@lovrabet\./[_0x1dcdfc(0x121)](_0x357f64)){_0x3434e4++;continue;}if(_0x357f64[_0x1dcdfc(0xff)]()===''&&_0x3434e4>0x0){_0x3434e4++;continue;}break;}for(;_0x3434e4<_0x4541f8['length'];_0x3434e4++){_0x127d00[_0x1dcdfc(0x10a)](_0x4541f8[_0x3434e4]);}return _0x127d00[_0x1dcdfc(0x10f)]('\x0a')['trimStart']();}export function resolveSqlMode(_0x442a53,_0x3d7903){const _0x4745ef=a131_0x2a15;if(_0x3d7903?.[_0x4745ef(0x124)])return _0x3d7903[_0x4745ef(0x124)];return detectSqlMode(_0x442a53);}function a131_0x2a2d(){const _0x52b101=['sqlCode','version','split','filter','push','694728fzPcYs','replace','stdin','dbName','join','syncedAt','lastSync','1215108YMIygL','\x20[y/N]\x20','stderr','sqlName','question','sqlConfig','\x20-->','length','2053219Dicthn','apps','sqlRoot','126386rLntxL','path','5913BQMYbx','--\x20@lovrabet.','test','toLowerCase','6UkrycJ','mode','fromEntries','459470cQARtj','52nbqpmI','includes','entries','trim','dbId','yes','mybatisXml','154814jEhulB','description','map'];a131_0x2a2d=function(){return _0x52b101;};return a131_0x2a2d();}export function resolveSqlFileName(_0x5413b5,_0x348b52,_0x4546ba){const _0x37c3f3=a131_0x2a15;if(_0x4546ba?.[_0x37c3f3(0x11e)])return _0x4546ba[_0x37c3f3(0x11e)];if(_0x4546ba?.[_0x37c3f3(0x115)]||_0x4546ba?.['dbName'])return buildSqlRelativePath(_0x5413b5,_0x4546ba?.[_0x37c3f3(0x115)],_0x4546ba?.[_0x37c3f3(0x10e)],resolveSqlMode(_0x348b52,_0x4546ba),_0x4546ba?.[_0x37c3f3(0x100)]);return buildDefaultSqlFileName(_0x5413b5,resolveSqlMode(_0x348b52,_0x4546ba));}export function resolveSqlLocalDir(_0x977f6f,_0x11a404){return join(_0x977f6f,SQL_LOCAL_REL_DIR,_0x11a404);}export async function confirmForceOverwrite(_0x42ec19){const _0x4ecd7d=a131_0x2a15,_0x4e3e71=createInterface({'input':process[_0x4ecd7d(0x10d)],'output':process[_0x4ecd7d(0x114)]}),_0x50e7de=await new Promise(_0x27c373=>{const _0x1f0906=_0x4ecd7d;_0x4e3e71[_0x1f0906(0x116)](_0x42ec19+_0x1f0906(0x113),_0x27c373);});return _0x4e3e71['close'](),['y',_0x4ecd7d(0x101)][_0x4ecd7d(0xfd)](_0x50e7de[_0x4ecd7d(0xff)]()[_0x4ecd7d(0x122)]());}export function findSqlLockScope(_0x5b9736,_0x1cc046){const _0x484b3a=a131_0x2a15;return _0x5b9736[_0x484b3a(0x11b)][_0x1cc046];}function a131_0x2a15(_0x41fdae,_0x261871){_0x41fdae=_0x41fdae-0xfc;const _0x2a2d28=a131_0x2a2d();let _0x2a15fe=_0x2a2d28[_0x41fdae];return _0x2a15fe;}function buildMetadataHeaderLines(_0x204910,_0x25200e){const _0x5ab563=a131_0x2a15,_0x53cb83=[[_0x5ab563(0x106),_0x204910[_0x5ab563(0x106)]],[_0x5ab563(0x115),_0x204910['sqlName']],[_0x5ab563(0x100),_0x204910[_0x5ab563(0x100)]],['dbName',_0x204910[_0x5ab563(0x10e)]],['mode',_0x204910[_0x5ab563(0x124)]],[_0x5ab563(0x110),_0x204910[_0x5ab563(0x110)]],[_0x5ab563(0x104),_0x204910[_0x5ab563(0x104)]]];if(_0x25200e===_0x5ab563(0x102))return _0x53cb83['filter'](([,_0x249a11])=>_0x249a11!==undefined&&_0x249a11!==null&&String(_0x249a11)[_0x5ab563(0xff)]()!=='')['map'](([_0x5b1092,_0x247a0f])=>'<!--\x20@lovrabet.'+_0x5b1092+':\x20'+String(_0x247a0f)+_0x5ab563(0x118));return _0x53cb83[_0x5ab563(0x109)](([,_0x22755f])=>_0x22755f!==undefined&&_0x22755f!==null&&String(_0x22755f)[_0x5ab563(0xff)]()!=='')[_0x5ab563(0x105)](([_0x2b0051,_0x3953fd])=>_0x5ab563(0x120)+_0x2b0051+':\x20'+String(_0x3953fd));}
1
+ function a131_0x7d01(){const _0x3178b8=['21JNKQaR','syncedAt','<!--\x20@lovrabet.','apps','.rabetbase/sql','dbId','yes','115hLlvsp','sqlContent','test','32911kMJSBZ','push','29106636mBPcry','1686vKVZQv','toLowerCase','stdin','filter','stderr','sqlRoot','mybatisXml','path','mode','--\x20@lovrabet.','13UvYurR','map','version','lastSync','\x20-->','trimStart','sqlConfig','3703077HPxedH','join','125082blVZlk','includes','length','sqlCode','description','sqlName','dbName','3124iwOebC','3156530NRttSC','33EoYZhi','replace','split','close','36YLASzu','2114936vAwYqJ','trim','endsWith'];a131_0x7d01=function(){return _0x3178b8;};return a131_0x7d01();}const a131_0x56d521=a131_0x22ab;(function(_0xe6379f,_0x4e55bf){const _0x3d95cb=a131_0x22ab,_0x4e16d4=_0xe6379f();while(!![]){try{const _0x355bc7=-parseInt(_0x3d95cb(0x177))/0x1*(parseInt(_0x3d95cb(0x169))/0x2)+-parseInt(_0x3d95cb(0x17a))/0x3*(-parseInt(_0x3d95cb(0x163))/0x4)+-parseInt(_0x3d95cb(0x174))/0x5*(-parseInt(_0x3d95cb(0x15c))/0x6)+-parseInt(_0x3d95cb(0x16d))/0x7*(parseInt(_0x3d95cb(0x16a))/0x8)+-parseInt(_0x3d95cb(0x15a))/0x9+-parseInt(_0x3d95cb(0x164))/0xa*(parseInt(_0x3d95cb(0x165))/0xb)+parseInt(_0x3d95cb(0x179))/0xc*(parseInt(_0x3d95cb(0x153))/0xd);if(_0x355bc7===_0x4e55bf)break;else _0x4e16d4['push'](_0x4e16d4['shift']());}catch(_0x17228b){_0x4e16d4['push'](_0x4e16d4['shift']());}}}(a131_0x7d01,0x927ed));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=a131_0x56d521(0x171);export function buildSqlLockEntry(_0x375998,_0x2b1b9c,_0x16ef85,_0x567332){const _0x2cfbdf=a131_0x56d521,_0x20d78e=detectSqlMode(_0x2b1b9c);return{'path':buildSqlRelativePath(_0x375998[_0x2cfbdf(0x15f)],_0x375998[_0x2cfbdf(0x161)],_0x567332?.[_0x2cfbdf(0x162)],_0x20d78e,_0x375998[_0x2cfbdf(0x172)]),'hash':_0x16ef85,'remoteId':_0x375998['id'],'version':_0x375998[_0x2cfbdf(0x155)],'dbId':Number(_0x375998[_0x2cfbdf(0x172)]),'dbName':_0x567332?.[_0x2cfbdf(0x162)],'sqlName':_0x375998['sqlName'],'sqlConfig':_0x375998[_0x2cfbdf(0x159)]??undefined,'mode':_0x20d78e};}export function cloneSqlLockData(_0xbf7ebf){const _0x3b85e0=a131_0x56d521;return{'apps':Object['fromEntries'](Object['entries'](_0xbf7ebf[_0x3b85e0(0x170)])[_0x3b85e0(0x154)](([_0x597e1d,_0x3d75bb])=>[_0x597e1d,{'sqlRoot':_0x3d75bb[_0x3b85e0(0x17f)],'lastSync':_0x3d75bb[_0x3b85e0(0x156)],'sqls':{..._0x3d75bb['sqls']}}]))};}export function ensureRemoteSqlContent(_0x3c5a42){const _0x5b681b=a131_0x56d521;return _0x3c5a42[_0x5b681b(0x175)]??'';}export function buildLocalSqlFileContent(_0x2bfc1a,_0x552ff3,_0x33948c){const _0x7cbc26=a131_0x56d521,_0x1228f4=_0x33948c?.[_0x7cbc26(0x151)]??detectSqlMode(_0x552ff3),_0x4a3176=stripLocalSqlMetadata(_0x552ff3,_0x1228f4)[_0x7cbc26(0x16b)](),_0x2d26fb=[...buildMetadataHeaderLines({'sqlCode':_0x2bfc1a['sqlCode'],'sqlName':_0x2bfc1a[_0x7cbc26(0x161)],'dbId':_0x2bfc1a[_0x7cbc26(0x172)],'dbName':_0x33948c?.[_0x7cbc26(0x162)],'mode':_0x1228f4,'syncedAt':_0x33948c?.[_0x7cbc26(0x16e)],'description':_0x33948c?.[_0x7cbc26(0x160)]},_0x1228f4),'',_0x4a3176],_0x4e0c57=_0x2d26fb[_0x7cbc26(0x15b)]('\x0a');return _0x4e0c57[_0x7cbc26(0x16c)]('\x0a')?_0x4e0c57:_0x4e0c57+'\x0a';}export function stripLocalSqlMetadata(_0x1da4b4,_0x194752){const _0x4f49a2=a131_0x56d521,_0x4b0fab=_0x1da4b4[_0x4f49a2(0x166)](/\r\n/g,'\x0a')[_0x4f49a2(0x167)]('\x0a'),_0x82a832=[];let _0x54bed8=0x0;if(_0x194752===_0x4f49a2(0x180))while(_0x54bed8<_0x4b0fab[_0x4f49a2(0x15e)]){const _0x1f97d7=_0x4b0fab[_0x54bed8]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x1f97d7)){_0x54bed8++;continue;}if(_0x1f97d7[_0x4f49a2(0x16b)]()===''&&_0x54bed8>0x0){_0x54bed8++;continue;}break;}else while(_0x54bed8<_0x4b0fab[_0x4f49a2(0x15e)]){const _0x137b37=_0x4b0fab[_0x54bed8]??'';if(/^\s*--\s*@lovrabet\./[_0x4f49a2(0x176)](_0x137b37)){_0x54bed8++;continue;}if(_0x137b37[_0x4f49a2(0x16b)]()===''&&_0x54bed8>0x0){_0x54bed8++;continue;}break;}for(;_0x54bed8<_0x4b0fab[_0x4f49a2(0x15e)];_0x54bed8++){_0x82a832[_0x4f49a2(0x178)](_0x4b0fab[_0x54bed8]);}return _0x82a832[_0x4f49a2(0x15b)]('\x0a')[_0x4f49a2(0x158)]();}export function resolveSqlMode(_0x410887,_0x74c804){const _0x1201b0=a131_0x56d521;if(_0x74c804?.['mode'])return _0x74c804[_0x1201b0(0x151)];return detectSqlMode(_0x410887);}export function resolveSqlFileName(_0x56051d,_0xfcf3cb,_0x22220b){const _0x572543=a131_0x56d521;if(_0x22220b?.[_0x572543(0x150)])return _0x22220b[_0x572543(0x150)];if(_0x22220b?.[_0x572543(0x161)]||_0x22220b?.['dbName'])return buildSqlRelativePath(_0x56051d,_0x22220b?.[_0x572543(0x161)],_0x22220b?.['dbName'],resolveSqlMode(_0xfcf3cb,_0x22220b),_0x22220b?.[_0x572543(0x172)]);return buildDefaultSqlFileName(_0x56051d,resolveSqlMode(_0xfcf3cb,_0x22220b));}export function resolveSqlLocalDir(_0x5c5d32,_0x3da1c7){return join(_0x5c5d32,SQL_LOCAL_REL_DIR,_0x3da1c7);}function a131_0x22ab(_0x3bb8ee,_0x16f462){_0x3bb8ee=_0x3bb8ee-0x150;const _0x7d01f2=a131_0x7d01();let _0x22abc1=_0x7d01f2[_0x3bb8ee];return _0x22abc1;}export async function confirmForceOverwrite(_0x34aae5){const _0x4da06f=a131_0x56d521,_0x3f9ac3=createInterface({'input':process[_0x4da06f(0x17c)],'output':process[_0x4da06f(0x17e)]}),_0x30d950=await new Promise(_0x385202=>{_0x3f9ac3['question'](_0x34aae5+'\x20[y/N]\x20',_0x385202);});return _0x3f9ac3[_0x4da06f(0x168)](),['y',_0x4da06f(0x173)][_0x4da06f(0x15d)](_0x30d950['trim']()[_0x4da06f(0x17b)]());}export function findSqlLockScope(_0x20573c,_0x5456d6){const _0x59590a=a131_0x56d521;return _0x20573c[_0x59590a(0x170)][_0x5456d6];}function buildMetadataHeaderLines(_0x460d2c,_0xce4e2f){const _0x586a17=a131_0x56d521,_0x248126=[[_0x586a17(0x15f),_0x460d2c[_0x586a17(0x15f)]],[_0x586a17(0x161),_0x460d2c[_0x586a17(0x161)]],[_0x586a17(0x172),_0x460d2c['dbId']],[_0x586a17(0x162),_0x460d2c[_0x586a17(0x162)]],[_0x586a17(0x151),_0x460d2c['mode']],[_0x586a17(0x16e),_0x460d2c['syncedAt']],[_0x586a17(0x160),_0x460d2c[_0x586a17(0x160)]]];if(_0xce4e2f===_0x586a17(0x180))return _0x248126[_0x586a17(0x17d)](([,_0xeb80fc])=>_0xeb80fc!==undefined&&_0xeb80fc!==null&&String(_0xeb80fc)[_0x586a17(0x16b)]()!=='')[_0x586a17(0x154)](([_0x35fb9d,_0x30aedb])=>_0x586a17(0x16f)+_0x35fb9d+':\x20'+String(_0x30aedb)+_0x586a17(0x157));return _0x248126['filter'](([,_0xa9698d])=>_0xa9698d!==undefined&&_0xa9698d!==null&&String(_0xa9698d)['trim']()!=='')[_0x586a17(0x154)](([_0x259af4,_0x360f9f])=>_0x586a17(0x152)+_0x259af4+':\x20'+String(_0x360f9f));}
@@ -1 +1 @@
1
- const a132_0x194053=a132_0x29df;(function(_0x59cba7,_0x2ab77c){const _0x4e7d21=a132_0x29df,_0x5227f2=_0x59cba7();while(!![]){try{const _0x234d82=parseInt(_0x4e7d21(0x142))/0x1+parseInt(_0x4e7d21(0x141))/0x2+-parseInt(_0x4e7d21(0x124))/0x3*(-parseInt(_0x4e7d21(0x129))/0x4)+parseInt(_0x4e7d21(0x122))/0x5+-parseInt(_0x4e7d21(0x13a))/0x6+parseInt(_0x4e7d21(0x13d))/0x7*(parseInt(_0x4e7d21(0x12f))/0x8)+-parseInt(_0x4e7d21(0x128))/0x9;if(_0x234d82===_0x2ab77c)break;else _0x5227f2['push'](_0x5227f2['shift']());}catch(_0x364828){_0x5227f2['push'](_0x5227f2['shift']());}}}(a132_0x1ef3,0x712a3));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a132_0x29df(_0x2e2bbf,_0x473f04){_0x2e2bbf=_0x2e2bbf-0x122;const _0x1ef3cb=a132_0x1ef3();let _0x29df39=_0x1ef3cb[_0x2e2bbf];return _0x29df39;}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a132_0x1ef3(){const _0x27c79b=['888FfeegV','sqls','totalCount','bool','lockFilePath','filePath','path','hash','\x20modified,\x20','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','sqlRoot','3938862jqgfHC','remote','\x20missing,\x20','10087lZQyhA','sqlName','tableData','length','1328834IPRUjP','139910JWmSia','\x20remote-only','read','460490ZitnaU','map','213zerDRi','sqlCode','has','lockKey','1561644CLYaKs','13360asHFpE','appCode','boolean','sql','push','status'];a132_0x1ef3=function(){return _0x27c79b;};return a132_0x1ef3();}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x3b6b78){const _0x5ac724=a132_0x29df,_0x126563=[];let _0x1ebcc3=0x1;while(!![]){const _0xb766c1=await listSqlQueries(_0x3b6b78,{'currentPage':_0x1ebcc3,'pageSize':PAGE_SIZE}),_0x184a56=_0xb766c1[_0x5ac724(0x13f)]??[];_0x126563['push'](..._0x184a56[_0x5ac724(0x123)](_0x307cef=>_0x307cef[_0x5ac724(0x125)]));if(_0x184a56['length']===0x0)break;const _0x3f9f63=_0xb766c1['paging']?.[_0x5ac724(0x131)];if(_0x3f9f63!=null?_0x126563[_0x5ac724(0x140)]>=_0x3f9f63:_0x184a56[_0x5ac724(0x140)]<PAGE_SIZE)break;_0x1ebcc3++;}return _0x126563;}export const sqlStatus={'service':a132_0x194053(0x12c),'command':a132_0x194053(0x12e),'description':a132_0x194053(0x138),'risk':a132_0x194053(0x144),'flags':[{'name':a132_0x194053(0x13b),'type':a132_0x194053(0x12b),'description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0x205e13){const _0x14fea2=a132_0x194053,_0x99a5b2=loadSqlProjectConfig(_0x205e13[_0x14fea2(0x12a)]),_0x242289=await readSqlLockFile(_0x99a5b2[_0x14fea2(0x133)]),{appLock:_0x57a8b7}=ensureSqlLockScope(_0x242289??createEmptySqlLock(),_0x99a5b2[_0x14fea2(0x12a)],_0x99a5b2[_0x14fea2(0x139)],_0x14fea2(0x12e)),_0x1464db=await scanLocalSqlQueries(_0x99a5b2),_0x45938f=[],_0x344c40=[],_0x2bdd92=[],_0xefcb33=[],_0x2e21e6=new Set(_0x1464db[_0x14fea2(0x123)](_0x3f4c52=>_0x3f4c52[_0x14fea2(0x127)]));for(const _0x3b44ae of _0x1464db){const _0x185424=await computeSqlFileHash(_0x3b44ae[_0x14fea2(0x134)]),_0x919762=_0x57a8b7[_0x14fea2(0x130)][_0x3b44ae[_0x14fea2(0x127)]],_0x43f61a=!!_0x919762&&_0x919762[_0x14fea2(0x135)]!==_0x3b44ae['relativePath'],_0x45ba2e=!!_0x919762&&!!_0x3b44ae[_0x14fea2(0x13e)]&&_0x919762[_0x14fea2(0x13e)]!==_0x3b44ae[_0x14fea2(0x13e)];if(!_0x919762)_0x45938f[_0x14fea2(0x12d)](_0x3b44ae['lockKey']);else _0x919762[_0x14fea2(0x136)]!==_0x185424||_0x43f61a||_0x45ba2e?_0x344c40[_0x14fea2(0x12d)](_0x3b44ae[_0x14fea2(0x127)]):_0x2bdd92[_0x14fea2(0x12d)](_0x3b44ae['lockKey']);}for(const _0x451315 of Object['keys'](_0x57a8b7[_0x14fea2(0x130)])){!_0x2e21e6['has'](_0x451315)&&_0xefcb33[_0x14fea2(0x12d)](_0x451315);}const _0x410bc5=[];if(_0x205e13[_0x14fea2(0x132)](_0x14fea2(0x13b))){const _0xd5b0a9=await fetchAllSqlCodes(_0x205e13[_0x14fea2(0x12a)]);for(const _0x42b47a of _0xd5b0a9){!_0x2e21e6[_0x14fea2(0x126)](_0x42b47a)&&!_0x57a8b7[_0x14fea2(0x130)][_0x42b47a]&&_0x410bc5[_0x14fea2(0x12d)](_0x42b47a);}}const _0x8a4e84=_0x45938f[_0x14fea2(0x140)]===0x0&&_0x344c40[_0x14fea2(0x140)]===0x0&&_0xefcb33['length']===0x0&&_0x410bc5[_0x14fea2(0x140)]===0x0;return{'ok':!![],'data':{'added':_0x45938f,'modified':_0x344c40,'missing':_0xefcb33,'unchanged':_0x2bdd92,'remoteOnly':_0x410bc5},'message':_0x8a4e84?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x45938f['length']+'\x20added,\x20'+_0x344c40[_0x14fea2(0x140)]+_0x14fea2(0x137)+_0xefcb33['length']+_0x14fea2(0x13c)+_0x2bdd92[_0x14fea2(0x140)]+'\x20unchanged'+(_0x410bc5[_0x14fea2(0x140)]>0x0?',\x20'+_0x410bc5[_0x14fea2(0x140)]+_0x14fea2(0x143):'')};}};
1
+ const a132_0x5864c9=a132_0x4d63;(function(_0x47d3a4,_0xc69c7e){const _0xb4988=a132_0x4d63,_0x44bd0d=_0x47d3a4();while(!![]){try{const _0x573a95=-parseInt(_0xb4988(0x1de))/0x1*(parseInt(_0xb4988(0x1e7))/0x2)+-parseInt(_0xb4988(0x1e9))/0x3+parseInt(_0xb4988(0x1d3))/0x4*(-parseInt(_0xb4988(0x1ea))/0x5)+-parseInt(_0xb4988(0x1e2))/0x6+-parseInt(_0xb4988(0x1f2))/0x7+-parseInt(_0xb4988(0x1d8))/0x8+parseInt(_0xb4988(0x1d9))/0x9;if(_0x573a95===_0xc69c7e)break;else _0x44bd0d['push'](_0x44bd0d['shift']());}catch(_0x531325){_0x44bd0d['push'](_0x44bd0d['shift']());}}}(a132_0x1cd9,0x2916d));function a132_0x4d63(_0x11ebee,_0x4238c1){_0x11ebee=_0x11ebee-0x1cf;const _0x1cd9ce=a132_0x1cd9();let _0x4d63de=_0x1cd9ce[_0x11ebee];return _0x4d63de;}import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;function a132_0x1cd9(){const _0x12495d=['\x20missing,\x20','1849120KfHXwD','7129836iRqxMN','All\x20SQL\x20queries\x20are\x20in\x20sync.','read','filePath','has','2082eSZVQB','sqls','push','keys','683364AKzTka','bool','lockFilePath','lockKey','\x20unchanged','4qvzsKs','remote','185199IJbzlK','274095idxYFp','sqlName','\x20added,\x20','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','sqlCode','relativePath','length','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','1107071GBoQpM','totalCount','sql','appCode','sqlRoot','4SrZpNP','paging','hash','tableData'];a132_0x1cd9=function(){return _0x12495d;};return a132_0x1cd9();}async function fetchAllSqlCodes(_0x24c581){const _0x5dc622=a132_0x4d63,_0x38804b=[];let _0x2cd9cc=0x1;while(!![]){const _0x5bb82a=await listSqlQueries(_0x24c581,{'currentPage':_0x2cd9cc,'pageSize':PAGE_SIZE}),_0x21e8be=_0x5bb82a[_0x5dc622(0x1d6)]??[];_0x38804b['push'](..._0x21e8be['map'](_0x797f97=>_0x797f97[_0x5dc622(0x1ee)]));if(_0x21e8be[_0x5dc622(0x1f0)]===0x0)break;const _0x336096=_0x5bb82a[_0x5dc622(0x1d4)]?.[_0x5dc622(0x1cf)];if(_0x336096!=null?_0x38804b['length']>=_0x336096:_0x21e8be[_0x5dc622(0x1f0)]<PAGE_SIZE)break;_0x2cd9cc++;}return _0x38804b;}export const sqlStatus={'service':a132_0x5864c9(0x1d0),'command':'status','description':a132_0x5864c9(0x1ed),'risk':a132_0x5864c9(0x1db),'flags':[{'name':a132_0x5864c9(0x1e8),'type':'boolean','description':a132_0x5864c9(0x1f1)}],async 'execute'(_0x17a351){const _0x1c893e=a132_0x5864c9,_0x462465=loadSqlProjectConfig(_0x17a351[_0x1c893e(0x1d1)]),_0x38a864=await readSqlLockFile(_0x462465[_0x1c893e(0x1e4)]),{appLock:_0x5c794a}=ensureSqlLockScope(_0x38a864??createEmptySqlLock(),_0x462465[_0x1c893e(0x1d1)],_0x462465[_0x1c893e(0x1d2)],'status'),_0x2d285a=await scanLocalSqlQueries(_0x462465),_0x20982d=[],_0x5e1cc3=[],_0x35ea37=[],_0xd3ff71=[],_0x5237ac=new Set(_0x2d285a['map'](_0x42befd=>_0x42befd[_0x1c893e(0x1e5)]));for(const _0x3d2fe5 of _0x2d285a){const _0x3e8f6d=await computeSqlFileHash(_0x3d2fe5[_0x1c893e(0x1dc)]),_0x378bde=_0x5c794a[_0x1c893e(0x1df)][_0x3d2fe5[_0x1c893e(0x1e5)]],_0x3f562d=!!_0x378bde&&_0x378bde['path']!==_0x3d2fe5[_0x1c893e(0x1ef)],_0x580c62=!!_0x378bde&&!!_0x3d2fe5['sqlName']&&_0x378bde['sqlName']!==_0x3d2fe5[_0x1c893e(0x1eb)];if(!_0x378bde)_0x20982d[_0x1c893e(0x1e0)](_0x3d2fe5[_0x1c893e(0x1e5)]);else _0x378bde[_0x1c893e(0x1d5)]!==_0x3e8f6d||_0x3f562d||_0x580c62?_0x5e1cc3[_0x1c893e(0x1e0)](_0x3d2fe5[_0x1c893e(0x1e5)]):_0x35ea37[_0x1c893e(0x1e0)](_0x3d2fe5[_0x1c893e(0x1e5)]);}for(const _0x56557c of Object[_0x1c893e(0x1e1)](_0x5c794a['sqls'])){!_0x5237ac[_0x1c893e(0x1dd)](_0x56557c)&&_0xd3ff71[_0x1c893e(0x1e0)](_0x56557c);}const _0xdb530e=[];if(_0x17a351[_0x1c893e(0x1e3)](_0x1c893e(0x1e8))){const _0x122021=await fetchAllSqlCodes(_0x17a351[_0x1c893e(0x1d1)]);for(const _0x5280a1 of _0x122021){!_0x5237ac[_0x1c893e(0x1dd)](_0x5280a1)&&!_0x5c794a[_0x1c893e(0x1df)][_0x5280a1]&&_0xdb530e[_0x1c893e(0x1e0)](_0x5280a1);}}const _0x5082a3=_0x20982d[_0x1c893e(0x1f0)]===0x0&&_0x5e1cc3[_0x1c893e(0x1f0)]===0x0&&_0xd3ff71[_0x1c893e(0x1f0)]===0x0&&_0xdb530e[_0x1c893e(0x1f0)]===0x0;return{'ok':!![],'data':{'added':_0x20982d,'modified':_0x5e1cc3,'missing':_0xd3ff71,'unchanged':_0x35ea37,'remoteOnly':_0xdb530e},'message':_0x5082a3?_0x1c893e(0x1da):_0x20982d[_0x1c893e(0x1f0)]+_0x1c893e(0x1ec)+_0x5e1cc3[_0x1c893e(0x1f0)]+'\x20modified,\x20'+_0xd3ff71[_0x1c893e(0x1f0)]+_0x1c893e(0x1d7)+_0x35ea37[_0x1c893e(0x1f0)]+_0x1c893e(0x1e6)+(_0xdb530e[_0x1c893e(0x1f0)]>0x0?',\x20'+_0xdb530e[_0x1c893e(0x1f0)]+'\x20remote-only':'')};}};
@@ -1 +1 @@
1
- const a133_0x4d4c97=a133_0x1d36;(function(_0x2ca758,_0x1bde6e){const _0x1ffc4b=a133_0x1d36,_0x15dc00=_0x2ca758();while(!![]){try{const _0x2f934a=-parseInt(_0x1ffc4b(0xef))/0x1*(parseInt(_0x1ffc4b(0xe7))/0x2)+parseInt(_0x1ffc4b(0xde))/0x3*(-parseInt(_0x1ffc4b(0xe6))/0x4)+parseInt(_0x1ffc4b(0xdf))/0x5+-parseInt(_0x1ffc4b(0xf9))/0x6+-parseInt(_0x1ffc4b(0x107))/0x7+-parseInt(_0x1ffc4b(0xe0))/0x8*(-parseInt(_0x1ffc4b(0xfa))/0x9)+parseInt(_0x1ffc4b(0xf7))/0xa*(parseInt(_0x1ffc4b(0xdc))/0xb);if(_0x2f934a===_0x1bde6e)break;else _0x15dc00['push'](_0x15dc00['shift']());}catch(_0x23d2a3){_0x15dc00['push'](_0x15dc00['shift']());}}}(a133_0xf08a,0xe9b35));import{readFileSync,existsSync}from'node:fs';function a133_0xf08a(){const _0x47e319=['filter','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','3184300SqdlFu','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','message','isDangerous','SQL\x20schema\x20validation','valid','fields','validation','sql','isArray','39061GgsyDL','tables','1810173cwMCOV','6970340klDzeH','8QRDQVq','from','get','string','schemaWarnings','\x22\x20not\x20found\x20in\x20any\x20dataset','8ViCfoK','430MHFAsD','Table\x20\x22','str','schemas','\x22\x20not\x20found\x20or\x20not\x20accessible','file','name','flagMissing','6193cQlPjK','read','map','validate','File\x20not\x20found:\x20','utf-8','appCode','toLowerCase','4810khanZI','schema:','1411140sOkXoL','9751545nAYpSV','tableName','isSelectOnly','type','dbtableConfig','trim','reason','Dataset\x20\x22','sqlType','length','push'];a133_0xf08a=function(){return _0x47e319;};return a133_0xf08a();}import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';function a133_0x1d36(_0x4b7101,_0x144889){_0x4b7101=_0x4b7101-0xd8;const _0xf08a57=a133_0xf08a();let _0x1d36d2=_0xf08a57[_0x4b7101];return _0x1d36d2;}import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a133_0x4d4c97(0xda),'command':a133_0x4d4c97(0xf2),'description':a133_0x4d4c97(0x108),'risk':a133_0x4d4c97(0xf0),'flags':[{'name':a133_0x4d4c97(0xec),'type':a133_0x4d4c97(0xe3),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a133_0x4d4c97(0xda),'type':a133_0x4d4c97(0xe3),'description':a133_0x4d4c97(0x106)},{'name':a133_0x4d4c97(0xea),'type':'string','description':'Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against'}],async 'execute'(_0x4676aa){const _0x2c7a7b=a133_0x4d4c97,_0x4910c6=_0x4676aa[_0x2c7a7b(0xe9)](_0x2c7a7b(0xec)),_0x42e0ae=_0x4676aa[_0x2c7a7b(0xe9)](_0x2c7a7b(0xda));if(!_0x4910c6&&!_0x42e0ae)throw CliErrors[_0x2c7a7b(0xee)](_0x2c7a7b(0xec),'Provide\x20--file\x20or\x20--sql');let _0x1303a3;if(_0x4910c6){const _0x1919f8=resolve(process['cwd'](),_0x4910c6);if(!existsSync(_0x1919f8))throw CliErrors[_0x2c7a7b(0xd9)](_0x2c7a7b(0xf3)+_0x1919f8);_0x1303a3=readFileSync(_0x1919f8,_0x2c7a7b(0xf4));}else _0x1303a3=_0x42e0ae;const _0xeff894=validateSql(_0x1303a3),_0x10b2b4={'valid':_0xeff894['valid'],'sqlType':_0xeff894[_0x2c7a7b(0x102)][_0x2c7a7b(0xfd)],'isSelectOnly':_0xeff894['sqlType'][_0x2c7a7b(0xfc)],'isDangerous':_0xeff894[_0x2c7a7b(0x102)][_0x2c7a7b(0x10a)],'tables':_0xeff894['tables'],'parameters':_0xeff894['parameters'],'message':_0xeff894[_0x2c7a7b(0x109)]};_0xeff894[_0x2c7a7b(0x102)][_0x2c7a7b(0x100)]&&(_0x10b2b4[_0x2c7a7b(0x100)]=_0xeff894['sqlType'][_0x2c7a7b(0x100)]);const _0x1a2f68=_0x4676aa[_0x2c7a7b(0xe9)]('schemas');if(_0x1a2f68&&_0xeff894[_0x2c7a7b(0x10c)]){const _0x2a91ca=_0x1a2f68['split'](',')['map'](_0x4b87f8=>_0x4b87f8[_0x2c7a7b(0xff)]())[_0x2c7a7b(0x105)](Boolean),_0x23e2d6=[],_0xde3358=filterDbTableBackedDatasets(await listDatasets(_0x4676aa[_0x2c7a7b(0xf5)])),_0x3bee71=new Map(_0xde3358[_0x2c7a7b(0xf1)](_0x1a2e14=>[_0x1a2e14[_0x2c7a7b(0xfe)]?.['tableName']?.[_0x2c7a7b(0xf6)](),_0x1a2e14]));for(const _0x980452 of _0xeff894[_0x2c7a7b(0xdd)]){const _0x42143e=_0x3bee71[_0x2c7a7b(0xe2)](_0x980452['toLowerCase']());!_0x42143e&&_0x23e2d6[_0x2c7a7b(0x104)](_0x2c7a7b(0xe8)+_0x980452+_0x2c7a7b(0xe5));}for(const _0x3b11f9 of _0x2a91ca){let _0x2cc853;try{_0x2cc853=await getDatasetDetail(_0x3b11f9);}catch{_0x23e2d6[_0x2c7a7b(0x104)](_0x2c7a7b(0x101)+_0x3b11f9+_0x2c7a7b(0xeb));continue;}assertDatasetIsDbTableBacked(_0x2cc853,_0x2c7a7b(0x10b));const _0x18fa50=Array[_0x2c7a7b(0xdb)](_0x2cc853['fields'])?_0x2cc853[_0x2c7a7b(0xd8)]:[],_0x5acf5e=new Set(_0x18fa50[_0x2c7a7b(0xf1)](_0x3f5437=>_0x3f5437[_0x2c7a7b(0xed)]?.[_0x2c7a7b(0xf6)]())),_0x266f21=_0x2cc853[_0x2c7a7b(0xfe)]?.[_0x2c7a7b(0xfb)]||_0x2cc853[_0x2c7a7b(0xfb)]||_0x3b11f9;_0x10b2b4[_0x2c7a7b(0xf8)+_0x266f21]={'code':_0x3b11f9,'tableName':_0x266f21,'fieldCount':_0x5acf5e['size'],'fields':Array[_0x2c7a7b(0xe1)](_0x5acf5e)};}_0x23e2d6[_0x2c7a7b(0x103)]>0x0&&(_0x10b2b4[_0x2c7a7b(0xe4)]=_0x23e2d6);}return{'ok':_0xeff894[_0x2c7a7b(0x10c)],'data':_0x10b2b4,'message':_0xeff894[_0x2c7a7b(0x109)]};}};
1
+ const a133_0x55c566=a133_0x1c9d;(function(_0x4e5251,_0x38e347){const _0x695ffc=a133_0x1c9d,_0x3150e0=_0x4e5251();while(!![]){try{const _0x408d0f=parseInt(_0x695ffc(0x174))/0x1*(parseInt(_0x695ffc(0x178))/0x2)+parseInt(_0x695ffc(0x172))/0x3*(-parseInt(_0x695ffc(0x185))/0x4)+parseInt(_0x695ffc(0x17e))/0x5*(-parseInt(_0x695ffc(0x19a))/0x6)+-parseInt(_0x695ffc(0x182))/0x7*(-parseInt(_0x695ffc(0x179))/0x8)+-parseInt(_0x695ffc(0x18e))/0x9*(-parseInt(_0x695ffc(0x193))/0xa)+-parseInt(_0x695ffc(0x18d))/0xb*(parseInt(_0x695ffc(0x19b))/0xc)+-parseInt(_0x695ffc(0x18f))/0xd*(-parseInt(_0x695ffc(0x1a5))/0xe);if(_0x408d0f===_0x38e347)break;else _0x3150e0['push'](_0x3150e0['shift']());}catch(_0xdbbef1){_0x3150e0['push'](_0x3150e0['shift']());}}}(a133_0x5ac4,0x36462));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a133_0x5ac4(){const _0x33fc99=['isDangerous','\x22\x20not\x20found\x20or\x20not\x20accessible','490DFpLuz','map','string','validation','Dataset\x20\x22','dbtableConfig','isSelectOnly','98436OrchvN','480duMBSM','sql','tables','size','tableName','schemas','Table\x20\x22','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','validate','trim','490hTnFLA','get','Provide\x20--file\x20or\x20--sql','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','appCode','schemaWarnings','fields','5361PKuVsf','str','9364TeytMP','flagMissing','filter','valid','94DmKdoj','779696pMXbJl','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','sqlType','SQL\x20schema\x20validation','5WapziF','schema:','push','utf-8','7gjQzmZ','read','parameters','740uYDGcp','split','\x22\x20not\x20found\x20in\x20any\x20dataset','cwd','toLowerCase','isArray','file','reason','109450UJqzvU','11997mhPpQY','135356ttynBN','type'];a133_0x5ac4=function(){return _0x33fc99;};return a133_0x5ac4();}function a133_0x1c9d(_0x3decb1,_0x5d911a){_0x3decb1=_0x3decb1-0x16c;const _0x5ac43b=a133_0x5ac4();let _0x1c9d94=_0x5ac43b[_0x3decb1];return _0x1c9d94;}import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a133_0x55c566(0x19c),'command':a133_0x55c566(0x1a3),'description':a133_0x55c566(0x1a2),'risk':a133_0x55c566(0x183),'flags':[{'name':'file','type':a133_0x55c566(0x195),'description':a133_0x55c566(0x17a)},{'name':'sql','type':'string','description':a133_0x55c566(0x16e)},{'name':a133_0x55c566(0x1a0),'type':'string','description':a133_0x55c566(0x17b)}],async 'execute'(_0x57a65a){const _0x398379=a133_0x55c566,_0x19dd1f=_0x57a65a[_0x398379(0x173)](_0x398379(0x18b)),_0x2a28a1=_0x57a65a[_0x398379(0x173)](_0x398379(0x19c));if(!_0x19dd1f&&!_0x2a28a1)throw CliErrors[_0x398379(0x175)](_0x398379(0x18b),_0x398379(0x16d));let _0x15a5cc;if(_0x19dd1f){const _0x536c8d=resolve(process[_0x398379(0x188)](),_0x19dd1f);if(!existsSync(_0x536c8d))throw CliErrors[_0x398379(0x196)]('File\x20not\x20found:\x20'+_0x536c8d);_0x15a5cc=readFileSync(_0x536c8d,_0x398379(0x181));}else _0x15a5cc=_0x2a28a1;const _0x4dd14f=validateSql(_0x15a5cc),_0x3fe611={'valid':_0x4dd14f[_0x398379(0x177)],'sqlType':_0x4dd14f[_0x398379(0x17c)][_0x398379(0x190)],'isSelectOnly':_0x4dd14f['sqlType'][_0x398379(0x199)],'isDangerous':_0x4dd14f[_0x398379(0x17c)][_0x398379(0x191)],'tables':_0x4dd14f[_0x398379(0x19d)],'parameters':_0x4dd14f[_0x398379(0x184)],'message':_0x4dd14f['message']};_0x4dd14f['sqlType']['reason']&&(_0x3fe611[_0x398379(0x18c)]=_0x4dd14f['sqlType']['reason']);const _0x2250b9=_0x57a65a[_0x398379(0x173)](_0x398379(0x1a0));if(_0x2250b9&&_0x4dd14f[_0x398379(0x177)]){const _0x52fdd1=_0x2250b9[_0x398379(0x186)](',')[_0x398379(0x194)](_0x4e92af=>_0x4e92af[_0x398379(0x1a4)]())[_0x398379(0x176)](Boolean),_0x5a5a7f=[],_0x44d130=filterDbTableBackedDatasets(await listDatasets(_0x57a65a[_0x398379(0x16f)])),_0x57dfd3=new Map(_0x44d130[_0x398379(0x194)](_0x58e7ed=>[_0x58e7ed['dbtableConfig']?.[_0x398379(0x19f)]?.[_0x398379(0x189)](),_0x58e7ed]));for(const _0x2313c9 of _0x4dd14f[_0x398379(0x19d)]){const _0x4cb073=_0x57dfd3[_0x398379(0x16c)](_0x2313c9['toLowerCase']());!_0x4cb073&&_0x5a5a7f[_0x398379(0x180)](_0x398379(0x1a1)+_0x2313c9+_0x398379(0x187));}for(const _0x241846 of _0x52fdd1){let _0x28aeef;try{_0x28aeef=await getDatasetDetail(_0x241846);}catch{_0x5a5a7f[_0x398379(0x180)](_0x398379(0x197)+_0x241846+_0x398379(0x192));continue;}assertDatasetIsDbTableBacked(_0x28aeef,_0x398379(0x17d));const _0x125392=Array[_0x398379(0x18a)](_0x28aeef['fields'])?_0x28aeef[_0x398379(0x171)]:[],_0x2cd226=new Set(_0x125392[_0x398379(0x194)](_0x4b1f95=>_0x4b1f95['name']?.[_0x398379(0x189)]())),_0x239329=_0x28aeef[_0x398379(0x198)]?.[_0x398379(0x19f)]||_0x28aeef[_0x398379(0x19f)]||_0x241846;_0x3fe611[_0x398379(0x17f)+_0x239329]={'code':_0x241846,'tableName':_0x239329,'fieldCount':_0x2cd226[_0x398379(0x19e)],'fields':Array['from'](_0x2cd226)};}_0x5a5a7f['length']>0x0&&(_0x3fe611[_0x398379(0x170)]=_0x5a5a7f);}return{'ok':_0x4dd14f[_0x398379(0x177)],'data':_0x3fe611,'message':_0x4dd14f['message']};}};
@@ -1 +1 @@
1
- function a134_0x5f13(){const _0x2b7b1a=['map','accessKey','698484VBgrFV','Config\x20key\x20(','appcode','7InKnma','Risk\x20level','zh-CN','has','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','trim','apps','env','join','entries','defaultFormat','apiDir','en-US','9564651fNkxDC','30PagbLw','riskLevel','defaultApp','keys','21072WkMyox','Auth\x20cookie','locale','app','452301BlJYbo','string','3047350EigAxG','API\x20directory\x20path','cookie','format','length','6906376lpozan','Access\x20key','Target\x20environment','Locale','pageSize','Default\x20page\x20size','10UcvSOg','4857904kXuhHK','number'];a134_0x5f13=function(){return _0x2b7b1a;};return a134_0x5f13();}const a134_0x466daa=a134_0xeb69;(function(_0x4d282b,_0x46763e){const _0x58aef9=a134_0xeb69,_0x2c7c25=_0x4d282b();while(!![]){try{const _0x4ae08f=-parseInt(_0x58aef9(0x182))/0x1*(-parseInt(_0x58aef9(0x17e))/0x2)+-parseInt(_0x58aef9(0x186))/0x3+parseInt(_0x58aef9(0x169))/0x4+-parseInt(_0x58aef9(0x188))/0x5+-parseInt(_0x58aef9(0x16d))/0x6*(-parseInt(_0x58aef9(0x170))/0x7)+parseInt(_0x58aef9(0x162))/0x8+-parseInt(_0x58aef9(0x17d))/0x9*(parseInt(_0x58aef9(0x168))/0xa);if(_0x4ae08f===_0x46763e)break;else _0x2c7c25['push'](_0x2c7c25['shift']());}catch(_0x2e4d7c){_0x2c7c25['push'](_0x2c7c25['shift']());}}}(a134_0x5f13,0xa7cbb));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';import{RABETBASE_ENV_VALUES}from'../constant/env.js';function a134_0xeb69(_0x3f7f3b,_0x27ca82){_0x3f7f3b=_0x3f7f3b-0x15e;const _0x5f135c=a134_0x5f13();let _0xeb6973=_0x5f135c[_0x3f7f3b];return _0xeb6973;}import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../constant/output.js';import{RISK_LEVEL_VALUES}from'../constant/risk.js';export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=[a134_0x466daa(0x15f),a134_0x466daa(0x16c),'locale',a134_0x466daa(0x160),a134_0x466daa(0x17f)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a134_0x466daa(0x16f),a134_0x466daa(0x177),'locale','format','cookie','accessKey',a134_0x466daa(0x17b)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x3a0d17){const _0x2af8b8=a134_0x466daa;return[..._0x3a0d17][_0x2af8b8(0x178)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x127075){const _0x55d818=a134_0x466daa;return TOP_LEVEL_CONFIG_KEYS[_0x55d818(0x173)](_0x127075);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x5c84e1=a134_0x466daa;return _0x5c84e1(0x16e)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':'env','apiDir':a134_0x466daa(0x17b),'cookie':a134_0x466daa(0x15f),'accessKey':a134_0x466daa(0x16c),'defaultFormat':'format','pageSize':a134_0x466daa(0x166),'riskLevel':a134_0x466daa(0x17f),'locale':a134_0x466daa(0x184)};export function getAppProfileFlagDefs(){const _0xd5b2fd=a134_0x466daa;return[{'name':'env','type':_0xd5b2fd(0x187),'description':_0xd5b2fd(0x164),'enum':[...RABETBASE_ENV_VALUES]},{'name':'apiDir','type':_0xd5b2fd(0x187),'description':_0xd5b2fd(0x15e)},{'name':'cookie','type':_0xd5b2fd(0x187),'description':_0xd5b2fd(0x183),'hidden':!![]},{'name':_0xd5b2fd(0x16c),'type':_0xd5b2fd(0x187),'description':_0xd5b2fd(0x163),'hidden':!![]},{'name':_0xd5b2fd(0x17a),'type':_0xd5b2fd(0x187),'description':_0xd5b2fd(0x174),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':_0xd5b2fd(0x16a),'description':_0xd5b2fd(0x167)},{'name':_0xd5b2fd(0x17f),'type':_0xd5b2fd(0x187),'description':_0xd5b2fd(0x171),'enum':[...RISK_LEVEL_VALUES]},{'name':_0xd5b2fd(0x184),'type':_0xd5b2fd(0x187),'description':_0xd5b2fd(0x165)}];}export function collectAppProfileOverrides(_0x766497){const _0x4e3032=a134_0x466daa,_0x2431ed={};for(const [_0x233b72,_0xbc2b56]of Object[_0x4e3032(0x179)](APP_PROFILE_FLAG_KEY_MAP)){const _0x387f07=_0x766497(_0x233b72);if(!_0x387f07)continue;_0x2431ed[_0xbc2b56]=_0xbc2b56===_0x4e3032(0x166)?Number(_0x387f07):_0x387f07;}return _0x2431ed;}export function buildAppProfileListFields(_0x6269ef){const _0x33bf4a=a134_0x466daa;return{'env':_0x6269ef[_0x33bf4a(0x177)]??null,'apiDir':_0x6269ef[_0x33bf4a(0x17b)]??null,'hasCookie':!!_0x6269ef[_0x33bf4a(0x15f)],'hasAccessKey':!!_0x6269ef[_0x33bf4a(0x16c)],'format':_0x6269ef['format']??null,'pageSize':_0x6269ef[_0x33bf4a(0x166)]??null,'riskLevel':_0x6269ef[_0x33bf4a(0x17f)]??null,'locale':_0x6269ef[_0x33bf4a(0x184)]??null};}export function buildAppDoctorFields(_0x554fe6,_0x17cd6b){const _0x3eead9=a134_0x466daa;return{'env':{'value':_0x554fe6[_0x3eead9(0x177)]||_0x17cd6b['env'],'source':_0x554fe6['env']?_0x3eead9(0x185):'inherit'},'apiDir':{'value':_0x554fe6['apiDir']||_0x17cd6b[_0x3eead9(0x17b)],'source':_0x554fe6[_0x3eead9(0x17b)]?_0x3eead9(0x185):'inherit'},'cookie':{'value':_0x554fe6['cookie']||_0x17cd6b['cookie'],'source':_0x554fe6['cookie']?_0x3eead9(0x185):'inherit'},'accessKey':{'value':_0x554fe6['accessKey']||_0x17cd6b['accessKey'],'source':_0x554fe6[_0x3eead9(0x16c)]?_0x3eead9(0x185):'inherit'}};}export function buildCanonicalAppConfig(_0x58a203,_0x2c7502){const _0x30df05=a134_0x466daa,_0x426d7b=_0x58a203[_0x30df05(0x16b)](_0x29e741=>String(_0x29e741||'')[_0x30df05(0x175)]())['filter'](Boolean);if(_0x426d7b['length']===0x0)return{};const _0x7e0d2e={};for(const _0x47a96f of _0x426d7b){_0x7e0d2e[_0x47a96f]=_0x2c7502?{'appcode':_0x47a96f,'env':_0x2c7502}:{'appcode':_0x47a96f};}return{'apps':_0x7e0d2e,'defaultApp':_0x426d7b[0x0]};}export function buildCanonicalProjectConfig(_0x21c1d9,_0x3a527d){const _0x1b25db=a134_0x466daa,{appCodes:appCodes=[],env:_0x1527bb,metadata:_0x4f43c4}=_0x3a527d,_0x387fbe={..._0x21c1d9,..._0x4f43c4||{}};delete _0x387fbe[_0x1b25db(0x16f)],delete _0x387fbe[_0x1b25db(0x185)];if(_0x1527bb)_0x387fbe['env']=_0x1527bb;else!_0x387fbe[_0x1b25db(0x177)]&&(_0x387fbe[_0x1b25db(0x177)]=DEFAULT_CONFIG_VALUES[_0x1b25db(0x177)]);const _0x485acf=buildCanonicalAppConfig(appCodes,_0x387fbe[_0x1b25db(0x177)]);return Object[_0x1b25db(0x181)](_0x485acf)[_0x1b25db(0x161)]>0x0&&(_0x387fbe[_0x1b25db(0x176)]=_0x485acf[_0x1b25db(0x176)],_0x387fbe['defaultApp']=_0x485acf[_0x1b25db(0x180)]),_0x387fbe;}const LOCALE_MAP={'zh':a134_0x466daa(0x172),'zh-cn':a134_0x466daa(0x172),'zh_cn':a134_0x466daa(0x172),'en':'en-US','en-us':a134_0x466daa(0x17c),'en_us':a134_0x466daa(0x17c)};export function normalizeLocale(_0x492003){if(!_0x492003)return null;return LOCALE_MAP[_0x492003['toLowerCase']()]??null;}
1
+ function a134_0x28a1(){const _0x2e0564=['12290930zFkomG','en-US','string','Locale','zh-CN','cookie','1510598CSMHfZ','accessKey','3606JvStGg','Risk\x20level','env','defaultApp','toLowerCase','format','pageSize','entries','app','Default\x20page\x20size','length','12xqJgMi','Access\x20key','appcode','116466dGOcNO','Target\x20environment','8912zUUkjR','363015TGLGUu','2502vYyoGJ','inherit','7NUrCfM','trim','keys','map','apiDir','1419445kQWywt','locale','apps','Auth\x20cookie','has','riskLevel'];a134_0x28a1=function(){return _0x2e0564;};return a134_0x28a1();}function a134_0x3259(_0x28dce7,_0x36d1bf){_0x28dce7=_0x28dce7-0x1da;const _0x28a166=a134_0x28a1();let _0x32594b=_0x28a166[_0x28dce7];return _0x32594b;}const a134_0x4d3cf9=a134_0x3259;(function(_0x14fb67,_0x5aeaa0){const _0x160cfb=a134_0x3259,_0x514df7=_0x14fb67();while(!![]){try{const _0x2c837d=-parseInt(_0x160cfb(0x1e0))/0x1+parseInt(_0x160cfb(0x1f7))/0x2+-parseInt(_0x160cfb(0x1e3))/0x3+-parseInt(_0x160cfb(0x1dd))/0x4*(-parseInt(_0x160cfb(0x1eb))/0x5)+parseInt(_0x160cfb(0x1f9))/0x6*(parseInt(_0x160cfb(0x1e6))/0x7)+-parseInt(_0x160cfb(0x1e2))/0x8*(-parseInt(_0x160cfb(0x1e4))/0x9)+-parseInt(_0x160cfb(0x1f1))/0xa;if(_0x2c837d===_0x5aeaa0)break;else _0x514df7['push'](_0x514df7['shift']());}catch(_0x56aff4){_0x514df7['push'](_0x514df7['shift']());}}}(a134_0x28a1,0x6e087));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';import{RABETBASE_ENV_VALUES}from'../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../constant/output.js';import{RISK_LEVEL_VALUES}from'../constant/risk.js';export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=[a134_0x4d3cf9(0x1f6),'accessKey',a134_0x4d3cf9(0x1ec),a134_0x4d3cf9(0x1fe),a134_0x4d3cf9(0x1f0)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a134_0x4d3cf9(0x1df),'env','locale','format',a134_0x4d3cf9(0x1f6),a134_0x4d3cf9(0x1f8),a134_0x4d3cf9(0x1ea)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x1595f9){return[..._0x1595f9]['join'](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x149324){const _0x44a9d8=a134_0x4d3cf9;return TOP_LEVEL_CONFIG_KEYS[_0x44a9d8(0x1ef)](_0x149324);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){return'Config\x20key\x20('+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':a134_0x4d3cf9(0x1fb),'apiDir':a134_0x4d3cf9(0x1ea),'cookie':'cookie','accessKey':a134_0x4d3cf9(0x1f8),'defaultFormat':a134_0x4d3cf9(0x1fe),'pageSize':a134_0x4d3cf9(0x1ff),'riskLevel':'riskLevel','locale':a134_0x4d3cf9(0x1ec)};export function getAppProfileFlagDefs(){const _0x212d85=a134_0x4d3cf9;return[{'name':_0x212d85(0x1fb),'type':_0x212d85(0x1f3),'description':_0x212d85(0x1e1),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0x212d85(0x1ea),'type':_0x212d85(0x1f3),'description':'API\x20directory\x20path'},{'name':_0x212d85(0x1f6),'type':'string','description':_0x212d85(0x1ee),'hidden':!![]},{'name':_0x212d85(0x1f8),'type':_0x212d85(0x1f3),'description':_0x212d85(0x1de),'hidden':!![]},{'name':'defaultFormat','type':_0x212d85(0x1f3),'description':'Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':'number','description':_0x212d85(0x1db)},{'name':_0x212d85(0x1f0),'type':'string','description':_0x212d85(0x1fa),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x212d85(0x1ec),'type':_0x212d85(0x1f3),'description':_0x212d85(0x1f4)}];}export function collectAppProfileOverrides(_0x409b15){const _0x22b9c9=a134_0x4d3cf9,_0x2fe706={};for(const [_0x480bb3,_0x430771]of Object[_0x22b9c9(0x200)](APP_PROFILE_FLAG_KEY_MAP)){const _0xcbe191=_0x409b15(_0x480bb3);if(!_0xcbe191)continue;_0x2fe706[_0x430771]=_0x430771===_0x22b9c9(0x1ff)?Number(_0xcbe191):_0xcbe191;}return _0x2fe706;}export function buildAppProfileListFields(_0x1514fe){const _0x1f0973=a134_0x4d3cf9;return{'env':_0x1514fe[_0x1f0973(0x1fb)]??null,'apiDir':_0x1514fe[_0x1f0973(0x1ea)]??null,'hasCookie':!!_0x1514fe['cookie'],'hasAccessKey':!!_0x1514fe[_0x1f0973(0x1f8)],'format':_0x1514fe[_0x1f0973(0x1fe)]??null,'pageSize':_0x1514fe[_0x1f0973(0x1ff)]??null,'riskLevel':_0x1514fe[_0x1f0973(0x1f0)]??null,'locale':_0x1514fe[_0x1f0973(0x1ec)]??null};}export function buildAppDoctorFields(_0x39c609,_0x41e96c){const _0x514b3b=a134_0x4d3cf9;return{'env':{'value':_0x39c609[_0x514b3b(0x1fb)]||_0x41e96c[_0x514b3b(0x1fb)],'source':_0x39c609['env']?_0x514b3b(0x1da):_0x514b3b(0x1e5)},'apiDir':{'value':_0x39c609['apiDir']||_0x41e96c[_0x514b3b(0x1ea)],'source':_0x39c609[_0x514b3b(0x1ea)]?_0x514b3b(0x1da):'inherit'},'cookie':{'value':_0x39c609['cookie']||_0x41e96c[_0x514b3b(0x1f6)],'source':_0x39c609[_0x514b3b(0x1f6)]?'app':'inherit'},'accessKey':{'value':_0x39c609[_0x514b3b(0x1f8)]||_0x41e96c['accessKey'],'source':_0x39c609['accessKey']?_0x514b3b(0x1da):_0x514b3b(0x1e5)}};}export function buildCanonicalAppConfig(_0x22c7e8,_0x1350d0){const _0x28e056=a134_0x4d3cf9,_0x57e57e=_0x22c7e8[_0x28e056(0x1e9)](_0x4cac9e=>String(_0x4cac9e||'')[_0x28e056(0x1e7)]())['filter'](Boolean);if(_0x57e57e[_0x28e056(0x1dc)]===0x0)return{};const _0x1e7737={};for(const _0x48f76a of _0x57e57e){_0x1e7737[_0x48f76a]=_0x1350d0?{'appcode':_0x48f76a,'env':_0x1350d0}:{'appcode':_0x48f76a};}return{'apps':_0x1e7737,'defaultApp':_0x57e57e[0x0]};}export function buildCanonicalProjectConfig(_0x5b4bc1,_0x411d0b){const _0x4731d9=a134_0x4d3cf9,{appCodes:appCodes=[],env:_0x156b5c,metadata:_0x535ba7}=_0x411d0b,_0x313161={..._0x5b4bc1,..._0x535ba7||{}};delete _0x313161['appcode'],delete _0x313161['app'];if(_0x156b5c)_0x313161[_0x4731d9(0x1fb)]=_0x156b5c;else!_0x313161[_0x4731d9(0x1fb)]&&(_0x313161['env']=DEFAULT_CONFIG_VALUES[_0x4731d9(0x1fb)]);const _0x113f82=buildCanonicalAppConfig(appCodes,_0x313161['env']);return Object[_0x4731d9(0x1e8)](_0x113f82)['length']>0x0&&(_0x313161['apps']=_0x113f82[_0x4731d9(0x1ed)],_0x313161[_0x4731d9(0x1fc)]=_0x113f82['defaultApp']),_0x313161;}const LOCALE_MAP={'zh':a134_0x4d3cf9(0x1f5),'zh-cn':a134_0x4d3cf9(0x1f5),'zh_cn':a134_0x4d3cf9(0x1f5),'en':a134_0x4d3cf9(0x1f2),'en-us':a134_0x4d3cf9(0x1f2),'en_us':'en-US'};export function normalizeLocale(_0x2fd8bd){const _0x32a50e=a134_0x4d3cf9;if(!_0x2fd8bd)return null;return LOCALE_MAP[_0x2fd8bd[_0x32a50e(0x1fd)]()]??null;}
@@ -1 +1 @@
1
- function a135_0x542d(_0x206bdd,_0x3bdde1){_0x206bdd=_0x206bdd-0x194;const _0x2c32c6=a135_0x2c32();let _0x542d2c=_0x2c32c6[_0x206bdd];return _0x542d2c;}const a135_0x1c650b=a135_0x542d;(function(_0x5b20b0,_0x2e90db){const _0xf922a2=a135_0x542d,_0x4edc87=_0x5b20b0();while(!![]){try{const _0x52d48d=-parseInt(_0xf922a2(0x199))/0x1*(parseInt(_0xf922a2(0x194))/0x2)+parseInt(_0xf922a2(0x196))/0x3*(-parseInt(_0xf922a2(0x19b))/0x4)+parseInt(_0xf922a2(0x197))/0x5*(-parseInt(_0xf922a2(0x1a1))/0x6)+-parseInt(_0xf922a2(0x19e))/0x7*(-parseInt(_0xf922a2(0x19c))/0x8)+parseInt(_0xf922a2(0x19d))/0x9*(-parseInt(_0xf922a2(0x19f))/0xa)+-parseInt(_0xf922a2(0x19a))/0xb+-parseInt(_0xf922a2(0x195))/0xc*(-parseInt(_0xf922a2(0x198))/0xd);if(_0x52d48d===_0x2e90db)break;else _0x4edc87['push'](_0x4edc87['shift']());}catch(_0x41440d){_0x4edc87['push'](_0x4edc87['shift']());}}}(a135_0x2c32,0xe773d));function a135_0x2c32(){const _0x5db857=['7886664oRfZKE','13788rbhPOV','7HqjQQe','9550kToCHt','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','18vWNNVo','3368062YFjZlk','12GWQDUJ','14097eVIvry','2303325YEQcUt','63402664kwgSNA','1VqkWpf','1918301KxigqX','180xbhlqc'];a135_0x2c32=function(){return _0x5db857;};return a135_0x2c32();}export const CLI_VERSION_POLICY_URL=a135_0x1c650b(0x1a0);
1
+ function a135_0x6ea6(_0x2499eb,_0x59868f){_0x2499eb=_0x2499eb-0x118;const _0x12d9d8=a135_0x12d9();let _0x6ea613=_0x12d9d8[_0x2499eb];return _0x6ea613;}function a135_0x12d9(){const _0x639d01=['11008jXLNAa','979670KOydVj','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','122193DxDsZr','158244GmsSUz','649644ykqGgR','78SqMjTt','1173123hMSSZd','72TgtBBZ','67991ulcYtS','121ZJLQKI','5ZVRRdP','2VLJzek'];a135_0x12d9=function(){return _0x639d01;};return a135_0x12d9();}const a135_0x1f47e3=a135_0x6ea6;(function(_0x4a3671,_0xf720e){const _0x5bae67=a135_0x6ea6,_0x3697cc=_0x4a3671();while(!![]){try{const _0x4d2def=-parseInt(_0x5bae67(0x11f))/0x1*(-parseInt(_0x5bae67(0x11b))/0x2)+parseInt(_0x5bae67(0x122))/0x3*(parseInt(_0x5bae67(0x11c))/0x4)+-parseInt(_0x5bae67(0x11a))/0x5*(-parseInt(_0x5bae67(0x121))/0x6)+parseInt(_0x5bae67(0x118))/0x7*(-parseInt(_0x5bae67(0x124))/0x8)+parseInt(_0x5bae67(0x123))/0x9+-parseInt(_0x5bae67(0x11d))/0xa+-parseInt(_0x5bae67(0x119))/0xb*(parseInt(_0x5bae67(0x120))/0xc);if(_0x4d2def===_0xf720e)break;else _0x3697cc['push'](_0x3697cc['shift']());}catch(_0x46db5c){_0x3697cc['push'](_0x3697cc['shift']());}}}(a135_0x12d9,0x18e25));export const CLI_VERSION_POLICY_URL=a135_0x1f47e3(0x11e);