@lovrabet/rabetbase-cli 2.3.16-beta.2 → 2.3.16-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/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/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/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/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/notification/config-list.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/react/create.js +1 -0
- package/lib/commands/page/react/detail.js +1 -0
- package/lib/commands/page/react/list.js +1 -0
- package/lib/commands/page/react/publish.js +1 -0
- package/lib/commands/page/react/shared.js +1 -0
- package/lib/commands/page/react/syntax.js +1 -0
- package/lib/commands/page/react/template.js +1 -0
- package/lib/commands/page/react/update.js +1 -0
- 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/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/create.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/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/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -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/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/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/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/templates/projects/sub-app-react-demo/CHANGELOG.md +1 -1
- package/templates/projects/sub-app-react-demo/README.md +1 -1
- package/templates/projects/sub-app-react-demo/docs/quick-start.md +1 -1
- package/templates/projects/sub-app-react-demo/src/pages/index.tsx +1 -1
- package/lib/commands/project/init.js +0 -1
- package/lib/commands/sql/save.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a169_0xbbf31b=a169_0x344b;(function(_0x424c6c,_0x23e708){const _0xf61bff=a169_0x344b,_0x251d70=_0x424c6c();while(!![]){try{const _0x355717=-parseInt(_0xf61bff(0x21b))/0x1*(parseInt(_0xf61bff(0x1e8))/0x2)+parseInt(_0xf61bff(0x1d0))/0x3*(-parseInt(_0xf61bff(0x1d4))/0x4)+-parseInt(_0xf61bff(0x1e4))/0x5*(-parseInt(_0xf61bff(0x1cd))/0x6)+-parseInt(_0xf61bff(0x1f7))/0x7*(parseInt(_0xf61bff(0x216))/0x8)+-parseInt(_0xf61bff(0x1f5))/0x9*(-parseInt(_0xf61bff(0x1fc))/0xa)+-parseInt(_0xf61bff(0x204))/0xb*(parseInt(_0xf61bff(0x206))/0xc)+-parseInt(_0xf61bff(0x1f8))/0xd*(-parseInt(_0xf61bff(0x1e6))/0xe);if(_0x355717===_0x23e708)break;else _0x251d70['push'](_0x251d70['shift']());}catch(_0x4ffecb){_0x251d70['push'](_0x251d70['shift']());}}}(a169_0x429e,0x28962));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a169_0xbbf31b(0x202),'required':!![],'description':a169_0xbbf31b(0x1d5)};export const ROLE_REF_FLAG={'name':a169_0xbbf31b(0x1ef),'type':a169_0xbbf31b(0x1f6),'required':!![],'description':a169_0xbbf31b(0x20c)};export const USER_REF_FLAG={'name':a169_0xbbf31b(0x1eb),'type':a169_0xbbf31b(0x1f6),'required':!![],'description':a169_0xbbf31b(0x1ee)};export const NAME_FLAG={'name':'name','type':a169_0xbbf31b(0x1f6),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':a169_0xbbf31b(0x1f3),'type':a169_0xbbf31b(0x1f6),'required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':'remark','type':a169_0xbbf31b(0x1f6),'required':![],'description':a169_0xbbf31b(0x207)};function a169_0x344b(_0x5957ed,_0x514316){_0x5957ed=_0x5957ed-0x1cd;const _0x429e03=a169_0x429e();let _0x344b0d=_0x429e03[_0x5957ed];return _0x344b0d;}export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a169_0xbbf31b(0x202),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=['ADMIN',a169_0xbbf31b(0x1fe),a169_0xbbf31b(0x217)];export function isBuiltinRole(_0x4c5c0e){const _0x22af3c=a169_0xbbf31b;return BUILTIN_ROLE_TYPES[_0x22af3c(0x20b)](_0x4c5c0e);}export function assertCustomRole(_0xaa7b04,_0x31f85b){const _0x2ea863=a169_0xbbf31b;if(_0xaa7b04[_0x2ea863(0x219)]!==_0x2ea863(0x21a))throw CliErrors[_0x2ea863(0x1f2)]('Cannot\x20'+_0x31f85b+_0x2ea863(0x1dd)+_0xaa7b04[_0x2ea863(0x1d7)]+'\x20('+_0xaa7b04[_0x2ea863(0x219)]+').',_0x2ea863(0x20a));}export function assertPermConfigurable(_0x3e0df6){const _0x4784fe=a169_0xbbf31b;if(_0x3e0df6['roleType']===_0x4784fe(0x1fe)||_0x3e0df6['roleType']==='ADMIN')throw CliErrors[_0x4784fe(0x1f2)](_0x4784fe(0x208)+_0x3e0df6[_0x4784fe(0x1d7)]+'\x20('+_0x3e0df6[_0x4784fe(0x219)]+').',_0x4784fe(0x1f4));}export function projectRole(_0x214200){const _0x2adf15=a169_0xbbf31b;return{'id':_0x214200['id'],'roleName':_0x214200[_0x2adf15(0x1d7)],'roleType':_0x214200[_0x2adf15(0x219)],'remark':_0x214200['remark'],'userCount':_0x214200[_0x2adf15(0x1d9)],'permitCount':_0x214200[_0x2adf15(0x1e3)],'builtin':isBuiltinRole(_0x214200[_0x2adf15(0x219)])};}export async function resolveRoleRef(_0x346ac6,_0x4071ef){const _0x6f2534=a169_0xbbf31b,_0x1a0c8a=_0x4071ef[_0x6f2534(0x211)]();if(!_0x1a0c8a)throw CliErrors['validation'](_0x6f2534(0x1de),_0x6f2534(0x1d8));if(/^\d+$/[_0x6f2534(0x1e0)](_0x1a0c8a))return getRoleById(_0x346ac6,Number(_0x1a0c8a));const _0x3f4feb=await listAllAppRoles(_0x346ac6),_0x11a3ab=_0x3f4feb[_0x6f2534(0x1db)](_0x4a7b99=>_0x4a7b99[_0x6f2534(0x1d7)]===_0x1a0c8a);if(_0x11a3ab[_0x6f2534(0x1ff)]===0x0)throw CliErrors[_0x6f2534(0x1f2)]('Role\x20name\x20\x22'+_0x1a0c8a+_0x6f2534(0x1cf)+_0x346ac6+'.',_0x6f2534(0x200));if(_0x11a3ab[_0x6f2534(0x1ff)]>0x1){const _0x48b43a=_0x11a3ab[_0x6f2534(0x1e7)](_0x55a154=>_0x55a154['id'])[_0x6f2534(0x1f0)](',\x20');throw CliErrors[_0x6f2534(0x1f2)]('Role\x20name\x20\x22'+_0x1a0c8a+_0x6f2534(0x1dc)+_0x48b43a+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x11a3ab[0x0];}export async function getRoleById(_0x9349fe,_0xbc89ff){const _0x425e1f=a169_0xbbf31b,_0x3d4df7=await getAppRole(_0xbc89ff);if(!_0x3d4df7)throw CliErrors[_0x425e1f(0x1f2)](_0x425e1f(0x1f9)+_0xbc89ff+'\x20not\x20found\x20in\x20app\x20'+_0x9349fe+'.',_0x425e1f(0x20e));return _0x3d4df7;}async function listAllAppRoles(_0x471364){const _0x308bde=a169_0xbbf31b,_0x56882a=0x64,_0x2f386=[];for(let _0x4483e4=0x1;;_0x4483e4+=0x1){const {items:_0x3ffcba,paging:_0x552af8}=await listAppRoles(_0x471364,{'currentPage':_0x4483e4,'pageSize':_0x56882a});_0x2f386[_0x308bde(0x1d6)](..._0x3ffcba);if(_0x3ffcba[_0x308bde(0x1ff)]<_0x56882a||_0x552af8&&_0x2f386[_0x308bde(0x1ff)]>=_0x552af8[_0x308bde(0x203)])return _0x2f386;}}export async function resolveTenantCode(){const _0x330d4f=a169_0xbbf31b,_0x18865e=await getSessionUserInfo(),_0x403e2e=_0x18865e?.['user']?.['tenant']?.[_0x330d4f(0x1d2)];if(!_0x403e2e)throw CliErrors[_0x330d4f(0x1e1)](_0x330d4f(0x1f1));return _0x403e2e;}function matchMember(_0xfd0193,_0x1b0400){const _0x3c5fff=a169_0xbbf31b,_0x2369bc=_0x1b0400[_0x3c5fff(0x211)]()[_0x3c5fff(0x20d)]();return(_0xfd0193[_0x3c5fff(0x213)]??'')['toLowerCase']()===_0x2369bc||(_0xfd0193[_0x3c5fff(0x210)]??'')['toLowerCase']()===_0x2369bc;}export async function resolveUserRef(_0x737e0f){const _0x49430a=a169_0xbbf31b,_0x5bbde4=_0x737e0f[_0x49430a(0x211)]();if(!_0x5bbde4)throw CliErrors[_0x49430a(0x1f2)]('Missing\x20user\x20reference.',_0x49430a(0x1e2));const _0x1a8049=await resolveTenantCode(),_0x2879d2=await getTenantMembers(_0x1a8049);if(/^\d+$/[_0x49430a(0x1e0)](_0x5bbde4)){const _0x48213e=Number(_0x5bbde4),_0x17bd5f=_0x2879d2[_0x49430a(0x1d1)](_0x19b03e=>_0x19b03e[_0x49430a(0x1d3)]===_0x48213e);return{'userId':_0x48213e,'username':_0x17bd5f?.[_0x49430a(0x210)]??String(_0x48213e),'nickname':_0x17bd5f?.[_0x49430a(0x213)],'matchedBy':'id'};}const _0x4fa57f=_0x2879d2['filter'](_0x7030f7=>matchMember(_0x7030f7,_0x5bbde4));if(_0x4fa57f['length']===0x0)throw CliErrors[_0x49430a(0x1f2)]('No\x20tenant\x20member\x20matches\x20\x22'+_0x5bbde4+'\x22.',_0x49430a(0x214));if(_0x4fa57f[_0x49430a(0x1ff)]>0x1){const _0x2c0073=_0x4fa57f[_0x49430a(0x1e7)](_0x4bac24=>(_0x4bac24['nickname']??_0x4bac24['username']??'?')+'('+_0x4bac24['userId']+')')[_0x49430a(0x1f0)](',\x20');throw CliErrors['validation']('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x5bbde4+_0x49430a(0x1da)+_0x2c0073+'.','Disambiguate\x20with\x20--user\x20<id>.');}const _0x41aa50=_0x4fa57f[0x0];return{'userId':_0x41aa50[_0x49430a(0x1d3)],'username':_0x41aa50['username']??String(_0x41aa50[_0x49430a(0x1d3)]),'nickname':_0x41aa50[_0x49430a(0x213)],'matchedBy':'name'};}export const UPDATE_USER_LIST_PATH=a169_0xbbf31b(0x1e9);function userIdsOf(_0x18bdd0){const _0x3d20c5=a169_0xbbf31b;return(_0x18bdd0?.[_0x3d20c5(0x1fb)]??[])['map'](_0x17b0b1=>_0x17b0b1[_0x3d20c5(0x1d3)]);}export function computeRoleUserMutation(_0x3e46da){const _0x1dd247=a169_0xbbf31b,{operation:_0x5b3c8d,appCode:_0xfdf295,roleUsers:_0x497a04,targetRoleId:_0x171c96,user:_0x295e6e}=_0x3e46da,_0x352664=_0x497a04[_0x1dd247(0x1d1)](_0x17639f=>_0x17639f['id']===_0x171c96);if(!_0x352664)throw CliErrors['validation'](_0x1dd247(0x1f9)+_0x171c96+_0x1dd247(0x201),_0x1dd247(0x20e));const _0x3b2508=userIdsOf(_0x352664),_0x5c1574=[];if(_0x3e46da[_0x1dd247(0x1ea)]!==undefined&&_0x3e46da['expectUserCount']!==_0x3b2508[_0x1dd247(0x1ff)])throw CliErrors[_0x1dd247(0x1f2)]('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x3e46da[_0x1dd247(0x1ea)]+_0x1dd247(0x209)+_0x3b2508[_0x1dd247(0x1ff)]+'.',_0x1dd247(0x1fa));const _0x387a91=_0x3b2508['includes'](_0x295e6e['userId']);let _0x1302f8=![];const _0x4267ca=[..._0x352664[_0x1dd247(0x1fb)]];if(_0x5b3c8d===_0x1dd247(0x1fd))_0x387a91?_0x5c1574[_0x1dd247(0x1d6)](_0x1dd247(0x1ce)+_0x295e6e[_0x1dd247(0x1d3)]+_0x1dd247(0x218)+_0x352664[_0x1dd247(0x1d7)]+';\x20no\x20change.'):(_0x4267ca[_0x1dd247(0x1d6)]({'userId':_0x295e6e[_0x1dd247(0x1d3)],'username':_0x295e6e[_0x1dd247(0x210)],..._0x295e6e[_0x1dd247(0x213)]?{'nickname':_0x295e6e[_0x1dd247(0x213)]}:{}}),_0x1302f8=!![]);else{if(!_0x387a91)_0x5c1574['push'](_0x1dd247(0x1ce)+_0x295e6e['userId']+_0x1dd247(0x1df)+_0x352664[_0x1dd247(0x1d7)]+_0x1dd247(0x1ed));else{const _0x529035=_0x4267ca[_0x1dd247(0x215)](_0x417497=>_0x417497[_0x1dd247(0x1d3)]===_0x295e6e['userId']);if(_0x529035>=0x0)_0x4267ca['splice'](_0x529035,0x1);_0x1302f8=!![];}}const _0x2d79ae=_0x497a04['map'](_0x4deafe=>_0x4deafe['id']===_0x171c96?{..._0x4deafe,'userList':_0x4267ca}:_0x4deafe),_0xf69efa=_0x4267ca[_0x1dd247(0x1e7)](_0x3695a5=>_0x3695a5['userId']),_0x334ca4={'operation':_0x5b3c8d,'selector':{'appCode':_0xfdf295,'roleId':_0x171c96,'roleName':_0x352664[_0x1dd247(0x1d7)],'userId':_0x295e6e[_0x1dd247(0x1d3)]},'before':{'userIds':_0x3b2508},'after':{'userIds':_0xf69efa},'dryRun':_0x3e46da[_0x1dd247(0x1ec)],'backend':{'method':_0x1dd247(0x1e5),'path':UPDATE_USER_LIST_PATH},'warnings':_0x5c1574};return{'roleList':_0x2d79ae,'mutation':_0x334ca4,'changed':_0x1302f8};}export async function loadRoleUsers(_0x2ed8c2){return listRoleUsers(_0x2ed8c2);}function a169_0x429e(){const _0x1423c3=['\x20member(s)\x20but\x20role\x20has\x20','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','includes','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','toLowerCase','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','str','username','trim','flagMissing','nickname','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','findIndex','8HolDEL','USER','\x20is\x20already\x20a\x20member\x20of\x20role\x20','roleType','CUSTOM','23590uAQLEd','6UIdANQ','User\x20','\x22\x20not\x20found\x20in\x20app\x20','196161SoPuUG','find','tenant_code','userId','4ANhnWO','Role\x20id\x20(from\x20`role\x20list`)','push','roleName','Pass\x20--role\x20<id|name>.','userCount','\x22:\x20','filter','\x22\x20is\x20ambiguous\x20(ids:\x20','\x20built-in\x20role\x20','Missing\x20role\x20reference.','\x20is\x20not\x20a\x20member\x20of\x20role\x20','test','authRequired','Pass\x20--user\x20<id|name>.','permitCount','1407245UgangT','POST','14GLvqBB','map','6WDbLUS','/smartapi/permit/user-role/update-user-list','expectUserCount','user','dryRun',';\x20no\x20change.','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','role','join','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','validation','name','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','890469AOYfJI','string','1869007MzgywF','4584047kMAiuf','Role\x20id\x20','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','userList','10qcbYcJ','user-add','DEV','length','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','\x20not\x20found\x20in\x20the\x20user-role\x20list.','number','totalCount','22781TBVvXb','appCode','948scTshJ','Optional\x20role\x20remark/description','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20'];a169_0x429e=function(){return _0x1423c3;};return a169_0x429e();}export function readRoleRef(_0x5523f5){const _0x18fb1f=a169_0xbbf31b,_0x5340fc=_0x5523f5[_0x18fb1f(0x20f)](_0x18fb1f(0x1ef))[_0x18fb1f(0x211)]();if(!_0x5340fc)throw CliErrors[_0x18fb1f(0x212)](_0x18fb1f(0x1ef),_0x18fb1f(0x1d8));return _0x5340fc;}export async function prepareUserMutation(_0x525241,_0x1046cf,_0x2a334f){const _0x2bef7e=a169_0xbbf31b,_0x17f71a=readRoleRef(_0x525241),_0xa26c4d=_0x525241[_0x2bef7e(0x20f)]('user')[_0x2bef7e(0x211)]();if(!_0xa26c4d)throw CliErrors[_0x2bef7e(0x212)]('user','Pass\x20--user\x20<id|name>.');const _0x352c54=_0x525241['flag']('expect-user-count'),_0x2fe719=_0x352c54===undefined||_0x352c54===null?undefined:Number(_0x352c54),_0x1ad119=await resolveRoleRef(_0x525241[_0x2bef7e(0x205)],_0x17f71a),_0x5e22ac=await resolveUserRef(_0xa26c4d),_0x6a02e9=await loadRoleUsers(_0x525241[_0x2bef7e(0x205)]);return computeRoleUserMutation({'operation':_0x1046cf,'appCode':_0x525241[_0x2bef7e(0x205)],'roleUsers':_0x6a02e9,'targetRoleId':_0x1ad119['id'],'user':{'userId':_0x5e22ac[_0x2bef7e(0x1d3)],'username':_0x5e22ac[_0x2bef7e(0x210)],'nickname':_0x5e22ac[_0x2bef7e(0x213)]},'dryRun':_0x2a334f,..._0x2fe719!==undefined?{'expectUserCount':_0x2fe719}:{}});}
|
|
1
|
+
const a176_0x28f530=a176_0xbb3d;(function(_0x1e6096,_0x10cb0b){const _0x501083=a176_0xbb3d,_0x4a7bfd=_0x1e6096();while(!![]){try{const _0x16b8ea=-parseInt(_0x501083(0xcb))/0x1+parseInt(_0x501083(0xa4))/0x2+-parseInt(_0x501083(0xaa))/0x3+parseInt(_0x501083(0xc0))/0x4+parseInt(_0x501083(0xa6))/0x5*(-parseInt(_0x501083(0xa2))/0x6)+parseInt(_0x501083(0xb7))/0x7*(-parseInt(_0x501083(0xb9))/0x8)+-parseInt(_0x501083(0x87))/0x9*(parseInt(_0x501083(0xc1))/0xa);if(_0x16b8ea===_0x10cb0b)break;else _0x4a7bfd['push'](_0x4a7bfd['shift']());}catch(_0x5e47f9){_0x4a7bfd['push'](_0x4a7bfd['shift']());}}}(a176_0x3910,0x41f2d));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a176_0x28f530(0xba),'required':!![],'description':'Role\x20id\x20(from\x20`role\x20list`)'};function a176_0x3910(){const _0x4f9423=['push','tenant_code','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','authRequired','roleName','userCount','POST','\x20is\x20already\x20a\x20member\x20of\x20role\x20','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20','154aZgJbw','expect-user-count','96792fudyDW','number','userId','filter','Missing\x20user\x20reference.','CUSTOM','/smartapi/permit/user-role/update-user-list','2104488QLZFzG','110300rUPAnh','name','tenant','totalCount','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','dryRun','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','user-add','Disambiguate\x20with\x20--role\x20<id>.','Anti-drift\x20check\x20failed:\x20expected\x20','13763ZehOfC','user','appCode','\x22:\x20','str','splice','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','map','DEV','Cannot\x20','toLowerCase','Optional\x20role\x20remark/description','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','string','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','Disambiguate\x20with\x20--user\x20<id>.','Pass\x20--role\x20<id|name>.','No\x20tenant\x20member\x20matches\x20\x22','135tbPxwM','includes','trim','Role\x20name\x20\x22','remark','test','userList','role','permitCount','\x22\x20is\x20ambiguous\x20(ids:\x20','\x20member(s)\x20but\x20role\x20has\x20','\x20not\x20found\x20in\x20app\x20','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs',';\x20no\x20change.','Role\x20id\x20','\x22\x20not\x20found\x20in\x20app\x20','\x20is\x20not\x20a\x20member\x20of\x20role\x20','\x20built-in\x20role\x20','expectUserCount','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','nickname','validation','length','flagMissing','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','\x20not\x20found\x20in\x20the\x20user-role\x20list.','username','8334WaYgkB','roleType','876802UNtiLY','Role\x20name','715OqFLKm','join','User\x20','ADMIN','151140SgzEbq','find','Multiple\x20tenant\x20members\x20match\x20\x22'];a176_0x3910=function(){return _0x4f9423;};return a176_0x3910();}export const ROLE_REF_FLAG={'name':a176_0x28f530(0x8e),'type':a176_0x28f530(0xd8),'required':!![],'description':a176_0x28f530(0xd7)};export const USER_REF_FLAG={'name':a176_0x28f530(0xcc),'type':a176_0x28f530(0xd8),'required':!![],'description':a176_0x28f530(0xaf)};export const NAME_FLAG={'name':a176_0x28f530(0xc2),'type':'string','required':!![],'description':a176_0x28f530(0xa5)};export const USER_NAME_FLAG={'name':'name','type':a176_0x28f530(0xd8),'required':!![],'description':a176_0x28f530(0x9f)};export const REMARK_FLAG={'name':a176_0x28f530(0x8b),'type':a176_0x28f530(0xd8),'required':![],'description':a176_0x28f530(0xd6)};export const EXPECT_USER_COUNT_FLAG={'name':a176_0x28f530(0xb8),'type':'number','required':![],'description':a176_0x28f530(0x93)};export const BUILTIN_ROLE_TYPES=['ADMIN',a176_0x28f530(0xd3),'USER'];export function isBuiltinRole(_0x448c1b){const _0x2a0199=a176_0x28f530;return BUILTIN_ROLE_TYPES[_0x2a0199(0x88)](_0x448c1b);}export function assertCustomRole(_0x5c7e82,_0x44dbe3){const _0x9eada6=a176_0x28f530;if(_0x5c7e82[_0x9eada6(0xa3)]!==_0x9eada6(0xbe))throw CliErrors[_0x9eada6(0x9c)](_0x9eada6(0xd4)+_0x44dbe3+_0x9eada6(0x98)+_0x5c7e82[_0x9eada6(0xb2)]+'\x20('+_0x5c7e82['roleType']+').',_0x9eada6(0xc7));}export function assertPermConfigurable(_0x5cfa9f){const _0x3961e5=a176_0x28f530;if(_0x5cfa9f['roleType']===_0x3961e5(0xd3)||_0x5cfa9f[_0x3961e5(0xa3)]===_0x3961e5(0xa9))throw CliErrors[_0x3961e5(0x9c)](_0x3961e5(0xb6)+_0x5cfa9f[_0x3961e5(0xb2)]+'\x20('+_0x5cfa9f[_0x3961e5(0xa3)]+').',_0x3961e5(0xd9));}export function projectRole(_0x44d7ad){const _0x1b93f8=a176_0x28f530;return{'id':_0x44d7ad['id'],'roleName':_0x44d7ad['roleName'],'roleType':_0x44d7ad[_0x1b93f8(0xa3)],'remark':_0x44d7ad[_0x1b93f8(0x8b)],'userCount':_0x44d7ad[_0x1b93f8(0xb3)],'permitCount':_0x44d7ad[_0x1b93f8(0x8f)],'builtin':isBuiltinRole(_0x44d7ad[_0x1b93f8(0xa3)])};}export async function resolveRoleRef(_0x11f145,_0x2fa639){const _0x393d16=a176_0x28f530,_0x1995e9=_0x2fa639[_0x393d16(0x89)]();if(!_0x1995e9)throw CliErrors[_0x393d16(0x9c)]('Missing\x20role\x20reference.',_0x393d16(0xdb));if(/^\d+$/[_0x393d16(0x8c)](_0x1995e9))return getRoleById(_0x11f145,Number(_0x1995e9));const _0x20f6b3=await listAllAppRoles(_0x11f145),_0x2d7bbc=_0x20f6b3['filter'](_0x451a14=>_0x451a14[_0x393d16(0xb2)]===_0x1995e9);if(_0x2d7bbc[_0x393d16(0x9d)]===0x0)throw CliErrors[_0x393d16(0x9c)](_0x393d16(0x8a)+_0x1995e9+_0x393d16(0x96)+_0x11f145+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.');if(_0x2d7bbc['length']>0x1){const _0x53f96d=_0x2d7bbc[_0x393d16(0xd2)](_0x3e92ce=>_0x3e92ce['id'])[_0x393d16(0xa7)](',\x20');throw CliErrors[_0x393d16(0x9c)]('Role\x20name\x20\x22'+_0x1995e9+_0x393d16(0x90)+_0x53f96d+').',_0x393d16(0xc9));}return _0x2d7bbc[0x0];}export async function getRoleById(_0x335c0c,_0x2dbc4c){const _0x22992d=a176_0x28f530,_0x84f0a8=await getAppRole(_0x2dbc4c);if(!_0x84f0a8)throw CliErrors[_0x22992d(0x9c)](_0x22992d(0x95)+_0x2dbc4c+_0x22992d(0x92)+_0x335c0c+'.',_0x22992d(0xb0));return _0x84f0a8;}async function listAllAppRoles(_0x4b90c2){const _0x59f748=a176_0x28f530,_0x150820=0x64,_0x3c04fa=[];for(let _0x478b54=0x1;;_0x478b54+=0x1){const {items:_0x5b508c,paging:_0x26e43f}=await listAppRoles(_0x4b90c2,{'currentPage':_0x478b54,'pageSize':_0x150820});_0x3c04fa[_0x59f748(0xad)](..._0x5b508c);if(_0x5b508c[_0x59f748(0x9d)]<_0x150820||_0x26e43f&&_0x3c04fa[_0x59f748(0x9d)]>=_0x26e43f[_0x59f748(0xc4)])return _0x3c04fa;}}export async function resolveTenantCode(){const _0x583dde=a176_0x28f530,_0x12aaa5=await getSessionUserInfo(),_0x589fe3=_0x12aaa5?.[_0x583dde(0xcc)]?.[_0x583dde(0xc3)]?.[_0x583dde(0xae)];if(!_0x589fe3)throw CliErrors[_0x583dde(0xb1)](_0x583dde(0xd1));return _0x589fe3;}function matchMember(_0x1e3da8,_0x2200bf){const _0x216cfd=a176_0x28f530,_0x1f4f05=_0x2200bf[_0x216cfd(0x89)]()[_0x216cfd(0xd5)]();return(_0x1e3da8['nickname']??'')[_0x216cfd(0xd5)]()===_0x1f4f05||(_0x1e3da8[_0x216cfd(0xa1)]??'')[_0x216cfd(0xd5)]()===_0x1f4f05;}export async function resolveUserRef(_0x39b57c){const _0x3393bc=a176_0x28f530,_0x2159e4=_0x39b57c[_0x3393bc(0x89)]();if(!_0x2159e4)throw CliErrors[_0x3393bc(0x9c)](_0x3393bc(0xbd),'Pass\x20--user\x20<id|name>.');const _0x1ff08e=await resolveTenantCode(),_0x428d80=await getTenantMembers(_0x1ff08e);if(/^\d+$/[_0x3393bc(0x8c)](_0x2159e4)){const _0x126b26=Number(_0x2159e4),_0x179be1=_0x428d80['find'](_0x4a1f8e=>_0x4a1f8e['userId']===_0x126b26);return{'userId':_0x126b26,'username':_0x179be1?.['username']??String(_0x126b26),'nickname':_0x179be1?.[_0x3393bc(0x9b)],'matchedBy':'id'};}const _0x36fd20=_0x428d80[_0x3393bc(0xbc)](_0x366318=>matchMember(_0x366318,_0x2159e4));if(_0x36fd20[_0x3393bc(0x9d)]===0x0)throw CliErrors[_0x3393bc(0x9c)](_0x3393bc(0x86)+_0x2159e4+'\x22.',_0x3393bc(0x9a));if(_0x36fd20[_0x3393bc(0x9d)]>0x1){const _0x32d261=_0x36fd20[_0x3393bc(0xd2)](_0x33a722=>(_0x33a722[_0x3393bc(0x9b)]??_0x33a722[_0x3393bc(0xa1)]??'?')+'('+_0x33a722['userId']+')')['join'](',\x20');throw CliErrors[_0x3393bc(0x9c)](_0x3393bc(0xac)+_0x2159e4+_0x3393bc(0xce)+_0x32d261+'.',_0x3393bc(0xda));}const _0x459a75=_0x36fd20[0x0];return{'userId':_0x459a75[_0x3393bc(0xbb)],'username':_0x459a75[_0x3393bc(0xa1)]??String(_0x459a75['userId']),'nickname':_0x459a75[_0x3393bc(0x9b)],'matchedBy':'name'};}export const UPDATE_USER_LIST_PATH=a176_0x28f530(0xbf);function userIdsOf(_0x3a70e3){const _0x2c25b7=a176_0x28f530;return(_0x3a70e3?.['userList']??[])[_0x2c25b7(0xd2)](_0x4ff66c=>_0x4ff66c[_0x2c25b7(0xbb)]);}export function computeRoleUserMutation(_0x34340a){const _0x48a93c=a176_0x28f530,{operation:_0x3f1570,appCode:_0x205b21,roleUsers:_0x9e9521,targetRoleId:_0xf98ac8,user:_0x367a33}=_0x34340a,_0x2e9c3f=_0x9e9521[_0x48a93c(0xab)](_0x1d10d4=>_0x1d10d4['id']===_0xf98ac8);if(!_0x2e9c3f)throw CliErrors['validation'](_0x48a93c(0x95)+_0xf98ac8+_0x48a93c(0xa0),_0x48a93c(0xb0));const _0x4a3a9f=userIdsOf(_0x2e9c3f),_0x36050a=[];if(_0x34340a[_0x48a93c(0x99)]!==undefined&&_0x34340a[_0x48a93c(0x99)]!==_0x4a3a9f['length'])throw CliErrors[_0x48a93c(0x9c)](_0x48a93c(0xca)+_0x34340a[_0x48a93c(0x99)]+_0x48a93c(0x91)+_0x4a3a9f[_0x48a93c(0x9d)]+'.',_0x48a93c(0xc5));const _0x1314a8=_0x4a3a9f[_0x48a93c(0x88)](_0x367a33[_0x48a93c(0xbb)]);let _0x1de91a=![];const _0x214c51=[..._0x2e9c3f[_0x48a93c(0x8d)]];if(_0x3f1570===_0x48a93c(0xc8))_0x1314a8?_0x36050a[_0x48a93c(0xad)](_0x48a93c(0xa8)+_0x367a33[_0x48a93c(0xbb)]+_0x48a93c(0xb5)+_0x2e9c3f[_0x48a93c(0xb2)]+_0x48a93c(0x94)):(_0x214c51[_0x48a93c(0xad)]({'userId':_0x367a33['userId'],'username':_0x367a33[_0x48a93c(0xa1)],..._0x367a33[_0x48a93c(0x9b)]?{'nickname':_0x367a33['nickname']}:{}}),_0x1de91a=!![]);else{if(!_0x1314a8)_0x36050a[_0x48a93c(0xad)](_0x48a93c(0xa8)+_0x367a33['userId']+_0x48a93c(0x97)+_0x2e9c3f[_0x48a93c(0xb2)]+_0x48a93c(0x94));else{const _0x36fb19=_0x214c51['findIndex'](_0x5c240b=>_0x5c240b[_0x48a93c(0xbb)]===_0x367a33['userId']);if(_0x36fb19>=0x0)_0x214c51[_0x48a93c(0xd0)](_0x36fb19,0x1);_0x1de91a=!![];}}const _0x574e91=_0x9e9521[_0x48a93c(0xd2)](_0x474882=>_0x474882['id']===_0xf98ac8?{..._0x474882,'userList':_0x214c51}:_0x474882),_0x590281=_0x214c51[_0x48a93c(0xd2)](_0xcf32af=>_0xcf32af[_0x48a93c(0xbb)]),_0x540c6b={'operation':_0x3f1570,'selector':{'appCode':_0x205b21,'roleId':_0xf98ac8,'roleName':_0x2e9c3f[_0x48a93c(0xb2)],'userId':_0x367a33[_0x48a93c(0xbb)]},'before':{'userIds':_0x4a3a9f},'after':{'userIds':_0x590281},'dryRun':_0x34340a[_0x48a93c(0xc6)],'backend':{'method':_0x48a93c(0xb4),'path':UPDATE_USER_LIST_PATH},'warnings':_0x36050a};return{'roleList':_0x574e91,'mutation':_0x540c6b,'changed':_0x1de91a};}export async function loadRoleUsers(_0x409df3){return listRoleUsers(_0x409df3);}function a176_0xbb3d(_0x5da565,_0x39ef96){_0x5da565=_0x5da565-0x86;const _0x391069=a176_0x3910();let _0xbb3dc8=_0x391069[_0x5da565];return _0xbb3dc8;}export function readRoleRef(_0xa202b7){const _0x490fa2=a176_0x28f530,_0x357096=_0xa202b7[_0x490fa2(0xcf)](_0x490fa2(0x8e))[_0x490fa2(0x89)]();if(!_0x357096)throw CliErrors[_0x490fa2(0x9e)](_0x490fa2(0x8e),_0x490fa2(0xdb));return _0x357096;}export async function prepareUserMutation(_0x150124,_0x26d96b,_0x59d488){const _0x423173=a176_0x28f530,_0x30f5a4=readRoleRef(_0x150124),_0x292b9e=_0x150124[_0x423173(0xcf)]('user')[_0x423173(0x89)]();if(!_0x292b9e)throw CliErrors[_0x423173(0x9e)](_0x423173(0xcc),'Pass\x20--user\x20<id|name>.');const _0x55a13b=_0x150124['flag']('expect-user-count'),_0x4bea67=_0x55a13b===undefined||_0x55a13b===null?undefined:Number(_0x55a13b),_0x565e0d=await resolveRoleRef(_0x150124[_0x423173(0xcd)],_0x30f5a4),_0x2b944f=await resolveUserRef(_0x292b9e),_0x271aea=await loadRoleUsers(_0x150124['appCode']);return computeRoleUserMutation({'operation':_0x26d96b,'appCode':_0x150124[_0x423173(0xcd)],'roleUsers':_0x271aea,'targetRoleId':_0x565e0d['id'],'user':{'userId':_0x2b944f[_0x423173(0xbb)],'username':_0x2b944f['username'],'nickname':_0x2b944f[_0x423173(0x9b)]},'dryRun':_0x59d488,..._0x4bea67!==undefined?{'expectUserCount':_0x4bea67}:{}});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a177_0x5b4098=a177_0x4959;function a177_0x2552(){const _0x7f53eb=['5IuAaEF','\x20(id=','Updated\x20role\x20','192380bYNRfQ','remark','flag','appCode','name','1106680smvsyB','POST','176vzfZfi','Nothing\x20to\x20update.','trim','3012102LVJGDm','/smartapi/permit/role/update','num','1317939ywWFtr','700Hgpsjn','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','update','2948106nLCcIL','1OqZoQK','New\x20role\x20name','roleName','validation','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','--name\x20cannot\x20be\x20empty.','21960agpEgd','189386qkjsVL'];a177_0x2552=function(){return _0x7f53eb;};return a177_0x2552();}(function(_0x5ceaa4,_0x45b7ea){const _0x1e7bd4=a177_0x4959,_0x5e3fba=_0x5ceaa4();while(!![]){try{const _0x9fb8b7=-parseInt(_0x1e7bd4(0x148))/0x1*(parseInt(_0x1e7bd4(0x132))/0x2)+parseInt(_0x1e7bd4(0x143))/0x3+-parseInt(_0x1e7bd4(0x13b))/0x4+parseInt(_0x1e7bd4(0x133))/0x5*(parseInt(_0x1e7bd4(0x147))/0x6)+-parseInt(_0x1e7bd4(0x144))/0x7*(parseInt(_0x1e7bd4(0x131))/0x8)+parseInt(_0x1e7bd4(0x140))/0x9+parseInt(_0x1e7bd4(0x136))/0xa*(-parseInt(_0x1e7bd4(0x13d))/0xb);if(_0x9fb8b7===_0x45b7ea)break;else _0x5e3fba['push'](_0x5e3fba['shift']());}catch(_0x45e492){_0x5e3fba['push'](_0x5e3fba['shift']());}}}(a177_0x2552,0x4c177));function a177_0x4959(_0x5d475e,_0x3d756f){_0x5d475e=_0x5d475e-0x12d;const _0x255282=a177_0x2552();let _0x49596c=_0x255282[_0x5d475e];return _0x49596c;}import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a177_0x5b4098(0x141);function readPatch(_0x3579fa){const _0x303ec8=a177_0x5b4098,_0x4a24d3=_0x3579fa[_0x303ec8(0x138)](_0x303ec8(0x13a)),_0x551493=_0x3579fa[_0x303ec8(0x138)](_0x303ec8(0x137)),_0x3ce7f0={};if(_0x4a24d3!==undefined&&_0x4a24d3!==null){const _0x72f923=String(_0x4a24d3)[_0x303ec8(0x13f)]();if(!_0x72f923)throw CliErrors[_0x303ec8(0x12e)](_0x303ec8(0x130));if(_0x72f923['length']>0x40)throw CliErrors[_0x303ec8(0x12e)]('Role\x20name\x20cannot\x20exceed\x2064\x20characters.');_0x3ce7f0[_0x303ec8(0x12d)]=_0x72f923;}_0x551493!==undefined&&_0x551493!==null&&(_0x3ce7f0[_0x303ec8(0x137)]=String(_0x551493));if(_0x3ce7f0[_0x303ec8(0x12d)]===undefined&&_0x3ce7f0[_0x303ec8(0x137)]===undefined)throw CliErrors['validation'](_0x303ec8(0x13e),_0x303ec8(0x145));return _0x3ce7f0;}export const roleUpdate={'service':'role','command':a177_0x5b4098(0x146),'description':a177_0x5b4098(0x12f),'risk':'write','flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a177_0x5b4098(0x13a),'type':'string','required':![],'description':a177_0x5b4098(0x149)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x109ee3){readPatch(_0x109ee3);},async 'dryRun'(_0x43ea50){const _0x5688ff=a177_0x5b4098,_0x470489=_0x43ea50[_0x5688ff(0x142)]('id'),_0x325905=readPatch(_0x43ea50),_0x457753=await getRoleById(_0x43ea50[_0x5688ff(0x139)],_0x470489);return assertCustomRole(_0x457753,'update'),asDryRunResult({'operation':_0x5688ff(0x146),'selector':{'appCode':_0x43ea50[_0x5688ff(0x139)],'roleId':_0x470489,'roleName':_0x457753[_0x5688ff(0x12d)]},'before':projectRole(_0x457753),'after':projectRole({..._0x457753,..._0x325905['roleName']!==undefined?{'roleName':_0x325905[_0x5688ff(0x12d)]}:{},..._0x325905['remark']!==undefined?{'remark':_0x325905['remark']}:{}}),'dryRun':!![],'backend':{'method':_0x5688ff(0x13c),'path':UPDATE_PATH},'warnings':[]},{'method':_0x5688ff(0x13c),'url':UPDATE_PATH});},async 'execute'(_0x677ecf){const _0x1f4ed5=a177_0x5b4098,_0x563792=_0x677ecf[_0x1f4ed5(0x142)]('id'),_0x1ebfbe=readPatch(_0x677ecf),_0x384e4a=await getRoleById(_0x677ecf[_0x1f4ed5(0x139)],_0x563792);assertCustomRole(_0x384e4a,_0x1f4ed5(0x146)),await updateAppRole({'id':_0x563792,'appCode':_0x677ecf['appCode'],..._0x1ebfbe['roleName']!==undefined?{'roleName':_0x1ebfbe[_0x1f4ed5(0x12d)]}:{},..._0x1ebfbe[_0x1f4ed5(0x137)]!==undefined?{'remark':_0x1ebfbe['remark']}:{}});const _0x37f4e2=await getRoleById(_0x677ecf['appCode'],_0x563792);return{'ok':!![],'data':{'operation':'update','selector':{'appCode':_0x677ecf[_0x1f4ed5(0x139)],'roleId':_0x563792,'roleName':_0x37f4e2['roleName']},'before':projectRole(_0x384e4a),'after':projectRole(_0x37f4e2),'dryRun':![],'backend':{'method':_0x1f4ed5(0x13c),'path':UPDATE_PATH},'warnings':[]},'message':_0x1f4ed5(0x135)+_0x37f4e2['roleName']+_0x1f4ed5(0x134)+_0x563792+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a178_0x3d4f(_0x477883,_0x4eb3e1){_0x477883=_0x477883-0x18a;const _0x2651a3=a178_0x2651();let _0x3d4f41=_0x2651a3[_0x477883];return _0x3d4f41;}const a178_0x1eca78=a178_0x3d4f;(function(_0x105ccd,_0x4ba7a8){const _0x248869=a178_0x3d4f,_0x6218f8=_0x105ccd();while(!![]){try{const _0x2f362e=-parseInt(_0x248869(0x19b))/0x1*(parseInt(_0x248869(0x196))/0x2)+parseInt(_0x248869(0x18c))/0x3*(-parseInt(_0x248869(0x197))/0x4)+parseInt(_0x248869(0x18b))/0x5+-parseInt(_0x248869(0x198))/0x6*(-parseInt(_0x248869(0x19c))/0x7)+parseInt(_0x248869(0x192))/0x8*(-parseInt(_0x248869(0x194))/0x9)+parseInt(_0x248869(0x193))/0xa+parseInt(_0x248869(0x19d))/0xb;if(_0x2f362e===_0x4ba7a8)break;else _0x6218f8['push'](_0x6218f8['shift']());}catch(_0xc1d724){_0x6218f8['push'](_0x6218f8['shift']());}}}(a178_0x2651,0x21684));function a178_0x2651(){const _0x4ed5fc=['377707FEsiKj','user-add','1040635dLXMtT','681MpJtTB','roleName','appCode','userId','\x20already\x20in\x20role\x20','\x20to\x20role\x20','287816hXSChp','37840PXBfDk','9YYUEAy','Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','259848xLqHVD','3356MUbQCv','82314nVJUyj','role','selector','1rFhsAu','126oSssTm'];a178_0x2651=function(){return _0x4ed5fc;};return a178_0x2651();}import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a178_0x1eca78(0x199),'command':a178_0x1eca78(0x18a),'description':a178_0x1eca78(0x195),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x52b839){const _0x1d44f5=a178_0x1eca78,{mutation:_0x232546}=await prepareUserMutation(_0x52b839,_0x1d44f5(0x18a),!![]);return asDryRunResult(_0x232546,{'method':'POST','url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x2130c3){const _0x594667=a178_0x1eca78,{roleList:_0x2b7770,mutation:_0x5b3838,changed:_0x4c67a3}=await prepareUserMutation(_0x2130c3,_0x594667(0x18a),![]);return _0x4c67a3&&await updateRoleUsers(_0x2130c3[_0x594667(0x18e)],_0x2b7770),{'ok':!![],'data':_0x5b3838,'message':_0x4c67a3?'Added\x20user\x20'+_0x5b3838[_0x594667(0x19a)][_0x594667(0x18f)]+_0x594667(0x191)+_0x5b3838[_0x594667(0x19a)][_0x594667(0x18d)]:'No\x20change:\x20user\x20'+_0x5b3838[_0x594667(0x19a)]['userId']+_0x594667(0x190)+_0x5b3838[_0x594667(0x19a)][_0x594667(0x18d)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a179_0x5e4f(_0x3bd098,_0x29a7f2){_0x3bd098=_0x3bd098-0x1d1;const _0x2bf27e=a179_0x2bf2();let _0x5e4f06=_0x2bf27e[_0x3bd098];return _0x5e4f06;}function a179_0x2bf2(){const _0x5342b5=['\x20from\x20role\x20','POST','selector','19CSDqdv','33AyqYdp','appCode','4112976MkMXnF','669326nddFFq','38902PTRrWp','Removed\x20user\x20','796365unOLbX','1773288kEBsnG','No\x20change:\x20user\x20','role','18qSUkZL','\x20not\x20in\x20role\x20','high-risk-write','8295190lOLmnJ','roleName','48yLsLyT','943350ZkTDVu','user-remove','userId'];a179_0x2bf2=function(){return _0x5342b5;};return a179_0x2bf2();}const a179_0x2c5644=a179_0x5e4f;(function(_0x5f5e79,_0x4d9084){const _0x591e9c=a179_0x5e4f,_0x19824f=_0x5f5e79();while(!![]){try{const _0x2c6655=-parseInt(_0x591e9c(0x1e2))/0x1*(parseInt(_0x591e9c(0x1e7))/0x2)+parseInt(_0x591e9c(0x1dc))/0x3+-parseInt(_0x591e9c(0x1e5))/0x4+parseInt(_0x591e9c(0x1d2))/0x5+-parseInt(_0x591e9c(0x1d6))/0x6*(-parseInt(_0x591e9c(0x1e6))/0x7)+-parseInt(_0x591e9c(0x1db))/0x8*(parseInt(_0x591e9c(0x1d3))/0x9)+parseInt(_0x591e9c(0x1d9))/0xa*(parseInt(_0x591e9c(0x1e3))/0xb);if(_0x2c6655===_0x4d9084)break;else _0x19824f['push'](_0x19824f['shift']());}catch(_0x52938e){_0x19824f['push'](_0x19824f['shift']());}}}(a179_0x2bf2,0xa35c9));import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':a179_0x2c5644(0x1d5),'command':a179_0x2c5644(0x1dd),'description':'Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','risk':a179_0x2c5644(0x1d8),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x4094df){const _0x9d5094=a179_0x2c5644,{mutation:_0x3ebe6f}=await prepareUserMutation(_0x4094df,_0x9d5094(0x1dd),!![]);return asDryRunResult(_0x3ebe6f,{'method':_0x9d5094(0x1e0),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x4ed33b){const _0x53c40b=a179_0x2c5644,{roleList:_0x192856,mutation:_0x3b0b25,changed:_0x40b98d}=await prepareUserMutation(_0x4ed33b,_0x53c40b(0x1dd),![]);return _0x40b98d&&await updateRoleUsers(_0x4ed33b[_0x53c40b(0x1e4)],_0x192856),{'ok':!![],'data':_0x3b0b25,'message':_0x40b98d?_0x53c40b(0x1d1)+_0x3b0b25[_0x53c40b(0x1e1)]['userId']+_0x53c40b(0x1df)+_0x3b0b25['selector'][_0x53c40b(0x1da)]:_0x53c40b(0x1d4)+_0x3b0b25[_0x53c40b(0x1e1)][_0x53c40b(0x1de)]+_0x53c40b(0x1d7)+_0x3b0b25[_0x53c40b(0x1e1)][_0x53c40b(0x1da)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a180_0x31ae93=a180_0x36fc;function a180_0x1c18(){const _0x5bcc67=['user-resolve','1211355EGteZz','username','Pass\x20--name\x20<nickname|username>.','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','368547wUlKAo','1297780exOvpb','flagMissing','nickname','404303JbiLZn','str','16mtMOVm','name','16JJcnfh','trim','1846182jqHgiS','120Bmiqlk','role','userId','307130yFieXS','\x22\x20→\x20userId\x20','397691GiItBY'];a180_0x1c18=function(){return _0x5bcc67;};return a180_0x1c18();}function a180_0x36fc(_0x4983a6,_0xf8c312){_0x4983a6=_0x4983a6-0x165;const _0x1c189e=a180_0x1c18();let _0x36fcc2=_0x1c189e[_0x4983a6];return _0x36fcc2;}(function(_0x5fdc26,_0x5da2a1){const _0x47ff94=a180_0x36fc,_0xe3eaca=_0x5fdc26();while(!![]){try{const _0x56b63f=parseInt(_0x47ff94(0x167))/0x1+parseInt(_0x47ff94(0x16d))/0x2+parseInt(_0x47ff94(0x179))/0x3*(parseInt(_0x47ff94(0x16b))/0x4)+parseInt(_0x47ff94(0x171))/0x5*(-parseInt(_0x47ff94(0x16e))/0x6)+-parseInt(_0x47ff94(0x173))/0x7*(-parseInt(_0x47ff94(0x169))/0x8)+-parseInt(_0x47ff94(0x175))/0x9+parseInt(_0x47ff94(0x17a))/0xa;if(_0x56b63f===_0x5da2a1)break;else _0xe3eaca['push'](_0xe3eaca['shift']());}catch(_0x33d213){_0xe3eaca['push'](_0xe3eaca['shift']());}}}(a180_0x1c18,0xaaac7));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a180_0x31ae93(0x16f),'command':a180_0x31ae93(0x174),'description':a180_0x31ae93(0x178),'risk':'read','flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2d21f8){const _0x19760f=a180_0x31ae93;if(!_0x2d21f8[_0x19760f(0x168)](_0x19760f(0x16a))[_0x19760f(0x16c)]())throw CliErrors[_0x19760f(0x165)](_0x19760f(0x16a),_0x19760f(0x177));},async 'execute'(_0x370ff2){const _0x5b1ff5=a180_0x31ae93,_0x387d8e=_0x370ff2['str']('name')['trim'](),_0x5e6294=await resolveUserRef(_0x387d8e);return{'ok':!![],'data':{'user':{'userId':_0x5e6294[_0x5b1ff5(0x170)],'username':_0x5e6294[_0x5b1ff5(0x176)],'nickname':_0x5e6294[_0x5b1ff5(0x166)],'matchedBy':_0x5e6294['matchedBy']}},'message':'Resolved\x20\x22'+_0x387d8e+_0x5b1ff5(0x172)+_0x5e6294['userId']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a181_0x57e2d4=a181_0x5cc5;(function(_0x45987b,_0xdc5b76){const _0x452acf=a181_0x5cc5,_0x4eff69=_0x45987b();while(!![]){try{const _0x2addf4=parseInt(_0x452acf(0xf8))/0x1*(-parseInt(_0x452acf(0xed))/0x2)+parseInt(_0x452acf(0x106))/0x3+parseInt(_0x452acf(0xf0))/0x4*(-parseInt(_0x452acf(0xf6))/0x5)+-parseInt(_0x452acf(0xf5))/0x6*(parseInt(_0x452acf(0xf3))/0x7)+-parseInt(_0x452acf(0xe0))/0x8+parseInt(_0x452acf(0xd2))/0x9*(-parseInt(_0x452acf(0x10c))/0xa)+-parseInt(_0x452acf(0xd9))/0xb*(-parseInt(_0x452acf(0xfe))/0xc);if(_0x2addf4===_0xdc5b76)break;else _0x4eff69['push'](_0x4eff69['shift']());}catch(_0x2472f7){_0x4eff69['push'](_0x4eff69['shift']());}}}(a181_0x555f,0x9b309));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set(['start',a181_0x57e2d4(0xf1)]);function readPackageScripts(_0x1f304d){const _0x1c4c09=a181_0x57e2d4,_0x58bae3=resolve(_0x1f304d,_0x1c4c09(0x107));if(!existsSync(_0x58bae3))return null;try{const _0x44916f=JSON[_0x1c4c09(0xdc)](readFileSync(_0x58bae3,_0x1c4c09(0x105)));return _0x44916f['scripts']??{};}catch{return null;}}function detectPackageManager(_0x422b50){const _0x5bdfdd=a181_0x57e2d4;if(existsSync(resolve(_0x422b50,_0x5bdfdd(0xe1)))||existsSync(resolve(_0x422b50,'bun.lock')))return _0x5bdfdd(0x10a);if(existsSync(resolve(_0x422b50,_0x5bdfdd(0xe7))))return'pnpm';if(existsSync(resolve(_0x422b50,_0x5bdfdd(0xee))))return _0x5bdfdd(0xda);return'npm';}async function versionCheck(_0x212eab){const _0x4de7cb=a181_0x57e2d4,_0x55dbee=await checkCliVersion();(_0x55dbee[_0x4de7cb(0x102)]||_0x55dbee[_0x4de7cb(0x108)])&&(printCliUpgradeWarning(_0x55dbee),assertCliVersionSupported(_0x55dbee));const _0x3a87f4=await checkSdkVersion(_0x212eab);if(_0x3a87f4[_0x4de7cb(0x102)])printSdkUpgradeWarning(_0x3a87f4);}function a181_0x5cc5(_0x26545b,_0x4756c3){_0x26545b=_0x26545b-0xd1;const _0x555f5d=a181_0x555f();let _0x5cc570=_0x555f5d[_0x26545b];return _0x5cc570;}function a181_0x555f(){const _0xfc28cd=['run','pnpm-lock.yaml','\x20\x20\x20\x20','node_modules','Run\x20a\x20package.json\x20script','No\x20package.json\x20found\x20in\x20current\x20directory.','cwd','4WrsbhE','yarn.lock','vite','4AzrpjJ','dev','validation','294jwcidI','Script\x20name\x20defined\x20in\x20package.json','130734NDquJD','2514685XXNOUE','keys','113494kuyNsC','args','vite\x20preview\x20exited\x20with\x20code\x20','preview','\x20run\x20start','error','1541544vYEntM','\x0a\x20\x20Available\x20scripts:\x0a','--watch','Available:\x20','needsUpgrade','close','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','utf-8','1792317wduCnH','package.json','belowMinimum','script','bun','.bin','10CQXCZo','all','2307321xoefaS','\x0a\x20\x20Usage:\x20','\x20exited\x20with\x20code\x20','push','log','(none)','inherit','253krxDdX','yarn','bool','parse','length','slice','\x22\x20not\x20found\x20in\x20package.json.','8119808ePzARH','bun.lockb','join','watch','read','\x20run\x20'];a181_0x555f=function(){return _0xfc28cd;};return a181_0x555f();}function spawnScript(_0x595608,_0x26eee3,_0x137306,_0x8019ce){return new Promise((_0x5c4667,_0x23b0e3)=>{const _0x55cf10=a181_0x5cc5,_0x1c1692=['run',_0x26eee3,..._0x137306],_0x49dffb=spawn(_0x595608,_0x1c1692,{'cwd':_0x8019ce,'stdio':_0x55cf10(0xd8),'shell':!![],'env':{...process.env,'PATH':''+join(_0x8019ce,_0x55cf10(0xe9),'.bin')+delimiter+process.env.PATH}});_0x49dffb['on'](_0x55cf10(0x103),_0xf514ce=>{const _0x59e7ac=_0x55cf10;if(_0xf514ce===0x0||_0xf514ce===null)_0x5c4667();else _0x23b0e3(new Error(_0x595608+_0x59e7ac(0xe5)+_0x26eee3+_0x59e7ac(0xd4)+_0xf514ce));}),_0x49dffb['on'](_0x55cf10(0xfd),_0x23b0e3);});}function spawnViteBuildWatch(_0x5bab80){return new Promise((_0x31b194,_0xcaaf44)=>{const _0x4555a3=a181_0x5cc5,_0x2ddcce=spawn(_0x4555a3(0xef),['build',_0x4555a3(0x100)],{'cwd':_0x5bab80,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x5bab80,'node_modules',_0x4555a3(0x10b))+delimiter+process.env.PATH}});_0x2ddcce['on'](_0x4555a3(0x103),_0xdb3018=>{const _0xf61fd8=_0x4555a3;if(_0xdb3018===0x0||_0xdb3018===null)_0x31b194();else _0xcaaf44(new Error(_0xf61fd8(0x104)+_0xdb3018));}),_0x2ddcce['on'](_0x4555a3(0xfd),_0xcaaf44);});}function spawnVitePreview(_0x3bf5c1){return new Promise((_0x2279e2,_0x531b69)=>{const _0x83ffbb=a181_0x5cc5,_0x1b9389=spawn(_0x83ffbb(0xef),['preview'],{'cwd':_0x3bf5c1,'stdio':_0x83ffbb(0xd8),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3bf5c1,_0x83ffbb(0xe9),_0x83ffbb(0x10b))+delimiter+process.env.PATH}});_0x1b9389['on'](_0x83ffbb(0x103),_0xc0ca86=>{const _0x1222d1=_0x83ffbb;if(_0xc0ca86===0x0||_0xc0ca86===null)_0x2279e2();else _0x531b69(new Error(_0x1222d1(0xfa)+_0xc0ca86));}),_0x1b9389['on'](_0x83ffbb(0xfd),_0x531b69);});}const runFlags=[{'name':a181_0x57e2d4(0xe3),'type':'boolean','description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a181_0x57e2d4(0xe6),'command':a181_0x57e2d4(0xe6),'description':a181_0x57e2d4(0xea),'risk':a181_0x57e2d4(0xe4),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a181_0x57e2d4(0x109),'description':a181_0x57e2d4(0xf4),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x325aeb=a181_0x57e2d4,_0x2f8741=[];return _0x2f8741['push']('\x20\x20EXAMPLES'),_0x2f8741['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x325aeb(0xfc)),_0x2f8741[_0x325aeb(0xd5)](_0x325aeb(0xe8)+CLI_BIN_NAME+'\x20run\x20build'),_0x2f8741[_0x325aeb(0xd5)](_0x325aeb(0xe8)+CLI_BIN_NAME+'\x20run\x20preview'),_0x2f8741[_0x325aeb(0xd5)](_0x325aeb(0xe8)+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x2f8741[_0x325aeb(0xe2)]('\x0a');},async 'execute'(_0x68224b){const _0x59ae09=a181_0x57e2d4,_0x5a55c2=process[_0x59ae09(0xec)](),_0x5b99c3=_0x68224b[_0x59ae09(0xf9)][0x0],_0x5de2d5=_0x68224b[_0x59ae09(0xf9)][_0x59ae09(0xde)](0x1),_0x2cb56f=readPackageScripts(_0x5a55c2);if(!_0x2cb56f)throw CliErrors['validation'](_0x59ae09(0xeb));if(!_0x5b99c3){const _0x2e328b=Object[_0x59ae09(0xf7)](_0x2cb56f);if(_0x2e328b[_0x59ae09(0xdd)]===0x0)console[_0x59ae09(0xd6)]('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x59ae09(0xd6)](_0x59ae09(0xff));for(const _0x5726c2 of _0x2e328b){console[_0x59ae09(0xd6)](_0x59ae09(0xe8)+_0x5726c2);}console[_0x59ae09(0xd6)](_0x59ae09(0xd3)+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x2cb56f[_0x5b99c3])throw CliErrors[_0x59ae09(0xf2)]('Script\x20\x22'+_0x5b99c3+_0x59ae09(0xdf),_0x59ae09(0x101)+(Object[_0x59ae09(0xf7)](_0x2cb56f)['join'](',\x20')||_0x59ae09(0xd7)));const _0x44272d=detectPackageManager(_0x5a55c2);VERSION_CHECK_SCRIPTS['has'](_0x5b99c3)&&await versionCheck(_0x5a55c2);if(_0x5b99c3===_0x59ae09(0xfb)&&_0x68224b[_0x59ae09(0xdb)](_0x59ae09(0xe3)))return await Promise[_0x59ae09(0xd1)]([spawnViteBuildWatch(_0x5a55c2),spawnVitePreview(_0x5a55c2)]),{'ok':!![]};return await spawnScript(_0x44272d,_0x5b99c3,_0x5de2d5,_0x5a55c2),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a182_0x2bb6(_0x1e792e,_0x164f7f){_0x1e792e=_0x1e792e-0x1c0;const _0x238b96=a182_0x238b();let _0x2bb610=_0x238b96[_0x1e792e];return _0x2bb610;}const a182_0x3aae65=a182_0x2bb6;(function(_0x4d195c,_0x1fda32){const _0x2b2c86=a182_0x2bb6,_0x163855=_0x4d195c();while(!![]){try{const _0x19a38a=parseInt(_0x2b2c86(0x1c6))/0x1*(-parseInt(_0x2b2c86(0x1cf))/0x2)+parseInt(_0x2b2c86(0x1ca))/0x3*(parseInt(_0x2b2c86(0x1cd))/0x4)+-parseInt(_0x2b2c86(0x1c1))/0x5+-parseInt(_0x2b2c86(0x1cb))/0x6*(-parseInt(_0x2b2c86(0x1c5))/0x7)+parseInt(_0x2b2c86(0x1c0))/0x8+parseInt(_0x2b2c86(0x1c3))/0x9*(parseInt(_0x2b2c86(0x1d0))/0xa)+-parseInt(_0x2b2c86(0x1c4))/0xb*(parseInt(_0x2b2c86(0x1cc))/0xc);if(_0x19a38a===_0x1fda32)break;else _0x163855['push'](_0x163855['shift']());}catch(_0x35e1e3){_0x163855['push'](_0x163855['shift']());}}}(a182_0x238b,0xdaf50));import{buildSchemaPayload}from'../framework/schema-export.js';function a182_0x238b(){const _0xeeb9f6=['331790HEMRBA','5290760JORNhl','6437505heNdEV','export','441DwzmIK','176Dbfucp','239869AntJyV','25207VSLDdN','read','Export\x20machine-readable\x20command\x20schema\x20(JSON)','schema','232263SsougF','210aUhPbJ','1150776AYXklq','68snhGXE','json','86HRfJzn'];a182_0x238b=function(){return _0xeeb9f6;};return a182_0x238b();}async function execute(_0x2bca3b){const _0x44a5ef=await buildSchemaPayload();return{'ok':!![],'data':_0x44a5ef};}export const schemaDefinition={'service':a182_0x3aae65(0x1c9),'command':a182_0x3aae65(0x1c2),'description':a182_0x3aae65(0x1c8),'risk':a182_0x3aae65(0x1c7),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a182_0x3aae65(0x1ce),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a176_0xb697b2=a176_0xf1a1;(function(_0x9b77c7,_0x34e3d7){const _0x58ab31=a176_0xf1a1,_0x281983=_0x9b77c7();while(!![]){try{const _0x450c71=parseInt(_0x58ab31(0x193))/0x1+-parseInt(_0x58ab31(0x194))/0x2+parseInt(_0x58ab31(0x18c))/0x3+-parseInt(_0x58ab31(0x199))/0x4+parseInt(_0x58ab31(0x1a6))/0x5*(-parseInt(_0x58ab31(0x192))/0x6)+-parseInt(_0x58ab31(0x1be))/0x7+parseInt(_0x58ab31(0x1ca))/0x8;if(_0x450c71===_0x34e3d7)break;else _0x281983['push'](_0x281983['shift']());}catch(_0x2219b8){_0x281983['push'](_0x281983['shift']());}}}(a176_0x52b5,0x7ee0f));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';function a176_0xf1a1(_0x1a6c45,_0x254739){_0x1a6c45=_0x1a6c45-0x186;const _0x52b535=a176_0x52b5();let _0xf1a134=_0x52b535[_0x1a6c45];return _0xf1a134;}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(_0x15f9b0){const _0x2b8f54=a176_0xf1a1;if(_0x15f9b0===_0x2b8f54(0x18b))return[_0x2b8f54(0x1c2),'\x20\x20SELECT\x201\x20AS\x20id',_0x2b8f54(0x19c),''][_0x2b8f54(0x190)]('\x0a');return[_0x2b8f54(0x197),'']['join']('\x0a');}export const sqlCreate={'service':a176_0xb697b2(0x19a),'command':a176_0xb697b2(0x1c1),'description':a176_0xb697b2(0x198),'risk':a176_0xb697b2(0x18a),'flags':[{'name':a176_0xb697b2(0x188),'type':a176_0xb697b2(0x1a0),'description':a176_0xb697b2(0x1b8)},{'name':a176_0xb697b2(0x19d),'type':a176_0xb697b2(0x1b3),'description':a176_0xb697b2(0x1af)},{'name':a176_0xb697b2(0x1c5),'type':a176_0xb697b2(0x1a0),'enum':['sql',a176_0xb697b2(0x18b)],'description':a176_0xb697b2(0x186)}],async 'validate'(_0x120c46){const _0x17a877=a176_0xb697b2;if(!_0x120c46[_0x17a877(0x1c3)])return;if(!_0x120c46['str']('name')['trim']())throw CliErrors[_0x17a877(0x1a3)](_0x17a877(0x188),_0x17a877(0x1b7));const _0x1c8e20=resolveProvidedDbId(_0x120c46);if(typeof _0x1c8e20!==_0x17a877(0x1b3)||!Number[_0x17a877(0x1bb)](_0x1c8e20)||_0x1c8e20<=0x0)throw CliErrors[_0x17a877(0x1a3)](_0x17a877(0x19d),_0x17a877(0x1c8));if(!_0x120c46[_0x17a877(0x1a4)](_0x17a877(0x1c5))[_0x17a877(0x191)]())throw CliErrors[_0x17a877(0x1a3)](_0x17a877(0x1c5),_0x17a877(0x1a5));},async 'dryRun'(_0x3db762){const _0x3a3cf2=a176_0xb697b2,_0x3a9ca7=loadSqlProjectConfig(_0x3db762[_0x3a3cf2(0x19f)]),{sqlName:_0x49d839,dbId:_0x297502,dbName:_0x8c66ef,mode:_0x1d50e8}=await resolveSqlNewInputs(_0x3db762),_0x45581a=buildSqlRelativePath(_0x3a3cf2(0x18f),_0x49d839,_0x8c66ef,_0x1d50e8,_0x297502),_0x163405=_0x3a9ca7[_0x3a3cf2(0x189)]+'/'+_0x45581a;return{'method':'POST','url':_0x3a3cf2(0x1b9),'body':{'appCode':_0x3db762[_0x3a3cf2(0x19f)],'sqlName':_0x49d839,'dbId':_0x297502,'mode':_0x1d50e8,'localPath':_0x163405},'description':_0x3a3cf2(0x195)+_0x3a9ca7[_0x3a3cf2(0x189)]};},async 'execute'(_0x2e154b){const _0x1ac0c9=a176_0xb697b2,_0x1dc73f=loadSqlProjectConfig(_0x2e154b[_0x1ac0c9(0x19f)]),{sqlName:_0x3bf90a,dbId:_0x38a7c5,dbName:_0xeb1c7c,mode:_0x370ea9}=await resolveSqlNewInputs(_0x2e154b),_0x1f8a91=generateSqlTemplate(_0x370ea9),_0x40cfc0=await createSqlQuery({'appCode':_0x2e154b['appCode'],'sqlName':_0x3bf90a,'dbId':_0x38a7c5,'sqlContent':_0x1f8a91}),_0x325f09=ensureRemoteSqlContent(_0x40cfc0),_0x3b6413=_0xeb1c7c||await getDbName(_0x2e154b['appCode'],_0x38a7c5)['catch'](()=>undefined),_0x1a8596=buildSqlRelativePath(_0x40cfc0[_0x1ac0c9(0x187)],_0x40cfc0[_0x1ac0c9(0x1c9)],_0x3b6413,_0x370ea9,_0x38a7c5),_0x527b2d=_0x1dc73f[_0x1ac0c9(0x189)]+'/'+_0x1a8596,_0x5dee16=buildLocalSqlFileContent({'sqlCode':_0x40cfc0[_0x1ac0c9(0x187)],'sqlName':_0x40cfc0[_0x1ac0c9(0x1c9)],'dbId':_0x40cfc0[_0x1ac0c9(0x1b2)]},_0x325f09,{'dbName':_0x3b6413,'mode':_0x370ea9,'syncedAt':new Date()[_0x1ac0c9(0x1c4)](),'description':_0x40cfc0[_0x1ac0c9(0x1cb)]});if(await fileExists(_0x527b2d))throw CliErrors[_0x1ac0c9(0x1c6)](_0x1ac0c9(0x1a1)+_0x527b2d);await ensureParentDirectory(_0x527b2d),await writeFile(_0x527b2d,_0x5dee16,_0x1ac0c9(0x1b6));const _0x52a6a2=await readSqlLockFile(_0x1dc73f['lockFilePath']),{lockData:_0x1f01b7,appLock:_0x54993b}=ensureSqlLockScope(_0x52a6a2??createEmptySqlLock(),_0x1dc73f[_0x1ac0c9(0x19f)],_0x1dc73f[_0x1ac0c9(0x18e)],_0x1ac0c9(0x1b4));return _0x54993b[_0x1ac0c9(0x1aa)][_0x40cfc0[_0x1ac0c9(0x187)]]={...buildSqlLockEntry(_0x40cfc0,_0x325f09,computeSqlContentHash(_0x5dee16),{'dbName':_0x3b6413}),'path':_0x1a8596,'mode':_0x370ea9},_0x54993b[_0x1ac0c9(0x19b)]=new Date()[_0x1ac0c9(0x1c4)](),await writeSqlLockFile(_0x1dc73f['lockFilePath'],_0x1f01b7),{'ok':!![],'data':{'id':_0x40cfc0['id'],'sqlCode':_0x40cfc0[_0x1ac0c9(0x187)],'sqlName':_0x40cfc0[_0x1ac0c9(0x1c9)],'dbId':_0x40cfc0[_0x1ac0c9(0x1b2)],'path':_0x527b2d,'mode':_0x370ea9},'message':'Created\x20SQL\x20query\x20'+_0x40cfc0[_0x1ac0c9(0x187)]};}};async function resolveSqlNewInputs(_0x22e6fa){const _0x14f04d=await resolveSqlNameInput(_0x22e6fa),{dbId:_0x14780c,dbName:_0x17b447}=await resolveDbSelection(_0x22e6fa),_0x256307=await resolveSqlModeInput(_0x22e6fa);return{'sqlName':_0x14f04d,'dbId':_0x14780c,'dbName':_0x17b447,'mode':_0x256307};}function a176_0x52b5(){const _0x2ea6ef=['普通\x20SQL(sql)','SELECT\x201\x20AS\x20id;','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','3009376AHasvo','sql','lastSync','</select>','db-id','length','appCode','string','File\x20already\x20exists:\x20','isInteger','flagMissing','str','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','5yaOZHi','stringify','SQL\x20名称不能为空','flag','sqls','parse','请输入\x20SQL\x20名称:','适合带动态标签的\x20MyBatis\x20XML\x20SQL','MyBatis\x20XML(mybatisXml)','Target\x20database\x20ID','dbName','Invalid\x20database\x20selection\x20payload:\x20','dbId','number','new','dbId\x20必须为正整数','utf8','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20query\x20display\x20name','/smartapi/custom/saveUserCustomSql','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','isFinite','请输入目标数据库\x20dbId:','✎\x20手动输入\x20dbId','1266384aGszpK','请选择目标数据库:','map','create','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','nonInteractive','toISOString','mode','validation','catch','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlName','16002368oXblru','description','Local\x20SQL\x20file\x20mode','sqlCode','name','sqlRootDir','high-risk-write','mybatisXml','1594032HguBff','请选择本地\x20SQL\x20模式:','sqlRoot','<server-generated-sqlCode>','join','trim','5183778vWsXHb','818614tmbygO','2066680EoZWeM','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'];a176_0x52b5=function(){return _0x2ea6ef;};return a176_0x52b5();}async function resolveSqlNameInput(_0x10a0cf){const _0x16ec75=a176_0xb697b2,_0x53391e=_0x10a0cf[_0x16ec75(0x1a4)](_0x16ec75(0x188))['trim']();if(_0x53391e)return _0x53391e;if(_0x10a0cf[_0x16ec75(0x1c3)])throw CliErrors[_0x16ec75(0x1a3)](_0x16ec75(0x188),_0x16ec75(0x1b7));return(await input({'message':_0x16ec75(0x1ac),'validate':_0x2ab96f=>_0x2ab96f['trim']()?!![]:_0x16ec75(0x1a8)}))[_0x16ec75(0x191)]();}async function resolveDbSelection(_0x2cee87){const _0x370d2e=a176_0xb697b2,_0x17868f=resolveProvidedDbId(_0x2cee87);if(typeof _0x17868f==='number'&&Number[_0x370d2e(0x1bb)](_0x17868f)&&_0x17868f>0x0)return{'dbId':_0x17868f,'dbName':await getDbName(_0x2cee87[_0x370d2e(0x19f)],_0x17868f)[_0x370d2e(0x1c7)](()=>undefined)};if(_0x2cee87['nonInteractive'])throw CliErrors[_0x370d2e(0x1a3)]('db-id',_0x370d2e(0x1c8));const _0x3475c7=await listDatabases(_0x2cee87['appCode'])[_0x370d2e(0x1c7)](()=>[]);if(_0x3475c7['length']===0x1)return{'dbId':_0x3475c7[0x0][_0x370d2e(0x1b2)],'dbName':_0x3475c7[0x0][_0x370d2e(0x1b0)]};if(_0x3475c7[_0x370d2e(0x19e)]>0x1){const _0x943d1b=await select({'message':_0x370d2e(0x1bf),'choices':[..._0x3475c7[_0x370d2e(0x1c0)](_0x29e296=>({'name':_0x29e296[_0x370d2e(0x1b0)]+'\x20('+_0x29e296[_0x370d2e(0x1b2)]+')','value':serializeDbSelection(_0x29e296)})),{'name':_0x370d2e(0x1bd),'value':'__manual__'}]});if(_0x943d1b!=='__manual__')return deserializeDbSelection(_0x943d1b);}const _0x543494=await input({'message':_0x370d2e(0x1bc),'validate':_0x4c4a9d=>{const _0x168425=_0x370d2e,_0x1e3600=_0x4c4a9d[_0x168425(0x191)]();if(!_0x1e3600)return'dbId\x20不能为空';const _0x485fe0=Number(_0x1e3600);if(!Number[_0x168425(0x1a2)](_0x485fe0)||_0x485fe0<=0x0)return _0x168425(0x1b5);return!![];}});return{'dbId':Number(_0x543494[_0x370d2e(0x191)]())};}async function resolveSqlModeInput(_0x278ab5){const _0x2340f4=a176_0xb697b2,_0x15cd34=_0x278ab5[_0x2340f4(0x1a4)](_0x2340f4(0x1c5))[_0x2340f4(0x191)]();if(_0x15cd34==='sql'||_0x15cd34===_0x2340f4(0x18b))return _0x15cd34;if(_0x278ab5[_0x2340f4(0x1c3)])throw CliErrors[_0x2340f4(0x1a3)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x2340f4(0x18d),'choices':[{'name':_0x2340f4(0x196),'value':_0x2340f4(0x19a),'description':_0x2340f4(0x1ba)},{'name':_0x2340f4(0x1ae),'value':_0x2340f4(0x18b),'description':_0x2340f4(0x1ad)}]});}function serializeDbSelection(_0x2f01e5){const _0x3954d0=a176_0xb697b2;return JSON[_0x3954d0(0x1a7)]({'dbId':_0x2f01e5['dbId'],'dbName':_0x2f01e5[_0x3954d0(0x1b0)]});}function deserializeDbSelection(_0x55b186){const _0xb01455=a176_0xb697b2;try{const _0x4ef6e6=JSON[_0xb01455(0x1ab)](_0x55b186);if(typeof _0x4ef6e6[_0xb01455(0x1b2)]===_0xb01455(0x1b3)&&Number[_0xb01455(0x1bb)](_0x4ef6e6[_0xb01455(0x1b2)]))return{'dbId':_0x4ef6e6[_0xb01455(0x1b2)],'dbName':_0x4ef6e6[_0xb01455(0x1b0)]};}catch{}throw CliErrors[_0xb01455(0x1c6)](_0xb01455(0x1b1)+_0x55b186);}function resolveProvidedDbId(_0x21a341){const _0x681269=a176_0xb697b2,_0x3e650f=_0x21a341[_0x681269(0x1a9)](_0x681269(0x19d));if(typeof _0x3e650f===_0x681269(0x1b3)&&Number[_0x681269(0x1bb)](_0x3e650f))return _0x3e650f;return undefined;}
|
|
1
|
+
const a183_0x373880=a183_0x568a;(function(_0x15ce12,_0x119e28){const _0x1e82a1=a183_0x568a,_0x542c17=_0x15ce12();while(!![]){try{const _0x59bb4d=-parseInt(_0x1e82a1(0xdd))/0x1+-parseInt(_0x1e82a1(0xc9))/0x2*(-parseInt(_0x1e82a1(0xbe))/0x3)+-parseInt(_0x1e82a1(0xd1))/0x4*(parseInt(_0x1e82a1(0xe2))/0x5)+-parseInt(_0x1e82a1(0xd3))/0x6+parseInt(_0x1e82a1(0xf1))/0x7*(-parseInt(_0x1e82a1(0xf5))/0x8)+parseInt(_0x1e82a1(0xe4))/0x9+-parseInt(_0x1e82a1(0xb4))/0xa*(-parseInt(_0x1e82a1(0xbf))/0xb);if(_0x59bb4d===_0x119e28)break;else _0x542c17['push'](_0x542c17['shift']());}catch(_0x1a8a0c){_0x542c17['push'](_0x542c17['shift']());}}}(a183_0x53aa,0x1ce60));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';function a183_0x568a(_0x27f783,_0x290823){_0x27f783=_0x27f783-0xb1;const _0x53aaea=a183_0x53aa();let _0x568a7e=_0x53aaea[_0x27f783];return _0x568a7e;}import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function a183_0x53aa(){const _0x5cd5d7=['SQL\x20query\x20display\x20name','create','请选择目标数据库:','Created\x20SQL\x20query\x20','普通\x20SQL(sql)','dbId\x20不能为空','56UjJTAt','isInteger','556296jRiDxr','Target\x20database\x20ID','__manual__','trim','join','适合带动态标签的\x20MyBatis\x20XML\x20SQL','new','stringify','\x20\x20SELECT\x201\x20AS\x20id','validation','129416DZusaf','mode','string','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','mybatisXml','63955EuXOuG','<server-generated-sqlCode>','564300wgpKyj','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','请选择本地\x20SQL\x20模式:','nonInteractive','name','sqlRootDir','appCode','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','high-risk-write','Invalid\x20database\x20selection\x20payload:\x20','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','isFinite','map','14ieWFlW','sqlCode','number','parse','57584PiLVeq','请输入目标数据库\x20dbId:','/smartapi/custom/saveUserCustomSql','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','4502890yegsJw','Local\x20SQL\x20file\x20mode','catch','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','lockFilePath','flag','SQL\x20名称不能为空','sqlName','POST','sql','3FMVpOK','11epxqlg','toISOString','flagMissing','✎\x20手动输入\x20dbId','dbName','db-id','请输入\x20SQL\x20名称:','length','str','dbId','41962TOoXjj','description'];a183_0x53aa=function(){return _0x5cd5d7;};return a183_0x53aa();}function generateSqlTemplate(_0x4e4e5f){const _0x51f809=a183_0x568a;if(_0x4e4e5f==='mybatisXml')return[_0x51f809(0xeb),_0x51f809(0xdb),'</select>','']['join']('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x51f809(0xd7)]('\x0a');}export const sqlCreate={'service':'sql','command':a183_0x373880(0xcc),'description':a183_0x373880(0xe5),'risk':a183_0x373880(0xec),'flags':[{'name':'name','type':a183_0x373880(0xdf),'description':a183_0x373880(0xcb)},{'name':a183_0x373880(0xc4),'type':a183_0x373880(0xf3),'description':a183_0x373880(0xd4)},{'name':a183_0x373880(0xde),'type':a183_0x373880(0xdf),'enum':[a183_0x373880(0xbd),a183_0x373880(0xe1)],'description':a183_0x373880(0xb5)}],async 'validate'(_0x5bf12f){const _0x252002=a183_0x373880;if(!_0x5bf12f['nonInteractive'])return;if(!_0x5bf12f[_0x252002(0xc7)]('name')[_0x252002(0xd6)]())throw CliErrors['flagMissing'](_0x252002(0xe8),_0x252002(0xe0));const _0x1bff76=resolveProvidedDbId(_0x5bf12f);if(typeof _0x1bff76!==_0x252002(0xf3)||!Number[_0x252002(0xef)](_0x1bff76)||_0x1bff76<=0x0)throw CliErrors['flagMissing'](_0x252002(0xc4),_0x252002(0xb3));if(!_0x5bf12f[_0x252002(0xc7)](_0x252002(0xde))[_0x252002(0xd6)]())throw CliErrors[_0x252002(0xc1)](_0x252002(0xde),_0x252002(0xb7));},async 'dryRun'(_0xebde2c){const _0x11b8e0=a183_0x373880,_0x389d85=loadSqlProjectConfig(_0xebde2c[_0x11b8e0(0xea)]),{sqlName:_0x46ac1b,dbId:_0x333fd0,dbName:_0x331c43,mode:_0xfdea48}=await resolveSqlNewInputs(_0xebde2c),_0x2d9a8b=buildSqlRelativePath(_0x11b8e0(0xe3),_0x46ac1b,_0x331c43,_0xfdea48,_0x333fd0),_0x15bf44=_0x389d85['sqlRootDir']+'/'+_0x2d9a8b;return{'method':_0x11b8e0(0xbc),'url':_0x11b8e0(0xb2),'body':{'appCode':_0xebde2c[_0x11b8e0(0xea)],'sqlName':_0x46ac1b,'dbId':_0x333fd0,'mode':_0xfdea48,'localPath':_0x15bf44},'description':_0x11b8e0(0xee)+_0x389d85[_0x11b8e0(0xe9)]};},async 'execute'(_0x5a62df){const _0x28ece5=a183_0x373880,_0x4890a8=loadSqlProjectConfig(_0x5a62df[_0x28ece5(0xea)]),{sqlName:_0x4eb12b,dbId:_0x33ec5f,dbName:_0x128ecf,mode:_0x4ad584}=await resolveSqlNewInputs(_0x5a62df),_0x2625e8=generateSqlTemplate(_0x4ad584),_0x1fd3a6=await createSqlQuery({'appCode':_0x5a62df[_0x28ece5(0xea)],'sqlName':_0x4eb12b,'dbId':_0x33ec5f,'sqlContent':_0x2625e8}),_0x2df91f=ensureRemoteSqlContent(_0x1fd3a6),_0x51a636=_0x128ecf||await getDbName(_0x5a62df[_0x28ece5(0xea)],_0x33ec5f)[_0x28ece5(0xb6)](()=>undefined),_0x4a307b=buildSqlRelativePath(_0x1fd3a6[_0x28ece5(0xf2)],_0x1fd3a6[_0x28ece5(0xbb)],_0x51a636,_0x4ad584,_0x33ec5f),_0xd2b6aa=_0x4890a8['sqlRootDir']+'/'+_0x4a307b,_0x5ca069=buildLocalSqlFileContent({'sqlCode':_0x1fd3a6[_0x28ece5(0xf2)],'sqlName':_0x1fd3a6[_0x28ece5(0xbb)],'dbId':_0x1fd3a6[_0x28ece5(0xc8)]},_0x2df91f,{'dbName':_0x51a636,'mode':_0x4ad584,'syncedAt':new Date()[_0x28ece5(0xc0)](),'description':_0x1fd3a6[_0x28ece5(0xca)]});if(await fileExists(_0xd2b6aa))throw CliErrors[_0x28ece5(0xdc)]('File\x20already\x20exists:\x20'+_0xd2b6aa);await ensureParentDirectory(_0xd2b6aa),await writeFile(_0xd2b6aa,_0x5ca069,'utf8');const _0x42525e=await readSqlLockFile(_0x4890a8['lockFilePath']),{lockData:_0x4b9a2c,appLock:_0x4c558f}=ensureSqlLockScope(_0x42525e??createEmptySqlLock(),_0x4890a8['appCode'],_0x4890a8['sqlRoot'],_0x28ece5(0xd9));return _0x4c558f['sqls'][_0x1fd3a6['sqlCode']]={...buildSqlLockEntry(_0x1fd3a6,_0x2df91f,computeSqlContentHash(_0x5ca069),{'dbName':_0x51a636}),'path':_0x4a307b,'mode':_0x4ad584},_0x4c558f['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x4890a8[_0x28ece5(0xb8)],_0x4b9a2c),{'ok':!![],'data':{'id':_0x1fd3a6['id'],'sqlCode':_0x1fd3a6[_0x28ece5(0xf2)],'sqlName':_0x1fd3a6[_0x28ece5(0xbb)],'dbId':_0x1fd3a6['dbId'],'path':_0xd2b6aa,'mode':_0x4ad584},'message':_0x28ece5(0xce)+_0x1fd3a6[_0x28ece5(0xf2)]};}};async function resolveSqlNewInputs(_0x23007d){const _0x655c33=await resolveSqlNameInput(_0x23007d),{dbId:_0x375020,dbName:_0x3ef684}=await resolveDbSelection(_0x23007d),_0x6830c1=await resolveSqlModeInput(_0x23007d);return{'sqlName':_0x655c33,'dbId':_0x375020,'dbName':_0x3ef684,'mode':_0x6830c1};}async function resolveSqlNameInput(_0xa69dd5){const _0xdaa0f4=a183_0x373880,_0x8d3fda=_0xa69dd5[_0xdaa0f4(0xc7)](_0xdaa0f4(0xe8))[_0xdaa0f4(0xd6)]();if(_0x8d3fda)return _0x8d3fda;if(_0xa69dd5[_0xdaa0f4(0xe7)])throw CliErrors[_0xdaa0f4(0xc1)](_0xdaa0f4(0xe8),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0xdaa0f4(0xc5),'validate':_0x3d49f2=>_0x3d49f2[_0xdaa0f4(0xd6)]()?!![]:_0xdaa0f4(0xba)}))['trim']();}async function resolveDbSelection(_0x118f4c){const _0x348643=a183_0x373880,_0x5764f7=resolveProvidedDbId(_0x118f4c);if(typeof _0x5764f7===_0x348643(0xf3)&&Number[_0x348643(0xef)](_0x5764f7)&&_0x5764f7>0x0)return{'dbId':_0x5764f7,'dbName':await getDbName(_0x118f4c[_0x348643(0xea)],_0x5764f7)[_0x348643(0xb6)](()=>undefined)};if(_0x118f4c['nonInteractive'])throw CliErrors[_0x348643(0xc1)](_0x348643(0xc4),_0x348643(0xb3));const _0x3619ec=await listDatabases(_0x118f4c['appCode'])[_0x348643(0xb6)](()=>[]);if(_0x3619ec[_0x348643(0xc6)]===0x1)return{'dbId':_0x3619ec[0x0][_0x348643(0xc8)],'dbName':_0x3619ec[0x0]['dbName']};if(_0x3619ec[_0x348643(0xc6)]>0x1){const _0x27c866=await select({'message':_0x348643(0xcd),'choices':[..._0x3619ec[_0x348643(0xf0)](_0x674670=>({'name':_0x674670['dbName']+'\x20('+_0x674670['dbId']+')','value':serializeDbSelection(_0x674670)})),{'name':_0x348643(0xc2),'value':_0x348643(0xd5)}]});if(_0x27c866!==_0x348643(0xd5))return deserializeDbSelection(_0x27c866);}const _0x44cd28=await input({'message':_0x348643(0xb1),'validate':_0x2e5b6a=>{const _0x3a9d81=_0x348643,_0x33c56b=_0x2e5b6a['trim']();if(!_0x33c56b)return _0x3a9d81(0xd0);const _0x36c5dd=Number(_0x33c56b);if(!Number[_0x3a9d81(0xd2)](_0x36c5dd)||_0x36c5dd<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x44cd28[_0x348643(0xd6)]())};}async function resolveSqlModeInput(_0x5bfd9b){const _0x52af7a=a183_0x373880,_0x2fbaa2=_0x5bfd9b[_0x52af7a(0xc7)](_0x52af7a(0xde))['trim']();if(_0x2fbaa2===_0x52af7a(0xbd)||_0x2fbaa2===_0x52af7a(0xe1))return _0x2fbaa2;if(_0x5bfd9b[_0x52af7a(0xe7)])throw CliErrors[_0x52af7a(0xc1)](_0x52af7a(0xde),_0x52af7a(0xb7));return await select({'message':_0x52af7a(0xe6),'choices':[{'name':_0x52af7a(0xcf),'value':'sql','description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':'MyBatis\x20XML(mybatisXml)','value':_0x52af7a(0xe1),'description':_0x52af7a(0xd8)}]});}function serializeDbSelection(_0x22437e){const _0x5c3e2d=a183_0x373880;return JSON[_0x5c3e2d(0xda)]({'dbId':_0x22437e[_0x5c3e2d(0xc8)],'dbName':_0x22437e[_0x5c3e2d(0xc3)]});}function deserializeDbSelection(_0x4e2c40){const _0x14a863=a183_0x373880;try{const _0x14142d=JSON[_0x14a863(0xf4)](_0x4e2c40);if(typeof _0x14142d[_0x14a863(0xc8)]===_0x14a863(0xf3)&&Number['isFinite'](_0x14142d[_0x14a863(0xc8)]))return{'dbId':_0x14142d[_0x14a863(0xc8)],'dbName':_0x14142d[_0x14a863(0xc3)]};}catch{}throw CliErrors['validation'](_0x14a863(0xed)+_0x4e2c40);}function resolveProvidedDbId(_0x1d99c0){const _0x2dcf1c=a183_0x373880,_0x465d14=_0x1d99c0[_0x2dcf1c(0xb9)](_0x2dcf1c(0xc4));if(typeof _0x465d14===_0x2dcf1c(0xf3)&&Number[_0x2dcf1c(0xef)](_0x465d14))return _0x465d14;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a184_0xd07327=a184_0x4dd2;(function(_0x18fb2b,_0xec9754){const _0x535ad2=a184_0x4dd2,_0x165ef3=_0x18fb2b();while(!![]){try{const _0x58c28e=-parseInt(_0x535ad2(0x10c))/0x1+parseInt(_0x535ad2(0xff))/0x2*(-parseInt(_0x535ad2(0x11b))/0x3)+-parseInt(_0x535ad2(0x105))/0x4*(parseInt(_0x535ad2(0x116))/0x5)+parseInt(_0x535ad2(0x100))/0x6+parseInt(_0x535ad2(0xf8))/0x7+-parseInt(_0x535ad2(0x114))/0x8*(-parseInt(_0x535ad2(0x119))/0x9)+parseInt(_0x535ad2(0xfa))/0xa;if(_0x58c28e===_0xec9754)break;else _0x165ef3['push'](_0x165ef3['shift']());}catch(_0x3a013a){_0x165ef3['push'](_0x165ef3['shift']());}}}(a184_0x3f41,0x210df));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a184_0xd07327(0x102),'command':a184_0xd07327(0x117),'description':a184_0xd07327(0x106),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x385f87){const _0x1aeb65=a184_0xd07327,_0x269983=loadSqlProjectConfig(_0x385f87[_0x1aeb65(0x10f)]),_0x220381=await readSqlLockFile(_0x269983[_0x1aeb65(0x112)]);if(!_0x220381)throw CliErrors[_0x1aeb65(0x115)](_0x1aeb65(0x101));},async 'dryRun'(_0x423cf9){const _0x1e01c5=a184_0xd07327,_0x3ee0d=loadSqlProjectConfig(_0x423cf9[_0x1e01c5(0x10f)]),_0x330e37=await readSqlLockFile(_0x3ee0d[_0x1e01c5(0x112)]);if(!_0x330e37)throw CliErrors[_0x1e01c5(0x115)](_0x1e01c5(0x101));const {appLock:_0x752c4e}=ensureSqlLockScope(_0x330e37,_0x423cf9[_0x1e01c5(0x10f)],_0x3ee0d[_0x1e01c5(0xf4)],_0x1e01c5(0x117)),_0x876e18=_0x423cf9[_0x1e01c5(0xfc)]('sqlcode'),_0x3d0352=_0x752c4e[_0x1e01c5(0xfd)][_0x876e18];if(!_0x3d0352)throw CliErrors[_0x1e01c5(0x115)](_0x1e01c5(0x118)+_0x876e18+'\x22.');return{'method':_0x1e01c5(0x108),'url':_0x1e01c5(0x10d),'body':{'sqlCode':_0x876e18,'id':_0x3d0352[_0x1e01c5(0x11a)],'localPath':resolveLocalSqlFilePath(_0x3ee0d,_0x876e18,_0x3d0352)},'description':_0x1e01c5(0x103)+_0x876e18+_0x1e01c5(0xfb)+_0x3ee0d[_0x1e01c5(0x11d)]};},async 'execute'(_0x505595){const _0x2e401f=a184_0xd07327,_0x1acd6=loadSqlProjectConfig(_0x505595[_0x2e401f(0x10f)]),_0x112f56=await readSqlLockFile(_0x1acd6['lockFilePath']);if(!_0x112f56)throw CliErrors[_0x2e401f(0x115)](_0x2e401f(0x10e));const {lockData:_0x2b1408,appLock:_0x1b05f6}=ensureSqlLockScope(_0x112f56,_0x505595[_0x2e401f(0x10f)],_0x1acd6[_0x2e401f(0xf4)],'delete'),_0x42a3e7=_0x505595[_0x2e401f(0xfc)](_0x2e401f(0x10b)),_0x3c1378=_0x1b05f6['sqls'][_0x42a3e7];if(!_0x3c1378)throw CliErrors[_0x2e401f(0x115)](_0x2e401f(0x118)+_0x42a3e7+'\x22.');await deleteSqlQuery({'id':_0x3c1378[_0x2e401f(0x11a)],'sqlCode':_0x42a3e7}),_0x1b05f6['sqls']=Object[_0x2e401f(0xf7)](Object[_0x2e401f(0x109)](_0x1b05f6[_0x2e401f(0xfd)])[_0x2e401f(0x104)](([_0x229763])=>_0x229763!==_0x42a3e7)),_0x1b05f6[_0x2e401f(0x107)]=new Date()[_0x2e401f(0x110)](),await writeSqlLockFile(_0x1acd6[_0x2e401f(0x112)],_0x2b1408);const _0xa873ef=resolveLocalSqlFilePath(_0x1acd6,_0x42a3e7,_0x3c1378);let _0x4a1052;await fileExists(_0xa873ef)&&(_0x4a1052=await moveToTrash(_0x1acd6[_0x2e401f(0x11c)],_0x1acd6[_0x2e401f(0x11d)],_0xa873ef),await cleanupEmptyDirectories(dirname(_0xa873ef),_0x1acd6[_0x2e401f(0xf5)]));const _0x28cbf6={'deleted':_0x42a3e7,'remoteId':_0x3c1378[_0x2e401f(0x11a)]};if(_0x4a1052)_0x28cbf6[_0x2e401f(0x113)]=_0x4a1052;return{'ok':!![],'data':_0x28cbf6,'message':_0x2e401f(0xfe)+_0x42a3e7+(_0x4a1052?_0x2e401f(0xf9):'')};}};async function moveToTrash(_0x1a668d,_0x3d6388,_0x3fad6c){const _0xf62b25=a184_0xd07327,_0x4036a7=new Date()[_0xf62b25(0x110)]()[_0xf62b25(0x111)](/[:.]/g,'-'),_0x361833=relative(_0x1a668d,_0x3fad6c),_0x4ce0a0=join(_0x3d6388,_0x4036a7,_0x361833);return await mkdir(dirname(_0x4ce0a0),{'recursive':!![]}),await rename(_0x3fad6c,_0x4ce0a0),_0x4ce0a0;}function a184_0x3f41(){const _0x1ecd3c=['delete','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','4473FlwlyN','remoteId','93NMmGFL','projectRoot','trashDir','sqlRoot','sqlRootDir','length','fromEntries','811657nbVPkb','\x20(local\x20file\x20moved\x20to\x20trash)','5076700rRdkrd','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','str','sqls','Deleted\x20','16402HlDdIx','1593330AJsImy','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','sql','Would\x20delete\x20SQL\x20','filter','48QFyfWZ','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','lastSync','POST','entries','startsWith','sqlcode','258935gyIojo','/smartapi/custom/deleteUserCustomSql','SQL\x20lock\x20file\x20not\x20found.','appCode','toISOString','replace','lockFilePath','trashedTo','8wBRCWp','validation','100465XgqOLr'];a184_0x3f41=function(){return _0x1ecd3c;};return a184_0x3f41();}function a184_0x4dd2(_0x533094,_0x5e7619){_0x533094=_0x533094-0xf4;const _0x3f410b=a184_0x3f41();let _0x4dd2ad=_0x3f410b[_0x533094];return _0x4dd2ad;}async function cleanupEmptyDirectories(_0x2ccbe2,_0x28d667){const _0x565fec=a184_0xd07327;let _0x3e452d=resolve(_0x2ccbe2);const _0xcd7509=resolve(_0x28d667);while(_0x3e452d[_0x565fec(0x10a)](''+_0xcd7509+sep)||_0x3e452d===_0xcd7509){if(_0x3e452d===_0xcd7509)return;try{const _0x14f4f1=await readdir(_0x3e452d);if(_0x14f4f1[_0x565fec(0xf6)]>0x0)return;await rmdir(_0x3e452d);}catch{return;}_0x3e452d=dirname(_0x3e452d);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a185_0xb38d(){const _0x348deb=['sqlcode','str','8152CCEKqN','verbose','boolean','read','sqlContent','693dCvVqj','3349535ZloKTx','11655936HdfPwD','dbId','description','4890592rUDiAY','appCode','sqlCode','3166796ETHLds','bool','264750LbptCW','sqlName','11025042beheVz','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode'];a185_0xb38d=function(){return _0x348deb;};return a185_0xb38d();}const a185_0x2689cd=a185_0x101e;(function(_0x53ada2,_0x2b9f14){const _0x3b3168=a185_0x101e,_0x26a7fd=_0x53ada2();while(!![]){try{const _0x1b6fd8=parseInt(_0x3b3168(0xba))/0x1+parseInt(_0x3b3168(0xb8))/0x2+parseInt(_0x3b3168(0xc5))/0x3*(-parseInt(_0x3b3168(0xc0))/0x4)+parseInt(_0x3b3168(0xc6))/0x5+-parseInt(_0x3b3168(0xbc))/0x6+-parseInt(_0x3b3168(0xca))/0x7+parseInt(_0x3b3168(0xc7))/0x8;if(_0x1b6fd8===_0x2b9f14)break;else _0x26a7fd['push'](_0x26a7fd['shift']());}catch(_0x14504b){_0x26a7fd['push'](_0x26a7fd['shift']());}}}(a185_0xb38d,0xec5aa));import{getSqlQueryInfo}from'../../core/api-client.js';function a185_0x101e(_0x5de8ef,_0x4ba840){_0x5de8ef=_0x5de8ef-0xb8;const _0xb38d61=a185_0xb38d();let _0x101e67=_0xb38d61[_0x5de8ef];return _0x101e67;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':'detail','description':a185_0x2689cd(0xbd),'risk':a185_0x2689cd(0xc3),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a185_0x2689cd(0xc2),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0xc57559){const _0x35a488=a185_0x2689cd,_0x3e0c96=await getSqlQueryInfo(_0xc57559[_0x35a488(0xcb)],_0xc57559[_0x35a488(0xbf)](_0x35a488(0xbe))),_0x2c1beb=_0xc57559[_0x35a488(0xb9)](_0x35a488(0xc1));if(_0x2c1beb)return{'ok':!![],'data':_0x3e0c96};const _0x5a4ada=_0x3e0c96[_0x35a488(0xc8)]?await getDbName(_0xc57559[_0x35a488(0xcb)],_0x3e0c96[_0x35a488(0xc8)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x3e0c96[_0x35a488(0xcc)],'sqlName':_0x3e0c96[_0x35a488(0xbb)],'db':_0x5a4ada?_0x5a4ada+'\x20('+_0x3e0c96['dbId']+')':_0x3e0c96['dbId']??'','description':_0x3e0c96[_0x35a488(0xc9)]??'','sqlContent':_0x3e0c96[_0x35a488(0xc4)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a186_0x502eb4=a186_0x202d;(function(_0x2f8e83,_0x80730b){const _0x263408=a186_0x202d,_0x247552=_0x2f8e83();while(!![]){try{const _0x1cbcdb=parseInt(_0x263408(0x190))/0x1+parseInt(_0x263408(0x187))/0x2*(-parseInt(_0x263408(0x191))/0x3)+-parseInt(_0x263408(0x199))/0x4+parseInt(_0x263408(0x19c))/0x5*(parseInt(_0x263408(0x19f))/0x6)+parseInt(_0x263408(0x18b))/0x7*(parseInt(_0x263408(0x189))/0x8)+-parseInt(_0x263408(0x18e))/0x9*(-parseInt(_0x263408(0x195))/0xa)+-parseInt(_0x263408(0x198))/0xb*(-parseInt(_0x263408(0x188))/0xc);if(_0x1cbcdb===_0x80730b)break;else _0x247552['push'](_0x247552['shift']());}catch(_0x164035){_0x247552['push'](_0x247552['shift']());}}}(a186_0x4469,0x1d789));import{executeSql}from'../../core/api-client.js';function a186_0x202d(_0x2605da,_0xed58a8){_0x2605da=_0x2605da-0x185;const _0x44698f=a186_0x4469();let _0x202d0f=_0x44698f[_0x2605da];return _0x202d0f;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a186_0x502eb4(0x185),'command':a186_0x502eb4(0x194),'description':a186_0x502eb4(0x192),'risk':'read','flags':[SQLCODE_FLAG,{'name':a186_0x502eb4(0x18d),'type':'string','description':a186_0x502eb4(0x19b)}],async 'execute'(_0x33bfc8){const _0xe5f694=a186_0x502eb4,_0x4ab67f=parseJsonParams(_0x33bfc8[_0xe5f694(0x18a)]('params')),_0x8a1e28=Date[_0xe5f694(0x197)](),_0x53c5c1=await executeSql(_0x33bfc8[_0xe5f694(0x186)],_0x33bfc8[_0xe5f694(0x18a)](_0xe5f694(0x19d)),_0x4ab67f),_0x4d1593=Date[_0xe5f694(0x197)]()-_0x8a1e28,_0x45e477=_0x53c5c1?.[_0xe5f694(0x193)]??_0x53c5c1,_0x1a4740=_0x53c5c1?.[_0xe5f694(0x196)]??!![];if(!_0x1a4740)return{'ok':![],'data':{'error':_0x53c5c1?.['execError']||'SQL\x20execution\x20failed','elapsed':_0x4d1593},'message':_0xe5f694(0x19a)};const _0x1de053=Array[_0xe5f694(0x19e)](_0x45e477)?_0x45e477:[];return{'ok':!![],'data':{'rows':_0x1de053,'rowCount':_0x1de053[_0xe5f694(0x18f)],'elapsed':_0x4d1593},'message':'Returned\x20'+_0x1de053['length']+_0xe5f694(0x18c)+_0x4d1593+'ms'};}};function a186_0x4469(){const _0x1afbe1=['88649pTQGBH','6FnWBEd','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','execResult','exec','185520uLcGHT','execSuccess','now','12617ESSVFx','828876ykdEeM','SQL\x20execution\x20failed','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','10hkJTNv','sqlcode','isArray','306618AnOzvo','sql','appCode','140558WBHNLA','552MGQLrl','1205320xkvfRj','str','7AVaZnN','\x20row(s)\x20in\x20','params','36tGhwpS','length'];a186_0x4469=function(){return _0x1afbe1;};return a186_0x4469();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x36011b,_0x5f475a){const _0x26f8af=a187_0x320b,_0x541b4e=_0x36011b();while(!![]){try{const _0x2774ae=-parseInt(_0x26f8af(0x1ed))/0x1+parseInt(_0x26f8af(0x1e4))/0x2*(-parseInt(_0x26f8af(0x1e5))/0x3)+parseInt(_0x26f8af(0x1eb))/0x4*(-parseInt(_0x26f8af(0x1e7))/0x5)+-parseInt(_0x26f8af(0x1e6))/0x6*(parseInt(_0x26f8af(0x1e8))/0x7)+-parseInt(_0x26f8af(0x1ee))/0x8+-parseInt(_0x26f8af(0x1e9))/0x9*(parseInt(_0x26f8af(0x1ec))/0xa)+parseInt(_0x26f8af(0x1ea))/0xb;if(_0x2774ae===_0x5f475a)break;else _0x541b4e['push'](_0x541b4e['shift']());}catch(_0x41fc59){_0x541b4e['push'](_0x541b4e['shift']());}}}(a187_0x354d,0xb5b72));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';function a187_0x354d(){const _0x1304ca=['3845816vMqTlt','10qkrXZF','1146594RTcULf','3225056bvgOYZ','285986bRrkmT','3OvTKli','206358hDAltg','5abUmas','133DbkJbF','11246913JxPWIJ','58317633XriLdA'];a187_0x354d=function(){return _0x1304ca;};return a187_0x354d();}import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';function a187_0x320b(_0x588592,_0x190731){_0x588592=_0x588592-0x1e4;const _0x354dce=a187_0x354d();let _0x320bd4=_0x354dce[_0x588592];return _0x320bd4;}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 a188_0x24c434=a188_0x3288;(function(_0x53b86b,_0x3e25ff){const _0x43bbf9=a188_0x3288,_0x25ba2d=_0x53b86b();while(!![]){try{const _0x3231b4=-parseInt(_0x43bbf9(0xe3))/0x1+parseInt(_0x43bbf9(0xde))/0x2*(-parseInt(_0x43bbf9(0xe5))/0x3)+-parseInt(_0x43bbf9(0xf2))/0x4*(-parseInt(_0x43bbf9(0xfd))/0x5)+-parseInt(_0x43bbf9(0xe9))/0x6+parseInt(_0x43bbf9(0xf5))/0x7+parseInt(_0x43bbf9(0xe7))/0x8+parseInt(_0x43bbf9(0xf3))/0x9*(parseInt(_0x43bbf9(0xf0))/0xa);if(_0x3231b4===_0x3e25ff)break;else _0x25ba2d['push'](_0x25ba2d['shift']());}catch(_0x37ca29){_0x25ba2d['push'](_0x25ba2d['shift']());}}}(a188_0x5cdf,0x36453));function a188_0x3288(_0x19cbb0,_0x382839){_0x19cbb0=_0x19cbb0-0xd9;const _0x5cdf48=a188_0x5cdf();let _0x3288c5=_0x5cdf48[_0x19cbb0];return _0x3288c5;}import{listSqlQueries}from'../../core/api-client.js';function a188_0x5cdf(){const _0x2248d5=['dbId','224133HPHaBg','sql','1113728MGtJpK','page','1827810TKjlIo','verbose','name','pagesize','paging','bool','read','30bmepAs','map','20fXlmRh','1044279vbJlHO','totalCount','2326247PuYRLb','No\x20custom\x20SQL\x20queries\x20found.','Page\x20size','boolean','Filter\x20by\x20SQL\x20name','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','number','appCode','279050CfNdot','all','Page\x20number','length','tableData','num','4AnBOZs','List\x20custom\x20SQL\x20queries','description','\x20SQL\x20queries\x20(total:\x20','str','422332iOuRdQ'];a188_0x5cdf=function(){return _0x2248d5;};return a188_0x5cdf();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a188_0x24c434(0xe6),'command':'list','description':a188_0x24c434(0xdf),'risk':a188_0x24c434(0xef),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a188_0x24c434(0xeb),'type':'string','description':a188_0x24c434(0xf9)},{'name':a188_0x24c434(0xe8),'type':'number','description':a188_0x24c434(0xda),'default':0x1},{'name':a188_0x24c434(0xec),'type':a188_0x24c434(0xfb),'description':a188_0x24c434(0xf7)},{'name':a188_0x24c434(0xea),'type':a188_0x24c434(0xf8),'description':a188_0x24c434(0xfa)}],async 'execute'(_0x981ef){const _0x193195=a188_0x24c434,_0x2f3e80=await listSqlQueries(_0x981ef[_0x193195(0xfc)],{'sqlCode':_0x981ef[_0x193195(0xe2)]('sqlcode')||undefined,'sqlName':_0x981ef['str'](_0x193195(0xeb))||undefined,'currentPage':_0x981ef['num'](_0x193195(0xe8)),'pageSize':_0x981ef[_0x193195(0xdd)](_0x193195(0xec),0x32)}),_0x44c06a=_0x981ef[_0x193195(0xee)]('verbose'),_0x2486d4=_0x2f3e80[_0x193195(0xdc)]??[],_0xb34916=_0x2f3e80[_0x193195(0xed)]?.[_0x193195(0xf4)]??_0x2486d4[_0x193195(0xdb)];let _0x32855f;return _0x44c06a?_0x32855f=_0x2486d4:_0x32855f=await Promise[_0x193195(0xd9)](_0x2486d4[_0x193195(0xf1)](async _0x2a2404=>{const _0x2870e2=_0x193195;let _0x35b73b;try{_0x35b73b=_0x2a2404['dbId']?await getDbName(_0x981ef['appCode'],_0x2a2404[_0x2870e2(0xe4)]):undefined;}catch{}return{'sqlCode':_0x2a2404['sqlCode'],'sqlName':_0x2a2404['sqlName'],'description':_0x2a2404[_0x2870e2(0xe0)]??'','db':_0x35b73b?_0x35b73b+'\x20('+_0x2a2404[_0x2870e2(0xe4)]+')':_0x2a2404['dbId']??''};})),{'ok':!![],'data':_0x32855f,'message':_0x2486d4[_0x193195(0xdb)]===0x0?_0x193195(0xf6):'Found\x20'+_0x2486d4['length']+_0x193195(0xe1)+_0xb34916+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a182_0x2e485a=a182_0x403e;(function(_0xbd71d5,_0x1e9b94){const _0x393065=a182_0x403e,_0x227bbc=_0xbd71d5();while(!![]){try{const _0x1a76d7=parseInt(_0x393065(0x7c))/0x1+parseInt(_0x393065(0xa4))/0x2+-parseInt(_0x393065(0x6f))/0x3+-parseInt(_0x393065(0x8e))/0x4+-parseInt(_0x393065(0x72))/0x5*(parseInt(_0x393065(0x9c))/0x6)+-parseInt(_0x393065(0x93))/0x7*(parseInt(_0x393065(0x7f))/0x8)+parseInt(_0x393065(0x70))/0x9;if(_0x1a76d7===_0x1e9b94)break;else _0x227bbc['push'](_0x227bbc['shift']());}catch(_0x3caafd){_0x227bbc['push'](_0x227bbc['shift']());}}}(a182_0x14ee,0x8c272));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';function a182_0x403e(_0x10f54e,_0xc7ac3c){_0x10f54e=_0x10f54e-0x6f;const _0x14eebe=a182_0x14ee();let _0x403e5d=_0x14eebe[_0x10f54e];return _0x403e5d;}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x272168,_0x3391e1){const _0x2005b5=a182_0x403e,_0x27d3fd=[];let _0x2ddf56=0x1;while(!![]){const _0x49fa27=await listSqlQueries(_0x272168,{'currentPage':_0x2ddf56,'pageSize':PAGE_SIZE,'sqlCode':_0x3391e1[_0x2005b5(0xa0)],'sqlName':_0x3391e1[_0x2005b5(0x97)]}),_0x90ef51=_0x49fa27['tableData']??[];_0x27d3fd[_0x2005b5(0x75)](..._0x90ef51);if(_0x90ef51['length']===0x0)break;const _0x5c5aaf=_0x49fa27[_0x2005b5(0x87)]?.[_0x2005b5(0x83)];if(_0x5c5aaf!=null?_0x27d3fd[_0x2005b5(0xa5)]>=_0x5c5aaf:_0x90ef51[_0x2005b5(0xa5)]<PAGE_SIZE)break;_0x2ddf56++;}return _0x27d3fd;}async function ensureSqlContent(_0x2d2011){const _0x34557b=a182_0x403e;if(_0x2d2011['sqlContent']!=null&&String(_0x2d2011[_0x34557b(0x9f)])[_0x34557b(0xa5)]>0x0)return _0x2d2011;return getSqlQueryDetail(_0x2d2011['sqlCode']);}export const sqlPull={'service':'sql','command':'pull','description':a182_0x2e485a(0x82),'risk':a182_0x2e485a(0x96),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a182_0x2e485a(0x8d),'type':a182_0x2e485a(0x80),'description':a182_0x2e485a(0xa3)},{'name':'force','type':a182_0x2e485a(0xa2),'description':a182_0x2e485a(0x98)}],async 'dryRun'(_0x2f675b){const _0x334a7c=a182_0x2e485a,_0x2ad7e5=loadSqlProjectConfig(_0x2f675b['appCode']),_0x583d08=await readSqlLockFile(_0x2ad7e5[_0x334a7c(0xa9)]),{appLock:_0x52004e}=ensureSqlLockScope(_0x583d08??createEmptySqlLock(),_0x2ad7e5[_0x334a7c(0x7a)],_0x2ad7e5[_0x334a7c(0x89)],_0x334a7c(0x9e)),_0x130213=await fetchAllSqlQueries(_0x2f675b[_0x334a7c(0x7a)],{'sqlCode':_0x2f675b[_0x334a7c(0xa8)](_0x334a7c(0x8f))||undefined,'sqlName':_0x2f675b['str'](_0x334a7c(0x8d))||undefined}),_0x2525ff=[];for(const _0x161825 of _0x130213){const _0x24af3b=await ensureSqlContent(_0x161825),_0x168c19=ensureRemoteSqlContent(_0x24af3b),_0x44d256=detectModeFromSql(_0x24af3b),_0x2c7892=_0x24af3b['dbId']?await getDbName(_0x2f675b['appCode'],Number(_0x24af3b[_0x334a7c(0x76)]))['catch'](()=>undefined):undefined,_0x500b8d=buildLocalSqlFileContent({'sqlCode':_0x24af3b[_0x334a7c(0xa0)],'sqlName':_0x24af3b['sqlName'],'dbId':_0x24af3b[_0x334a7c(0x76)]},_0x168c19,{'dbName':_0x2c7892,'mode':_0x44d256,'syncedAt':new Date()[_0x334a7c(0x90)](),'description':_0x24af3b[_0x334a7c(0x79)]}),_0x4d17e0=buildSqlLockEntry(_0x24af3b,_0x168c19,'',{'dbName':_0x2c7892}),_0x1d7fb4=resolveLocalSqlFilePath(_0x2ad7e5,_0x24af3b[_0x334a7c(0xa0)],_0x4d17e0);let _0x3ea18a=_0x334a7c(0x94),_0x1c990d;if(await fileExists(_0x1d7fb4)){const _0x409aff=await readFile(_0x1d7fb4,'utf8');isEquivalentPulledSqlFile(_0x409aff,_0x500b8d,_0x44d256)?(_0x3ea18a='skipped',_0x1c990d=_0x334a7c(0x85)):(_0x3ea18a=_0x334a7c(0x78),_0x1c990d='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x2525ff[_0x334a7c(0x75)]({'sqlCode':_0x24af3b[_0x334a7c(0xa0)],'sqlName':_0x24af3b[_0x334a7c(0x97)],'filePath':_0x1d7fb4,'status':_0x3ea18a,'reason':_0x1c990d});}return{'method':_0x334a7c(0x71),'url':_0x334a7c(0x91),'body':{'appCode':_0x2f675b['appCode'],'sqlCode':_0x2f675b[_0x334a7c(0xa8)](_0x334a7c(0x8f))||null,'sqlName':_0x2f675b[_0x334a7c(0xa8)]('name')||null,'files':_0x2525ff},'description':_0x334a7c(0xa1)+_0x2525ff['length']+_0x334a7c(0x7b)+_0x2ad7e5[_0x334a7c(0x9d)]};},async 'execute'(_0x3f0d51){const _0x3d9f88=a182_0x2e485a,_0x8a1055=loadSqlProjectConfig(_0x3f0d51[_0x3d9f88(0x7a)]),_0x5e1c9b=await readSqlLockFile(_0x8a1055['lockFilePath']),{lockData:_0x51d927,appLock:_0x5f2e7c}=ensureSqlLockScope(_0x5e1c9b??createEmptySqlLock(),_0x8a1055['appCode'],_0x8a1055['sqlRoot'],_0x3d9f88(0x9e)),_0x12bc53=_0x3f0d51[_0x3d9f88(0x8a)](_0x3d9f88(0xa7)),_0x2748dd=await fetchAllSqlQueries(_0x3f0d51['appCode'],{'sqlCode':_0x3f0d51[_0x3d9f88(0xa8)](_0x3d9f88(0x8f))||undefined,'sqlName':_0x3f0d51[_0x3d9f88(0xa8)](_0x3d9f88(0x8d))||undefined});if(_0x2748dd['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x3d9f88(0x88)};const _0x29da81=[],_0xd6f846=[];for(const _0x153e1e of _0x2748dd){try{_0x29da81[_0x3d9f88(0x75)](await ensureSqlContent(_0x153e1e));}catch(_0x42f8df){_0xd6f846[_0x3d9f88(0x75)]({'sqlCode':_0x153e1e['sqlCode'],'error':_0x42f8df instanceof Error?_0x42f8df[_0x3d9f88(0x92)]:String(_0x42f8df)});}}if(_0x12bc53&&!_0x3f0d51[_0x3d9f88(0x86)]){let _0x49ee55=![];for(const _0x3481d9 of _0x29da81){const _0x51f803=detectModeFromSql(_0x3481d9),_0x548a71=_0x3481d9['dbId']?await getDbName(_0x3f0d51[_0x3d9f88(0x7a)],Number(_0x3481d9['dbId']))[_0x3d9f88(0x7e)](()=>undefined):undefined,_0xa92b25=buildLocalSqlFileContent({'sqlCode':_0x3481d9[_0x3d9f88(0xa0)],'sqlName':_0x3481d9['sqlName'],'dbId':_0x3481d9[_0x3d9f88(0x76)]},ensureRemoteSqlContent(_0x3481d9),{'dbName':_0x548a71,'mode':_0x51f803,'syncedAt':new Date()[_0x3d9f88(0x90)](),'description':_0x3481d9[_0x3d9f88(0x79)]}),_0x1ff8b0=resolveLocalSqlFilePath(_0x8a1055,_0x3481d9['sqlCode'],buildSqlLockEntry(_0x3481d9,ensureRemoteSqlContent(_0x3481d9),'',{'dbName':_0x548a71}));if(await fileExists(_0x1ff8b0)){const _0x47c9e3=await readFile(_0x1ff8b0,_0x3d9f88(0xaa));if(!isEquivalentPulledSqlFile(_0x47c9e3,_0xa92b25,_0x51f803)){_0x49ee55=!![];break;}}}if(_0x49ee55){const _0x250d62=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x250d62)throw CliErrors[_0x3d9f88(0x8b)](_0x3d9f88(0xab));}}const _0x48610e=cloneSqlLockData(_0x51d927),_0x4e4101=_0x48610e[_0x3d9f88(0x74)][_0x8a1055[_0x3d9f88(0x7a)]],_0x40f982=[],_0x535070=[];for(const _0x57ccb6 of _0x29da81){const _0x3b3dc9=_0x4e4101[_0x3d9f88(0x73)][_0x57ccb6[_0x3d9f88(0xa0)]],_0x81c6b0=ensureRemoteSqlContent(_0x57ccb6),_0x2f09d4=detectModeFromSql(_0x57ccb6),_0x530e16=_0x57ccb6[_0x3d9f88(0x76)]?await getDbName(_0x3f0d51[_0x3d9f88(0x7a)],Number(_0x57ccb6['dbId']))[_0x3d9f88(0x7e)](()=>undefined):undefined,_0x50a06a=buildLocalSqlFileContent({'sqlCode':_0x57ccb6[_0x3d9f88(0xa0)],'sqlName':_0x57ccb6[_0x3d9f88(0x97)],'dbId':_0x57ccb6[_0x3d9f88(0x76)]},_0x81c6b0,{'dbName':_0x530e16,'mode':_0x2f09d4,'syncedAt':new Date()[_0x3d9f88(0x90)](),'description':_0x57ccb6[_0x3d9f88(0x79)]}),_0x3f94cc=buildSqlLockEntry(_0x57ccb6,_0x81c6b0,computeSqlContentHash(_0x50a06a),{'dbName':_0x530e16}),_0x4db23b=_0x3f94cc[_0x3d9f88(0x84)],_0x23cc94=join(_0x8a1055[_0x3d9f88(0x9d)],_0x4db23b);try{if(await fileExists(_0x23cc94)){const _0x48f609=await readFile(_0x23cc94,_0x3d9f88(0xaa));if(isEquivalentPulledSqlFile(_0x48f609,_0x50a06a,_0x2f09d4)){_0x535070['push']({'sqlCode':_0x57ccb6['sqlCode'],'reason':_0x3d9f88(0x85)}),_0x4e4101[_0x3d9f88(0x73)][_0x57ccb6[_0x3d9f88(0xa0)]]={..._0x3f94cc,'hash':computeSqlContentHash(_0x48f609),'path':_0x4db23b};continue;}if(!_0x12bc53){_0x535070[_0x3d9f88(0x75)]({'sqlCode':_0x57ccb6[_0x3d9f88(0xa0)],'reason':_0x3d9f88(0x9a)});continue;}}const _0x5e5cc6=_0x3b3dc9?.[_0x3d9f88(0x84)]?join(_0x8a1055[_0x3d9f88(0x9d)],_0x3b3dc9[_0x3d9f88(0x84)]):undefined;_0x5e5cc6&&_0x5e5cc6!==_0x23cc94&&await fileExists(_0x5e5cc6)&&await rm(_0x5e5cc6,{'force':!![]}),await ensureParentDirectory(_0x23cc94),await writeFile(_0x23cc94,_0x50a06a,_0x3d9f88(0xaa)),_0x4e4101['sqls'][_0x57ccb6[_0x3d9f88(0xa0)]]={..._0x3f94cc,'path':_0x4db23b},_0x40f982[_0x3d9f88(0x75)]({'sqlCode':_0x57ccb6[_0x3d9f88(0xa0)],'filePath':_0x23cc94});}catch(_0x187cf0){_0xd6f846[_0x3d9f88(0x75)]({'sqlCode':_0x57ccb6['sqlCode'],'error':_0x187cf0 instanceof Error?_0x187cf0['message']:String(_0x187cf0)});}}return _0x4e4101[_0x3d9f88(0x81)]=new Date()[_0x3d9f88(0x90)](),await writeSqlLockFile(_0x8a1055[_0x3d9f88(0xa9)],_0x48610e),{'ok':_0xd6f846[_0x3d9f88(0xa5)]===0x0,'data':{'pulled':_0x40f982,'skipped':_0x535070,'failed':_0xd6f846},'message':_0x3d9f88(0x99)+_0x40f982['length']+'\x20written,\x20'+_0x535070[_0x3d9f88(0xa5)]+_0x3d9f88(0x7d)+_0xd6f846[_0x3d9f88(0xa5)]+'\x20failed'};}};function detectModeFromSql(_0x4c166c){const _0x4a604b=a182_0x2e485a,_0x24d8c7=ensureRemoteSqlContent(_0x4c166c),_0x4cc8d7=stripLocalSqlMetadata(_0x24d8c7,_0x4a604b(0x9b))['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x4a604b(0x77)](_0x4cc8d7))return _0x4a604b(0x9b);return'sql';}function isEquivalentPulledSqlFile(_0x3d44c8,_0x34966d,_0x7b008){return normalizePullComparableContent(_0x3d44c8,_0x7b008)===normalizePullComparableContent(_0x34966d,_0x7b008);}function normalizePullComparableContent(_0xf5ca09,_0x23b983){const _0x5b2e1a=a182_0x2e485a,_0x471f0b=_0xf5ca09[_0x5b2e1a(0xa6)](/\r\n/g,'\x0a')[_0x5b2e1a(0x8c)]('\x0a'),_0x4d4183=_0x471f0b['filter'](_0x6795e1=>!isSyncedAtMetadataLine(_0x6795e1,_0x23b983));return _0x4d4183[_0x5b2e1a(0x95)]('\x0a');}function a182_0x14ee(){const _0x315d3a=['utf8','Force\x20pull\x20cancelled.','2696736QhsMrE','21969234GdlXOp','POST','2155Icipbx','sqls','apps','push','dbId','test','conflict','description','appCode','\x20SQL\x20file(s)\x20into\x20','14833YrXEZm','\x20skipped,\x20','catch','24mbBjAK','string','lastSync','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','totalCount','path','unchanged','nonInteractive','paging','No\x20remote\x20SQL\x20queries\x20matched.','sqlRoot','bool','cancelled','split','name','3950172qFcVGn','sqlcode','toISOString','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','message','345562bccJgb','would_pull','join','write','sqlName','Force\x20overwrite\x20local\x20unsynced\x20changes','Pull\x20complete:\x20','local\x20differs\x20from\x20remote','mybatisXml','8958tESFBq','sqlRootDir','pull','sqlContent','sqlCode','Would\x20pull\x20','boolean','Filter\x20by\x20SQL\x20display\x20name','1592486RawrxV','length','replace','force','str','lockFilePath'];a182_0x14ee=function(){return _0x315d3a;};return a182_0x14ee();}function isSyncedAtMetadataLine(_0x524318,_0xb6045e){const _0x12890e=a182_0x2e485a;if(_0xb6045e===_0x12890e(0x9b))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x12890e(0x77)](_0x524318);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x524318);}
|
|
1
|
+
const a189_0xfc5292=a189_0x1942;(function(_0x2a3420,_0x49abae){const _0x120b15=a189_0x1942,_0x112651=_0x2a3420();while(!![]){try{const _0xfd418=parseInt(_0x120b15(0x173))/0x1*(-parseInt(_0x120b15(0x16f))/0x2)+-parseInt(_0x120b15(0x179))/0x3+parseInt(_0x120b15(0x160))/0x4+-parseInt(_0x120b15(0x164))/0x5*(parseInt(_0x120b15(0x195))/0x6)+parseInt(_0x120b15(0x172))/0x7+parseInt(_0x120b15(0x18f))/0x8+parseInt(_0x120b15(0x187))/0x9*(parseInt(_0x120b15(0x17e))/0xa);if(_0xfd418===_0x49abae)break;else _0x112651['push'](_0x112651['shift']());}catch(_0x4e07a0){_0x112651['push'](_0x112651['shift']());}}}(a189_0x1c40,0x7cc3d));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 a189_0x1942(_0x2fe7ac,_0x3d64cb){_0x2fe7ac=_0x2fe7ac-0x15e;const _0x1c4074=a189_0x1c40();let _0x1942b5=_0x1c4074[_0x2fe7ac];return _0x1942b5;}import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;function a189_0x1c40(){const _0x51e8c5=['nonInteractive','bool','message','Force\x20overwrite\x20local\x20unsynced\x20changes','pull','sqls','trimStart','paging','6qtkeLz','lockFilePath','utf8','829577EWNYLb','109206QqErZi','filter','mybatisXml','\x20failed','local\x20differs\x20from\x20remote','\x20written,\x20','1550052TTPSIB','appCode','Force\x20pull\x20cancelled.','str','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','31550eguPmC','would_pull','\x20skipped,\x20','lastSync','boolean','sqlCode','unchanged','Filter\x20by\x20SQL\x20display\x20name','sqlcode','117KGljDJ','join','totalCount','force','push','cancelled','length','No\x20remote\x20SQL\x20queries\x20matched.','6132944rVlrLt','name','POST','string','sqlContent','dbId','152694YIrzcn','catch','Pull\x20complete:\x20','sql','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','split','test','\x20SQL\x20file(s)\x20into\x20','sqlRoot','2022168FqILEq','sqlRootDir','description','sqlName','15tayjZR','toISOString','path'];a189_0x1c40=function(){return _0x51e8c5;};return a189_0x1c40();}async function fetchAllSqlQueries(_0x39aa12,_0x1e12ed){const _0x3db37c=a189_0x1942,_0x32eb3e=[];let _0x25fea1=0x1;while(!![]){const _0x5e34d2=await listSqlQueries(_0x39aa12,{'currentPage':_0x25fea1,'pageSize':PAGE_SIZE,'sqlCode':_0x1e12ed[_0x3db37c(0x183)],'sqlName':_0x1e12ed['sqlName']}),_0x235d85=_0x5e34d2['tableData']??[];_0x32eb3e[_0x3db37c(0x18b)](..._0x235d85);if(_0x235d85[_0x3db37c(0x18d)]===0x0)break;const _0x23338b=_0x5e34d2[_0x3db37c(0x16e)]?.[_0x3db37c(0x189)];if(_0x23338b!=null?_0x32eb3e[_0x3db37c(0x18d)]>=_0x23338b:_0x235d85['length']<PAGE_SIZE)break;_0x25fea1++;}return _0x32eb3e;}async function ensureSqlContent(_0x3fe760){const _0xd46102=a189_0x1942;if(_0x3fe760[_0xd46102(0x193)]!=null&&String(_0x3fe760['sqlContent'])[_0xd46102(0x18d)]>0x0)return _0x3fe760;return getSqlQueryDetail(_0x3fe760['sqlCode']);}export const sqlPull={'service':a189_0xfc5292(0x198),'command':a189_0xfc5292(0x16b),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a189_0xfc5292(0x190),'type':a189_0xfc5292(0x192),'description':a189_0xfc5292(0x185)},{'name':a189_0xfc5292(0x18a),'type':a189_0xfc5292(0x182),'description':a189_0xfc5292(0x16a)}],async 'dryRun'(_0x6bafba){const _0x4647f6=a189_0xfc5292,_0x5796da=loadSqlProjectConfig(_0x6bafba[_0x4647f6(0x17a)]),_0x44159b=await readSqlLockFile(_0x5796da[_0x4647f6(0x170)]),{appLock:_0x91a91b}=ensureSqlLockScope(_0x44159b??createEmptySqlLock(),_0x5796da[_0x4647f6(0x17a)],_0x5796da[_0x4647f6(0x15f)],_0x4647f6(0x16b)),_0x4e740=await fetchAllSqlQueries(_0x6bafba[_0x4647f6(0x17a)],{'sqlCode':_0x6bafba[_0x4647f6(0x17c)](_0x4647f6(0x186))||undefined,'sqlName':_0x6bafba['str'](_0x4647f6(0x190))||undefined}),_0x19044e=[];for(const _0xaf9f31 of _0x4e740){const _0x41b980=await ensureSqlContent(_0xaf9f31),_0x2d4bd9=ensureRemoteSqlContent(_0x41b980),_0xc900fe=detectModeFromSql(_0x41b980),_0x480b8d=_0x41b980[_0x4647f6(0x194)]?await getDbName(_0x6bafba[_0x4647f6(0x17a)],Number(_0x41b980[_0x4647f6(0x194)]))[_0x4647f6(0x196)](()=>undefined):undefined,_0x4d7f7e=buildLocalSqlFileContent({'sqlCode':_0x41b980[_0x4647f6(0x183)],'sqlName':_0x41b980['sqlName'],'dbId':_0x41b980[_0x4647f6(0x194)]},_0x2d4bd9,{'dbName':_0x480b8d,'mode':_0xc900fe,'syncedAt':new Date()['toISOString'](),'description':_0x41b980[_0x4647f6(0x162)]}),_0xac7845=buildSqlLockEntry(_0x41b980,_0x2d4bd9,'',{'dbName':_0x480b8d}),_0x201d11=resolveLocalSqlFilePath(_0x5796da,_0x41b980[_0x4647f6(0x183)],_0xac7845);let _0x3c7c53=_0x4647f6(0x17f),_0x500ed;if(await fileExists(_0x201d11)){const _0x248bb5=await readFile(_0x201d11,_0x4647f6(0x171));isEquivalentPulledSqlFile(_0x248bb5,_0x4d7f7e,_0xc900fe)?(_0x3c7c53='skipped',_0x500ed='unchanged'):(_0x3c7c53='conflict',_0x500ed=_0x4647f6(0x17d));}_0x19044e['push']({'sqlCode':_0x41b980[_0x4647f6(0x183)],'sqlName':_0x41b980[_0x4647f6(0x163)],'filePath':_0x201d11,'status':_0x3c7c53,'reason':_0x500ed});}return{'method':_0x4647f6(0x191),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x6bafba['appCode'],'sqlCode':_0x6bafba[_0x4647f6(0x17c)]('sqlcode')||null,'sqlName':_0x6bafba[_0x4647f6(0x17c)](_0x4647f6(0x190))||null,'files':_0x19044e},'description':'Would\x20pull\x20'+_0x19044e[_0x4647f6(0x18d)]+_0x4647f6(0x15e)+_0x5796da[_0x4647f6(0x161)]};},async 'execute'(_0xb886c5){const _0xf62f41=a189_0xfc5292,_0x250257=loadSqlProjectConfig(_0xb886c5[_0xf62f41(0x17a)]),_0x4df998=await readSqlLockFile(_0x250257[_0xf62f41(0x170)]),{lockData:_0x1dfc35,appLock:_0x4409bf}=ensureSqlLockScope(_0x4df998??createEmptySqlLock(),_0x250257['appCode'],_0x250257[_0xf62f41(0x15f)],'pull'),_0x7fc229=_0xb886c5[_0xf62f41(0x168)]('force'),_0x20deb8=await fetchAllSqlQueries(_0xb886c5[_0xf62f41(0x17a)],{'sqlCode':_0xb886c5[_0xf62f41(0x17c)](_0xf62f41(0x186))||undefined,'sqlName':_0xb886c5[_0xf62f41(0x17c)]('name')||undefined});if(_0x20deb8[_0xf62f41(0x18d)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0xf62f41(0x18e)};const _0x5e832c=[],_0x2d9359=[];for(const _0x322b27 of _0x20deb8){try{_0x5e832c[_0xf62f41(0x18b)](await ensureSqlContent(_0x322b27));}catch(_0x2c0f02){_0x2d9359[_0xf62f41(0x18b)]({'sqlCode':_0x322b27[_0xf62f41(0x183)],'error':_0x2c0f02 instanceof Error?_0x2c0f02[_0xf62f41(0x169)]:String(_0x2c0f02)});}}if(_0x7fc229&&!_0xb886c5[_0xf62f41(0x167)]){let _0x282a70=![];for(const _0x52e161 of _0x5e832c){const _0x2ef2bf=detectModeFromSql(_0x52e161),_0x2d6b98=_0x52e161[_0xf62f41(0x194)]?await getDbName(_0xb886c5['appCode'],Number(_0x52e161[_0xf62f41(0x194)]))[_0xf62f41(0x196)](()=>undefined):undefined,_0xdb17aa=buildLocalSqlFileContent({'sqlCode':_0x52e161[_0xf62f41(0x183)],'sqlName':_0x52e161[_0xf62f41(0x163)],'dbId':_0x52e161[_0xf62f41(0x194)]},ensureRemoteSqlContent(_0x52e161),{'dbName':_0x2d6b98,'mode':_0x2ef2bf,'syncedAt':new Date()[_0xf62f41(0x165)](),'description':_0x52e161['description']}),_0x42dabb=resolveLocalSqlFilePath(_0x250257,_0x52e161[_0xf62f41(0x183)],buildSqlLockEntry(_0x52e161,ensureRemoteSqlContent(_0x52e161),'',{'dbName':_0x2d6b98}));if(await fileExists(_0x42dabb)){const _0x2aa55d=await readFile(_0x42dabb,'utf8');if(!isEquivalentPulledSqlFile(_0x2aa55d,_0xdb17aa,_0x2ef2bf)){_0x282a70=!![];break;}}}if(_0x282a70){const _0x417144=await confirmForceOverwrite(_0xf62f41(0x199));if(!_0x417144)throw CliErrors[_0xf62f41(0x18c)](_0xf62f41(0x17b));}}const _0x2ed0cb=cloneSqlLockData(_0x1dfc35),_0xf4328e=_0x2ed0cb['apps'][_0x250257[_0xf62f41(0x17a)]],_0x3763ad=[],_0x1b206a=[];for(const _0x337bd8 of _0x5e832c){const _0x273cd9=_0xf4328e[_0xf62f41(0x16c)][_0x337bd8[_0xf62f41(0x183)]],_0x3ed2a2=ensureRemoteSqlContent(_0x337bd8),_0x5cf55c=detectModeFromSql(_0x337bd8),_0x5b0097=_0x337bd8[_0xf62f41(0x194)]?await getDbName(_0xb886c5['appCode'],Number(_0x337bd8[_0xf62f41(0x194)]))[_0xf62f41(0x196)](()=>undefined):undefined,_0x385ae1=buildLocalSqlFileContent({'sqlCode':_0x337bd8[_0xf62f41(0x183)],'sqlName':_0x337bd8['sqlName'],'dbId':_0x337bd8['dbId']},_0x3ed2a2,{'dbName':_0x5b0097,'mode':_0x5cf55c,'syncedAt':new Date()[_0xf62f41(0x165)](),'description':_0x337bd8[_0xf62f41(0x162)]}),_0x286ea7=buildSqlLockEntry(_0x337bd8,_0x3ed2a2,computeSqlContentHash(_0x385ae1),{'dbName':_0x5b0097}),_0x34e338=_0x286ea7['path'],_0x3b6dfe=join(_0x250257[_0xf62f41(0x161)],_0x34e338);try{if(await fileExists(_0x3b6dfe)){const _0x12fc18=await readFile(_0x3b6dfe,_0xf62f41(0x171));if(isEquivalentPulledSqlFile(_0x12fc18,_0x385ae1,_0x5cf55c)){_0x1b206a[_0xf62f41(0x18b)]({'sqlCode':_0x337bd8[_0xf62f41(0x183)],'reason':_0xf62f41(0x184)}),_0xf4328e[_0xf62f41(0x16c)][_0x337bd8[_0xf62f41(0x183)]]={..._0x286ea7,'hash':computeSqlContentHash(_0x12fc18),'path':_0x34e338};continue;}if(!_0x7fc229){_0x1b206a[_0xf62f41(0x18b)]({'sqlCode':_0x337bd8[_0xf62f41(0x183)],'reason':_0xf62f41(0x177)});continue;}}const _0x433727=_0x273cd9?.[_0xf62f41(0x166)]?join(_0x250257[_0xf62f41(0x161)],_0x273cd9[_0xf62f41(0x166)]):undefined;_0x433727&&_0x433727!==_0x3b6dfe&&await fileExists(_0x433727)&&await rm(_0x433727,{'force':!![]}),await ensureParentDirectory(_0x3b6dfe),await writeFile(_0x3b6dfe,_0x385ae1,_0xf62f41(0x171)),_0xf4328e[_0xf62f41(0x16c)][_0x337bd8[_0xf62f41(0x183)]]={..._0x286ea7,'path':_0x34e338},_0x3763ad[_0xf62f41(0x18b)]({'sqlCode':_0x337bd8['sqlCode'],'filePath':_0x3b6dfe});}catch(_0x543e8a){_0x2d9359['push']({'sqlCode':_0x337bd8[_0xf62f41(0x183)],'error':_0x543e8a instanceof Error?_0x543e8a[_0xf62f41(0x169)]:String(_0x543e8a)});}}return _0xf4328e[_0xf62f41(0x181)]=new Date()[_0xf62f41(0x165)](),await writeSqlLockFile(_0x250257['lockFilePath'],_0x2ed0cb),{'ok':_0x2d9359['length']===0x0,'data':{'pulled':_0x3763ad,'skipped':_0x1b206a,'failed':_0x2d9359},'message':_0xf62f41(0x197)+_0x3763ad[_0xf62f41(0x18d)]+_0xf62f41(0x178)+_0x1b206a[_0xf62f41(0x18d)]+_0xf62f41(0x180)+_0x2d9359[_0xf62f41(0x18d)]+_0xf62f41(0x176)};}};function detectModeFromSql(_0x5bc5c6){const _0x1765e6=a189_0xfc5292,_0x5f3679=ensureRemoteSqlContent(_0x5bc5c6),_0xda3741=stripLocalSqlMetadata(_0x5f3679,'mybatisXml')[_0x1765e6(0x16d)]();if(/^<(select|insert|update|delete)\b/i[_0x1765e6(0x19b)](_0xda3741))return _0x1765e6(0x175);return'sql';}function isEquivalentPulledSqlFile(_0x5ecb97,_0x1637c0,_0xb4da3){return normalizePullComparableContent(_0x5ecb97,_0xb4da3)===normalizePullComparableContent(_0x1637c0,_0xb4da3);}function normalizePullComparableContent(_0x307f60,_0x2a3a43){const _0x1742c4=a189_0xfc5292,_0x1e9c3c=_0x307f60['replace'](/\r\n/g,'\x0a')[_0x1742c4(0x19a)]('\x0a'),_0x3775b0=_0x1e9c3c[_0x1742c4(0x174)](_0xd24a5a=>!isSyncedAtMetadataLine(_0xd24a5a,_0x2a3a43));return _0x3775b0[_0x1742c4(0x188)]('\x0a');}function isSyncedAtMetadataLine(_0x577bd8,_0x184e4f){const _0x48b8d9=a189_0xfc5292;if(_0x184e4f==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x48b8d9(0x19b)](_0x577bd8);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x48b8d9(0x19b)](_0x577bd8);}
|