@lovrabet/rabetbase-cli 2.4.6-beta.3 → 2.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/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/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-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-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/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/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/template.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/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.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/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/skills/rabetbase/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const a178_0x9b2ca2=a178_0xe39b;function a178_0xe39b(_0x905b64,_0x12099c){_0x905b64=_0x905b64-0x111;const _0x5047bf=a178_0x5047();let _0xe39b7=_0x5047bf[_0x905b64];return _0xe39b7;}(function(_0x3b764f,_0x49c45c){const _0x187aac=a178_0xe39b,_0x424c2f=_0x3b764f();while(!![]){try{const _0x10fe3d=-parseInt(_0x187aac(0x13a))/0x1+-parseInt(_0x187aac(0x128))/0x2*(-parseInt(_0x187aac(0x137))/0x3)+-parseInt(_0x187aac(0x134))/0x4+parseInt(_0x187aac(0x13b))/0x5*(-parseInt(_0x187aac(0x115))/0x6)+-parseInt(_0x187aac(0x11f))/0x7*(-parseInt(_0x187aac(0x163))/0x8)+-parseInt(_0x187aac(0x13d))/0x9+parseInt(_0x187aac(0x15d))/0xa*(parseInt(_0x187aac(0x15c))/0xb);if(_0x10fe3d===_0x49c45c)break;else _0x424c2f['push'](_0x424c2f['shift']());}catch(_0x1fc67d){_0x424c2f['push'](_0x424c2f['shift']());}}}(a178_0x5047,0xd04ad));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}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':a178_0x9b2ca2(0x154),'required':!![],'description':a178_0x9b2ca2(0x15f)};export const ROLE_REF_FLAG={'name':a178_0x9b2ca2(0x13f),'type':a178_0x9b2ca2(0x12f),'required':!![],'description':'Role\x20id\x20or\x20exact\x20role\x20name'};export const USER_REF_FLAG={'name':a178_0x9b2ca2(0x11c),'type':a178_0x9b2ca2(0x12f),'required':!![],'description':a178_0x9b2ca2(0x14a)};export const NAME_FLAG={'name':a178_0x9b2ca2(0x14f),'type':a178_0x9b2ca2(0x12f),'required':!![],'description':a178_0x9b2ca2(0x129)};export const USER_NAME_FLAG={'name':a178_0x9b2ca2(0x14f),'type':a178_0x9b2ca2(0x12f),'required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':a178_0x9b2ca2(0x121),'type':'string','required':![],'description':a178_0x9b2ca2(0x125)};export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a178_0x9b2ca2(0x154),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=[a178_0x9b2ca2(0x156),a178_0x9b2ca2(0x118),a178_0x9b2ca2(0x143)];export function isBuiltinRole(_0x5de1c8){const _0x140e93=a178_0x9b2ca2;return BUILTIN_ROLE_TYPES[_0x140e93(0x117)](_0x5de1c8);}export function assertCustomRole(_0x10c732,_0x576543){const _0x134928=a178_0x9b2ca2;if(_0x10c732[_0x134928(0x149)]!==_0x134928(0x12b))throw CliErrors[_0x134928(0x144)](_0x134928(0x126)+_0x576543+_0x134928(0x152)+_0x10c732[_0x134928(0x147)]+'\x20('+_0x10c732['roleType']+').','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.');}export function projectRole(_0x4aebbf){const _0x4edd7a=a178_0x9b2ca2;return{'id':_0x4aebbf['id'],'roleName':_0x4aebbf[_0x4edd7a(0x147)],'roleType':_0x4aebbf[_0x4edd7a(0x149)],'remark':_0x4aebbf[_0x4edd7a(0x121)],'userCount':_0x4aebbf[_0x4edd7a(0x136)],'permitCount':_0x4aebbf[_0x4edd7a(0x114)],'builtin':isBuiltinRole(_0x4aebbf[_0x4edd7a(0x149)])};}export async function resolveRoleRef(_0x53a99e,_0x4f5fc2){const _0x1ec9f1=a178_0x9b2ca2,_0x3ab3a1=_0x4f5fc2[_0x1ec9f1(0x111)]();if(!_0x3ab3a1)throw CliErrors['validation'](_0x1ec9f1(0x120),_0x1ec9f1(0x160));if(/^\d+$/[_0x1ec9f1(0x127)](_0x3ab3a1))return getRoleById(_0x53a99e,Number(_0x3ab3a1));const _0x134023=await listAllAppRoles(_0x53a99e),_0x399c1d=_0x134023[_0x1ec9f1(0x112)](_0x4dc377=>_0x4dc377[_0x1ec9f1(0x147)]===_0x3ab3a1);if(_0x399c1d[_0x1ec9f1(0x132)]===0x0)throw CliErrors[_0x1ec9f1(0x144)]('Role\x20name\x20\x22'+_0x3ab3a1+_0x1ec9f1(0x131)+_0x53a99e+'.',_0x1ec9f1(0x146));if(_0x399c1d[_0x1ec9f1(0x132)]>0x1){const _0x511cf3=_0x399c1d[_0x1ec9f1(0x11a)](_0x33ed50=>_0x33ed50['id'])[_0x1ec9f1(0x116)](',\x20');throw CliErrors[_0x1ec9f1(0x144)](_0x1ec9f1(0x14d)+_0x3ab3a1+_0x1ec9f1(0x12a)+_0x511cf3+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x399c1d[0x0];}export async function getRoleById(_0x430004,_0x5ba81c){const _0x127b06=a178_0x9b2ca2,_0xcf4353=await listAllAppRoles(_0x430004),_0x7f7e1e=_0xcf4353[_0x127b06(0x112)](_0x52a2ba=>_0x52a2ba['id']===_0x5ba81c&&(!_0x52a2ba['appCode']||_0x52a2ba[_0x127b06(0x158)]===_0x430004));if(_0x7f7e1e['length']!==0x1)throw CliErrors[_0x127b06(0x144)](_0x127b06(0x12c)+_0x5ba81c+_0x127b06(0x153)+_0x430004+'.',_0x127b06(0x150));return _0x7f7e1e[0x0];}function a178_0x5047(){const _0x10c907=['1602354whfUAL','9050vuwRId','User\x20','8886681tHDAjq','Pass\x20--user\x20<id|name>.','role','Multiple\x20tenant\x20members\x20match\x20\x22','username','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','OWNER','validation','\x20member(s)\x20but\x20role\x20has\x20','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','roleName','push','roleType','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','userId','POST','Role\x20name\x20\x22','dev','name','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','/smartapi/permit/user-role/delete','\x20built-in\x20role\x20','\x20not\x20found\x20in\x20app\x20','number','totalCount','ADMIN','\x20duplicate\x20memberships\x20for\x20user\x20','appCode','No\x20tenant\x20member\x20matches\x20\x22','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','user-add','792gimuMR','237730xlzuzr','find','Role\x20id\x20(from\x20`role\x20list`)','Pass\x20--role\x20<id|name>.','expectUserCount','toLowerCase','609272XnSsAx','trim','filter','Removed\x20','permitCount','3336njgLti','join','includes','DEV','str','map','tenant_code','user','nickname','Missing\x20user\x20reference.','154CTZJdw','Missing\x20role\x20reference.','remark','\x20is\x20already\x20a\x20member\x20of\x20role\x20','dryRun','/smartapi/permit/user-role/create','Optional\x20role\x20remark/description','Cannot\x20','test','6ljdEMa','Role\x20name','\x22\x20is\x20ambiguous\x20(ids:\x20','CUSTOM','Role\x20id\x20','\x20members\x20of\x20the\x20OWNER\x20role.','\x22:\x20','string','Disambiguate\x20with\x20--user\x20<id>.','\x22\x20not\x20found\x20in\x20app\x20','length','flag','358900aTqzcd','expect-user-count','userCount','1151859ZxXOqF','tenant',';\x20no\x20change.'];a178_0x5047=function(){return _0x10c907;};return a178_0x5047();}async function listAllAppRoles(_0x4f01eb){const _0x18b4c5=a178_0x9b2ca2,_0x1525bf=0x64,_0x589a0f=[];for(let _0x51783e=0x1;;_0x51783e+=0x1){const {items:_0x22c799,paging:_0x215c0f}=await listAppRoles(_0x4f01eb,{'currentPage':_0x51783e,'pageSize':_0x1525bf});_0x589a0f['push'](..._0x22c799);if(_0x22c799[_0x18b4c5(0x132)]<_0x1525bf||_0x215c0f&&_0x589a0f[_0x18b4c5(0x132)]>=_0x215c0f['totalCount'])return _0x589a0f;}}export async function resolveTenantCode(){const _0xef58e1=a178_0x9b2ca2,_0x26ea38=await getSessionUserInfo(),_0x5cb93d=_0x26ea38?.['user']?.[_0xef58e1(0x138)]?.[_0xef58e1(0x11b)];if(!_0x5cb93d)throw CliErrors['authRequired'](_0xef58e1(0x142));return _0x5cb93d;}function matchMember(_0xdb5a60,_0x309ce2){const _0x56b703=a178_0x9b2ca2,_0x46a05a=_0x309ce2[_0x56b703(0x111)]()[_0x56b703(0x162)]();return(_0xdb5a60['nickname']??'')['toLowerCase']()===_0x46a05a||(_0xdb5a60[_0x56b703(0x141)]??'')['toLowerCase']()===_0x46a05a;}export async function resolveUserRef(_0x9a8fd4){const _0x3de883=a178_0x9b2ca2,_0x358e80=_0x9a8fd4[_0x3de883(0x111)]();if(!_0x358e80)throw CliErrors[_0x3de883(0x144)](_0x3de883(0x11e),_0x3de883(0x13e));const _0x567996=await resolveTenantCode(),_0x15da20=await getTenantMembers(_0x567996);if(/^\d+$/[_0x3de883(0x127)](_0x358e80)){const _0x34970e=Number(_0x358e80),_0x2a1293=_0x15da20[_0x3de883(0x15e)](_0x48ffa7=>_0x48ffa7[_0x3de883(0x14b)]===_0x34970e);return{'userId':_0x34970e,'username':_0x2a1293?.['username']??String(_0x34970e),'nickname':_0x2a1293?.[_0x3de883(0x11d)],'matchedBy':'id'};}const _0x4bbcc6=_0x15da20['filter'](_0x33dcd9=>matchMember(_0x33dcd9,_0x358e80));if(_0x4bbcc6[_0x3de883(0x132)]===0x0)throw CliErrors[_0x3de883(0x144)](_0x3de883(0x159)+_0x358e80+'\x22.','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.');if(_0x4bbcc6[_0x3de883(0x132)]>0x1){const _0x583821=_0x4bbcc6['map'](_0x557a8d=>(_0x557a8d['nickname']??_0x557a8d[_0x3de883(0x141)]??'?')+'('+_0x557a8d[_0x3de883(0x14b)]+')')[_0x3de883(0x116)](',\x20');throw CliErrors[_0x3de883(0x144)](_0x3de883(0x140)+_0x358e80+_0x3de883(0x12e)+_0x583821+'.',_0x3de883(0x130));}const _0x43bbfd=_0x4bbcc6[0x0];return{'userId':_0x43bbfd[_0x3de883(0x14b)],'username':_0x43bbfd[_0x3de883(0x141)]??String(_0x43bbfd['userId']),'nickname':_0x43bbfd[_0x3de883(0x11d)],'matchedBy':_0x3de883(0x14f)};}export const CREATE_USER_ROLE_PATH=a178_0x9b2ca2(0x124);export const DELETE_USER_ROLE_PATH=a178_0x9b2ca2(0x151);export function computeRoleUserMutation(_0x33d3d5){const _0x3c43ed=a178_0x9b2ca2,{operation:_0x333536,appCode:_0x21f41,role:_0x351ac8,relations:_0x2975bd,user:_0x5018aa}=_0x33d3d5,_0x4a002a=[...new Set(_0x2975bd[_0x3c43ed(0x11a)](_0x406569=>_0x406569[_0x3c43ed(0x14b)]))],_0x1032af=[];if(_0x33d3d5[_0x3c43ed(0x161)]!==undefined&&_0x33d3d5['expectUserCount']!==_0x4a002a[_0x3c43ed(0x132)])throw CliErrors[_0x3c43ed(0x144)]('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x33d3d5[_0x3c43ed(0x161)]+_0x3c43ed(0x145)+_0x4a002a['length']+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x1aa990=_0x4a002a[_0x3c43ed(0x117)](_0x5018aa[_0x3c43ed(0x14b)]),_0x20378c=_0x2975bd[_0x3c43ed(0x112)](_0x116e7e=>_0x116e7e[_0x3c43ed(0x14b)]===_0x5018aa['userId'])[_0x3c43ed(0x11a)](_0x168c20=>_0x168c20['id']),_0x5be613=_0x333536===_0x3c43ed(0x15b)?!_0x1aa990:_0x1aa990;let _0x41dca8=_0x4a002a;_0x333536===_0x3c43ed(0x15b)?_0x1aa990?_0x1032af[_0x3c43ed(0x148)](_0x3c43ed(0x13c)+_0x5018aa[_0x3c43ed(0x14b)]+_0x3c43ed(0x122)+_0x351ac8[_0x3c43ed(0x147)]+_0x3c43ed(0x139)):_0x41dca8=[..._0x4a002a,_0x5018aa[_0x3c43ed(0x14b)]]:!_0x1aa990?_0x1032af['push'](_0x3c43ed(0x13c)+_0x5018aa[_0x3c43ed(0x14b)]+'\x20is\x20not\x20a\x20member\x20of\x20role\x20'+_0x351ac8[_0x3c43ed(0x147)]+_0x3c43ed(0x139)):(_0x41dca8=_0x4a002a[_0x3c43ed(0x112)](_0x384567=>_0x384567!==_0x5018aa[_0x3c43ed(0x14b)]),_0x20378c[_0x3c43ed(0x132)]>0x1&&_0x1032af['push'](_0x3c43ed(0x113)+_0x20378c['length']+_0x3c43ed(0x157)+_0x5018aa[_0x3c43ed(0x14b)]+'.'));const _0x9aa11b={'scope':_0x3c43ed(0x14e),'operation':_0x333536,'selector':{'appCode':_0x21f41,'roleId':_0x351ac8['id'],'roleName':_0x351ac8['roleName'],'userId':_0x5018aa[_0x3c43ed(0x14b)]},'before':{'userIds':_0x4a002a},'after':{'userIds':_0x41dca8},'dryRun':_0x33d3d5[_0x3c43ed(0x123)],'backend':{'method':_0x3c43ed(0x14c),'path':_0x333536===_0x3c43ed(0x15b)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x1032af};return{'mutation':_0x9aa11b,'changed':_0x5be613,'matchingRelationIds':_0x20378c};}export async function loadDevRoleRelations(_0x497ff9,_0x5a7509){const _0x2c2281=a178_0x9b2ca2,_0x429206=0x64,_0x488bc2=[];for(let _0x470ab6=0x1;;_0x470ab6+=0x1){const {items:_0x1b2bc8,paging:_0x3f1b19}=await listDevUserRoleRelations(_0x497ff9,{'roleId':_0x5a7509,'currentPage':_0x470ab6,'pageSize':_0x429206});_0x488bc2[_0x2c2281(0x148)](..._0x1b2bc8);if(_0x1b2bc8['length']<_0x429206||_0x3f1b19&&_0x488bc2['length']>=_0x3f1b19[_0x2c2281(0x155)])return _0x488bc2;}}export function readRoleRef(_0x506c30){const _0x29ea6b=a178_0x9b2ca2,_0x2941d3=_0x506c30[_0x29ea6b(0x119)]('role')['trim']();if(!_0x2941d3)throw CliErrors['flagMissing'](_0x29ea6b(0x13f),_0x29ea6b(0x160));return _0x2941d3;}export async function prepareUserMutation(_0x1ffd2b,_0x4b37dc,_0x79ecca){const _0xebb7dc=a178_0x9b2ca2,_0x4440d5=readRoleRef(_0x1ffd2b),_0x87381b=_0x1ffd2b[_0xebb7dc(0x119)](_0xebb7dc(0x11c))[_0xebb7dc(0x111)]();if(!_0x87381b)throw CliErrors['flagMissing'](_0xebb7dc(0x11c),_0xebb7dc(0x13e));const _0x1fe030=_0x1ffd2b[_0xebb7dc(0x133)](_0xebb7dc(0x135)),_0x3fb1ac=_0x1fe030===undefined||_0x1fe030===null?undefined:Number(_0x1fe030),_0x59f132=await resolveRoleRef(_0x1ffd2b['appCode'],_0x4440d5);if(_0x59f132[_0xebb7dc(0x149)]===_0xebb7dc(0x143))throw CliErrors[_0xebb7dc(0x144)]('Cannot\x20'+_0x4b37dc+_0xebb7dc(0x12d),_0xebb7dc(0x15a));const _0xf81708=await resolveUserRef(_0x87381b),_0x50eb11=await loadDevRoleRelations(_0x1ffd2b[_0xebb7dc(0x158)],_0x59f132['id']);return{...computeRoleUserMutation({'operation':_0x4b37dc,'appCode':_0x1ffd2b['appCode'],'role':_0x59f132,'relations':_0x50eb11,'user':{'userId':_0xf81708[_0xebb7dc(0x14b)],'username':_0xf81708['username'],'nickname':_0xf81708[_0xebb7dc(0x11d)]},'dryRun':_0x79ecca,..._0x3fb1ac!==undefined?{'expectUserCount':_0x3fb1ac}:{}}),'role':_0x59f132,'user':_0xf81708};}
|
|
1
|
+
const a178_0x5add86=a178_0x35d5;(function(_0x3d0a51,_0x32826a){const _0x1ad506=a178_0x35d5,_0x10532c=_0x3d0a51();while(!![]){try{const _0x2d5949=parseInt(_0x1ad506(0x180))/0x1+-parseInt(_0x1ad506(0x17b))/0x2*(-parseInt(_0x1ad506(0x179))/0x3)+parseInt(_0x1ad506(0x1a9))/0x4*(parseInt(_0x1ad506(0x191))/0x5)+-parseInt(_0x1ad506(0x1a6))/0x6+-parseInt(_0x1ad506(0x1ae))/0x7+parseInt(_0x1ad506(0x19f))/0x8*(parseInt(_0x1ad506(0x1a4))/0x9)+parseInt(_0x1ad506(0x1c3))/0xa;if(_0x2d5949===_0x32826a)break;else _0x10532c['push'](_0x10532c['shift']());}catch(_0x34acdf){_0x10532c['push'](_0x10532c['shift']());}}}(a178_0x4e6d,0x75073));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}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':a178_0x5add86(0x1bf),'required':!![],'description':a178_0x5add86(0x177)};export const ROLE_REF_FLAG={'name':a178_0x5add86(0x193),'type':a178_0x5add86(0x1a0),'required':!![],'description':a178_0x5add86(0x18b)};function a178_0x35d5(_0x47b2b6,_0x5d7083){_0x47b2b6=_0x47b2b6-0x171;const _0x4e6d5d=a178_0x4e6d();let _0x35d557=_0x4e6d5d[_0x47b2b6];return _0x35d557;}export const USER_REF_FLAG={'name':a178_0x5add86(0x192),'type':'string','required':!![],'description':a178_0x5add86(0x18e)};export const NAME_FLAG={'name':a178_0x5add86(0x1bd),'type':a178_0x5add86(0x1a0),'required':!![],'description':a178_0x5add86(0x183)};export const USER_NAME_FLAG={'name':a178_0x5add86(0x1bd),'type':a178_0x5add86(0x1a0),'required':!![],'description':a178_0x5add86(0x173)};export const REMARK_FLAG={'name':a178_0x5add86(0x17d),'type':a178_0x5add86(0x1a0),'required':![],'description':a178_0x5add86(0x1b0)};export const EXPECT_USER_COUNT_FLAG={'name':a178_0x5add86(0x189),'type':a178_0x5add86(0x1bf),'required':![],'description':a178_0x5add86(0x1af)};export const BUILTIN_ROLE_TYPES=[a178_0x5add86(0x18f),a178_0x5add86(0x194),a178_0x5add86(0x1a1)];export function isBuiltinRole(_0x5188fe){const _0x91973a=a178_0x5add86;return BUILTIN_ROLE_TYPES[_0x91973a(0x1b8)](_0x5188fe);}export function assertCustomRole(_0xe25aa0,_0xf83177){const _0x33c801=a178_0x5add86;if(_0xe25aa0['roleType']!==_0x33c801(0x184))throw CliErrors[_0x33c801(0x190)]('Cannot\x20'+_0xf83177+_0x33c801(0x1b5)+_0xe25aa0[_0x33c801(0x1ad)]+'\x20('+_0xe25aa0[_0x33c801(0x19c)]+').','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.');}export function projectRole(_0x581f14){const _0x56dda0=a178_0x5add86;return{'id':_0x581f14['id'],'roleName':_0x581f14[_0x56dda0(0x1ad)],'roleType':_0x581f14[_0x56dda0(0x19c)],'remark':_0x581f14[_0x56dda0(0x17d)],'userCount':_0x581f14[_0x56dda0(0x186)],'permitCount':_0x581f14[_0x56dda0(0x1bc)],'builtin':isBuiltinRole(_0x581f14[_0x56dda0(0x19c)])};}export async function resolveRoleRef(_0x3b9dfc,_0x4f8e69){const _0x557021=a178_0x5add86,_0x1edd42=_0x4f8e69['trim']();if(!_0x1edd42)throw CliErrors[_0x557021(0x190)]('Missing\x20role\x20reference.',_0x557021(0x19e));if(/^\d+$/[_0x557021(0x197)](_0x1edd42))return getRoleById(_0x3b9dfc,Number(_0x1edd42));const _0x5eaf00=await listAllAppRoles(_0x3b9dfc),_0x4bb9fb=_0x5eaf00[_0x557021(0x1a5)](_0x1a7917=>_0x1a7917['roleName']===_0x1edd42);if(_0x4bb9fb[_0x557021(0x1be)]===0x0)throw CliErrors[_0x557021(0x190)](_0x557021(0x1ac)+_0x1edd42+_0x557021(0x1c7)+_0x3b9dfc+'.',_0x557021(0x19d));if(_0x4bb9fb['length']>0x1){const _0x77b2ab=_0x4bb9fb['map'](_0xfd832a=>_0xfd832a['id'])[_0x557021(0x1aa)](',\x20');throw CliErrors[_0x557021(0x190)](_0x557021(0x1ac)+_0x1edd42+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x77b2ab+').',_0x557021(0x1b2));}return _0x4bb9fb[0x0];}export async function getRoleById(_0x3c869c,_0x4a1e68){const _0xd64ab9=a178_0x5add86,_0x25488a=await listAllAppRoles(_0x3c869c),_0x1e7c92=_0x25488a[_0xd64ab9(0x1a5)](_0x141b47=>_0x141b47['id']===_0x4a1e68&&(!_0x141b47[_0xd64ab9(0x1ab)]||_0x141b47[_0xd64ab9(0x1ab)]===_0x3c869c));if(_0x1e7c92[_0xd64ab9(0x1be)]!==0x1)throw CliErrors[_0xd64ab9(0x190)](_0xd64ab9(0x185)+_0x4a1e68+_0xd64ab9(0x172)+_0x3c869c+'.',_0xd64ab9(0x1b6));return _0x1e7c92[0x0];}async function listAllAppRoles(_0x4089e3){const _0x5a1c39=a178_0x5add86,_0x4acf90=0x64,_0x5b45df=[];for(let _0x2bf425=0x1;;_0x2bf425+=0x1){const {items:_0x202d7a,paging:_0x543433}=await listAppRoles(_0x4089e3,{'currentPage':_0x2bf425,'pageSize':_0x4acf90});_0x5b45df[_0x5a1c39(0x18d)](..._0x202d7a);if(_0x202d7a[_0x5a1c39(0x1be)]<_0x4acf90||_0x543433&&_0x5b45df[_0x5a1c39(0x1be)]>=_0x543433[_0x5a1c39(0x174)])return _0x5b45df;}}function a178_0x4e6d(){const _0x781954=['ADMIN','validation','2100UAFyfk','user','role','DEV','dev','Multiple\x20tenant\x20members\x20match\x20\x22','test','\x20member(s)\x20but\x20role\x20has\x20','tenant','\x20is\x20already\x20a\x20member\x20of\x20role\x20','find','roleType','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','Pass\x20--role\x20<id|name>.','24mmUDmw','string','OWNER','nickname',';\x20no\x20change.','909693bmwuoe','filter','3770664tGcZYQ','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','flagMissing','320sItlAy','join','appCode','Role\x20name\x20\x22','roleName','1744638tQjYfa','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','Optional\x20role\x20remark/description','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','Disambiguate\x20with\x20--role\x20<id>.','tenant_code','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','\x20built-in\x20role\x20','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','authRequired','includes','/smartapi/permit/user-role/create','POST','Pass\x20--user\x20<id|name>.','permitCount','name','length','number','\x20duplicate\x20memberships\x20for\x20user\x20','User\x20','\x20members\x20of\x20the\x20OWNER\x20role.','4534380bQWAhg','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','userId','username','\x22\x20not\x20found\x20in\x20app\x20','Missing\x20user\x20reference.','\x20not\x20found\x20in\x20app\x20','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','totalCount','expectUserCount','trim','Role\x20id\x20(from\x20`role\x20list`)','No\x20tenant\x20member\x20matches\x20\x22','82743qDDSaG','\x20is\x20not\x20a\x20member\x20of\x20role\x20','26neIxZg','dryRun','remark','\x22:\x20','toLowerCase','208203MWeHJU','str','map','Role\x20name','CUSTOM','Role\x20id\x20','userCount','Removed\x20','Anti-drift\x20check\x20failed:\x20expected\x20','expect-user-count','user-add','Role\x20id\x20or\x20exact\x20role\x20name','Disambiguate\x20with\x20--user\x20<id>.','push','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'];a178_0x4e6d=function(){return _0x781954;};return a178_0x4e6d();}export async function resolveTenantCode(){const _0x539069=a178_0x5add86,_0x129612=await getSessionUserInfo(),_0xbe9d63=_0x129612?.[_0x539069(0x192)]?.[_0x539069(0x199)]?.[_0x539069(0x1b3)];if(!_0xbe9d63)throw CliErrors[_0x539069(0x1b7)](_0x539069(0x1a7));return _0xbe9d63;}function matchMember(_0x4dbf87,_0x161a07){const _0x5af721=a178_0x5add86,_0x39e83a=_0x161a07['trim']()[_0x5af721(0x17f)]();return(_0x4dbf87[_0x5af721(0x1a2)]??'')[_0x5af721(0x17f)]()===_0x39e83a||(_0x4dbf87[_0x5af721(0x1c6)]??'')['toLowerCase']()===_0x39e83a;}export async function resolveUserRef(_0x114c8e){const _0x5e35a9=a178_0x5add86,_0x2fc438=_0x114c8e['trim']();if(!_0x2fc438)throw CliErrors[_0x5e35a9(0x190)](_0x5e35a9(0x171),_0x5e35a9(0x1bb));const _0x122902=await resolveTenantCode(),_0x38d1e9=await getTenantMembers(_0x122902);if(/^\d+$/[_0x5e35a9(0x197)](_0x2fc438)){const _0x35d47f=Number(_0x2fc438),_0xa8fca8=_0x38d1e9[_0x5e35a9(0x19b)](_0x46eb23=>_0x46eb23[_0x5e35a9(0x1c5)]===_0x35d47f);return{'userId':_0x35d47f,'username':_0xa8fca8?.['username']??String(_0x35d47f),'nickname':_0xa8fca8?.[_0x5e35a9(0x1a2)],'matchedBy':'id'};}const _0x51b65e=_0x38d1e9[_0x5e35a9(0x1a5)](_0x2c9eb9=>matchMember(_0x2c9eb9,_0x2fc438));if(_0x51b65e[_0x5e35a9(0x1be)]===0x0)throw CliErrors['validation'](_0x5e35a9(0x178)+_0x2fc438+'\x22.',_0x5e35a9(0x1b4));if(_0x51b65e[_0x5e35a9(0x1be)]>0x1){const _0x272288=_0x51b65e[_0x5e35a9(0x182)](_0x27747b=>(_0x27747b[_0x5e35a9(0x1a2)]??_0x27747b[_0x5e35a9(0x1c6)]??'?')+'('+_0x27747b[_0x5e35a9(0x1c5)]+')')[_0x5e35a9(0x1aa)](',\x20');throw CliErrors[_0x5e35a9(0x190)](_0x5e35a9(0x196)+_0x2fc438+_0x5e35a9(0x17e)+_0x272288+'.',_0x5e35a9(0x18c));}const _0x5ddc12=_0x51b65e[0x0];return{'userId':_0x5ddc12[_0x5e35a9(0x1c5)],'username':_0x5ddc12['username']??String(_0x5ddc12[_0x5e35a9(0x1c5)]),'nickname':_0x5ddc12[_0x5e35a9(0x1a2)],'matchedBy':'name'};}export const CREATE_USER_ROLE_PATH=a178_0x5add86(0x1b9);export const DELETE_USER_ROLE_PATH='/smartapi/permit/user-role/delete';export function computeRoleUserMutation(_0x574eb4){const _0x54bc05=a178_0x5add86,{operation:_0x4bafbb,appCode:_0x4f324f,role:_0x36b0e7,relations:_0x4f264f,user:_0x129d9f}=_0x574eb4,_0x44468d=[...new Set(_0x4f264f[_0x54bc05(0x182)](_0x3310da=>_0x3310da['userId']))],_0x40ca17=[];if(_0x574eb4[_0x54bc05(0x175)]!==undefined&&_0x574eb4[_0x54bc05(0x175)]!==_0x44468d[_0x54bc05(0x1be)])throw CliErrors[_0x54bc05(0x190)](_0x54bc05(0x188)+_0x574eb4[_0x54bc05(0x175)]+_0x54bc05(0x198)+_0x44468d[_0x54bc05(0x1be)]+'.',_0x54bc05(0x1b1));const _0x5363ca=_0x44468d[_0x54bc05(0x1b8)](_0x129d9f['userId']),_0x6ac78e=_0x4f264f['filter'](_0x32ec47=>_0x32ec47[_0x54bc05(0x1c5)]===_0x129d9f[_0x54bc05(0x1c5)])[_0x54bc05(0x182)](_0x1409a5=>_0x1409a5['id']),_0x1745b5=_0x4bafbb===_0x54bc05(0x18a)?!_0x5363ca:_0x5363ca;let _0x34edef=_0x44468d;_0x4bafbb===_0x54bc05(0x18a)?_0x5363ca?_0x40ca17[_0x54bc05(0x18d)]('User\x20'+_0x129d9f[_0x54bc05(0x1c5)]+_0x54bc05(0x19a)+_0x36b0e7[_0x54bc05(0x1ad)]+_0x54bc05(0x1a3)):_0x34edef=[..._0x44468d,_0x129d9f['userId']]:!_0x5363ca?_0x40ca17[_0x54bc05(0x18d)](_0x54bc05(0x1c1)+_0x129d9f['userId']+_0x54bc05(0x17a)+_0x36b0e7['roleName']+_0x54bc05(0x1a3)):(_0x34edef=_0x44468d['filter'](_0x3dce3c=>_0x3dce3c!==_0x129d9f[_0x54bc05(0x1c5)]),_0x6ac78e[_0x54bc05(0x1be)]>0x1&&_0x40ca17[_0x54bc05(0x18d)](_0x54bc05(0x187)+_0x6ac78e[_0x54bc05(0x1be)]+_0x54bc05(0x1c0)+_0x129d9f['userId']+'.'));const _0xf7b143={'scope':_0x54bc05(0x195),'operation':_0x4bafbb,'selector':{'appCode':_0x4f324f,'roleId':_0x36b0e7['id'],'roleName':_0x36b0e7[_0x54bc05(0x1ad)],'userId':_0x129d9f[_0x54bc05(0x1c5)]},'before':{'userIds':_0x44468d},'after':{'userIds':_0x34edef},'dryRun':_0x574eb4[_0x54bc05(0x17c)],'backend':{'method':_0x54bc05(0x1ba),'path':_0x4bafbb===_0x54bc05(0x18a)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x40ca17};return{'mutation':_0xf7b143,'changed':_0x1745b5,'matchingRelationIds':_0x6ac78e};}export async function loadDevRoleRelations(_0x21c72a,_0x983d49){const _0x1fe9fa=a178_0x5add86,_0x5cc542=0x64,_0x24d0c6=[];for(let _0x2ee3d3=0x1;;_0x2ee3d3+=0x1){const {items:_0x42ae16,paging:_0x46de36}=await listDevUserRoleRelations(_0x21c72a,{'roleId':_0x983d49,'currentPage':_0x2ee3d3,'pageSize':_0x5cc542});_0x24d0c6[_0x1fe9fa(0x18d)](..._0x42ae16);if(_0x42ae16[_0x1fe9fa(0x1be)]<_0x5cc542||_0x46de36&&_0x24d0c6[_0x1fe9fa(0x1be)]>=_0x46de36['totalCount'])return _0x24d0c6;}}export function readRoleRef(_0x210d42){const _0x38cb29=a178_0x5add86,_0x293d72=_0x210d42[_0x38cb29(0x181)](_0x38cb29(0x193))[_0x38cb29(0x176)]();if(!_0x293d72)throw CliErrors[_0x38cb29(0x1a8)](_0x38cb29(0x193),'Pass\x20--role\x20<id|name>.');return _0x293d72;}export async function prepareUserMutation(_0x323720,_0x2d9330,_0x9746ed){const _0x11823c=a178_0x5add86,_0x51ae02=readRoleRef(_0x323720),_0x5de1b7=_0x323720['str'](_0x11823c(0x192))[_0x11823c(0x176)]();if(!_0x5de1b7)throw CliErrors[_0x11823c(0x1a8)](_0x11823c(0x192),'Pass\x20--user\x20<id|name>.');const _0x23723d=_0x323720['flag']('expect-user-count'),_0x37d033=_0x23723d===undefined||_0x23723d===null?undefined:Number(_0x23723d),_0x5aec11=await resolveRoleRef(_0x323720[_0x11823c(0x1ab)],_0x51ae02);if(_0x5aec11[_0x11823c(0x19c)]===_0x11823c(0x1a1))throw CliErrors[_0x11823c(0x190)]('Cannot\x20'+_0x2d9330+_0x11823c(0x1c2),_0x11823c(0x1c4));const _0x46f930=await resolveUserRef(_0x5de1b7),_0x5a1ba7=await loadDevRoleRelations(_0x323720[_0x11823c(0x1ab)],_0x5aec11['id']);return{...computeRoleUserMutation({'operation':_0x2d9330,'appCode':_0x323720[_0x11823c(0x1ab)],'role':_0x5aec11,'relations':_0x5a1ba7,'user':{'userId':_0x46f930[_0x11823c(0x1c5)],'username':_0x46f930[_0x11823c(0x1c6)],'nickname':_0x46f930['nickname']},'dryRun':_0x9746ed,..._0x37d033!==undefined?{'expectUserCount':_0x37d033}:{}}),'role':_0x5aec11,'user':_0x46f930};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a179_0x4f443d=a179_0x1aa0;(function(_0x44f5a4,_0x259234){const _0x11e7a4=a179_0x1aa0,_0x3daab1=_0x44f5a4();while(!![]){try{const _0x2419a9=parseInt(_0x11e7a4(0xf5))/0x1*(-parseInt(_0x11e7a4(0xf1))/0x2)+-parseInt(_0x11e7a4(0xfe))/0x3+-parseInt(_0x11e7a4(0xef))/0x4+parseInt(_0x11e7a4(0xe8))/0x5*(parseInt(_0x11e7a4(0xf7))/0x6)+-parseInt(_0x11e7a4(0xed))/0x7+-parseInt(_0x11e7a4(0xf3))/0x8+-parseInt(_0x11e7a4(0xf4))/0x9*(-parseInt(_0x11e7a4(0x102))/0xa);if(_0x2419a9===_0x259234)break;else _0x3daab1['push'](_0x3daab1['shift']());}catch(_0x22dee1){_0x3daab1['push'](_0x3daab1['shift']());}}}(a179_0xabd8,0xae0f3));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';function a179_0x1aa0(_0x35f591,_0x5c3032){_0x35f591=_0x35f591-0xe8;const _0xabd83a=a179_0xabd8();let _0x1aa002=_0xabd83a[_0x35f591];return _0x1aa002;}import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';function a179_0xabd8(){const _0x20c7b1=['trim','148510azxWPm','remark','role','dev','180XKpNll','num','length','\x20(id=','name','1399398AiAqvJ','New\x20role\x20name','4823076FhAoAV','write','25684moHnwM','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','7237472BQjzrx','2547HWvLfZ','46jdZznL','appCode','81258PKoSBX','update','flag','validation','POST','/smartapi/permit/role/update','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','3229005kLeNZC','string','roleName'];a179_0xabd8=function(){return _0x20c7b1;};return a179_0xabd8();}const UPDATE_PATH=a179_0x4f443d(0xfc);function readPatch(_0xaef361){const _0x48128c=a179_0x4f443d,_0x1f8bdc=_0xaef361[_0x48128c(0xf9)]('name'),_0x4c5909=_0xaef361[_0x48128c(0xf9)](_0x48128c(0x103)),_0x2b9651={};if(_0x1f8bdc!==undefined&&_0x1f8bdc!==null){const _0x7614c=String(_0x1f8bdc)[_0x48128c(0x101)]();if(!_0x7614c)throw CliErrors[_0x48128c(0xfa)]('--name\x20cannot\x20be\x20empty.');if(_0x7614c[_0x48128c(0xea)]>0x40)throw CliErrors[_0x48128c(0xfa)]('Role\x20name\x20cannot\x20exceed\x2064\x20characters.');_0x2b9651[_0x48128c(0x100)]=_0x7614c;}_0x4c5909!==undefined&&_0x4c5909!==null&&(_0x2b9651[_0x48128c(0x103)]=String(_0x4c5909));if(_0x2b9651[_0x48128c(0x100)]===undefined&&_0x2b9651[_0x48128c(0x103)]===undefined)throw CliErrors['validation']('Nothing\x20to\x20update.',_0x48128c(0xf2));return _0x2b9651;}export const roleUpdate={'service':a179_0x4f443d(0x104),'command':'update','description':a179_0x4f443d(0xfd),'risk':a179_0x4f443d(0xf0),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a179_0x4f443d(0xec),'type':a179_0x4f443d(0xff),'required':![],'description':a179_0x4f443d(0xee)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x5bf526){readPatch(_0x5bf526);},async 'dryRun'(_0x244306){const _0x4a58c8=a179_0x4f443d,_0x2c232f=_0x244306[_0x4a58c8(0xe9)]('id'),_0x5861c7=readPatch(_0x244306),_0x2a1b06=await getRoleById(_0x244306[_0x4a58c8(0xf6)],_0x2c232f);return assertCustomRole(_0x2a1b06,_0x4a58c8(0xf8)),asDryRunResult({'scope':_0x4a58c8(0x105),'operation':_0x4a58c8(0xf8),'selector':{'appCode':_0x244306[_0x4a58c8(0xf6)],'roleId':_0x2c232f,'roleName':_0x2a1b06[_0x4a58c8(0x100)]},'before':projectRole(_0x2a1b06),'after':projectRole({..._0x2a1b06,..._0x5861c7['roleName']!==undefined?{'roleName':_0x5861c7[_0x4a58c8(0x100)]}:{},..._0x5861c7[_0x4a58c8(0x103)]!==undefined?{'remark':_0x5861c7[_0x4a58c8(0x103)]}:{}}),'dryRun':!![],'backend':{'method':_0x4a58c8(0xfb),'path':UPDATE_PATH},'warnings':[]},{'method':_0x4a58c8(0xfb),'url':UPDATE_PATH});},async 'execute'(_0x3fda1b){const _0x74772d=a179_0x4f443d,_0x44ea0f=_0x3fda1b['num']('id'),_0x198932=readPatch(_0x3fda1b),_0x172629=await getRoleById(_0x3fda1b[_0x74772d(0xf6)],_0x44ea0f);assertCustomRole(_0x172629,'update'),await updateAppRole({'id':_0x44ea0f,'appCode':_0x3fda1b[_0x74772d(0xf6)],..._0x198932['roleName']!==undefined?{'roleName':_0x198932[_0x74772d(0x100)]}:{},..._0x198932[_0x74772d(0x103)]!==undefined?{'remark':_0x198932[_0x74772d(0x103)]}:{}});const _0x4548f0=await getRoleById(_0x3fda1b[_0x74772d(0xf6)],_0x44ea0f);return{'ok':!![],'data':{'scope':_0x74772d(0x105),'operation':_0x74772d(0xf8),'selector':{'appCode':_0x3fda1b[_0x74772d(0xf6)],'roleId':_0x44ea0f,'roleName':_0x4548f0[_0x74772d(0x100)]},'before':projectRole(_0x172629),'after':projectRole(_0x4548f0),'dryRun':![],'backend':{'method':_0x74772d(0xfb),'path':UPDATE_PATH},'warnings':[]},'message':'Updated\x20role\x20'+_0x4548f0[_0x74772d(0x100)]+_0x74772d(0xeb)+_0x44ea0f+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a180_0x8842da=a180_0x51ec;(function(_0x4c0feb,_0x248a58){const _0x1b543d=a180_0x51ec,_0x5cf0e1=_0x4c0feb();while(!![]){try{const _0x39bff1=parseInt(_0x1b543d(0xba))/0x1*(parseInt(_0x1b543d(0xbc))/0x2)+-parseInt(_0x1b543d(0xb9))/0x3*(-parseInt(_0x1b543d(0xc1))/0x4)+-parseInt(_0x1b543d(0xb3))/0x5+parseInt(_0x1b543d(0xc4))/0x6+-parseInt(_0x1b543d(0xb4))/0x7*(-parseInt(_0x1b543d(0xbd))/0x8)+-parseInt(_0x1b543d(0xbe))/0x9+parseInt(_0x1b543d(0xb1))/0xa*(-parseInt(_0x1b543d(0xb2))/0xb);if(_0x39bff1===_0x248a58)break;else _0x5cf0e1['push'](_0x5cf0e1['shift']());}catch(_0x3b83ed){_0x5cf0e1['push'](_0x5cf0e1['shift']());}}}(a180_0x56e9,0x769ed));import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a180_0x56e9(){const _0x439d9d=['3663ThkDQk','role','190LLHFFT','1583672ghFEKk','2143863ubhsUr','userId','No\x20change:\x20user\x20','533756JALpyY','roleName','selector','44652foxdMx','username','Added\x20user\x20','3408940jgpScp','33KsmlIl','683095VwEKVu','21TyGVUa','user-add','\x20already\x20in\x20role\x20','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','roleType','21JIoUBX'];a180_0x56e9=function(){return _0x439d9d;};return a180_0x56e9();}function a180_0x51ec(_0x4647c0,_0x4a9aa5){_0x4647c0=_0x4647c0-0xb0;const _0x56e9e7=a180_0x56e9();let _0x51ec7d=_0x56e9e7[_0x4647c0];return _0x51ec7d;}import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a180_0x8842da(0xbb),'command':a180_0x8842da(0xb5),'description':a180_0x8842da(0xb7),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x2283dd){const _0x5808d0=a180_0x8842da,{mutation:_0xc85e5e}=await prepareUserMutation(_0x2283dd,_0x5808d0(0xb5),!![]);return asDryRunResult(_0xc85e5e,{'method':'POST','url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x3cdaaa){const _0x5a3203=a180_0x8842da,{mutation:_0x6779d0,changed:_0x2029d8,role:_0x304c2d,user:_0x5ce131}=await prepareUserMutation(_0x3cdaaa,_0x5a3203(0xb5),![]);return _0x2029d8&&await createDevUserRole({'appCode':_0x3cdaaa['appCode'],'userId':_0x5ce131[_0x5a3203(0xbf)],'username':_0x5ce131[_0x5a3203(0xc5)],'roleType':_0x304c2d[_0x5a3203(0xb8)],'roleId':_0x6779d0[_0x5a3203(0xc3)]['roleId']}),{'ok':!![],'data':_0x6779d0,'message':_0x2029d8?_0x5a3203(0xb0)+_0x6779d0[_0x5a3203(0xc3)][_0x5a3203(0xbf)]+'\x20to\x20role\x20'+_0x6779d0['selector'][_0x5a3203(0xc2)]:_0x5a3203(0xc0)+_0x6779d0[_0x5a3203(0xc3)][_0x5a3203(0xbf)]+_0x5a3203(0xb6)+_0x6779d0[_0x5a3203(0xc3)]['roleName']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a181_0x28ab(){const _0x3fd9a0=['POST','role','user-remove','12ztTjyN','3290160Aancgb','userId','42AnvINx','636978xuwVKn','49rqOmzy','36fmWKOk','Removed\x20user\x20','selector','38942sfApPF','118635FnGwdO','9hOYBWz','5108464vsbpeH','2920887zCYmEv','No\x20change:\x20user\x20','657715neJhTQ','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','roleName'];a181_0x28ab=function(){return _0x3fd9a0;};return a181_0x28ab();}const a181_0xa11e07=a181_0x3223;function a181_0x3223(_0xc94ba2,_0x4d76a1){_0xc94ba2=_0xc94ba2-0x117;const _0x28ab1a=a181_0x28ab();let _0x3223fa=_0x28ab1a[_0xc94ba2];return _0x3223fa;}(function(_0x46fbdc,_0x589662){const _0x5bd0f4=a181_0x3223,_0x1e2508=_0x46fbdc();while(!![]){try{const _0x33800b=-parseInt(_0x5bd0f4(0x120))/0x1*(-parseInt(_0x5bd0f4(0x126))/0x2)+-parseInt(_0x5bd0f4(0x12a))/0x3+parseInt(_0x5bd0f4(0x11d))/0x4*(parseInt(_0x5bd0f4(0x117))/0x5)+parseInt(_0x5bd0f4(0x121))/0x6*(-parseInt(_0x5bd0f4(0x122))/0x7)+parseInt(_0x5bd0f4(0x129))/0x8*(parseInt(_0x5bd0f4(0x128))/0x9)+parseInt(_0x5bd0f4(0x11e))/0xa+parseInt(_0x5bd0f4(0x127))/0xb*(parseInt(_0x5bd0f4(0x123))/0xc);if(_0x33800b===_0x589662)break;else _0x1e2508['push'](_0x1e2508['shift']());}catch(_0x2e4b34){_0x1e2508['push'](_0x1e2508['shift']());}}}(a181_0x28ab,0x78fd2));import{deleteDevUserRole}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,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':a181_0xa11e07(0x11b),'command':a181_0xa11e07(0x11c),'description':a181_0xa11e07(0x118),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x26fdd5){const _0x536124=a181_0xa11e07,{mutation:_0x4812cb}=await prepareUserMutation(_0x26fdd5,'user-remove',!![]);return asDryRunResult(_0x4812cb,{'method':_0x536124(0x11a),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x4a21f9){const _0x4ed11f=a181_0xa11e07,{matchingRelationIds:_0x2300dc,mutation:_0xabef72,changed:_0x2c89f3}=await prepareUserMutation(_0x4a21f9,_0x4ed11f(0x11c),![]);if(_0x2c89f3)for(const _0x5323f0 of _0x2300dc){await deleteDevUserRole(_0x5323f0);}return{'ok':!![],'data':_0xabef72,'message':_0x2c89f3?_0x4ed11f(0x124)+_0xabef72[_0x4ed11f(0x125)][_0x4ed11f(0x11f)]+'\x20from\x20role\x20'+_0xabef72[_0x4ed11f(0x125)][_0x4ed11f(0x119)]:_0x4ed11f(0x12b)+_0xabef72['selector']['userId']+'\x20not\x20in\x20role\x20'+_0xabef72[_0x4ed11f(0x125)][_0x4ed11f(0x119)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a182_0xf60b(_0x50eb37,_0x4baa4a){_0x50eb37=_0x50eb37-0x12a;const _0x2135c2=a182_0x2135();let _0xf60b26=_0x2135c2[_0x50eb37];return _0xf60b26;}const a182_0x3a88ae=a182_0xf60b;(function(_0x1907a0,_0x2f3ae7){const _0x2def23=a182_0xf60b,_0x23fe27=_0x1907a0();while(!![]){try{const _0x3927b8=parseInt(_0x2def23(0x130))/0x1+parseInt(_0x2def23(0x133))/0x2*(parseInt(_0x2def23(0x13a))/0x3)+parseInt(_0x2def23(0x12f))/0x4*(parseInt(_0x2def23(0x13f))/0x5)+-parseInt(_0x2def23(0x138))/0x6*(-parseInt(_0x2def23(0x137))/0x7)+parseInt(_0x2def23(0x12e))/0x8*(parseInt(_0x2def23(0x134))/0x9)+parseInt(_0x2def23(0x13b))/0xa*(parseInt(_0x2def23(0x12a))/0xb)+-parseInt(_0x2def23(0x136))/0xc*(parseInt(_0x2def23(0x12b))/0xd);if(_0x3927b8===_0x2f3ae7)break;else _0x23fe27['push'](_0x23fe27['shift']());}catch(_0x547593){_0x23fe27['push'](_0x23fe27['shift']());}}}(a182_0x2135,0x33b78));import{CliErrors}from'../../errors.js';function a182_0x2135(){const _0x2cb513=['355293ScmFUu','nickname','read','11498cTlpIG','9dGkcPq','role','3108YyBKLr','49xHlaNY','332538jSrqkP','trim','213LNTqCc','40nWWygq','userId','matchedBy','Resolved\x20\x22','15jAmiIN','Pass\x20--name\x20<nickname|username>.','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','\x22\x20→\x20userId\x20','794684SraBcn','76947Aefmdy','username','name','1971848LNfUnY','77284dwxuCo'];a182_0x2135=function(){return _0x2cb513;};return a182_0x2135();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a182_0x3a88ae(0x135),'command':'user-resolve','description':a182_0x3a88ae(0x141),'risk':a182_0x3a88ae(0x132),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x130dbd){const _0x3d4112=a182_0x3a88ae;if(!_0x130dbd['str']('name')[_0x3d4112(0x139)]())throw CliErrors['flagMissing']('name',_0x3d4112(0x140));},async 'execute'(_0x36cb29){const _0x192be3=a182_0x3a88ae,_0x5160a9=_0x36cb29['str'](_0x192be3(0x12d))['trim'](),_0xf0fc3a=await resolveUserRef(_0x5160a9);return{'ok':!![],'data':{'user':{'userId':_0xf0fc3a[_0x192be3(0x13c)],'username':_0xf0fc3a[_0x192be3(0x12c)],'nickname':_0xf0fc3a[_0x192be3(0x131)],'matchedBy':_0xf0fc3a[_0x192be3(0x13d)]}},'message':_0x192be3(0x13e)+_0x5160a9+_0x192be3(0x142)+_0xf0fc3a[_0x192be3(0x13c)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a183_0x8581e0=a183_0x3eb6;(function(_0x53bd0e,_0x18bf3f){const _0x1ba28d=a183_0x3eb6,_0x41adcd=_0x53bd0e();while(!![]){try{const _0x28feac=parseInt(_0x1ba28d(0x129))/0x1+parseInt(_0x1ba28d(0x134))/0x2*(parseInt(_0x1ba28d(0x123))/0x3)+parseInt(_0x1ba28d(0x12a))/0x4*(parseInt(_0x1ba28d(0x130))/0x5)+parseInt(_0x1ba28d(0x13a))/0x6+parseInt(_0x1ba28d(0x118))/0x7*(-parseInt(_0x1ba28d(0x124))/0x8)+parseInt(_0x1ba28d(0x119))/0x9+-parseInt(_0x1ba28d(0x13e))/0xa*(parseInt(_0x1ba28d(0x139))/0xb);if(_0x28feac===_0x18bf3f)break;else _0x41adcd['push'](_0x41adcd['shift']());}catch(_0x4aa508){_0x41adcd['push'](_0x41adcd['shift']());}}}(a183_0x370b,0x35171));function a183_0x3eb6(_0x2106f4,_0x54418e){_0x2106f4=_0x2106f4-0x117;const _0x370b3f=a183_0x370b();let _0x3eb62a=_0x370b3f[_0x2106f4];return _0x3eb62a;}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([a183_0x8581e0(0x137),'dev']);function readPackageScripts(_0x118b86){const _0x15b510=a183_0x8581e0,_0x2a22e7=resolve(_0x118b86,'package.json');if(!existsSync(_0x2a22e7))return null;try{const _0x3fb513=JSON['parse'](readFileSync(_0x2a22e7,'utf-8'));return _0x3fb513[_0x15b510(0x12e)]??{};}catch{return null;}}function detectPackageManager(_0xc4ef32){const _0x23c880=a183_0x8581e0;if(existsSync(resolve(_0xc4ef32,_0x23c880(0x135)))||existsSync(resolve(_0xc4ef32,_0x23c880(0x11f))))return'bun';if(existsSync(resolve(_0xc4ef32,_0x23c880(0x127))))return _0x23c880(0x148);if(existsSync(resolve(_0xc4ef32,_0x23c880(0x11d))))return _0x23c880(0x145);return _0x23c880(0x147);}async function versionCheck(_0xa3e2b0){const _0x232cee=a183_0x8581e0,_0xb295d8=await checkCliVersion();(_0xb295d8[_0x232cee(0x13c)]||_0xb295d8[_0x232cee(0x11b)])&&(printCliUpgradeWarning(_0xb295d8),assertCliVersionSupported(_0xb295d8));const _0x26286=await checkSdkVersion(_0xa3e2b0);if(_0x26286[_0x232cee(0x13c)])printSdkUpgradeWarning(_0x26286);}function a183_0x370b(){const _0x5a4bf6=['vite\x20preview\x20exited\x20with\x20code\x20','bun.lock','Available:\x20','(none)','preview','75rbTTCW','64LUUNtm','inherit','\x20run\x20preview\x20--watch','pnpm-lock.yaml','write','115545cvTVcb','716DiJdGw','vite','run','error','scripts','validation','3490QtyStv','Run\x20a\x20package.json\x20script','args','\x22\x20not\x20found\x20in\x20package.json.','20182MwkfRM','bun.lockb','Script\x20\x22','start','push','535414RShzuq','1504746gRErft','\x20run\x20preview','needsUpgrade','.bin','50AetKer','\x20\x20EXAMPLES','keys','Script\x20name\x20defined\x20in\x20package.json','all','join','has','yarn','script','npm','pnpm','\x20\x20\x20\x20','watch','\x0a\x20\x20Usage:\x20','cwd','close','log','No\x20package.json\x20found\x20in\x20current\x20directory.','315014LtyjhJ','695610FZwMuz','slice','belowMinimum','node_modules','yarn.lock'];a183_0x370b=function(){return _0x5a4bf6;};return a183_0x370b();}function spawnScript(_0xce3bed,_0x7f08b3,_0x7009ec,_0x5563c4){return new Promise((_0x4a223f,_0x14c5e3)=>{const _0x58eab9=a183_0x3eb6,_0x54c4b8=[_0x58eab9(0x12c),_0x7f08b3,..._0x7009ec],_0x7e9ce6=spawn(_0xce3bed,_0x54c4b8,{'cwd':_0x5563c4,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x5563c4,_0x58eab9(0x11c),_0x58eab9(0x13d))+delimiter+process.env.PATH}});_0x7e9ce6['on']('close',_0x4bb363=>{if(_0x4bb363===0x0||_0x4bb363===null)_0x4a223f();else _0x14c5e3(new Error(_0xce3bed+'\x20run\x20'+_0x7f08b3+'\x20exited\x20with\x20code\x20'+_0x4bb363));}),_0x7e9ce6['on']('error',_0x14c5e3);});}function spawnViteBuildWatch(_0xcabc58){return new Promise((_0x3aaccc,_0x470bae)=>{const _0x515e3f=a183_0x3eb6,_0x3d467c=spawn(_0x515e3f(0x12b),['build','--watch'],{'cwd':_0xcabc58,'stdio':_0x515e3f(0x125),'shell':!![],'env':{...process.env,'PATH':''+join(_0xcabc58,_0x515e3f(0x11c),_0x515e3f(0x13d))+delimiter+process.env.PATH}});_0x3d467c['on'](_0x515e3f(0x14d),_0x1e1916=>{if(_0x1e1916===0x0||_0x1e1916===null)_0x3aaccc();else _0x470bae(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x1e1916));}),_0x3d467c['on'](_0x515e3f(0x12d),_0x470bae);});}function spawnVitePreview(_0x3693db){return new Promise((_0x10b996,_0x19bb24)=>{const _0x4f0eb1=a183_0x3eb6,_0x4e10fa=spawn(_0x4f0eb1(0x12b),[_0x4f0eb1(0x122)],{'cwd':_0x3693db,'stdio':_0x4f0eb1(0x125),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3693db,_0x4f0eb1(0x11c),_0x4f0eb1(0x13d))+delimiter+process.env.PATH}});_0x4e10fa['on'](_0x4f0eb1(0x14d),_0x215056=>{const _0x36dea0=_0x4f0eb1;if(_0x215056===0x0||_0x215056===null)_0x10b996();else _0x19bb24(new Error(_0x36dea0(0x11e)+_0x215056));}),_0x4e10fa['on']('error',_0x19bb24);});}const runFlags=[{'name':a183_0x8581e0(0x14a),'type':'boolean','description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a183_0x8581e0(0x12c),'command':a183_0x8581e0(0x12c),'description':a183_0x8581e0(0x131),'risk':a183_0x8581e0(0x128),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a183_0x8581e0(0x146),'description':a183_0x8581e0(0x141),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0xd751f6=a183_0x8581e0,_0x579041=[];return _0x579041[_0xd751f6(0x138)](_0xd751f6(0x13f)),_0x579041[_0xd751f6(0x138)](_0xd751f6(0x149)+CLI_BIN_NAME+'\x20run\x20start'),_0x579041[_0xd751f6(0x138)](_0xd751f6(0x149)+CLI_BIN_NAME+'\x20run\x20build'),_0x579041[_0xd751f6(0x138)](_0xd751f6(0x149)+CLI_BIN_NAME+_0xd751f6(0x13b)),_0x579041[_0xd751f6(0x138)](_0xd751f6(0x149)+CLI_BIN_NAME+_0xd751f6(0x126)),_0x579041[_0xd751f6(0x143)]('\x0a');},async 'execute'(_0x3786f9){const _0x3be796=a183_0x8581e0,_0x36c1d9=process[_0x3be796(0x14c)](),_0x589768=_0x3786f9[_0x3be796(0x132)][0x0],_0x3a725e=_0x3786f9['args'][_0x3be796(0x11a)](0x1),_0x49a45f=readPackageScripts(_0x36c1d9);if(!_0x49a45f)throw CliErrors[_0x3be796(0x12f)](_0x3be796(0x117));if(!_0x589768){const _0x1cf6b1=Object[_0x3be796(0x140)](_0x49a45f);if(_0x1cf6b1['length']===0x0)console['log']('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x3be796(0x14e)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x5cf6b3 of _0x1cf6b1){console[_0x3be796(0x14e)](_0x3be796(0x149)+_0x5cf6b3);}console['log'](_0x3be796(0x14b)+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x49a45f[_0x589768])throw CliErrors['validation'](_0x3be796(0x136)+_0x589768+_0x3be796(0x133),_0x3be796(0x120)+(Object[_0x3be796(0x140)](_0x49a45f)[_0x3be796(0x143)](',\x20')||_0x3be796(0x121)));const _0x5bf0e1=detectPackageManager(_0x36c1d9);VERSION_CHECK_SCRIPTS[_0x3be796(0x144)](_0x589768)&&await versionCheck(_0x36c1d9);if(_0x589768===_0x3be796(0x122)&&_0x3786f9['bool'](_0x3be796(0x14a)))return await Promise[_0x3be796(0x142)]([spawnViteBuildWatch(_0x36c1d9),spawnVitePreview(_0x36c1d9)]),{'ok':!![]};return await spawnScript(_0x5bf0e1,_0x589768,_0x3a725e,_0x36c1d9),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a184_0x2c4701=a184_0x51af;(function(_0x3de10e,_0xb49a8d){const _0xb8befc=a184_0x51af,_0x11ffcf=_0x3de10e();while(!![]){try{const _0x23f94d=parseInt(_0xb8befc(0x1d0))/0x1+-parseInt(_0xb8befc(0x1cf))/0x2+-parseInt(_0xb8befc(0x1cb))/0x3+parseInt(_0xb8befc(0x1d2))/0x4+-parseInt(_0xb8befc(0x1d3))/0x5+parseInt(_0xb8befc(0x1cc))/0x6*(-parseInt(_0xb8befc(0x1ca))/0x7)+-parseInt(_0xb8befc(0x1ce))/0x8*(parseInt(_0xb8befc(0x1d1))/0x9);if(_0x23f94d===_0xb49a8d)break;else _0x11ffcf['push'](_0x11ffcf['shift']());}catch(_0x2fd562){_0x11ffcf['push'](_0x11ffcf['shift']());}}}(a184_0x47b7,0x352cb));function a184_0x47b7(){const _0x4e0d8a=['16BlOMHp','236338sjDfua','418564wYkrNN','227349baNtry','1281580iMFiMj','938985hZeOAg','14819mZntna','259017KrEtwx','222ytNPws','schema'];a184_0x47b7=function(){return _0x4e0d8a;};return a184_0x47b7();}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x54fa96){const _0x4f3906=await buildSchemaPayload();return{'ok':!![],'data':_0x4f3906};}function a184_0x51af(_0x2d0b99,_0x4a8ff5){_0x2d0b99=_0x2d0b99-0x1ca;const _0x47b753=a184_0x47b7();let _0x51af53=_0x47b753[_0x2d0b99];return _0x51af53;}export const schemaDefinition={'service':a184_0x2c4701(0x1cd),'command':'export','description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a185_0x4ceda7=a185_0x3d85;function a185_0x3543(){const _0x5d07a8=['mybatisXml','请输入\x20SQL\x20名称:','description','</select>','str','string','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','join','trim','lockFilePath','sqlName','SQL\x20名称不能为空','SQL\x20query\x20display\x20name','MyBatis\x20XML(mybatisXml)','请选择本地\x20SQL\x20模式:','nonInteractive','5721070RAeXTu','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','lastSync','普通\x20SQL(sql)','appCode','Invalid\x20database\x20selection\x20payload:\x20','250536baCfVm','dbName','utf8','map','isFinite','1488230ZGybPh','/smartapi/custom/saveUserCustomSql','5601944BywMGQ','validation','length','db-id','flagMissing','sqlCode','1257876pdjzMG','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','Target\x20database\x20ID','Local\x20SQL\x20file\x20mode','sql','dbId\x20不能为空','SELECT\x201\x20AS\x20id;','File\x20already\x20exists:\x20','dbId','22595859FQQlGz','sqls','dbId\x20必须为正整数','9uroKOg','toISOString','mode','1870218vQkaVR','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','number','name','sqlRootDir','catch','new','<server-generated-sqlCode>','isInteger','36QNQdpB','POST'];a185_0x3543=function(){return _0x5d07a8;};return a185_0x3543();}(function(_0x54b776,_0x20c4eb){const _0x436292=a185_0x3d85,_0x5bbe8a=_0x54b776();while(!![]){try{const _0x478239=parseInt(_0x436292(0x1a7))/0x1+parseInt(_0x436292(0x1ac))/0x2+-parseInt(_0x436292(0x1c0))/0x3*(parseInt(_0x436292(0x1b4))/0x4)+parseInt(_0x436292(0x1a0))/0x5+-parseInt(_0x436292(0x1cc))/0x6*(-parseInt(_0x436292(0x1c3))/0x7)+parseInt(_0x436292(0x1ae))/0x8+-parseInt(_0x436292(0x1bd))/0x9;if(_0x478239===_0x20c4eb)break;else _0x5bbe8a['push'](_0x5bbe8a['shift']());}catch(_0x3c7f58){_0x5bbe8a['push'](_0x5bbe8a['shift']());}}}(a185_0x3543,0xf13be));import{writeFile}from'node:fs/promises';function a185_0x3d85(_0x241970,_0x10a992){_0x241970=_0x241970-0x197;const _0x354394=a185_0x3543();let _0x3d855f=_0x354394[_0x241970];return _0x3d855f;}import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x3f4d92){const _0x542d1f=a185_0x3d85;if(_0x3f4d92===_0x542d1f(0x1ce))return[_0x542d1f(0x1a2),'\x20\x20SELECT\x201\x20AS\x20id',_0x542d1f(0x1d1),''][_0x542d1f(0x197)]('\x0a');return[_0x542d1f(0x1ba),'']['join']('\x0a');}export const sqlCreate={'service':a185_0x4ceda7(0x1b8),'command':'create','description':a185_0x4ceda7(0x1b5),'risk':'write','flags':[{'name':a185_0x4ceda7(0x1c6),'type':'string','description':a185_0x4ceda7(0x19c)},{'name':a185_0x4ceda7(0x1b1),'type':a185_0x4ceda7(0x1c5),'description':a185_0x4ceda7(0x1b6)},{'name':'mode','type':a185_0x4ceda7(0x1d3),'enum':['sql',a185_0x4ceda7(0x1ce)],'description':a185_0x4ceda7(0x1b7)}],async 'validate'(_0x5dca97){const _0x526b94=a185_0x4ceda7;if(!_0x5dca97[_0x526b94(0x19f)])return;if(!_0x5dca97[_0x526b94(0x1d2)]('name')[_0x526b94(0x198)]())throw CliErrors['flagMissing'](_0x526b94(0x1c6),_0x526b94(0x1a1));const _0x45f541=resolveProvidedDbId(_0x5dca97);if(typeof _0x45f541!==_0x526b94(0x1c5)||!Number[_0x526b94(0x1ab)](_0x45f541)||_0x45f541<=0x0)throw CliErrors[_0x526b94(0x1b2)](_0x526b94(0x1b1),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x5dca97['str']('mode')[_0x526b94(0x198)]())throw CliErrors[_0x526b94(0x1b2)](_0x526b94(0x1c2),_0x526b94(0x1d4));},async 'dryRun'(_0x5d795b){const _0x27ae90=a185_0x4ceda7,_0x22917d=loadSqlProjectConfig(_0x5d795b[_0x27ae90(0x1a5)]),{sqlName:_0x25f812,dbId:_0x3a929b,dbName:_0x11cd2c,mode:_0x4bcf99}=await resolveSqlNewInputs(_0x5d795b),_0x27a349=buildSqlRelativePath(_0x27ae90(0x1ca),_0x25f812,_0x11cd2c,_0x4bcf99,_0x3a929b),_0x36863d=_0x22917d[_0x27ae90(0x1c7)]+'/'+_0x27a349;return{'method':_0x27ae90(0x1cd),'url':_0x27ae90(0x1ad),'body':{'appCode':_0x5d795b[_0x27ae90(0x1a5)],'sqlName':_0x25f812,'dbId':_0x3a929b,'mode':_0x4bcf99,'localPath':_0x36863d},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x22917d['sqlRootDir']};},async 'execute'(_0x35ae9e){const _0x1e3c75=a185_0x4ceda7,_0x4f61b3=loadSqlProjectConfig(_0x35ae9e['appCode']),{sqlName:_0x29fd3b,dbId:_0x35813f,dbName:_0x183935,mode:_0x1aee93}=await resolveSqlNewInputs(_0x35ae9e),_0x2d1f64=generateSqlTemplate(_0x1aee93),_0x5eb600=await createSqlQuery({'appCode':_0x35ae9e[_0x1e3c75(0x1a5)],'sqlName':_0x29fd3b,'dbId':_0x35813f,'sqlContent':_0x2d1f64}),_0x2a4163=ensureRemoteSqlContent(_0x5eb600),_0x3ebe0f=_0x183935||await getDbName(_0x35ae9e[_0x1e3c75(0x1a5)],_0x35813f)[_0x1e3c75(0x1c8)](()=>undefined),_0x5cf76b=buildSqlRelativePath(_0x5eb600[_0x1e3c75(0x1b3)],_0x5eb600['sqlName'],_0x3ebe0f,_0x1aee93,_0x35813f),_0x31be46=_0x4f61b3[_0x1e3c75(0x1c7)]+'/'+_0x5cf76b,_0x228e25=buildLocalSqlFileContent({'sqlCode':_0x5eb600['sqlCode'],'sqlName':_0x5eb600[_0x1e3c75(0x19a)],'dbId':_0x5eb600[_0x1e3c75(0x1bc)]},_0x2a4163,{'dbName':_0x3ebe0f,'mode':_0x1aee93,'syncedAt':new Date()[_0x1e3c75(0x1c1)](),'description':_0x5eb600[_0x1e3c75(0x1d0)]});if(await fileExists(_0x31be46))throw CliErrors[_0x1e3c75(0x1af)](_0x1e3c75(0x1bb)+_0x31be46);await ensureParentDirectory(_0x31be46),await writeFile(_0x31be46,_0x228e25,_0x1e3c75(0x1a9));const _0x37624d=await readSqlLockFile(_0x4f61b3[_0x1e3c75(0x199)]),{lockData:_0x26ae6b,appLock:_0x212c87}=ensureSqlLockScope(_0x37624d??createEmptySqlLock(),_0x4f61b3['appCode'],_0x4f61b3['sqlRoot'],_0x1e3c75(0x1c9));return _0x212c87[_0x1e3c75(0x1be)][_0x5eb600[_0x1e3c75(0x1b3)]]={...buildSqlLockEntry(_0x5eb600,_0x2a4163,computeSqlContentHash(_0x228e25),{'dbName':_0x3ebe0f}),'path':_0x5cf76b,'mode':_0x1aee93},_0x212c87[_0x1e3c75(0x1a3)]=new Date()[_0x1e3c75(0x1c1)](),await writeSqlLockFile(_0x4f61b3['lockFilePath'],_0x26ae6b),{'ok':!![],'data':{'id':_0x5eb600['id'],'sqlCode':_0x5eb600[_0x1e3c75(0x1b3)],'sqlName':_0x5eb600[_0x1e3c75(0x19a)],'dbId':_0x5eb600[_0x1e3c75(0x1bc)],'path':_0x31be46,'mode':_0x1aee93},'message':'Created\x20SQL\x20query\x20'+_0x5eb600[_0x1e3c75(0x1b3)]};}};async function resolveSqlNewInputs(_0x71a980){const _0x227c24=await resolveSqlNameInput(_0x71a980),{dbId:_0x4398c2,dbName:_0x5a5845}=await resolveDbSelection(_0x71a980),_0x4df483=await resolveSqlModeInput(_0x71a980);return{'sqlName':_0x227c24,'dbId':_0x4398c2,'dbName':_0x5a5845,'mode':_0x4df483};}async function resolveSqlNameInput(_0x24b148){const _0x232c3=a185_0x4ceda7,_0x615e31=_0x24b148[_0x232c3(0x1d2)](_0x232c3(0x1c6))[_0x232c3(0x198)]();if(_0x615e31)return _0x615e31;if(_0x24b148['nonInteractive'])throw CliErrors['flagMissing'](_0x232c3(0x1c6),_0x232c3(0x1a1));return(await input({'message':_0x232c3(0x1cf),'validate':_0x40f853=>_0x40f853[_0x232c3(0x198)]()?!![]:_0x232c3(0x19b)}))[_0x232c3(0x198)]();}async function resolveDbSelection(_0x40565b){const _0x9c47c4=a185_0x4ceda7,_0x4c0e7c=resolveProvidedDbId(_0x40565b);if(typeof _0x4c0e7c===_0x9c47c4(0x1c5)&&Number['isFinite'](_0x4c0e7c)&&_0x4c0e7c>0x0)return{'dbId':_0x4c0e7c,'dbName':await getDbName(_0x40565b[_0x9c47c4(0x1a5)],_0x4c0e7c)[_0x9c47c4(0x1c8)](()=>undefined)};if(_0x40565b[_0x9c47c4(0x19f)])throw CliErrors[_0x9c47c4(0x1b2)](_0x9c47c4(0x1b1),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x99e0cb=await listDatabases(_0x40565b[_0x9c47c4(0x1a5)])['catch'](()=>[]);if(_0x99e0cb['length']===0x1)return{'dbId':_0x99e0cb[0x0][_0x9c47c4(0x1bc)],'dbName':_0x99e0cb[0x0][_0x9c47c4(0x1a8)]};if(_0x99e0cb[_0x9c47c4(0x1b0)]>0x1){const _0x57d05a=await select({'message':'请选择目标数据库:','choices':[..._0x99e0cb[_0x9c47c4(0x1aa)](_0x2bd821=>({'name':_0x2bd821['dbName']+'\x20('+_0x2bd821['dbId']+')','value':serializeDbSelection(_0x2bd821)})),{'name':'✎\x20手动输入\x20dbId','value':'__manual__'}]});if(_0x57d05a!=='__manual__')return deserializeDbSelection(_0x57d05a);}const _0x67a85a=await input({'message':'请输入目标数据库\x20dbId:','validate':_0x4d3da7=>{const _0x217e86=_0x9c47c4,_0x556b86=_0x4d3da7[_0x217e86(0x198)]();if(!_0x556b86)return _0x217e86(0x1b9);const _0x2d5235=Number(_0x556b86);if(!Number[_0x217e86(0x1cb)](_0x2d5235)||_0x2d5235<=0x0)return _0x217e86(0x1bf);return!![];}});return{'dbId':Number(_0x67a85a[_0x9c47c4(0x198)]())};}async function resolveSqlModeInput(_0x4faa3b){const _0x38dc62=a185_0x4ceda7,_0x6b1192=_0x4faa3b[_0x38dc62(0x1d2)](_0x38dc62(0x1c2))['trim']();if(_0x6b1192===_0x38dc62(0x1b8)||_0x6b1192==='mybatisXml')return _0x6b1192;if(_0x4faa3b['nonInteractive'])throw CliErrors[_0x38dc62(0x1b2)](_0x38dc62(0x1c2),_0x38dc62(0x1d4));return await select({'message':_0x38dc62(0x19e),'choices':[{'name':_0x38dc62(0x1a4),'value':_0x38dc62(0x1b8),'description':_0x38dc62(0x1c4)},{'name':_0x38dc62(0x19d),'value':_0x38dc62(0x1ce),'description':'适合带动态标签的\x20MyBatis\x20XML\x20SQL'}]});}function serializeDbSelection(_0x3be1e1){const _0x2e4284=a185_0x4ceda7;return JSON['stringify']({'dbId':_0x3be1e1[_0x2e4284(0x1bc)],'dbName':_0x3be1e1[_0x2e4284(0x1a8)]});}function deserializeDbSelection(_0x2b6dd5){const _0xaae936=a185_0x4ceda7;try{const _0x419302=JSON['parse'](_0x2b6dd5);if(typeof _0x419302['dbId']===_0xaae936(0x1c5)&&Number[_0xaae936(0x1ab)](_0x419302['dbId']))return{'dbId':_0x419302[_0xaae936(0x1bc)],'dbName':_0x419302[_0xaae936(0x1a8)]};}catch{}throw CliErrors[_0xaae936(0x1af)](_0xaae936(0x1a6)+_0x2b6dd5);}function resolveProvidedDbId(_0x2cdb08){const _0x13017e=a185_0x4ceda7,_0x5d467a=_0x2cdb08['flag']('db-id');if(typeof _0x5d467a===_0x13017e(0x1c5)&&Number[_0x13017e(0x1ab)](_0x5d467a))return _0x5d467a;return undefined;}
|
|
1
|
+
const a185_0x149a8b=a185_0x2c45;(function(_0x37019b,_0x5bcf17){const _0x21958f=a185_0x2c45,_0x58a1b8=_0x37019b();while(!![]){try{const _0x5302db=-parseInt(_0x21958f(0x18f))/0x1+-parseInt(_0x21958f(0x1c8))/0x2+parseInt(_0x21958f(0x1c3))/0x3+-parseInt(_0x21958f(0x1be))/0x4*(-parseInt(_0x21958f(0x1b4))/0x5)+parseInt(_0x21958f(0x19c))/0x6*(parseInt(_0x21958f(0x1a5))/0x7)+parseInt(_0x21958f(0x1c6))/0x8+parseInt(_0x21958f(0x1c7))/0x9*(-parseInt(_0x21958f(0x1cc))/0xa);if(_0x5302db===_0x5bcf17)break;else _0x58a1b8['push'](_0x58a1b8['shift']());}catch(_0x413b17){_0x58a1b8['push'](_0x58a1b8['shift']());}}}(a185_0xaf19,0xa16cd));function a185_0xaf19(){const _0x155994=['lockFilePath','string','description','Invalid\x20database\x20selection\x20payload:\x20','SELECT\x201\x20AS\x20id;','sqlName','<server-generated-sqlCode>','</select>','number','db-id','str','join','10UpXULg','write','sql','sqlCode','nonInteractive','SQL\x20query\x20display\x20name','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','map','stringify','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','1574036yXekGK','sqlRootDir','appCode','请输入目标数据库\x20dbId:','mode','3818751INBouO','请选择目标数据库:','POST','4096352VHybIz','694395ztAFSa','1021234ijpmqH','toISOString','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','260NEFwtM','validation','isInteger','dbName','name','123324ougrlJ','请输入\x20SQL\x20名称:','dbId\x20必须为正整数','length','MyBatis\x20XML(mybatisXml)','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','isFinite','flagMissing','utf8','适合带动态标签的\x20MyBatis\x20XML\x20SQL','mybatisXml','lastSync','✎\x20手动输入\x20dbId','1458378JsVEFw','trim','Local\x20SQL\x20file\x20mode','new','catch','create','sqlRoot','__manual__','普通\x20SQL(sql)','21eABcDm','\x20\x20SELECT\x201\x20AS\x20id','dbId'];a185_0xaf19=function(){return _0x155994;};return a185_0xaf19();}import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x1baa76){const _0xb6981c=a185_0x2c45;if(_0x1baa76===_0xb6981c(0x199))return[_0xb6981c(0x194),_0xb6981c(0x1a6),_0xb6981c(0x1af),''][_0xb6981c(0x1b3)]('\x0a');return[_0xb6981c(0x1ac),''][_0xb6981c(0x1b3)]('\x0a');}export const sqlCreate={'service':a185_0x149a8b(0x1b6),'command':a185_0x149a8b(0x1a1),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a185_0x149a8b(0x1b5),'flags':[{'name':a185_0x149a8b(0x1d0),'type':a185_0x149a8b(0x1a9),'description':a185_0x149a8b(0x1b9)},{'name':a185_0x149a8b(0x1b1),'type':'number','description':'Target\x20database\x20ID'},{'name':a185_0x149a8b(0x1c2),'type':a185_0x149a8b(0x1a9),'enum':['sql',a185_0x149a8b(0x199)],'description':a185_0x149a8b(0x19e)}],async 'validate'(_0x107b25){const _0x784498=a185_0x149a8b;if(!_0x107b25[_0x784498(0x1b8)])return;if(!_0x107b25['str'](_0x784498(0x1d0))[_0x784498(0x19d)]())throw CliErrors[_0x784498(0x196)]('name',_0x784498(0x1ca));const _0x2c70b7=resolveProvidedDbId(_0x107b25);if(typeof _0x2c70b7!=='number'||!Number[_0x784498(0x195)](_0x2c70b7)||_0x2c70b7<=0x0)throw CliErrors[_0x784498(0x196)](_0x784498(0x1b1),_0x784498(0x1cb));if(!_0x107b25[_0x784498(0x1b2)]('mode')[_0x784498(0x19d)]())throw CliErrors[_0x784498(0x196)]('mode',_0x784498(0x1ba));},async 'dryRun'(_0x318be5){const _0x168dab=a185_0x149a8b,_0x423770=loadSqlProjectConfig(_0x318be5['appCode']),{sqlName:_0x299db,dbId:_0x5f17fe,dbName:_0x19dd14,mode:_0x35d169}=await resolveSqlNewInputs(_0x318be5),_0x1e37c3=buildSqlRelativePath(_0x168dab(0x1ae),_0x299db,_0x19dd14,_0x35d169,_0x5f17fe),_0x446838=_0x423770[_0x168dab(0x1bf)]+'/'+_0x1e37c3;return{'method':_0x168dab(0x1c5),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x318be5[_0x168dab(0x1c0)],'sqlName':_0x299db,'dbId':_0x5f17fe,'mode':_0x35d169,'localPath':_0x446838},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x423770['sqlRootDir']};},async 'execute'(_0x44138b){const _0x18b80d=a185_0x149a8b,_0x2d97e8=loadSqlProjectConfig(_0x44138b['appCode']),{sqlName:_0x4e8cb0,dbId:_0x1150e5,dbName:_0x4cdfa4,mode:_0x58bdb3}=await resolveSqlNewInputs(_0x44138b),_0x529ac9=generateSqlTemplate(_0x58bdb3),_0xa86a9d=await createSqlQuery({'appCode':_0x44138b[_0x18b80d(0x1c0)],'sqlName':_0x4e8cb0,'dbId':_0x1150e5,'sqlContent':_0x529ac9}),_0x177a5e=ensureRemoteSqlContent(_0xa86a9d),_0x1f9895=_0x4cdfa4||await getDbName(_0x44138b[_0x18b80d(0x1c0)],_0x1150e5)[_0x18b80d(0x1a0)](()=>undefined),_0x20d0cd=buildSqlRelativePath(_0xa86a9d[_0x18b80d(0x1b7)],_0xa86a9d[_0x18b80d(0x1ad)],_0x1f9895,_0x58bdb3,_0x1150e5),_0x47107f=_0x2d97e8['sqlRootDir']+'/'+_0x20d0cd,_0x46657a=buildLocalSqlFileContent({'sqlCode':_0xa86a9d[_0x18b80d(0x1b7)],'sqlName':_0xa86a9d[_0x18b80d(0x1ad)],'dbId':_0xa86a9d[_0x18b80d(0x1a7)]},_0x177a5e,{'dbName':_0x1f9895,'mode':_0x58bdb3,'syncedAt':new Date()['toISOString'](),'description':_0xa86a9d[_0x18b80d(0x1aa)]});if(await fileExists(_0x47107f))throw CliErrors[_0x18b80d(0x1cd)]('File\x20already\x20exists:\x20'+_0x47107f);await ensureParentDirectory(_0x47107f),await writeFile(_0x47107f,_0x46657a,_0x18b80d(0x197));const _0x18cfbb=await readSqlLockFile(_0x2d97e8[_0x18b80d(0x1a8)]),{lockData:_0x1ecf8a,appLock:_0x2d298a}=ensureSqlLockScope(_0x18cfbb??createEmptySqlLock(),_0x2d97e8['appCode'],_0x2d97e8[_0x18b80d(0x1a2)],_0x18b80d(0x19f));return _0x2d298a['sqls'][_0xa86a9d[_0x18b80d(0x1b7)]]={...buildSqlLockEntry(_0xa86a9d,_0x177a5e,computeSqlContentHash(_0x46657a),{'dbName':_0x1f9895}),'path':_0x20d0cd,'mode':_0x58bdb3},_0x2d298a[_0x18b80d(0x19a)]=new Date()[_0x18b80d(0x1c9)](),await writeSqlLockFile(_0x2d97e8['lockFilePath'],_0x1ecf8a),{'ok':!![],'data':{'id':_0xa86a9d['id'],'sqlCode':_0xa86a9d[_0x18b80d(0x1b7)],'sqlName':_0xa86a9d['sqlName'],'dbId':_0xa86a9d['dbId'],'path':_0x47107f,'mode':_0x58bdb3},'message':'Created\x20SQL\x20query\x20'+_0xa86a9d[_0x18b80d(0x1b7)]};}};async function resolveSqlNewInputs(_0x24a146){const _0x2fdc9a=await resolveSqlNameInput(_0x24a146),{dbId:_0x443133,dbName:_0x222215}=await resolveDbSelection(_0x24a146),_0x41f4c2=await resolveSqlModeInput(_0x24a146);return{'sqlName':_0x2fdc9a,'dbId':_0x443133,'dbName':_0x222215,'mode':_0x41f4c2};}async function resolveSqlNameInput(_0x476f17){const _0xd3eda7=a185_0x149a8b,_0x2d15e3=_0x476f17[_0xd3eda7(0x1b2)](_0xd3eda7(0x1d0))['trim']();if(_0x2d15e3)return _0x2d15e3;if(_0x476f17[_0xd3eda7(0x1b8)])throw CliErrors['flagMissing'](_0xd3eda7(0x1d0),_0xd3eda7(0x1ca));return(await input({'message':_0xd3eda7(0x190),'validate':_0x4e39e8=>_0x4e39e8[_0xd3eda7(0x19d)]()?!![]:'SQL\x20名称不能为空'}))['trim']();}async function resolveDbSelection(_0x2e1520){const _0x4f3b30=a185_0x149a8b,_0x4560d3=resolveProvidedDbId(_0x2e1520);if(typeof _0x4560d3==='number'&&Number[_0x4f3b30(0x195)](_0x4560d3)&&_0x4560d3>0x0)return{'dbId':_0x4560d3,'dbName':await getDbName(_0x2e1520[_0x4f3b30(0x1c0)],_0x4560d3)[_0x4f3b30(0x1a0)](()=>undefined)};if(_0x2e1520[_0x4f3b30(0x1b8)])throw CliErrors['flagMissing'](_0x4f3b30(0x1b1),_0x4f3b30(0x1cb));const _0x4fe2da=await listDatabases(_0x2e1520[_0x4f3b30(0x1c0)])[_0x4f3b30(0x1a0)](()=>[]);if(_0x4fe2da['length']===0x1)return{'dbId':_0x4fe2da[0x0][_0x4f3b30(0x1a7)],'dbName':_0x4fe2da[0x0][_0x4f3b30(0x1cf)]};if(_0x4fe2da[_0x4f3b30(0x192)]>0x1){const _0x21236b=await select({'message':_0x4f3b30(0x1c4),'choices':[..._0x4fe2da[_0x4f3b30(0x1bb)](_0x38f315=>({'name':_0x38f315[_0x4f3b30(0x1cf)]+'\x20('+_0x38f315[_0x4f3b30(0x1a7)]+')','value':serializeDbSelection(_0x38f315)})),{'name':_0x4f3b30(0x19b),'value':_0x4f3b30(0x1a3)}]});if(_0x21236b!==_0x4f3b30(0x1a3))return deserializeDbSelection(_0x21236b);}const _0x449555=await input({'message':_0x4f3b30(0x1c1),'validate':_0x754d3e=>{const _0x4c85a0=_0x4f3b30,_0x96f6c6=_0x754d3e[_0x4c85a0(0x19d)]();if(!_0x96f6c6)return'dbId\x20不能为空';const _0x162fe5=Number(_0x96f6c6);if(!Number[_0x4c85a0(0x1ce)](_0x162fe5)||_0x162fe5<=0x0)return _0x4c85a0(0x191);return!![];}});return{'dbId':Number(_0x449555['trim']())};}async function resolveSqlModeInput(_0x4f95bc){const _0x5709c0=a185_0x149a8b,_0x26822b=_0x4f95bc[_0x5709c0(0x1b2)]('mode')[_0x5709c0(0x19d)]();if(_0x26822b==='sql'||_0x26822b===_0x5709c0(0x199))return _0x26822b;if(_0x4f95bc[_0x5709c0(0x1b8)])throw CliErrors[_0x5709c0(0x196)]('mode',_0x5709c0(0x1ba));return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':_0x5709c0(0x1a4),'value':_0x5709c0(0x1b6),'description':_0x5709c0(0x1bd)},{'name':_0x5709c0(0x193),'value':_0x5709c0(0x199),'description':_0x5709c0(0x198)}]});}function serializeDbSelection(_0x25cca5){const _0x4363f3=a185_0x149a8b;return JSON[_0x4363f3(0x1bc)]({'dbId':_0x25cca5[_0x4363f3(0x1a7)],'dbName':_0x25cca5[_0x4363f3(0x1cf)]});}function a185_0x2c45(_0x44f3e1,_0x4535b3){_0x44f3e1=_0x44f3e1-0x18f;const _0xaf197e=a185_0xaf19();let _0x2c4514=_0xaf197e[_0x44f3e1];return _0x2c4514;}function deserializeDbSelection(_0x27adbc){const _0x42f5c8=a185_0x149a8b;try{const _0x5d1fc5=JSON['parse'](_0x27adbc);if(typeof _0x5d1fc5[_0x42f5c8(0x1a7)]==='number'&&Number[_0x42f5c8(0x195)](_0x5d1fc5[_0x42f5c8(0x1a7)]))return{'dbId':_0x5d1fc5['dbId'],'dbName':_0x5d1fc5[_0x42f5c8(0x1cf)]};}catch{}throw CliErrors[_0x42f5c8(0x1cd)](_0x42f5c8(0x1ab)+_0x27adbc);}function resolveProvidedDbId(_0x433c5a){const _0x53913d=a185_0x149a8b,_0x2ee14b=_0x433c5a['flag'](_0x53913d(0x1b1));if(typeof _0x2ee14b===_0x53913d(0x1b0)&&Number['isFinite'](_0x2ee14b))return _0x2ee14b;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a186_0x411079=a186_0x47a4;(function(_0x22cdd6,_0x4c37e1){const _0x14c27a=a186_0x47a4,_0x80fbff=_0x22cdd6();while(!![]){try{const _0x4cdff4=parseInt(_0x14c27a(0x115))/0x1+-parseInt(_0x14c27a(0x102))/0x2*(-parseInt(_0x14c27a(0x108))/0x3)+-parseInt(_0x14c27a(0x10a))/0x4+-parseInt(_0x14c27a(0x116))/0x5+parseInt(_0x14c27a(0x106))/0x6+parseInt(_0x14c27a(0x100))/0x7*(-parseInt(_0x14c27a(0x117))/0x8)+-parseInt(_0x14c27a(0x11a))/0x9*(-parseInt(_0x14c27a(0x10e))/0xa);if(_0x4cdff4===_0x4c37e1)break;else _0x80fbff['push'](_0x80fbff['shift']());}catch(_0x273a76){_0x80fbff['push'](_0x80fbff['shift']());}}}(a186_0x38e9,0xd0c85));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a186_0x38e9(){const _0x407574=['remoteId','length','10yCGhSn','projectRoot','trashedTo','sqlcode','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','lockFilePath','sqlRoot','660800jFtjFh','2349335IbYwLQ','168vBLYzH','\x20(local\x20file\x20moved\x20to\x20trash)','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','3289716atuQzG','validation','trashDir','entries','sqls','appCode','delete','toISOString','333263dMtgeM','/smartapi/custom/deleteUserCustomSql','98148bIBdhD','str','replace','sql','9089682TbkASp','SQL\x20lock\x20file\x20not\x20found.','75yskOTX','sqlRootDir','5773168ROFMwL','Deleted\x20'];a186_0x38e9=function(){return _0x407574;};return a186_0x38e9();}function a186_0x47a4(_0x4e4ca4,_0x38968c){_0x4e4ca4=_0x4e4ca4-0xff;const _0x38e975=a186_0x38e9();let _0x47a4c1=_0x38e975[_0x4e4ca4];return _0x47a4c1;}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':a186_0x411079(0x105),'command':a186_0x411079(0x120),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x4894fd){const _0x2b50e3=a186_0x411079,_0x204db7=loadSqlProjectConfig(_0x4894fd[_0x2b50e3(0x11f)]),_0x41c870=await readSqlLockFile(_0x204db7['lockFilePath']);if(!_0x41c870)throw CliErrors[_0x2b50e3(0x11b)](_0x2b50e3(0x119));},async 'dryRun'(_0x1199ca){const _0x3dd43d=a186_0x411079,_0x58d677=loadSqlProjectConfig(_0x1199ca['appCode']),_0x315ca1=await readSqlLockFile(_0x58d677[_0x3dd43d(0x113)]);if(!_0x315ca1)throw CliErrors[_0x3dd43d(0x11b)](_0x3dd43d(0x119));const {appLock:_0x5114f7}=ensureSqlLockScope(_0x315ca1,_0x1199ca[_0x3dd43d(0x11f)],_0x58d677[_0x3dd43d(0x114)],_0x3dd43d(0x120)),_0x11b8ee=_0x1199ca[_0x3dd43d(0x103)](_0x3dd43d(0x111)),_0x2541c3=_0x5114f7[_0x3dd43d(0x11e)][_0x11b8ee];if(!_0x2541c3)throw CliErrors[_0x3dd43d(0x11b)](_0x3dd43d(0x112)+_0x11b8ee+'\x22.');return{'method':'POST','url':_0x3dd43d(0x101),'body':{'sqlCode':_0x11b8ee,'id':_0x2541c3[_0x3dd43d(0x10c)],'localPath':resolveLocalSqlFilePath(_0x58d677,_0x11b8ee,_0x2541c3)},'description':'Would\x20delete\x20SQL\x20'+_0x11b8ee+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x58d677[_0x3dd43d(0x11c)]};},async 'execute'(_0x29c2b2){const _0x558fa7=a186_0x411079,_0x109839=loadSqlProjectConfig(_0x29c2b2[_0x558fa7(0x11f)]),_0x5e9030=await readSqlLockFile(_0x109839[_0x558fa7(0x113)]);if(!_0x5e9030)throw CliErrors[_0x558fa7(0x11b)](_0x558fa7(0x107));const {lockData:_0x19f659,appLock:_0x2541f3}=ensureSqlLockScope(_0x5e9030,_0x29c2b2[_0x558fa7(0x11f)],_0x109839[_0x558fa7(0x114)],_0x558fa7(0x120)),_0x379389=_0x29c2b2[_0x558fa7(0x103)](_0x558fa7(0x111)),_0x8df452=_0x2541f3[_0x558fa7(0x11e)][_0x379389];if(!_0x8df452)throw CliErrors['validation'](_0x558fa7(0x112)+_0x379389+'\x22.');await deleteSqlQuery({'id':_0x8df452[_0x558fa7(0x10c)],'sqlCode':_0x379389}),_0x2541f3[_0x558fa7(0x11e)]=Object['fromEntries'](Object[_0x558fa7(0x11d)](_0x2541f3[_0x558fa7(0x11e)])['filter'](([_0x4bc28b])=>_0x4bc28b!==_0x379389)),_0x2541f3['lastSync']=new Date()[_0x558fa7(0xff)](),await writeSqlLockFile(_0x109839[_0x558fa7(0x113)],_0x19f659);const _0x3d8437=resolveLocalSqlFilePath(_0x109839,_0x379389,_0x8df452);let _0x2e904a;await fileExists(_0x3d8437)&&(_0x2e904a=await moveToTrash(_0x109839[_0x558fa7(0x10f)],_0x109839[_0x558fa7(0x11c)],_0x3d8437),await cleanupEmptyDirectories(dirname(_0x3d8437),_0x109839[_0x558fa7(0x109)]));const _0x156867={'deleted':_0x379389,'remoteId':_0x8df452['remoteId']};if(_0x2e904a)_0x156867[_0x558fa7(0x110)]=_0x2e904a;return{'ok':!![],'data':_0x156867,'message':_0x558fa7(0x10b)+_0x379389+(_0x2e904a?_0x558fa7(0x118):'')};}};async function moveToTrash(_0x58d2d6,_0x15e880,_0x1ceb9f){const _0x3e3573=a186_0x411079,_0x2a1003=new Date()[_0x3e3573(0xff)]()[_0x3e3573(0x104)](/[:.]/g,'-'),_0xbf1c99=relative(_0x58d2d6,_0x1ceb9f),_0x1f49b2=join(_0x15e880,_0x2a1003,_0xbf1c99);return await mkdir(dirname(_0x1f49b2),{'recursive':!![]}),await rename(_0x1ceb9f,_0x1f49b2),_0x1f49b2;}async function cleanupEmptyDirectories(_0x1ab0f2,_0x1b2e2b){const _0x32b699=a186_0x411079;let _0x20bc92=resolve(_0x1ab0f2);const _0x340f84=resolve(_0x1b2e2b);while(_0x20bc92['startsWith'](''+_0x340f84+sep)||_0x20bc92===_0x340f84){if(_0x20bc92===_0x340f84)return;try{const _0x19b4cb=await readdir(_0x20bc92);if(_0x19b4cb[_0x32b699(0x10d)]>0x0)return;await rmdir(_0x20bc92);}catch{return;}_0x20bc92=dirname(_0x20bc92);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a187_0xf6e8(){const _0x22c8fd=['bool','46239AqSurY','detail','Return\x20full\x20raw\x20SQL\x20query\x20object','1270544edeWUu','str','description','read','sqlContent','126954lwZfTx','4luEyfT','10730nDWMIp','dbId','sqlcode','884121uMXeTI','appCode','334735xITdMu','8XbIHJx','boolean','sql','1551kUlALH','sqlName','479418FCJqsZ','6KNjyVq','verbose'];a187_0xf6e8=function(){return _0x22c8fd;};return a187_0xf6e8();}function a187_0x54ed(_0x2e9ad4,_0x3f73aa){_0x2e9ad4=_0x2e9ad4-0x10a;const _0xf6e871=a187_0xf6e8();let _0x54edf1=_0xf6e871[_0x2e9ad4];return _0x54edf1;}const a187_0x2e4b23=a187_0x54ed;(function(_0x243647,_0x48fb3c){const _0x334e35=a187_0x54ed,_0x510fe7=_0x243647();while(!![]){try{const _0xdad803=parseInt(_0x334e35(0x11e))/0x1*(parseInt(_0x334e35(0x115))/0x2)+parseInt(_0x334e35(0x11a))/0x3*(-parseInt(_0x334e35(0x10e))/0x4)+-parseInt(_0x334e35(0x114))/0x5+parseInt(_0x334e35(0x11b))/0x6*(parseInt(_0x334e35(0x112))/0x7)+parseInt(_0x334e35(0x121))/0x8+parseInt(_0x334e35(0x10d))/0x9+-parseInt(_0x334e35(0x10f))/0xa*(parseInt(_0x334e35(0x118))/0xb);if(_0xdad803===_0x48fb3c)break;else _0x510fe7['push'](_0x510fe7['shift']());}catch(_0x1b1f80){_0x510fe7['push'](_0x510fe7['shift']());}}}(a187_0xf6e8,0x19e99));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a187_0x2e4b23(0x117),'command':a187_0x2e4b23(0x11f),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a187_0x2e4b23(0x10b),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a187_0x2e4b23(0x116),'description':a187_0x2e4b23(0x120)}],async 'execute'(_0x4b978d){const _0x318b6a=a187_0x2e4b23,_0x5dbe94=await getSqlQueryInfo(_0x4b978d[_0x318b6a(0x113)],_0x4b978d[_0x318b6a(0x122)](_0x318b6a(0x111))),_0x37df38=_0x4b978d[_0x318b6a(0x11d)](_0x318b6a(0x11c));if(_0x37df38)return{'ok':!![],'data':_0x5dbe94};const _0x2de803=_0x5dbe94['dbId']?await getDbName(_0x4b978d['appCode'],_0x5dbe94[_0x318b6a(0x110)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x5dbe94['sqlCode'],'sqlName':_0x5dbe94[_0x318b6a(0x119)],'db':_0x2de803?_0x2de803+'\x20('+_0x5dbe94[_0x318b6a(0x110)]+')':_0x5dbe94[_0x318b6a(0x110)]??'','description':_0x5dbe94[_0x318b6a(0x10a)]??'','sqlContent':_0x5dbe94[_0x318b6a(0x10c)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a188_0x4da1(){const _0x4fbc60=['sqlcode','413hwMouX','execError','1400ktRxFe','12VJfiLS','471321CzAMFw','SQL\x20execution\x20failed','execSuccess','Returned\x20','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','528190siiOLn','length','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','\x20row(s)\x20in\x20','params','string','1777746rZCJLy','50cZhvSc','11929863bmSxjk','1768gUhMdk','exec','str','now','7147aYYOpb','4UqPewr','260541hdrdrT'];a188_0x4da1=function(){return _0x4fbc60;};return a188_0x4da1();}const a188_0x3ad3ea=a188_0x561e;(function(_0xeb8dfd,_0x872308){const _0xd73172=a188_0x561e,_0x3cbc65=_0xeb8dfd();while(!![]){try{const _0x5b0d7b=parseInt(_0xd73172(0x1fb))/0x1*(-parseInt(_0xd73172(0x1fd))/0x2)+-parseInt(_0xd73172(0x1ff))/0x3*(parseInt(_0xd73172(0x1f8))/0x4)+-parseInt(_0xd73172(0x1ea))/0x5+-parseInt(_0xd73172(0x1f0))/0x6+-parseInt(_0xd73172(0x1f7))/0x7*(parseInt(_0xd73172(0x1f3))/0x8)+parseInt(_0xd73172(0x1f9))/0x9*(parseInt(_0xd73172(0x1f1))/0xa)+-parseInt(_0xd73172(0x1f2))/0xb*(-parseInt(_0xd73172(0x1fe))/0xc);if(_0x5b0d7b===_0x872308)break;else _0x3cbc65['push'](_0x3cbc65['shift']());}catch(_0x4ddd41){_0x3cbc65['push'](_0x3cbc65['shift']());}}}(a188_0x4da1,0x25f6d));import{executeSql}from'../../core/api-client.js';function a188_0x561e(_0x3893f2,_0x532a5d){_0x3893f2=_0x3893f2-0x1e7;const _0x4da17e=a188_0x4da1();let _0x561eab=_0x4da17e[_0x3893f2];return _0x561eab;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':'sql','command':a188_0x3ad3ea(0x1f4),'description':a188_0x3ad3ea(0x1ec),'risk':'read','flags':[SQLCODE_FLAG,{'name':a188_0x3ad3ea(0x1ee),'type':a188_0x3ad3ea(0x1ef),'description':a188_0x3ad3ea(0x1e9)}],async 'execute'(_0x29f1aa){const _0x4f93f7=a188_0x3ad3ea,_0x3bc995=parseJsonParams(_0x29f1aa[_0x4f93f7(0x1f5)](_0x4f93f7(0x1ee))),_0x3e0c0b=Date[_0x4f93f7(0x1f6)](),_0xe0a431=await executeSql(_0x29f1aa['appCode'],_0x29f1aa[_0x4f93f7(0x1f5)](_0x4f93f7(0x1fa)),_0x3bc995),_0x2f2fca=Date['now']()-_0x3e0c0b,_0xadeec7=_0xe0a431?.['execResult']??_0xe0a431,_0x2ea6e3=_0xe0a431?.[_0x4f93f7(0x1e7)]??!![];if(!_0x2ea6e3)return{'ok':![],'data':{'error':_0xe0a431?.[_0x4f93f7(0x1fc)]||_0x4f93f7(0x200),'elapsed':_0x2f2fca},'message':_0x4f93f7(0x200)};const _0x439f18=Array['isArray'](_0xadeec7)?_0xadeec7:[];return{'ok':!![],'data':{'rows':_0x439f18,'rowCount':_0x439f18[_0x4f93f7(0x1eb)],'elapsed':_0x2f2fca},'message':_0x4f93f7(0x1e8)+_0x439f18[_0x4f93f7(0x1eb)]+_0x4f93f7(0x1ed)+_0x2f2fca+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4f3f01,_0x404363){const _0x5251e8=a189_0x4611,_0x1a1efc=_0x4f3f01();while(!![]){try{const _0x53baac=parseInt(_0x5251e8(0x196))/0x1*(parseInt(_0x5251e8(0x192))/0x2)+parseInt(_0x5251e8(0x18f))/0x3+-parseInt(_0x5251e8(0x190))/0x4*(parseInt(_0x5251e8(0x18c))/0x5)+parseInt(_0x5251e8(0x18e))/0x6+parseInt(_0x5251e8(0x18d))/0x7*(-parseInt(_0x5251e8(0x193))/0x8)+parseInt(_0x5251e8(0x195))/0x9*(parseInt(_0x5251e8(0x191))/0xa)+parseInt(_0x5251e8(0x194))/0xb;if(_0x53baac===_0x404363)break;else _0x1a1efc['push'](_0x1a1efc['shift']());}catch(_0x5486e5){_0x1a1efc['push'](_0x1a1efc['shift']());}}}(a189_0x4600,0x711e9));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a189_0x4600(){const _0x11f91b=['139905YwbziM','2DToqXP','504915jsErkl','7pRvPLv','1981008kmPGQY','1071708oaMGVQ','12aWAaiG','250SBhjFN','375194NecpGN','6204216EagKuG','996490ARvNOd'];a189_0x4600=function(){return _0x11f91b;};return a189_0x4600();}import{sqlExec}from'../../commands/sql/exec.js';function a189_0x4611(_0x38addf,_0x3886be){_0x38addf=_0x38addf-0x18c;const _0x460008=a189_0x4600();let _0x4611df=_0x460008[_0x38addf];return _0x4611df;}import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a190_0x60e0b2=a190_0x3a4d;function a190_0x5713(){const _0x2fa8eb=['sqlCode','3694348OMKLFl','verbose','appCode','pagesize','No\x20custom\x20SQL\x20queries\x20found.','sql','name','Found\x20','all','2966982YQuuhN','23buwMxI','map','1255009DhVzFD','number','\x20SQL\x20queries\x20(total:\x20','boolean','List\x20custom\x20SQL\x20queries','dbId','12321882SkzHtz','str','paging','1611125tQZXaA','Filter\x20by\x20SQL\x20name','string','Page\x20number','page','description','6GCgLhA','90352ZYYyhD','length','9677392hHZHrv','num','read'];a190_0x5713=function(){return _0x2fa8eb;};return a190_0x5713();}(function(_0x4a95f1,_0x4bf76b){const _0x57b9e1=a190_0x3a4d,_0x600ad0=_0x4a95f1();while(!![]){try{const _0x2dbd50=parseInt(_0x57b9e1(0x159))/0x1*(parseInt(_0x57b9e1(0x149))/0x2)+-parseInt(_0x57b9e1(0x158))/0x3+parseInt(_0x57b9e1(0x14f))/0x4+-parseInt(_0x57b9e1(0x142))/0x5*(parseInt(_0x57b9e1(0x148))/0x6)+-parseInt(_0x57b9e1(0x15b))/0x7+-parseInt(_0x57b9e1(0x14b))/0x8+parseInt(_0x57b9e1(0x13f))/0x9;if(_0x2dbd50===_0x4bf76b)break;else _0x600ad0['push'](_0x600ad0['shift']());}catch(_0x41ff7b){_0x600ad0['push'](_0x600ad0['shift']());}}}(a190_0x5713,0x9a301));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a190_0x3a4d(_0x2323e7,_0x1de7c2){_0x2323e7=_0x2323e7-0x13f;const _0x571300=a190_0x5713();let _0x3a4dbc=_0x571300[_0x2323e7];return _0x3a4dbc;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a190_0x60e0b2(0x154),'command':'list','description':a190_0x60e0b2(0x15f),'risk':a190_0x60e0b2(0x14d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a190_0x60e0b2(0x155),'type':a190_0x60e0b2(0x144),'description':a190_0x60e0b2(0x143)},{'name':a190_0x60e0b2(0x146),'type':a190_0x60e0b2(0x15c),'description':a190_0x60e0b2(0x145),'default':0x1},{'name':a190_0x60e0b2(0x152),'type':a190_0x60e0b2(0x15c),'description':'Page\x20size'},{'name':'verbose','type':a190_0x60e0b2(0x15e),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x12a1c0){const _0x106c34=a190_0x60e0b2,_0x14cfae=await listSqlQueries(_0x12a1c0[_0x106c34(0x151)],{'sqlCode':_0x12a1c0[_0x106c34(0x140)]('sqlcode')||undefined,'sqlName':_0x12a1c0[_0x106c34(0x140)](_0x106c34(0x155))||undefined,'currentPage':_0x12a1c0[_0x106c34(0x14c)]('page'),'pageSize':_0x12a1c0[_0x106c34(0x14c)]('pagesize',0x32)}),_0x181c7d=_0x12a1c0['bool'](_0x106c34(0x150)),_0x141b14=_0x14cfae['tableData']??[],_0x2e8cea=_0x14cfae[_0x106c34(0x141)]?.['totalCount']??_0x141b14[_0x106c34(0x14a)];let _0x5a7347;return _0x181c7d?_0x5a7347=_0x141b14:_0x5a7347=await Promise[_0x106c34(0x157)](_0x141b14[_0x106c34(0x15a)](async _0x1622ec=>{const _0x153b41=_0x106c34;let _0xd14349;try{_0xd14349=_0x1622ec['dbId']?await getDbName(_0x12a1c0[_0x153b41(0x151)],_0x1622ec[_0x153b41(0x160)]):undefined;}catch{}return{'sqlCode':_0x1622ec[_0x153b41(0x14e)],'sqlName':_0x1622ec['sqlName'],'description':_0x1622ec[_0x153b41(0x147)]??'','db':_0xd14349?_0xd14349+'\x20('+_0x1622ec[_0x153b41(0x160)]+')':_0x1622ec[_0x153b41(0x160)]??''};})),{'ok':!![],'data':_0x5a7347,'message':_0x141b14[_0x106c34(0x14a)]===0x0?_0x106c34(0x153):_0x106c34(0x156)+_0x141b14[_0x106c34(0x14a)]+_0x106c34(0x15d)+_0x2e8cea+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a191_0x297d7a=a191_0x34c2;(function(_0x409495,_0x14c66e){const _0x46cc48=a191_0x34c2,_0x2ed9be=_0x409495();while(!![]){try{const _0x918a82=parseInt(_0x46cc48(0x105))/0x1+-parseInt(_0x46cc48(0x11c))/0x2+-parseInt(_0x46cc48(0xe6))/0x3+parseInt(_0x46cc48(0x11d))/0x4+parseInt(_0x46cc48(0x115))/0x5+parseInt(_0x46cc48(0xec))/0x6+parseInt(_0x46cc48(0x101))/0x7*(parseInt(_0x46cc48(0x116))/0x8);if(_0x918a82===_0x14c66e)break;else _0x2ed9be['push'](_0x2ed9be['shift']());}catch(_0x2aa11d){_0x2ed9be['push'](_0x2ed9be['shift']());}}}(a191_0xb44d,0xe645d));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a191_0xb44d(){const _0x4ebc17=['local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','string','70HbMVsQ','tableData','lastSync','nonInteractive','10327qGLDrs','apps','unchanged','sqlcode','description','trimStart','toISOString','\x20written,\x20','test','sqlRootDir','Filter\x20by\x20SQL\x20display\x20name','path','\x20failed','sqls','Force\x20overwrite\x20local\x20unsynced\x20changes','skipped','2267475WoCUUc','995128WWKbuI','mybatisXml','would_pull','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','bool','sqlContent','3505130BAZyFD','3932812CaPlJf','push','totalCount','sqlRoot','5190387DEQwIf','sqlName','cancelled','POST','utf8','No\x20remote\x20SQL\x20queries\x20matched.','10409736mYUmpa','length','force','pull','dbId','\x20skipped,\x20','lockFilePath','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','conflict','str','replace','name','sql','appCode','join','sqlCode','Force\x20pull\x20cancelled.','catch'];a191_0xb44d=function(){return _0x4ebc17;};return a191_0xb44d();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';function a191_0x34c2(_0x46a97d,_0x56969c){_0x46a97d=_0x46a97d-0xe4;const _0xb44dca=a191_0xb44d();let _0x34c224=_0xb44dca[_0x46a97d];return _0x34c224;}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x249313,_0x57f2b4){const _0x1980d4=a191_0x34c2,_0x3e6e62=[];let _0x1091ca=0x1;while(!![]){const _0x59ac6b=await listSqlQueries(_0x249313,{'currentPage':_0x1091ca,'pageSize':PAGE_SIZE,'sqlCode':_0x57f2b4[_0x1980d4(0xfc)],'sqlName':_0x57f2b4[_0x1980d4(0xe7)]}),_0x445c80=_0x59ac6b[_0x1980d4(0x102)]??[];_0x3e6e62['push'](..._0x445c80);if(_0x445c80['length']===0x0)break;const _0xcf6417=_0x59ac6b['paging']?.[_0x1980d4(0xe4)];if(_0xcf6417!=null?_0x3e6e62[_0x1980d4(0xed)]>=_0xcf6417:_0x445c80[_0x1980d4(0xed)]<PAGE_SIZE)break;_0x1091ca++;}return _0x3e6e62;}async function ensureSqlContent(_0x5288fd){const _0x29affe=a191_0x34c2;if(_0x5288fd['sqlContent']!=null&&String(_0x5288fd[_0x29affe(0x11b)])[_0x29affe(0xed)]>0x0)return _0x5288fd;return getSqlQueryDetail(_0x5288fd[_0x29affe(0xfc)]);}export const sqlPull={'service':a191_0x297d7a(0xf9),'command':a191_0x297d7a(0xef),'description':a191_0x297d7a(0xf4),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a191_0x297d7a(0xf8),'type':a191_0x297d7a(0x100),'description':a191_0x297d7a(0x10f)},{'name':a191_0x297d7a(0xee),'type':'boolean','description':a191_0x297d7a(0x113)}],async 'dryRun'(_0x1f93a1){const _0x5be0ba=a191_0x297d7a,_0x2a9930=loadSqlProjectConfig(_0x1f93a1['appCode']),_0x9bf481=await readSqlLockFile(_0x2a9930[_0x5be0ba(0xf2)]),{appLock:_0x565ece}=ensureSqlLockScope(_0x9bf481??createEmptySqlLock(),_0x2a9930[_0x5be0ba(0xfa)],_0x2a9930[_0x5be0ba(0xe5)],'pull'),_0x105ad0=await fetchAllSqlQueries(_0x1f93a1[_0x5be0ba(0xfa)],{'sqlCode':_0x1f93a1[_0x5be0ba(0xf6)](_0x5be0ba(0x108))||undefined,'sqlName':_0x1f93a1[_0x5be0ba(0xf6)](_0x5be0ba(0xf8))||undefined}),_0x2821fe=[];for(const _0x335560 of _0x105ad0){const _0x35ab63=await ensureSqlContent(_0x335560),_0x679d48=ensureRemoteSqlContent(_0x35ab63),_0x2db8a6=detectModeFromSql(_0x35ab63),_0x3dcb5f=_0x35ab63[_0x5be0ba(0xf0)]?await getDbName(_0x1f93a1[_0x5be0ba(0xfa)],Number(_0x35ab63['dbId']))[_0x5be0ba(0xfe)](()=>undefined):undefined,_0x22fc5c=buildLocalSqlFileContent({'sqlCode':_0x35ab63[_0x5be0ba(0xfc)],'sqlName':_0x35ab63[_0x5be0ba(0xe7)],'dbId':_0x35ab63[_0x5be0ba(0xf0)]},_0x679d48,{'dbName':_0x3dcb5f,'mode':_0x2db8a6,'syncedAt':new Date()[_0x5be0ba(0x10b)](),'description':_0x35ab63[_0x5be0ba(0x109)]}),_0x1a6e0d=buildSqlLockEntry(_0x35ab63,_0x679d48,'',{'dbName':_0x3dcb5f}),_0x5d43d0=resolveLocalSqlFilePath(_0x2a9930,_0x35ab63[_0x5be0ba(0xfc)],_0x1a6e0d);let _0x87d915=_0x5be0ba(0x118),_0x5eec86;if(await fileExists(_0x5d43d0)){const _0x5ed15d=await readFile(_0x5d43d0,_0x5be0ba(0xea));isEquivalentPulledSqlFile(_0x5ed15d,_0x22fc5c,_0x2db8a6)?(_0x87d915=_0x5be0ba(0x114),_0x5eec86='unchanged'):(_0x87d915=_0x5be0ba(0xf5),_0x5eec86=_0x5be0ba(0xff));}_0x2821fe[_0x5be0ba(0x11e)]({'sqlCode':_0x35ab63['sqlCode'],'sqlName':_0x35ab63[_0x5be0ba(0xe7)],'filePath':_0x5d43d0,'status':_0x87d915,'reason':_0x5eec86});}return{'method':_0x5be0ba(0xe9),'url':_0x5be0ba(0x119),'body':{'appCode':_0x1f93a1[_0x5be0ba(0xfa)],'sqlCode':_0x1f93a1[_0x5be0ba(0xf6)](_0x5be0ba(0x108))||null,'sqlName':_0x1f93a1[_0x5be0ba(0xf6)](_0x5be0ba(0xf8))||null,'files':_0x2821fe},'description':'Would\x20pull\x20'+_0x2821fe[_0x5be0ba(0xed)]+'\x20SQL\x20file(s)\x20into\x20'+_0x2a9930[_0x5be0ba(0x10e)]};},async 'execute'(_0x50c6d9){const _0x570c58=a191_0x297d7a,_0xca3c47=loadSqlProjectConfig(_0x50c6d9[_0x570c58(0xfa)]),_0x340e57=await readSqlLockFile(_0xca3c47['lockFilePath']),{lockData:_0x5610ae,appLock:_0x2e9ff3}=ensureSqlLockScope(_0x340e57??createEmptySqlLock(),_0xca3c47[_0x570c58(0xfa)],_0xca3c47[_0x570c58(0xe5)],_0x570c58(0xef)),_0x40e8f6=_0x50c6d9[_0x570c58(0x11a)](_0x570c58(0xee)),_0x2b8a83=await fetchAllSqlQueries(_0x50c6d9[_0x570c58(0xfa)],{'sqlCode':_0x50c6d9[_0x570c58(0xf6)]('sqlcode')||undefined,'sqlName':_0x50c6d9['str'](_0x570c58(0xf8))||undefined});if(_0x2b8a83[_0x570c58(0xed)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x570c58(0xeb)};const _0x366281=[],_0x3d8c8b=[];for(const _0x4f04f1 of _0x2b8a83){try{_0x366281[_0x570c58(0x11e)](await ensureSqlContent(_0x4f04f1));}catch(_0x5552e5){_0x3d8c8b[_0x570c58(0x11e)]({'sqlCode':_0x4f04f1[_0x570c58(0xfc)],'error':_0x5552e5 instanceof Error?_0x5552e5['message']:String(_0x5552e5)});}}if(_0x40e8f6&&!_0x50c6d9[_0x570c58(0x104)]){let _0x4d45a9=![];for(const _0x3728cd of _0x366281){const _0x12c098=detectModeFromSql(_0x3728cd),_0x21fe31=_0x3728cd[_0x570c58(0xf0)]?await getDbName(_0x50c6d9[_0x570c58(0xfa)],Number(_0x3728cd[_0x570c58(0xf0)]))[_0x570c58(0xfe)](()=>undefined):undefined,_0x32d0d4=buildLocalSqlFileContent({'sqlCode':_0x3728cd[_0x570c58(0xfc)],'sqlName':_0x3728cd[_0x570c58(0xe7)],'dbId':_0x3728cd[_0x570c58(0xf0)]},ensureRemoteSqlContent(_0x3728cd),{'dbName':_0x21fe31,'mode':_0x12c098,'syncedAt':new Date()['toISOString'](),'description':_0x3728cd[_0x570c58(0x109)]}),_0x3dd6a0=resolveLocalSqlFilePath(_0xca3c47,_0x3728cd[_0x570c58(0xfc)],buildSqlLockEntry(_0x3728cd,ensureRemoteSqlContent(_0x3728cd),'',{'dbName':_0x21fe31}));if(await fileExists(_0x3dd6a0)){const _0x486e31=await readFile(_0x3dd6a0,_0x570c58(0xea));if(!isEquivalentPulledSqlFile(_0x486e31,_0x32d0d4,_0x12c098)){_0x4d45a9=!![];break;}}}if(_0x4d45a9){const _0x4d2da8=await confirmForceOverwrite(_0x570c58(0xf3));if(!_0x4d2da8)throw CliErrors[_0x570c58(0xe8)](_0x570c58(0xfd));}}const _0x1c058e=cloneSqlLockData(_0x5610ae),_0x1d0ca9=_0x1c058e[_0x570c58(0x106)][_0xca3c47[_0x570c58(0xfa)]],_0x4af78e=[],_0x13ec67=[];for(const _0xd70035 of _0x366281){const _0x464995=_0x1d0ca9[_0x570c58(0x112)][_0xd70035[_0x570c58(0xfc)]],_0x47ae90=ensureRemoteSqlContent(_0xd70035),_0x4f93c6=detectModeFromSql(_0xd70035),_0x2ea821=_0xd70035[_0x570c58(0xf0)]?await getDbName(_0x50c6d9[_0x570c58(0xfa)],Number(_0xd70035[_0x570c58(0xf0)]))['catch'](()=>undefined):undefined,_0xbfbc2d=buildLocalSqlFileContent({'sqlCode':_0xd70035['sqlCode'],'sqlName':_0xd70035['sqlName'],'dbId':_0xd70035[_0x570c58(0xf0)]},_0x47ae90,{'dbName':_0x2ea821,'mode':_0x4f93c6,'syncedAt':new Date()[_0x570c58(0x10b)](),'description':_0xd70035[_0x570c58(0x109)]}),_0x4158b8=buildSqlLockEntry(_0xd70035,_0x47ae90,computeSqlContentHash(_0xbfbc2d),{'dbName':_0x2ea821}),_0x1b8fe5=_0x4158b8['path'],_0xffaf04=join(_0xca3c47[_0x570c58(0x10e)],_0x1b8fe5);try{if(await fileExists(_0xffaf04)){const _0x34483f=await readFile(_0xffaf04,_0x570c58(0xea));if(isEquivalentPulledSqlFile(_0x34483f,_0xbfbc2d,_0x4f93c6)){_0x13ec67[_0x570c58(0x11e)]({'sqlCode':_0xd70035['sqlCode'],'reason':_0x570c58(0x107)}),_0x1d0ca9['sqls'][_0xd70035[_0x570c58(0xfc)]]={..._0x4158b8,'hash':computeSqlContentHash(_0x34483f),'path':_0x1b8fe5};continue;}if(!_0x40e8f6){_0x13ec67[_0x570c58(0x11e)]({'sqlCode':_0xd70035[_0x570c58(0xfc)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x3a7c44=_0x464995?.[_0x570c58(0x110)]?join(_0xca3c47[_0x570c58(0x10e)],_0x464995[_0x570c58(0x110)]):undefined;_0x3a7c44&&_0x3a7c44!==_0xffaf04&&await fileExists(_0x3a7c44)&&await rm(_0x3a7c44,{'force':!![]}),await ensureParentDirectory(_0xffaf04),await writeFile(_0xffaf04,_0xbfbc2d,_0x570c58(0xea)),_0x1d0ca9[_0x570c58(0x112)][_0xd70035[_0x570c58(0xfc)]]={..._0x4158b8,'path':_0x1b8fe5},_0x4af78e['push']({'sqlCode':_0xd70035['sqlCode'],'filePath':_0xffaf04});}catch(_0x1b238a){_0x3d8c8b['push']({'sqlCode':_0xd70035['sqlCode'],'error':_0x1b238a instanceof Error?_0x1b238a['message']:String(_0x1b238a)});}}return _0x1d0ca9[_0x570c58(0x103)]=new Date()['toISOString'](),await writeSqlLockFile(_0xca3c47[_0x570c58(0xf2)],_0x1c058e),{'ok':_0x3d8c8b[_0x570c58(0xed)]===0x0,'data':{'pulled':_0x4af78e,'skipped':_0x13ec67,'failed':_0x3d8c8b},'message':'Pull\x20complete:\x20'+_0x4af78e[_0x570c58(0xed)]+_0x570c58(0x10c)+_0x13ec67[_0x570c58(0xed)]+_0x570c58(0xf1)+_0x3d8c8b[_0x570c58(0xed)]+_0x570c58(0x111)};}};function detectModeFromSql(_0x5dc8dd){const _0x1d11b6=a191_0x297d7a,_0x20df5c=ensureRemoteSqlContent(_0x5dc8dd),_0x193049=stripLocalSqlMetadata(_0x20df5c,_0x1d11b6(0x117))[_0x1d11b6(0x10a)]();if(/^<(select|insert|update|delete)\b/i[_0x1d11b6(0x10d)](_0x193049))return _0x1d11b6(0x117);return _0x1d11b6(0xf9);}function isEquivalentPulledSqlFile(_0x363fb1,_0x5d3930,_0x4ca5db){return normalizePullComparableContent(_0x363fb1,_0x4ca5db)===normalizePullComparableContent(_0x5d3930,_0x4ca5db);}function normalizePullComparableContent(_0x40fff3,_0x584003){const _0x5e1a74=a191_0x297d7a,_0x243b1b=_0x40fff3[_0x5e1a74(0xf7)](/\r\n/g,'\x0a')['split']('\x0a'),_0x297c20=_0x243b1b['filter'](_0x1ae71e=>!isSyncedAtMetadataLine(_0x1ae71e,_0x584003));return _0x297c20[_0x5e1a74(0xfb)]('\x0a');}function isSyncedAtMetadataLine(_0x5d0a59,_0x466e40){const _0x2c5d09=a191_0x297d7a;if(_0x466e40===_0x2c5d09(0x117))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x2c5d09(0x10d)](_0x5d0a59);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x5d0a59);}
|
|
1
|
+
const a191_0x4bda62=a191_0x3825;(function(_0x4892fa,_0x1a4008){const _0x39b95d=a191_0x3825,_0x3b38e4=_0x4892fa();while(!![]){try{const _0x518d10=parseInt(_0x39b95d(0xf2))/0x1+-parseInt(_0x39b95d(0xe9))/0x2*(-parseInt(_0x39b95d(0xfe))/0x3)+-parseInt(_0x39b95d(0xd5))/0x4+-parseInt(_0x39b95d(0x10b))/0x5+-parseInt(_0x39b95d(0xdd))/0x6*(parseInt(_0x39b95d(0xeb))/0x7)+-parseInt(_0x39b95d(0xd4))/0x8+parseInt(_0x39b95d(0xff))/0x9*(parseInt(_0x39b95d(0xe6))/0xa);if(_0x518d10===_0x1a4008)break;else _0x3b38e4['push'](_0x3b38e4['shift']());}catch(_0x4c08b7){_0x3b38e4['push'](_0x3b38e4['shift']());}}}(a191_0x3018,0xbcd1d));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x208d7e,_0x3c34fe){const _0x227272=a191_0x3825,_0x242fba=[];let _0xd7593b=0x1;while(!![]){const _0x4de09d=await listSqlQueries(_0x208d7e,{'currentPage':_0xd7593b,'pageSize':PAGE_SIZE,'sqlCode':_0x3c34fe[_0x227272(0xe8)],'sqlName':_0x3c34fe['sqlName']}),_0x17b380=_0x4de09d[_0x227272(0xfb)]??[];_0x242fba[_0x227272(0xfc)](..._0x17b380);if(_0x17b380[_0x227272(0x105)]===0x0)break;const _0x3d7850=_0x4de09d[_0x227272(0xfd)]?.[_0x227272(0x10c)];if(_0x3d7850!=null?_0x242fba[_0x227272(0x105)]>=_0x3d7850:_0x17b380[_0x227272(0x105)]<PAGE_SIZE)break;_0xd7593b++;}return _0x242fba;}async function ensureSqlContent(_0x58fed5){const _0x2042f7=a191_0x3825;if(_0x58fed5[_0x2042f7(0xda)]!=null&&String(_0x58fed5[_0x2042f7(0xda)])[_0x2042f7(0x105)]>0x0)return _0x58fed5;return getSqlQueryDetail(_0x58fed5[_0x2042f7(0xe8)]);}export const sqlPull={'service':a191_0x4bda62(0x102),'command':a191_0x4bda62(0x104),'description':a191_0x4bda62(0xd3),'risk':a191_0x4bda62(0xf0),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a191_0x4bda62(0x101),'type':'string','description':a191_0x4bda62(0xea)},{'name':a191_0x4bda62(0xe4),'type':a191_0x4bda62(0xfa),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x15be5a){const _0x3bfa1b=a191_0x4bda62,_0x218ec5=loadSqlProjectConfig(_0x15be5a['appCode']),_0x30c09d=await readSqlLockFile(_0x218ec5[_0x3bfa1b(0xd7)]),{appLock:_0x23d806}=ensureSqlLockScope(_0x30c09d??createEmptySqlLock(),_0x218ec5[_0x3bfa1b(0xf6)],_0x218ec5[_0x3bfa1b(0xec)],_0x3bfa1b(0x104)),_0x50454b=await fetchAllSqlQueries(_0x15be5a[_0x3bfa1b(0xf6)],{'sqlCode':_0x15be5a[_0x3bfa1b(0xe5)](_0x3bfa1b(0xef))||undefined,'sqlName':_0x15be5a['str']('name')||undefined}),_0x2ded6b=[];for(const _0x3f982c of _0x50454b){const _0x58e7b7=await ensureSqlContent(_0x3f982c),_0x42c692=ensureRemoteSqlContent(_0x58e7b7),_0x490b5d=detectModeFromSql(_0x58e7b7),_0x32855c=_0x58e7b7[_0x3bfa1b(0xf8)]?await getDbName(_0x15be5a[_0x3bfa1b(0xf6)],Number(_0x58e7b7[_0x3bfa1b(0xf8)]))['catch'](()=>undefined):undefined,_0x55cbff=buildLocalSqlFileContent({'sqlCode':_0x58e7b7[_0x3bfa1b(0xe8)],'sqlName':_0x58e7b7['sqlName'],'dbId':_0x58e7b7[_0x3bfa1b(0xf8)]},_0x42c692,{'dbName':_0x32855c,'mode':_0x490b5d,'syncedAt':new Date()[_0x3bfa1b(0xe0)](),'description':_0x58e7b7[_0x3bfa1b(0x100)]}),_0x4b815c=buildSqlLockEntry(_0x58e7b7,_0x42c692,'',{'dbName':_0x32855c}),_0x2c0ddd=resolveLocalSqlFilePath(_0x218ec5,_0x58e7b7[_0x3bfa1b(0xe8)],_0x4b815c);let _0x23aec9=_0x3bfa1b(0xdb),_0x66acff;if(await fileExists(_0x2c0ddd)){const _0x52a8b8=await readFile(_0x2c0ddd,_0x3bfa1b(0x109));isEquivalentPulledSqlFile(_0x52a8b8,_0x55cbff,_0x490b5d)?(_0x23aec9=_0x3bfa1b(0xf4),_0x66acff=_0x3bfa1b(0xd8)):(_0x23aec9=_0x3bfa1b(0xd9),_0x66acff=_0x3bfa1b(0xe3));}_0x2ded6b['push']({'sqlCode':_0x58e7b7[_0x3bfa1b(0xe8)],'sqlName':_0x58e7b7[_0x3bfa1b(0x106)],'filePath':_0x2c0ddd,'status':_0x23aec9,'reason':_0x66acff});}return{'method':'POST','url':_0x3bfa1b(0xdf),'body':{'appCode':_0x15be5a[_0x3bfa1b(0xf6)],'sqlCode':_0x15be5a['str'](_0x3bfa1b(0xef))||null,'sqlName':_0x15be5a[_0x3bfa1b(0xe5)]('name')||null,'files':_0x2ded6b},'description':_0x3bfa1b(0xf5)+_0x2ded6b['length']+'\x20SQL\x20file(s)\x20into\x20'+_0x218ec5[_0x3bfa1b(0xe2)]};},async 'execute'(_0x2cd19a){const _0x352ef0=a191_0x4bda62,_0x2efad5=loadSqlProjectConfig(_0x2cd19a['appCode']),_0x340d51=await readSqlLockFile(_0x2efad5[_0x352ef0(0xd7)]),{lockData:_0x19a1d4,appLock:_0x13b30d}=ensureSqlLockScope(_0x340d51??createEmptySqlLock(),_0x2efad5[_0x352ef0(0xf6)],_0x2efad5[_0x352ef0(0xec)],_0x352ef0(0x104)),_0x11d61d=_0x2cd19a[_0x352ef0(0xe1)](_0x352ef0(0xe4)),_0x119186=await fetchAllSqlQueries(_0x2cd19a['appCode'],{'sqlCode':_0x2cd19a[_0x352ef0(0xe5)](_0x352ef0(0xef))||undefined,'sqlName':_0x2cd19a[_0x352ef0(0xe5)]('name')||undefined});if(_0x119186[_0x352ef0(0x105)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x72134c=[],_0x8547af=[];for(const _0x8bef8 of _0x119186){try{_0x72134c['push'](await ensureSqlContent(_0x8bef8));}catch(_0x2d2df5){_0x8547af[_0x352ef0(0xfc)]({'sqlCode':_0x8bef8[_0x352ef0(0xe8)],'error':_0x2d2df5 instanceof Error?_0x2d2df5[_0x352ef0(0xf7)]:String(_0x2d2df5)});}}if(_0x11d61d&&!_0x2cd19a[_0x352ef0(0xf1)]){let _0x16f25e=![];for(const _0xab7420 of _0x72134c){const _0x113088=detectModeFromSql(_0xab7420),_0x5e111a=_0xab7420[_0x352ef0(0xf8)]?await getDbName(_0x2cd19a[_0x352ef0(0xf6)],Number(_0xab7420[_0x352ef0(0xf8)]))[_0x352ef0(0xde)](()=>undefined):undefined,_0x1a4b33=buildLocalSqlFileContent({'sqlCode':_0xab7420[_0x352ef0(0xe8)],'sqlName':_0xab7420[_0x352ef0(0x106)],'dbId':_0xab7420[_0x352ef0(0xf8)]},ensureRemoteSqlContent(_0xab7420),{'dbName':_0x5e111a,'mode':_0x113088,'syncedAt':new Date()['toISOString'](),'description':_0xab7420['description']}),_0x19ffaa=resolveLocalSqlFilePath(_0x2efad5,_0xab7420['sqlCode'],buildSqlLockEntry(_0xab7420,ensureRemoteSqlContent(_0xab7420),'',{'dbName':_0x5e111a}));if(await fileExists(_0x19ffaa)){const _0x3611fb=await readFile(_0x19ffaa,'utf8');if(!isEquivalentPulledSqlFile(_0x3611fb,_0x1a4b33,_0x113088)){_0x16f25e=!![];break;}}}if(_0x16f25e){const _0x276e17=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x276e17)throw CliErrors['cancelled'](_0x352ef0(0xf9));}}const _0x5406b6=cloneSqlLockData(_0x19a1d4),_0x46f227=_0x5406b6[_0x352ef0(0xdc)][_0x2efad5[_0x352ef0(0xf6)]],_0x454b53=[],_0x4f9608=[];for(const _0x4847f0 of _0x72134c){const _0x448201=_0x46f227[_0x352ef0(0x108)][_0x4847f0[_0x352ef0(0xe8)]],_0x169ec8=ensureRemoteSqlContent(_0x4847f0),_0xc956d8=detectModeFromSql(_0x4847f0),_0x3351a1=_0x4847f0[_0x352ef0(0xf8)]?await getDbName(_0x2cd19a[_0x352ef0(0xf6)],Number(_0x4847f0[_0x352ef0(0xf8)]))[_0x352ef0(0xde)](()=>undefined):undefined,_0x541be2=buildLocalSqlFileContent({'sqlCode':_0x4847f0[_0x352ef0(0xe8)],'sqlName':_0x4847f0['sqlName'],'dbId':_0x4847f0[_0x352ef0(0xf8)]},_0x169ec8,{'dbName':_0x3351a1,'mode':_0xc956d8,'syncedAt':new Date()[_0x352ef0(0xe0)](),'description':_0x4847f0[_0x352ef0(0x100)]}),_0x533098=buildSqlLockEntry(_0x4847f0,_0x169ec8,computeSqlContentHash(_0x541be2),{'dbName':_0x3351a1}),_0x6995f9=_0x533098['path'],_0x10cd08=join(_0x2efad5[_0x352ef0(0xe2)],_0x6995f9);try{if(await fileExists(_0x10cd08)){const _0x347f43=await readFile(_0x10cd08,_0x352ef0(0x109));if(isEquivalentPulledSqlFile(_0x347f43,_0x541be2,_0xc956d8)){_0x4f9608[_0x352ef0(0xfc)]({'sqlCode':_0x4847f0[_0x352ef0(0xe8)],'reason':_0x352ef0(0xd8)}),_0x46f227[_0x352ef0(0x108)][_0x4847f0[_0x352ef0(0xe8)]]={..._0x533098,'hash':computeSqlContentHash(_0x347f43),'path':_0x6995f9};continue;}if(!_0x11d61d){_0x4f9608['push']({'sqlCode':_0x4847f0[_0x352ef0(0xe8)],'reason':_0x352ef0(0x10a)});continue;}}const _0x52bb70=_0x448201?.[_0x352ef0(0xd2)]?join(_0x2efad5['sqlRootDir'],_0x448201[_0x352ef0(0xd2)]):undefined;_0x52bb70&&_0x52bb70!==_0x10cd08&&await fileExists(_0x52bb70)&&await rm(_0x52bb70,{'force':!![]}),await ensureParentDirectory(_0x10cd08),await writeFile(_0x10cd08,_0x541be2,_0x352ef0(0x109)),_0x46f227[_0x352ef0(0x108)][_0x4847f0['sqlCode']]={..._0x533098,'path':_0x6995f9},_0x454b53[_0x352ef0(0xfc)]({'sqlCode':_0x4847f0[_0x352ef0(0xe8)],'filePath':_0x10cd08});}catch(_0x158c7f){_0x8547af[_0x352ef0(0xfc)]({'sqlCode':_0x4847f0[_0x352ef0(0xe8)],'error':_0x158c7f instanceof Error?_0x158c7f[_0x352ef0(0xf7)]:String(_0x158c7f)});}}return _0x46f227[_0x352ef0(0xee)]=new Date()[_0x352ef0(0xe0)](),await writeSqlLockFile(_0x2efad5['lockFilePath'],_0x5406b6),{'ok':_0x8547af[_0x352ef0(0x105)]===0x0,'data':{'pulled':_0x454b53,'skipped':_0x4f9608,'failed':_0x8547af},'message':'Pull\x20complete:\x20'+_0x454b53[_0x352ef0(0x105)]+_0x352ef0(0xf3)+_0x4f9608[_0x352ef0(0x105)]+'\x20skipped,\x20'+_0x8547af[_0x352ef0(0x105)]+'\x20failed'};}};function detectModeFromSql(_0x267eb5){const _0x178d1f=a191_0x4bda62,_0xcfa822=ensureRemoteSqlContent(_0x267eb5),_0xe0dbbc=stripLocalSqlMetadata(_0xcfa822,_0x178d1f(0x103))[_0x178d1f(0xed)]();if(/^<(select|insert|update|delete)\b/i[_0x178d1f(0x107)](_0xe0dbbc))return _0x178d1f(0x103);return _0x178d1f(0x102);}function isEquivalentPulledSqlFile(_0x1fead9,_0xb5410a,_0x21f307){return normalizePullComparableContent(_0x1fead9,_0x21f307)===normalizePullComparableContent(_0xb5410a,_0x21f307);}function normalizePullComparableContent(_0x52197b,_0x338b67){const _0x4a8bac=a191_0x4bda62,_0x47a611=_0x52197b[_0x4a8bac(0xe7)](/\r\n/g,'\x0a')['split']('\x0a'),_0x438f6e=_0x47a611[_0x4a8bac(0xd6)](_0x1c1a89=>!isSyncedAtMetadataLine(_0x1c1a89,_0x338b67));return _0x438f6e['join']('\x0a');}function a191_0x3825(_0x4c8a4b,_0x1c8317){_0x4c8a4b=_0x4c8a4b-0xd2;const _0x3018bc=a191_0x3018();let _0x3825cc=_0x3018bc[_0x4c8a4b];return _0x3825cc;}function isSyncedAtMetadataLine(_0x28fece,_0x451b12){const _0x552663=a191_0x4bda62;if(_0x451b12===_0x552663(0x103))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x552663(0x107)](_0x28fece);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x28fece);}function a191_0x3018(){const _0x184e92=['tableData','push','paging','201387PkfcdC','80847ScoSBY','description','name','sql','mybatisXml','pull','length','sqlName','test','sqls','utf8','local\x20differs\x20from\x20remote','4396990FWEKVc','totalCount','path','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','1849768vetoTK','4920828rPNzSi','filter','lockFilePath','unchanged','conflict','sqlContent','would_pull','apps','5333694wBiZYn','catch','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','toISOString','bool','sqlRootDir','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','force','str','3660UHEYRG','replace','sqlCode','2TteRQu','Filter\x20by\x20SQL\x20display\x20name','7tcWsQx','sqlRoot','trimStart','lastSync','sqlcode','read','nonInteractive','648273PKalQD','\x20written,\x20','skipped','Would\x20pull\x20','appCode','message','dbId','Force\x20pull\x20cancelled.','boolean'];a191_0x3018=function(){return _0x184e92;};return a191_0x3018();}
|