@lovrabet/rabetbase-cli 2.5.1 → 2.5.2-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/api/generate-sdk-config-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/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.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 -1
- 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/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.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/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.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-restore.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/dataset/user-deleted-field-list.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-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.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/table-diff-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/deployment/auto-sync.d.ts +3 -11
- package/lib/commands/deployment/auto-sync.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.d.ts +2 -0
- package/lib/commands/deployment/sync-all.js +1 -0
- package/lib/commands/deployment/sync-jobs.d.ts +2 -0
- package/lib/commands/deployment/sync-jobs.js +1 -0
- package/lib/commands/deployment/sync-status.d.ts +2 -0
- package/lib/commands/deployment/sync-status.js +1 -0
- package/lib/commands/deployment/sync.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/instant-api-policy/current.d.ts +2 -0
- package/lib/commands/instant-api-policy/current.js +1 -0
- package/lib/commands/instant-api-policy/index.d.ts +2 -0
- package/lib/commands/instant-api-policy/index.js +1 -0
- package/lib/commands/instant-api-policy/init.d.ts +2 -0
- package/lib/commands/instant-api-policy/init.js +1 -0
- package/lib/commands/instant-api-policy/publish.d.ts +2 -0
- package/lib/commands/instant-api-policy/publish.js +1 -0
- package/lib/commands/instant-api-policy/pull.d.ts +2 -0
- package/lib/commands/instant-api-policy/pull.js +1 -0
- package/lib/commands/instant-api-policy/revision.d.ts +2 -0
- package/lib/commands/instant-api-policy/revision.js +1 -0
- package/lib/commands/instant-api-policy/revisions.d.ts +2 -0
- package/lib/commands/instant-api-policy/revisions.js +1 -0
- package/lib/commands/instant-api-policy/rollback.d.ts +2 -0
- package/lib/commands/instant-api-policy/rollback.js +1 -0
- package/lib/commands/instant-api-policy/shared.d.ts +82 -0
- package/lib/commands/instant-api-policy/shared.js +1 -0
- package/lib/commands/instant-api-policy/validate.d.ts +2 -0
- package/lib/commands/instant-api-policy/validate.js +1 -0
- 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/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- 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 -1
- 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/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/template.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.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/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.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/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.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/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.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/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.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/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 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- 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/domain-config.js +1 -1
- package/lib/config/project-domain-routing.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/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.d.ts +0 -2
- 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.d.ts +113 -2
- 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/instant-api-policy/config.d.ts +23 -0
- package/lib/core/instant-api-policy/config.js +1 -0
- package/lib/core/kb-search-client.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 -1
- 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 -1
- package/lib/framework/explicit-yes.js +1 -1
- 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/supported-flags.d.ts +2 -0
- package/lib/framework/supported-flags.js +1 -0
- package/lib/framework/types.d.ts +2 -4
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.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/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/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
- package/skills/rabetbase/SKILL.md +12 -6
- package/skills/rabetbase/references/rabetbase-deployment-sync.md +51 -43
- package/skills/rabetbase/references/rabetbase-instant-api-policy.md +92 -0
- package/skills/rabetbase.manifest.json +4 -3
- package/lib/config/deployment-sync.d.ts +0 -10
- package/lib/config/deployment-sync.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a207_0x4d9aaa=a207_0xc20c;(function(_0x4d2960,_0x45e0ac){const _0x56474b=a207_0xc20c,_0x1ce377=_0x4d2960();while(!![]){try{const _0x55bc94=-parseInt(_0x56474b(0x112))/0x1+-parseInt(_0x56474b(0x120))/0x2+parseInt(_0x56474b(0xf9))/0x3+-parseInt(_0x56474b(0x10a))/0x4+parseInt(_0x56474b(0x128))/0x5+parseInt(_0x56474b(0x10d))/0x6+-parseInt(_0x56474b(0x127))/0x7;if(_0x55bc94===_0x45e0ac)break;else _0x1ce377['push'](_0x1ce377['shift']());}catch(_0x11b498){_0x1ce377['push'](_0x1ce377['shift']());}}}(a207_0x1d38,0xaba91));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';function a207_0xc20c(_0x48337d,_0x3b90cc){_0x48337d=_0x48337d-0xf3;const _0x1d385e=a207_0x1d38();let _0xc20cc6=_0x1d385e[_0x48337d];return _0xc20cc6;}import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';function a207_0x1d38(){const _0x43935b=['4155333grLHuk','build','\x0a\x20\x20Usage:\x20','has','(none)','start','\x0a\x20\x20Available\x20scripts:\x0a','close','\x20run\x20preview\x20--watch','parse','vite\x20preview\x20exited\x20with\x20code\x20','\x20run\x20start','push','all','watch','preview','needsUpgrade','1697148BdrOgv','length','\x20\x20\x20\x20','3944400uSSMKB','node_modules','.bin','inherit','npm','286559rEnXMW','args','Script\x20name\x20defined\x20in\x20package.json','vite','\x22\x20not\x20found\x20in\x20package.json.','error','keys','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','log','slice','bool','join','validation','dev','1811284vQPwzC','Script\x20\x22','\x20exited\x20with\x20code\x20','No\x20scripts\x20defined\x20in\x20package.json.','scripts','pnpm-lock.yaml','boolean','5623898AZjhpw','5402560XWkBuE','package.json','\x20run\x20<script>\x0a','\x20run\x20build','yarn.lock','cwd','\x20run\x20','\x20run\x20preview','write','run','utf-8'];a207_0x1d38=function(){return _0x43935b;};return a207_0x1d38();}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([a207_0x4d9aaa(0xfe),a207_0x4d9aaa(0x11f)]);function readPackageScripts(_0x3d1b3c){const _0x17c29d=a207_0x4d9aaa,_0x46cd38=resolve(_0x3d1b3c,_0x17c29d(0x129));if(!existsSync(_0x46cd38))return null;try{const _0x379d3a=JSON[_0x17c29d(0x102)](readFileSync(_0x46cd38,_0x17c29d(0xf8)));return _0x379d3a[_0x17c29d(0x124)]??{};}catch{return null;}}function detectPackageManager(_0x5901e5){const _0x334926=a207_0x4d9aaa;if(existsSync(resolve(_0x5901e5,'bun.lockb'))||existsSync(resolve(_0x5901e5,'bun.lock')))return'bun';if(existsSync(resolve(_0x5901e5,_0x334926(0x125))))return'pnpm';if(existsSync(resolve(_0x5901e5,_0x334926(0x12c))))return'yarn';return _0x334926(0x111);}async function versionCheck(_0x2c5817){const _0x1e53ae=a207_0x4d9aaa,_0x3a56e9=await checkCliVersion();(_0x3a56e9[_0x1e53ae(0x109)]||_0x3a56e9['belowMinimum'])&&(printCliUpgradeWarning(_0x3a56e9),assertCliVersionSupported(_0x3a56e9));const _0x195976=await checkSdkVersion(_0x2c5817);if(_0x195976[_0x1e53ae(0x109)])printSdkUpgradeWarning(_0x195976);}function spawnScript(_0x58046a,_0x36d3b3,_0x1a6be2,_0x223094){return new Promise((_0x316629,_0x180b48)=>{const _0x512344=a207_0xc20c,_0x4f517c=['run',_0x36d3b3,..._0x1a6be2],_0x833ca1=spawn(_0x58046a,_0x4f517c,{'cwd':_0x223094,'stdio':_0x512344(0x110),'shell':!![],'env':{...process.env,'PATH':''+join(_0x223094,_0x512344(0x10e),_0x512344(0x10f))+delimiter+process.env.PATH}});_0x833ca1['on'](_0x512344(0x100),_0x2d2ba8=>{const _0x18ffe6=_0x512344;if(_0x2d2ba8===0x0||_0x2d2ba8===null)_0x316629();else _0x180b48(new Error(_0x58046a+_0x18ffe6(0xf4)+_0x36d3b3+_0x18ffe6(0x122)+_0x2d2ba8));}),_0x833ca1['on'](_0x512344(0x117),_0x180b48);});}function spawnViteBuildWatch(_0x5d0bf8){return new Promise((_0x3d17a2,_0x1db726)=>{const _0x2e4741=a207_0xc20c,_0x5e11be=spawn(_0x2e4741(0x115),[_0x2e4741(0xfa),'--watch'],{'cwd':_0x5d0bf8,'stdio':_0x2e4741(0x110),'shell':!![],'env':{...process.env,'PATH':''+join(_0x5d0bf8,_0x2e4741(0x10e),_0x2e4741(0x10f))+delimiter+process.env.PATH}});_0x5e11be['on'](_0x2e4741(0x100),_0x312abd=>{const _0x3aab36=_0x2e4741;if(_0x312abd===0x0||_0x312abd===null)_0x3d17a2();else _0x1db726(new Error(_0x3aab36(0x119)+_0x312abd));}),_0x5e11be['on'](_0x2e4741(0x117),_0x1db726);});}function spawnVitePreview(_0x193e10){return new Promise((_0x283097,_0x5f2dcf)=>{const _0x35896a=a207_0xc20c,_0x59649b=spawn(_0x35896a(0x115),[_0x35896a(0x108)],{'cwd':_0x193e10,'stdio':_0x35896a(0x110),'shell':!![],'env':{...process.env,'PATH':''+join(_0x193e10,_0x35896a(0x10e),'.bin')+delimiter+process.env.PATH}});_0x59649b['on'](_0x35896a(0x100),_0x46293c=>{const _0x470540=_0x35896a;if(_0x46293c===0x0||_0x46293c===null)_0x283097();else _0x5f2dcf(new Error(_0x470540(0x103)+_0x46293c));}),_0x59649b['on']('error',_0x5f2dcf);});}const runFlags=[{'name':a207_0x4d9aaa(0x107),'type':a207_0x4d9aaa(0x126),'description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a207_0x4d9aaa(0xf7),'command':a207_0x4d9aaa(0xf7),'description':'Run\x20a\x20package.json\x20script','risk':a207_0x4d9aaa(0xf6),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':a207_0x4d9aaa(0x114),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x168d4a=a207_0x4d9aaa,_0x42e28b=[];return _0x42e28b['push']('\x20\x20EXAMPLES'),_0x42e28b[_0x168d4a(0x105)](_0x168d4a(0x10c)+CLI_BIN_NAME+_0x168d4a(0x104)),_0x42e28b[_0x168d4a(0x105)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x168d4a(0x12b)),_0x42e28b[_0x168d4a(0x105)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x168d4a(0xf5)),_0x42e28b[_0x168d4a(0x105)](_0x168d4a(0x10c)+CLI_BIN_NAME+_0x168d4a(0x101)),_0x42e28b[_0x168d4a(0x11d)]('\x0a');},async 'execute'(_0x200ac8){const _0xb5c091=a207_0x4d9aaa,_0x4b141a=process[_0xb5c091(0xf3)](),_0x1547c0=_0x200ac8[_0xb5c091(0x113)][0x0],_0x4942d1=_0x200ac8[_0xb5c091(0x113)][_0xb5c091(0x11b)](0x1),_0x550e68=readPackageScripts(_0x4b141a);if(!_0x550e68)throw CliErrors[_0xb5c091(0x11e)]('No\x20package.json\x20found\x20in\x20current\x20directory.');if(!_0x1547c0){const _0x265100=Object[_0xb5c091(0x118)](_0x550e68);if(_0x265100[_0xb5c091(0x10b)]===0x0)console['log'](_0xb5c091(0x123));else{console[_0xb5c091(0x11a)](_0xb5c091(0xff));for(const _0x321e51 of _0x265100){console[_0xb5c091(0x11a)](_0xb5c091(0x10c)+_0x321e51);}console['log'](_0xb5c091(0xfb)+CLI_BIN_NAME+_0xb5c091(0x12a));}return{'ok':!![]};}if(!_0x550e68[_0x1547c0])throw CliErrors[_0xb5c091(0x11e)](_0xb5c091(0x121)+_0x1547c0+_0xb5c091(0x116),'Available:\x20'+(Object[_0xb5c091(0x118)](_0x550e68)[_0xb5c091(0x11d)](',\x20')||_0xb5c091(0xfd)));const _0xd622bb=detectPackageManager(_0x4b141a);VERSION_CHECK_SCRIPTS[_0xb5c091(0xfc)](_0x1547c0)&&await versionCheck(_0x4b141a);if(_0x1547c0===_0xb5c091(0x108)&&_0x200ac8[_0xb5c091(0x11c)](_0xb5c091(0x107)))return await Promise[_0xb5c091(0x106)]([spawnViteBuildWatch(_0x4b141a),spawnVitePreview(_0x4b141a)]),{'ok':!![]};return await spawnScript(_0xd622bb,_0x1547c0,_0x4942d1,_0x4b141a),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a208_0x51d6d1=a208_0x2d4e;function a208_0x2602(){const _0x5c3d99=['2979695DlWkwv','schema','797678xrSmCJ','json','4152320UQCTpk','2917019giMhZh','554925ZPJghU','442270BnvmcI','export','4079580jkJmpE','Export\x20machine-readable\x20command\x20schema\x20(JSON)','6JkTAGQ'];a208_0x2602=function(){return _0x5c3d99;};return a208_0x2602();}(function(_0x56e27b,_0x1d60bb){const _0xede564=a208_0x2d4e,_0x6230c5=_0x56e27b();while(!![]){try{const _0x490465=-parseInt(_0xede564(0x1df))/0x1+-parseInt(_0xede564(0x1d8))/0x2+parseInt(_0xede564(0x1d7))/0x3+parseInt(_0xede564(0x1da))/0x4+parseInt(_0xede564(0x1dd))/0x5*(-parseInt(_0xede564(0x1dc))/0x6)+parseInt(_0xede564(0x1d6))/0x7+parseInt(_0xede564(0x1d5))/0x8;if(_0x490465===_0x1d60bb)break;else _0x6230c5['push'](_0x6230c5['shift']());}catch(_0x4e90a5){_0x6230c5['push'](_0x6230c5['shift']());}}}(a208_0x2602,0x80633));import{buildSchemaPayload}from'../framework/schema-export.js';function a208_0x2d4e(_0x11ebc6,_0x41e7a4){_0x11ebc6=_0x11ebc6-0x1d5;const _0x2602e6=a208_0x2602();let _0x2d4e31=_0x2602e6[_0x11ebc6];return _0x2d4e31;}async function execute(_0x5bd100){const _0x5b4fd7=await buildSchemaPayload();return{'ok':!![],'data':_0x5b4fd7};}export const schemaDefinition={'service':a208_0x51d6d1(0x1de),'command':a208_0x51d6d1(0x1d9),'description':a208_0x51d6d1(0x1db),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a208_0x51d6d1(0x1e0),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a196_0x492311=a196_0x3fb6;(function(_0x54e859,_0x417d5f){const _0xcdc7d=a196_0x3fb6,_0x3512c5=_0x54e859();while(!![]){try{const _0x324cf6=-parseInt(_0xcdc7d(0x1f7))/0x1*(-parseInt(_0xcdc7d(0x1dc))/0x2)+parseInt(_0xcdc7d(0x1e0))/0x3+-parseInt(_0xcdc7d(0x1fa))/0x4*(parseInt(_0xcdc7d(0x1da))/0x5)+parseInt(_0xcdc7d(0x1e4))/0x6*(parseInt(_0xcdc7d(0x1ec))/0x7)+parseInt(_0xcdc7d(0x1e6))/0x8+parseInt(_0xcdc7d(0x206))/0x9+-parseInt(_0xcdc7d(0x20c))/0xa;if(_0x324cf6===_0x417d5f)break;else _0x3512c5['push'](_0x3512c5['shift']());}catch(_0x335b9b){_0x3512c5['push'](_0x3512c5['shift']());}}}(a196_0x2239,0xa603a));function a196_0x3fb6(_0x5221fb,_0x3e4bef){_0x5221fb=_0x5221fb-0x1c8;const _0x2239c1=a196_0x2239();let _0x3fb6b4=_0x2239c1[_0x5221fb];return _0x3fb6b4;}import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x4b66fe){const _0x31bdd6=a196_0x3fb6;if(_0x4b66fe===_0x31bdd6(0x1ca))return[_0x31bdd6(0x1d0),_0x31bdd6(0x1f2),_0x31bdd6(0x1d6),''][_0x31bdd6(0x1d7)]('\x0a');return[_0x31bdd6(0x1d1),''][_0x31bdd6(0x1d7)]('\x0a');}function a196_0x2239(){const _0x2dc464=['isFinite','sqls','2703012PulBiV','nonInteractive','appCode','Select\x20the\x20local\x20SQL\x20mode:','420498dYvgwj','sql','2355960wPGrWm','create','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','db-id','/smartapi/custom/saveUserCustomSql','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','21cJJPHE','catch','sqlCode','dbName','File\x20already\x20exists:\x20','string','\x20\x20SELECT\x201\x20AS\x20id','POST','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','length','sqlRootDir','173041hdoVEb','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','888MrpCnH','number','name','new','parse','str','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','flag','Created\x20SQL\x20query\x20','SQL\x20query\x20display\x20name','trim','Invalid\x20database\x20selection\x20payload:\x20','11743317itYTKc','<server-generated-sqlCode>','description','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','mode','flagMissing','10776240cZNibi','stringify','✎\x20Enter\x20dbId\x20manually','dbId','mybatisXml','isInteger','Target\x20database\x20ID','toISOString','lockFilePath','validation','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','SELECT\x201\x20AS\x20id;','SQL\x20name\x20cannot\x20be\x20empty','Local\x20SQL\x20file\x20mode','sqlName','write','</select>','join','__manual__','dbId\x20must\x20be\x20a\x20positive\x20integer','25360yhtHHf','map','2IpgGkk','dbId\x20cannot\x20be\x20empty'];a196_0x2239=function(){return _0x2dc464;};return a196_0x2239();}export const sqlCreate={'service':a196_0x492311(0x1e5),'command':a196_0x492311(0x1e7),'description':a196_0x492311(0x1f8),'risk':a196_0x492311(0x1d5),'flags':[{'name':a196_0x492311(0x1fc),'type':a196_0x492311(0x1f1),'description':a196_0x492311(0x203)},{'name':a196_0x492311(0x1e9),'type':a196_0x492311(0x1fb),'description':a196_0x492311(0x1cc)},{'name':'mode','type':a196_0x492311(0x1f1),'enum':[a196_0x492311(0x1e5),a196_0x492311(0x1ca)],'description':a196_0x492311(0x1d3)}],async 'validate'(_0x2ca04c){const _0x125b3c=a196_0x492311;if(!_0x2ca04c['nonInteractive'])return;if(!_0x2ca04c[_0x125b3c(0x1ff)](_0x125b3c(0x1fc))['trim']())throw CliErrors['flagMissing'](_0x125b3c(0x1fc),_0x125b3c(0x1eb));const _0x3ebf42=resolveProvidedDbId(_0x2ca04c);if(typeof _0x3ebf42!==_0x125b3c(0x1fb)||!Number[_0x125b3c(0x1de)](_0x3ebf42)||_0x3ebf42<=0x0)throw CliErrors[_0x125b3c(0x20b)]('db-id','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x2ca04c[_0x125b3c(0x1ff)](_0x125b3c(0x20a))[_0x125b3c(0x204)]())throw CliErrors['flagMissing'](_0x125b3c(0x20a),_0x125b3c(0x200));},async 'dryRun'(_0x27609b){const _0x201000=a196_0x492311,_0x27c848=loadSqlProjectConfig(_0x27609b[_0x201000(0x1e2)]),{sqlName:_0x3e958f,dbId:_0xfdf021,dbName:_0xd788df,mode:_0x17760f}=await resolveSqlNewInputs(_0x27609b),_0x4192aa=buildSqlRelativePath(_0x201000(0x207),_0x3e958f,_0xd788df,_0x17760f,_0xfdf021),_0x4402f5=_0x27c848[_0x201000(0x1f6)]+'/'+_0x4192aa;return{'method':_0x201000(0x1f3),'url':_0x201000(0x1ea),'body':{'appCode':_0x27609b['appCode'],'sqlName':_0x3e958f,'dbId':_0xfdf021,'mode':_0x17760f,'localPath':_0x4402f5},'description':_0x201000(0x1f9)+_0x27c848[_0x201000(0x1f6)]};},async 'execute'(_0x3658f3){const _0x4506d3=a196_0x492311,_0x3db16a=loadSqlProjectConfig(_0x3658f3[_0x4506d3(0x1e2)]),{sqlName:_0x204bc9,dbId:_0x227a8a,dbName:_0x399434,mode:_0x54604f}=await resolveSqlNewInputs(_0x3658f3),_0x2e4bfe=generateSqlTemplate(_0x54604f),_0xbad0a8=await createSqlQuery({'appCode':_0x3658f3['appCode'],'sqlName':_0x204bc9,'dbId':_0x227a8a,'sqlContent':_0x2e4bfe}),_0x58e73c=ensureRemoteSqlContent(_0xbad0a8),_0x2f31c4=_0x399434||await getDbName(_0x3658f3[_0x4506d3(0x1e2)],_0x227a8a)[_0x4506d3(0x1ed)](()=>undefined),_0x32f1f2=buildSqlRelativePath(_0xbad0a8['sqlCode'],_0xbad0a8['sqlName'],_0x2f31c4,_0x54604f,_0x227a8a),_0x760d7a=_0x3db16a[_0x4506d3(0x1f6)]+'/'+_0x32f1f2,_0x1f8dd9=buildLocalSqlFileContent({'sqlCode':_0xbad0a8[_0x4506d3(0x1ee)],'sqlName':_0xbad0a8[_0x4506d3(0x1d4)],'dbId':_0xbad0a8[_0x4506d3(0x1c9)]},_0x58e73c,{'dbName':_0x2f31c4,'mode':_0x54604f,'syncedAt':new Date()[_0x4506d3(0x1cd)](),'description':_0xbad0a8[_0x4506d3(0x208)]});if(await fileExists(_0x760d7a))throw CliErrors[_0x4506d3(0x1cf)](_0x4506d3(0x1f0)+_0x760d7a);await ensureParentDirectory(_0x760d7a),await writeFile(_0x760d7a,_0x1f8dd9,'utf8');const _0x283603=await readSqlLockFile(_0x3db16a[_0x4506d3(0x1ce)]),{lockData:_0x3546f7,appLock:_0xb719ea}=ensureSqlLockScope(_0x283603??createEmptySqlLock(),_0x3db16a[_0x4506d3(0x1e2)],_0x3db16a['sqlRoot'],_0x4506d3(0x1fd));return _0xb719ea[_0x4506d3(0x1df)][_0xbad0a8[_0x4506d3(0x1ee)]]={...buildSqlLockEntry(_0xbad0a8,_0x58e73c,computeSqlContentHash(_0x1f8dd9),{'dbName':_0x2f31c4}),'path':_0x32f1f2,'mode':_0x54604f},_0xb719ea['lastSync']=new Date()[_0x4506d3(0x1cd)](),await writeSqlLockFile(_0x3db16a[_0x4506d3(0x1ce)],_0x3546f7),{'ok':!![],'data':{'id':_0xbad0a8['id'],'sqlCode':_0xbad0a8[_0x4506d3(0x1ee)],'sqlName':_0xbad0a8[_0x4506d3(0x1d4)],'dbId':_0xbad0a8[_0x4506d3(0x1c9)],'path':_0x760d7a,'mode':_0x54604f},'message':_0x4506d3(0x202)+_0xbad0a8['sqlCode']};}};async function resolveSqlNewInputs(_0x223e0a){const _0x17d22b=await resolveSqlNameInput(_0x223e0a),{dbId:_0x4cb50a,dbName:_0x13ad82}=await resolveDbSelection(_0x223e0a),_0x25eb53=await resolveSqlModeInput(_0x223e0a);return{'sqlName':_0x17d22b,'dbId':_0x4cb50a,'dbName':_0x13ad82,'mode':_0x25eb53};}async function resolveSqlNameInput(_0x1ae09c){const _0x5388de=a196_0x492311,_0x552cf1=_0x1ae09c[_0x5388de(0x1ff)](_0x5388de(0x1fc))[_0x5388de(0x204)]();if(_0x552cf1)return _0x552cf1;if(_0x1ae09c[_0x5388de(0x1e1)])throw CliErrors[_0x5388de(0x20b)](_0x5388de(0x1fc),_0x5388de(0x1eb));return(await input({'message':'SQL\x20name:','validate':_0x2fef42=>_0x2fef42[_0x5388de(0x204)]()?!![]:_0x5388de(0x1d2)}))[_0x5388de(0x204)]();}async function resolveDbSelection(_0x2616bf){const _0x3913f5=a196_0x492311,_0x4c4573=resolveProvidedDbId(_0x2616bf);if(typeof _0x4c4573===_0x3913f5(0x1fb)&&Number[_0x3913f5(0x1de)](_0x4c4573)&&_0x4c4573>0x0)return{'dbId':_0x4c4573,'dbName':await getDbName(_0x2616bf[_0x3913f5(0x1e2)],_0x4c4573)[_0x3913f5(0x1ed)](()=>undefined)};if(_0x2616bf[_0x3913f5(0x1e1)])throw CliErrors['flagMissing'](_0x3913f5(0x1e9),_0x3913f5(0x209));const _0x4356c3=await listDatabases(_0x2616bf[_0x3913f5(0x1e2)])[_0x3913f5(0x1ed)](()=>[]);if(_0x4356c3[_0x3913f5(0x1f5)]===0x1)return{'dbId':_0x4356c3[0x0][_0x3913f5(0x1c9)],'dbName':_0x4356c3[0x0][_0x3913f5(0x1ef)]};if(_0x4356c3[_0x3913f5(0x1f5)]>0x1){const _0x5c30d6=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0x4356c3[_0x3913f5(0x1db)](_0x37290e=>({'name':_0x37290e[_0x3913f5(0x1ef)]+'\x20('+_0x37290e[_0x3913f5(0x1c9)]+')','value':serializeDbSelection(_0x37290e)})),{'name':_0x3913f5(0x1c8),'value':_0x3913f5(0x1d8)}]});if(_0x5c30d6!==_0x3913f5(0x1d8))return deserializeDbSelection(_0x5c30d6);}const _0x4f50dc=await input({'message':'Target\x20database\x20dbId:','validate':_0x133d92=>{const _0x187203=_0x3913f5,_0x12dd77=_0x133d92['trim']();if(!_0x12dd77)return _0x187203(0x1dd);const _0x398761=Number(_0x12dd77);if(!Number[_0x187203(0x1cb)](_0x398761)||_0x398761<=0x0)return _0x187203(0x1d9);return!![];}});return{'dbId':Number(_0x4f50dc[_0x3913f5(0x204)]())};}async function resolveSqlModeInput(_0x39415c){const _0x5b7042=a196_0x492311,_0x41b34f=_0x39415c[_0x5b7042(0x1ff)]('mode')[_0x5b7042(0x204)]();if(_0x41b34f===_0x5b7042(0x1e5)||_0x41b34f===_0x5b7042(0x1ca))return _0x41b34f;if(_0x39415c[_0x5b7042(0x1e1)])throw CliErrors[_0x5b7042(0x20b)](_0x5b7042(0x20a),_0x5b7042(0x200));return await select({'message':_0x5b7042(0x1e3),'choices':[{'name':'Plain\x20SQL\x20(sql)','value':_0x5b7042(0x1e5),'description':_0x5b7042(0x1e8)},{'name':'MyBatis\x20XML\x20(mybatisXml)','value':_0x5b7042(0x1ca),'description':_0x5b7042(0x1f4)}]});}function serializeDbSelection(_0x2d6659){const _0x5eaa18=a196_0x492311;return JSON[_0x5eaa18(0x20d)]({'dbId':_0x2d6659['dbId'],'dbName':_0x2d6659[_0x5eaa18(0x1ef)]});}function deserializeDbSelection(_0x41a362){const _0x5d685b=a196_0x492311;try{const _0x19b66c=JSON[_0x5d685b(0x1fe)](_0x41a362);if(typeof _0x19b66c[_0x5d685b(0x1c9)]==='number'&&Number[_0x5d685b(0x1de)](_0x19b66c[_0x5d685b(0x1c9)]))return{'dbId':_0x19b66c[_0x5d685b(0x1c9)],'dbName':_0x19b66c['dbName']};}catch{}throw CliErrors[_0x5d685b(0x1cf)](_0x5d685b(0x205)+_0x41a362);}function resolveProvidedDbId(_0x2b697a){const _0xdd6bed=a196_0x492311,_0x1bf510=_0x2b697a[_0xdd6bed(0x201)](_0xdd6bed(0x1e9));if(typeof _0x1bf510==='number'&&Number[_0xdd6bed(0x1de)](_0x1bf510))return _0x1bf510;return undefined;}
|
|
1
|
+
const a209_0x3bbc76=a209_0x8857;(function(_0xdd1a74,_0x175e99){const _0xfa6a94=a209_0x8857,_0x2fea65=_0xdd1a74();while(!![]){try{const _0x222982=parseInt(_0xfa6a94(0x13e))/0x1+-parseInt(_0xfa6a94(0x129))/0x2+parseInt(_0xfa6a94(0x133))/0x3*(parseInt(_0xfa6a94(0x135))/0x4)+parseInt(_0xfa6a94(0x12a))/0x5*(parseInt(_0xfa6a94(0x11b))/0x6)+parseInt(_0xfa6a94(0x124))/0x7+parseInt(_0xfa6a94(0x10f))/0x8*(-parseInt(_0xfa6a94(0x13c))/0x9)+parseInt(_0xfa6a94(0x141))/0xa*(-parseInt(_0xfa6a94(0x111))/0xb);if(_0x222982===_0x175e99)break;else _0x2fea65['push'](_0x2fea65['shift']());}catch(_0x3d3b5b){_0x2fea65['push'](_0x2fea65['shift']());}}}(a209_0x56aa,0x5185b));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x1f8607){const _0x35a079=a209_0x8857;if(_0x1f8607==='mybatisXml')return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','\x20\x20SELECT\x201\x20AS\x20id',_0x35a079(0x10e),''][_0x35a079(0x147)]('\x0a');return[_0x35a079(0x119),''][_0x35a079(0x147)]('\x0a');}function a209_0x56aa(){const _0x18b674=['number','487937YciVpO','/smartapi/custom/saveUserCustomSql','toISOString','218930wErFNz','length','SQL\x20name:','appCode','sqls','__manual__','join','Created\x20SQL\x20query\x20','mode','Plain\x20SQL\x20(sql)','utf8','mybatisXml','</select>','195816weNldL','description','605JVFEjN','✎\x20Enter\x20dbId\x20manually','Select\x20the\x20local\x20SQL\x20mode:','stringify','isFinite','name','sqlCode','nonInteractive','SELECT\x201\x20AS\x20id;','<server-generated-sqlCode>','498NqjAqv','dbName','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','dbId','string','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','db-id','create','validation','4028094bIjRpw','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','str','Local\x20SQL\x20file\x20mode','790086ifAIkf','37425eidkWh','SQL\x20query\x20display\x20name','map','new','sqlRootDir','trim','flag','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','sqlName','1993644wxsdDf','write','4cRnpOG','parse','sql','flagMissing','catch','lockFilePath','isInteger','153sWshGZ'];a209_0x56aa=function(){return _0x18b674;};return a209_0x56aa();}export const sqlCreate={'service':a209_0x3bbc76(0x137),'command':a209_0x3bbc76(0x122),'description':a209_0x3bbc76(0x125),'risk':a209_0x3bbc76(0x134),'flags':[{'name':'name','type':a209_0x3bbc76(0x11f),'description':a209_0x3bbc76(0x12b)},{'name':a209_0x3bbc76(0x121),'type':'number','description':'Target\x20database\x20ID'},{'name':'mode','type':'string','enum':['sql','mybatisXml'],'description':a209_0x3bbc76(0x128)}],async 'validate'(_0x32fc45){const _0x35bf95=a209_0x3bbc76;if(!_0x32fc45['nonInteractive'])return;if(!_0x32fc45[_0x35bf95(0x127)]('name')[_0x35bf95(0x12f)]())throw CliErrors[_0x35bf95(0x138)](_0x35bf95(0x116),_0x35bf95(0x126));const _0x5d380e=resolveProvidedDbId(_0x32fc45);if(typeof _0x5d380e!=='number'||!Number[_0x35bf95(0x115)](_0x5d380e)||_0x5d380e<=0x0)throw CliErrors[_0x35bf95(0x138)](_0x35bf95(0x121),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x32fc45['str'](_0x35bf95(0x149))[_0x35bf95(0x12f)]())throw CliErrors[_0x35bf95(0x138)](_0x35bf95(0x149),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x551bf9){const _0x1ba103=a209_0x3bbc76,_0x5e21c4=loadSqlProjectConfig(_0x551bf9[_0x1ba103(0x144)]),{sqlName:_0xa5e675,dbId:_0x4669dc,dbName:_0x445871,mode:_0x398b20}=await resolveSqlNewInputs(_0x551bf9),_0x25e61c=buildSqlRelativePath(_0x1ba103(0x11a),_0xa5e675,_0x445871,_0x398b20,_0x4669dc),_0x5aa860=_0x5e21c4[_0x1ba103(0x12e)]+'/'+_0x25e61c;return{'method':'POST','url':_0x1ba103(0x13f),'body':{'appCode':_0x551bf9['appCode'],'sqlName':_0xa5e675,'dbId':_0x4669dc,'mode':_0x398b20,'localPath':_0x5aa860},'description':_0x1ba103(0x11d)+_0x5e21c4[_0x1ba103(0x12e)]};},async 'execute'(_0x389359){const _0x336283=a209_0x3bbc76,_0x2757a4=loadSqlProjectConfig(_0x389359[_0x336283(0x144)]),{sqlName:_0x4bbcc1,dbId:_0x1c081a,dbName:_0x2eb0de,mode:_0x3d76af}=await resolveSqlNewInputs(_0x389359),_0x5a81ea=generateSqlTemplate(_0x3d76af),_0xa38b48=await createSqlQuery({'appCode':_0x389359[_0x336283(0x144)],'sqlName':_0x4bbcc1,'dbId':_0x1c081a,'sqlContent':_0x5a81ea}),_0x27a1b7=ensureRemoteSqlContent(_0xa38b48),_0x3172da=_0x2eb0de||await getDbName(_0x389359[_0x336283(0x144)],_0x1c081a)[_0x336283(0x139)](()=>undefined),_0x578126=buildSqlRelativePath(_0xa38b48[_0x336283(0x117)],_0xa38b48[_0x336283(0x132)],_0x3172da,_0x3d76af,_0x1c081a),_0x3c1b94=_0x2757a4[_0x336283(0x12e)]+'/'+_0x578126,_0x1fb947=buildLocalSqlFileContent({'sqlCode':_0xa38b48[_0x336283(0x117)],'sqlName':_0xa38b48[_0x336283(0x132)],'dbId':_0xa38b48['dbId']},_0x27a1b7,{'dbName':_0x3172da,'mode':_0x3d76af,'syncedAt':new Date()[_0x336283(0x140)](),'description':_0xa38b48[_0x336283(0x110)]});if(await fileExists(_0x3c1b94))throw CliErrors[_0x336283(0x123)]('File\x20already\x20exists:\x20'+_0x3c1b94);await ensureParentDirectory(_0x3c1b94),await writeFile(_0x3c1b94,_0x1fb947,_0x336283(0x14b));const _0x34be9a=await readSqlLockFile(_0x2757a4[_0x336283(0x13a)]),{lockData:_0x3eddcf,appLock:_0xbc73f4}=ensureSqlLockScope(_0x34be9a??createEmptySqlLock(),_0x2757a4[_0x336283(0x144)],_0x2757a4['sqlRoot'],_0x336283(0x12d));return _0xbc73f4[_0x336283(0x145)][_0xa38b48[_0x336283(0x117)]]={...buildSqlLockEntry(_0xa38b48,_0x27a1b7,computeSqlContentHash(_0x1fb947),{'dbName':_0x3172da}),'path':_0x578126,'mode':_0x3d76af},_0xbc73f4['lastSync']=new Date()[_0x336283(0x140)](),await writeSqlLockFile(_0x2757a4[_0x336283(0x13a)],_0x3eddcf),{'ok':!![],'data':{'id':_0xa38b48['id'],'sqlCode':_0xa38b48[_0x336283(0x117)],'sqlName':_0xa38b48[_0x336283(0x132)],'dbId':_0xa38b48['dbId'],'path':_0x3c1b94,'mode':_0x3d76af},'message':_0x336283(0x148)+_0xa38b48[_0x336283(0x117)]};}};async function resolveSqlNewInputs(_0x1727a2){const _0xdf1657=await resolveSqlNameInput(_0x1727a2),{dbId:_0x2f6eec,dbName:_0x234c32}=await resolveDbSelection(_0x1727a2),_0x228942=await resolveSqlModeInput(_0x1727a2);return{'sqlName':_0xdf1657,'dbId':_0x2f6eec,'dbName':_0x234c32,'mode':_0x228942};}function a209_0x8857(_0x3390d1,_0x333263){_0x3390d1=_0x3390d1-0x10e;const _0x56aa77=a209_0x56aa();let _0x8857d5=_0x56aa77[_0x3390d1];return _0x8857d5;}async function resolveSqlNameInput(_0x36e034){const _0x2a620c=a209_0x3bbc76,_0x234c87=_0x36e034['str'](_0x2a620c(0x116))[_0x2a620c(0x12f)]();if(_0x234c87)return _0x234c87;if(_0x36e034[_0x2a620c(0x118)])throw CliErrors['flagMissing'](_0x2a620c(0x116),_0x2a620c(0x126));return(await input({'message':_0x2a620c(0x143),'validate':_0x4838f1=>_0x4838f1[_0x2a620c(0x12f)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))[_0x2a620c(0x12f)]();}async function resolveDbSelection(_0x1b368f){const _0x132500=a209_0x3bbc76,_0x2c5297=resolveProvidedDbId(_0x1b368f);if(typeof _0x2c5297==='number'&&Number[_0x132500(0x115)](_0x2c5297)&&_0x2c5297>0x0)return{'dbId':_0x2c5297,'dbName':await getDbName(_0x1b368f[_0x132500(0x144)],_0x2c5297)['catch'](()=>undefined)};if(_0x1b368f[_0x132500(0x118)])throw CliErrors[_0x132500(0x138)](_0x132500(0x121),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x5577d1=await listDatabases(_0x1b368f[_0x132500(0x144)])['catch'](()=>[]);if(_0x5577d1[_0x132500(0x142)]===0x1)return{'dbId':_0x5577d1[0x0][_0x132500(0x11e)],'dbName':_0x5577d1[0x0]['dbName']};if(_0x5577d1['length']>0x1){const _0x563a80=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0x5577d1[_0x132500(0x12c)](_0x15b66f=>({'name':_0x15b66f['dbName']+'\x20('+_0x15b66f['dbId']+')','value':serializeDbSelection(_0x15b66f)})),{'name':_0x132500(0x112),'value':'__manual__'}]});if(_0x563a80!==_0x132500(0x146))return deserializeDbSelection(_0x563a80);}const _0x27551f=await input({'message':'Target\x20database\x20dbId:','validate':_0x3be5d5=>{const _0x27fc9a=_0x132500,_0x16e615=_0x3be5d5[_0x27fc9a(0x12f)]();if(!_0x16e615)return'dbId\x20cannot\x20be\x20empty';const _0x348ee7=Number(_0x16e615);if(!Number[_0x27fc9a(0x13b)](_0x348ee7)||_0x348ee7<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x27551f[_0x132500(0x12f)]())};}async function resolveSqlModeInput(_0xaab165){const _0x50368d=a209_0x3bbc76,_0x3a77a6=_0xaab165[_0x50368d(0x127)](_0x50368d(0x149))[_0x50368d(0x12f)]();if(_0x3a77a6===_0x50368d(0x137)||_0x3a77a6===_0x50368d(0x14c))return _0x3a77a6;if(_0xaab165[_0x50368d(0x118)])throw CliErrors[_0x50368d(0x138)](_0x50368d(0x149),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x50368d(0x113),'choices':[{'name':_0x50368d(0x14a),'value':_0x50368d(0x137),'description':_0x50368d(0x131)},{'name':'MyBatis\x20XML\x20(mybatisXml)','value':_0x50368d(0x14c),'description':_0x50368d(0x120)}]});}function serializeDbSelection(_0x252373){const _0x1ae80a=a209_0x3bbc76;return JSON[_0x1ae80a(0x114)]({'dbId':_0x252373['dbId'],'dbName':_0x252373[_0x1ae80a(0x11c)]});}function deserializeDbSelection(_0x2c1494){const _0x5783df=a209_0x3bbc76;try{const _0x3b8f38=JSON[_0x5783df(0x136)](_0x2c1494);if(typeof _0x3b8f38['dbId']===_0x5783df(0x13d)&&Number['isFinite'](_0x3b8f38[_0x5783df(0x11e)]))return{'dbId':_0x3b8f38[_0x5783df(0x11e)],'dbName':_0x3b8f38['dbName']};}catch{}throw CliErrors[_0x5783df(0x123)]('Invalid\x20database\x20selection\x20payload:\x20'+_0x2c1494);}function resolveProvidedDbId(_0xdc740c){const _0x2148f7=a209_0x3bbc76,_0x558295=_0xdc740c[_0x2148f7(0x130)]('db-id');if(typeof _0x558295===_0x2148f7(0x13d)&&Number['isFinite'](_0x558295))return _0x558295;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a210_0x346af7=a210_0x57a0;(function(_0xc8961b,_0x365ee1){const _0x464917=a210_0x57a0,_0x33ad67=_0xc8961b();while(!![]){try{const _0x45f9c9=parseInt(_0x464917(0x117))/0x1*(parseInt(_0x464917(0x11d))/0x2)+parseInt(_0x464917(0x11f))/0x3+-parseInt(_0x464917(0x114))/0x4+-parseInt(_0x464917(0x107))/0x5+parseInt(_0x464917(0x10b))/0x6*(parseInt(_0x464917(0x112))/0x7)+parseInt(_0x464917(0x115))/0x8+-parseInt(_0x464917(0x10e))/0x9;if(_0x45f9c9===_0x365ee1)break;else _0x33ad67['push'](_0x33ad67['shift']());}catch(_0x2ad3b5){_0x33ad67['push'](_0x33ad67['shift']());}}}(a210_0x5a21,0x33f70));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';function a210_0x5a21(){const _0xe1b0b5=['str','1244181avtJww','remoteId','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','filter','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','Would\x20delete\x20SQL\x20','toISOString','POST','sqlRootDir','length','sqlRoot','1517365quvFOH','lockFilePath','trashedTo','/smartapi/custom/deleteUserCustomSql','462pWgyHu','startsWith','appCode','84303hnlcDS','trashDir','high-risk-write','sqls','2821JdioPf','sqlcode','1668864RzlgJF','860248owypdp','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','145ynVThA','entries','validation','projectRoot','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','delete','5374XbdbYF'];a210_0x5a21=function(){return _0xe1b0b5;};return a210_0x5a21();}function a210_0x57a0(_0x2bf913,_0x1fa11c){_0x2bf913=_0x2bf913-0x105;const _0x5a21e6=a210_0x5a21();let _0x57a017=_0x5a21e6[_0x2bf913];return _0x57a017;}import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':'sql','command':a210_0x346af7(0x11c),'description':a210_0x346af7(0x116),'risk':a210_0x346af7(0x110),'flags':[SQLCODE_FLAG],async 'validate'(_0x455665){const _0x47c128=a210_0x346af7,_0x5c22a7=loadSqlProjectConfig(_0x455665['appCode']),_0x3624f1=await readSqlLockFile(_0x5c22a7[_0x47c128(0x108)]);if(!_0x3624f1)throw CliErrors[_0x47c128(0x119)](_0x47c128(0x11b));},async 'dryRun'(_0x388c48){const _0x2b763a=a210_0x346af7,_0x607308=loadSqlProjectConfig(_0x388c48[_0x2b763a(0x10d)]),_0x1a7b26=await readSqlLockFile(_0x607308[_0x2b763a(0x108)]);if(!_0x1a7b26)throw CliErrors['validation'](_0x2b763a(0x11b));const {appLock:_0xf0639}=ensureSqlLockScope(_0x1a7b26,_0x388c48[_0x2b763a(0x10d)],_0x607308[_0x2b763a(0x106)],_0x2b763a(0x11c)),_0x103199=_0x388c48[_0x2b763a(0x11e)]('sqlcode'),_0x5c07df=_0xf0639[_0x2b763a(0x111)][_0x103199];if(!_0x5c07df)throw CliErrors[_0x2b763a(0x119)](_0x2b763a(0x121)+_0x103199+'\x22.');return{'method':_0x2b763a(0x126),'url':_0x2b763a(0x10a),'body':{'sqlCode':_0x103199,'id':_0x5c07df[_0x2b763a(0x120)],'localPath':resolveLocalSqlFilePath(_0x607308,_0x103199,_0x5c07df)},'description':_0x2b763a(0x124)+_0x103199+_0x2b763a(0x123)+_0x607308[_0x2b763a(0x10f)]};},async 'execute'(_0x5177b9){const _0x435162=a210_0x346af7,_0x366aaf=loadSqlProjectConfig(_0x5177b9['appCode']),_0xae5470=await readSqlLockFile(_0x366aaf[_0x435162(0x108)]);if(!_0xae5470)throw CliErrors[_0x435162(0x119)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x4e00eb,appLock:_0x382277}=ensureSqlLockScope(_0xae5470,_0x5177b9[_0x435162(0x10d)],_0x366aaf[_0x435162(0x106)],_0x435162(0x11c)),_0x82aaf0=_0x5177b9[_0x435162(0x11e)](_0x435162(0x113)),_0x28aded=_0x382277[_0x435162(0x111)][_0x82aaf0];if(!_0x28aded)throw CliErrors[_0x435162(0x119)](_0x435162(0x121)+_0x82aaf0+'\x22.');await deleteSqlQuery({'id':_0x28aded[_0x435162(0x120)],'sqlCode':_0x82aaf0}),_0x382277[_0x435162(0x111)]=Object['fromEntries'](Object[_0x435162(0x118)](_0x382277[_0x435162(0x111)])[_0x435162(0x122)](([_0x2c05a5])=>_0x2c05a5!==_0x82aaf0)),_0x382277['lastSync']=new Date()[_0x435162(0x125)](),await writeSqlLockFile(_0x366aaf[_0x435162(0x108)],_0x4e00eb);const _0x34249b=resolveLocalSqlFilePath(_0x366aaf,_0x82aaf0,_0x28aded);let _0x38008f;await fileExists(_0x34249b)&&(_0x38008f=await moveToTrash(_0x366aaf[_0x435162(0x11a)],_0x366aaf[_0x435162(0x10f)],_0x34249b),await cleanupEmptyDirectories(dirname(_0x34249b),_0x366aaf[_0x435162(0x127)]));const _0x1d28c2={'deleted':_0x82aaf0,'remoteId':_0x28aded[_0x435162(0x120)]};if(_0x38008f)_0x1d28c2[_0x435162(0x109)]=_0x38008f;return{'ok':!![],'data':_0x1d28c2,'message':'Deleted\x20'+_0x82aaf0+(_0x38008f?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x4cc1e8,_0x274235,_0x4f0fa3){const _0x5dd694=a210_0x346af7,_0x1dca0c=new Date()[_0x5dd694(0x125)]()['replace'](/[:.]/g,'-'),_0x54f8ff=relative(_0x4cc1e8,_0x4f0fa3),_0x1b6264=join(_0x274235,_0x1dca0c,_0x54f8ff);return await mkdir(dirname(_0x1b6264),{'recursive':!![]}),await rename(_0x4f0fa3,_0x1b6264),_0x1b6264;}async function cleanupEmptyDirectories(_0x1cd155,_0x4d8236){const _0x195969=a210_0x346af7;let _0x14c793=resolve(_0x1cd155);const _0x4320b2=resolve(_0x4d8236);while(_0x14c793[_0x195969(0x10c)](''+_0x4320b2+sep)||_0x14c793===_0x4320b2){if(_0x14c793===_0x4320b2)return;try{const _0x3d9bf4=await readdir(_0x14c793);if(_0x3d9bf4[_0x195969(0x105)]>0x0)return;await rmdir(_0x14c793);}catch{return;}_0x14c793=dirname(_0x14c793);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a211_0x9cf73f=a211_0x4e7a;(function(_0x3e28a1,_0x513b47){const _0x402ae5=a211_0x4e7a,_0x1d9e52=_0x3e28a1();while(!![]){try{const _0x31064a=-parseInt(_0x402ae5(0x17f))/0x1+parseInt(_0x402ae5(0x181))/0x2*(-parseInt(_0x402ae5(0x176))/0x3)+-parseInt(_0x402ae5(0x187))/0x4+-parseInt(_0x402ae5(0x173))/0x5*(-parseInt(_0x402ae5(0x182))/0x6)+parseInt(_0x402ae5(0x17e))/0x7*(parseInt(_0x402ae5(0x17d))/0x8)+parseInt(_0x402ae5(0x17b))/0x9*(parseInt(_0x402ae5(0x184))/0xa)+-parseInt(_0x402ae5(0x188))/0xb*(-parseInt(_0x402ae5(0x180))/0xc);if(_0x31064a===_0x513b47)break;else _0x1d9e52['push'](_0x1d9e52['shift']());}catch(_0x442aa3){_0x1d9e52['push'](_0x1d9e52['shift']());}}}(a211_0x58d9,0x83082));function a211_0x4e7a(_0xc1e78,_0x2dc99f){_0xc1e78=_0xc1e78-0x173;const _0x58d9a5=a211_0x58d9();let _0x4e7a13=_0x58d9a5[_0xc1e78];return _0x4e7a13;}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a211_0x58d9(){const _0x5c5e8d=['731128NwUyMj','21bXUakJ','944843qgVWXn','228SWqCQq','236ptVbIw','30jzyqDr','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','160EmbMkn','Return\x20full\x20raw\x20SQL\x20query\x20object','verbose','1950796BCjnDW','718817ELXjWy','sqlContent','sql','bool','688990XqhndT','str','appCode','15786GEtVVx','dbId','boolean','sqlCode','sqlName','216792IHdhpL','read'];a211_0x58d9=function(){return _0x5c5e8d;};return a211_0x58d9();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a211_0x9cf73f(0x18a),'command':'detail','description':a211_0x9cf73f(0x183),'risk':a211_0x9cf73f(0x17c),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a211_0x9cf73f(0x178),'description':a211_0x9cf73f(0x185)}],async 'execute'(_0x4251f8){const _0x257e94=a211_0x9cf73f,_0xb12220=await getSqlQueryInfo(_0x4251f8['appCode'],_0x4251f8[_0x257e94(0x174)]('sqlcode')),_0x32102c=_0x4251f8[_0x257e94(0x18b)](_0x257e94(0x186));if(_0x32102c)return{'ok':!![],'data':_0xb12220};const _0x22de95=_0xb12220[_0x257e94(0x177)]?await getDbName(_0x4251f8[_0x257e94(0x175)],_0xb12220[_0x257e94(0x177)]):undefined;return{'ok':!![],'data':{'sqlCode':_0xb12220[_0x257e94(0x179)],'sqlName':_0xb12220[_0x257e94(0x17a)],'db':_0x22de95?_0x22de95+'\x20('+_0xb12220[_0x257e94(0x177)]+')':_0xb12220[_0x257e94(0x177)]??'','description':_0xb12220['description']??'','sqlContent':_0xb12220[_0x257e94(0x189)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a212_0x25e4ca=a212_0x5568;(function(_0x1798fa,_0x25549c){const _0x4afa9b=a212_0x5568,_0x69bd0f=_0x1798fa();while(!![]){try{const _0x3e2716=-parseInt(_0x4afa9b(0xd2))/0x1*(-parseInt(_0x4afa9b(0xcc))/0x2)+-parseInt(_0x4afa9b(0xcb))/0x3+parseInt(_0x4afa9b(0xc3))/0x4*(-parseInt(_0x4afa9b(0xda))/0x5)+parseInt(_0x4afa9b(0xca))/0x6*(parseInt(_0x4afa9b(0xd0))/0x7)+parseInt(_0x4afa9b(0xd8))/0x8*(-parseInt(_0x4afa9b(0xd3))/0x9)+-parseInt(_0x4afa9b(0xc9))/0xa*(-parseInt(_0x4afa9b(0xd9))/0xb)+parseInt(_0x4afa9b(0xc4))/0xc;if(_0x3e2716===_0x25549c)break;else _0x69bd0f['push'](_0x69bd0f['shift']());}catch(_0x312476){_0x69bd0f['push'](_0x69bd0f['shift']());}}}(a212_0x1297,0x6950c));import{executeSql}from'../../core/api-client.js';function a212_0x5568(_0x174ed9,_0x4a4c3d){_0x174ed9=_0x174ed9-0xc3;const _0x1297e9=a212_0x1297();let _0x556855=_0x1297e9[_0x174ed9];return _0x556855;}function a212_0x1297(){const _0x29a405=['Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','execError','12qCTNLB','5967444EfprDC','Returned\x20','appCode','SQL\x20execution\x20failed','read','10ehHjQk','6XPYEJJ','349947eOYQsd','4098eZNiAG','sql','params','execSuccess','453467qzcBmi','isArray','311AhHHYh','87966ofbrYz','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','str','length','now','392wHZKrk','6678001kRiPxV','1299085fZSFGd'];a212_0x1297=function(){return _0x29a405;};return a212_0x1297();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a212_0x25e4ca(0xcd),'command':'exec','description':a212_0x25e4ca(0xdb),'risk':a212_0x25e4ca(0xc8),'flags':[SQLCODE_FLAG,{'name':'params','type':'string','description':a212_0x25e4ca(0xd4)}],async 'execute'(_0x4cc91a){const _0x1bc074=a212_0x25e4ca,_0x3e34ef=parseJsonParams(_0x4cc91a['str'](_0x1bc074(0xce))),_0x2a16e4=Date[_0x1bc074(0xd7)](),_0x577d03=await executeSql(_0x4cc91a[_0x1bc074(0xc6)],_0x4cc91a[_0x1bc074(0xd5)]('sqlcode'),_0x3e34ef),_0x4bf96b=Date[_0x1bc074(0xd7)]()-_0x2a16e4,_0x5218e3=_0x577d03?.['execResult']??_0x577d03,_0x3b9cfe=_0x577d03?.[_0x1bc074(0xcf)]??!![];if(!_0x3b9cfe)return{'ok':![],'data':{'error':_0x577d03?.[_0x1bc074(0xdc)]||_0x1bc074(0xc7),'elapsed':_0x4bf96b},'message':_0x1bc074(0xc7)};const _0x2a999f=Array[_0x1bc074(0xd1)](_0x5218e3)?_0x5218e3:[];return{'ok':!![],'data':{'rows':_0x2a999f,'rowCount':_0x2a999f[_0x1bc074(0xd6)],'elapsed':_0x4bf96b},'message':_0x1bc074(0xc5)+_0x2a999f[_0x1bc074(0xd6)]+'\x20row(s)\x20in\x20'+_0x4bf96b+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x514dc0,_0x4da15b){const _0x4fdaeb=a213_0x23bb,_0x2cb779=_0x514dc0();while(!![]){try{const _0x7f6a6f=parseInt(_0x4fdaeb(0x153))/0x1+-parseInt(_0x4fdaeb(0x155))/0x2*(-parseInt(_0x4fdaeb(0x157))/0x3)+-parseInt(_0x4fdaeb(0x156))/0x4+parseInt(_0x4fdaeb(0x159))/0x5+parseInt(_0x4fdaeb(0x151))/0x6+parseInt(_0x4fdaeb(0x154))/0x7+parseInt(_0x4fdaeb(0x152))/0x8*(-parseInt(_0x4fdaeb(0x158))/0x9);if(_0x7f6a6f===_0x4da15b)break;else _0x2cb779['push'](_0x2cb779['shift']());}catch(_0xa422f0){_0x2cb779['push'](_0x2cb779['shift']());}}}(a213_0x5ea5,0xa3f03));function a213_0x23bb(_0x4afa10,_0xe68e78){_0x4afa10=_0x4afa10-0x151;const _0x5ea577=a213_0x5ea5();let _0x23bb5f=_0x5ea577[_0x4afa10];return _0x23bb5f;}import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a213_0x5ea5(){const _0x5cde2c=['247173WNjDjR','578268bnzrOH','5687985pMRGgg','3793800vJhTtG','440bHoYcX','1230899RyjRLF','6876030vMlVRv','22OviMeb','2736144AvMDzy'];a213_0x5ea5=function(){return _0x5cde2c;};return a213_0x5ea5();}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a214_0x111549=a214_0x1ff1;(function(_0x54bf9a,_0x267df8){const _0x1356dc=a214_0x1ff1,_0x3a63d7=_0x54bf9a();while(!![]){try{const _0x408cc4=-parseInt(_0x1356dc(0x138))/0x1*(parseInt(_0x1356dc(0x13e))/0x2)+-parseInt(_0x1356dc(0x140))/0x3*(-parseInt(_0x1356dc(0x124))/0x4)+parseInt(_0x1356dc(0x126))/0x5*(-parseInt(_0x1356dc(0x13d))/0x6)+parseInt(_0x1356dc(0x12a))/0x7+-parseInt(_0x1356dc(0x132))/0x8*(-parseInt(_0x1356dc(0x139))/0x9)+parseInt(_0x1356dc(0x12e))/0xa+-parseInt(_0x1356dc(0x12f))/0xb;if(_0x408cc4===_0x267df8)break;else _0x3a63d7['push'](_0x3a63d7['shift']());}catch(_0xaf58d8){_0x3a63d7['push'](_0x3a63d7['shift']());}}}(a214_0x5175,0x2d98a));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a214_0x5175(){const _0x5d7e35=['3680450FfpcDO','9037468wVmVib','totalCount','appCode','171808IcIZJU','sqlCode','boolean','List\x20custom\x20SQL\x20queries','No\x20custom\x20SQL\x20queries\x20found.','read','90715ZbdCEi','117UoFPnn','pagesize','page','length','125268RlDkMH','2qPFaUo','verbose','3jANnwy','str','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','paging','name','description','number','1244464jACaMH','\x20SQL\x20queries\x20(total:\x20','5HHylDm','num','Filter\x20by\x20SQL\x20name','dbId','1131158pSWbHA','Page\x20number','Found\x20','bool'];a214_0x5175=function(){return _0x5d7e35;};return a214_0x5175();}function a214_0x1ff1(_0x4003a8,_0x264ce6){_0x4003a8=_0x4003a8-0x122;const _0x51752b=a214_0x5175();let _0x1ff14b=_0x51752b[_0x4003a8];return _0x1ff14b;}export const sqlList={'service':'sql','command':'list','description':a214_0x111549(0x135),'risk':a214_0x111549(0x137),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a214_0x111549(0x144),'type':'string','description':a214_0x111549(0x128)},{'name':a214_0x111549(0x13b),'type':a214_0x111549(0x123),'description':a214_0x111549(0x12b),'default':0x1},{'name':a214_0x111549(0x13a),'type':'number','description':'Page\x20size'},{'name':a214_0x111549(0x13f),'type':a214_0x111549(0x134),'description':a214_0x111549(0x142)}],async 'execute'(_0x3043a2){const _0x5c84f1=a214_0x111549,_0xbd2763=await listSqlQueries(_0x3043a2[_0x5c84f1(0x131)],{'sqlCode':_0x3043a2[_0x5c84f1(0x141)]('sqlcode')||undefined,'sqlName':_0x3043a2[_0x5c84f1(0x141)]('name')||undefined,'currentPage':_0x3043a2[_0x5c84f1(0x127)](_0x5c84f1(0x13b)),'pageSize':_0x3043a2[_0x5c84f1(0x127)](_0x5c84f1(0x13a),0x32)}),_0x23469e=_0x3043a2[_0x5c84f1(0x12d)](_0x5c84f1(0x13f)),_0x3885ec=_0xbd2763['tableData']??[],_0x2e5dbc=_0xbd2763[_0x5c84f1(0x143)]?.[_0x5c84f1(0x130)]??_0x3885ec[_0x5c84f1(0x13c)];let _0x335d65;return _0x23469e?_0x335d65=_0x3885ec:_0x335d65=await Promise['all'](_0x3885ec['map'](async _0x138bdc=>{const _0xd90e16=_0x5c84f1;let _0x34cb0e;try{_0x34cb0e=_0x138bdc[_0xd90e16(0x129)]?await getDbName(_0x3043a2['appCode'],_0x138bdc[_0xd90e16(0x129)]):undefined;}catch{}return{'sqlCode':_0x138bdc[_0xd90e16(0x133)],'sqlName':_0x138bdc['sqlName'],'description':_0x138bdc[_0xd90e16(0x122)]??'','db':_0x34cb0e?_0x34cb0e+'\x20('+_0x138bdc['dbId']+')':_0x138bdc[_0xd90e16(0x129)]??''};})),{'ok':!![],'data':_0x335d65,'message':_0x3885ec[_0x5c84f1(0x13c)]===0x0?_0x5c84f1(0x136):_0x5c84f1(0x12c)+_0x3885ec[_0x5c84f1(0x13c)]+_0x5c84f1(0x125)+_0x2e5dbc+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a202_0x1c4c4c=a202_0x4a30;(function(_0x4a75eb,_0x288354){const _0x531e78=a202_0x4a30,_0x89554e=_0x4a75eb();while(!![]){try{const _0x18ebbe=parseInt(_0x531e78(0x1c2))/0x1+-parseInt(_0x531e78(0x1a2))/0x2+-parseInt(_0x531e78(0x1ac))/0x3+-parseInt(_0x531e78(0x1b6))/0x4*(parseInt(_0x531e78(0x1a3))/0x5)+parseInt(_0x531e78(0x1a7))/0x6*(-parseInt(_0x531e78(0x1b7))/0x7)+-parseInt(_0x531e78(0x1b1))/0x8+parseInt(_0x531e78(0x1aa))/0x9;if(_0x18ebbe===_0x288354)break;else _0x89554e['push'](_0x89554e['shift']());}catch(_0x5eb92b){_0x89554e['push'](_0x89554e['shift']());}}}(a202_0x5cfb,0xf087b));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';function a202_0x5cfb(){const _0xd722d=['lastSync','5688246mBMNWF','Force\x20overwrite\x20local\x20unsynced\x20changes','mybatisXml','\x20skipped,\x20','sqlName','6652472KosaQi','str','filter','length','sqlRootDir','4lHZdml','4081581xchLCW','message','local\x20differs\x20from\x20remote','sqlContent','read','path','No\x20remote\x20SQL\x20queries\x20matched.','description','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','sqls','utf8','89860EZFQSv','pull','conflict','sql','cancelled','toISOString','lockFilePath','push','test','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','\x20written,\x20','trimStart','name','dbId','bool','split','string','appCode','sqlcode','force','tableData','unchanged','Pull\x20complete:\x20','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','sqlCode','skipped','2429808vZdnNx','4278385wagrzd','nonInteractive','sqlRoot','\x20failed','6oouTBr','catch','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','56489904aZCqPu'];a202_0x5cfb=function(){return _0xd722d;};return a202_0x5cfb();}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';function a202_0x4a30(_0x62bd70,_0x4b02c1){_0x62bd70=_0x62bd70-0x19e;const _0x5cfbca=a202_0x5cfb();let _0x4a3006=_0x5cfbca[_0x62bd70];return _0x4a3006;}import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x4fc609,_0x2a137b){const _0xafb996=a202_0x4a30,_0x3a6395=[];let _0x4aa6cf=0x1;while(!![]){const _0x4408e1=await listSqlQueries(_0x4fc609,{'currentPage':_0x4aa6cf,'pageSize':PAGE_SIZE,'sqlCode':_0x2a137b[_0xafb996(0x1a0)],'sqlName':_0x2a137b[_0xafb996(0x1b0)]}),_0x3ee1f3=_0x4408e1[_0xafb996(0x1d6)]??[];_0x3a6395[_0xafb996(0x1c9)](..._0x3ee1f3);if(_0x3ee1f3['length']===0x0)break;const _0x2e1848=_0x4408e1['paging']?.['totalCount'];if(_0x2e1848!=null?_0x3a6395[_0xafb996(0x1b4)]>=_0x2e1848:_0x3ee1f3['length']<PAGE_SIZE)break;_0x4aa6cf++;}return _0x3a6395;}async function ensureSqlContent(_0x3901f0){const _0x575459=a202_0x4a30;if(_0x3901f0[_0x575459(0x1ba)]!=null&&String(_0x3901f0[_0x575459(0x1ba)])[_0x575459(0x1b4)]>0x0)return _0x3901f0;return getSqlQueryDetail(_0x3901f0[_0x575459(0x1a0)]);}export const sqlPull={'service':a202_0x1c4c4c(0x1c5),'command':a202_0x1c4c4c(0x1c3),'description':a202_0x1c4c4c(0x1cb),'risk':a202_0x1c4c4c(0x1bb),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a202_0x1c4c4c(0x1ce),'type':a202_0x1c4c4c(0x1d2),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a202_0x1c4c4c(0x1d5),'type':'boolean','description':a202_0x1c4c4c(0x1ad)}],async 'dryRun'(_0x4c602f){const _0x5f0bcc=a202_0x1c4c4c,_0x4b6d7f=loadSqlProjectConfig(_0x4c602f[_0x5f0bcc(0x1d3)]),_0x5f0d49=await readSqlLockFile(_0x4b6d7f['lockFilePath']),{appLock:_0x52cf8b}=ensureSqlLockScope(_0x5f0d49??createEmptySqlLock(),_0x4b6d7f[_0x5f0bcc(0x1d3)],_0x4b6d7f[_0x5f0bcc(0x1a5)],_0x5f0bcc(0x1c3)),_0x5d01e0=await fetchAllSqlQueries(_0x4c602f[_0x5f0bcc(0x1d3)],{'sqlCode':_0x4c602f[_0x5f0bcc(0x1b2)](_0x5f0bcc(0x1d4))||undefined,'sqlName':_0x4c602f['str']('name')||undefined}),_0x5c7ba7=[];for(const _0x256aa8 of _0x5d01e0){const _0x52e0ea=await ensureSqlContent(_0x256aa8),_0x1fc1c7=ensureRemoteSqlContent(_0x52e0ea),_0x166905=detectModeFromSql(_0x52e0ea),_0x5b0d02=_0x52e0ea[_0x5f0bcc(0x1cf)]?await getDbName(_0x4c602f[_0x5f0bcc(0x1d3)],Number(_0x52e0ea['dbId']))[_0x5f0bcc(0x1a8)](()=>undefined):undefined,_0x9fc948=buildLocalSqlFileContent({'sqlCode':_0x52e0ea[_0x5f0bcc(0x1a0)],'sqlName':_0x52e0ea[_0x5f0bcc(0x1b0)],'dbId':_0x52e0ea[_0x5f0bcc(0x1cf)]},_0x1fc1c7,{'dbName':_0x5b0d02,'mode':_0x166905,'syncedAt':new Date()[_0x5f0bcc(0x1c7)](),'description':_0x52e0ea[_0x5f0bcc(0x1be)]}),_0x21f446=buildSqlLockEntry(_0x52e0ea,_0x1fc1c7,'',{'dbName':_0x5b0d02}),_0x1803a0=resolveLocalSqlFilePath(_0x4b6d7f,_0x52e0ea['sqlCode'],_0x21f446);let _0x565c53='would_pull',_0x55fec8;if(await fileExists(_0x1803a0)){const _0x2f9d5b=await readFile(_0x1803a0,_0x5f0bcc(0x1c1));isEquivalentPulledSqlFile(_0x2f9d5b,_0x9fc948,_0x166905)?(_0x565c53=_0x5f0bcc(0x1a1),_0x55fec8='unchanged'):(_0x565c53=_0x5f0bcc(0x1c4),_0x55fec8=_0x5f0bcc(0x1a9));}_0x5c7ba7[_0x5f0bcc(0x1c9)]({'sqlCode':_0x52e0ea[_0x5f0bcc(0x1a0)],'sqlName':_0x52e0ea[_0x5f0bcc(0x1b0)],'filePath':_0x1803a0,'status':_0x565c53,'reason':_0x55fec8});}return{'method':'POST','url':_0x5f0bcc(0x19f),'body':{'appCode':_0x4c602f['appCode'],'sqlCode':_0x4c602f[_0x5f0bcc(0x1b2)](_0x5f0bcc(0x1d4))||null,'sqlName':_0x4c602f[_0x5f0bcc(0x1b2)](_0x5f0bcc(0x1ce))||null,'files':_0x5c7ba7},'description':'Would\x20pull\x20'+_0x5c7ba7[_0x5f0bcc(0x1b4)]+'\x20SQL\x20file(s)\x20into\x20'+_0x4b6d7f['sqlRootDir']};},async 'execute'(_0x44a4e0){const _0x548588=a202_0x1c4c4c,_0x5c5793=loadSqlProjectConfig(_0x44a4e0[_0x548588(0x1d3)]),_0x433fc6=await readSqlLockFile(_0x5c5793[_0x548588(0x1c8)]),{lockData:_0x175ce0,appLock:_0x43fdeb}=ensureSqlLockScope(_0x433fc6??createEmptySqlLock(),_0x5c5793[_0x548588(0x1d3)],_0x5c5793[_0x548588(0x1a5)],_0x548588(0x1c3)),_0x2f4828=_0x44a4e0[_0x548588(0x1d0)](_0x548588(0x1d5)),_0x264577=await fetchAllSqlQueries(_0x44a4e0[_0x548588(0x1d3)],{'sqlCode':_0x44a4e0[_0x548588(0x1b2)](_0x548588(0x1d4))||undefined,'sqlName':_0x44a4e0[_0x548588(0x1b2)](_0x548588(0x1ce))||undefined});if(_0x264577[_0x548588(0x1b4)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x548588(0x1bd)};const _0x3453d5=[],_0xa4db7e=[];for(const _0x5e5adb of _0x264577){try{_0x3453d5[_0x548588(0x1c9)](await ensureSqlContent(_0x5e5adb));}catch(_0x7fb597){_0xa4db7e[_0x548588(0x1c9)]({'sqlCode':_0x5e5adb[_0x548588(0x1a0)],'error':_0x7fb597 instanceof Error?_0x7fb597[_0x548588(0x1b8)]:String(_0x7fb597)});}}if(_0x2f4828&&!_0x44a4e0[_0x548588(0x1a4)]){let _0x4e147d=![];for(const _0x24d75a of _0x3453d5){const _0x53f73b=detectModeFromSql(_0x24d75a),_0x314563=_0x24d75a['dbId']?await getDbName(_0x44a4e0[_0x548588(0x1d3)],Number(_0x24d75a[_0x548588(0x1cf)]))['catch'](()=>undefined):undefined,_0x1f915d=buildLocalSqlFileContent({'sqlCode':_0x24d75a[_0x548588(0x1a0)],'sqlName':_0x24d75a[_0x548588(0x1b0)],'dbId':_0x24d75a[_0x548588(0x1cf)]},ensureRemoteSqlContent(_0x24d75a),{'dbName':_0x314563,'mode':_0x53f73b,'syncedAt':new Date()[_0x548588(0x1c7)](),'description':_0x24d75a['description']}),_0x567747=resolveLocalSqlFilePath(_0x5c5793,_0x24d75a[_0x548588(0x1a0)],buildSqlLockEntry(_0x24d75a,ensureRemoteSqlContent(_0x24d75a),'',{'dbName':_0x314563}));if(await fileExists(_0x567747)){const _0x534e81=await readFile(_0x567747,_0x548588(0x1c1));if(!isEquivalentPulledSqlFile(_0x534e81,_0x1f915d,_0x53f73b)){_0x4e147d=!![];break;}}}if(_0x4e147d){const _0x50a4a3=await confirmForceOverwrite(_0x548588(0x1bf));if(!_0x50a4a3)throw CliErrors[_0x548588(0x1c6)]('Force\x20pull\x20cancelled.');}}const _0x4f9434=cloneSqlLockData(_0x175ce0),_0x477baf=_0x4f9434['apps'][_0x5c5793[_0x548588(0x1d3)]],_0x516152=[],_0x25120f=[];for(const _0x477b13 of _0x3453d5){const _0x28143b=_0x477baf['sqls'][_0x477b13[_0x548588(0x1a0)]],_0x499d2c=ensureRemoteSqlContent(_0x477b13),_0x1aacea=detectModeFromSql(_0x477b13),_0x159018=_0x477b13[_0x548588(0x1cf)]?await getDbName(_0x44a4e0[_0x548588(0x1d3)],Number(_0x477b13['dbId']))[_0x548588(0x1a8)](()=>undefined):undefined,_0x51d2ac=buildLocalSqlFileContent({'sqlCode':_0x477b13[_0x548588(0x1a0)],'sqlName':_0x477b13['sqlName'],'dbId':_0x477b13[_0x548588(0x1cf)]},_0x499d2c,{'dbName':_0x159018,'mode':_0x1aacea,'syncedAt':new Date()['toISOString'](),'description':_0x477b13[_0x548588(0x1be)]}),_0x29fda6=buildSqlLockEntry(_0x477b13,_0x499d2c,computeSqlContentHash(_0x51d2ac),{'dbName':_0x159018}),_0x1d4d6a=_0x29fda6[_0x548588(0x1bc)],_0x192320=join(_0x5c5793[_0x548588(0x1b5)],_0x1d4d6a);try{if(await fileExists(_0x192320)){const _0x4f5b9e=await readFile(_0x192320,'utf8');if(isEquivalentPulledSqlFile(_0x4f5b9e,_0x51d2ac,_0x1aacea)){_0x25120f[_0x548588(0x1c9)]({'sqlCode':_0x477b13[_0x548588(0x1a0)],'reason':_0x548588(0x1d7)}),_0x477baf[_0x548588(0x1c0)][_0x477b13[_0x548588(0x1a0)]]={..._0x29fda6,'hash':computeSqlContentHash(_0x4f5b9e),'path':_0x1d4d6a};continue;}if(!_0x2f4828){_0x25120f[_0x548588(0x1c9)]({'sqlCode':_0x477b13['sqlCode'],'reason':_0x548588(0x1b9)});continue;}}const _0x4159ea=_0x28143b?.[_0x548588(0x1bc)]?join(_0x5c5793[_0x548588(0x1b5)],_0x28143b[_0x548588(0x1bc)]):undefined;_0x4159ea&&_0x4159ea!==_0x192320&&await fileExists(_0x4159ea)&&await rm(_0x4159ea,{'force':!![]}),await ensureParentDirectory(_0x192320),await writeFile(_0x192320,_0x51d2ac,'utf8'),_0x477baf['sqls'][_0x477b13['sqlCode']]={..._0x29fda6,'path':_0x1d4d6a},_0x516152[_0x548588(0x1c9)]({'sqlCode':_0x477b13['sqlCode'],'filePath':_0x192320});}catch(_0xd59278){_0xa4db7e[_0x548588(0x1c9)]({'sqlCode':_0x477b13[_0x548588(0x1a0)],'error':_0xd59278 instanceof Error?_0xd59278[_0x548588(0x1b8)]:String(_0xd59278)});}}return _0x477baf[_0x548588(0x1ab)]=new Date()[_0x548588(0x1c7)](),await writeSqlLockFile(_0x5c5793['lockFilePath'],_0x4f9434),{'ok':_0xa4db7e[_0x548588(0x1b4)]===0x0,'data':{'pulled':_0x516152,'skipped':_0x25120f,'failed':_0xa4db7e},'message':_0x548588(0x19e)+_0x516152[_0x548588(0x1b4)]+_0x548588(0x1cc)+_0x25120f[_0x548588(0x1b4)]+_0x548588(0x1af)+_0xa4db7e[_0x548588(0x1b4)]+_0x548588(0x1a6)};}};function detectModeFromSql(_0x44a1fc){const _0x441680=a202_0x1c4c4c,_0x58add7=ensureRemoteSqlContent(_0x44a1fc),_0x2137d9=stripLocalSqlMetadata(_0x58add7,_0x441680(0x1ae))[_0x441680(0x1cd)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x2137d9))return _0x441680(0x1ae);return _0x441680(0x1c5);}function isEquivalentPulledSqlFile(_0x27c4c6,_0x169310,_0x4e866b){return normalizePullComparableContent(_0x27c4c6,_0x4e866b)===normalizePullComparableContent(_0x169310,_0x4e866b);}function normalizePullComparableContent(_0x507932,_0x532406){const _0xcb3ab7=a202_0x1c4c4c,_0x3765e8=_0x507932['replace'](/\r\n/g,'\x0a')[_0xcb3ab7(0x1d1)]('\x0a'),_0x1f22cd=_0x3765e8[_0xcb3ab7(0x1b3)](_0x556b04=>!isSyncedAtMetadataLine(_0x556b04,_0x532406));return _0x1f22cd['join']('\x0a');}function isSyncedAtMetadataLine(_0x961b81,_0x2a89ec){const _0x3709be=a202_0x1c4c4c;if(_0x2a89ec===_0x3709be(0x1ae))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x3709be(0x1ca)](_0x961b81);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x961b81);}
|
|
1
|
+
const a215_0x262db2=a215_0x2775;(function(_0x3aabb4,_0x46d6c3){const _0x4742ac=a215_0x2775,_0xe5cde4=_0x3aabb4();while(!![]){try{const _0x4bf9c3=-parseInt(_0x4742ac(0x133))/0x1*(-parseInt(_0x4742ac(0x10d))/0x2)+parseInt(_0x4742ac(0x10c))/0x3+-parseInt(_0x4742ac(0x118))/0x4+-parseInt(_0x4742ac(0x136))/0x5+-parseInt(_0x4742ac(0x148))/0x6+parseInt(_0x4742ac(0x10a))/0x7+parseInt(_0x4742ac(0x134))/0x8;if(_0x4bf9c3===_0x46d6c3)break;else _0xe5cde4['push'](_0xe5cde4['shift']());}catch(_0x5abc77){_0xe5cde4['push'](_0xe5cde4['shift']());}}}(a215_0x2ae4,0x4267f));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';function a215_0x2775(_0x516d41,_0x76b139){_0x516d41=_0x516d41-0x109;const _0x2ae455=a215_0x2ae4();let _0x27755f=_0x2ae455[_0x516d41];return _0x27755f;}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x458d74,_0x221d37){const _0x5d66c6=a215_0x2775,_0x472f51=[];let _0x43dc68=0x1;while(!![]){const _0x5786fd=await listSqlQueries(_0x458d74,{'currentPage':_0x43dc68,'pageSize':PAGE_SIZE,'sqlCode':_0x221d37[_0x5d66c6(0x143)],'sqlName':_0x221d37['sqlName']}),_0x3902ee=_0x5786fd['tableData']??[];_0x472f51[_0x5d66c6(0x13f)](..._0x3902ee);if(_0x3902ee[_0x5d66c6(0x13c)]===0x0)break;const _0x1ccd44=_0x5786fd[_0x5d66c6(0x12b)]?.[_0x5d66c6(0x12c)];if(_0x1ccd44!=null?_0x472f51[_0x5d66c6(0x13c)]>=_0x1ccd44:_0x3902ee[_0x5d66c6(0x13c)]<PAGE_SIZE)break;_0x43dc68++;}return _0x472f51;}async function ensureSqlContent(_0xa1f979){const _0x189b27=a215_0x2775;if(_0xa1f979['sqlContent']!=null&&String(_0xa1f979[_0x189b27(0x130)])[_0x189b27(0x13c)]>0x0)return _0xa1f979;return getSqlQueryDetail(_0xa1f979[_0x189b27(0x143)]);}export const sqlPull={'service':a215_0x262db2(0x147),'command':a215_0x262db2(0x11b),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a215_0x262db2(0x142),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a215_0x262db2(0x117),'type':a215_0x262db2(0x122),'description':a215_0x262db2(0x12f)},{'name':a215_0x262db2(0x113),'type':a215_0x262db2(0x146),'description':a215_0x262db2(0x11a)}],async 'dryRun'(_0x26d0b8){const _0xee4d46=a215_0x262db2,_0x259d81=loadSqlProjectConfig(_0x26d0b8[_0xee4d46(0x126)]),_0x5210cd=await readSqlLockFile(_0x259d81[_0xee4d46(0x139)]),{appLock:_0x3c424d}=ensureSqlLockScope(_0x5210cd??createEmptySqlLock(),_0x259d81[_0xee4d46(0x126)],_0x259d81[_0xee4d46(0x119)],_0xee4d46(0x11b)),_0x40d759=await fetchAllSqlQueries(_0x26d0b8[_0xee4d46(0x126)],{'sqlCode':_0x26d0b8[_0xee4d46(0x12a)](_0xee4d46(0x10e))||undefined,'sqlName':_0x26d0b8[_0xee4d46(0x12a)](_0xee4d46(0x117))||undefined}),_0x7047ce=[];for(const _0x12d53c of _0x40d759){const _0x28a92f=await ensureSqlContent(_0x12d53c),_0x19cd2d=ensureRemoteSqlContent(_0x28a92f),_0x2c01df=detectModeFromSql(_0x28a92f),_0x2a5eb6=_0x28a92f[_0xee4d46(0x12e)]?await getDbName(_0x26d0b8[_0xee4d46(0x126)],Number(_0x28a92f[_0xee4d46(0x12e)]))['catch'](()=>undefined):undefined,_0x58e72a=buildLocalSqlFileContent({'sqlCode':_0x28a92f[_0xee4d46(0x143)],'sqlName':_0x28a92f[_0xee4d46(0x141)],'dbId':_0x28a92f[_0xee4d46(0x12e)]},_0x19cd2d,{'dbName':_0x2a5eb6,'mode':_0x2c01df,'syncedAt':new Date()[_0xee4d46(0x137)](),'description':_0x28a92f['description']}),_0x290d4c=buildSqlLockEntry(_0x28a92f,_0x19cd2d,'',{'dbName':_0x2a5eb6}),_0x375989=resolveLocalSqlFilePath(_0x259d81,_0x28a92f[_0xee4d46(0x143)],_0x290d4c);let _0x194889=_0xee4d46(0x129),_0x385516;if(await fileExists(_0x375989)){const _0x147095=await readFile(_0x375989,'utf8');isEquivalentPulledSqlFile(_0x147095,_0x58e72a,_0x2c01df)?(_0x194889=_0xee4d46(0x13d),_0x385516='unchanged'):(_0x194889=_0xee4d46(0x123),_0x385516=_0xee4d46(0x116));}_0x7047ce[_0xee4d46(0x13f)]({'sqlCode':_0x28a92f[_0xee4d46(0x143)],'sqlName':_0x28a92f['sqlName'],'filePath':_0x375989,'status':_0x194889,'reason':_0x385516});}return{'method':_0xee4d46(0x131),'url':_0xee4d46(0x13b),'body':{'appCode':_0x26d0b8[_0xee4d46(0x126)],'sqlCode':_0x26d0b8['str'](_0xee4d46(0x10e))||null,'sqlName':_0x26d0b8[_0xee4d46(0x12a)](_0xee4d46(0x117))||null,'files':_0x7047ce},'description':_0xee4d46(0x144)+_0x7047ce['length']+_0xee4d46(0x11d)+_0x259d81['sqlRootDir']};},async 'execute'(_0x1c5246){const _0x28080b=a215_0x262db2,_0x41f067=loadSqlProjectConfig(_0x1c5246[_0x28080b(0x126)]),_0x3d003c=await readSqlLockFile(_0x41f067[_0x28080b(0x139)]),{lockData:_0x394221,appLock:_0x3314c8}=ensureSqlLockScope(_0x3d003c??createEmptySqlLock(),_0x41f067[_0x28080b(0x126)],_0x41f067[_0x28080b(0x119)],'pull'),_0x33d8af=_0x1c5246[_0x28080b(0x13a)]('force'),_0x18459a=await fetchAllSqlQueries(_0x1c5246['appCode'],{'sqlCode':_0x1c5246[_0x28080b(0x12a)](_0x28080b(0x10e))||undefined,'sqlName':_0x1c5246[_0x28080b(0x12a)](_0x28080b(0x117))||undefined});if(_0x18459a[_0x28080b(0x13c)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x28080b(0x112)};const _0x5971d2=[],_0x5a5331=[];for(const _0x18c9e of _0x18459a){try{_0x5971d2[_0x28080b(0x13f)](await ensureSqlContent(_0x18c9e));}catch(_0x86deaa){_0x5a5331['push']({'sqlCode':_0x18c9e[_0x28080b(0x143)],'error':_0x86deaa instanceof Error?_0x86deaa[_0x28080b(0x145)]:String(_0x86deaa)});}}if(_0x33d8af&&!_0x1c5246[_0x28080b(0x13e)]){let _0x12d4a9=![];for(const _0x1f35df of _0x5971d2){const _0x34b0f2=detectModeFromSql(_0x1f35df),_0x3b576d=_0x1f35df[_0x28080b(0x12e)]?await getDbName(_0x1c5246[_0x28080b(0x126)],Number(_0x1f35df[_0x28080b(0x12e)]))[_0x28080b(0x10f)](()=>undefined):undefined,_0x554bf6=buildLocalSqlFileContent({'sqlCode':_0x1f35df[_0x28080b(0x143)],'sqlName':_0x1f35df[_0x28080b(0x141)],'dbId':_0x1f35df[_0x28080b(0x12e)]},ensureRemoteSqlContent(_0x1f35df),{'dbName':_0x3b576d,'mode':_0x34b0f2,'syncedAt':new Date()[_0x28080b(0x137)](),'description':_0x1f35df[_0x28080b(0x127)]}),_0x1071f1=resolveLocalSqlFilePath(_0x41f067,_0x1f35df[_0x28080b(0x143)],buildSqlLockEntry(_0x1f35df,ensureRemoteSqlContent(_0x1f35df),'',{'dbName':_0x3b576d}));if(await fileExists(_0x1071f1)){const _0x127073=await readFile(_0x1071f1,'utf8');if(!isEquivalentPulledSqlFile(_0x127073,_0x554bf6,_0x34b0f2)){_0x12d4a9=!![];break;}}}if(_0x12d4a9){const _0x3ab1d8=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x3ab1d8)throw CliErrors[_0x28080b(0x121)](_0x28080b(0x120));}}const _0x67bba0=cloneSqlLockData(_0x394221),_0xea34ec=_0x67bba0[_0x28080b(0x124)][_0x41f067[_0x28080b(0x126)]],_0x52c620=[],_0x4f0649=[];for(const _0x2e0d76 of _0x5971d2){const _0x3dabab=_0xea34ec['sqls'][_0x2e0d76[_0x28080b(0x143)]],_0x5a1645=ensureRemoteSqlContent(_0x2e0d76),_0x14f17c=detectModeFromSql(_0x2e0d76),_0x33871b=_0x2e0d76[_0x28080b(0x12e)]?await getDbName(_0x1c5246[_0x28080b(0x126)],Number(_0x2e0d76['dbId']))[_0x28080b(0x10f)](()=>undefined):undefined,_0x535d92=buildLocalSqlFileContent({'sqlCode':_0x2e0d76[_0x28080b(0x143)],'sqlName':_0x2e0d76['sqlName'],'dbId':_0x2e0d76[_0x28080b(0x12e)]},_0x5a1645,{'dbName':_0x33871b,'mode':_0x14f17c,'syncedAt':new Date()['toISOString'](),'description':_0x2e0d76[_0x28080b(0x127)]}),_0x1e0d0a=buildSqlLockEntry(_0x2e0d76,_0x5a1645,computeSqlContentHash(_0x535d92),{'dbName':_0x33871b}),_0x1184c0=_0x1e0d0a[_0x28080b(0x12d)],_0x4a04d4=join(_0x41f067[_0x28080b(0x109)],_0x1184c0);try{if(await fileExists(_0x4a04d4)){const _0x211863=await readFile(_0x4a04d4,_0x28080b(0x138));if(isEquivalentPulledSqlFile(_0x211863,_0x535d92,_0x14f17c)){_0x4f0649[_0x28080b(0x13f)]({'sqlCode':_0x2e0d76[_0x28080b(0x143)],'reason':_0x28080b(0x125)}),_0xea34ec[_0x28080b(0x11c)][_0x2e0d76['sqlCode']]={..._0x1e0d0a,'hash':computeSqlContentHash(_0x211863),'path':_0x1184c0};continue;}if(!_0x33d8af){_0x4f0649['push']({'sqlCode':_0x2e0d76[_0x28080b(0x143)],'reason':_0x28080b(0x11e)});continue;}}const _0x395fd2=_0x3dabab?.[_0x28080b(0x12d)]?join(_0x41f067[_0x28080b(0x109)],_0x3dabab[_0x28080b(0x12d)]):undefined;_0x395fd2&&_0x395fd2!==_0x4a04d4&&await fileExists(_0x395fd2)&&await rm(_0x395fd2,{'force':!![]}),await ensureParentDirectory(_0x4a04d4),await writeFile(_0x4a04d4,_0x535d92,_0x28080b(0x138)),_0xea34ec['sqls'][_0x2e0d76['sqlCode']]={..._0x1e0d0a,'path':_0x1184c0},_0x52c620[_0x28080b(0x13f)]({'sqlCode':_0x2e0d76[_0x28080b(0x143)],'filePath':_0x4a04d4});}catch(_0x409b85){_0x5a5331[_0x28080b(0x13f)]({'sqlCode':_0x2e0d76[_0x28080b(0x143)],'error':_0x409b85 instanceof Error?_0x409b85[_0x28080b(0x145)]:String(_0x409b85)});}}return _0xea34ec[_0x28080b(0x11f)]=new Date()[_0x28080b(0x137)](),await writeSqlLockFile(_0x41f067['lockFilePath'],_0x67bba0),{'ok':_0x5a5331[_0x28080b(0x13c)]===0x0,'data':{'pulled':_0x52c620,'skipped':_0x4f0649,'failed':_0x5a5331},'message':_0x28080b(0x128)+_0x52c620[_0x28080b(0x13c)]+_0x28080b(0x140)+_0x4f0649[_0x28080b(0x13c)]+'\x20skipped,\x20'+_0x5a5331[_0x28080b(0x13c)]+_0x28080b(0x111)};}};function a215_0x2ae4(){const _0x15ff83=['sqlRoot','Force\x20overwrite\x20local\x20unsynced\x20changes','pull','sqls','\x20SQL\x20file(s)\x20into\x20','local\x20differs\x20from\x20remote','lastSync','Force\x20pull\x20cancelled.','cancelled','string','conflict','apps','unchanged','appCode','description','Pull\x20complete:\x20','would_pull','str','paging','totalCount','path','dbId','Filter\x20by\x20SQL\x20display\x20name','sqlContent','POST','trimStart','10777QtPVPb','2808752rcvczf','test','2501765lEHtPh','toISOString','utf8','lockFilePath','bool','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','length','skipped','nonInteractive','push','\x20written,\x20','sqlName','read','sqlCode','Would\x20pull\x20','message','boolean','sql','577164pbBWEY','sqlRootDir','2349536EsJfJA','filter','210282HVwbbW','34kGwJgz','sqlcode','catch','replace','\x20failed','No\x20remote\x20SQL\x20queries\x20matched.','force','mybatisXml','split','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','name','285996joZzGO'];a215_0x2ae4=function(){return _0x15ff83;};return a215_0x2ae4();}function detectModeFromSql(_0x4f44c6){const _0x354603=a215_0x262db2,_0x326b34=ensureRemoteSqlContent(_0x4f44c6),_0x2cd4e7=stripLocalSqlMetadata(_0x326b34,_0x354603(0x114))[_0x354603(0x132)]();if(/^<(select|insert|update|delete)\b/i[_0x354603(0x135)](_0x2cd4e7))return _0x354603(0x114);return _0x354603(0x147);}function isEquivalentPulledSqlFile(_0x5d9abe,_0x2671e2,_0x381f8c){return normalizePullComparableContent(_0x5d9abe,_0x381f8c)===normalizePullComparableContent(_0x2671e2,_0x381f8c);}function normalizePullComparableContent(_0x4c0b0a,_0x16ba6f){const _0x2d03cf=a215_0x262db2,_0x3b9431=_0x4c0b0a[_0x2d03cf(0x110)](/\r\n/g,'\x0a')[_0x2d03cf(0x115)]('\x0a'),_0x5c8d61=_0x3b9431[_0x2d03cf(0x10b)](_0x1d9598=>!isSyncedAtMetadataLine(_0x1d9598,_0x16ba6f));return _0x5c8d61['join']('\x0a');}function isSyncedAtMetadataLine(_0x1e2246,_0x53a16e){const _0x20bfc9=a215_0x262db2;if(_0x53a16e===_0x20bfc9(0x114))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x20bfc9(0x135)](_0x1e2246);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x1e2246);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a203_0x10b9c8=a203_0x4e56;(function(_0x4d7000,_0x1e6807){const _0x3866c6=a203_0x4e56,_0xc25d49=_0x4d7000();while(!![]){try{const _0x20bb3e=-parseInt(_0x3866c6(0x18e))/0x1*(parseInt(_0x3866c6(0x175))/0x2)+parseInt(_0x3866c6(0x14d))/0x3*(parseInt(_0x3866c6(0x17d))/0x4)+-parseInt(_0x3866c6(0x18a))/0x5*(parseInt(_0x3866c6(0x15d))/0x6)+parseInt(_0x3866c6(0x17f))/0x7*(parseInt(_0x3866c6(0x170))/0x8)+parseInt(_0x3866c6(0x176))/0x9+parseInt(_0x3866c6(0x189))/0xa+-parseInt(_0x3866c6(0x16e))/0xb;if(_0x20bb3e===_0x1e6807)break;else _0xc25d49['push'](_0xc25d49['shift']());}catch(_0x5eed9e){_0xc25d49['push'](_0xc25d49['shift']());}}}(a203_0x2049,0x9b5ba));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';import{automaticDeploymentSyncSucceeded,buildAutomaticDeploymentSyncPreview,runAutomaticDeploymentSync,validateAutomaticDeploymentSync}from'../../commands/deployment/auto-sync.js';function a203_0x2049(){const _0x55acf9=['sqlcode','status','write','configured','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqlRoot','dbId','dbName','utf8','remoteId','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','unchanged','9276egcdJr','join','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','catch','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqls','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','exec','sqlConfig','entries','push','sqlCode','length','version','lockFilePath','filePath','Local\x20directory\x20\x22','16116628xenZDi','sql','2446648VllAPS','map','Push\x20complete:\x20','has','sqlName','2EBeNZm','11420802OzsnXk','startsWith','\x20pushed,\x20','str','path','relativePath','force','49092GtVwRO','POST','7DcqEkz','hash','mode','message','appCode','bool','set','get','sqlRootDir','trashDir','2851120nagrhl','1385smhqId','/smartapi/custom/updateUserCustomSql','Would\x20push\x20','validation','385663AIufdC','Local\x20SQL\x20not\x20found:\x20','No\x20database\x20matches\x20local\x20directory\x20\x22','toISOString','\x20failed','258uzodSg','replace','\x20SQL\x20file(s)','No\x20local\x20SQL\x20files\x20found.'];a203_0x2049=function(){return _0x55acf9;};return a203_0x2049();}async function getTargetSqlQueries(_0xbcbeb4,_0x2eaaae,_0x20bee3){const _0x144248=a203_0x4e56,_0x3c243e=await scanLocalSqlQueries(_0xbcbeb4),_0x55dd8d=new Map();for(const _0x8070e8 of _0x3c243e){if(_0x20bee3&&_0x8070e8['sqlCode']!==_0x20bee3)continue;const _0x4ad9fa=_0x55dd8d[_0x144248(0x186)](_0x8070e8[_0x144248(0x168)])??[];_0x4ad9fa[_0x144248(0x167)](_0x8070e8),_0x55dd8d[_0x144248(0x185)](_0x8070e8[_0x144248(0x168)],_0x4ad9fa);}if(_0x20bee3&&!_0x55dd8d[_0x144248(0x173)](_0x20bee3))throw CliErrors[_0x144248(0x18d)](_0x144248(0x149)+_0x20bee3);const _0x1a7479=[];for(const [_0x58c3f9,_0x2b855]of _0x55dd8d[_0x144248(0x166)]()){if(_0x2b855[_0x144248(0x169)]===0x1){_0x1a7479[_0x144248(0x167)](_0x2b855[0x0]);continue;}const _0x2497b6=_0x2eaaae[_0x144248(0x162)][_0x58c3f9],_0xb8c5c1=_0x2497b6?.[_0x144248(0x17a)],_0x17522a=_0xb8c5c1?_0x2b855['filter'](_0x47e53c=>_0x47e53c[_0x144248(0x17b)]!==_0xb8c5c1):_0x2b855;if(_0x2497b6&&_0x17522a[_0x144248(0x169)]===0x1){_0x1a7479[_0x144248(0x167)](_0x17522a[0x0]);continue;}throw CliErrors[_0x144248(0x18d)](_0x144248(0x15f)+_0x58c3f9+_0x144248(0x15b));}return _0x1a7479;}export const sqlPush={'service':a203_0x10b9c8(0x16f),'command':'push','description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a203_0x10b9c8(0x153),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a203_0x10b9c8(0x17c),'type':'boolean','description':a203_0x10b9c8(0x155)}],async 'validate'(_0x451ba9){validateAutomaticDeploymentSync(_0x451ba9);},async 'dryRun'(_0x5ed96d){const _0x420ea9=a203_0x10b9c8,_0x594e34=loadSqlProjectConfig(_0x5ed96d[_0x420ea9(0x183)]),_0x562e9e=await readSqlLockFile(_0x594e34[_0x420ea9(0x16b)]),{appLock:_0x2631be}=ensureSqlLockScope(_0x562e9e??createEmptySqlLock(),_0x5ed96d[_0x420ea9(0x183)],_0x594e34[_0x420ea9(0x156)],_0x420ea9(0x167)),_0x3bae36=await getTargetSqlQueries(_0x594e34,_0x2631be,_0x5ed96d[_0x420ea9(0x179)](_0x420ea9(0x151))||undefined),_0x26b96d=[];for(const _0x8f417 of _0x3bae36){const _0x41118c=await computeSqlFileHash(_0x8f417['filePath']),_0xaa28f4=_0x2631be['sqls'][_0x8f417[_0x420ea9(0x168)]],_0x1e1d78=!!_0xaa28f4&&(_0xaa28f4[_0x420ea9(0x17a)]!==_0x8f417[_0x420ea9(0x17b)]||!!_0x8f417[_0x420ea9(0x174)]&&_0xaa28f4[_0x420ea9(0x174)]!==_0x8f417[_0x420ea9(0x174)]);if(!_0x5ed96d[_0x420ea9(0x184)](_0x420ea9(0x17c))&&_0xaa28f4&&_0xaa28f4[_0x420ea9(0x180)]===_0x41118c&&!_0x1e1d78)continue;_0x26b96d[_0x420ea9(0x167)](_0x8f417['sqlCode']);}return{'method':_0x420ea9(0x17e),'url':_0x420ea9(0x18b),'deploymentSync':buildAutomaticDeploymentSyncPreview(_0x5ed96d,_0x420ea9(0x16f),_0x26b96d),'body':{'sqlCodes':_0x26b96d,'appCode':_0x5ed96d['appCode']},'description':_0x420ea9(0x18c)+_0x26b96d[_0x420ea9(0x169)]+_0x420ea9(0x14f)};},async 'execute'(_0x2d7727){const _0x52ea46=a203_0x10b9c8,_0x1e09bb=loadSqlProjectConfig(_0x2d7727[_0x52ea46(0x183)]),_0x12a79e=await readSqlLockFile(_0x1e09bb[_0x52ea46(0x16b)]),{lockData:_0x59b20f,appLock:_0x1c98d9}=ensureSqlLockScope(_0x12a79e??createEmptySqlLock(),_0x2d7727[_0x52ea46(0x183)],_0x1e09bb[_0x52ea46(0x156)],_0x52ea46(0x167)),_0xf1ad91=await getTargetSqlQueries(_0x1e09bb,_0x1c98d9,_0x2d7727[_0x52ea46(0x179)]('sqlcode')||undefined);if(_0xf1ad91[_0x52ea46(0x169)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x52ea46(0x150)};const _0x4f6125=[],_0x556780=[],_0x400faf=[];for(const _0x4b4b6c of _0xf1ad91){const _0x2d64f8=_0x1c98d9[_0x52ea46(0x162)][_0x4b4b6c[_0x52ea46(0x168)]];if(!_0x2d64f8){_0x400faf[_0x52ea46(0x167)]({'sqlCode':_0x4b4b6c[_0x52ea46(0x168)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x3c4ef6=await computeSqlFileHash(_0x4b4b6c['filePath']),_0x4f7591=_0x2d64f8[_0x52ea46(0x17a)]!==_0x4b4b6c['relativePath']||!!_0x4b4b6c[_0x52ea46(0x174)]&&_0x2d64f8[_0x52ea46(0x174)]!==_0x4b4b6c[_0x52ea46(0x174)];if(!_0x2d7727[_0x52ea46(0x184)]('force')&&_0x2d64f8['hash']===_0x3c4ef6&&!_0x4f7591){_0x556780[_0x52ea46(0x167)]({'sqlCode':_0x4b4b6c[_0x52ea46(0x168)],'reason':_0x52ea46(0x15c)});continue;}if(_0x2d64f8[_0x52ea46(0x16a)]==null){_0x400faf[_0x52ea46(0x167)]({'sqlCode':_0x4b4b6c[_0x52ea46(0x168)],'error':_0x52ea46(0x161)});continue;}const _0x26e8c8=await readFile(_0x4b4b6c[_0x52ea46(0x16c)],_0x52ea46(0x159)),_0x26b14e=stripLocalSqlMetadata(_0x26e8c8,_0x4b4b6c[_0x52ea46(0x181)]),_0x53ea2c=_0x4b4b6c['sqlName']||_0x2d64f8[_0x52ea46(0x174)],_0x2722c0=await resolveTargetDbBinding(_0x2d7727[_0x52ea46(0x183)],_0x4b4b6c,_0x2d64f8),_0x59e4c1=await updateSqlQuery({'id':_0x2d64f8[_0x52ea46(0x15a)],'appCode':_0x2d7727[_0x52ea46(0x183)],'sqlCode':_0x4b4b6c[_0x52ea46(0x168)],'sqlName':_0x53ea2c,'dbId':_0x2722c0['dbId'],'version':_0x2d64f8[_0x52ea46(0x16a)],'sqlContent':_0x26b14e,'sqlConfig':_0x2d64f8[_0x52ea46(0x165)]??undefined}),_0x287d36=_0x59e4c1[_0x52ea46(0x157)]?await getDbName(_0x2d7727[_0x52ea46(0x183)],Number(_0x59e4c1[_0x52ea46(0x157)]))[_0x52ea46(0x160)](()=>_0x2722c0[_0x52ea46(0x158)]):_0x2722c0['dbName'];_0x1c98d9[_0x52ea46(0x162)][_0x4b4b6c[_0x52ea46(0x168)]]={...buildSqlLockEntry(_0x59e4c1,_0x26b14e,_0x3c4ef6,{'dbName':_0x287d36}),'path':_0x4b4b6c[_0x52ea46(0x17b)],'mode':_0x2d64f8['mode']},await archivePreviousSqlFileIfNeeded(_0x1e09bb,_0x2d64f8[_0x52ea46(0x17a)],_0x4b4b6c[_0x52ea46(0x17b)]),_0x4f6125['push']({'sqlCode':_0x4b4b6c[_0x52ea46(0x168)],'remoteId':_0x2d64f8[_0x52ea46(0x15a)]});}catch(_0xdf69a6){_0x400faf[_0x52ea46(0x167)]({'sqlCode':_0x4b4b6c[_0x52ea46(0x168)],'error':_0xdf69a6 instanceof Error?_0xdf69a6[_0x52ea46(0x182)]:String(_0xdf69a6)});}}_0x1c98d9['lastSync']=new Date()[_0x52ea46(0x14b)](),await writeSqlLockFile(_0x1e09bb[_0x52ea46(0x16b)],_0x59b20f);const _0x360fa7=_0x400faf['length']===0x0,_0x370131=await runAutomaticDeploymentSync(_0x2d7727,_0x52ea46(0x16f),_0x4f6125[_0x52ea46(0x171)](_0x321517=>_0x321517[_0x52ea46(0x168)]),_0x360fa7),_0x536375=_0x360fa7&&automaticDeploymentSyncSucceeded(_0x370131),_0x52cb97=_0x370131[_0x52ea46(0x154)]?',\x20deployment\x20sync\x20'+_0x370131[_0x52ea46(0x152)]:'';return{'ok':_0x536375,'data':{'pushed':_0x4f6125,'skipped':_0x556780,'failed':_0x400faf,'deploymentSync':_0x370131},'message':_0x52ea46(0x172)+_0x4f6125[_0x52ea46(0x169)]+_0x52ea46(0x178)+_0x556780[_0x52ea46(0x169)]+'\x20skipped,\x20'+_0x400faf[_0x52ea46(0x169)]+_0x52ea46(0x14c)+_0x52cb97};}};async function archivePreviousSqlFileIfNeeded(_0x4df483,_0xe4bacc,_0x418367){const _0x105c2c=a203_0x10b9c8;if(!_0xe4bacc||_0xe4bacc===_0x418367)return;const _0xbe76a3=join(_0x4df483[_0x105c2c(0x187)],_0xe4bacc);if(!await fileExists(_0xbe76a3))return;const _0x17a98c=await moveToTrash(_0x4df483['projectRoot'],_0x4df483[_0x105c2c(0x188)],_0xbe76a3);await cleanupEmptyDirectories(dirname(_0xbe76a3),_0x4df483[_0x105c2c(0x187)]),void _0x17a98c;}async function moveToTrash(_0x5b47e9,_0x217af3,_0x64a6ef){const _0x3ce3b4=a203_0x10b9c8,_0x9d6dcf=new Date()['toISOString']()[_0x3ce3b4(0x14e)](/[:.]/g,'-'),_0x3a1d56=relative(_0x5b47e9,_0x64a6ef),_0x154b59=join(_0x217af3,_0x9d6dcf,_0x3a1d56);return await mkdir(dirname(_0x154b59),{'recursive':!![]}),await rename(_0x64a6ef,_0x154b59),_0x154b59;}async function cleanupEmptyDirectories(_0x355b65,_0x1ffc9e){const _0x4ad28f=a203_0x10b9c8;let _0x162007=resolve(_0x355b65);const _0x218ee2=resolve(_0x1ffc9e);while(_0x162007[_0x4ad28f(0x177)](''+_0x218ee2+sep)||_0x162007===_0x218ee2){if(_0x162007===_0x218ee2)return;try{const _0x13cb6b=await readdir(_0x162007);if(_0x13cb6b[_0x4ad28f(0x169)]>0x0)return;await rmdir(_0x162007);}catch{return;}_0x162007=dirname(_0x162007);}}async function resolveTargetDbBinding(_0x3eab29,_0x52a262,_0x4a6365){const _0x3fa689=a203_0x10b9c8,_0x2a60c6=_0x52a262['dbDirectory'];if(!_0x2a60c6)return{'dbId':_0x4a6365[_0x3fa689(0x157)],'dbName':_0x4a6365[_0x3fa689(0x158)]};const _0x8c7268=buildDbDirectoryName(_0x4a6365[_0x3fa689(0x158)],_0x4a6365['dbId']);if(_0x2a60c6===_0x8c7268)return{'dbId':_0x4a6365[_0x3fa689(0x157)],'dbName':_0x4a6365[_0x3fa689(0x158)]};const _0x133969=parseExplicitDbDirectory(_0x2a60c6);if(_0x133969!=null)return{'dbId':_0x133969,'dbName':await getDbName(_0x3eab29,_0x133969)[_0x3fa689(0x160)](()=>undefined)};const _0x42fa4a=await listDatabases(_0x3eab29),_0x35a763=_0x42fa4a['filter'](_0x33cfec=>buildDbDirectoryName(_0x33cfec[_0x3fa689(0x158)],_0x33cfec[_0x3fa689(0x157)])===_0x2a60c6);if(_0x35a763['length']===0x1)return{'dbId':_0x35a763[0x0]['dbId'],'dbName':_0x35a763[0x0][_0x3fa689(0x158)]};if(_0x35a763[_0x3fa689(0x169)]===0x0)throw CliErrors[_0x3fa689(0x18d)](_0x3fa689(0x14a)+_0x2a60c6+'\x22\x20for\x20sqlCode\x20'+_0x52a262['sqlCode']+'.');const _0x5bd2fb=_0x35a763[_0x3fa689(0x171)](_0x46cfdd=>_0x46cfdd[_0x3fa689(0x158)]+'\x20('+_0x46cfdd[_0x3fa689(0x157)]+')')[_0x3fa689(0x15e)](',\x20');throw CliErrors[_0x3fa689(0x18d)](_0x3fa689(0x16d)+_0x2a60c6+_0x3fa689(0x163)+_0x52a262[_0x3fa689(0x168)]+':\x20'+_0x5bd2fb);}function a203_0x4e56(_0x422cc9,_0x48d923){_0x422cc9=_0x422cc9-0x149;const _0x20490=a203_0x2049();let _0x4e5665=_0x20490[_0x422cc9];return _0x4e5665;}function parseExplicitDbDirectory(_0xbedeb3){const _0x82ce47=a203_0x10b9c8,_0x37d0b7=/^db-(\d+)$/[_0x82ce47(0x164)](_0xbedeb3);if(!_0x37d0b7)return null;const _0x14d528=Number(_0x37d0b7[0x1]);return Number['isFinite'](_0x14d528)&&_0x14d528>0x0?_0x14d528:null;}
|
|
1
|
+
const a216_0x2ffbea=a216_0x2326;(function(_0x490177,_0x17f7b0){const _0x6720=a216_0x2326,_0x41db4c=_0x490177();while(!![]){try{const _0x496f02=parseInt(_0x6720(0x10b))/0x1+-parseInt(_0x6720(0xff))/0x2*(parseInt(_0x6720(0xe1))/0x3)+-parseInt(_0x6720(0xdb))/0x4*(-parseInt(_0x6720(0xd9))/0x5)+-parseInt(_0x6720(0x102))/0x6*(parseInt(_0x6720(0x114))/0x7)+parseInt(_0x6720(0xfe))/0x8+parseInt(_0x6720(0x100))/0x9*(parseInt(_0x6720(0xe0))/0xa)+parseInt(_0x6720(0xee))/0xb;if(_0x496f02===_0x17f7b0)break;else _0x41db4c['push'](_0x41db4c['shift']());}catch(_0x211b0a){_0x41db4c['push'](_0x41db4c['shift']());}}}(a216_0x419a,0x3e618));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a216_0x2326(_0x20513c,_0x4a0652){_0x20513c=_0x20513c-0xd7;const _0x419a89=a216_0x419a();let _0x2326af=_0x419a89[_0x20513c];return _0x2326af;}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';function a216_0x419a(){const _0x2fefa0=['Push\x20local\x20SQL\x20files\x20to\x20remote','map','dbName','join','\x20failed','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','7sLgsgX','isFinite','lockFilePath','Local\x20directory\x20\x22','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','\x22\x20for\x20sqlCode\x20','\x20pushed,\x20','\x20SQL\x20file(s)','sqlRootDir','toISOString','status','message','15geUWpF','hash','506452wqncbl','startsWith','exec','appCode',',\x20deployment\x20sync\x20','92750buKWVm','2517guwFtF','has','sqls','remoteId','utf8','get','dbId','sqlcode','replace','\x20skipped,\x20','unchanged','version','validation','3168693XRNuzX','write','mode','filter','/smartapi/custom/updateUserCustomSql','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','boolean','projectRoot','filePath','length','sqlConfig','sqlName','sql','str','No\x20database\x20matches\x20local\x20directory\x20\x22','catch','813904iKSaLH','854sWfXya','18vozjjT','dbDirectory','1114842RTGOgT','Would\x20push\x20','path','relativePath','POST','sqlRoot','sqlCode','bool','push','11382SxOvQY','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','force'];a216_0x419a=function(){return _0x2fefa0;};return a216_0x419a();}import{automaticDeploymentSyncSucceeded,buildAutomaticDeploymentSyncPreview,runAutomaticDeploymentSync}from'../../commands/deployment/auto-sync.js';async function getTargetSqlQueries(_0x14539a,_0x328813,_0x3dec19){const _0x2b3058=a216_0x2326,_0x16aaef=await scanLocalSqlQueries(_0x14539a),_0x1130f1=new Map();for(const _0x3396f7 of _0x16aaef){if(_0x3dec19&&_0x3396f7[_0x2b3058(0x108)]!==_0x3dec19)continue;const _0x5ddbb0=_0x1130f1[_0x2b3058(0xe6)](_0x3396f7[_0x2b3058(0x108)])??[];_0x5ddbb0[_0x2b3058(0x10a)](_0x3396f7),_0x1130f1['set'](_0x3396f7[_0x2b3058(0x108)],_0x5ddbb0);}if(_0x3dec19&&!_0x1130f1[_0x2b3058(0xe2)](_0x3dec19))throw CliErrors[_0x2b3058(0xed)]('Local\x20SQL\x20not\x20found:\x20'+_0x3dec19);const _0x5334ad=[];for(const [_0x4c0e46,_0x4ee96b]of _0x1130f1['entries']()){if(_0x4ee96b[_0x2b3058(0xf7)]===0x1){_0x5334ad[_0x2b3058(0x10a)](_0x4ee96b[0x0]);continue;}const _0x556c1b=_0x328813[_0x2b3058(0xe3)][_0x4c0e46],_0x4eb5c9=_0x556c1b?.[_0x2b3058(0x104)],_0xe03f=_0x4eb5c9?_0x4ee96b[_0x2b3058(0xf1)](_0x4e61ed=>_0x4e61ed[_0x2b3058(0x105)]!==_0x4eb5c9):_0x4ee96b;if(_0x556c1b&&_0xe03f[_0x2b3058(0xf7)]===0x1){_0x5334ad[_0x2b3058(0x10a)](_0xe03f[0x0]);continue;}throw CliErrors['validation'](_0x2b3058(0xf3)+_0x4c0e46+_0x2b3058(0x113));}return _0x5334ad;}export const sqlPush={'service':a216_0x2ffbea(0xfa),'command':a216_0x2ffbea(0x10a),'description':a216_0x2ffbea(0x10e),'risk':a216_0x2ffbea(0xef),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a216_0x2ffbea(0xf4),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x4fb42c){const _0x35a941=a216_0x2ffbea,_0x1873fb=loadSqlProjectConfig(_0x4fb42c[_0x35a941(0xde)]),_0x2d426c=await readSqlLockFile(_0x1873fb['lockFilePath']),{appLock:_0x2484cd}=ensureSqlLockScope(_0x2d426c??createEmptySqlLock(),_0x4fb42c['appCode'],_0x1873fb[_0x35a941(0x107)],_0x35a941(0x10a)),_0x225ede=await getTargetSqlQueries(_0x1873fb,_0x2484cd,_0x4fb42c[_0x35a941(0xfb)](_0x35a941(0xe8))||undefined),_0x533de4=[];for(const _0x1c81a2 of _0x225ede){const _0x315d99=await computeSqlFileHash(_0x1c81a2[_0x35a941(0xf6)]),_0x6145ec=_0x2484cd['sqls'][_0x1c81a2[_0x35a941(0x108)]],_0x104646=!!_0x6145ec&&(_0x6145ec[_0x35a941(0x104)]!==_0x1c81a2['relativePath']||!!_0x1c81a2[_0x35a941(0xf9)]&&_0x6145ec['sqlName']!==_0x1c81a2[_0x35a941(0xf9)]);if(!_0x4fb42c[_0x35a941(0x109)](_0x35a941(0x10d))&&_0x6145ec&&_0x6145ec[_0x35a941(0xda)]===_0x315d99&&!_0x104646)continue;_0x533de4[_0x35a941(0x10a)](_0x1c81a2['sqlCode']);}return{'method':_0x35a941(0x106),'url':_0x35a941(0xf2),'deploymentSync':buildAutomaticDeploymentSyncPreview(_0x35a941(0xfa),_0x533de4),'body':{'sqlCodes':_0x533de4,'appCode':_0x4fb42c['appCode']},'description':_0x35a941(0x103)+_0x533de4[_0x35a941(0xf7)]+_0x35a941(0x11b)};},async 'execute'(_0xfd896c){const _0x328a8c=a216_0x2ffbea,_0x199065=loadSqlProjectConfig(_0xfd896c[_0x328a8c(0xde)]),_0x1fd5e1=await readSqlLockFile(_0x199065[_0x328a8c(0x116)]),{lockData:_0x9cca70,appLock:_0x193ce5}=ensureSqlLockScope(_0x1fd5e1??createEmptySqlLock(),_0xfd896c[_0x328a8c(0xde)],_0x199065[_0x328a8c(0x107)],_0x328a8c(0x10a)),_0x59cd29=await getTargetSqlQueries(_0x199065,_0x193ce5,_0xfd896c[_0x328a8c(0xfb)](_0x328a8c(0xe8))||undefined);if(_0x59cd29[_0x328a8c(0xf7)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x530699=[],_0x5e3a3c=[],_0x233cd3=[];for(const _0xdc77ee of _0x59cd29){const _0x1f85be=_0x193ce5[_0x328a8c(0xe3)][_0xdc77ee['sqlCode']];if(!_0x1f85be){_0x233cd3['push']({'sqlCode':_0xdc77ee[_0x328a8c(0x108)],'error':_0x328a8c(0x10c)});continue;}try{const _0x5578bc=await computeSqlFileHash(_0xdc77ee[_0x328a8c(0xf6)]),_0x417e8a=_0x1f85be[_0x328a8c(0x104)]!==_0xdc77ee[_0x328a8c(0x105)]||!!_0xdc77ee[_0x328a8c(0xf9)]&&_0x1f85be['sqlName']!==_0xdc77ee[_0x328a8c(0xf9)];if(!_0xfd896c[_0x328a8c(0x109)]('force')&&_0x1f85be[_0x328a8c(0xda)]===_0x5578bc&&!_0x417e8a){_0x5e3a3c[_0x328a8c(0x10a)]({'sqlCode':_0xdc77ee[_0x328a8c(0x108)],'reason':_0x328a8c(0xeb)});continue;}if(_0x1f85be[_0x328a8c(0xec)]==null){_0x233cd3[_0x328a8c(0x10a)]({'sqlCode':_0xdc77ee[_0x328a8c(0x108)],'error':_0x328a8c(0x118)});continue;}const _0x1edcca=await readFile(_0xdc77ee['filePath'],_0x328a8c(0xe5)),_0x3e6553=stripLocalSqlMetadata(_0x1edcca,_0xdc77ee[_0x328a8c(0xf0)]),_0x297e8a=_0xdc77ee[_0x328a8c(0xf9)]||_0x1f85be[_0x328a8c(0xf9)],_0x489e14=await resolveTargetDbBinding(_0xfd896c[_0x328a8c(0xde)],_0xdc77ee,_0x1f85be),_0x202486=await updateSqlQuery({'id':_0x1f85be['remoteId'],'appCode':_0xfd896c['appCode'],'sqlCode':_0xdc77ee[_0x328a8c(0x108)],'sqlName':_0x297e8a,'dbId':_0x489e14[_0x328a8c(0xe7)],'version':_0x1f85be[_0x328a8c(0xec)],'sqlContent':_0x3e6553,'sqlConfig':_0x1f85be[_0x328a8c(0xf8)]??undefined}),_0x13e40b=_0x202486['dbId']?await getDbName(_0xfd896c['appCode'],Number(_0x202486[_0x328a8c(0xe7)]))['catch'](()=>_0x489e14[_0x328a8c(0x110)]):_0x489e14['dbName'];_0x193ce5[_0x328a8c(0xe3)][_0xdc77ee['sqlCode']]={...buildSqlLockEntry(_0x202486,_0x3e6553,_0x5578bc,{'dbName':_0x13e40b}),'path':_0xdc77ee[_0x328a8c(0x105)],'mode':_0x1f85be[_0x328a8c(0xf0)]},await archivePreviousSqlFileIfNeeded(_0x199065,_0x1f85be[_0x328a8c(0x104)],_0xdc77ee[_0x328a8c(0x105)]),_0x530699[_0x328a8c(0x10a)]({'sqlCode':_0xdc77ee[_0x328a8c(0x108)],'remoteId':_0x1f85be[_0x328a8c(0xe4)]});}catch(_0x285337){_0x233cd3['push']({'sqlCode':_0xdc77ee['sqlCode'],'error':_0x285337 instanceof Error?_0x285337[_0x328a8c(0xd8)]:String(_0x285337)});}}_0x193ce5['lastSync']=new Date()[_0x328a8c(0x11d)](),await writeSqlLockFile(_0x199065[_0x328a8c(0x116)],_0x9cca70);const _0x53e844=_0x233cd3[_0x328a8c(0xf7)]===0x0,_0x37832d=await runAutomaticDeploymentSync(_0xfd896c,_0x328a8c(0xfa),_0x530699[_0x328a8c(0x10f)](_0x1bf213=>_0x1bf213[_0x328a8c(0x108)]),_0x53e844),_0x65c5a0=_0x53e844&&automaticDeploymentSyncSucceeded(_0x37832d),_0x11e508=_0x328a8c(0xdf)+_0x37832d[_0x328a8c(0xd7)];return{'ok':_0x65c5a0,'data':{'pushed':_0x530699,'skipped':_0x5e3a3c,'failed':_0x233cd3,'deploymentSync':_0x37832d},'message':'Push\x20complete:\x20'+_0x530699[_0x328a8c(0xf7)]+_0x328a8c(0x11a)+_0x5e3a3c[_0x328a8c(0xf7)]+_0x328a8c(0xea)+_0x233cd3[_0x328a8c(0xf7)]+_0x328a8c(0x112)+_0x11e508};}};async function archivePreviousSqlFileIfNeeded(_0x119a71,_0x568cee,_0x40b084){const _0x405eb8=a216_0x2ffbea;if(!_0x568cee||_0x568cee===_0x40b084)return;const _0x277bda=join(_0x119a71[_0x405eb8(0x11c)],_0x568cee);if(!await fileExists(_0x277bda))return;const _0x47536e=await moveToTrash(_0x119a71[_0x405eb8(0xf5)],_0x119a71['trashDir'],_0x277bda);await cleanupEmptyDirectories(dirname(_0x277bda),_0x119a71[_0x405eb8(0x11c)]),void _0x47536e;}async function moveToTrash(_0x2fb11a,_0x274eec,_0x57c852){const _0x374658=a216_0x2ffbea,_0x177d71=new Date()[_0x374658(0x11d)]()[_0x374658(0xe9)](/[:.]/g,'-'),_0x4f41ea=relative(_0x2fb11a,_0x57c852),_0x3522a3=join(_0x274eec,_0x177d71,_0x4f41ea);return await mkdir(dirname(_0x3522a3),{'recursive':!![]}),await rename(_0x57c852,_0x3522a3),_0x3522a3;}async function cleanupEmptyDirectories(_0x2e6e0a,_0x434f31){const _0x300260=a216_0x2ffbea;let _0x4ec0ec=resolve(_0x2e6e0a);const _0x3d3b63=resolve(_0x434f31);while(_0x4ec0ec[_0x300260(0xdc)](''+_0x3d3b63+sep)||_0x4ec0ec===_0x3d3b63){if(_0x4ec0ec===_0x3d3b63)return;try{const _0x43ba76=await readdir(_0x4ec0ec);if(_0x43ba76['length']>0x0)return;await rmdir(_0x4ec0ec);}catch{return;}_0x4ec0ec=dirname(_0x4ec0ec);}}async function resolveTargetDbBinding(_0xacf96c,_0x241fa9,_0x24b6fd){const _0x362984=a216_0x2ffbea,_0x5e5248=_0x241fa9[_0x362984(0x101)];if(!_0x5e5248)return{'dbId':_0x24b6fd['dbId'],'dbName':_0x24b6fd[_0x362984(0x110)]};const _0x46dffb=buildDbDirectoryName(_0x24b6fd[_0x362984(0x110)],_0x24b6fd[_0x362984(0xe7)]);if(_0x5e5248===_0x46dffb)return{'dbId':_0x24b6fd[_0x362984(0xe7)],'dbName':_0x24b6fd[_0x362984(0x110)]};const _0x38a716=parseExplicitDbDirectory(_0x5e5248);if(_0x38a716!=null)return{'dbId':_0x38a716,'dbName':await getDbName(_0xacf96c,_0x38a716)[_0x362984(0xfd)](()=>undefined)};const _0x15f4c1=await listDatabases(_0xacf96c),_0x3f0bb0=_0x15f4c1[_0x362984(0xf1)](_0x12b555=>buildDbDirectoryName(_0x12b555[_0x362984(0x110)],_0x12b555[_0x362984(0xe7)])===_0x5e5248);if(_0x3f0bb0[_0x362984(0xf7)]===0x1)return{'dbId':_0x3f0bb0[0x0][_0x362984(0xe7)],'dbName':_0x3f0bb0[0x0]['dbName']};if(_0x3f0bb0['length']===0x0)throw CliErrors[_0x362984(0xed)](_0x362984(0xfc)+_0x5e5248+_0x362984(0x119)+_0x241fa9[_0x362984(0x108)]+'.');const _0x1db9c6=_0x3f0bb0[_0x362984(0x10f)](_0x5f5123=>_0x5f5123['dbName']+'\x20('+_0x5f5123[_0x362984(0xe7)]+')')[_0x362984(0x111)](',\x20');throw CliErrors[_0x362984(0xed)](_0x362984(0x117)+_0x5e5248+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x241fa9[_0x362984(0x108)]+':\x20'+_0x1db9c6);}function parseExplicitDbDirectory(_0x15044f){const _0x5e7cc2=a216_0x2ffbea,_0x80d19e=/^db-(\d+)$/[_0x5e7cc2(0xdd)](_0x15044f);if(!_0x80d19e)return null;const _0x2a5f1c=Number(_0x80d19e[0x1]);return Number[_0x5e7cc2(0x115)](_0x2a5f1c)&&_0x2a5f1c>0x0?_0x2a5f1c:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0xc37bc6,_0x25b1c4){const _0x508c9a=a217_0x4d04,_0x38ce4d=_0xc37bc6();while(!![]){try{const _0x46d29d=parseInt(_0x508c9a(0x190))/0x1*(parseInt(_0x508c9a(0x177))/0x2)+-parseInt(_0x508c9a(0x19c))/0x3*(parseInt(_0x508c9a(0x173))/0x4)+parseInt(_0x508c9a(0x18e))/0x5+parseInt(_0x508c9a(0x17e))/0x6*(parseInt(_0x508c9a(0x172))/0x7)+-parseInt(_0x508c9a(0x16c))/0x8+parseInt(_0x508c9a(0x16f))/0x9+-parseInt(_0x508c9a(0x174))/0xa;if(_0x46d29d===_0x25b1c4)break;else _0x38ce4d['push'](_0x38ce4d['shift']());}catch(_0x25c323){_0x38ce4d['push'](_0x38ce4d['shift']());}}}(a217_0x3d59,0x9c9a7));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';function a217_0x3d59(){const _0x2cee49=['lastSync','<!--\x20@lovrabet.','6hKySqU','endsWith','replace','syncedAt','sqlCode','stdin','sqlContent','push','--\x20@lovrabet.','dbId','join','test','trimStart','\x20-->','sqlConfig','question','3492335dzZVxo','\x20[y/N]\x20','1GadNbY','version','toLowerCase','includes','mybatisXml','apps','close','dbName','yes','split','description','entries','132bfeXSg','3631784kGakMX','trim','map','3243240zZyVlr','filter','mode','7646513WhBoXl','83844dWfynU','8918940viwfkI','length','stderr','1516824gmPCsF','sqlRoot','sqlName','fromEntries','path'];a217_0x3d59=function(){return _0x2cee49;};return a217_0x3d59();}export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x3ee506,_0x2a6dea,_0x37c76f,_0x4916b2){const _0x51f1b7=a217_0x4d04,_0x4dd54f=detectSqlMode(_0x2a6dea);return{'path':buildSqlRelativePath(_0x3ee506['sqlCode'],_0x3ee506[_0x51f1b7(0x179)],_0x4916b2?.[_0x51f1b7(0x197)],_0x4dd54f,_0x3ee506[_0x51f1b7(0x187)]),'hash':_0x37c76f,'remoteId':_0x3ee506['id'],'version':_0x3ee506[_0x51f1b7(0x191)],'dbId':Number(_0x3ee506[_0x51f1b7(0x187)]),'dbName':_0x4916b2?.[_0x51f1b7(0x197)],'sqlName':_0x3ee506[_0x51f1b7(0x179)],'sqlConfig':_0x3ee506[_0x51f1b7(0x18c)]??undefined,'mode':_0x4dd54f};}export function cloneSqlLockData(_0x595b7e){const _0x524a05=a217_0x4d04;return{'apps':Object[_0x524a05(0x17a)](Object[_0x524a05(0x19b)](_0x595b7e[_0x524a05(0x195)])[_0x524a05(0x16e)](([_0x2ca608,_0x3e0e0e])=>[_0x2ca608,{'sqlRoot':_0x3e0e0e[_0x524a05(0x178)],'lastSync':_0x3e0e0e[_0x524a05(0x17c)],'sqls':{..._0x3e0e0e['sqls']}}]))};}export function ensureRemoteSqlContent(_0x45402){const _0x223bc7=a217_0x4d04;return _0x45402[_0x223bc7(0x184)]??'';}export function buildLocalSqlFileContent(_0x2d4e1f,_0x3dffcb,_0x133da8){const _0xa16ac6=a217_0x4d04,_0xc45e18=_0x133da8?.[_0xa16ac6(0x171)]??detectSqlMode(_0x3dffcb),_0x5a2c5e=stripLocalSqlMetadata(_0x3dffcb,_0xc45e18)[_0xa16ac6(0x16d)](),_0x223a79=[...buildMetadataHeaderLines({'sqlCode':_0x2d4e1f[_0xa16ac6(0x182)],'sqlName':_0x2d4e1f['sqlName'],'dbId':_0x2d4e1f[_0xa16ac6(0x187)],'dbName':_0x133da8?.[_0xa16ac6(0x197)],'mode':_0xc45e18,'syncedAt':_0x133da8?.[_0xa16ac6(0x181)],'description':_0x133da8?.[_0xa16ac6(0x19a)]},_0xc45e18),'',_0x5a2c5e],_0x1e9eb8=_0x223a79[_0xa16ac6(0x188)]('\x0a');return _0x1e9eb8[_0xa16ac6(0x17f)]('\x0a')?_0x1e9eb8:_0x1e9eb8+'\x0a';}export function stripLocalSqlMetadata(_0x4b371a,_0x206191){const _0x118cfb=a217_0x4d04,_0x9a3e8d=_0x4b371a[_0x118cfb(0x180)](/\r\n/g,'\x0a')[_0x118cfb(0x199)]('\x0a'),_0x164170=[];let _0x33f3ee=0x0;if(_0x206191===_0x118cfb(0x194))while(_0x33f3ee<_0x9a3e8d[_0x118cfb(0x175)]){const _0x3383dd=_0x9a3e8d[_0x33f3ee]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x3383dd)){_0x33f3ee++;continue;}if(_0x3383dd[_0x118cfb(0x16d)]()===''&&_0x33f3ee>0x0){_0x33f3ee++;continue;}break;}else while(_0x33f3ee<_0x9a3e8d[_0x118cfb(0x175)]){const _0x17b8ba=_0x9a3e8d[_0x33f3ee]??'';if(/^\s*--\s*@lovrabet\./[_0x118cfb(0x189)](_0x17b8ba)){_0x33f3ee++;continue;}if(_0x17b8ba[_0x118cfb(0x16d)]()===''&&_0x33f3ee>0x0){_0x33f3ee++;continue;}break;}for(;_0x33f3ee<_0x9a3e8d[_0x118cfb(0x175)];_0x33f3ee++){_0x164170[_0x118cfb(0x185)](_0x9a3e8d[_0x33f3ee]);}return _0x164170[_0x118cfb(0x188)]('\x0a')[_0x118cfb(0x18a)]();}export function resolveSqlMode(_0x216922,_0x32aa51){const _0x19552c=a217_0x4d04;if(_0x32aa51?.[_0x19552c(0x171)])return _0x32aa51[_0x19552c(0x171)];return detectSqlMode(_0x216922);}export function resolveSqlFileName(_0x30f256,_0x5b29d9,_0x3d1513){const _0x2b5cdc=a217_0x4d04;if(_0x3d1513?.['path'])return _0x3d1513[_0x2b5cdc(0x17b)];if(_0x3d1513?.[_0x2b5cdc(0x179)]||_0x3d1513?.['dbName'])return buildSqlRelativePath(_0x30f256,_0x3d1513?.[_0x2b5cdc(0x179)],_0x3d1513?.[_0x2b5cdc(0x197)],resolveSqlMode(_0x5b29d9,_0x3d1513),_0x3d1513?.[_0x2b5cdc(0x187)]);return buildDefaultSqlFileName(_0x30f256,resolveSqlMode(_0x5b29d9,_0x3d1513));}export function resolveSqlLocalDir(_0x41b5f7,_0xcf0dbf){return join(_0x41b5f7,SQL_LOCAL_REL_DIR,_0xcf0dbf);}export async function confirmForceOverwrite(_0x4c8678){const _0x3ba72b=a217_0x4d04,_0xb92e11=createInterface({'input':process[_0x3ba72b(0x183)],'output':process[_0x3ba72b(0x176)]}),_0x4e80de=await new Promise(_0x47e32e=>{const _0x169636=_0x3ba72b;_0xb92e11[_0x169636(0x18d)](_0x4c8678+_0x169636(0x18f),_0x47e32e);});return _0xb92e11[_0x3ba72b(0x196)](),['y',_0x3ba72b(0x198)][_0x3ba72b(0x193)](_0x4e80de['trim']()[_0x3ba72b(0x192)]());}function a217_0x4d04(_0x1a4580,_0x486c18){_0x1a4580=_0x1a4580-0x16c;const _0x3d59b6=a217_0x3d59();let _0x4d04de=_0x3d59b6[_0x1a4580];return _0x4d04de;}export function findSqlLockScope(_0x2ab754,_0x1125ed){return _0x2ab754['apps'][_0x1125ed];}function buildMetadataHeaderLines(_0x59f0d5,_0x3498f5){const _0x8b5121=a217_0x4d04,_0x19c90b=[[_0x8b5121(0x182),_0x59f0d5[_0x8b5121(0x182)]],[_0x8b5121(0x179),_0x59f0d5[_0x8b5121(0x179)]],[_0x8b5121(0x187),_0x59f0d5['dbId']],['dbName',_0x59f0d5['dbName']],[_0x8b5121(0x171),_0x59f0d5[_0x8b5121(0x171)]],[_0x8b5121(0x181),_0x59f0d5[_0x8b5121(0x181)]],[_0x8b5121(0x19a),_0x59f0d5[_0x8b5121(0x19a)]]];if(_0x3498f5==='mybatisXml')return _0x19c90b[_0x8b5121(0x170)](([,_0x324d50])=>_0x324d50!==undefined&&_0x324d50!==null&&String(_0x324d50)[_0x8b5121(0x16d)]()!=='')[_0x8b5121(0x16e)](([_0x3842ba,_0x3238d2])=>_0x8b5121(0x17d)+_0x3842ba+':\x20'+String(_0x3238d2)+_0x8b5121(0x18b));return _0x19c90b['filter'](([,_0x5e65a6])=>_0x5e65a6!==undefined&&_0x5e65a6!==null&&String(_0x5e65a6)[_0x8b5121(0x16d)]()!=='')[_0x8b5121(0x16e)](([_0x3b6237,_0x22091b])=>_0x8b5121(0x186)+_0x3b6237+':\x20'+String(_0x22091b));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a218_0x296826=a218_0x18f0;function a218_0x5ad0(){const _0x150e79=['3ixsRpu','totalCount','status','\x20unchanged','boolean','read','tableData','233525UlXeAE','has','5576536VsVfPX','paging','appCode','path','push','1511550FjKsqn','sqls','sqlName','10308ZIqrvn','hash','length','910gPUIuz','lockFilePath','lockKey','812392dNmpAU','sql','\x20added,\x20','map','10230390rMcTnb','\x20missing,\x20','517606aSKSvr','All\x20SQL\x20queries\x20are\x20in\x20sync.','\x20remote-only','bool','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file'];a218_0x5ad0=function(){return _0x150e79;};return a218_0x5ad0();}function a218_0x18f0(_0x50a12d,_0x397ea9){_0x50a12d=_0x50a12d-0x1cd;const _0x5ad062=a218_0x5ad0();let _0x18f08f=_0x5ad062[_0x50a12d];return _0x18f08f;}(function(_0x4c476e,_0x25b551){const _0x1a04e8=a218_0x18f0,_0x373473=_0x4c476e();while(!![]){try{const _0x3d94ae=parseInt(_0x1a04e8(0x1de))/0x1*(parseInt(_0x1a04e8(0x1d9))/0x2)+parseInt(_0x1a04e8(0x1ec))/0x3+-parseInt(_0x1a04e8(0x1d3))/0x4+parseInt(_0x1a04e8(0x1e5))/0x5+parseInt(_0x1a04e8(0x1cd))/0x6*(-parseInt(_0x1a04e8(0x1d0))/0x7)+parseInt(_0x1a04e8(0x1e7))/0x8+-parseInt(_0x1a04e8(0x1d7))/0x9;if(_0x3d94ae===_0x25b551)break;else _0x373473['push'](_0x373473['shift']());}catch(_0x3bd9ac){_0x373473['push'](_0x373473['shift']());}}}(a218_0x5ad0,0x70853));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x2f45d0){const _0x17654e=a218_0x18f0,_0x21ecff=[];let _0x3cef67=0x1;while(!![]){const _0xb93f36=await listSqlQueries(_0x2f45d0,{'currentPage':_0x3cef67,'pageSize':PAGE_SIZE}),_0x5dd665=_0xb93f36[_0x17654e(0x1e4)]??[];_0x21ecff[_0x17654e(0x1eb)](..._0x5dd665[_0x17654e(0x1d6)](_0x3d5595=>_0x3d5595['sqlCode']));if(_0x5dd665['length']===0x0)break;const _0x4bccd7=_0xb93f36[_0x17654e(0x1e8)]?.[_0x17654e(0x1df)];if(_0x4bccd7!=null?_0x21ecff[_0x17654e(0x1cf)]>=_0x4bccd7:_0x5dd665[_0x17654e(0x1cf)]<PAGE_SIZE)break;_0x3cef67++;}return _0x21ecff;}export const sqlStatus={'service':a218_0x296826(0x1d4),'command':a218_0x296826(0x1e0),'description':a218_0x296826(0x1dd),'risk':a218_0x296826(0x1e3),'flags':[{'name':'remote','type':a218_0x296826(0x1e2),'description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0x48559c){const _0x1a4e9c=a218_0x296826,_0x49bc8e=loadSqlProjectConfig(_0x48559c[_0x1a4e9c(0x1e9)]),_0x471827=await readSqlLockFile(_0x49bc8e[_0x1a4e9c(0x1d1)]),{appLock:_0x11ed0f}=ensureSqlLockScope(_0x471827??createEmptySqlLock(),_0x49bc8e[_0x1a4e9c(0x1e9)],_0x49bc8e['sqlRoot'],_0x1a4e9c(0x1e0)),_0x33bbae=await scanLocalSqlQueries(_0x49bc8e),_0x51d42b=[],_0x4bd402=[],_0x4377ba=[],_0x454fc5=[],_0x618f5c=new Set(_0x33bbae[_0x1a4e9c(0x1d6)](_0x1b8a18=>_0x1b8a18[_0x1a4e9c(0x1d2)]));for(const _0x3a011f of _0x33bbae){const _0x53da18=await computeSqlFileHash(_0x3a011f['filePath']),_0x224532=_0x11ed0f[_0x1a4e9c(0x1ed)][_0x3a011f['lockKey']],_0x6a49fb=!!_0x224532&&_0x224532[_0x1a4e9c(0x1ea)]!==_0x3a011f['relativePath'],_0x37bc85=!!_0x224532&&!!_0x3a011f['sqlName']&&_0x224532[_0x1a4e9c(0x1ee)]!==_0x3a011f[_0x1a4e9c(0x1ee)];if(!_0x224532)_0x51d42b[_0x1a4e9c(0x1eb)](_0x3a011f[_0x1a4e9c(0x1d2)]);else _0x224532[_0x1a4e9c(0x1ce)]!==_0x53da18||_0x6a49fb||_0x37bc85?_0x4bd402[_0x1a4e9c(0x1eb)](_0x3a011f[_0x1a4e9c(0x1d2)]):_0x4377ba[_0x1a4e9c(0x1eb)](_0x3a011f[_0x1a4e9c(0x1d2)]);}for(const _0x3d04a0 of Object['keys'](_0x11ed0f['sqls'])){!_0x618f5c[_0x1a4e9c(0x1e6)](_0x3d04a0)&&_0x454fc5[_0x1a4e9c(0x1eb)](_0x3d04a0);}const _0x456bde=[];if(_0x48559c[_0x1a4e9c(0x1dc)]('remote')){const _0x3cef46=await fetchAllSqlCodes(_0x48559c[_0x1a4e9c(0x1e9)]);for(const _0x14e735 of _0x3cef46){!_0x618f5c[_0x1a4e9c(0x1e6)](_0x14e735)&&!_0x11ed0f[_0x1a4e9c(0x1ed)][_0x14e735]&&_0x456bde[_0x1a4e9c(0x1eb)](_0x14e735);}}const _0x27e1db=_0x51d42b[_0x1a4e9c(0x1cf)]===0x0&&_0x4bd402[_0x1a4e9c(0x1cf)]===0x0&&_0x454fc5[_0x1a4e9c(0x1cf)]===0x0&&_0x456bde[_0x1a4e9c(0x1cf)]===0x0;return{'ok':!![],'data':{'added':_0x51d42b,'modified':_0x4bd402,'missing':_0x454fc5,'unchanged':_0x4377ba,'remoteOnly':_0x456bde},'message':_0x27e1db?_0x1a4e9c(0x1da):_0x51d42b[_0x1a4e9c(0x1cf)]+_0x1a4e9c(0x1d5)+_0x4bd402[_0x1a4e9c(0x1cf)]+'\x20modified,\x20'+_0x454fc5[_0x1a4e9c(0x1cf)]+_0x1a4e9c(0x1d8)+_0x4377ba[_0x1a4e9c(0x1cf)]+_0x1a4e9c(0x1e1)+(_0x456bde[_0x1a4e9c(0x1cf)]>0x0?',\x20'+_0x456bde['length']+_0x1a4e9c(0x1db):'')};}};
|