@lovrabet/rabetbase-cli 2.3.9-beta.1 → 2.3.9-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -0
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/delete.js +1 -0
- package/lib/commands/menu/group-create.js +1 -0
- package/lib/commands/menu/group-update.js +1 -0
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -0
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -0
- package/lib/commands/menu/shared/facts.js +1 -0
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -0
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/create.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -0
- package/lib/commands/task/status.js +1 -0
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -0
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -0
- package/lib/framework/explicit-yes.js +1 -0
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a160_0xc295(_0x205f08,_0x19c205){_0x205f08=_0x205f08-0x167;const _0x18ca54=a160_0x18ca();let _0xc295d2=_0x18ca54[_0x205f08];return _0xc295d2;}const a160_0x106787=a160_0xc295;(function(_0xa0586e,_0x30774c){const _0x539071=a160_0xc295,_0x5653bc=_0xa0586e();while(!![]){try{const _0x3af7d7=-parseInt(_0x539071(0x177))/0x1+parseInt(_0x539071(0x178))/0x2+-parseInt(_0x539071(0x171))/0x3*(parseInt(_0x539071(0x173))/0x4)+-parseInt(_0x539071(0x16e))/0x5*(-parseInt(_0x539071(0x176))/0x6)+-parseInt(_0x539071(0x167))/0x7+-parseInt(_0x539071(0x16d))/0x8+parseInt(_0x539071(0x16c))/0x9;if(_0x3af7d7===_0x30774c)break;else _0x5653bc['push'](_0x5653bc['shift']());}catch(_0x1e2581){_0x5653bc['push'](_0x5653bc['shift']());}}}(a160_0x18ca,0x64786));function a160_0x18ca(){const _0x16aed5=['19236618xNnMYt','5257720wntkFp','151005zcrQfb','user-remove','\x20from\x20role\x20','2613rtsIkY','userId','3116PfbmbY','role','Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','96CZnwSZ','212428emwlIA','102200ueNxmD','No\x20change:\x20user\x20','4984280fsbPHl','selector','\x20not\x20in\x20role\x20','roleName','Removed\x20user\x20'];a160_0x18ca=function(){return _0x16aed5;};return a160_0x18ca();}import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':a160_0x106787(0x174),'command':a160_0x106787(0x16f),'description':a160_0x106787(0x175),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x4e3b56){const _0x529d7e=a160_0x106787,{mutation:_0x5a32dd}=await prepareUserMutation(_0x4e3b56,_0x529d7e(0x16f),!![]);return asDryRunResult(_0x5a32dd,{'method':'POST','url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x61cbfb){const _0x434d6b=a160_0x106787,{roleList:_0x9bf496,mutation:_0xf6ffc5,changed:_0x39f608}=await prepareUserMutation(_0x61cbfb,_0x434d6b(0x16f),![]);return _0x39f608&&await updateRoleUsers(_0x61cbfb['appCode'],_0x9bf496),{'ok':!![],'data':_0xf6ffc5,'message':_0x39f608?_0x434d6b(0x16b)+_0xf6ffc5['selector'][_0x434d6b(0x172)]+_0x434d6b(0x170)+_0xf6ffc5[_0x434d6b(0x168)][_0x434d6b(0x16a)]:_0x434d6b(0x179)+_0xf6ffc5[_0x434d6b(0x168)][_0x434d6b(0x172)]+_0x434d6b(0x169)+_0xf6ffc5[_0x434d6b(0x168)][_0x434d6b(0x16a)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a161_0x41315b=a161_0x1ae9;(function(_0x1f5d5a,_0x3dd326){const _0xdcd8da=a161_0x1ae9,_0x12706c=_0x1f5d5a();while(!![]){try{const _0x7a8340=-parseInt(_0xdcd8da(0x139))/0x1*(-parseInt(_0xdcd8da(0x130))/0x2)+-parseInt(_0xdcd8da(0x13e))/0x3+-parseInt(_0xdcd8da(0x146))/0x4*(parseInt(_0xdcd8da(0x140))/0x5)+parseInt(_0xdcd8da(0x145))/0x6*(parseInt(_0xdcd8da(0x12e))/0x7)+parseInt(_0xdcd8da(0x12f))/0x8*(parseInt(_0xdcd8da(0x138))/0x9)+-parseInt(_0xdcd8da(0x13c))/0xa*(parseInt(_0xdcd8da(0x13f))/0xb)+parseInt(_0xdcd8da(0x144))/0xc*(parseInt(_0xdcd8da(0x143))/0xd);if(_0x7a8340===_0x3dd326)break;else _0x12706c['push'](_0x12706c['shift']());}catch(_0x3dff10){_0x12706c['push'](_0x12706c['shift']());}}}(a161_0x248f,0x6aa8a));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a161_0x1ae9(_0x36a2ab,_0x172038){_0x36a2ab=_0x36a2ab-0x12e;const _0x248ff3=a161_0x248f();let _0x1ae958=_0x248ff3[_0x36a2ab];return _0x1ae958;}function a161_0x248f(){const _0x4c5793=['408rXxVkV','4MpLAas','39795pRzssL','250232wiPqZM','969454zTdsQL','Pass\x20--name\x20<nickname|username>.','nickname','Resolved\x20\x22','trim','read','name','str','45mbRUho','1wiqqBJ','userId','username','1963270nmAVIh','flagMissing','183756kLuBQG','11vLyhjD','3611315YXJSHV','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','user-resolve','13XxQnII','4668168XmcSli'];a161_0x248f=function(){return _0x4c5793;};return a161_0x248f();}import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':'role','command':a161_0x41315b(0x142),'description':a161_0x41315b(0x141),'risk':a161_0x41315b(0x135),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x47cddb){const _0xe40e77=a161_0x41315b;if(!_0x47cddb[_0xe40e77(0x137)]('name')[_0xe40e77(0x134)]())throw CliErrors[_0xe40e77(0x13d)](_0xe40e77(0x136),_0xe40e77(0x131));},async 'execute'(_0x5b0c2b){const _0x4b68da=a161_0x41315b,_0x167cc5=_0x5b0c2b[_0x4b68da(0x137)]('name')[_0x4b68da(0x134)](),_0x3201d9=await resolveUserRef(_0x167cc5);return{'ok':!![],'data':{'user':{'userId':_0x3201d9[_0x4b68da(0x13a)],'username':_0x3201d9[_0x4b68da(0x13b)],'nickname':_0x3201d9[_0x4b68da(0x132)],'matchedBy':_0x3201d9['matchedBy']}},'message':_0x4b68da(0x133)+_0x167cc5+'\x22\x20→\x20userId\x20'+_0x3201d9[_0x4b68da(0x13a)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a162_0x2faa03=a162_0x1d1a;(function(_0x3708b9,_0x4cc552){const _0x511f14=a162_0x1d1a,_0xb92d8f=_0x3708b9();while(!![]){try{const _0x25a6d2=parseInt(_0x511f14(0x1d6))/0x1*(-parseInt(_0x511f14(0x1e3))/0x2)+parseInt(_0x511f14(0x1dd))/0x3*(-parseInt(_0x511f14(0x1bf))/0x4)+-parseInt(_0x511f14(0x1e8))/0x5*(-parseInt(_0x511f14(0x1ec))/0x6)+parseInt(_0x511f14(0x1ee))/0x7+-parseInt(_0x511f14(0x1cf))/0x8*(-parseInt(_0x511f14(0x1d7))/0x9)+-parseInt(_0x511f14(0x1cc))/0xa*(parseInt(_0x511f14(0x1d2))/0xb)+-parseInt(_0x511f14(0x1c7))/0xc;if(_0x25a6d2===_0x4cc552)break;else _0xb92d8f['push'](_0xb92d8f['shift']());}catch(_0x5e420f){_0xb92d8f['push'](_0xb92d8f['shift']());}}}(a162_0x240a,0x40f91));function a162_0x240a(){const _0x1e468e=['script','belowMinimum','read','6WXfVDV','dev','3110492EHrZab','\x20run\x20preview\x20--watch','node_modules','\x0a\x20\x20Available\x20scripts:\x0a','.bin','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','pnpm-lock.yaml','\x22\x20not\x20found\x20in\x20package.json.','join','\x20run\x20','No\x20package.json\x20found\x20in\x20current\x20directory.','bool','\x20\x20\x20\x20','\x0a\x20\x20Usage:\x20','boolean','utf-8','92GIQeDA','yarn.lock','npm','Available:\x20','bun.lock','Run\x20a\x20package.json\x20script','\x20run\x20<script>\x0a','preview','4830408bAtIGu','vite','run','slice','push','342730ImTmRt','parse','start','8936IaXEHt','inherit','Script\x20name\x20defined\x20in\x20package.json','11kRTpep','\x20run\x20preview','keys','package.json','1hyAkLv','2547TwMNWu','--watch','args','validation','Script\x20\x22','watch','44079CQMsyl','needsUpgrade','build','vite\x20preview\x20exited\x20with\x20code\x20','\x20run\x20start','scripts','155886dMXkvP','log','has','yarn','error','1791755ZzFFmz'];a162_0x240a=function(){return _0x1e468e;};return a162_0x240a();}import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';function a162_0x1d1a(_0x51a1b9,_0x447f73){_0x51a1b9=_0x51a1b9-0x1b9;const _0x240a3d=a162_0x240a();let _0x1d1a09=_0x240a3d[_0x51a1b9];return _0x1d1a09;}import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a162_0x2faa03(0x1ce),a162_0x2faa03(0x1ed)]);function readPackageScripts(_0x611547){const _0x335817=a162_0x2faa03,_0x1c3ed6=resolve(_0x611547,_0x335817(0x1d5));if(!existsSync(_0x1c3ed6))return null;try{const _0x3bb99a=JSON[_0x335817(0x1cd)](readFileSync(_0x1c3ed6,_0x335817(0x1be)));return _0x3bb99a[_0x335817(0x1e2)]??{};}catch{return null;}}function detectPackageManager(_0x1e7a71){const _0x29b23d=a162_0x2faa03;if(existsSync(resolve(_0x1e7a71,'bun.lockb'))||existsSync(resolve(_0x1e7a71,_0x29b23d(0x1c3))))return'bun';if(existsSync(resolve(_0x1e7a71,_0x29b23d(0x1f4))))return'pnpm';if(existsSync(resolve(_0x1e7a71,_0x29b23d(0x1c0))))return _0x29b23d(0x1e6);return _0x29b23d(0x1c1);}async function versionCheck(_0x246b78){const _0x5880ae=a162_0x2faa03,_0x1ab83c=await checkCliVersion();(_0x1ab83c[_0x5880ae(0x1de)]||_0x1ab83c[_0x5880ae(0x1ea)])&&(printCliUpgradeWarning(_0x1ab83c),assertCliVersionSupported(_0x1ab83c));const _0x40ceb6=await checkSdkVersion(_0x246b78);if(_0x40ceb6[_0x5880ae(0x1de)])printSdkUpgradeWarning(_0x40ceb6);}function spawnScript(_0x5bc59b,_0x390da6,_0x545b24,_0x304890){return new Promise((_0x5edcf2,_0x36605b)=>{const _0x27fb4b=a162_0x1d1a,_0x1434bc=[_0x27fb4b(0x1c9),_0x390da6,..._0x545b24],_0x5916c0=spawn(_0x5bc59b,_0x1434bc,{'cwd':_0x304890,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x304890,_0x27fb4b(0x1f0),_0x27fb4b(0x1f2))+delimiter+process.env.PATH}});_0x5916c0['on']('close',_0x5c0c36=>{const _0x13543f=_0x27fb4b;if(_0x5c0c36===0x0||_0x5c0c36===null)_0x5edcf2();else _0x36605b(new Error(_0x5bc59b+_0x13543f(0x1f7)+_0x390da6+'\x20exited\x20with\x20code\x20'+_0x5c0c36));}),_0x5916c0['on'](_0x27fb4b(0x1e7),_0x36605b);});}function spawnViteBuildWatch(_0x269ffa){return new Promise((_0x37aae4,_0x100aa7)=>{const _0x36b5d3=a162_0x1d1a,_0x2538db=spawn('vite',[_0x36b5d3(0x1df),_0x36b5d3(0x1d8)],{'cwd':_0x269ffa,'stdio':_0x36b5d3(0x1d0),'shell':!![],'env':{...process.env,'PATH':''+join(_0x269ffa,_0x36b5d3(0x1f0),_0x36b5d3(0x1f2))+delimiter+process.env.PATH}});_0x2538db['on']('close',_0x5d870f=>{const _0x58d50d=_0x36b5d3;if(_0x5d870f===0x0||_0x5d870f===null)_0x37aae4();else _0x100aa7(new Error(_0x58d50d(0x1f3)+_0x5d870f));}),_0x2538db['on']('error',_0x100aa7);});}function spawnVitePreview(_0x36e717){return new Promise((_0x447458,_0x52de85)=>{const _0x202c22=a162_0x1d1a,_0x230a2b=spawn(_0x202c22(0x1c8),[_0x202c22(0x1c6)],{'cwd':_0x36e717,'stdio':_0x202c22(0x1d0),'shell':!![],'env':{...process.env,'PATH':''+join(_0x36e717,_0x202c22(0x1f0),'.bin')+delimiter+process.env.PATH}});_0x230a2b['on']('close',_0x2ae814=>{const _0x245fde=_0x202c22;if(_0x2ae814===0x0||_0x2ae814===null)_0x447458();else _0x52de85(new Error(_0x245fde(0x1e0)+_0x2ae814));}),_0x230a2b['on'](_0x202c22(0x1e7),_0x52de85);});}const runFlags=[{'name':a162_0x2faa03(0x1dc),'type':a162_0x2faa03(0x1bd),'description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a162_0x2faa03(0x1c9),'command':a162_0x2faa03(0x1c9),'description':a162_0x2faa03(0x1c4),'risk':a162_0x2faa03(0x1eb),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a162_0x2faa03(0x1e9),'description':a162_0x2faa03(0x1d1),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x73a8c9=a162_0x2faa03,_0x86eb52=[];return _0x86eb52[_0x73a8c9(0x1cb)]('\x20\x20EXAMPLES'),_0x86eb52[_0x73a8c9(0x1cb)](_0x73a8c9(0x1bb)+CLI_BIN_NAME+_0x73a8c9(0x1e1)),_0x86eb52[_0x73a8c9(0x1cb)](_0x73a8c9(0x1bb)+CLI_BIN_NAME+'\x20run\x20build'),_0x86eb52[_0x73a8c9(0x1cb)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x73a8c9(0x1d3)),_0x86eb52[_0x73a8c9(0x1cb)](_0x73a8c9(0x1bb)+CLI_BIN_NAME+_0x73a8c9(0x1ef)),_0x86eb52[_0x73a8c9(0x1f6)]('\x0a');},async 'execute'(_0xf2e787){const _0x8c963a=a162_0x2faa03,_0x51c871=process['cwd'](),_0x33a8f7=_0xf2e787[_0x8c963a(0x1d9)][0x0],_0x59ea25=_0xf2e787[_0x8c963a(0x1d9)][_0x8c963a(0x1ca)](0x1),_0x1101d3=readPackageScripts(_0x51c871);if(!_0x1101d3)throw CliErrors[_0x8c963a(0x1da)](_0x8c963a(0x1b9));if(!_0x33a8f7){const _0x4cbfd3=Object[_0x8c963a(0x1d4)](_0x1101d3);if(_0x4cbfd3['length']===0x0)console[_0x8c963a(0x1e4)]('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x8c963a(0x1e4)](_0x8c963a(0x1f1));for(const _0x2dfede of _0x4cbfd3){console['log'](_0x8c963a(0x1bb)+_0x2dfede);}console[_0x8c963a(0x1e4)](_0x8c963a(0x1bc)+CLI_BIN_NAME+_0x8c963a(0x1c5));}return{'ok':!![]};}if(!_0x1101d3[_0x33a8f7])throw CliErrors[_0x8c963a(0x1da)](_0x8c963a(0x1db)+_0x33a8f7+_0x8c963a(0x1f5),_0x8c963a(0x1c2)+(Object[_0x8c963a(0x1d4)](_0x1101d3)[_0x8c963a(0x1f6)](',\x20')||'(none)'));const _0x1e67b9=detectPackageManager(_0x51c871);VERSION_CHECK_SCRIPTS[_0x8c963a(0x1e5)](_0x33a8f7)&&await versionCheck(_0x51c871);if(_0x33a8f7===_0x8c963a(0x1c6)&&_0xf2e787[_0x8c963a(0x1ba)](_0x8c963a(0x1dc)))return await Promise['all']([spawnViteBuildWatch(_0x51c871),spawnVitePreview(_0x51c871)]),{'ok':!![]};return await spawnScript(_0x1e67b9,_0x33a8f7,_0x59ea25,_0x51c871),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a163_0x53f834=a163_0x3003;(function(_0x268542,_0x622f40){const _0x47d969=a163_0x3003,_0x1c1698=_0x268542();while(!![]){try{const _0x32e661=-parseInt(_0x47d969(0x140))/0x1+-parseInt(_0x47d969(0x145))/0x2+-parseInt(_0x47d969(0x142))/0x3+parseInt(_0x47d969(0x13f))/0x4*(parseInt(_0x47d969(0x144))/0x5)+parseInt(_0x47d969(0x147))/0x6+-parseInt(_0x47d969(0x146))/0x7*(parseInt(_0x47d969(0x13e))/0x8)+parseInt(_0x47d969(0x143))/0x9;if(_0x32e661===_0x622f40)break;else _0x1c1698['push'](_0x1c1698['shift']());}catch(_0x36cb47){_0x1c1698['push'](_0x1c1698['shift']());}}}(a163_0x4bbf,0x460c1));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x4b04d){const _0x578ab9=await buildSchemaPayload();return{'ok':!![],'data':_0x578ab9};}function a163_0x4bbf(){const _0x19ed5e=['7JsGICn','294402SHCEgG','read','schema','1728032UgQRyE','29336bxVYAl','165770DbGzcw','json','133566tSiyRi','4596759udPNEt','335GHBBlg','675974kOchmv'];a163_0x4bbf=function(){return _0x19ed5e;};return a163_0x4bbf();}function a163_0x3003(_0x400812,_0x30723a){_0x400812=_0x400812-0x13d;const _0x4bbff0=a163_0x4bbf();let _0x30036d=_0x4bbff0[_0x400812];return _0x30036d;}export const schemaDefinition={'service':a163_0x53f834(0x13d),'command':'export','description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a163_0x53f834(0x148),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a163_0x53f834(0x141),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a156_0x24621f=a156_0x35ba;(function(_0x5c6927,_0x30e62f){const _0x563acb=a156_0x35ba,_0x45c80b=_0x5c6927();while(!![]){try{const _0x1c5f34=-parseInt(_0x563acb(0x1e3))/0x1+parseInt(_0x563acb(0x200))/0x2+-parseInt(_0x563acb(0x1de))/0x3+-parseInt(_0x563acb(0x1da))/0x4*(-parseInt(_0x563acb(0x215))/0x5)+parseInt(_0x563acb(0x212))/0x6*(parseInt(_0x563acb(0x217))/0x7)+-parseInt(_0x563acb(0x1e2))/0x8+-parseInt(_0x563acb(0x1e7))/0x9;if(_0x1c5f34===_0x30e62f)break;else _0x45c80b['push'](_0x45c80b['shift']());}catch(_0x330011){_0x45c80b['push'](_0x45c80b['shift']());}}}(a156_0x26a8,0x74176));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';function a156_0x35ba(_0x302833,_0xeee552){_0x302833=_0x302833-0x1d9;const _0x26a8e2=a156_0x26a8();let _0x35ba78=_0x26a8e2[_0x302833];return _0x35ba78;}import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a156_0x26a8(){const _0x1ef84a=['/smartapi/custom/saveUserCustomSql','str','nonInteractive','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','description','catch','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','Created\x20SQL\x20query\x20','dbName','请选择本地\x20SQL\x20模式:','string','sqlRootDir','请输入目标数据库\x20dbId:','new','sqlRoot','普通\x20SQL(sql)','1821596ESkSAu','<server-generated-sqlCode>','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','join','map','trim','high-risk-write','mybatisXml','请选择目标数据库:','appCode','utf8','flagMissing','__manual__','isFinite','number','Local\x20SQL\x20file\x20mode','SQL\x20名称不能为空','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','1758UQvzRv','lockFilePath','toISOString','3351585cUgizJ','dbId\x20不能为空','17234igAGtU','sqlName','sqlCode','mode','name','validation','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','length','db-id','4UfIDiQ','lastSync','SELECT\x201\x20AS\x20id;','parse','2627826aAjiXn','stringify','Target\x20database\x20ID','适合带动态标签的\x20MyBatis\x20XML\x20SQL','2988616ghxUnE','13867PPJGsg','isInteger','SQL\x20query\x20display\x20name','sql','5072265iGTzXK','请输入\x20SQL\x20名称:','dbId','\x20\x20SELECT\x201\x20AS\x20id','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','create','sqls','Invalid\x20database\x20selection\x20payload:\x20'];a156_0x26a8=function(){return _0x1ef84a;};return a156_0x26a8();}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x2dd3e5){const _0x355af6=a156_0x35ba;if(_0x2dd3e5===_0x355af6(0x207))return[_0x355af6(0x1f5),_0x355af6(0x1ea),'</select>',''][_0x355af6(0x203)]('\x0a');return[_0x355af6(0x1dc),''][_0x355af6(0x203)]('\x0a');}export const sqlCreate={'service':a156_0x24621f(0x1e6),'command':a156_0x24621f(0x1ec),'description':a156_0x24621f(0x21d),'risk':a156_0x24621f(0x206),'flags':[{'name':a156_0x24621f(0x21b),'type':a156_0x24621f(0x1fa),'description':a156_0x24621f(0x1e5)},{'name':a156_0x24621f(0x1d9),'type':a156_0x24621f(0x20e),'description':a156_0x24621f(0x1e0)},{'name':'mode','type':a156_0x24621f(0x1fa),'enum':[a156_0x24621f(0x1e6),a156_0x24621f(0x207)],'description':a156_0x24621f(0x20f)}],async 'validate'(_0x56c7f7){const _0x21e946=a156_0x24621f;if(!_0x56c7f7[_0x21e946(0x1f1)])return;if(!_0x56c7f7['str'](_0x21e946(0x21b))[_0x21e946(0x205)]())throw CliErrors[_0x21e946(0x20b)]('name',_0x21e946(0x1f2));const _0x511ec2=resolveProvidedDbId(_0x56c7f7);if(typeof _0x511ec2!==_0x21e946(0x20e)||!Number['isFinite'](_0x511ec2)||_0x511ec2<=0x0)throw CliErrors[_0x21e946(0x20b)]('db-id','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x56c7f7[_0x21e946(0x1f0)](_0x21e946(0x21a))[_0x21e946(0x205)]())throw CliErrors[_0x21e946(0x20b)](_0x21e946(0x21a),_0x21e946(0x1f6));},async 'dryRun'(_0x18e450){const _0x4ad4cd=a156_0x24621f,_0x58fb5e=loadSqlProjectConfig(_0x18e450[_0x4ad4cd(0x209)]),{sqlName:_0x39ff68,dbId:_0x21f981,dbName:_0x2b2780,mode:_0x396afd}=await resolveSqlNewInputs(_0x18e450),_0x354bdd=buildSqlRelativePath(_0x4ad4cd(0x201),_0x39ff68,_0x2b2780,_0x396afd,_0x21f981),_0x114b2c=_0x58fb5e[_0x4ad4cd(0x1fb)]+'/'+_0x354bdd;return{'method':'POST','url':_0x4ad4cd(0x1ef),'body':{'appCode':_0x18e450['appCode'],'sqlName':_0x39ff68,'dbId':_0x21f981,'mode':_0x396afd,'localPath':_0x114b2c},'description':_0x4ad4cd(0x211)+_0x58fb5e['sqlRootDir']};},async 'execute'(_0x2a56e8){const _0xda2c4e=a156_0x24621f,_0x1464c9=loadSqlProjectConfig(_0x2a56e8[_0xda2c4e(0x209)]),{sqlName:_0x49ec99,dbId:_0x16db32,dbName:_0x3e4318,mode:_0x40ebda}=await resolveSqlNewInputs(_0x2a56e8),_0x5538cc=generateSqlTemplate(_0x40ebda),_0x36cc8a=await createSqlQuery({'appCode':_0x2a56e8[_0xda2c4e(0x209)],'sqlName':_0x49ec99,'dbId':_0x16db32,'sqlContent':_0x5538cc}),_0x44a873=ensureRemoteSqlContent(_0x36cc8a),_0x152d24=_0x3e4318||await getDbName(_0x2a56e8[_0xda2c4e(0x209)],_0x16db32)['catch'](()=>undefined),_0x619027=buildSqlRelativePath(_0x36cc8a['sqlCode'],_0x36cc8a[_0xda2c4e(0x218)],_0x152d24,_0x40ebda,_0x16db32),_0x2a5990=_0x1464c9['sqlRootDir']+'/'+_0x619027,_0x4be863=buildLocalSqlFileContent({'sqlCode':_0x36cc8a[_0xda2c4e(0x219)],'sqlName':_0x36cc8a[_0xda2c4e(0x218)],'dbId':_0x36cc8a[_0xda2c4e(0x1e9)]},_0x44a873,{'dbName':_0x152d24,'mode':_0x40ebda,'syncedAt':new Date()[_0xda2c4e(0x214)](),'description':_0x36cc8a[_0xda2c4e(0x1f3)]});if(await fileExists(_0x2a5990))throw CliErrors['validation']('File\x20already\x20exists:\x20'+_0x2a5990);await ensureParentDirectory(_0x2a5990),await writeFile(_0x2a5990,_0x4be863,_0xda2c4e(0x20a));const _0x1c0bf3=await readSqlLockFile(_0x1464c9[_0xda2c4e(0x213)]),{lockData:_0x57ca6c,appLock:_0xb15417}=ensureSqlLockScope(_0x1c0bf3??createEmptySqlLock(),_0x1464c9[_0xda2c4e(0x209)],_0x1464c9[_0xda2c4e(0x1fe)],_0xda2c4e(0x1fd));return _0xb15417[_0xda2c4e(0x1ed)][_0x36cc8a[_0xda2c4e(0x219)]]={...buildSqlLockEntry(_0x36cc8a,_0x44a873,computeSqlContentHash(_0x4be863),{'dbName':_0x152d24}),'path':_0x619027,'mode':_0x40ebda},_0xb15417[_0xda2c4e(0x1db)]=new Date()[_0xda2c4e(0x214)](),await writeSqlLockFile(_0x1464c9[_0xda2c4e(0x213)],_0x57ca6c),{'ok':!![],'data':{'id':_0x36cc8a['id'],'sqlCode':_0x36cc8a[_0xda2c4e(0x219)],'sqlName':_0x36cc8a[_0xda2c4e(0x218)],'dbId':_0x36cc8a['dbId'],'path':_0x2a5990,'mode':_0x40ebda},'message':_0xda2c4e(0x1f7)+_0x36cc8a[_0xda2c4e(0x219)]};}};async function resolveSqlNewInputs(_0x32e4db){const _0x57820c=await resolveSqlNameInput(_0x32e4db),{dbId:_0x1bad68,dbName:_0x3f9d7b}=await resolveDbSelection(_0x32e4db),_0x26ab58=await resolveSqlModeInput(_0x32e4db);return{'sqlName':_0x57820c,'dbId':_0x1bad68,'dbName':_0x3f9d7b,'mode':_0x26ab58};}async function resolveSqlNameInput(_0x3ef164){const _0x201ea0=a156_0x24621f,_0x4317f9=_0x3ef164[_0x201ea0(0x1f0)](_0x201ea0(0x21b))[_0x201ea0(0x205)]();if(_0x4317f9)return _0x4317f9;if(_0x3ef164[_0x201ea0(0x1f1)])throw CliErrors[_0x201ea0(0x20b)](_0x201ea0(0x21b),_0x201ea0(0x1f2));return(await input({'message':_0x201ea0(0x1e8),'validate':_0xb76408=>_0xb76408[_0x201ea0(0x205)]()?!![]:_0x201ea0(0x210)}))[_0x201ea0(0x205)]();}async function resolveDbSelection(_0x3c029e){const _0x39775b=a156_0x24621f,_0x20252b=resolveProvidedDbId(_0x3c029e);if(typeof _0x20252b==='number'&&Number[_0x39775b(0x20d)](_0x20252b)&&_0x20252b>0x0)return{'dbId':_0x20252b,'dbName':await getDbName(_0x3c029e[_0x39775b(0x209)],_0x20252b)[_0x39775b(0x1f4)](()=>undefined)};if(_0x3c029e['nonInteractive'])throw CliErrors['flagMissing']('db-id',_0x39775b(0x202));const _0x493daf=await listDatabases(_0x3c029e[_0x39775b(0x209)])[_0x39775b(0x1f4)](()=>[]);if(_0x493daf[_0x39775b(0x21e)]===0x1)return{'dbId':_0x493daf[0x0][_0x39775b(0x1e9)],'dbName':_0x493daf[0x0][_0x39775b(0x1f8)]};if(_0x493daf[_0x39775b(0x21e)]>0x1){const _0x516c34=await select({'message':_0x39775b(0x208),'choices':[..._0x493daf[_0x39775b(0x204)](_0x688b0c=>({'name':_0x688b0c['dbName']+'\x20('+_0x688b0c['dbId']+')','value':serializeDbSelection(_0x688b0c)})),{'name':'✎\x20手动输入\x20dbId','value':_0x39775b(0x20c)}]});if(_0x516c34!=='__manual__')return deserializeDbSelection(_0x516c34);}const _0x57b9cc=await input({'message':_0x39775b(0x1fc),'validate':_0x473014=>{const _0x4e7177=_0x39775b,_0x45f2a7=_0x473014['trim']();if(!_0x45f2a7)return _0x4e7177(0x216);const _0x193669=Number(_0x45f2a7);if(!Number[_0x4e7177(0x1e4)](_0x193669)||_0x193669<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x57b9cc[_0x39775b(0x205)]())};}async function resolveSqlModeInput(_0xa38843){const _0x47e412=a156_0x24621f,_0x53ae9c=_0xa38843['str'](_0x47e412(0x21a))[_0x47e412(0x205)]();if(_0x53ae9c==='sql'||_0x53ae9c===_0x47e412(0x207))return _0x53ae9c;if(_0xa38843['nonInteractive'])throw CliErrors[_0x47e412(0x20b)](_0x47e412(0x21a),_0x47e412(0x1f6));return await select({'message':_0x47e412(0x1f9),'choices':[{'name':_0x47e412(0x1ff),'value':_0x47e412(0x1e6),'description':_0x47e412(0x1eb)},{'name':'MyBatis\x20XML(mybatisXml)','value':_0x47e412(0x207),'description':_0x47e412(0x1e1)}]});}function serializeDbSelection(_0x108b61){const _0x19c72b=a156_0x24621f;return JSON[_0x19c72b(0x1df)]({'dbId':_0x108b61[_0x19c72b(0x1e9)],'dbName':_0x108b61['dbName']});}function deserializeDbSelection(_0x13ca0c){const _0x58ec3b=a156_0x24621f;try{const _0x27451b=JSON[_0x58ec3b(0x1dd)](_0x13ca0c);if(typeof _0x27451b['dbId']===_0x58ec3b(0x20e)&&Number[_0x58ec3b(0x20d)](_0x27451b[_0x58ec3b(0x1e9)]))return{'dbId':_0x27451b[_0x58ec3b(0x1e9)],'dbName':_0x27451b[_0x58ec3b(0x1f8)]};}catch{}throw CliErrors[_0x58ec3b(0x21c)](_0x58ec3b(0x1ee)+_0x13ca0c);}function resolveProvidedDbId(_0x6f74a3){const _0x277168=a156_0x24621f,_0x21f0e2=_0x6f74a3['flag'](_0x277168(0x1d9));if(typeof _0x21f0e2===_0x277168(0x20e)&&Number[_0x277168(0x20d)](_0x21f0e2))return _0x21f0e2;return undefined;}
|
|
1
|
+
const a164_0x5a2ef4=a164_0x4e09;(function(_0x15ee02,_0x26fc7d){const _0x3bb970=a164_0x4e09,_0x18fbf3=_0x15ee02();while(!![]){try{const _0x2e61fa=parseInt(_0x3bb970(0x1cb))/0x1+-parseInt(_0x3bb970(0x19f))/0x2*(parseInt(_0x3bb970(0x1c9))/0x3)+-parseInt(_0x3bb970(0x1cf))/0x4+parseInt(_0x3bb970(0x1a3))/0x5*(-parseInt(_0x3bb970(0x1a4))/0x6)+-parseInt(_0x3bb970(0x1b9))/0x7+parseInt(_0x3bb970(0x1b2))/0x8+parseInt(_0x3bb970(0x1a1))/0x9;if(_0x2e61fa===_0x26fc7d)break;else _0x18fbf3['push'](_0x18fbf3['shift']());}catch(_0x1e5697){_0x18fbf3['push'](_0x18fbf3['shift']());}}}(a164_0xe0ab,0xee62c));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';function a164_0xe0ab(){const _0x183e8b=['dbName','create','nonInteractive','407958CGgkIm','/smartapi/custom/saveUserCustomSql','230046HwUzyC','__manual__','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','普通\x20SQL(sql)','323980oKtfNd','POST','SQL\x20名称不能为空','number','\x20\x20SELECT\x201\x20AS\x20id','length','trim','File\x20already\x20exists:\x20','flagMissing','db-id','catch','sqlRoot','sql','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','dbId\x20不能为空','new','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','12rWeFaJ','mybatisXml','32513715ONQDpQ','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','3707095TMKXwv','6eXKGKV','MyBatis\x20XML(mybatisXml)','sqls','sqlRootDir','sqlName','sqlCode','</select>','utf8','lockFilePath','dbId\x20必须为正整数','SELECT\x201\x20AS\x20id;','请选择目标数据库:','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','parse','736192nHudVf','Local\x20SQL\x20file\x20mode','Created\x20SQL\x20query\x20','mode','请输入目标数据库\x20dbId:','appCode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','9239629Fpuyrq','<server-generated-sqlCode>','description','name','toISOString','string','SQL\x20query\x20display\x20name','str','validation','isFinite','适合带动态标签的\x20MyBatis\x20XML\x20SQL','dbId','join'];a164_0xe0ab=function(){return _0x183e8b;};return a164_0xe0ab();}import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a164_0x4e09(_0x4a8015,_0x26e290){_0x4a8015=_0x4a8015-0x19f;const _0xe0ab30=a164_0xe0ab();let _0x4e0999=_0xe0ab30[_0x4a8015];return _0x4e0999;}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x43970a){const _0x17abc5=a164_0x4e09;if(_0x43970a===_0x17abc5(0x1a0))return[_0x17abc5(0x1a2),_0x17abc5(0x1d3),_0x17abc5(0x1aa),''][_0x17abc5(0x1c5)]('\x0a');return[_0x17abc5(0x1ae),'']['join']('\x0a');}export const sqlCreate={'service':a164_0x5a2ef4(0x1db),'command':a164_0x5a2ef4(0x1c7),'description':a164_0x5a2ef4(0x1dc),'risk':'high-risk-write','flags':[{'name':a164_0x5a2ef4(0x1bc),'type':a164_0x5a2ef4(0x1be),'description':a164_0x5a2ef4(0x1bf)},{'name':a164_0x5a2ef4(0x1d8),'type':'number','description':'Target\x20database\x20ID'},{'name':a164_0x5a2ef4(0x1b5),'type':a164_0x5a2ef4(0x1be),'enum':['sql','mybatisXml'],'description':a164_0x5a2ef4(0x1b3)}],async 'validate'(_0x1098b2){const _0x5a7845=a164_0x5a2ef4;if(!_0x1098b2[_0x5a7845(0x1c8)])return;if(!_0x1098b2[_0x5a7845(0x1c0)](_0x5a7845(0x1bc))[_0x5a7845(0x1d5)]())throw CliErrors['flagMissing'](_0x5a7845(0x1bc),_0x5a7845(0x1cd));const _0x3a61dc=resolveProvidedDbId(_0x1098b2);if(typeof _0x3a61dc!=='number'||!Number[_0x5a7845(0x1c2)](_0x3a61dc)||_0x3a61dc<=0x0)throw CliErrors['flagMissing'](_0x5a7845(0x1d8),_0x5a7845(0x1b0));if(!_0x1098b2['str'](_0x5a7845(0x1b5))['trim']())throw CliErrors[_0x5a7845(0x1d7)](_0x5a7845(0x1b5),_0x5a7845(0x1b8));},async 'dryRun'(_0xe398ec){const _0x1348da=a164_0x5a2ef4,_0x3a61ce=loadSqlProjectConfig(_0xe398ec[_0x1348da(0x1b7)]),{sqlName:_0x39d16f,dbId:_0x165a81,dbName:_0x159207,mode:_0x13b27b}=await resolveSqlNewInputs(_0xe398ec),_0x22ec63=buildSqlRelativePath(_0x1348da(0x1ba),_0x39d16f,_0x159207,_0x13b27b,_0x165a81),_0x57b5a1=_0x3a61ce['sqlRootDir']+'/'+_0x22ec63;return{'method':_0x1348da(0x1d0),'url':_0x1348da(0x1ca),'body':{'appCode':_0xe398ec[_0x1348da(0x1b7)],'sqlName':_0x39d16f,'dbId':_0x165a81,'mode':_0x13b27b,'localPath':_0x57b5a1},'description':_0x1348da(0x1df)+_0x3a61ce['sqlRootDir']};},async 'execute'(_0x5e7f63){const _0x43eed2=a164_0x5a2ef4,_0x2ca017=loadSqlProjectConfig(_0x5e7f63[_0x43eed2(0x1b7)]),{sqlName:_0x57832c,dbId:_0x11291d,dbName:_0x453de6,mode:_0x5ea0bd}=await resolveSqlNewInputs(_0x5e7f63),_0x198197=generateSqlTemplate(_0x5ea0bd),_0x18e253=await createSqlQuery({'appCode':_0x5e7f63['appCode'],'sqlName':_0x57832c,'dbId':_0x11291d,'sqlContent':_0x198197}),_0x52ed27=ensureRemoteSqlContent(_0x18e253),_0x3e3535=_0x453de6||await getDbName(_0x5e7f63[_0x43eed2(0x1b7)],_0x11291d)[_0x43eed2(0x1d9)](()=>undefined),_0xaaf74f=buildSqlRelativePath(_0x18e253[_0x43eed2(0x1a9)],_0x18e253[_0x43eed2(0x1a8)],_0x3e3535,_0x5ea0bd,_0x11291d),_0xfbc677=_0x2ca017[_0x43eed2(0x1a7)]+'/'+_0xaaf74f,_0xcd28f0=buildLocalSqlFileContent({'sqlCode':_0x18e253[_0x43eed2(0x1a9)],'sqlName':_0x18e253[_0x43eed2(0x1a8)],'dbId':_0x18e253[_0x43eed2(0x1c4)]},_0x52ed27,{'dbName':_0x3e3535,'mode':_0x5ea0bd,'syncedAt':new Date()[_0x43eed2(0x1bd)](),'description':_0x18e253[_0x43eed2(0x1bb)]});if(await fileExists(_0xfbc677))throw CliErrors[_0x43eed2(0x1c1)](_0x43eed2(0x1d6)+_0xfbc677);await ensureParentDirectory(_0xfbc677),await writeFile(_0xfbc677,_0xcd28f0,_0x43eed2(0x1ab));const _0x328631=await readSqlLockFile(_0x2ca017['lockFilePath']),{lockData:_0x1f1b40,appLock:_0x27de0f}=ensureSqlLockScope(_0x328631??createEmptySqlLock(),_0x2ca017[_0x43eed2(0x1b7)],_0x2ca017[_0x43eed2(0x1da)],_0x43eed2(0x1de));return _0x27de0f[_0x43eed2(0x1a6)][_0x18e253[_0x43eed2(0x1a9)]]={...buildSqlLockEntry(_0x18e253,_0x52ed27,computeSqlContentHash(_0xcd28f0),{'dbName':_0x3e3535}),'path':_0xaaf74f,'mode':_0x5ea0bd},_0x27de0f['lastSync']=new Date()[_0x43eed2(0x1bd)](),await writeSqlLockFile(_0x2ca017[_0x43eed2(0x1ac)],_0x1f1b40),{'ok':!![],'data':{'id':_0x18e253['id'],'sqlCode':_0x18e253['sqlCode'],'sqlName':_0x18e253[_0x43eed2(0x1a8)],'dbId':_0x18e253[_0x43eed2(0x1c4)],'path':_0xfbc677,'mode':_0x5ea0bd},'message':_0x43eed2(0x1b4)+_0x18e253[_0x43eed2(0x1a9)]};}};async function resolveSqlNewInputs(_0x2d947e){const _0x57f8ae=await resolveSqlNameInput(_0x2d947e),{dbId:_0x1a2b24,dbName:_0xcb7eae}=await resolveDbSelection(_0x2d947e),_0x18c5b2=await resolveSqlModeInput(_0x2d947e);return{'sqlName':_0x57f8ae,'dbId':_0x1a2b24,'dbName':_0xcb7eae,'mode':_0x18c5b2};}async function resolveSqlNameInput(_0x340f43){const _0x100613=a164_0x5a2ef4,_0x3f59f6=_0x340f43[_0x100613(0x1c0)](_0x100613(0x1bc))[_0x100613(0x1d5)]();if(_0x3f59f6)return _0x3f59f6;if(_0x340f43[_0x100613(0x1c8)])throw CliErrors['flagMissing'](_0x100613(0x1bc),_0x100613(0x1cd));return(await input({'message':'请输入\x20SQL\x20名称:','validate':_0xb4f2e3=>_0xb4f2e3[_0x100613(0x1d5)]()?!![]:_0x100613(0x1d1)}))[_0x100613(0x1d5)]();}async function resolveDbSelection(_0x626782){const _0x12db64=a164_0x5a2ef4,_0x43cbfa=resolveProvidedDbId(_0x626782);if(typeof _0x43cbfa==='number'&&Number[_0x12db64(0x1c2)](_0x43cbfa)&&_0x43cbfa>0x0)return{'dbId':_0x43cbfa,'dbName':await getDbName(_0x626782[_0x12db64(0x1b7)],_0x43cbfa)[_0x12db64(0x1d9)](()=>undefined)};if(_0x626782['nonInteractive'])throw CliErrors['flagMissing'](_0x12db64(0x1d8),_0x12db64(0x1b0));const _0x1f00cd=await listDatabases(_0x626782[_0x12db64(0x1b7)])[_0x12db64(0x1d9)](()=>[]);if(_0x1f00cd[_0x12db64(0x1d4)]===0x1)return{'dbId':_0x1f00cd[0x0][_0x12db64(0x1c4)],'dbName':_0x1f00cd[0x0]['dbName']};if(_0x1f00cd[_0x12db64(0x1d4)]>0x1){const _0x18e383=await select({'message':_0x12db64(0x1af),'choices':[..._0x1f00cd['map'](_0x431c21=>({'name':_0x431c21[_0x12db64(0x1c6)]+'\x20('+_0x431c21[_0x12db64(0x1c4)]+')','value':serializeDbSelection(_0x431c21)})),{'name':'✎\x20手动输入\x20dbId','value':_0x12db64(0x1cc)}]});if(_0x18e383!=='__manual__')return deserializeDbSelection(_0x18e383);}const _0x5c27b6=await input({'message':_0x12db64(0x1b6),'validate':_0x4a36d5=>{const _0x340c33=_0x12db64,_0x1bb1c5=_0x4a36d5[_0x340c33(0x1d5)]();if(!_0x1bb1c5)return _0x340c33(0x1dd);const _0x24cd8e=Number(_0x1bb1c5);if(!Number['isInteger'](_0x24cd8e)||_0x24cd8e<=0x0)return _0x340c33(0x1ad);return!![];}});return{'dbId':Number(_0x5c27b6['trim']())};}async function resolveSqlModeInput(_0x149818){const _0x4feb5b=a164_0x5a2ef4,_0x481cf2=_0x149818[_0x4feb5b(0x1c0)](_0x4feb5b(0x1b5))[_0x4feb5b(0x1d5)]();if(_0x481cf2===_0x4feb5b(0x1db)||_0x481cf2===_0x4feb5b(0x1a0))return _0x481cf2;if(_0x149818['nonInteractive'])throw CliErrors[_0x4feb5b(0x1d7)](_0x4feb5b(0x1b5),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':_0x4feb5b(0x1ce),'value':_0x4feb5b(0x1db),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0x4feb5b(0x1a5),'value':_0x4feb5b(0x1a0),'description':_0x4feb5b(0x1c3)}]});}function serializeDbSelection(_0x1762ed){const _0x474e52=a164_0x5a2ef4;return JSON['stringify']({'dbId':_0x1762ed[_0x474e52(0x1c4)],'dbName':_0x1762ed['dbName']});}function deserializeDbSelection(_0x1643f0){const _0x5a20e4=a164_0x5a2ef4;try{const _0x5ea944=JSON[_0x5a20e4(0x1b1)](_0x1643f0);if(typeof _0x5ea944[_0x5a20e4(0x1c4)]==='number'&&Number[_0x5a20e4(0x1c2)](_0x5ea944[_0x5a20e4(0x1c4)]))return{'dbId':_0x5ea944[_0x5a20e4(0x1c4)],'dbName':_0x5ea944['dbName']};}catch{}throw CliErrors[_0x5a20e4(0x1c1)]('Invalid\x20database\x20selection\x20payload:\x20'+_0x1643f0);}function resolveProvidedDbId(_0x471f33){const _0x563131=a164_0x5a2ef4,_0x4353ab=_0x471f33['flag']('db-id');if(typeof _0x4353ab===_0x563131(0x1d2)&&Number['isFinite'](_0x4353ab))return _0x4353ab;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a165_0x1a4577=a165_0x5676;(function(_0x2de7b1,_0x21765a){const _0x560446=a165_0x5676,_0x1f3297=_0x2de7b1();while(!![]){try{const _0x45028f=-parseInt(_0x560446(0xe7))/0x1+parseInt(_0x560446(0xe5))/0x2+parseInt(_0x560446(0xd5))/0x3+-parseInt(_0x560446(0xe3))/0x4*(-parseInt(_0x560446(0xd2))/0x5)+-parseInt(_0x560446(0xee))/0x6+-parseInt(_0x560446(0xda))/0x7*(parseInt(_0x560446(0xd8))/0x8)+-parseInt(_0x560446(0xe9))/0x9*(-parseInt(_0x560446(0xd4))/0xa);if(_0x45028f===_0x21765a)break;else _0x1f3297['push'](_0x1f3297['shift']());}catch(_0x2a1435){_0x1f3297['push'](_0x1f3297['shift']());}}}(a165_0x2cf6,0x7eb0e));function a165_0x2cf6(){const _0x56a2c4=['No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','sqls','5KMYdwL','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','10ZzpCTD','1262430fdETfn','\x20(local\x20file\x20moved\x20to\x20trash)','projectRoot','16CGNHtW','Deleted\x20','2220813qXJASV','remoteId','/smartapi/custom/deleteUserCustomSql','fromEntries','lockFilePath','filter','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','lastSync','POST','3003780lUDGyN','entries','281708UtwhLd','trashDir','950817ufyZwn','validation','12672432GqeeUN','delete','str','sqlcode','startsWith','3698376DqGZdC','sqlRoot','sql','high-risk-write','appCode'];a165_0x2cf6=function(){return _0x56a2c4;};return a165_0x2cf6();}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 a165_0x5676(_0x2cdd0c,_0x280b1f){_0x2cdd0c=_0x2cdd0c-0xcc;const _0x2cf658=a165_0x2cf6();let _0x567650=_0x2cf658[_0x2cdd0c];return _0x567650;}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':a165_0x1a4577(0xcd),'command':a165_0x1a4577(0xea),'description':a165_0x1a4577(0xe0),'risk':a165_0x1a4577(0xce),'flags':[SQLCODE_FLAG],async 'validate'(_0x2343cc){const _0x2a7258=a165_0x1a4577,_0x601a98=loadSqlProjectConfig(_0x2343cc['appCode']),_0x286bd6=await readSqlLockFile(_0x601a98[_0x2a7258(0xde)]);if(!_0x286bd6)throw CliErrors[_0x2a7258(0xe8)](_0x2a7258(0xd3));},async 'dryRun'(_0x17623d){const _0x27f3ee=a165_0x1a4577,_0x4c431c=loadSqlProjectConfig(_0x17623d[_0x27f3ee(0xcf)]),_0x1261b0=await readSqlLockFile(_0x4c431c['lockFilePath']);if(!_0x1261b0)throw CliErrors[_0x27f3ee(0xe8)](_0x27f3ee(0xd3));const {appLock:_0x1ef624}=ensureSqlLockScope(_0x1261b0,_0x17623d[_0x27f3ee(0xcf)],_0x4c431c[_0x27f3ee(0xcc)],_0x27f3ee(0xea)),_0x34e9f7=_0x17623d[_0x27f3ee(0xeb)]('sqlcode'),_0x3f5440=_0x1ef624[_0x27f3ee(0xd1)][_0x34e9f7];if(!_0x3f5440)throw CliErrors['validation']('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x34e9f7+'\x22.');return{'method':_0x27f3ee(0xe2),'url':_0x27f3ee(0xdc),'body':{'sqlCode':_0x34e9f7,'id':_0x3f5440[_0x27f3ee(0xdb)],'localPath':resolveLocalSqlFilePath(_0x4c431c,_0x34e9f7,_0x3f5440)},'description':'Would\x20delete\x20SQL\x20'+_0x34e9f7+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x4c431c[_0x27f3ee(0xe6)]};},async 'execute'(_0x4772e7){const _0x1243cc=a165_0x1a4577,_0x4830fa=loadSqlProjectConfig(_0x4772e7[_0x1243cc(0xcf)]),_0x48e7dd=await readSqlLockFile(_0x4830fa[_0x1243cc(0xde)]);if(!_0x48e7dd)throw CliErrors[_0x1243cc(0xe8)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x22b3c4,appLock:_0xe83de1}=ensureSqlLockScope(_0x48e7dd,_0x4772e7['appCode'],_0x4830fa[_0x1243cc(0xcc)],'delete'),_0xd2538a=_0x4772e7[_0x1243cc(0xeb)](_0x1243cc(0xec)),_0x84638a=_0xe83de1['sqls'][_0xd2538a];if(!_0x84638a)throw CliErrors[_0x1243cc(0xe8)](_0x1243cc(0xd0)+_0xd2538a+'\x22.');await deleteSqlQuery({'id':_0x84638a[_0x1243cc(0xdb)],'sqlCode':_0xd2538a}),_0xe83de1[_0x1243cc(0xd1)]=Object[_0x1243cc(0xdd)](Object[_0x1243cc(0xe4)](_0xe83de1[_0x1243cc(0xd1)])[_0x1243cc(0xdf)](([_0x1b740c])=>_0x1b740c!==_0xd2538a)),_0xe83de1[_0x1243cc(0xe1)]=new Date()['toISOString'](),await writeSqlLockFile(_0x4830fa['lockFilePath'],_0x22b3c4);const _0x41faed=resolveLocalSqlFilePath(_0x4830fa,_0xd2538a,_0x84638a);let _0x5619a6;await fileExists(_0x41faed)&&(_0x5619a6=await moveToTrash(_0x4830fa[_0x1243cc(0xd7)],_0x4830fa[_0x1243cc(0xe6)],_0x41faed),await cleanupEmptyDirectories(dirname(_0x41faed),_0x4830fa['sqlRootDir']));const _0x4505d0={'deleted':_0xd2538a,'remoteId':_0x84638a[_0x1243cc(0xdb)]};if(_0x5619a6)_0x4505d0['trashedTo']=_0x5619a6;return{'ok':!![],'data':_0x4505d0,'message':_0x1243cc(0xd9)+_0xd2538a+(_0x5619a6?_0x1243cc(0xd6):'')};}};async function moveToTrash(_0xa3a40a,_0x199f6d,_0x552a2a){const _0x34368e=new Date()['toISOString']()['replace'](/[:.]/g,'-'),_0x2c6a4c=relative(_0xa3a40a,_0x552a2a),_0x47b383=join(_0x199f6d,_0x34368e,_0x2c6a4c);return await mkdir(dirname(_0x47b383),{'recursive':!![]}),await rename(_0x552a2a,_0x47b383),_0x47b383;}async function cleanupEmptyDirectories(_0x380ff6,_0x43edfb){const _0x28b44f=a165_0x1a4577;let _0x3cb327=resolve(_0x380ff6);const _0x41e875=resolve(_0x43edfb);while(_0x3cb327[_0x28b44f(0xed)](''+_0x41e875+sep)||_0x3cb327===_0x41e875){if(_0x3cb327===_0x41e875)return;try{const _0x5bfe0a=await readdir(_0x3cb327);if(_0x5bfe0a['length']>0x0)return;await rmdir(_0x3cb327);}catch{return;}_0x3cb327=dirname(_0x3cb327);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a166_0x953501=a166_0x190a;(function(_0x410488,_0x501de5){const _0x2b97e4=a166_0x190a,_0x23f452=_0x410488();while(!![]){try{const _0x24e1ad=-parseInt(_0x2b97e4(0x1c6))/0x1+-parseInt(_0x2b97e4(0x1c2))/0x2*(parseInt(_0x2b97e4(0x1be))/0x3)+parseInt(_0x2b97e4(0x1cc))/0x4*(parseInt(_0x2b97e4(0x1ba))/0x5)+parseInt(_0x2b97e4(0x1c5))/0x6*(-parseInt(_0x2b97e4(0x1bc))/0x7)+parseInt(_0x2b97e4(0x1c8))/0x8+parseInt(_0x2b97e4(0x1c3))/0x9*(parseInt(_0x2b97e4(0x1cf))/0xa)+parseInt(_0x2b97e4(0x1ce))/0xb*(-parseInt(_0x2b97e4(0x1c9))/0xc);if(_0x24e1ad===_0x501de5)break;else _0x23f452['push'](_0x23f452['shift']());}catch(_0x58a7ce){_0x23f452['push'](_0x23f452['shift']());}}}(a166_0xd32d,0x591c3));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a166_0xd32d(){const _0xfd132e=['9QKxdre','verbose','102hDKvEe','152623wjfJBi','sql','4059136ShYWjg','192bimXEi','detail','boolean','4NadeFw','sqlName','140646RaxFmn','5160920uXLrQq','sqlcode','description','2488220HqtJwQ','dbId','167342tTuMKk','Return\x20full\x20raw\x20SQL\x20query\x20object','42lGNQAn','str','read','sqlContent','56076HwAZWS'];a166_0xd32d=function(){return _0xfd132e;};return a166_0xd32d();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a166_0x190a(_0xf06c5a,_0x479e20){_0xf06c5a=_0xf06c5a-0x1ba;const _0xd32d40=a166_0xd32d();let _0x190aa4=_0xd32d40[_0xf06c5a];return _0x190aa4;}export const sqlDetail={'service':a166_0x953501(0x1c7),'command':a166_0x953501(0x1ca),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a166_0x953501(0x1c0),'flags':[SQLCODE_FLAG,{'name':a166_0x953501(0x1c4),'type':a166_0x953501(0x1cb),'description':a166_0x953501(0x1bd)}],async 'execute'(_0xf03453){const _0x1ecea1=a166_0x953501,_0x176358=await getSqlQueryInfo(_0xf03453['appCode'],_0xf03453[_0x1ecea1(0x1bf)](_0x1ecea1(0x1d0))),_0x5d661a=_0xf03453['bool'](_0x1ecea1(0x1c4));if(_0x5d661a)return{'ok':!![],'data':_0x176358};const _0x516d74=_0x176358[_0x1ecea1(0x1bb)]?await getDbName(_0xf03453['appCode'],_0x176358[_0x1ecea1(0x1bb)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x176358['sqlCode'],'sqlName':_0x176358[_0x1ecea1(0x1cd)],'db':_0x516d74?_0x516d74+'\x20('+_0x176358[_0x1ecea1(0x1bb)]+')':_0x176358[_0x1ecea1(0x1bb)]??'','description':_0x176358[_0x1ecea1(0x1d1)]??'','sqlContent':_0x176358[_0x1ecea1(0x1c1)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a167_0x57b265=a167_0x45d9;(function(_0x3bbc8f,_0x26489b){const _0x34a3a5=a167_0x45d9,_0x28ff3a=_0x3bbc8f();while(!![]){try{const _0x1caf55=parseInt(_0x34a3a5(0x15c))/0x1*(-parseInt(_0x34a3a5(0x173))/0x2)+-parseInt(_0x34a3a5(0x16a))/0x3*(-parseInt(_0x34a3a5(0x165))/0x4)+parseInt(_0x34a3a5(0x161))/0x5*(-parseInt(_0x34a3a5(0x15e))/0x6)+-parseInt(_0x34a3a5(0x16d))/0x7+parseInt(_0x34a3a5(0x168))/0x8*(parseInt(_0x34a3a5(0x16b))/0x9)+parseInt(_0x34a3a5(0x16c))/0xa*(-parseInt(_0x34a3a5(0x160))/0xb)+parseInt(_0x34a3a5(0x175))/0xc;if(_0x1caf55===_0x26489b)break;else _0x28ff3a['push'](_0x28ff3a['shift']());}catch(_0x53e05a){_0x28ff3a['push'](_0x28ff3a['shift']());}}}(a167_0x58d4,0xa9cbc));function a167_0x45d9(_0x88d973,_0x3bbab5){_0x88d973=_0x88d973-0x15c;const _0x58d4a8=a167_0x58d4();let _0x45d91d=_0x58d4a8[_0x88d973];return _0x45d91d;}function a167_0x58d4(){const _0x4c3688=['execError','exec','read','322958gZlCDD','SQL\x20execution\x20failed','40785924rHhsts','8bFaxPk','Returned\x20','252aGLIoY','appCode','110EUmpEm','84770XDCDKF','isArray','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','857176qQaphD','length','sql','196296njdEzd','string','6BAYqXR','27GVyjBt','878270kacHaP','2263604xIVuut','params','execSuccess'];a167_0x58d4=function(){return _0x4c3688;};return a167_0x58d4();}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a167_0x57b265(0x167),'command':a167_0x57b265(0x171),'description':a167_0x57b265(0x163),'risk':a167_0x57b265(0x172),'flags':[SQLCODE_FLAG,{'name':a167_0x57b265(0x16e),'type':a167_0x57b265(0x169),'description':a167_0x57b265(0x164)}],async 'execute'(_0x4c60f1){const _0x45b4eb=a167_0x57b265,_0x5af389=parseJsonParams(_0x4c60f1['str'](_0x45b4eb(0x16e))),_0x3070f1=Date['now'](),_0x1e15a9=await executeSql(_0x4c60f1[_0x45b4eb(0x15f)],_0x4c60f1['str']('sqlcode'),_0x5af389),_0x48255a=Date['now']()-_0x3070f1,_0x919aef=_0x1e15a9?.['execResult']??_0x1e15a9,_0x3cecf6=_0x1e15a9?.[_0x45b4eb(0x16f)]??!![];if(!_0x3cecf6)return{'ok':![],'data':{'error':_0x1e15a9?.[_0x45b4eb(0x170)]||'SQL\x20execution\x20failed','elapsed':_0x48255a},'message':_0x45b4eb(0x174)};const _0x50e8f7=Array[_0x45b4eb(0x162)](_0x919aef)?_0x919aef:[];return{'ok':!![],'data':{'rows':_0x50e8f7,'rowCount':_0x50e8f7['length'],'elapsed':_0x48255a},'message':_0x45b4eb(0x15d)+_0x50e8f7[_0x45b4eb(0x166)]+'\x20row(s)\x20in\x20'+_0x48255a+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4ca99a,_0x37f7af){const _0x2246b6=a168_0x7da1,_0x5b7024=_0x4ca99a();while(!![]){try{const _0x5ab8a9=parseInt(_0x2246b6(0x139))/0x1*(-parseInt(_0x2246b6(0x13b))/0x2)+-parseInt(_0x2246b6(0x13e))/0x3*(parseInt(_0x2246b6(0x13c))/0x4)+parseInt(_0x2246b6(0x141))/0x5+-parseInt(_0x2246b6(0x142))/0x6+parseInt(_0x2246b6(0x140))/0x7*(-parseInt(_0x2246b6(0x13d))/0x8)+-parseInt(_0x2246b6(0x13a))/0x9+parseInt(_0x2246b6(0x13f))/0xa;if(_0x5ab8a9===_0x37f7af)break;else _0x5b7024['push'](_0x5b7024['shift']());}catch(_0xaa93a8){_0x5b7024['push'](_0x5b7024['shift']());}}}(a168_0x2494,0x5cc1e));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';function a168_0x2494(){const _0x5e3710=['3740EmQAKL','5656024Xrxodk','1608gjIzjS','20110170Vmamfl','7BLHbjX','1407765KdxcLj','169038FejdXe','13zlheWH','3412665Tcoxjh','45710LVpajs'];a168_0x2494=function(){return _0x5e3710;};return a168_0x2494();}function a168_0x7da1(_0xa7ce99,_0x53050e){_0xa7ce99=_0xa7ce99-0x139;const _0x249428=a168_0x2494();let _0x7da18e=_0x249428[_0xa7ce99];return _0x7da18e;}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];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a169_0x4a5d19=a169_0x3cdc;(function(_0x36b29a,_0x426f69){const _0x54aadb=a169_0x3cdc,_0x394dac=_0x36b29a();while(!![]){try{const _0x2b46c3=-parseInt(_0x54aadb(0x9a))/0x1*(-parseInt(_0x54aadb(0x9e))/0x2)+-parseInt(_0x54aadb(0xb7))/0x3+-parseInt(_0x54aadb(0xa8))/0x4*(parseInt(_0x54aadb(0x95))/0x5)+-parseInt(_0x54aadb(0xad))/0x6+-parseInt(_0x54aadb(0xaf))/0x7*(parseInt(_0x54aadb(0xb6))/0x8)+-parseInt(_0x54aadb(0x96))/0x9*(parseInt(_0x54aadb(0xaa))/0xa)+-parseInt(_0x54aadb(0xb4))/0xb*(-parseInt(_0x54aadb(0xab))/0xc);if(_0x2b46c3===_0x426f69)break;else _0x394dac['push'](_0x394dac['shift']());}catch(_0x564012){_0x394dac['push'](_0x394dac['shift']());}}}(a169_0xd015,0x3000b));import{listSqlQueries}from'../../core/api-client.js';function a169_0x3cdc(_0x4a919f,_0x530863){_0x4a919f=_0x4a919f-0x91;const _0xd01515=a169_0xd015();let _0x3cdc57=_0xd01515[_0x4a919f];return _0x3cdc57;}import{getDbName}from'../../core/db-resolver.js';function a169_0xd015(){const _0x61f30e=['Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','537hcXiiU','string','description','boolean','1378vhwNVe','str','No\x20custom\x20SQL\x20queries\x20found.','paging','list','read','Found\x20','Page\x20number','sqlName','Page\x20size','165848IZQpHM','map','1926590MTrRha','468RNmvKl','\x20SQL\x20queries\x20(total:\x20','251460KuwVAM','all','28LVEhOn','name','number','verbose','num','205183NqhqRu','length','643432kLPeco','38580uNRhPR','List\x20custom\x20SQL\x20queries','pagesize','appCode','sqlCode','Filter\x20by\x20SQL\x20name','page','40RNoCCb','9POQbwN','sqlcode','dbId'];a169_0xd015=function(){return _0x61f30e;};return a169_0xd015();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a169_0x4a5d19(0xa2),'description':a169_0x4a5d19(0xb8),'risk':a169_0x4a5d19(0xa3),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a169_0x4a5d19(0xb0),'type':a169_0x4a5d19(0x9b),'description':a169_0x4a5d19(0x93)},{'name':a169_0x4a5d19(0x94),'type':a169_0x4a5d19(0xb1),'description':a169_0x4a5d19(0xa5),'default':0x1},{'name':a169_0x4a5d19(0xb9),'type':'number','description':a169_0x4a5d19(0xa7)},{'name':a169_0x4a5d19(0xb2),'type':a169_0x4a5d19(0x9d),'description':a169_0x4a5d19(0x99)}],async 'execute'(_0x58af5f){const _0x90f90e=a169_0x4a5d19,_0x215db3=await listSqlQueries(_0x58af5f[_0x90f90e(0x91)],{'sqlCode':_0x58af5f[_0x90f90e(0x9f)](_0x90f90e(0x97))||undefined,'sqlName':_0x58af5f[_0x90f90e(0x9f)](_0x90f90e(0xb0))||undefined,'currentPage':_0x58af5f[_0x90f90e(0xb3)](_0x90f90e(0x94)),'pageSize':_0x58af5f['num'](_0x90f90e(0xb9),0x32)}),_0x10c5b1=_0x58af5f['bool']('verbose'),_0x1d4636=_0x215db3['tableData']??[],_0x3baf9f=_0x215db3[_0x90f90e(0xa1)]?.['totalCount']??_0x1d4636[_0x90f90e(0xb5)];let _0x34c750;return _0x10c5b1?_0x34c750=_0x1d4636:_0x34c750=await Promise[_0x90f90e(0xae)](_0x1d4636[_0x90f90e(0xa9)](async _0x5034cc=>{const _0x48257c=_0x90f90e;let _0x40454b;try{_0x40454b=_0x5034cc[_0x48257c(0x98)]?await getDbName(_0x58af5f[_0x48257c(0x91)],_0x5034cc[_0x48257c(0x98)]):undefined;}catch{}return{'sqlCode':_0x5034cc[_0x48257c(0x92)],'sqlName':_0x5034cc[_0x48257c(0xa6)],'description':_0x5034cc[_0x48257c(0x9c)]??'','db':_0x40454b?_0x40454b+'\x20('+_0x5034cc[_0x48257c(0x98)]+')':_0x5034cc[_0x48257c(0x98)]??''};})),{'ok':!![],'data':_0x34c750,'message':_0x1d4636[_0x90f90e(0xb5)]===0x0?_0x90f90e(0xa0):_0x90f90e(0xa4)+_0x1d4636[_0x90f90e(0xb5)]+_0x90f90e(0xac)+_0x3baf9f+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a162_0x4752d0=a162_0x5b08;function a162_0x5b08(_0x3f6f7a,_0x21ceb1){_0x3f6f7a=_0x3f6f7a-0xeb;const _0x1d6710=a162_0x1d67();let _0x5b0808=_0x1d6710[_0x3f6f7a];return _0x5b0808;}(function(_0x4edcd4,_0x236d70){const _0x364e7e=a162_0x5b08,_0x76a327=_0x4edcd4();while(!![]){try{const _0x1661f0=parseInt(_0x364e7e(0xec))/0x1+-parseInt(_0x364e7e(0xf3))/0x2*(-parseInt(_0x364e7e(0x109))/0x3)+-parseInt(_0x364e7e(0x126))/0x4+parseInt(_0x364e7e(0x124))/0x5*(parseInt(_0x364e7e(0x10c))/0x6)+parseInt(_0x364e7e(0x11e))/0x7*(-parseInt(_0x364e7e(0x103))/0x8)+parseInt(_0x364e7e(0x111))/0x9*(-parseInt(_0x364e7e(0x129))/0xa)+parseInt(_0x364e7e(0xf5))/0xb;if(_0x1661f0===_0x236d70)break;else _0x76a327['push'](_0x76a327['shift']());}catch(_0x11b74f){_0x76a327['push'](_0x76a327['shift']());}}}(a162_0x1d67,0x7de83));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';function a162_0x1d67(){const _0x35d5e9=['Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','tableData','lockFilePath','Filter\x20by\x20SQL\x20display\x20name','boolean','Would\x20pull\x20','replace','bool','force','trimStart','cancelled','32599QyFhnk','\x20skipped,\x20','dbId','message','apps','sqlContent','5zhMBik','mybatisXml','1943964QckGCB','appCode','Force\x20pull\x20cancelled.','5152790FCmIjY','name','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','filter','510707TxAXaz','paging','Pull\x20complete:\x20','sqlRootDir','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','Force\x20overwrite\x20local\x20unsynced\x20changes','path','8sYOfwn','catch','11964590VmYuaf','\x20SQL\x20file(s)\x20into\x20','conflict','sqlCode','sqls','sqlName','\x20written,\x20','push','pull','str','unchanged','sqlcode','No\x20remote\x20SQL\x20queries\x20matched.','length','80iabJan','description','nonInteractive','sql','toISOString','totalCount','131907uQdZzI','skipped','join','1827366gVCYJh','\x20failed','string','test','utf8','18vBRNEV','sqlRoot'];a162_0x1d67=function(){return _0x35d5e9;};return a162_0x1d67();}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(_0x99ed3c,_0x304a33){const _0x4f91ad=a162_0x5b08,_0x2eff23=[];let _0x2acce7=0x1;while(!![]){const _0x1bc937=await listSqlQueries(_0x99ed3c,{'currentPage':_0x2acce7,'pageSize':PAGE_SIZE,'sqlCode':_0x304a33[_0x4f91ad(0xf8)],'sqlName':_0x304a33[_0x4f91ad(0xfa)]}),_0x31b371=_0x1bc937[_0x4f91ad(0x114)]??[];_0x2eff23[_0x4f91ad(0xfc)](..._0x31b371);if(_0x31b371['length']===0x0)break;const _0x1bfe7e=_0x1bc937[_0x4f91ad(0xed)]?.[_0x4f91ad(0x108)];if(_0x1bfe7e!=null?_0x2eff23[_0x4f91ad(0x102)]>=_0x1bfe7e:_0x31b371[_0x4f91ad(0x102)]<PAGE_SIZE)break;_0x2acce7++;}return _0x2eff23;}async function ensureSqlContent(_0x2d69f6){const _0x4cb295=a162_0x5b08;if(_0x2d69f6[_0x4cb295(0x123)]!=null&&String(_0x2d69f6[_0x4cb295(0x123)])['length']>0x0)return _0x2d69f6;return getSqlQueryDetail(_0x2d69f6['sqlCode']);}export const sqlPull={'service':a162_0x4752d0(0x106),'command':'pull','description':a162_0x4752d0(0x113),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a162_0x4752d0(0x10e),'description':a162_0x4752d0(0x116)},{'name':'force','type':a162_0x4752d0(0x117),'description':a162_0x4752d0(0xf1)}],async 'dryRun'(_0x9c60ce){const _0x393d05=a162_0x4752d0,_0x216735=loadSqlProjectConfig(_0x9c60ce['appCode']),_0x2b6a3c=await readSqlLockFile(_0x216735[_0x393d05(0x115)]),{appLock:_0x4bfa91}=ensureSqlLockScope(_0x2b6a3c??createEmptySqlLock(),_0x216735[_0x393d05(0x127)],_0x216735[_0x393d05(0x112)],_0x393d05(0xfd)),_0x45822a=await fetchAllSqlQueries(_0x9c60ce[_0x393d05(0x127)],{'sqlCode':_0x9c60ce[_0x393d05(0xfe)](_0x393d05(0x100))||undefined,'sqlName':_0x9c60ce[_0x393d05(0xfe)](_0x393d05(0x12a))||undefined}),_0x5ceee7=[];for(const _0x54d47b of _0x45822a){const _0x176da7=await ensureSqlContent(_0x54d47b),_0x29fb8d=ensureRemoteSqlContent(_0x176da7),_0x206211=detectModeFromSql(_0x176da7),_0x27a90a=_0x176da7[_0x393d05(0x120)]?await getDbName(_0x9c60ce['appCode'],Number(_0x176da7[_0x393d05(0x120)]))['catch'](()=>undefined):undefined,_0x220b31=buildLocalSqlFileContent({'sqlCode':_0x176da7[_0x393d05(0xf8)],'sqlName':_0x176da7[_0x393d05(0xfa)],'dbId':_0x176da7['dbId']},_0x29fb8d,{'dbName':_0x27a90a,'mode':_0x206211,'syncedAt':new Date()[_0x393d05(0x107)](),'description':_0x176da7[_0x393d05(0x104)]}),_0x19b359=buildSqlLockEntry(_0x176da7,_0x29fb8d,'',{'dbName':_0x27a90a}),_0x245447=resolveLocalSqlFilePath(_0x216735,_0x176da7[_0x393d05(0xf8)],_0x19b359);let _0x1ba4fe='would_pull',_0x45ace8;if(await fileExists(_0x245447)){const _0x3a3b26=await readFile(_0x245447,'utf8');isEquivalentPulledSqlFile(_0x3a3b26,_0x220b31,_0x206211)?(_0x1ba4fe=_0x393d05(0x10a),_0x45ace8=_0x393d05(0xff)):(_0x1ba4fe=_0x393d05(0xf7),_0x45ace8=_0x393d05(0xf0));}_0x5ceee7['push']({'sqlCode':_0x176da7[_0x393d05(0xf8)],'sqlName':_0x176da7[_0x393d05(0xfa)],'filePath':_0x245447,'status':_0x1ba4fe,'reason':_0x45ace8});}return{'method':'POST','url':_0x393d05(0x12b),'body':{'appCode':_0x9c60ce['appCode'],'sqlCode':_0x9c60ce[_0x393d05(0xfe)](_0x393d05(0x100))||null,'sqlName':_0x9c60ce[_0x393d05(0xfe)](_0x393d05(0x12a))||null,'files':_0x5ceee7},'description':_0x393d05(0x118)+_0x5ceee7[_0x393d05(0x102)]+_0x393d05(0xf6)+_0x216735[_0x393d05(0xef)]};},async 'execute'(_0x1cb688){const _0x2fb4dc=a162_0x4752d0,_0x53e22b=loadSqlProjectConfig(_0x1cb688[_0x2fb4dc(0x127)]),_0x1e28ea=await readSqlLockFile(_0x53e22b[_0x2fb4dc(0x115)]),{lockData:_0x4f43b3,appLock:_0x1150d9}=ensureSqlLockScope(_0x1e28ea??createEmptySqlLock(),_0x53e22b[_0x2fb4dc(0x127)],_0x53e22b['sqlRoot'],_0x2fb4dc(0xfd)),_0x29aecf=_0x1cb688[_0x2fb4dc(0x11a)](_0x2fb4dc(0x11b)),_0x13dbd0=await fetchAllSqlQueries(_0x1cb688[_0x2fb4dc(0x127)],{'sqlCode':_0x1cb688['str'](_0x2fb4dc(0x100))||undefined,'sqlName':_0x1cb688[_0x2fb4dc(0xfe)]('name')||undefined});if(_0x13dbd0[_0x2fb4dc(0x102)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x2fb4dc(0x101)};const _0x1075ef=[],_0x1f63d9=[];for(const _0x4d9f4a of _0x13dbd0){try{_0x1075ef[_0x2fb4dc(0xfc)](await ensureSqlContent(_0x4d9f4a));}catch(_0x259018){_0x1f63d9[_0x2fb4dc(0xfc)]({'sqlCode':_0x4d9f4a['sqlCode'],'error':_0x259018 instanceof Error?_0x259018[_0x2fb4dc(0x121)]:String(_0x259018)});}}if(_0x29aecf&&!_0x1cb688[_0x2fb4dc(0x105)]){let _0x5c32fa=![];for(const _0x35c469 of _0x1075ef){const _0x15fa1a=detectModeFromSql(_0x35c469),_0x4c7878=_0x35c469[_0x2fb4dc(0x120)]?await getDbName(_0x1cb688[_0x2fb4dc(0x127)],Number(_0x35c469['dbId']))['catch'](()=>undefined):undefined,_0xc28283=buildLocalSqlFileContent({'sqlCode':_0x35c469[_0x2fb4dc(0xf8)],'sqlName':_0x35c469[_0x2fb4dc(0xfa)],'dbId':_0x35c469[_0x2fb4dc(0x120)]},ensureRemoteSqlContent(_0x35c469),{'dbName':_0x4c7878,'mode':_0x15fa1a,'syncedAt':new Date()[_0x2fb4dc(0x107)](),'description':_0x35c469[_0x2fb4dc(0x104)]}),_0xb871cc=resolveLocalSqlFilePath(_0x53e22b,_0x35c469['sqlCode'],buildSqlLockEntry(_0x35c469,ensureRemoteSqlContent(_0x35c469),'',{'dbName':_0x4c7878}));if(await fileExists(_0xb871cc)){const _0x9f58b2=await readFile(_0xb871cc,_0x2fb4dc(0x110));if(!isEquivalentPulledSqlFile(_0x9f58b2,_0xc28283,_0x15fa1a)){_0x5c32fa=!![];break;}}}if(_0x5c32fa){const _0x42dbdb=await confirmForceOverwrite(_0x2fb4dc(0x12c));if(!_0x42dbdb)throw CliErrors[_0x2fb4dc(0x11d)](_0x2fb4dc(0x128));}}const _0x4498f1=cloneSqlLockData(_0x4f43b3),_0x3faa63=_0x4498f1[_0x2fb4dc(0x122)][_0x53e22b[_0x2fb4dc(0x127)]],_0xfe60fd=[],_0x20b08a=[];for(const _0x5b7882 of _0x1075ef){const _0x3a29f4=_0x3faa63[_0x2fb4dc(0xf9)][_0x5b7882[_0x2fb4dc(0xf8)]],_0x2fff32=ensureRemoteSqlContent(_0x5b7882),_0x12a875=detectModeFromSql(_0x5b7882),_0x35cc88=_0x5b7882['dbId']?await getDbName(_0x1cb688['appCode'],Number(_0x5b7882[_0x2fb4dc(0x120)]))[_0x2fb4dc(0xf4)](()=>undefined):undefined,_0x206572=buildLocalSqlFileContent({'sqlCode':_0x5b7882[_0x2fb4dc(0xf8)],'sqlName':_0x5b7882[_0x2fb4dc(0xfa)],'dbId':_0x5b7882[_0x2fb4dc(0x120)]},_0x2fff32,{'dbName':_0x35cc88,'mode':_0x12a875,'syncedAt':new Date()[_0x2fb4dc(0x107)](),'description':_0x5b7882[_0x2fb4dc(0x104)]}),_0x3207c0=buildSqlLockEntry(_0x5b7882,_0x2fff32,computeSqlContentHash(_0x206572),{'dbName':_0x35cc88}),_0x510157=_0x3207c0[_0x2fb4dc(0xf2)],_0x147607=join(_0x53e22b[_0x2fb4dc(0xef)],_0x510157);try{if(await fileExists(_0x147607)){const _0x915de0=await readFile(_0x147607,'utf8');if(isEquivalentPulledSqlFile(_0x915de0,_0x206572,_0x12a875)){_0x20b08a[_0x2fb4dc(0xfc)]({'sqlCode':_0x5b7882[_0x2fb4dc(0xf8)],'reason':_0x2fb4dc(0xff)}),_0x3faa63[_0x2fb4dc(0xf9)][_0x5b7882[_0x2fb4dc(0xf8)]]={..._0x3207c0,'hash':computeSqlContentHash(_0x915de0),'path':_0x510157};continue;}if(!_0x29aecf){_0x20b08a['push']({'sqlCode':_0x5b7882[_0x2fb4dc(0xf8)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x534acc=_0x3a29f4?.[_0x2fb4dc(0xf2)]?join(_0x53e22b[_0x2fb4dc(0xef)],_0x3a29f4[_0x2fb4dc(0xf2)]):undefined;_0x534acc&&_0x534acc!==_0x147607&&await fileExists(_0x534acc)&&await rm(_0x534acc,{'force':!![]}),await ensureParentDirectory(_0x147607),await writeFile(_0x147607,_0x206572,_0x2fb4dc(0x110)),_0x3faa63[_0x2fb4dc(0xf9)][_0x5b7882['sqlCode']]={..._0x3207c0,'path':_0x510157},_0xfe60fd['push']({'sqlCode':_0x5b7882[_0x2fb4dc(0xf8)],'filePath':_0x147607});}catch(_0x5586cd){_0x1f63d9['push']({'sqlCode':_0x5b7882[_0x2fb4dc(0xf8)],'error':_0x5586cd instanceof Error?_0x5586cd['message']:String(_0x5586cd)});}}return _0x3faa63['lastSync']=new Date()[_0x2fb4dc(0x107)](),await writeSqlLockFile(_0x53e22b['lockFilePath'],_0x4498f1),{'ok':_0x1f63d9[_0x2fb4dc(0x102)]===0x0,'data':{'pulled':_0xfe60fd,'skipped':_0x20b08a,'failed':_0x1f63d9},'message':_0x2fb4dc(0xee)+_0xfe60fd['length']+_0x2fb4dc(0xfb)+_0x20b08a[_0x2fb4dc(0x102)]+_0x2fb4dc(0x11f)+_0x1f63d9[_0x2fb4dc(0x102)]+_0x2fb4dc(0x10d)};}};function detectModeFromSql(_0x153a21){const _0x56f664=a162_0x4752d0,_0x2260b5=ensureRemoteSqlContent(_0x153a21),_0x3069bc=stripLocalSqlMetadata(_0x2260b5,_0x56f664(0x125))[_0x56f664(0x11c)]();if(/^<(select|insert|update|delete)\b/i[_0x56f664(0x10f)](_0x3069bc))return _0x56f664(0x125);return _0x56f664(0x106);}function isEquivalentPulledSqlFile(_0x301a0d,_0x2e8d09,_0x314f32){return normalizePullComparableContent(_0x301a0d,_0x314f32)===normalizePullComparableContent(_0x2e8d09,_0x314f32);}function normalizePullComparableContent(_0x46d666,_0x10c9c0){const _0x49e4eb=a162_0x4752d0,_0x2e81bd=_0x46d666[_0x49e4eb(0x119)](/\r\n/g,'\x0a')['split']('\x0a'),_0x2f2ab7=_0x2e81bd[_0x49e4eb(0xeb)](_0xda297f=>!isSyncedAtMetadataLine(_0xda297f,_0x10c9c0));return _0x2f2ab7[_0x49e4eb(0x10b)]('\x0a');}function isSyncedAtMetadataLine(_0x574351,_0x429a6f){const _0xfa8c54=a162_0x4752d0;if(_0x429a6f===_0xfa8c54(0x125))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x574351);return/^\s*--\s*@lovrabet\.syncedAt:/[_0xfa8c54(0x10f)](_0x574351);}
|
|
1
|
+
const a170_0x5e992d=a170_0x4467;function a170_0x4467(_0x430a70,_0x42ce95){_0x430a70=_0x430a70-0x1f4;const _0x2c4a4d=a170_0x2c4a();let _0x4467b5=_0x2c4a4d[_0x430a70];return _0x4467b5;}(function(_0x5ec66f,_0x2a3f48){const _0x702463=a170_0x4467,_0x9c3b6b=_0x5ec66f();while(!![]){try{const _0x58231d=-parseInt(_0x702463(0x208))/0x1+-parseInt(_0x702463(0x202))/0x2+parseInt(_0x702463(0x22a))/0x3*(parseInt(_0x702463(0x205))/0x4)+parseInt(_0x702463(0x201))/0x5*(parseInt(_0x702463(0x210))/0x6)+parseInt(_0x702463(0x221))/0x7*(-parseInt(_0x702463(0x225))/0x8)+parseInt(_0x702463(0x1f4))/0x9+parseInt(_0x702463(0x1ff))/0xa;if(_0x58231d===_0x2a3f48)break;else _0x9c3b6b['push'](_0x9c3b6b['shift']());}catch(_0x25fb03){_0x9c3b6b['push'](_0x9c3b6b['shift']());}}}(a170_0x2c4a,0x415bd));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';function a170_0x2c4a(){const _0x5cd5a4=['150uKmOkk','path','mybatisXml','Would\x20pull\x20','lockFilePath','utf8','POST','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','string','cancelled','Force\x20pull\x20cancelled.','split','lastSync','paging','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','push','trimStart','7NxJAPN','appCode','conflict','force','3865624VmazxS','dbId','length','sqls','bool','1593105gUOaAf','\x20skipped,\x20','filter','sqlContent','Pull\x20complete:\x20','\x20written,\x20','boolean','totalCount','str','1574343IVtkpH','sqlcode','catch','sqlRootDir','sqlName','Filter\x20by\x20SQL\x20display\x20name','message','description','sqlCode','\x20SQL\x20file(s)\x20into\x20','replace','3731770OhUpap','write','39085zzbXpf','823912bFHHLX','skipped','toISOString','4NtCNRS','would_pull','pull','111696gFeCwj','name','unchanged','test','apps','sql','\x20failed','No\x20remote\x20SQL\x20queries\x20matched.'];a170_0x2c4a=function(){return _0x5cd5a4;};return a170_0x2c4a();}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(_0x21fe2e,_0x44a1cb){const _0x484887=a170_0x4467,_0x424ba3=[];let _0x515a11=0x1;while(!![]){const _0x2ae78c=await listSqlQueries(_0x21fe2e,{'currentPage':_0x515a11,'pageSize':PAGE_SIZE,'sqlCode':_0x44a1cb['sqlCode'],'sqlName':_0x44a1cb['sqlName']}),_0x453aa7=_0x2ae78c['tableData']??[];_0x424ba3['push'](..._0x453aa7);if(_0x453aa7[_0x484887(0x227)]===0x0)break;const _0x2fd06c=_0x2ae78c[_0x484887(0x21d)]?.[_0x484887(0x231)];if(_0x2fd06c!=null?_0x424ba3[_0x484887(0x227)]>=_0x2fd06c:_0x453aa7[_0x484887(0x227)]<PAGE_SIZE)break;_0x515a11++;}return _0x424ba3;}async function ensureSqlContent(_0x171511){const _0x38cba7=a170_0x4467;if(_0x171511[_0x38cba7(0x22d)]!=null&&String(_0x171511[_0x38cba7(0x22d)])[_0x38cba7(0x227)]>0x0)return _0x171511;return getSqlQueryDetail(_0x171511[_0x38cba7(0x1fc)]);}export const sqlPull={'service':a170_0x5e992d(0x20d),'command':'pull','description':a170_0x5e992d(0x21e),'risk':a170_0x5e992d(0x200),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a170_0x5e992d(0x209),'type':a170_0x5e992d(0x218),'description':a170_0x5e992d(0x1f9)},{'name':a170_0x5e992d(0x224),'type':a170_0x5e992d(0x230),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x536783){const _0x7b59a3=a170_0x5e992d,_0x7491be=loadSqlProjectConfig(_0x536783[_0x7b59a3(0x222)]),_0x23703b=await readSqlLockFile(_0x7491be['lockFilePath']),{appLock:_0x2a528d}=ensureSqlLockScope(_0x23703b??createEmptySqlLock(),_0x7491be[_0x7b59a3(0x222)],_0x7491be['sqlRoot'],'pull'),_0x52652b=await fetchAllSqlQueries(_0x536783['appCode'],{'sqlCode':_0x536783[_0x7b59a3(0x232)](_0x7b59a3(0x1f5))||undefined,'sqlName':_0x536783[_0x7b59a3(0x232)]('name')||undefined}),_0x62290b=[];for(const _0x1d2706 of _0x52652b){const _0x9d7a9e=await ensureSqlContent(_0x1d2706),_0x4653a8=ensureRemoteSqlContent(_0x9d7a9e),_0x5d447a=detectModeFromSql(_0x9d7a9e),_0x3104ef=_0x9d7a9e[_0x7b59a3(0x226)]?await getDbName(_0x536783[_0x7b59a3(0x222)],Number(_0x9d7a9e[_0x7b59a3(0x226)]))[_0x7b59a3(0x1f6)](()=>undefined):undefined,_0xfeaf40=buildLocalSqlFileContent({'sqlCode':_0x9d7a9e[_0x7b59a3(0x1fc)],'sqlName':_0x9d7a9e[_0x7b59a3(0x1f8)],'dbId':_0x9d7a9e[_0x7b59a3(0x226)]},_0x4653a8,{'dbName':_0x3104ef,'mode':_0x5d447a,'syncedAt':new Date()[_0x7b59a3(0x204)](),'description':_0x9d7a9e[_0x7b59a3(0x1fb)]}),_0x1340f8=buildSqlLockEntry(_0x9d7a9e,_0x4653a8,'',{'dbName':_0x3104ef}),_0xa99426=resolveLocalSqlFilePath(_0x7491be,_0x9d7a9e[_0x7b59a3(0x1fc)],_0x1340f8);let _0x31cfab=_0x7b59a3(0x206),_0x22f7bd;if(await fileExists(_0xa99426)){const _0x148114=await readFile(_0xa99426,_0x7b59a3(0x215));isEquivalentPulledSqlFile(_0x148114,_0xfeaf40,_0x5d447a)?(_0x31cfab=_0x7b59a3(0x203),_0x22f7bd=_0x7b59a3(0x20a)):(_0x31cfab=_0x7b59a3(0x223),_0x22f7bd='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x62290b[_0x7b59a3(0x21f)]({'sqlCode':_0x9d7a9e[_0x7b59a3(0x1fc)],'sqlName':_0x9d7a9e[_0x7b59a3(0x1f8)],'filePath':_0xa99426,'status':_0x31cfab,'reason':_0x22f7bd});}return{'method':_0x7b59a3(0x216),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x536783[_0x7b59a3(0x222)],'sqlCode':_0x536783[_0x7b59a3(0x232)](_0x7b59a3(0x1f5))||null,'sqlName':_0x536783[_0x7b59a3(0x232)](_0x7b59a3(0x209))||null,'files':_0x62290b},'description':_0x7b59a3(0x213)+_0x62290b[_0x7b59a3(0x227)]+_0x7b59a3(0x1fd)+_0x7491be['sqlRootDir']};},async 'execute'(_0x53f1da){const _0x4225fa=a170_0x5e992d,_0x503fbf=loadSqlProjectConfig(_0x53f1da[_0x4225fa(0x222)]),_0x260aac=await readSqlLockFile(_0x503fbf[_0x4225fa(0x214)]),{lockData:_0x343548,appLock:_0x30ac60}=ensureSqlLockScope(_0x260aac??createEmptySqlLock(),_0x503fbf['appCode'],_0x503fbf['sqlRoot'],_0x4225fa(0x207)),_0x35e5de=_0x53f1da[_0x4225fa(0x229)]('force'),_0x23489b=await fetchAllSqlQueries(_0x53f1da['appCode'],{'sqlCode':_0x53f1da[_0x4225fa(0x232)](_0x4225fa(0x1f5))||undefined,'sqlName':_0x53f1da[_0x4225fa(0x232)](_0x4225fa(0x209))||undefined});if(_0x23489b[_0x4225fa(0x227)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4225fa(0x20f)};const _0x2adc52=[],_0x3f545e=[];for(const _0x5da422 of _0x23489b){try{_0x2adc52[_0x4225fa(0x21f)](await ensureSqlContent(_0x5da422));}catch(_0x11cc8c){_0x3f545e[_0x4225fa(0x21f)]({'sqlCode':_0x5da422['sqlCode'],'error':_0x11cc8c instanceof Error?_0x11cc8c[_0x4225fa(0x1fa)]:String(_0x11cc8c)});}}if(_0x35e5de&&!_0x53f1da['nonInteractive']){let _0x3da236=![];for(const _0x592f0a of _0x2adc52){const _0x5ce742=detectModeFromSql(_0x592f0a),_0x33e0f5=_0x592f0a[_0x4225fa(0x226)]?await getDbName(_0x53f1da[_0x4225fa(0x222)],Number(_0x592f0a[_0x4225fa(0x226)]))[_0x4225fa(0x1f6)](()=>undefined):undefined,_0xed62a6=buildLocalSqlFileContent({'sqlCode':_0x592f0a['sqlCode'],'sqlName':_0x592f0a['sqlName'],'dbId':_0x592f0a['dbId']},ensureRemoteSqlContent(_0x592f0a),{'dbName':_0x33e0f5,'mode':_0x5ce742,'syncedAt':new Date()[_0x4225fa(0x204)](),'description':_0x592f0a['description']}),_0x4f12b9=resolveLocalSqlFilePath(_0x503fbf,_0x592f0a[_0x4225fa(0x1fc)],buildSqlLockEntry(_0x592f0a,ensureRemoteSqlContent(_0x592f0a),'',{'dbName':_0x33e0f5}));if(await fileExists(_0x4f12b9)){const _0x5f5d26=await readFile(_0x4f12b9,'utf8');if(!isEquivalentPulledSqlFile(_0x5f5d26,_0xed62a6,_0x5ce742)){_0x3da236=!![];break;}}}if(_0x3da236){const _0x12760d=await confirmForceOverwrite(_0x4225fa(0x217));if(!_0x12760d)throw CliErrors[_0x4225fa(0x219)](_0x4225fa(0x21a));}}const _0x4d2d96=cloneSqlLockData(_0x343548),_0x449c36=_0x4d2d96[_0x4225fa(0x20c)][_0x503fbf['appCode']],_0x54f9da=[],_0x35e6fd=[];for(const _0x577fdc of _0x2adc52){const _0x2fe978=_0x449c36['sqls'][_0x577fdc[_0x4225fa(0x1fc)]],_0x2df48e=ensureRemoteSqlContent(_0x577fdc),_0x337c57=detectModeFromSql(_0x577fdc),_0x4e86d5=_0x577fdc[_0x4225fa(0x226)]?await getDbName(_0x53f1da[_0x4225fa(0x222)],Number(_0x577fdc[_0x4225fa(0x226)]))[_0x4225fa(0x1f6)](()=>undefined):undefined,_0x288df8=buildLocalSqlFileContent({'sqlCode':_0x577fdc[_0x4225fa(0x1fc)],'sqlName':_0x577fdc[_0x4225fa(0x1f8)],'dbId':_0x577fdc[_0x4225fa(0x226)]},_0x2df48e,{'dbName':_0x4e86d5,'mode':_0x337c57,'syncedAt':new Date()[_0x4225fa(0x204)](),'description':_0x577fdc[_0x4225fa(0x1fb)]}),_0x45abf7=buildSqlLockEntry(_0x577fdc,_0x2df48e,computeSqlContentHash(_0x288df8),{'dbName':_0x4e86d5}),_0x15dfe8=_0x45abf7[_0x4225fa(0x211)],_0x439f3f=join(_0x503fbf[_0x4225fa(0x1f7)],_0x15dfe8);try{if(await fileExists(_0x439f3f)){const _0xeff5d=await readFile(_0x439f3f,_0x4225fa(0x215));if(isEquivalentPulledSqlFile(_0xeff5d,_0x288df8,_0x337c57)){_0x35e6fd['push']({'sqlCode':_0x577fdc[_0x4225fa(0x1fc)],'reason':_0x4225fa(0x20a)}),_0x449c36['sqls'][_0x577fdc[_0x4225fa(0x1fc)]]={..._0x45abf7,'hash':computeSqlContentHash(_0xeff5d),'path':_0x15dfe8};continue;}if(!_0x35e5de){_0x35e6fd['push']({'sqlCode':_0x577fdc['sqlCode'],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x444bdb=_0x2fe978?.[_0x4225fa(0x211)]?join(_0x503fbf[_0x4225fa(0x1f7)],_0x2fe978[_0x4225fa(0x211)]):undefined;_0x444bdb&&_0x444bdb!==_0x439f3f&&await fileExists(_0x444bdb)&&await rm(_0x444bdb,{'force':!![]}),await ensureParentDirectory(_0x439f3f),await writeFile(_0x439f3f,_0x288df8,_0x4225fa(0x215)),_0x449c36[_0x4225fa(0x228)][_0x577fdc[_0x4225fa(0x1fc)]]={..._0x45abf7,'path':_0x15dfe8},_0x54f9da['push']({'sqlCode':_0x577fdc[_0x4225fa(0x1fc)],'filePath':_0x439f3f});}catch(_0x482541){_0x3f545e[_0x4225fa(0x21f)]({'sqlCode':_0x577fdc['sqlCode'],'error':_0x482541 instanceof Error?_0x482541[_0x4225fa(0x1fa)]:String(_0x482541)});}}return _0x449c36[_0x4225fa(0x21c)]=new Date()[_0x4225fa(0x204)](),await writeSqlLockFile(_0x503fbf['lockFilePath'],_0x4d2d96),{'ok':_0x3f545e[_0x4225fa(0x227)]===0x0,'data':{'pulled':_0x54f9da,'skipped':_0x35e6fd,'failed':_0x3f545e},'message':_0x4225fa(0x22e)+_0x54f9da[_0x4225fa(0x227)]+_0x4225fa(0x22f)+_0x35e6fd[_0x4225fa(0x227)]+_0x4225fa(0x22b)+_0x3f545e[_0x4225fa(0x227)]+_0x4225fa(0x20e)};}};function detectModeFromSql(_0x21a84c){const _0x1f7a4f=a170_0x5e992d,_0x44e8c4=ensureRemoteSqlContent(_0x21a84c),_0x287550=stripLocalSqlMetadata(_0x44e8c4,'mybatisXml')[_0x1f7a4f(0x220)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x287550))return _0x1f7a4f(0x212);return _0x1f7a4f(0x20d);}function isEquivalentPulledSqlFile(_0x423167,_0x47c9b9,_0x4f5be9){return normalizePullComparableContent(_0x423167,_0x4f5be9)===normalizePullComparableContent(_0x47c9b9,_0x4f5be9);}function normalizePullComparableContent(_0x360577,_0x5d8cf6){const _0x3733d1=a170_0x5e992d,_0x5e9692=_0x360577[_0x3733d1(0x1fe)](/\r\n/g,'\x0a')[_0x3733d1(0x21b)]('\x0a'),_0x1528fb=_0x5e9692[_0x3733d1(0x22c)](_0xf69d95=>!isSyncedAtMetadataLine(_0xf69d95,_0x5d8cf6));return _0x1528fb['join']('\x0a');}function isSyncedAtMetadataLine(_0x29319a,_0x3725d5){const _0x55347e=a170_0x5e992d;if(_0x3725d5===_0x55347e(0x212))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x55347e(0x20b)](_0x29319a);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x29319a);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a163_0x38fdec=a163_0x3e08;(function(_0x43e33e,_0x487831){const _0x51d9b2=a163_0x3e08,_0x2ad856=_0x43e33e();while(!![]){try{const _0x424a73=parseInt(_0x51d9b2(0xe5))/0x1*(parseInt(_0x51d9b2(0xf6))/0x2)+parseInt(_0x51d9b2(0xd8))/0x3*(parseInt(_0x51d9b2(0xd5))/0x4)+parseInt(_0x51d9b2(0xd9))/0x5*(-parseInt(_0x51d9b2(0xf5))/0x6)+-parseInt(_0x51d9b2(0xc1))/0x7+-parseInt(_0x51d9b2(0xdc))/0x8*(-parseInt(_0x51d9b2(0xdf))/0x9)+-parseInt(_0x51d9b2(0xbc))/0xa+parseInt(_0x51d9b2(0xbf))/0xb;if(_0x424a73===_0x487831)break;else _0x2ad856['push'](_0x2ad856['shift']());}catch(_0x57b7da){_0x2ad856['push'](_0x2ad856['shift']());}}}(a163_0x10e5,0x1c9aa));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(_0x28fa0d,_0x3285f9,_0xbba3d0){const _0x35e316=a163_0x3e08,_0x546524=await scanLocalSqlQueries(_0x28fa0d),_0x172e19=new Map();for(const _0x1abb24 of _0x546524){if(_0xbba3d0&&_0x1abb24['sqlCode']!==_0xbba3d0)continue;const _0x2f4eaf=_0x172e19[_0x35e316(0xd0)](_0x1abb24['sqlCode'])??[];_0x2f4eaf['push'](_0x1abb24),_0x172e19[_0x35e316(0xdb)](_0x1abb24[_0x35e316(0xd6)],_0x2f4eaf);}if(_0xbba3d0&&!_0x172e19['has'](_0xbba3d0))throw CliErrors[_0x35e316(0xc4)](_0x35e316(0xc8)+_0xbba3d0);const _0x19401f=[];for(const [_0x1c175a,_0x3d867d]of _0x172e19[_0x35e316(0xcf)]()){if(_0x3d867d['length']===0x1){_0x19401f['push'](_0x3d867d[0x0]);continue;}const _0x34ef34=_0x3285f9[_0x35e316(0xf9)][_0x1c175a],_0x113223=_0x34ef34?.[_0x35e316(0xf1)],_0x291292=_0x113223?_0x3d867d['filter'](_0xb4dd81=>_0xb4dd81[_0x35e316(0xf4)]!==_0x113223):_0x3d867d;if(_0x34ef34&&_0x291292[_0x35e316(0xd2)]===0x1){_0x19401f['push'](_0x291292[0x0]);continue;}throw CliErrors[_0x35e316(0xc4)](_0x35e316(0xe8)+_0x1c175a+_0x35e316(0xf8));}return _0x19401f;}export const sqlPush={'service':'sql','command':a163_0x38fdec(0xce),'description':a163_0x38fdec(0xde),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a163_0x38fdec(0xe4),'type':a163_0x38fdec(0xcb),'description':a163_0x38fdec(0xfc)}],async 'dryRun'(_0x11580f){const _0x325a4b=a163_0x38fdec,_0x1acbbe=loadSqlProjectConfig(_0x11580f[_0x325a4b(0xc2)]),_0x39a4b5=await readSqlLockFile(_0x1acbbe[_0x325a4b(0xbe)]),{appLock:_0xc35a3e}=ensureSqlLockScope(_0x39a4b5??createEmptySqlLock(),_0x11580f[_0x325a4b(0xc2)],_0x1acbbe[_0x325a4b(0xbb)],_0x325a4b(0xce)),_0x426e1a=await getTargetSqlQueries(_0x1acbbe,_0xc35a3e,_0x11580f[_0x325a4b(0xef)](_0x325a4b(0xe0))||undefined),_0x3e8c95=[];for(const _0x465ec4 of _0x426e1a){const _0x48c8b2=await computeSqlFileHash(_0x465ec4[_0x325a4b(0xbd)]),_0x335f73=_0xc35a3e[_0x325a4b(0xf9)][_0x465ec4[_0x325a4b(0xd6)]],_0x5a8332=!!_0x335f73&&(_0x335f73[_0x325a4b(0xf1)]!==_0x465ec4[_0x325a4b(0xf4)]||!!_0x465ec4[_0x325a4b(0xdd)]&&_0x335f73[_0x325a4b(0xdd)]!==_0x465ec4['sqlName']);if(!_0x11580f[_0x325a4b(0xeb)](_0x325a4b(0xe4))&&_0x335f73&&_0x335f73[_0x325a4b(0xc7)]===_0x48c8b2&&!_0x5a8332)continue;_0x3e8c95[_0x325a4b(0xce)](_0x465ec4[_0x325a4b(0xd6)]);}return{'method':'POST','url':_0x325a4b(0xf2),'body':{'sqlCodes':_0x3e8c95,'appCode':_0x11580f[_0x325a4b(0xc2)]},'description':_0x325a4b(0xca)+_0x3e8c95[_0x325a4b(0xd2)]+_0x325a4b(0xea)};},async 'execute'(_0x4ab9fc){const _0x4dfdbd=a163_0x38fdec,_0x1d75bc=loadSqlProjectConfig(_0x4ab9fc[_0x4dfdbd(0xc2)]),_0x5f324c=await readSqlLockFile(_0x1d75bc['lockFilePath']),{lockData:_0x405092,appLock:_0x43fe1f}=ensureSqlLockScope(_0x5f324c??createEmptySqlLock(),_0x4ab9fc[_0x4dfdbd(0xc2)],_0x1d75bc[_0x4dfdbd(0xbb)],_0x4dfdbd(0xce)),_0x2d3f09=await getTargetSqlQueries(_0x1d75bc,_0x43fe1f,_0x4ab9fc[_0x4dfdbd(0xef)](_0x4dfdbd(0xe0))||undefined);if(_0x2d3f09['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x4dfdbd(0xe2)};const _0x5088c1=[],_0x4dd0c7=[],_0x2da44c=[];for(const _0x4aabca of _0x2d3f09){const _0x28dc36=_0x43fe1f[_0x4dfdbd(0xf9)][_0x4aabca[_0x4dfdbd(0xd6)]];if(!_0x28dc36){_0x2da44c[_0x4dfdbd(0xce)]({'sqlCode':_0x4aabca[_0x4dfdbd(0xd6)],'error':_0x4dfdbd(0xcc)});continue;}try{const _0x42d6d0=await computeSqlFileHash(_0x4aabca['filePath']),_0x18ebdf=_0x28dc36['path']!==_0x4aabca[_0x4dfdbd(0xf4)]||!!_0x4aabca['sqlName']&&_0x28dc36[_0x4dfdbd(0xdd)]!==_0x4aabca['sqlName'];if(!_0x4ab9fc['bool']('force')&&_0x28dc36['hash']===_0x42d6d0&&!_0x18ebdf){_0x4dd0c7['push']({'sqlCode':_0x4aabca[_0x4dfdbd(0xd6)],'reason':_0x4dfdbd(0xcd)});continue;}if(_0x28dc36[_0x4dfdbd(0xd4)]==null){_0x2da44c[_0x4dfdbd(0xce)]({'sqlCode':_0x4aabca[_0x4dfdbd(0xd6)],'error':_0x4dfdbd(0xfe)});continue;}const _0x1a2dc3=await readFile(_0x4aabca[_0x4dfdbd(0xbd)],'utf8'),_0x2f578e=stripLocalSqlMetadata(_0x1a2dc3,_0x4aabca['mode']),_0x5871a6=_0x4aabca['sqlName']||_0x28dc36['sqlName'],_0x43bfac=await resolveTargetDbBinding(_0x4ab9fc[_0x4dfdbd(0xc2)],_0x4aabca,_0x28dc36),_0x1bb855=await updateSqlQuery({'id':_0x28dc36[_0x4dfdbd(0xe1)],'appCode':_0x4ab9fc['appCode'],'sqlCode':_0x4aabca[_0x4dfdbd(0xd6)],'sqlName':_0x5871a6,'dbId':_0x43bfac[_0x4dfdbd(0xc3)],'version':_0x28dc36['version'],'sqlContent':_0x2f578e,'sqlConfig':_0x28dc36[_0x4dfdbd(0xfd)]??undefined}),_0x391373=_0x1bb855[_0x4dfdbd(0xc3)]?await getDbName(_0x4ab9fc[_0x4dfdbd(0xc2)],Number(_0x1bb855['dbId']))['catch'](()=>_0x43bfac[_0x4dfdbd(0xe3)]):_0x43bfac[_0x4dfdbd(0xe3)];_0x43fe1f[_0x4dfdbd(0xf9)][_0x4aabca[_0x4dfdbd(0xd6)]]={...buildSqlLockEntry(_0x1bb855,_0x2f578e,_0x42d6d0,{'dbName':_0x391373}),'path':_0x4aabca[_0x4dfdbd(0xf4)],'mode':_0x28dc36[_0x4dfdbd(0xe9)]},await archivePreviousSqlFileIfNeeded(_0x1d75bc,_0x28dc36['path'],_0x4aabca[_0x4dfdbd(0xf4)]),_0x5088c1['push']({'sqlCode':_0x4aabca[_0x4dfdbd(0xd6)],'remoteId':_0x28dc36[_0x4dfdbd(0xe1)]});}catch(_0x1d7704){_0x2da44c[_0x4dfdbd(0xce)]({'sqlCode':_0x4aabca[_0x4dfdbd(0xd6)],'error':_0x1d7704 instanceof Error?_0x1d7704[_0x4dfdbd(0xe7)]:String(_0x1d7704)});}}return _0x43fe1f[_0x4dfdbd(0xec)]=new Date()[_0x4dfdbd(0xc5)](),await writeSqlLockFile(_0x1d75bc[_0x4dfdbd(0xbe)],_0x405092),{'ok':_0x2da44c[_0x4dfdbd(0xd2)]===0x0,'data':{'pushed':_0x5088c1,'skipped':_0x4dd0c7,'failed':_0x2da44c},'message':'Push\x20complete:\x20'+_0x5088c1[_0x4dfdbd(0xd2)]+_0x4dfdbd(0xf7)+_0x4dd0c7[_0x4dfdbd(0xd2)]+'\x20skipped,\x20'+_0x2da44c[_0x4dfdbd(0xd2)]+_0x4dfdbd(0xfb)};}};async function archivePreviousSqlFileIfNeeded(_0x5e463f,_0xd6115,_0x5af7a6){const _0x25520a=a163_0x38fdec;if(!_0xd6115||_0xd6115===_0x5af7a6)return;const _0x4c8858=join(_0x5e463f[_0x25520a(0xc0)],_0xd6115);if(!await fileExists(_0x4c8858))return;const _0x34ebc3=await moveToTrash(_0x5e463f[_0x25520a(0xd3)],_0x5e463f[_0x25520a(0xc9)],_0x4c8858);await cleanupEmptyDirectories(dirname(_0x4c8858),_0x5e463f[_0x25520a(0xc0)]),void _0x34ebc3;}async function moveToTrash(_0x40d8b1,_0x6eab5d,_0x48f1ff){const _0x259cab=a163_0x38fdec,_0x561ffd=new Date()[_0x259cab(0xc5)]()[_0x259cab(0xed)](/[:.]/g,'-'),_0x928eb9=relative(_0x40d8b1,_0x48f1ff),_0x539edd=join(_0x6eab5d,_0x561ffd,_0x928eb9);return await mkdir(dirname(_0x539edd),{'recursive':!![]}),await rename(_0x48f1ff,_0x539edd),_0x539edd;}async function cleanupEmptyDirectories(_0x39d84f,_0x5698ef){const _0x1d8324=a163_0x38fdec;let _0xa7c61d=resolve(_0x39d84f);const _0x138eb7=resolve(_0x5698ef);while(_0xa7c61d[_0x1d8324(0xd1)](''+_0x138eb7+sep)||_0xa7c61d===_0x138eb7){if(_0xa7c61d===_0x138eb7)return;try{const _0x302297=await readdir(_0xa7c61d);if(_0x302297[_0x1d8324(0xd2)]>0x0)return;await rmdir(_0xa7c61d);}catch{return;}_0xa7c61d=dirname(_0xa7c61d);}}async function resolveTargetDbBinding(_0x4c26d1,_0x9b9595,_0x27c3ab){const _0x9bf8dd=a163_0x38fdec,_0x112d74=_0x9b9595[_0x9bf8dd(0xd7)];if(!_0x112d74)return{'dbId':_0x27c3ab['dbId'],'dbName':_0x27c3ab['dbName']};const _0x218034=buildDbDirectoryName(_0x27c3ab[_0x9bf8dd(0xe3)],_0x27c3ab[_0x9bf8dd(0xc3)]);if(_0x112d74===_0x218034)return{'dbId':_0x27c3ab['dbId'],'dbName':_0x27c3ab[_0x9bf8dd(0xe3)]};const _0x3b60ab=parseExplicitDbDirectory(_0x112d74);if(_0x3b60ab!=null)return{'dbId':_0x3b60ab,'dbName':await getDbName(_0x4c26d1,_0x3b60ab)[_0x9bf8dd(0xfa)](()=>undefined)};const _0x2452db=await listDatabases(_0x4c26d1),_0x5abd24=_0x2452db[_0x9bf8dd(0xba)](_0x384452=>buildDbDirectoryName(_0x384452['dbName'],_0x384452[_0x9bf8dd(0xc3)])===_0x112d74);if(_0x5abd24[_0x9bf8dd(0xd2)]===0x1)return{'dbId':_0x5abd24[0x0][_0x9bf8dd(0xc3)],'dbName':_0x5abd24[0x0][_0x9bf8dd(0xe3)]};if(_0x5abd24[_0x9bf8dd(0xd2)]===0x0)throw CliErrors[_0x9bf8dd(0xc4)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x112d74+_0x9bf8dd(0xda)+_0x9b9595['sqlCode']+'.');const _0x4d9779=_0x5abd24[_0x9bf8dd(0xc6)](_0x5104e5=>_0x5104e5['dbName']+'\x20('+_0x5104e5[_0x9bf8dd(0xc3)]+')')[_0x9bf8dd(0xf3)](',\x20');throw CliErrors[_0x9bf8dd(0xc4)](_0x9bf8dd(0xf0)+_0x112d74+_0x9bf8dd(0xe6)+_0x9b9595[_0x9bf8dd(0xd6)]+':\x20'+_0x4d9779);}function parseExplicitDbDirectory(_0x560ce6){const _0x326ff4=a163_0x38fdec,_0x4e31e6=/^db-(\d+)$/['exec'](_0x560ce6);if(!_0x4e31e6)return null;const _0x471ba5=Number(_0x4e31e6[0x1]);return Number[_0x326ff4(0xee)](_0x471ba5)&&_0x471ba5>0x0?_0x471ba5:null;}function a163_0x3e08(_0x12f46b,_0x2e5405){_0x12f46b=_0x12f46b-0xba;const _0x10e562=a163_0x10e5();let _0x3e081b=_0x10e562[_0x12f46b];return _0x3e081b;}function a163_0x10e5(){const _0x36f149=['93932AykRJJ','sqlCode','dbDirectory','15vTkqcq','5sMErwh','\x22\x20for\x20sqlCode\x20','set','8GAUyku','sqlName','Push\x20local\x20SQL\x20files\x20to\x20remote','1755198gyHRNT','sqlcode','remoteId','No\x20local\x20SQL\x20files\x20found.','dbName','force','1qvUkDi','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','message','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','mode','\x20SQL\x20file(s)','bool','lastSync','replace','isFinite','str','Local\x20directory\x20\x22','path','/smartapi/custom/updateUserCustomSql','join','relativePath','1251708ctPyZE','60044TQIgdq','\x20pushed,\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','sqls','catch','\x20failed','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqlConfig','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','filter','sqlRoot','188730CqLSsL','filePath','lockFilePath','2392104VRhSdN','sqlRootDir','1506890kkMhyb','appCode','dbId','validation','toISOString','map','hash','Local\x20SQL\x20not\x20found:\x20','trashDir','Would\x20push\x20','boolean','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','unchanged','push','entries','get','startsWith','length','projectRoot','version'];a163_0x10e5=function(){return _0x36f149;};return a163_0x10e5();}
|
|
1
|
+
const a171_0x42c8cb=a171_0x4512;(function(_0x9c5b34,_0x228b4f){const _0x3dc3bf=a171_0x4512,_0x57890e=_0x9c5b34();while(!![]){try{const _0x54bcb5=parseInt(_0x3dc3bf(0x1d8))/0x1*(parseInt(_0x3dc3bf(0x1b8))/0x2)+parseInt(_0x3dc3bf(0x1a6))/0x3*(parseInt(_0x3dc3bf(0x1bd))/0x4)+-parseInt(_0x3dc3bf(0x1c2))/0x5+-parseInt(_0x3dc3bf(0x1bc))/0x6*(-parseInt(_0x3dc3bf(0x1c8))/0x7)+parseInt(_0x3dc3bf(0x1d9))/0x8*(parseInt(_0x3dc3bf(0x1b1))/0x9)+parseInt(_0x3dc3bf(0x1dc))/0xa+-parseInt(_0x3dc3bf(0x1c0))/0xb*(parseInt(_0x3dc3bf(0x1a1))/0xc);if(_0x54bcb5===_0x228b4f)break;else _0x57890e['push'](_0x57890e['shift']());}catch(_0x545ba6){_0x57890e['push'](_0x57890e['shift']());}}}(a171_0x55c3,0x7d526));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';function a171_0x55c3(){const _0x456cc0=['entries','Local\x20directory\x20\x22','lockFilePath','filePath','hash','str','sqls','mode','length','exec','set','\x20failed','1011048nwiwBe','4448968veiiyh','sqlCode','sql','3937420vgEXtP','sqlcode','\x20SQL\x20file(s)','sqlRoot','path','push','24eXFdCa','message','force','validation','replace','24NmoeDf','/smartapi/custom/updateUserCustomSql','map','boolean','sqlConfig','dbName','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','sqlName','\x22\x20for\x20sqlCode\x20','POST','relativePath','9yTcYbj','isFinite','join','projectRoot','filter','\x20skipped,\x20','trashDir','2uFBsnT','version','dbId','startsWith','5634IVtcYP','111312SZwecw','bool','appCode','9122146YnPxjH','high-risk-write','4110010IChpEF','toISOString','remoteId','\x20pushed,\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','Push\x20local\x20SQL\x20files\x20to\x20remote','6041MqSKpz','catch','sqlRootDir','Local\x20SQL\x20not\x20found:\x20'];a171_0x55c3=function(){return _0x456cc0;};return a171_0x55c3();}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(_0x22b9d5,_0x2b292f,_0x3eecff){const _0x594058=a171_0x4512,_0x54c42f=await scanLocalSqlQueries(_0x22b9d5),_0x5ade90=new Map();for(const _0x8579bf of _0x54c42f){if(_0x3eecff&&_0x8579bf[_0x594058(0x1da)]!==_0x3eecff)continue;const _0x327eb3=_0x5ade90['get'](_0x8579bf[_0x594058(0x1da)])??[];_0x327eb3[_0x594058(0x1a0)](_0x8579bf),_0x5ade90[_0x594058(0x1d6)](_0x8579bf['sqlCode'],_0x327eb3);}if(_0x3eecff&&!_0x5ade90['has'](_0x3eecff))throw CliErrors['validation'](_0x594058(0x1cb)+_0x3eecff);const _0xf373b9=[];for(const [_0x300e98,_0x2f27ab]of _0x5ade90[_0x594058(0x1cc)]()){if(_0x2f27ab[_0x594058(0x1d4)]===0x1){_0xf373b9[_0x594058(0x1a0)](_0x2f27ab[0x0]);continue;}const _0x32df4e=_0x2b292f[_0x594058(0x1d2)][_0x300e98],_0x4bbff8=_0x32df4e?.[_0x594058(0x19f)],_0xd7a07d=_0x4bbff8?_0x2f27ab[_0x594058(0x1b5)](_0x29138b=>_0x29138b['relativePath']!==_0x4bbff8):_0x2f27ab;if(_0x32df4e&&_0xd7a07d[_0x594058(0x1d4)]===0x1){_0xf373b9[_0x594058(0x1a0)](_0xd7a07d[0x0]);continue;}throw CliErrors[_0x594058(0x1a4)](_0x594058(0x1ac)+_0x300e98+_0x594058(0x1c6));}return _0xf373b9;}export const sqlPush={'service':a171_0x42c8cb(0x1db),'command':a171_0x42c8cb(0x1a0),'description':a171_0x42c8cb(0x1c7),'risk':a171_0x42c8cb(0x1c1),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a171_0x42c8cb(0x1a3),'type':a171_0x42c8cb(0x1a9),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x225ef5){const _0xec2b84=a171_0x42c8cb,_0xfe3fa9=loadSqlProjectConfig(_0x225ef5[_0xec2b84(0x1bf)]),_0x3e662e=await readSqlLockFile(_0xfe3fa9[_0xec2b84(0x1ce)]),{appLock:_0x4697b1}=ensureSqlLockScope(_0x3e662e??createEmptySqlLock(),_0x225ef5[_0xec2b84(0x1bf)],_0xfe3fa9[_0xec2b84(0x19e)],'push'),_0x260b88=await getTargetSqlQueries(_0xfe3fa9,_0x4697b1,_0x225ef5[_0xec2b84(0x1d1)](_0xec2b84(0x19c))||undefined),_0x5c86fa=[];for(const _0x49e70e of _0x260b88){const _0x2ada87=await computeSqlFileHash(_0x49e70e[_0xec2b84(0x1cf)]),_0x361266=_0x4697b1[_0xec2b84(0x1d2)][_0x49e70e['sqlCode']],_0x23a712=!!_0x361266&&(_0x361266['path']!==_0x49e70e['relativePath']||!!_0x49e70e[_0xec2b84(0x1ad)]&&_0x361266['sqlName']!==_0x49e70e[_0xec2b84(0x1ad)]);if(!_0x225ef5[_0xec2b84(0x1be)](_0xec2b84(0x1a3))&&_0x361266&&_0x361266[_0xec2b84(0x1d0)]===_0x2ada87&&!_0x23a712)continue;_0x5c86fa['push'](_0x49e70e[_0xec2b84(0x1da)]);}return{'method':_0xec2b84(0x1af),'url':_0xec2b84(0x1a7),'body':{'sqlCodes':_0x5c86fa,'appCode':_0x225ef5[_0xec2b84(0x1bf)]},'description':'Would\x20push\x20'+_0x5c86fa['length']+_0xec2b84(0x19d)};},async 'execute'(_0x38b7a4){const _0x3e721a=a171_0x42c8cb,_0x381ff9=loadSqlProjectConfig(_0x38b7a4[_0x3e721a(0x1bf)]),_0x16086d=await readSqlLockFile(_0x381ff9[_0x3e721a(0x1ce)]),{lockData:_0x26588a,appLock:_0x15765a}=ensureSqlLockScope(_0x16086d??createEmptySqlLock(),_0x38b7a4[_0x3e721a(0x1bf)],_0x381ff9[_0x3e721a(0x19e)],_0x3e721a(0x1a0)),_0x539015=await getTargetSqlQueries(_0x381ff9,_0x15765a,_0x38b7a4[_0x3e721a(0x1d1)](_0x3e721a(0x19c))||undefined);if(_0x539015['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x38e79e=[],_0x2efac2=[],_0x33da19=[];for(const _0x6c3b3d of _0x539015){const _0x2e63eb=_0x15765a[_0x3e721a(0x1d2)][_0x6c3b3d[_0x3e721a(0x1da)]];if(!_0x2e63eb){_0x33da19[_0x3e721a(0x1a0)]({'sqlCode':_0x6c3b3d[_0x3e721a(0x1da)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x3a44e7=await computeSqlFileHash(_0x6c3b3d[_0x3e721a(0x1cf)]),_0x4eeff3=_0x2e63eb[_0x3e721a(0x19f)]!==_0x6c3b3d[_0x3e721a(0x1b0)]||!!_0x6c3b3d[_0x3e721a(0x1ad)]&&_0x2e63eb[_0x3e721a(0x1ad)]!==_0x6c3b3d[_0x3e721a(0x1ad)];if(!_0x38b7a4[_0x3e721a(0x1be)]('force')&&_0x2e63eb[_0x3e721a(0x1d0)]===_0x3a44e7&&!_0x4eeff3){_0x2efac2[_0x3e721a(0x1a0)]({'sqlCode':_0x6c3b3d[_0x3e721a(0x1da)],'reason':'unchanged'});continue;}if(_0x2e63eb[_0x3e721a(0x1b9)]==null){_0x33da19[_0x3e721a(0x1a0)]({'sqlCode':_0x6c3b3d[_0x3e721a(0x1da)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x5781a0=await readFile(_0x6c3b3d[_0x3e721a(0x1cf)],'utf8'),_0x371297=stripLocalSqlMetadata(_0x5781a0,_0x6c3b3d[_0x3e721a(0x1d3)]),_0x2ef228=_0x6c3b3d[_0x3e721a(0x1ad)]||_0x2e63eb[_0x3e721a(0x1ad)],_0x591430=await resolveTargetDbBinding(_0x38b7a4[_0x3e721a(0x1bf)],_0x6c3b3d,_0x2e63eb),_0x1d0e97=await updateSqlQuery({'id':_0x2e63eb[_0x3e721a(0x1c4)],'appCode':_0x38b7a4[_0x3e721a(0x1bf)],'sqlCode':_0x6c3b3d[_0x3e721a(0x1da)],'sqlName':_0x2ef228,'dbId':_0x591430[_0x3e721a(0x1ba)],'version':_0x2e63eb[_0x3e721a(0x1b9)],'sqlContent':_0x371297,'sqlConfig':_0x2e63eb[_0x3e721a(0x1aa)]??undefined}),_0x2b322d=_0x1d0e97[_0x3e721a(0x1ba)]?await getDbName(_0x38b7a4['appCode'],Number(_0x1d0e97['dbId']))['catch'](()=>_0x591430[_0x3e721a(0x1ab)]):_0x591430[_0x3e721a(0x1ab)];_0x15765a[_0x3e721a(0x1d2)][_0x6c3b3d[_0x3e721a(0x1da)]]={...buildSqlLockEntry(_0x1d0e97,_0x371297,_0x3a44e7,{'dbName':_0x2b322d}),'path':_0x6c3b3d[_0x3e721a(0x1b0)],'mode':_0x2e63eb[_0x3e721a(0x1d3)]},await archivePreviousSqlFileIfNeeded(_0x381ff9,_0x2e63eb['path'],_0x6c3b3d[_0x3e721a(0x1b0)]),_0x38e79e[_0x3e721a(0x1a0)]({'sqlCode':_0x6c3b3d[_0x3e721a(0x1da)],'remoteId':_0x2e63eb[_0x3e721a(0x1c4)]});}catch(_0x3701d3){_0x33da19[_0x3e721a(0x1a0)]({'sqlCode':_0x6c3b3d[_0x3e721a(0x1da)],'error':_0x3701d3 instanceof Error?_0x3701d3[_0x3e721a(0x1a2)]:String(_0x3701d3)});}}return _0x15765a['lastSync']=new Date()[_0x3e721a(0x1c3)](),await writeSqlLockFile(_0x381ff9['lockFilePath'],_0x26588a),{'ok':_0x33da19['length']===0x0,'data':{'pushed':_0x38e79e,'skipped':_0x2efac2,'failed':_0x33da19},'message':'Push\x20complete:\x20'+_0x38e79e['length']+_0x3e721a(0x1c5)+_0x2efac2[_0x3e721a(0x1d4)]+_0x3e721a(0x1b6)+_0x33da19['length']+_0x3e721a(0x1d7)};}};function a171_0x4512(_0x3dc8ec,_0x2ca977){_0x3dc8ec=_0x3dc8ec-0x19c;const _0x55c3c1=a171_0x55c3();let _0x451257=_0x55c3c1[_0x3dc8ec];return _0x451257;}async function archivePreviousSqlFileIfNeeded(_0x8f9f30,_0x2e3daf,_0x176511){const _0x199a38=a171_0x42c8cb;if(!_0x2e3daf||_0x2e3daf===_0x176511)return;const _0x63e4ae=join(_0x8f9f30['sqlRootDir'],_0x2e3daf);if(!await fileExists(_0x63e4ae))return;const _0x3257d0=await moveToTrash(_0x8f9f30[_0x199a38(0x1b4)],_0x8f9f30[_0x199a38(0x1b7)],_0x63e4ae);await cleanupEmptyDirectories(dirname(_0x63e4ae),_0x8f9f30[_0x199a38(0x1ca)]),void _0x3257d0;}async function moveToTrash(_0x4581ba,_0xe33702,_0x79588c){const _0x571ca9=a171_0x42c8cb,_0x3dcdf5=new Date()[_0x571ca9(0x1c3)]()[_0x571ca9(0x1a5)](/[:.]/g,'-'),_0x23fe62=relative(_0x4581ba,_0x79588c),_0x30940a=join(_0xe33702,_0x3dcdf5,_0x23fe62);return await mkdir(dirname(_0x30940a),{'recursive':!![]}),await rename(_0x79588c,_0x30940a),_0x30940a;}async function cleanupEmptyDirectories(_0x3370c3,_0x4b2598){const _0x3913c9=a171_0x42c8cb;let _0x37a155=resolve(_0x3370c3);const _0x4e249b=resolve(_0x4b2598);while(_0x37a155[_0x3913c9(0x1bb)](''+_0x4e249b+sep)||_0x37a155===_0x4e249b){if(_0x37a155===_0x4e249b)return;try{const _0x4396b2=await readdir(_0x37a155);if(_0x4396b2[_0x3913c9(0x1d4)]>0x0)return;await rmdir(_0x37a155);}catch{return;}_0x37a155=dirname(_0x37a155);}}async function resolveTargetDbBinding(_0x57f600,_0x2db5b1,_0x3c544f){const _0xe3293c=a171_0x42c8cb,_0x555e73=_0x2db5b1['dbDirectory'];if(!_0x555e73)return{'dbId':_0x3c544f[_0xe3293c(0x1ba)],'dbName':_0x3c544f[_0xe3293c(0x1ab)]};const _0x5db6ca=buildDbDirectoryName(_0x3c544f[_0xe3293c(0x1ab)],_0x3c544f[_0xe3293c(0x1ba)]);if(_0x555e73===_0x5db6ca)return{'dbId':_0x3c544f['dbId'],'dbName':_0x3c544f[_0xe3293c(0x1ab)]};const _0x24ec36=parseExplicitDbDirectory(_0x555e73);if(_0x24ec36!=null)return{'dbId':_0x24ec36,'dbName':await getDbName(_0x57f600,_0x24ec36)[_0xe3293c(0x1c9)](()=>undefined)};const _0x5a5759=await listDatabases(_0x57f600),_0x45e154=_0x5a5759[_0xe3293c(0x1b5)](_0x4dc58c=>buildDbDirectoryName(_0x4dc58c[_0xe3293c(0x1ab)],_0x4dc58c[_0xe3293c(0x1ba)])===_0x555e73);if(_0x45e154[_0xe3293c(0x1d4)]===0x1)return{'dbId':_0x45e154[0x0]['dbId'],'dbName':_0x45e154[0x0][_0xe3293c(0x1ab)]};if(_0x45e154['length']===0x0)throw CliErrors[_0xe3293c(0x1a4)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x555e73+_0xe3293c(0x1ae)+_0x2db5b1['sqlCode']+'.');const _0x2d6ba8=_0x45e154[_0xe3293c(0x1a8)](_0x702f7a=>_0x702f7a[_0xe3293c(0x1ab)]+'\x20('+_0x702f7a[_0xe3293c(0x1ba)]+')')[_0xe3293c(0x1b3)](',\x20');throw CliErrors[_0xe3293c(0x1a4)](_0xe3293c(0x1cd)+_0x555e73+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x2db5b1[_0xe3293c(0x1da)]+':\x20'+_0x2d6ba8);}function parseExplicitDbDirectory(_0x14b40e){const _0x34c836=a171_0x42c8cb,_0x3083d0=/^db-(\d+)$/[_0x34c836(0x1d5)](_0x14b40e);if(!_0x3083d0)return null;const _0xad0868=Number(_0x3083d0[0x1]);return Number[_0x34c836(0x1b2)](_0xad0868)&&_0xad0868>0x0?_0xad0868:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a172_0x132828=a172_0x3f65;function a172_0x16b0(){const _0x3aca32=['validation','739208qUXmVz','Path\x20to\x20the\x20SQL\x20file','sql','Query\x20description','string','469680QdwUZb','write','760108Twijxo','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','402455LQURNe','join','114036YWMaQk','description','74635koquzC','sqlname','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','file','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`.','4497395cPLlWp'];a172_0x16b0=function(){return _0x3aca32;};return a172_0x16b0();}(function(_0x5b6346,_0x12da50){const _0x1bacdd=a172_0x3f65,_0xbf5a36=_0x5b6346();while(!![]){try{const _0x207121=-parseInt(_0x1bacdd(0x8f))/0x1+-parseInt(_0x1bacdd(0x89))/0x2+parseInt(_0x1bacdd(0x8d))/0x3+-parseInt(_0x1bacdd(0x96))/0x4+parseInt(_0x1bacdd(0x8b))/0x5+parseInt(_0x1bacdd(0x87))/0x6+parseInt(_0x1bacdd(0x94))/0x7;if(_0x207121===_0x12da50)break;else _0xbf5a36['push'](_0xbf5a36['shift']());}catch(_0x2cbbf6){_0xbf5a36['push'](_0xbf5a36['shift']());}}}(a172_0x16b0,0x30c61));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a172_0x132828(0x91),'Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.',a172_0x132828(0x93)][a172_0x132828(0x8c)]('\x0a');function a172_0x3f65(_0x196d8f,_0x24988e){_0x196d8f=_0x196d8f-0x84;const _0x16b0b5=a172_0x16b0();let _0x3f65b9=_0x16b0b5[_0x196d8f];return _0x3f65b9;}export const sqlSave={'service':a172_0x132828(0x84),'command':'save','description':'Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','risk':a172_0x132828(0x88),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a172_0x132828(0x92),'type':a172_0x132828(0x86),'required':!![],'description':a172_0x132828(0x97)},SQLCODE_FLAG_OPTIONAL,{'name':a172_0x132828(0x90),'type':'string','description':'SQL\x20query\x20display\x20name'},{'name':'db','type':'string','description':a172_0x132828(0x8a)},{'name':a172_0x132828(0x8e),'type':a172_0x132828(0x86),'description':a172_0x132828(0x85)}],async 'validate'(){const _0x46eefb=a172_0x132828;throw CliErrors[_0x46eefb(0x95)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x2be8fe=a172_0x132828;throw CliErrors[_0x2be8fe(0x95)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a173_0xa143e9=a173_0x7d51;(function(_0x2feca1,_0x39ffda){const _0x7eb3f=a173_0x7d51,_0x241373=_0x2feca1();while(!![]){try{const _0x162d8e=-parseInt(_0x7eb3f(0xc0))/0x1*(-parseInt(_0x7eb3f(0xab))/0x2)+parseInt(_0x7eb3f(0xc5))/0x3*(parseInt(_0x7eb3f(0xca))/0x4)+parseInt(_0x7eb3f(0xc9))/0x5*(-parseInt(_0x7eb3f(0xd1))/0x6)+-parseInt(_0x7eb3f(0xcd))/0x7*(-parseInt(_0x7eb3f(0xbc))/0x8)+parseInt(_0x7eb3f(0xd4))/0x9+parseInt(_0x7eb3f(0xbd))/0xa+-parseInt(_0x7eb3f(0xbe))/0xb;if(_0x162d8e===_0x39ffda)break;else _0x241373['push'](_0x241373['shift']());}catch(_0x8c327b){_0x241373['push'](_0x241373['shift']());}}}(a173_0x4c5d,0x8ebeb));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=a173_0xa143e9(0xb8);export function buildSqlLockEntry(_0x3e39d6,_0x6991fe,_0x2e0138,_0x2f9f2e){const _0x46035a=a173_0xa143e9,_0x3ef706=detectSqlMode(_0x6991fe);return{'path':buildSqlRelativePath(_0x3e39d6['sqlCode'],_0x3e39d6['sqlName'],_0x2f9f2e?.[_0x46035a(0xd6)],_0x3ef706,_0x3e39d6[_0x46035a(0xb9)]),'hash':_0x2e0138,'remoteId':_0x3e39d6['id'],'version':_0x3e39d6[_0x46035a(0xba)],'dbId':Number(_0x3e39d6['dbId']),'dbName':_0x2f9f2e?.[_0x46035a(0xd6)],'sqlName':_0x3e39d6[_0x46035a(0xbf)],'sqlConfig':_0x3e39d6[_0x46035a(0xb5)]??undefined,'mode':_0x3ef706};}export function cloneSqlLockData(_0x2ca02e){const _0x3e0f94=a173_0xa143e9;return{'apps':Object[_0x3e0f94(0xce)](Object['entries'](_0x2ca02e[_0x3e0f94(0xb6)])[_0x3e0f94(0xd0)](([_0x71de35,_0x4fc0da])=>[_0x71de35,{'sqlRoot':_0x4fc0da['sqlRoot'],'lastSync':_0x4fc0da[_0x3e0f94(0xac)],'sqls':{..._0x4fc0da[_0x3e0f94(0xc1)]}}]))};}export function ensureRemoteSqlContent(_0x20ca10){const _0x3f4936=a173_0xa143e9;return _0x20ca10[_0x3f4936(0xb0)]??'';}export function buildLocalSqlFileContent(_0x2bd321,_0x1a5d97,_0x5b7b76){const _0x1b636e=a173_0xa143e9,_0x3cc7ca=_0x5b7b76?.[_0x1b636e(0xc3)]??detectSqlMode(_0x1a5d97),_0x4988f9=stripLocalSqlMetadata(_0x1a5d97,_0x3cc7ca)[_0x1b636e(0xcf)](),_0x2b19ce=[...buildMetadataHeaderLines({'sqlCode':_0x2bd321[_0x1b636e(0xc4)],'sqlName':_0x2bd321[_0x1b636e(0xbf)],'dbId':_0x2bd321[_0x1b636e(0xb9)],'dbName':_0x5b7b76?.[_0x1b636e(0xd6)],'mode':_0x3cc7ca,'syncedAt':_0x5b7b76?.[_0x1b636e(0xad)],'description':_0x5b7b76?.[_0x1b636e(0xd7)]},_0x3cc7ca),'',_0x4988f9],_0x36507f=_0x2b19ce[_0x1b636e(0xaa)]('\x0a');return _0x36507f['endsWith']('\x0a')?_0x36507f:_0x36507f+'\x0a';}export function stripLocalSqlMetadata(_0x443128,_0x1d841e){const _0x110fd6=a173_0xa143e9,_0x4d8f3f=_0x443128[_0x110fd6(0xc2)](/\r\n/g,'\x0a')[_0x110fd6(0xb2)]('\x0a'),_0xe63bf5=[];let _0x3f3243=0x0;if(_0x1d841e===_0x110fd6(0xb7))while(_0x3f3243<_0x4d8f3f[_0x110fd6(0xb4)]){const _0x44839a=_0x4d8f3f[_0x3f3243]??'';if(/^\s*<!--\s*@lovrabet\./[_0x110fd6(0xc7)](_0x44839a)){_0x3f3243++;continue;}if(_0x44839a[_0x110fd6(0xcf)]()===''&&_0x3f3243>0x0){_0x3f3243++;continue;}break;}else while(_0x3f3243<_0x4d8f3f['length']){const _0x7919ff=_0x4d8f3f[_0x3f3243]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x7919ff)){_0x3f3243++;continue;}if(_0x7919ff[_0x110fd6(0xcf)]()===''&&_0x3f3243>0x0){_0x3f3243++;continue;}break;}for(;_0x3f3243<_0x4d8f3f['length'];_0x3f3243++){_0xe63bf5[_0x110fd6(0xd2)](_0x4d8f3f[_0x3f3243]);}return _0xe63bf5[_0x110fd6(0xaa)]('\x0a')[_0x110fd6(0xc6)]();}export function resolveSqlMode(_0x23c196,_0x6d1dcc){const _0x330e73=a173_0xa143e9;if(_0x6d1dcc?.[_0x330e73(0xc3)])return _0x6d1dcc[_0x330e73(0xc3)];return detectSqlMode(_0x23c196);}export function resolveSqlFileName(_0x56a06e,_0xe3ba8e,_0x4a8499){const _0x45641f=a173_0xa143e9;if(_0x4a8499?.[_0x45641f(0xbb)])return _0x4a8499['path'];if(_0x4a8499?.[_0x45641f(0xbf)]||_0x4a8499?.[_0x45641f(0xd6)])return buildSqlRelativePath(_0x56a06e,_0x4a8499?.[_0x45641f(0xbf)],_0x4a8499?.['dbName'],resolveSqlMode(_0xe3ba8e,_0x4a8499),_0x4a8499?.['dbId']);return buildDefaultSqlFileName(_0x56a06e,resolveSqlMode(_0xe3ba8e,_0x4a8499));}function a173_0x7d51(_0x50551c,_0x211d18){_0x50551c=_0x50551c-0xaa;const _0x4c5d3a=a173_0x4c5d();let _0x7d513b=_0x4c5d3a[_0x50551c];return _0x7d513b;}export function resolveSqlLocalDir(_0x2cee8d,_0x846948){return join(_0x2cee8d,SQL_LOCAL_REL_DIR,_0x846948);}function a173_0x4c5d(){const _0x4d7169=['dbId','version','path','248xUXvDP','4406940eHZWNL','18784557aNUClH','sqlName','3psaCMB','sqls','replace','mode','sqlCode','6zWpphs','trimStart','test','close','215wazEQO','2307560MFhBVw','yes','stdin','58107YQMJsl','fromEntries','trim','map','20766rBNoHo','push','\x20[y/N]\x20','23481ybIvAA','<!--\x20@lovrabet.','dbName','description','filter','join','391186Uwotuu','lastSync','syncedAt','question','stderr','sqlContent','\x20-->','split','includes','length','sqlConfig','apps','mybatisXml','.rabetbase/sql'];a173_0x4c5d=function(){return _0x4d7169;};return a173_0x4c5d();}export async function confirmForceOverwrite(_0x481488){const _0xd1cdb8=a173_0xa143e9,_0x1f84a2=createInterface({'input':process[_0xd1cdb8(0xcc)],'output':process[_0xd1cdb8(0xaf)]}),_0x3f3b7e=await new Promise(_0x1384e8=>{const _0x53f7a5=_0xd1cdb8;_0x1f84a2[_0x53f7a5(0xae)](_0x481488+_0x53f7a5(0xd3),_0x1384e8);});return _0x1f84a2[_0xd1cdb8(0xc8)](),['y',_0xd1cdb8(0xcb)][_0xd1cdb8(0xb3)](_0x3f3b7e['trim']()['toLowerCase']());}export function findSqlLockScope(_0x5cf0ab,_0x4d30bf){return _0x5cf0ab['apps'][_0x4d30bf];}function buildMetadataHeaderLines(_0xebff1b,_0x337e50){const _0x3f78a7=a173_0xa143e9,_0x4a3b56=[[_0x3f78a7(0xc4),_0xebff1b[_0x3f78a7(0xc4)]],[_0x3f78a7(0xbf),_0xebff1b[_0x3f78a7(0xbf)]],[_0x3f78a7(0xb9),_0xebff1b[_0x3f78a7(0xb9)]],[_0x3f78a7(0xd6),_0xebff1b[_0x3f78a7(0xd6)]],['mode',_0xebff1b['mode']],[_0x3f78a7(0xad),_0xebff1b['syncedAt']],[_0x3f78a7(0xd7),_0xebff1b['description']]];if(_0x337e50===_0x3f78a7(0xb7))return _0x4a3b56[_0x3f78a7(0xd8)](([,_0x54af7c])=>_0x54af7c!==undefined&&_0x54af7c!==null&&String(_0x54af7c)[_0x3f78a7(0xcf)]()!=='')['map'](([_0x2a8054,_0x33cbca])=>_0x3f78a7(0xd5)+_0x2a8054+':\x20'+String(_0x33cbca)+_0x3f78a7(0xb1));return _0x4a3b56[_0x3f78a7(0xd8)](([,_0x225031])=>_0x225031!==undefined&&_0x225031!==null&&String(_0x225031)[_0x3f78a7(0xcf)]()!=='')[_0x3f78a7(0xd0)](([_0x244a8b,_0x1f456b])=>'--\x20@lovrabet.'+_0x244a8b+':\x20'+String(_0x1f456b));}
|