@lovrabet/rabetbase-cli 2.3.14-beta.1 → 2.3.15-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/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/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/create.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a161_0x154547=a161_0x27c7;(function(_0x2402f8,_0x224459){const _0x32616b=a161_0x27c7,_0x38c81d=_0x2402f8();while(!![]){try{const _0x47255d=parseInt(_0x32616b(0x1ba))/0x1*(-parseInt(_0x32616b(0x1a3))/0x2)+-parseInt(_0x32616b(0x1a8))/0x3*(-parseInt(_0x32616b(0x1b2))/0x4)+parseInt(_0x32616b(0x19b))/0x5*(parseInt(_0x32616b(0x1b6))/0x6)+parseInt(_0x32616b(0x1b7))/0x7*(parseInt(_0x32616b(0x1b1))/0x8)+parseInt(_0x32616b(0x1a5))/0x9+-parseInt(_0x32616b(0x195))/0xa*(parseInt(_0x32616b(0x1b3))/0xb)+-parseInt(_0x32616b(0x1b9))/0xc;if(_0x47255d===_0x224459)break;else _0x38c81d['push'](_0x38c81d['shift']());}catch(_0x4ca605){_0x38c81d['push'](_0x38c81d['shift']());}}}(a161_0x699a,0x69061));function a161_0x27c7(_0x51dc3a,_0x51a6da){_0x51dc3a=_0x51dc3a-0x193;const _0x699a8a=a161_0x699a();let _0x27c725=_0x699a8a[_0x51dc3a];return _0x27c725;}import{listAppRoles}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a161_0x699a(){const _0x4633ec=['731624lPqJCu','10571DUMFqW','length','Use\x20one\x20of:\x20','53856rXrmKW','84sEMoiC','DEV','4249716ZhEMEb','1aiuckv','validation','toUpperCase','--page\x20must\x20be\x20greater\x20than\x20or\x20equal\x20to\x201.','read','3310ERUhGZ','CUSTOM','map','roleType','Page\x20size\x20(1-100)','page','205WbgnwR','Invalid\x20--type\x20\x22','number','filter','--pagesize\x20must\x20be\x20between\x201\x20and\x20100.','type','str','trim','1203862WiYvsF','string','4908312fEnQVG','includes','num','3FwuaZk','Page\x20index\x20(1-based)','\x20role(s)','appCode','pagesize','list','Found\x20','Filter\x20by\x20role\x20type','List\x20user\x20groups\x20(roles)\x20for\x20the\x20current\x20app','405368QcFOpu'];a161_0x699a=function(){return _0x4633ec;};return a161_0x699a();}import{projectRole}from'../../commands/role/shared.js';const ROLE_TYPES=['ADMIN',a161_0x154547(0x1b8),'USER',a161_0x154547(0x196)];export const roleList={'service':'role','command':a161_0x154547(0x1ad),'description':a161_0x154547(0x1b0),'risk':a161_0x154547(0x194),'flags':[APPCODE_FLAG_OPTIONAL,{'name':'type','type':a161_0x154547(0x1a4),'required':![],'description':a161_0x154547(0x1af),'enum':ROLE_TYPES},{'name':a161_0x154547(0x19a),'type':'number','description':a161_0x154547(0x1a9),'default':0x1},{'name':a161_0x154547(0x1ac),'type':a161_0x154547(0x19d),'description':a161_0x154547(0x199),'default':0x64}],async 'validate'(_0x111ba8){const _0x51e3f2=a161_0x154547,_0x5197b2=_0x111ba8[_0x51e3f2(0x1a1)](_0x51e3f2(0x1a0))[_0x51e3f2(0x1a2)]();if(_0x5197b2&&!ROLE_TYPES[_0x51e3f2(0x1a6)](_0x5197b2['toUpperCase']()))throw CliErrors['validation'](_0x51e3f2(0x19c)+_0x5197b2+'\x22.',_0x51e3f2(0x1b5)+ROLE_TYPES['join'](',\x20')+'.');const _0x4f19d8=_0x111ba8['num']('page',0x1),_0x2bcf5f=_0x111ba8[_0x51e3f2(0x1a7)](_0x51e3f2(0x1ac),0x64);if(_0x4f19d8<0x1)throw CliErrors['validation'](_0x51e3f2(0x193));if(_0x2bcf5f<0x1||_0x2bcf5f>0x64)throw CliErrors[_0x51e3f2(0x1bb)](_0x51e3f2(0x19f));},async 'execute'(_0x524412){const _0x526383=a161_0x154547,_0x44ccaa=_0x524412['num'](_0x526383(0x19a),0x1)||0x1,_0x7c0926=_0x524412[_0x526383(0x1a7)]('pagesize',0x64)||0x64,_0x1d5e8e=_0x524412[_0x526383(0x1a1)](_0x526383(0x1a0))['trim']()[_0x526383(0x1bc)](),{items:_0x39bf38,paging:_0x273b11}=await listAppRoles(_0x524412[_0x526383(0x1ab)],{'currentPage':_0x44ccaa,'pageSize':_0x7c0926}),_0x28b2be=_0x1d5e8e?_0x39bf38[_0x526383(0x19e)](_0x3b47a6=>_0x3b47a6[_0x526383(0x198)]===_0x1d5e8e):_0x39bf38,_0xf02d38=_0x28b2be[_0x526383(0x197)](projectRole);return{'ok':!![],'data':{'roles':_0xf02d38,'paging':_0x273b11},'message':_0x526383(0x1ae)+_0xf02d38[_0x526383(0x1b4)]+_0x526383(0x1aa)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a162_0x4ef002=a162_0x2fe5;(function(_0x5c2688,_0x1b28b0){const _0x1af801=a162_0x2fe5,_0x5ce740=_0x5c2688();while(!![]){try{const _0x1424e7=-parseInt(_0x1af801(0x104))/0x1+parseInt(_0x1af801(0x106))/0x2+parseInt(_0x1af801(0x108))/0x3+parseInt(_0x1af801(0x140))/0x4+-parseInt(_0x1af801(0x13f))/0x5+-parseInt(_0x1af801(0x10f))/0x6+-parseInt(_0x1af801(0x117))/0x7;if(_0x1424e7===_0x1b28b0)break;else _0x5ce740['push'](_0x5ce740['shift']());}catch(_0x39e588){_0x5ce740['push'](_0x5ce740['shift']());}}}(a162_0x18ee,0x60fa4));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a162_0x4ef002(0x10d),'required':!![],'description':a162_0x4ef002(0x131)};export const ROLE_REF_FLAG={'name':a162_0x4ef002(0x130),'type':a162_0x4ef002(0x110),'required':!![],'description':a162_0x4ef002(0x143)};export const USER_REF_FLAG={'name':'user','type':'string','required':!![],'description':'User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'};export const NAME_FLAG={'name':'name','type':a162_0x4ef002(0x110),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':a162_0x4ef002(0xff),'type':'string','required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':a162_0x4ef002(0x107),'type':a162_0x4ef002(0x110),'required':![],'description':a162_0x4ef002(0x10b)};export const EXPECT_USER_COUNT_FLAG={'name':a162_0x4ef002(0x139),'type':a162_0x4ef002(0x10d),'required':![],'description':a162_0x4ef002(0x138)};export const BUILTIN_ROLE_TYPES=[a162_0x4ef002(0x113),a162_0x4ef002(0x13c),a162_0x4ef002(0x11f)];export function isBuiltinRole(_0x39281c){const _0x298a50=a162_0x4ef002;return BUILTIN_ROLE_TYPES[_0x298a50(0x102)](_0x39281c);}export function assertCustomRole(_0x5f0d6e,_0x4f542d){const _0x300da4=a162_0x4ef002;if(_0x5f0d6e[_0x300da4(0x128)]!=='CUSTOM')throw CliErrors[_0x300da4(0x142)](_0x300da4(0x109)+_0x4f542d+_0x300da4(0x135)+_0x5f0d6e[_0x300da4(0x11d)]+'\x20('+_0x5f0d6e[_0x300da4(0x128)]+').',_0x300da4(0x12f));}export function assertPermConfigurable(_0x2d3e5b){const _0x3bb45d=a162_0x4ef002;if(_0x2d3e5b[_0x3bb45d(0x128)]===_0x3bb45d(0x13c)||_0x2d3e5b[_0x3bb45d(0x128)]===_0x3bb45d(0x113))throw CliErrors[_0x3bb45d(0x142)](_0x3bb45d(0x132)+_0x2d3e5b[_0x3bb45d(0x11d)]+'\x20('+_0x2d3e5b[_0x3bb45d(0x128)]+').','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.');}export function projectRole(_0x1476af){const _0xd111ec=a162_0x4ef002;return{'id':_0x1476af['id'],'roleName':_0x1476af[_0xd111ec(0x11d)],'roleType':_0x1476af[_0xd111ec(0x128)],'remark':_0x1476af['remark'],'userCount':_0x1476af[_0xd111ec(0x125)],'permitCount':_0x1476af[_0xd111ec(0x11c)],'builtin':isBuiltinRole(_0x1476af[_0xd111ec(0x128)])};}export async function resolveRoleRef(_0x5bd69e,_0x1de80){const _0x4859b2=a162_0x4ef002,_0x4af3bb=_0x1de80[_0x4859b2(0x144)]();if(!_0x4af3bb)throw CliErrors[_0x4859b2(0x142)](_0x4859b2(0x120),'Pass\x20--role\x20<id|name>.');if(/^\d+$/[_0x4859b2(0x123)](_0x4af3bb))return getRoleById(_0x5bd69e,Number(_0x4af3bb));const _0x8554a3=await listAllAppRoles(_0x5bd69e),_0x4c509f=_0x8554a3['filter'](_0x3623df=>_0x3623df[_0x4859b2(0x11d)]===_0x4af3bb);if(_0x4c509f['length']===0x0)throw CliErrors['validation'](_0x4859b2(0x127)+_0x4af3bb+'\x22\x20not\x20found\x20in\x20app\x20'+_0x5bd69e+'.',_0x4859b2(0x119));if(_0x4c509f[_0x4859b2(0x11b)]>0x1){const _0x1e4bb7=_0x4c509f[_0x4859b2(0x11e)](_0x4fd17e=>_0x4fd17e['id'])[_0x4859b2(0x13e)](',\x20');throw CliErrors[_0x4859b2(0x142)](_0x4859b2(0x127)+_0x4af3bb+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x1e4bb7+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x4c509f[0x0];}export async function getRoleById(_0x4b1d73,_0x2a70ac){const _0x5554d2=a162_0x4ef002,_0x12bc66=await getAppRole(_0x2a70ac);if(!_0x12bc66)throw CliErrors[_0x5554d2(0x142)]('Role\x20id\x20'+_0x2a70ac+_0x5554d2(0x101)+_0x4b1d73+'.',_0x5554d2(0x13d));return _0x12bc66;}async function listAllAppRoles(_0x365acc){const _0x4df968=a162_0x4ef002,_0x2ce702=0x64,_0x1218f6=[];for(let _0x43302d=0x1;;_0x43302d+=0x1){const {items:_0x8758ef,paging:_0xdacddc}=await listAppRoles(_0x365acc,{'currentPage':_0x43302d,'pageSize':_0x2ce702});_0x1218f6[_0x4df968(0x126)](..._0x8758ef);if(_0x8758ef[_0x4df968(0x11b)]<_0x2ce702||_0xdacddc&&_0x1218f6[_0x4df968(0x11b)]>=_0xdacddc[_0x4df968(0xfc)])return _0x1218f6;}}export async function resolveTenantCode(){const _0x6f3a19=a162_0x4ef002,_0x58b571=await getSessionUserInfo(),_0x1d2d3a=_0x58b571?.['user']?.[_0x6f3a19(0x12c)]?.[_0x6f3a19(0x145)];if(!_0x1d2d3a)throw CliErrors['authRequired'](_0x6f3a19(0x115));return _0x1d2d3a;}function a162_0x2fe5(_0x237626,_0x1b676f){_0x237626=_0x237626-0xfc;const _0x18ee9c=a162_0x18ee();let _0x2fe58b=_0x18ee9c[_0x237626];return _0x2fe58b;}function matchMember(_0x1178de,_0x1539fc){const _0x31745e=a162_0x4ef002,_0x474d29=_0x1539fc[_0x31745e(0x144)]()['toLowerCase']();return(_0x1178de[_0x31745e(0x116)]??'')[_0x31745e(0x118)]()===_0x474d29||(_0x1178de[_0x31745e(0x12b)]??'')[_0x31745e(0x118)]()===_0x474d29;}export async function resolveUserRef(_0x5bc559){const _0x281aad=a162_0x4ef002,_0x3582c3=_0x5bc559['trim']();if(!_0x3582c3)throw CliErrors['validation'](_0x281aad(0xfd),_0x281aad(0x147));const _0x444e32=await resolveTenantCode(),_0x54cc98=await getTenantMembers(_0x444e32);if(/^\d+$/['test'](_0x3582c3)){const _0x206464=Number(_0x3582c3),_0x49f0c8=_0x54cc98['find'](_0x55d509=>_0x55d509[_0x281aad(0x105)]===_0x206464);return{'userId':_0x206464,'username':_0x49f0c8?.[_0x281aad(0x12b)]??String(_0x206464),'nickname':_0x49f0c8?.[_0x281aad(0x116)],'matchedBy':'id'};}const _0x1afdc2=_0x54cc98[_0x281aad(0x122)](_0x28f2a7=>matchMember(_0x28f2a7,_0x3582c3));if(_0x1afdc2[_0x281aad(0x11b)]===0x0)throw CliErrors['validation']('No\x20tenant\x20member\x20matches\x20\x22'+_0x3582c3+'\x22.','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.');if(_0x1afdc2['length']>0x1){const _0x3f316f=_0x1afdc2[_0x281aad(0x11e)](_0x327bb5=>(_0x327bb5[_0x281aad(0x116)]??_0x327bb5[_0x281aad(0x12b)]??'?')+'('+_0x327bb5['userId']+')')['join'](',\x20');throw CliErrors[_0x281aad(0x142)](_0x281aad(0x12a)+_0x3582c3+'\x22:\x20'+_0x3f316f+'.',_0x281aad(0x13b));}const _0x21e7b7=_0x1afdc2[0x0];return{'userId':_0x21e7b7[_0x281aad(0x105)],'username':_0x21e7b7['username']??String(_0x21e7b7[_0x281aad(0x105)]),'nickname':_0x21e7b7[_0x281aad(0x116)],'matchedBy':'name'};}export const UPDATE_USER_LIST_PATH=a162_0x4ef002(0x137);function userIdsOf(_0x547905){const _0xdb4d80=a162_0x4ef002;return(_0x547905?.[_0xdb4d80(0x134)]??[])['map'](_0x5a2129=>_0x5a2129[_0xdb4d80(0x105)]);}export function computeRoleUserMutation(_0x511f16){const _0x2c78e=a162_0x4ef002,{operation:_0x3f2d9d,appCode:_0x1b5e70,roleUsers:_0x415033,targetRoleId:_0x5ee6c6,user:_0x58fd5c}=_0x511f16,_0x4e5123=_0x415033[_0x2c78e(0x124)](_0x1edb30=>_0x1edb30['id']===_0x5ee6c6);if(!_0x4e5123)throw CliErrors[_0x2c78e(0x142)](_0x2c78e(0x13a)+_0x5ee6c6+_0x2c78e(0x133),'Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');const _0x3b1138=userIdsOf(_0x4e5123),_0x4e90d0=[];if(_0x511f16[_0x2c78e(0x114)]!==undefined&&_0x511f16['expectUserCount']!==_0x3b1138['length'])throw CliErrors[_0x2c78e(0x142)](_0x2c78e(0x112)+_0x511f16[_0x2c78e(0x114)]+'\x20member(s)\x20but\x20role\x20has\x20'+_0x3b1138[_0x2c78e(0x11b)]+'.',_0x2c78e(0x11a));const _0x448856=_0x3b1138[_0x2c78e(0x102)](_0x58fd5c[_0x2c78e(0x105)]);let _0x549af0=![];const _0x52c608=[..._0x4e5123['userList']];if(_0x3f2d9d===_0x2c78e(0xfe))_0x448856?_0x4e90d0[_0x2c78e(0x126)]('User\x20'+_0x58fd5c['userId']+_0x2c78e(0x10e)+_0x4e5123['roleName']+_0x2c78e(0x12d)):(_0x52c608[_0x2c78e(0x126)]({'userId':_0x58fd5c['userId'],'username':_0x58fd5c[_0x2c78e(0x12b)],..._0x58fd5c['nickname']?{'nickname':_0x58fd5c[_0x2c78e(0x116)]}:{}}),_0x549af0=!![]);else{if(!_0x448856)_0x4e90d0[_0x2c78e(0x126)](_0x2c78e(0x141)+_0x58fd5c['userId']+_0x2c78e(0x129)+_0x4e5123[_0x2c78e(0x11d)]+_0x2c78e(0x12d));else{const _0x5d7b51=_0x52c608[_0x2c78e(0x100)](_0x43fe85=>_0x43fe85['userId']===_0x58fd5c[_0x2c78e(0x105)]);if(_0x5d7b51>=0x0)_0x52c608['splice'](_0x5d7b51,0x1);_0x549af0=!![];}}const _0x58ab4d=_0x415033[_0x2c78e(0x11e)](_0x57622d=>_0x57622d['id']===_0x5ee6c6?{..._0x57622d,'userList':_0x52c608}:_0x57622d),_0x51b10b=_0x52c608['map'](_0xe1cb7=>_0xe1cb7['userId']),_0x56b191={'operation':_0x3f2d9d,'selector':{'appCode':_0x1b5e70,'roleId':_0x5ee6c6,'roleName':_0x4e5123[_0x2c78e(0x11d)],'userId':_0x58fd5c['userId']},'before':{'userIds':_0x3b1138},'after':{'userIds':_0x51b10b},'dryRun':_0x511f16[_0x2c78e(0x111)],'backend':{'method':_0x2c78e(0x121),'path':UPDATE_USER_LIST_PATH},'warnings':_0x4e90d0};return{'roleList':_0x58ab4d,'mutation':_0x56b191,'changed':_0x549af0};}function a162_0x18ee(){const _0x135a8b=['\x20built-in\x20role\x20','user','/smartapi/permit/user-role/update-user-list','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','expect-user-count','Role\x20id\x20','Disambiguate\x20with\x20--user\x20<id>.','DEV','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','join','1656225OhWsgV','2869516MRnqnK','User\x20','validation','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','trim','tenant_code','flag','Pass\x20--user\x20<id|name>.','totalCount','Missing\x20user\x20reference.','user-add','name','findIndex','\x20not\x20found\x20in\x20app\x20','includes','flagMissing','792673XPpgwh','userId','1130190nSgBNq','remark','1390554chWvKS','Cannot\x20','appCode','Optional\x20role\x20remark/description','Pass\x20--role\x20<id|name>.','number','\x20is\x20already\x20a\x20member\x20of\x20role\x20','1318680nTCUvU','string','dryRun','Anti-drift\x20check\x20failed:\x20expected\x20','ADMIN','expectUserCount','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','nickname','35518GgxTdZ','toLowerCase','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','length','permitCount','roleName','map','USER','Missing\x20role\x20reference.','POST','filter','test','find','userCount','push','Role\x20name\x20\x22','roleType','\x20is\x20not\x20a\x20member\x20of\x20role\x20','Multiple\x20tenant\x20members\x20match\x20\x22','username','tenant',';\x20no\x20change.','str','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','role','Role\x20id\x20(from\x20`role\x20list`)','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20','\x20not\x20found\x20in\x20the\x20user-role\x20list.','userList'];a162_0x18ee=function(){return _0x135a8b;};return a162_0x18ee();}export async function loadRoleUsers(_0x43a089){return listRoleUsers(_0x43a089);}export function readRoleRef(_0xf13747){const _0x39591b=a162_0x4ef002,_0x11a3a6=_0xf13747['str'](_0x39591b(0x130))[_0x39591b(0x144)]();if(!_0x11a3a6)throw CliErrors[_0x39591b(0x103)](_0x39591b(0x130),_0x39591b(0x10c));return _0x11a3a6;}export async function prepareUserMutation(_0x1cd5c6,_0xb6330f,_0x3e9327){const _0x311ca2=a162_0x4ef002,_0x5d0e5c=readRoleRef(_0x1cd5c6),_0x35bb11=_0x1cd5c6[_0x311ca2(0x12e)](_0x311ca2(0x136))[_0x311ca2(0x144)]();if(!_0x35bb11)throw CliErrors[_0x311ca2(0x103)](_0x311ca2(0x136),_0x311ca2(0x147));const _0x15f3a1=_0x1cd5c6[_0x311ca2(0x146)](_0x311ca2(0x139)),_0x2eea7d=_0x15f3a1===undefined||_0x15f3a1===null?undefined:Number(_0x15f3a1),_0x1c8156=await resolveRoleRef(_0x1cd5c6[_0x311ca2(0x10a)],_0x5d0e5c),_0x14dacd=await resolveUserRef(_0x35bb11),_0x3d1904=await loadRoleUsers(_0x1cd5c6[_0x311ca2(0x10a)]);return computeRoleUserMutation({'operation':_0xb6330f,'appCode':_0x1cd5c6[_0x311ca2(0x10a)],'roleUsers':_0x3d1904,'targetRoleId':_0x1c8156['id'],'user':{'userId':_0x14dacd[_0x311ca2(0x105)],'username':_0x14dacd[_0x311ca2(0x12b)],'nickname':_0x14dacd[_0x311ca2(0x116)]},'dryRun':_0x3e9327,..._0x2eea7d!==undefined?{'expectUserCount':_0x2eea7d}:{}});}
|
|
1
|
+
const a162_0x2d3361=a162_0x1bb7;(function(_0x20f0f0,_0x34db6b){const _0x503fe5=a162_0x1bb7,_0x6b5dd=_0x20f0f0();while(!![]){try{const _0x2730bb=-parseInt(_0x503fe5(0x20f))/0x1*(-parseInt(_0x503fe5(0x1e0))/0x2)+-parseInt(_0x503fe5(0x1dc))/0x3*(parseInt(_0x503fe5(0x210))/0x4)+-parseInt(_0x503fe5(0x1ea))/0x5*(parseInt(_0x503fe5(0x207))/0x6)+-parseInt(_0x503fe5(0x21d))/0x7+parseInt(_0x503fe5(0x1d4))/0x8+-parseInt(_0x503fe5(0x214))/0x9*(-parseInt(_0x503fe5(0x1e7))/0xa)+parseInt(_0x503fe5(0x20e))/0xb*(-parseInt(_0x503fe5(0x21a))/0xc);if(_0x2730bb===_0x34db6b)break;else _0x6b5dd['push'](_0x6b5dd['shift']());}catch(_0x31f10c){_0x6b5dd['push'](_0x6b5dd['shift']());}}}(a162_0x4c6c,0xc5ef3));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a162_0x2d3361(0x1d0),'required':!![],'description':'Role\x20id\x20(from\x20`role\x20list`)'};export const ROLE_REF_FLAG={'name':a162_0x2d3361(0x1f1),'type':a162_0x2d3361(0x217),'required':!![],'description':'Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)'};export const USER_REF_FLAG={'name':a162_0x2d3361(0x212),'type':'string','required':!![],'description':'User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'};export const NAME_FLAG={'name':a162_0x2d3361(0x1ee),'type':a162_0x2d3361(0x217),'required':!![],'description':a162_0x2d3361(0x1fd)};export const USER_NAME_FLAG={'name':'name','type':'string','required':!![],'description':a162_0x2d3361(0x1f4)};export const REMARK_FLAG={'name':'remark','type':a162_0x2d3361(0x217),'required':![],'description':a162_0x2d3361(0x1f3)};export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a162_0x2d3361(0x1d0),'required':![],'description':a162_0x2d3361(0x213)};export const BUILTIN_ROLE_TYPES=[a162_0x2d3361(0x1de),a162_0x2d3361(0x21b),a162_0x2d3361(0x208)];export function isBuiltinRole(_0x1355cb){const _0x54db58=a162_0x2d3361;return BUILTIN_ROLE_TYPES[_0x54db58(0x201)](_0x1355cb);}export function assertCustomRole(_0x1e744b,_0x1bc5e4){const _0x47fde3=a162_0x2d3361;if(_0x1e744b[_0x47fde3(0x1fc)]!=='CUSTOM')throw CliErrors[_0x47fde3(0x20d)](_0x47fde3(0x215)+_0x1bc5e4+_0x47fde3(0x1ec)+_0x1e744b[_0x47fde3(0x20c)]+'\x20('+_0x1e744b[_0x47fde3(0x1fc)]+').','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.');}export function assertPermConfigurable(_0x3ff4a8){const _0x9457d7=a162_0x2d3361;if(_0x3ff4a8[_0x9457d7(0x1fc)]===_0x9457d7(0x21b)||_0x3ff4a8[_0x9457d7(0x1fc)]==='ADMIN')throw CliErrors[_0x9457d7(0x20d)](_0x9457d7(0x204)+_0x3ff4a8[_0x9457d7(0x20c)]+'\x20('+_0x3ff4a8['roleType']+').',_0x9457d7(0x1fa));}export function projectRole(_0x12b994){const _0x116b00=a162_0x2d3361;return{'id':_0x12b994['id'],'roleName':_0x12b994['roleName'],'roleType':_0x12b994[_0x116b00(0x1fc)],'remark':_0x12b994[_0x116b00(0x20b)],'userCount':_0x12b994[_0x116b00(0x1f7)],'permitCount':_0x12b994['permitCount'],'builtin':isBuiltinRole(_0x12b994[_0x116b00(0x1fc)])};}export async function resolveRoleRef(_0x2f3ed1,_0xebc015){const _0x1965a4=a162_0x2d3361,_0x4ac8c5=_0xebc015[_0x1965a4(0x21c)]();if(!_0x4ac8c5)throw CliErrors[_0x1965a4(0x20d)](_0x1965a4(0x1f5),_0x1965a4(0x1e9));if(/^\d+$/[_0x1965a4(0x1e8)](_0x4ac8c5))return getRoleById(_0x2f3ed1,Number(_0x4ac8c5));const _0x255fe5=await listAllAppRoles(_0x2f3ed1),_0x4a652a=_0x255fe5['filter'](_0x46197e=>_0x46197e[_0x1965a4(0x20c)]===_0x4ac8c5);if(_0x4a652a[_0x1965a4(0x1d8)]===0x0)throw CliErrors[_0x1965a4(0x20d)]('Role\x20name\x20\x22'+_0x4ac8c5+_0x1965a4(0x1d9)+_0x2f3ed1+'.',_0x1965a4(0x209));if(_0x4a652a['length']>0x1){const _0x4e5fea=_0x4a652a[_0x1965a4(0x1d5)](_0x9ed8df=>_0x9ed8df['id'])[_0x1965a4(0x1e4)](',\x20');throw CliErrors['validation']('Role\x20name\x20\x22'+_0x4ac8c5+_0x1965a4(0x1e3)+_0x4e5fea+').',_0x1965a4(0x1d2));}return _0x4a652a[0x0];}export async function getRoleById(_0x3ebfc3,_0x94e102){const _0x19dc95=a162_0x2d3361,_0x154f2c=await getAppRole(_0x94e102);if(!_0x154f2c)throw CliErrors[_0x19dc95(0x20d)](_0x19dc95(0x1fe)+_0x94e102+_0x19dc95(0x1f9)+_0x3ebfc3+'.',_0x19dc95(0x1e1));return _0x154f2c;}function a162_0x4c6c(){const _0x14169b=['Disambiguate\x20with\x20--role\x20<id>.','Anti-drift\x20check\x20failed:\x20expected\x20','3569784AwZwSs','map','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','User\x20','length','\x22\x20not\x20found\x20in\x20app\x20','Missing\x20user\x20reference.','/smartapi/permit/user-role/update-user-list','102108MBQKcE','expectUserCount','ADMIN','No\x20tenant\x20member\x20matches\x20\x22','26NulxmC','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','flag','\x22\x20is\x20ambiguous\x20(ids:\x20','join','tenant','\x20is\x20already\x20a\x20member\x20of\x20role\x20','1330plRGfN','test','Pass\x20--role\x20<id|name>.','1645doxWLc','push','\x20built-in\x20role\x20','dryRun','name','Disambiguate\x20with\x20--user\x20<id>.','totalCount','role','nickname','Optional\x20role\x20remark/description','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','Missing\x20role\x20reference.','userId','userCount','username','\x20not\x20found\x20in\x20app\x20','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','splice','roleType','Role\x20name','Role\x20id\x20','filter','flagMissing','includes',';\x20no\x20change.','toLowerCase','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20','userList','\x20not\x20found\x20in\x20the\x20user-role\x20list.','13890wtICOS','USER','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','Multiple\x20tenant\x20members\x20match\x20\x22','remark','roleName','validation','5208478jwQRFo','111305mnqmPU','40sUwRgA','find','user','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','43101PeeiZj','Cannot\x20','appCode','string','expect-user-count','str','12LcNocN','DEV','trim','1007251kDVDSY','number','\x20is\x20not\x20a\x20member\x20of\x20role\x20'];a162_0x4c6c=function(){return _0x14169b;};return a162_0x4c6c();}async function listAllAppRoles(_0x11db98){const _0x227448=a162_0x2d3361,_0x318693=0x64,_0x2ae3dd=[];for(let _0x363802=0x1;;_0x363802+=0x1){const {items:_0x220a51,paging:_0x96f82}=await listAppRoles(_0x11db98,{'currentPage':_0x363802,'pageSize':_0x318693});_0x2ae3dd[_0x227448(0x1eb)](..._0x220a51);if(_0x220a51[_0x227448(0x1d8)]<_0x318693||_0x96f82&&_0x2ae3dd[_0x227448(0x1d8)]>=_0x96f82[_0x227448(0x1f0)])return _0x2ae3dd;}}export async function resolveTenantCode(){const _0x301986=a162_0x2d3361,_0x1c1c53=await getSessionUserInfo(),_0x433fb1=_0x1c1c53?.[_0x301986(0x212)]?.[_0x301986(0x1e5)]?.['tenant_code'];if(!_0x433fb1)throw CliErrors['authRequired']('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x433fb1;}function matchMember(_0x46f661,_0x391113){const _0x29467a=a162_0x2d3361,_0x593b63=_0x391113['trim']()['toLowerCase']();return(_0x46f661['nickname']??'')[_0x29467a(0x203)]()===_0x593b63||(_0x46f661[_0x29467a(0x1f8)]??'')[_0x29467a(0x203)]()===_0x593b63;}export async function resolveUserRef(_0x509595){const _0x4575cb=a162_0x2d3361,_0x3965e7=_0x509595[_0x4575cb(0x21c)]();if(!_0x3965e7)throw CliErrors['validation'](_0x4575cb(0x1da),'Pass\x20--user\x20<id|name>.');const _0x382d4c=await resolveTenantCode(),_0x40a9b6=await getTenantMembers(_0x382d4c);if(/^\d+$/['test'](_0x3965e7)){const _0x267097=Number(_0x3965e7),_0x5ad2fe=_0x40a9b6[_0x4575cb(0x211)](_0x34f8ff=>_0x34f8ff[_0x4575cb(0x1f6)]===_0x267097);return{'userId':_0x267097,'username':_0x5ad2fe?.[_0x4575cb(0x1f8)]??String(_0x267097),'nickname':_0x5ad2fe?.['nickname'],'matchedBy':'id'};}const _0x2acfd7=_0x40a9b6[_0x4575cb(0x1ff)](_0x2779a7=>matchMember(_0x2779a7,_0x3965e7));if(_0x2acfd7[_0x4575cb(0x1d8)]===0x0)throw CliErrors[_0x4575cb(0x20d)](_0x4575cb(0x1df)+_0x3965e7+'\x22.','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.');if(_0x2acfd7['length']>0x1){const _0x6385e9=_0x2acfd7['map'](_0x195d12=>(_0x195d12[_0x4575cb(0x1f2)]??_0x195d12[_0x4575cb(0x1f8)]??'?')+'('+_0x195d12['userId']+')')[_0x4575cb(0x1e4)](',\x20');throw CliErrors[_0x4575cb(0x20d)](_0x4575cb(0x20a)+_0x3965e7+'\x22:\x20'+_0x6385e9+'.',_0x4575cb(0x1ef));}const _0x4e8cc7=_0x2acfd7[0x0];return{'userId':_0x4e8cc7[_0x4575cb(0x1f6)],'username':_0x4e8cc7[_0x4575cb(0x1f8)]??String(_0x4e8cc7['userId']),'nickname':_0x4e8cc7['nickname'],'matchedBy':_0x4575cb(0x1ee)};}export const UPDATE_USER_LIST_PATH=a162_0x2d3361(0x1db);function userIdsOf(_0x2e569e){const _0x4be973=a162_0x2d3361;return(_0x2e569e?.[_0x4be973(0x205)]??[])[_0x4be973(0x1d5)](_0x4c8f98=>_0x4c8f98[_0x4be973(0x1f6)]);}export function computeRoleUserMutation(_0x43e2af){const _0x448196=a162_0x2d3361,{operation:_0x47a521,appCode:_0x2f8a48,roleUsers:_0x4804a9,targetRoleId:_0x4358af,user:_0x32631c}=_0x43e2af,_0x7645fe=_0x4804a9[_0x448196(0x211)](_0x23d0dd=>_0x23d0dd['id']===_0x4358af);if(!_0x7645fe)throw CliErrors[_0x448196(0x20d)](_0x448196(0x1fe)+_0x4358af+_0x448196(0x206),_0x448196(0x1e1));const _0x340fbe=userIdsOf(_0x7645fe),_0x4e8181=[];if(_0x43e2af[_0x448196(0x1dd)]!==undefined&&_0x43e2af[_0x448196(0x1dd)]!==_0x340fbe[_0x448196(0x1d8)])throw CliErrors[_0x448196(0x20d)](_0x448196(0x1d3)+_0x43e2af[_0x448196(0x1dd)]+'\x20member(s)\x20but\x20role\x20has\x20'+_0x340fbe[_0x448196(0x1d8)]+'.',_0x448196(0x1d6));const _0x2114c9=_0x340fbe[_0x448196(0x201)](_0x32631c[_0x448196(0x1f6)]);let _0x4ce1ad=![];const _0x4cd62d=[..._0x7645fe[_0x448196(0x205)]];if(_0x47a521==='user-add')_0x2114c9?_0x4e8181[_0x448196(0x1eb)](_0x448196(0x1d7)+_0x32631c[_0x448196(0x1f6)]+_0x448196(0x1e6)+_0x7645fe[_0x448196(0x20c)]+';\x20no\x20change.'):(_0x4cd62d[_0x448196(0x1eb)]({'userId':_0x32631c[_0x448196(0x1f6)],'username':_0x32631c[_0x448196(0x1f8)],..._0x32631c[_0x448196(0x1f2)]?{'nickname':_0x32631c['nickname']}:{}}),_0x4ce1ad=!![]);else{if(!_0x2114c9)_0x4e8181[_0x448196(0x1eb)]('User\x20'+_0x32631c[_0x448196(0x1f6)]+_0x448196(0x1d1)+_0x7645fe[_0x448196(0x20c)]+_0x448196(0x202));else{const _0x3c1f34=_0x4cd62d['findIndex'](_0x33f45d=>_0x33f45d['userId']===_0x32631c[_0x448196(0x1f6)]);if(_0x3c1f34>=0x0)_0x4cd62d[_0x448196(0x1fb)](_0x3c1f34,0x1);_0x4ce1ad=!![];}}const _0x519a3c=_0x4804a9['map'](_0x5935de=>_0x5935de['id']===_0x4358af?{..._0x5935de,'userList':_0x4cd62d}:_0x5935de),_0x49deba=_0x4cd62d[_0x448196(0x1d5)](_0x4f228d=>_0x4f228d[_0x448196(0x1f6)]),_0x71884f={'operation':_0x47a521,'selector':{'appCode':_0x2f8a48,'roleId':_0x4358af,'roleName':_0x7645fe[_0x448196(0x20c)],'userId':_0x32631c[_0x448196(0x1f6)]},'before':{'userIds':_0x340fbe},'after':{'userIds':_0x49deba},'dryRun':_0x43e2af[_0x448196(0x1ed)],'backend':{'method':'POST','path':UPDATE_USER_LIST_PATH},'warnings':_0x4e8181};return{'roleList':_0x519a3c,'mutation':_0x71884f,'changed':_0x4ce1ad};}function a162_0x1bb7(_0x2f901c,_0x4625a3){_0x2f901c=_0x2f901c-0x1d0;const _0x4c6c78=a162_0x4c6c();let _0x1bb7b9=_0x4c6c78[_0x2f901c];return _0x1bb7b9;}export async function loadRoleUsers(_0x22ba6b){return listRoleUsers(_0x22ba6b);}export function readRoleRef(_0x15d841){const _0x4e442e=a162_0x2d3361,_0x12942c=_0x15d841[_0x4e442e(0x219)](_0x4e442e(0x1f1))[_0x4e442e(0x21c)]();if(!_0x12942c)throw CliErrors[_0x4e442e(0x200)]('role',_0x4e442e(0x1e9));return _0x12942c;}export async function prepareUserMutation(_0x59d05d,_0x3d4067,_0x415a05){const _0x4e51cc=a162_0x2d3361,_0x542e1c=readRoleRef(_0x59d05d),_0x37b875=_0x59d05d[_0x4e51cc(0x219)]('user')[_0x4e51cc(0x21c)]();if(!_0x37b875)throw CliErrors[_0x4e51cc(0x200)]('user','Pass\x20--user\x20<id|name>.');const _0x3d21af=_0x59d05d[_0x4e51cc(0x1e2)](_0x4e51cc(0x218)),_0x4be5ec=_0x3d21af===undefined||_0x3d21af===null?undefined:Number(_0x3d21af),_0x49d0ad=await resolveRoleRef(_0x59d05d[_0x4e51cc(0x216)],_0x542e1c),_0x5c3725=await resolveUserRef(_0x37b875),_0xd3626a=await loadRoleUsers(_0x59d05d[_0x4e51cc(0x216)]);return computeRoleUserMutation({'operation':_0x3d4067,'appCode':_0x59d05d[_0x4e51cc(0x216)],'roleUsers':_0xd3626a,'targetRoleId':_0x49d0ad['id'],'user':{'userId':_0x5c3725[_0x4e51cc(0x1f6)],'username':_0x5c3725[_0x4e51cc(0x1f8)],'nickname':_0x5c3725[_0x4e51cc(0x1f2)]},'dryRun':_0x415a05,..._0x4be5ec!==undefined?{'expectUserCount':_0x4be5ec}:{}});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a163_0x891cdb=a163_0x98c7;(function(_0x2a0641,_0x36a970){const _0x5bc487=a163_0x98c7,_0x335aba=_0x2a0641();while(!![]){try{const _0x181696=-parseInt(_0x5bc487(0x103))/0x1*(parseInt(_0x5bc487(0x10d))/0x2)+parseInt(_0x5bc487(0x108))/0x3+-parseInt(_0x5bc487(0xf9))/0x4*(-parseInt(_0x5bc487(0xfb))/0x5)+parseInt(_0x5bc487(0x106))/0x6+-parseInt(_0x5bc487(0x104))/0x7+-parseInt(_0x5bc487(0x10b))/0x8+parseInt(_0x5bc487(0xfc))/0x9;if(_0x181696===_0x36a970)break;else _0x335aba['push'](_0x335aba['shift']());}catch(_0x1879d8){_0x335aba['push'](_0x335aba['shift']());}}}(a163_0x2f46,0x529ec));import{updateAppRole}from'../../core/api-client.js';function a163_0x98c7(_0x3b519a,_0x540d0f){_0x3b519a=_0x3b519a-0xf9;const _0x2f4640=a163_0x2f46();let _0x98c730=_0x2f4640[_0x3b519a];return _0x98c730;}function a163_0x2f46(){const _0x4a4645=['remark','1935216CwxwWM','trim','955608jaabts','num','flag','3262392kiYGcb','Updated\x20role\x20','2AUftyo','roleName','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','POST','update','488iWJMBK','/smartapi/permit/role/update','2620zsmtKm','6315876wbDaYD','Nothing\x20to\x20update.','validation','appCode','length','\x20(id=','New\x20role\x20name','29955Jblaes','4414186eFBazx'];a163_0x2f46=function(){return _0x4a4645;};return a163_0x2f46();}import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a163_0x891cdb(0xfa);function readPatch(_0x2672d4){const _0xf64c24=a163_0x891cdb,_0x89c49=_0x2672d4['flag']('name'),_0x199db3=_0x2672d4[_0xf64c24(0x10a)](_0xf64c24(0x105)),_0x5c312c={};if(_0x89c49!==undefined&&_0x89c49!==null){const _0x7d283d=String(_0x89c49)[_0xf64c24(0x107)]();if(!_0x7d283d)throw CliErrors[_0xf64c24(0xfe)]('--name\x20cannot\x20be\x20empty.');if(_0x7d283d[_0xf64c24(0x100)]>0x40)throw CliErrors[_0xf64c24(0xfe)](_0xf64c24(0x10f));_0x5c312c[_0xf64c24(0x10e)]=_0x7d283d;}_0x199db3!==undefined&&_0x199db3!==null&&(_0x5c312c[_0xf64c24(0x105)]=String(_0x199db3));if(_0x5c312c[_0xf64c24(0x10e)]===undefined&&_0x5c312c[_0xf64c24(0x105)]===undefined)throw CliErrors[_0xf64c24(0xfe)](_0xf64c24(0xfd),'Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.');return _0x5c312c;}export const roleUpdate={'service':'role','command':a163_0x891cdb(0x111),'description':'Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','risk':'write','flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':'name','type':'string','required':![],'description':a163_0x891cdb(0x102)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x38ff12){readPatch(_0x38ff12);},async 'dryRun'(_0x34e1c6){const _0x4297b0=a163_0x891cdb,_0x39f9c6=_0x34e1c6['num']('id'),_0x23304e=readPatch(_0x34e1c6),_0x1047d4=await getRoleById(_0x34e1c6[_0x4297b0(0xff)],_0x39f9c6);return assertCustomRole(_0x1047d4,_0x4297b0(0x111)),asDryRunResult({'operation':_0x4297b0(0x111),'selector':{'appCode':_0x34e1c6[_0x4297b0(0xff)],'roleId':_0x39f9c6,'roleName':_0x1047d4[_0x4297b0(0x10e)]},'before':projectRole(_0x1047d4),'after':projectRole({..._0x1047d4,..._0x23304e[_0x4297b0(0x10e)]!==undefined?{'roleName':_0x23304e[_0x4297b0(0x10e)]}:{},..._0x23304e[_0x4297b0(0x105)]!==undefined?{'remark':_0x23304e[_0x4297b0(0x105)]}:{}}),'dryRun':!![],'backend':{'method':_0x4297b0(0x110),'path':UPDATE_PATH},'warnings':[]},{'method':'POST','url':UPDATE_PATH});},async 'execute'(_0x1ae7c0){const _0x1e35f0=a163_0x891cdb,_0x1ef509=_0x1ae7c0[_0x1e35f0(0x109)]('id'),_0x2efff6=readPatch(_0x1ae7c0),_0x5537f3=await getRoleById(_0x1ae7c0['appCode'],_0x1ef509);assertCustomRole(_0x5537f3,_0x1e35f0(0x111)),await updateAppRole({'id':_0x1ef509,'appCode':_0x1ae7c0['appCode'],..._0x2efff6['roleName']!==undefined?{'roleName':_0x2efff6[_0x1e35f0(0x10e)]}:{},..._0x2efff6['remark']!==undefined?{'remark':_0x2efff6[_0x1e35f0(0x105)]}:{}});const _0x35c80f=await getRoleById(_0x1ae7c0[_0x1e35f0(0xff)],_0x1ef509);return{'ok':!![],'data':{'operation':'update','selector':{'appCode':_0x1ae7c0['appCode'],'roleId':_0x1ef509,'roleName':_0x35c80f['roleName']},'before':projectRole(_0x5537f3),'after':projectRole(_0x35c80f),'dryRun':![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},'message':_0x1e35f0(0x10c)+_0x35c80f[_0x1e35f0(0x10e)]+_0x1e35f0(0x101)+_0x1ef509+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a164_0x276909=a164_0x1550;(function(_0x121025,_0x365db5){const _0x1b66d3=a164_0x1550,_0x1be8d5=_0x121025();while(!![]){try{const _0x32c98f=-parseInt(_0x1b66d3(0x1a3))/0x1*(parseInt(_0x1b66d3(0x1a9))/0x2)+-parseInt(_0x1b66d3(0x195))/0x3+-parseInt(_0x1b66d3(0x197))/0x4*(-parseInt(_0x1b66d3(0x1a2))/0x5)+-parseInt(_0x1b66d3(0x1a0))/0x6*(-parseInt(_0x1b66d3(0x1a8))/0x7)+parseInt(_0x1b66d3(0x19d))/0x8*(parseInt(_0x1b66d3(0x19b))/0x9)+parseInt(_0x1b66d3(0x196))/0xa*(-parseInt(_0x1b66d3(0x19c))/0xb)+parseInt(_0x1b66d3(0x19f))/0xc;if(_0x32c98f===_0x365db5)break;else _0x1be8d5['push'](_0x1be8d5['shift']());}catch(_0x522f1c){_0x1be8d5['push'](_0x1be8d5['shift']());}}}(a164_0x3c32,0x65702));function a164_0x3c32(){const _0x1e608b=['roleName','user-add','Added\x20user\x20','27SxgFVW','2973157ifHomm','1202192EkGkCW','No\x20change:\x20user\x20','7022832ECrESy','39042WVqTsp','\x20to\x20role\x20','2825045RuSoUR','89jBJMxq','userId','selector','high-risk-write','appCode','7KnLFYy','11590hkPtmt','role','407265MBsKEc','20OPquQG','4lwFdHk'];a164_0x3c32=function(){return _0x1e608b;};return a164_0x3c32();}import{updateRoleUsers}from'../../core/api-client.js';function a164_0x1550(_0x5dcff9,_0x3ec6b0){_0x5dcff9=_0x5dcff9-0x195;const _0x3c32f5=a164_0x3c32();let _0x155080=_0x3c32f5[_0x5dcff9];return _0x155080;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a164_0x276909(0x1aa),'command':a164_0x276909(0x199),'description':'Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','risk':a164_0x276909(0x1a6),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x544c67){const _0x55e544=a164_0x276909,{mutation:_0x5e1bb6}=await prepareUserMutation(_0x544c67,_0x55e544(0x199),!![]);return asDryRunResult(_0x5e1bb6,{'method':'POST','url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x2780bd){const _0x4ebed8=a164_0x276909,{roleList:_0x103435,mutation:_0x4ad47d,changed:_0x296ace}=await prepareUserMutation(_0x2780bd,'user-add',![]);return _0x296ace&&await updateRoleUsers(_0x2780bd[_0x4ebed8(0x1a7)],_0x103435),{'ok':!![],'data':_0x4ad47d,'message':_0x296ace?_0x4ebed8(0x19a)+_0x4ad47d['selector']['userId']+_0x4ebed8(0x1a1)+_0x4ad47d[_0x4ebed8(0x1a5)][_0x4ebed8(0x198)]:_0x4ebed8(0x19e)+_0x4ad47d['selector'][_0x4ebed8(0x1a4)]+'\x20already\x20in\x20role\x20'+_0x4ad47d[_0x4ebed8(0x1a5)][_0x4ebed8(0x198)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a165_0x2afa89=a165_0xd413;function a165_0xd413(_0x2acda6,_0x476743){_0x2acda6=_0x2acda6-0x122;const _0xa6a292=a165_0xa6a2();let _0xd41373=_0xa6a292[_0x2acda6];return _0xd41373;}(function(_0x32d0aa,_0x371d4a){const _0x963c1a=a165_0xd413,_0x1c9336=_0x32d0aa();while(!![]){try{const _0x50604e=parseInt(_0x963c1a(0x135))/0x1*(parseInt(_0x963c1a(0x126))/0x2)+parseInt(_0x963c1a(0x125))/0x3+parseInt(_0x963c1a(0x134))/0x4*(-parseInt(_0x963c1a(0x124))/0x5)+parseInt(_0x963c1a(0x12b))/0x6+parseInt(_0x963c1a(0x128))/0x7+-parseInt(_0x963c1a(0x127))/0x8*(parseInt(_0x963c1a(0x129))/0x9)+-parseInt(_0x963c1a(0x123))/0xa;if(_0x50604e===_0x371d4a)break;else _0x1c9336['push'](_0x1c9336['shift']());}catch(_0x348f91){_0x1c9336['push'](_0x1c9336['shift']());}}}(a165_0xa6a2,0xa49e7));import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';function a165_0xa6a2(){const _0xf887db=['5099166NBCmav','\x20not\x20in\x20role\x20','appCode','role','high-risk-write','roleName','selector','No\x20change:\x20user\x20','\x20from\x20role\x20','660132OKHhpS','2dWZhcq','user-remove','userId','14634640yOgjJy','35ngVXkq','2863824JdrFXW','631324WKAItM','24Gwqkmm','8853726dFOpWj','1222911OsBirx','POST'];a165_0xa6a2=function(){return _0xf887db;};return a165_0xa6a2();}export const roleUserRemove={'service':a165_0x2afa89(0x12e),'command':'user-remove','description':'Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','risk':a165_0x2afa89(0x12f),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x42c3a8){const _0x2888b8=a165_0x2afa89,{mutation:_0x32af7a}=await prepareUserMutation(_0x42c3a8,_0x2888b8(0x136),!![]);return asDryRunResult(_0x32af7a,{'method':_0x2888b8(0x12a),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x3e1b10){const _0x5c8afe=a165_0x2afa89,{roleList:_0x5bfe75,mutation:_0x4f403d,changed:_0x2beb9a}=await prepareUserMutation(_0x3e1b10,_0x5c8afe(0x136),![]);return _0x2beb9a&&await updateRoleUsers(_0x3e1b10[_0x5c8afe(0x12d)],_0x5bfe75),{'ok':!![],'data':_0x4f403d,'message':_0x2beb9a?'Removed\x20user\x20'+_0x4f403d[_0x5c8afe(0x131)]['userId']+_0x5c8afe(0x133)+_0x4f403d[_0x5c8afe(0x131)][_0x5c8afe(0x130)]:_0x5c8afe(0x132)+_0x4f403d[_0x5c8afe(0x131)][_0x5c8afe(0x122)]+_0x5c8afe(0x12c)+_0x4f403d[_0x5c8afe(0x131)]['roleName']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a166_0x230ce9=a166_0x59a0;(function(_0x217347,_0x4f1ed3){const _0x3f61c5=a166_0x59a0,_0xf153d8=_0x217347();while(!![]){try{const _0x11d491=-parseInt(_0x3f61c5(0x1ea))/0x1+parseInt(_0x3f61c5(0x1ef))/0x2*(-parseInt(_0x3f61c5(0x1f6))/0x3)+-parseInt(_0x3f61c5(0x1f7))/0x4+parseInt(_0x3f61c5(0x1fb))/0x5+-parseInt(_0x3f61c5(0x1f5))/0x6+parseInt(_0x3f61c5(0x1eb))/0x7+parseInt(_0x3f61c5(0x1ee))/0x8*(parseInt(_0x3f61c5(0x1ed))/0x9);if(_0x11d491===_0x4f1ed3)break;else _0xf153d8['push'](_0xf153d8['shift']());}catch(_0x40a085){_0xf153d8['push'](_0xf153d8['shift']());}}}(a166_0x140e,0xbf461));import{CliErrors}from'../../errors.js';function a166_0x59a0(_0x1aaa9b,_0x10656a){_0x1aaa9b=_0x1aaa9b-0x1e7;const _0x140eb8=a166_0x140e();let _0x59a01f=_0x140eb8[_0x1aaa9b];return _0x59a01f;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';function a166_0x140e(){const _0x373897=['Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','role','read','user-resolve','5691078wcXJDy','669JdReGa','1383420YiAtAc','str','matchedBy','flagMissing','1155890ccjbGV','nickname','userId','trim','\x22\x20→\x20userId\x20','1536739SJUJCK','5029367kJISxW','name','459CPNKrG','550600zncBsa','7580zvXvSj','Pass\x20--name\x20<nickname|username>.'];a166_0x140e=function(){return _0x373897;};return a166_0x140e();}export const roleUserResolve={'service':a166_0x230ce9(0x1f2),'command':a166_0x230ce9(0x1f4),'description':a166_0x230ce9(0x1f1),'risk':a166_0x230ce9(0x1f3),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x299cad){const _0x5eac2d=a166_0x230ce9;if(!_0x299cad[_0x5eac2d(0x1f8)](_0x5eac2d(0x1ec))[_0x5eac2d(0x1e8)]())throw CliErrors[_0x5eac2d(0x1fa)](_0x5eac2d(0x1ec),_0x5eac2d(0x1f0));},async 'execute'(_0x3653bb){const _0x1b3cb6=a166_0x230ce9,_0x521cf5=_0x3653bb[_0x1b3cb6(0x1f8)]('name')[_0x1b3cb6(0x1e8)](),_0x30dd09=await resolveUserRef(_0x521cf5);return{'ok':!![],'data':{'user':{'userId':_0x30dd09[_0x1b3cb6(0x1e7)],'username':_0x30dd09['username'],'nickname':_0x30dd09[_0x1b3cb6(0x1fc)],'matchedBy':_0x30dd09[_0x1b3cb6(0x1f9)]}},'message':'Resolved\x20\x22'+_0x521cf5+_0x1b3cb6(0x1e9)+_0x30dd09[_0x1b3cb6(0x1e7)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a167_0x459264=a167_0x219b;(function(_0x48de78,_0x498dc2){const _0x834bcd=a167_0x219b,_0x5df562=_0x48de78();while(!![]){try{const _0x3a07e5=-parseInt(_0x834bcd(0x1c9))/0x1*(parseInt(_0x834bcd(0x1cd))/0x2)+parseInt(_0x834bcd(0x1a4))/0x3*(-parseInt(_0x834bcd(0x1d1))/0x4)+-parseInt(_0x834bcd(0x19c))/0x5+parseInt(_0x834bcd(0x19b))/0x6+-parseInt(_0x834bcd(0x1b5))/0x7*(-parseInt(_0x834bcd(0x19e))/0x8)+parseInt(_0x834bcd(0x1b6))/0x9*(-parseInt(_0x834bcd(0x1cf))/0xa)+parseInt(_0x834bcd(0x1c0))/0xb*(parseInt(_0x834bcd(0x1cb))/0xc);if(_0x3a07e5===_0x498dc2)break;else _0x5df562['push'](_0x5df562['shift']());}catch(_0x440d77){_0x5df562['push'](_0x5df562['shift']());}}}(a167_0x1158,0xef7cf));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([a167_0x459264(0x1b2),a167_0x459264(0x1ae)]);function a167_0x219b(_0x57c132,_0x2d9bee){_0x57c132=_0x57c132-0x198;const _0x1158ca=a167_0x1158();let _0x219b19=_0x1158ca[_0x57c132];return _0x219b19;}function readPackageScripts(_0x13a981){const _0x256b49=a167_0x459264,_0x65119c=resolve(_0x13a981,'package.json');if(!existsSync(_0x65119c))return null;try{const _0x2d0bf3=JSON[_0x256b49(0x1b3)](readFileSync(_0x65119c,_0x256b49(0x1c2)));return _0x2d0bf3[_0x256b49(0x1c1)]??{};}catch{return null;}}function detectPackageManager(_0x5f1e0b){const _0x9e6021=a167_0x459264;if(existsSync(resolve(_0x5f1e0b,_0x9e6021(0x1c5)))||existsSync(resolve(_0x5f1e0b,_0x9e6021(0x1b7))))return _0x9e6021(0x1ab);if(existsSync(resolve(_0x5f1e0b,_0x9e6021(0x1d4))))return _0x9e6021(0x1d8);if(existsSync(resolve(_0x5f1e0b,'yarn.lock')))return _0x9e6021(0x1c7);return _0x9e6021(0x1bf);}async function versionCheck(_0x3196fa){const _0x4d7f78=a167_0x459264,_0x1c2d84=await checkCliVersion();(_0x1c2d84[_0x4d7f78(0x198)]||_0x1c2d84[_0x4d7f78(0x1d7)])&&(printCliUpgradeWarning(_0x1c2d84),assertCliVersionSupported(_0x1c2d84));const _0x223f5a=await checkSdkVersion(_0x3196fa);if(_0x223f5a[_0x4d7f78(0x198)])printSdkUpgradeWarning(_0x223f5a);}function spawnScript(_0x25e7a8,_0x4da135,_0x848067,_0x5644ad){return new Promise((_0x13589e,_0x1824df)=>{const _0x2337ff=a167_0x219b,_0x35150f=['run',_0x4da135,..._0x848067],_0x205d4e=spawn(_0x25e7a8,_0x35150f,{'cwd':_0x5644ad,'stdio':_0x2337ff(0x1af),'shell':!![],'env':{...process.env,'PATH':''+join(_0x5644ad,'node_modules','.bin')+delimiter+process.env.PATH}});_0x205d4e['on'](_0x2337ff(0x19a),_0xd54227=>{const _0x1c3034=_0x2337ff;if(_0xd54227===0x0||_0xd54227===null)_0x13589e();else _0x1824df(new Error(_0x25e7a8+'\x20run\x20'+_0x4da135+_0x1c3034(0x1c4)+_0xd54227));}),_0x205d4e['on'](_0x2337ff(0x1ce),_0x1824df);});}function spawnViteBuildWatch(_0x350d5a){return new Promise((_0x19015c,_0x17f1f2)=>{const _0x3aacd2=a167_0x219b,_0x28f22b=spawn(_0x3aacd2(0x1a2),['build',_0x3aacd2(0x1bd)],{'cwd':_0x350d5a,'stdio':_0x3aacd2(0x1af),'shell':!![],'env':{...process.env,'PATH':''+join(_0x350d5a,_0x3aacd2(0x1bc),_0x3aacd2(0x19d))+delimiter+process.env.PATH}});_0x28f22b['on'](_0x3aacd2(0x19a),_0x1ae42c=>{if(_0x1ae42c===0x0||_0x1ae42c===null)_0x19015c();else _0x17f1f2(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x1ae42c));}),_0x28f22b['on']('error',_0x17f1f2);});}function spawnVitePreview(_0x46602c){return new Promise((_0x38d66b,_0x51da75)=>{const _0x65bd76=a167_0x219b,_0x519577=spawn(_0x65bd76(0x1a2),[_0x65bd76(0x1a8)],{'cwd':_0x46602c,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x46602c,_0x65bd76(0x1bc),'.bin')+delimiter+process.env.PATH}});_0x519577['on'](_0x65bd76(0x19a),_0x2412e0=>{const _0x2f5ee9=_0x65bd76;if(_0x2412e0===0x0||_0x2412e0===null)_0x38d66b();else _0x51da75(new Error(_0x2f5ee9(0x1ba)+_0x2412e0));}),_0x519577['on'](_0x65bd76(0x1ce),_0x51da75);});}const runFlags=[{'name':a167_0x459264(0x19f),'type':a167_0x459264(0x1bb),'description':a167_0x459264(0x1b4),'default':![]}];function a167_0x1158(){const _0x2d24f4=['yarn','\x20\x20\x20\x20','1KchPhK','Run\x20a\x20package.json\x20script','13251696xIsaIf','all','2488764IJWjKc','error','5040iofquK','has','32aZkAUL','\x20run\x20start','\x0a\x20\x20Available\x20scripts:\x0a','pnpm-lock.yaml','slice','run','belowMinimum','pnpm','needsUpgrade','bool','close','1387740EtPPZk','2891270rzGBJB','.bin','2878808ozktnu','watch','(none)','args','vite','Script\x20\x22','147306XafFQl','push','\x0a\x20\x20Usage:\x20','join','preview','\x20run\x20<script>\x0a','\x22\x20not\x20found\x20in\x20package.json.','bun','\x20\x20EXAMPLES','No\x20scripts\x20defined\x20in\x20package.json.','dev','inherit','\x20run\x20build','validation','start','parse','Enable\x20watch\x20mode\x20for\x20preview','21OaqmcT','5769YtWuwi','bun.lock','log','length','vite\x20preview\x20exited\x20with\x20code\x20','boolean','node_modules','--watch','Available:\x20','npm','22VhczFS','scripts','utf-8','\x20run\x20preview','\x20exited\x20with\x20code\x20','bun.lockb','keys'];a167_0x1158=function(){return _0x2d24f4;};return a167_0x1158();}export const runDefinition={'service':a167_0x459264(0x1d6),'command':a167_0x459264(0x1d6),'description':a167_0x459264(0x1ca),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x4ea36d=a167_0x459264,_0x466bd0=[];return _0x466bd0[_0x4ea36d(0x1a5)](_0x4ea36d(0x1ac)),_0x466bd0[_0x4ea36d(0x1a5)](_0x4ea36d(0x1c8)+CLI_BIN_NAME+_0x4ea36d(0x1d2)),_0x466bd0['push'](_0x4ea36d(0x1c8)+CLI_BIN_NAME+_0x4ea36d(0x1b0)),_0x466bd0[_0x4ea36d(0x1a5)](_0x4ea36d(0x1c8)+CLI_BIN_NAME+_0x4ea36d(0x1c3)),_0x466bd0['push'](_0x4ea36d(0x1c8)+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x466bd0[_0x4ea36d(0x1a7)]('\x0a');},async 'execute'(_0xf3e3c8){const _0xb5315=a167_0x459264,_0x282a58=process['cwd'](),_0x3fcf8e=_0xf3e3c8['args'][0x0],_0xca1eda=_0xf3e3c8[_0xb5315(0x1a1)][_0xb5315(0x1d5)](0x1),_0x2fca12=readPackageScripts(_0x282a58);if(!_0x2fca12)throw CliErrors[_0xb5315(0x1b1)]('No\x20package.json\x20found\x20in\x20current\x20directory.');if(!_0x3fcf8e){const _0x150e50=Object[_0xb5315(0x1c6)](_0x2fca12);if(_0x150e50[_0xb5315(0x1b9)]===0x0)console[_0xb5315(0x1b8)](_0xb5315(0x1ad));else{console[_0xb5315(0x1b8)](_0xb5315(0x1d3));for(const _0x5395f8 of _0x150e50){console['log'](_0xb5315(0x1c8)+_0x5395f8);}console[_0xb5315(0x1b8)](_0xb5315(0x1a6)+CLI_BIN_NAME+_0xb5315(0x1a9));}return{'ok':!![]};}if(!_0x2fca12[_0x3fcf8e])throw CliErrors[_0xb5315(0x1b1)](_0xb5315(0x1a3)+_0x3fcf8e+_0xb5315(0x1aa),_0xb5315(0x1be)+(Object[_0xb5315(0x1c6)](_0x2fca12)[_0xb5315(0x1a7)](',\x20')||_0xb5315(0x1a0)));const _0x88feba=detectPackageManager(_0x282a58);VERSION_CHECK_SCRIPTS[_0xb5315(0x1d0)](_0x3fcf8e)&&await versionCheck(_0x282a58);if(_0x3fcf8e==='preview'&&_0xf3e3c8[_0xb5315(0x199)](_0xb5315(0x19f)))return await Promise[_0xb5315(0x1cc)]([spawnViteBuildWatch(_0x282a58),spawnVitePreview(_0x282a58)]),{'ok':!![]};return await spawnScript(_0x88feba,_0x3fcf8e,_0xca1eda,_0x282a58),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a168_0x101941=a168_0x3b4b;function a168_0x17ef(){const _0x30e32e=['json','217HEwVrq','166808AevuFf','1487090JFrpGF','423863LfZzdS','58236Dzxnle','318mvpjlf','312OIGfZr','120104RCYJNx','148689NFLKcM','read','3YqqZgf','21eMqQNe','14345WqkWnt'];a168_0x17ef=function(){return _0x30e32e;};return a168_0x17ef();}(function(_0x95887,_0x15a93c){const _0x4cdb0=a168_0x3b4b,_0x557680=_0x95887();while(!![]){try{const _0x2eb5aa=-parseInt(_0x4cdb0(0x135))/0x1*(-parseInt(_0x4cdb0(0x13d))/0x2)+parseInt(_0x4cdb0(0x136))/0x3*(parseInt(_0x4cdb0(0x140))/0x4)+-parseInt(_0x4cdb0(0x137))/0x5*(parseInt(_0x4cdb0(0x13e))/0x6)+parseInt(_0x4cdb0(0x139))/0x7*(-parseInt(_0x4cdb0(0x13a))/0x8)+-parseInt(_0x4cdb0(0x141))/0x9+-parseInt(_0x4cdb0(0x13b))/0xa+parseInt(_0x4cdb0(0x13c))/0xb*(parseInt(_0x4cdb0(0x13f))/0xc);if(_0x2eb5aa===_0x15a93c)break;else _0x557680['push'](_0x557680['shift']());}catch(_0x68c77){_0x557680['push'](_0x557680['shift']());}}}(a168_0x17ef,0x51f6e));import{buildSchemaPayload}from'../framework/schema-export.js';function a168_0x3b4b(_0x1053b6,_0xa55858){_0x1053b6=_0x1053b6-0x134;const _0x17efc4=a168_0x17ef();let _0x3b4b05=_0x17efc4[_0x1053b6];return _0x3b4b05;}async function execute(_0x3ad78b){const _0x34f8c1=await buildSchemaPayload();return{'ok':!![],'data':_0x34f8c1};}export const schemaDefinition={'service':'schema','command':'export','description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a168_0x101941(0x134),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a168_0x101941(0x138),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a169_0x5852f3=a169_0x97d1;(function(_0x47b53b,_0x3e3fb1){const _0x1c0889=a169_0x97d1,_0x12d4ca=_0x47b53b();while(!![]){try{const _0x4795b6=parseInt(_0x1c0889(0x190))/0x1+parseInt(_0x1c0889(0x17b))/0x2+parseInt(_0x1c0889(0x191))/0x3*(-parseInt(_0x1c0889(0x1a3))/0x4)+parseInt(_0x1c0889(0x192))/0x5+-parseInt(_0x1c0889(0x182))/0x6+parseInt(_0x1c0889(0x1a6))/0x7*(parseInt(_0x1c0889(0x19b))/0x8)+-parseInt(_0x1c0889(0x17f))/0x9;if(_0x4795b6===_0x3e3fb1)break;else _0x12d4ca['push'](_0x12d4ca['shift']());}catch(_0x5bbd8f){_0x12d4ca['push'](_0x12d4ca['shift']());}}}(a169_0x5740,0xd2a4e));import{writeFile}from'node:fs/promises';function a169_0x97d1(_0x54b07d,_0xc5d14f){_0x54b07d=_0x54b07d-0x173;const _0x574006=a169_0x5740();let _0x97d193=_0x574006[_0x54b07d];return _0x97d193;}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(_0x4e082f){const _0xbe067f=a169_0x97d1;if(_0x4e082f==='mybatisXml')return[_0xbe067f(0x185),_0xbe067f(0x176),_0xbe067f(0x19a),''][_0xbe067f(0x17d)]('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0xbe067f(0x17d)]('\x0a');}export const sqlCreate={'service':a169_0x5852f3(0x1a8),'command':a169_0x5852f3(0x1a4),'description':a169_0x5852f3(0x18a),'risk':a169_0x5852f3(0x178),'flags':[{'name':a169_0x5852f3(0x183),'type':'string','description':a169_0x5852f3(0x1a1)},{'name':a169_0x5852f3(0x174),'type':a169_0x5852f3(0x1a2),'description':a169_0x5852f3(0x19e)},{'name':a169_0x5852f3(0x1a0),'type':a169_0x5852f3(0x1ac),'enum':[a169_0x5852f3(0x1a8),a169_0x5852f3(0x18b)],'description':a169_0x5852f3(0x184)}],async 'validate'(_0x54a642){const _0x6e04ec=a169_0x5852f3;if(!_0x54a642['nonInteractive'])return;if(!_0x54a642[_0x6e04ec(0x189)](_0x6e04ec(0x183))[_0x6e04ec(0x1b1)]())throw CliErrors[_0x6e04ec(0x1af)](_0x6e04ec(0x183),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x2ffe81=resolveProvidedDbId(_0x54a642);if(typeof _0x2ffe81!==_0x6e04ec(0x1a2)||!Number[_0x6e04ec(0x1b3)](_0x2ffe81)||_0x2ffe81<=0x0)throw CliErrors[_0x6e04ec(0x1af)](_0x6e04ec(0x174),_0x6e04ec(0x1aa));if(!_0x54a642[_0x6e04ec(0x189)]('mode')[_0x6e04ec(0x1b1)]())throw CliErrors[_0x6e04ec(0x1af)](_0x6e04ec(0x1a0),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x12809b){const _0x150fa2=a169_0x5852f3,_0xfe2656=loadSqlProjectConfig(_0x12809b[_0x150fa2(0x196)]),{sqlName:_0x4a5f3a,dbId:_0x9f7c18,dbName:_0x5a8f1a,mode:_0x28db15}=await resolveSqlNewInputs(_0x12809b),_0xfedc28=buildSqlRelativePath('<server-generated-sqlCode>',_0x4a5f3a,_0x5a8f1a,_0x28db15,_0x9f7c18),_0x188b8d=_0xfe2656[_0x150fa2(0x1b4)]+'/'+_0xfedc28;return{'method':_0x150fa2(0x18e),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x12809b[_0x150fa2(0x196)],'sqlName':_0x4a5f3a,'dbId':_0x9f7c18,'mode':_0x28db15,'localPath':_0x188b8d},'description':_0x150fa2(0x1b0)+_0xfe2656[_0x150fa2(0x1b4)]};},async 'execute'(_0x14f185){const _0x79bef9=a169_0x5852f3,_0x13b5fe=loadSqlProjectConfig(_0x14f185[_0x79bef9(0x196)]),{sqlName:_0x15c029,dbId:_0x57701b,dbName:_0x899db6,mode:_0x46e1cd}=await resolveSqlNewInputs(_0x14f185),_0x28e46e=generateSqlTemplate(_0x46e1cd),_0x54c647=await createSqlQuery({'appCode':_0x14f185[_0x79bef9(0x196)],'sqlName':_0x15c029,'dbId':_0x57701b,'sqlContent':_0x28e46e}),_0x50d958=ensureRemoteSqlContent(_0x54c647),_0x364d46=_0x899db6||await getDbName(_0x14f185[_0x79bef9(0x196)],_0x57701b)[_0x79bef9(0x17e)](()=>undefined),_0x228320=buildSqlRelativePath(_0x54c647[_0x79bef9(0x193)],_0x54c647['sqlName'],_0x364d46,_0x46e1cd,_0x57701b),_0x151b69=_0x13b5fe[_0x79bef9(0x1b4)]+'/'+_0x228320,_0xf2d51e=buildLocalSqlFileContent({'sqlCode':_0x54c647[_0x79bef9(0x193)],'sqlName':_0x54c647[_0x79bef9(0x199)],'dbId':_0x54c647[_0x79bef9(0x1ad)]},_0x50d958,{'dbName':_0x364d46,'mode':_0x46e1cd,'syncedAt':new Date()[_0x79bef9(0x186)](),'description':_0x54c647[_0x79bef9(0x197)]});if(await fileExists(_0x151b69))throw CliErrors['validation'](_0x79bef9(0x181)+_0x151b69);await ensureParentDirectory(_0x151b69),await writeFile(_0x151b69,_0xf2d51e,'utf8');const _0x13c0da=await readSqlLockFile(_0x13b5fe[_0x79bef9(0x18f)]),{lockData:_0x5192d0,appLock:_0x3ac11a}=ensureSqlLockScope(_0x13c0da??createEmptySqlLock(),_0x13b5fe[_0x79bef9(0x196)],_0x13b5fe[_0x79bef9(0x18c)],_0x79bef9(0x187));return _0x3ac11a[_0x79bef9(0x19c)][_0x54c647[_0x79bef9(0x193)]]={...buildSqlLockEntry(_0x54c647,_0x50d958,computeSqlContentHash(_0xf2d51e),{'dbName':_0x364d46}),'path':_0x228320,'mode':_0x46e1cd},_0x3ac11a[_0x79bef9(0x180)]=new Date()[_0x79bef9(0x186)](),await writeSqlLockFile(_0x13b5fe[_0x79bef9(0x18f)],_0x5192d0),{'ok':!![],'data':{'id':_0x54c647['id'],'sqlCode':_0x54c647['sqlCode'],'sqlName':_0x54c647[_0x79bef9(0x199)],'dbId':_0x54c647[_0x79bef9(0x1ad)],'path':_0x151b69,'mode':_0x46e1cd},'message':'Created\x20SQL\x20query\x20'+_0x54c647[_0x79bef9(0x193)]};}};function a169_0x5740(){const _0x4f242d=['POST','lockFilePath','194277ASndRZ','21207jEfXdz','798505JQDNKV','sqlCode','适合带动态标签的\x20MyBatis\x20XML\x20SQL','dbId\x20不能为空','appCode','description','请选择目标数据库:','sqlName','</select>','24cGmVAR','sqls','普通\x20SQL(sql)','Target\x20database\x20ID','length','mode','SQL\x20query\x20display\x20name','number','76KxCMKp','create','Invalid\x20database\x20selection\x20payload:\x20','3268027CveXtr','请选择本地\x20SQL\x20模式:','sql','dbName','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','nonInteractive','string','dbId','SQL\x20名称不能为空','flagMissing','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','trim','请输入目标数据库\x20dbId:','isFinite','sqlRootDir','__manual__','dbId\x20必须为正整数','db-id','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','\x20\x20SELECT\x201\x20AS\x20id','请输入\x20SQL\x20名称:','high-risk-write','MyBatis\x20XML(mybatisXml)','isInteger','1322242CvvsFl','stringify','join','catch','11837241bBoWqm','lastSync','File\x20already\x20exists:\x20','619944pEVhnL','name','Local\x20SQL\x20file\x20mode','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','toISOString','new','parse','str','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','mybatisXml','sqlRoot','validation'];a169_0x5740=function(){return _0x4f242d;};return a169_0x5740();}async function resolveSqlNewInputs(_0x13b2ff){const _0xb0bd71=await resolveSqlNameInput(_0x13b2ff),{dbId:_0x217895,dbName:_0x50902a}=await resolveDbSelection(_0x13b2ff),_0xd47ff9=await resolveSqlModeInput(_0x13b2ff);return{'sqlName':_0xb0bd71,'dbId':_0x217895,'dbName':_0x50902a,'mode':_0xd47ff9};}async function resolveSqlNameInput(_0x3b4bd8){const _0x57d58c=a169_0x5852f3,_0x57eb13=_0x3b4bd8[_0x57d58c(0x189)](_0x57d58c(0x183))[_0x57d58c(0x1b1)]();if(_0x57eb13)return _0x57eb13;if(_0x3b4bd8['nonInteractive'])throw CliErrors[_0x57d58c(0x1af)](_0x57d58c(0x183),_0x57d58c(0x175));return(await input({'message':_0x57d58c(0x177),'validate':_0x3ce2ec=>_0x3ce2ec[_0x57d58c(0x1b1)]()?!![]:_0x57d58c(0x1ae)}))['trim']();}async function resolveDbSelection(_0x43545f){const _0x4977f4=a169_0x5852f3,_0x487ee7=resolveProvidedDbId(_0x43545f);if(typeof _0x487ee7===_0x4977f4(0x1a2)&&Number[_0x4977f4(0x1b3)](_0x487ee7)&&_0x487ee7>0x0)return{'dbId':_0x487ee7,'dbName':await getDbName(_0x43545f[_0x4977f4(0x196)],_0x487ee7)[_0x4977f4(0x17e)](()=>undefined)};if(_0x43545f[_0x4977f4(0x1ab)])throw CliErrors['flagMissing'](_0x4977f4(0x174),_0x4977f4(0x1aa));const _0xdc44d3=await listDatabases(_0x43545f[_0x4977f4(0x196)])['catch'](()=>[]);if(_0xdc44d3[_0x4977f4(0x19f)]===0x1)return{'dbId':_0xdc44d3[0x0][_0x4977f4(0x1ad)],'dbName':_0xdc44d3[0x0]['dbName']};if(_0xdc44d3[_0x4977f4(0x19f)]>0x1){const _0x132ae6=await select({'message':_0x4977f4(0x198),'choices':[..._0xdc44d3['map'](_0x32397a=>({'name':_0x32397a[_0x4977f4(0x1a9)]+'\x20('+_0x32397a[_0x4977f4(0x1ad)]+')','value':serializeDbSelection(_0x32397a)})),{'name':'✎\x20手动输入\x20dbId','value':_0x4977f4(0x1b5)}]});if(_0x132ae6!==_0x4977f4(0x1b5))return deserializeDbSelection(_0x132ae6);}const _0x1fb5a9=await input({'message':_0x4977f4(0x1b2),'validate':_0xe5230a=>{const _0x724c79=_0x4977f4,_0x2a54b9=_0xe5230a[_0x724c79(0x1b1)]();if(!_0x2a54b9)return _0x724c79(0x195);const _0x194dda=Number(_0x2a54b9);if(!Number[_0x724c79(0x17a)](_0x194dda)||_0x194dda<=0x0)return _0x724c79(0x173);return!![];}});return{'dbId':Number(_0x1fb5a9[_0x4977f4(0x1b1)]())};}async function resolveSqlModeInput(_0xb1cc3e){const _0x16404c=a169_0x5852f3,_0x4555de=_0xb1cc3e[_0x16404c(0x189)](_0x16404c(0x1a0))[_0x16404c(0x1b1)]();if(_0x4555de===_0x16404c(0x1a8)||_0x4555de===_0x16404c(0x18b))return _0x4555de;if(_0xb1cc3e[_0x16404c(0x1ab)])throw CliErrors[_0x16404c(0x1af)](_0x16404c(0x1a0),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x16404c(0x1a7),'choices':[{'name':_0x16404c(0x19d),'value':_0x16404c(0x1a8),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0x16404c(0x179),'value':_0x16404c(0x18b),'description':_0x16404c(0x194)}]});}function serializeDbSelection(_0x3c2cfe){const _0x466618=a169_0x5852f3;return JSON[_0x466618(0x17c)]({'dbId':_0x3c2cfe[_0x466618(0x1ad)],'dbName':_0x3c2cfe[_0x466618(0x1a9)]});}function deserializeDbSelection(_0x1f7aae){const _0x36738c=a169_0x5852f3;try{const _0x102b96=JSON[_0x36738c(0x188)](_0x1f7aae);if(typeof _0x102b96[_0x36738c(0x1ad)]==='number'&&Number[_0x36738c(0x1b3)](_0x102b96['dbId']))return{'dbId':_0x102b96[_0x36738c(0x1ad)],'dbName':_0x102b96[_0x36738c(0x1a9)]};}catch{}throw CliErrors[_0x36738c(0x18d)](_0x36738c(0x1a5)+_0x1f7aae);}function resolveProvidedDbId(_0x2e61fd){const _0x162ba6=a169_0x5852f3,_0x23d41e=_0x2e61fd['flag'](_0x162ba6(0x174));if(typeof _0x23d41e===_0x162ba6(0x1a2)&&Number[_0x162ba6(0x1b3)](_0x23d41e))return _0x23d41e;return undefined;}
|
|
1
|
+
const a169_0x40ca45=a169_0x3348;(function(_0x5ee109,_0x491947){const _0x407563=a169_0x3348,_0x807a22=_0x5ee109();while(!![]){try{const _0x5ed3d7=parseInt(_0x407563(0x211))/0x1+-parseInt(_0x407563(0x1e8))/0x2+-parseInt(_0x407563(0x1e6))/0x3+-parseInt(_0x407563(0x201))/0x4+-parseInt(_0x407563(0x1f0))/0x5*(-parseInt(_0x407563(0x203))/0x6)+-parseInt(_0x407563(0x1e1))/0x7+parseInt(_0x407563(0x213))/0x8;if(_0x5ed3d7===_0x491947)break;else _0x807a22['push'](_0x807a22['shift']());}catch(_0x13002e){_0x807a22['push'](_0x807a22['shift']());}}}(a169_0x159d,0x3a58e));function a169_0x3348(_0x53ff58,_0x54e1cc){_0x53ff58=_0x53ff58-0x1d4;const _0x159d23=a169_0x159d();let _0x334877=_0x159d23[_0x53ff58];return _0x334877;}import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a169_0x159d(){const _0x49badc=['Target\x20database\x20ID','sqlRoot','292088YpEZFW','SQL\x20名称不能为空','3515352ZEjWIF','lockFilePath','flag','flagMissing','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','MyBatis\x20XML(mybatisXml)','Created\x20SQL\x20query\x20','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','\x20\x20SELECT\x201\x20AS\x20id','✎\x20手动输入\x20dbId','lastSync','请输入\x20SQL\x20名称:','trim','name','368228woRYSb','mybatisXml','请选择目标数据库:','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','str','358875qRkgtu','__manual__','651114EyWfoV','</select>','number','validation','nonInteractive','join','length','SELECT\x201\x20AS\x20id;','70ebTGOZ','string','description','普通\x20SQL(sql)','toISOString','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','high-risk-write','dbName','catch','sql','appCode','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','适合带动态标签的\x20MyBatis\x20XML\x20SQL','map','sqlRootDir','dbId','dbId\x20必须为正整数','1580860DZLZVD','sqlCode','171636GMjZTo','Invalid\x20database\x20selection\x20payload:\x20','db-id','dbId\x20不能为空','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','POST','sqlName','isFinite','parse','stringify','SQL\x20query\x20display\x20name','mode'];a169_0x159d=function(){return _0x49badc;};return a169_0x159d();}import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x479acd){const _0x670549=a169_0x3348;if(_0x479acd==='mybatisXml')return[_0x670549(0x1fb),_0x670549(0x1db),_0x670549(0x1e9),'']['join']('\x0a');return[_0x670549(0x1ef),''][_0x670549(0x1ed)]('\x0a');}export const sqlCreate={'service':a169_0x40ca45(0x1f9),'command':'create','description':a169_0x40ca45(0x207),'risk':a169_0x40ca45(0x1f6),'flags':[{'name':'name','type':a169_0x40ca45(0x1f1),'description':a169_0x40ca45(0x20d)},{'name':a169_0x40ca45(0x205),'type':a169_0x40ca45(0x1ea),'description':a169_0x40ca45(0x20f)},{'name':a169_0x40ca45(0x20e),'type':'string','enum':[a169_0x40ca45(0x1f9),a169_0x40ca45(0x1e2)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0xe5dff4){const _0xb3df9d=a169_0x40ca45;if(!_0xe5dff4[_0xb3df9d(0x1ec)])return;if(!_0xe5dff4['str'](_0xb3df9d(0x1e0))[_0xb3df9d(0x1df)]())throw CliErrors['flagMissing'](_0xb3df9d(0x1e0),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x139e93=resolveProvidedDbId(_0xe5dff4);if(typeof _0x139e93!==_0xb3df9d(0x1ea)||!Number['isFinite'](_0x139e93)||_0x139e93<=0x0)throw CliErrors['flagMissing'](_0xb3df9d(0x205),_0xb3df9d(0x1d7));if(!_0xe5dff4[_0xb3df9d(0x1e5)](_0xb3df9d(0x20e))['trim']())throw CliErrors['flagMissing'](_0xb3df9d(0x20e),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x56f36d){const _0x4cacbb=a169_0x40ca45,_0x76f30=loadSqlProjectConfig(_0x56f36d[_0x4cacbb(0x1fa)]),{sqlName:_0x46b7d5,dbId:_0x2f948f,dbName:_0x24709e,mode:_0x3a8953}=await resolveSqlNewInputs(_0x56f36d),_0x397eb2=buildSqlRelativePath('<server-generated-sqlCode>',_0x46b7d5,_0x24709e,_0x3a8953,_0x2f948f),_0x16bf57=_0x76f30[_0x4cacbb(0x1fe)]+'/'+_0x397eb2;return{'method':_0x4cacbb(0x208),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x56f36d[_0x4cacbb(0x1fa)],'sqlName':_0x46b7d5,'dbId':_0x2f948f,'mode':_0x3a8953,'localPath':_0x16bf57},'description':_0x4cacbb(0x1e4)+_0x76f30[_0x4cacbb(0x1fe)]};},async 'execute'(_0x10a09f){const _0x11b180=a169_0x40ca45,_0x3a10a8=loadSqlProjectConfig(_0x10a09f[_0x11b180(0x1fa)]),{sqlName:_0x5d9841,dbId:_0x3ed964,dbName:_0x429a59,mode:_0x12fc2a}=await resolveSqlNewInputs(_0x10a09f),_0x83e2c1=generateSqlTemplate(_0x12fc2a),_0x2c2a0d=await createSqlQuery({'appCode':_0x10a09f[_0x11b180(0x1fa)],'sqlName':_0x5d9841,'dbId':_0x3ed964,'sqlContent':_0x83e2c1}),_0x1ee6d9=ensureRemoteSqlContent(_0x2c2a0d),_0x4bd28b=_0x429a59||await getDbName(_0x10a09f[_0x11b180(0x1fa)],_0x3ed964)[_0x11b180(0x1f8)](()=>undefined),_0x54d25d=buildSqlRelativePath(_0x2c2a0d['sqlCode'],_0x2c2a0d[_0x11b180(0x209)],_0x4bd28b,_0x12fc2a,_0x3ed964),_0xdfdeee=_0x3a10a8[_0x11b180(0x1fe)]+'/'+_0x54d25d,_0x4db0a9=buildLocalSqlFileContent({'sqlCode':_0x2c2a0d[_0x11b180(0x202)],'sqlName':_0x2c2a0d['sqlName'],'dbId':_0x2c2a0d[_0x11b180(0x1ff)]},_0x1ee6d9,{'dbName':_0x4bd28b,'mode':_0x12fc2a,'syncedAt':new Date()[_0x11b180(0x1f4)](),'description':_0x2c2a0d[_0x11b180(0x1f2)]});if(await fileExists(_0xdfdeee))throw CliErrors[_0x11b180(0x1eb)]('File\x20already\x20exists:\x20'+_0xdfdeee);await ensureParentDirectory(_0xdfdeee),await writeFile(_0xdfdeee,_0x4db0a9,'utf8');const _0x103d74=await readSqlLockFile(_0x3a10a8[_0x11b180(0x1d4)]),{lockData:_0x2a26b4,appLock:_0xa4a76d}=ensureSqlLockScope(_0x103d74??createEmptySqlLock(),_0x3a10a8['appCode'],_0x3a10a8[_0x11b180(0x210)],'new');return _0xa4a76d['sqls'][_0x2c2a0d[_0x11b180(0x202)]]={...buildSqlLockEntry(_0x2c2a0d,_0x1ee6d9,computeSqlContentHash(_0x4db0a9),{'dbName':_0x4bd28b}),'path':_0x54d25d,'mode':_0x12fc2a},_0xa4a76d[_0x11b180(0x1dd)]=new Date()[_0x11b180(0x1f4)](),await writeSqlLockFile(_0x3a10a8[_0x11b180(0x1d4)],_0x2a26b4),{'ok':!![],'data':{'id':_0x2c2a0d['id'],'sqlCode':_0x2c2a0d[_0x11b180(0x202)],'sqlName':_0x2c2a0d['sqlName'],'dbId':_0x2c2a0d[_0x11b180(0x1ff)],'path':_0xdfdeee,'mode':_0x12fc2a},'message':_0x11b180(0x1d9)+_0x2c2a0d[_0x11b180(0x202)]};}};async function resolveSqlNewInputs(_0x504328){const _0xec538d=await resolveSqlNameInput(_0x504328),{dbId:_0x14951c,dbName:_0x4e6abf}=await resolveDbSelection(_0x504328),_0x51b212=await resolveSqlModeInput(_0x504328);return{'sqlName':_0xec538d,'dbId':_0x14951c,'dbName':_0x4e6abf,'mode':_0x51b212};}async function resolveSqlNameInput(_0x431405){const _0x1ec035=a169_0x40ca45,_0x2f226a=_0x431405[_0x1ec035(0x1e5)]('name')[_0x1ec035(0x1df)]();if(_0x2f226a)return _0x2f226a;if(_0x431405[_0x1ec035(0x1ec)])throw CliErrors[_0x1ec035(0x1d6)](_0x1ec035(0x1e0),_0x1ec035(0x1da));return(await input({'message':_0x1ec035(0x1de),'validate':_0x4532e7=>_0x4532e7[_0x1ec035(0x1df)]()?!![]:_0x1ec035(0x212)}))['trim']();}async function resolveDbSelection(_0x5170c5){const _0x5c658f=a169_0x40ca45,_0x29d713=resolveProvidedDbId(_0x5170c5);if(typeof _0x29d713===_0x5c658f(0x1ea)&&Number['isFinite'](_0x29d713)&&_0x29d713>0x0)return{'dbId':_0x29d713,'dbName':await getDbName(_0x5170c5[_0x5c658f(0x1fa)],_0x29d713)['catch'](()=>undefined)};if(_0x5170c5[_0x5c658f(0x1ec)])throw CliErrors[_0x5c658f(0x1d6)](_0x5c658f(0x205),_0x5c658f(0x1d7));const _0x11acbb=await listDatabases(_0x5170c5[_0x5c658f(0x1fa)])['catch'](()=>[]);if(_0x11acbb['length']===0x1)return{'dbId':_0x11acbb[0x0][_0x5c658f(0x1ff)],'dbName':_0x11acbb[0x0][_0x5c658f(0x1f7)]};if(_0x11acbb[_0x5c658f(0x1ee)]>0x1){const _0x40dc91=await select({'message':_0x5c658f(0x1e3),'choices':[..._0x11acbb[_0x5c658f(0x1fd)](_0x2aef7e=>({'name':_0x2aef7e[_0x5c658f(0x1f7)]+'\x20('+_0x2aef7e['dbId']+')','value':serializeDbSelection(_0x2aef7e)})),{'name':_0x5c658f(0x1dc),'value':_0x5c658f(0x1e7)}]});if(_0x40dc91!==_0x5c658f(0x1e7))return deserializeDbSelection(_0x40dc91);}const _0x557e77=await input({'message':'请输入目标数据库\x20dbId:','validate':_0x472e58=>{const _0x6d8308=_0x5c658f,_0x32f2bf=_0x472e58[_0x6d8308(0x1df)]();if(!_0x32f2bf)return _0x6d8308(0x206);const _0x15c31c=Number(_0x32f2bf);if(!Number['isInteger'](_0x15c31c)||_0x15c31c<=0x0)return _0x6d8308(0x200);return!![];}});return{'dbId':Number(_0x557e77[_0x5c658f(0x1df)]())};}async function resolveSqlModeInput(_0x1fe3f1){const _0x232e40=a169_0x40ca45,_0x2bfc01=_0x1fe3f1[_0x232e40(0x1e5)]('mode')[_0x232e40(0x1df)]();if(_0x2bfc01===_0x232e40(0x1f9)||_0x2bfc01==='mybatisXml')return _0x2bfc01;if(_0x1fe3f1[_0x232e40(0x1ec)])throw CliErrors['flagMissing'](_0x232e40(0x20e),_0x232e40(0x1f5));return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':_0x232e40(0x1f3),'value':_0x232e40(0x1f9),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0x232e40(0x1d8),'value':_0x232e40(0x1e2),'description':_0x232e40(0x1fc)}]});}function serializeDbSelection(_0x388a85){const _0x1fffea=a169_0x40ca45;return JSON[_0x1fffea(0x20c)]({'dbId':_0x388a85[_0x1fffea(0x1ff)],'dbName':_0x388a85[_0x1fffea(0x1f7)]});}function deserializeDbSelection(_0x170a3d){const _0x4cceec=a169_0x40ca45;try{const _0x9b1e0f=JSON[_0x4cceec(0x20b)](_0x170a3d);if(typeof _0x9b1e0f[_0x4cceec(0x1ff)]===_0x4cceec(0x1ea)&&Number[_0x4cceec(0x20a)](_0x9b1e0f[_0x4cceec(0x1ff)]))return{'dbId':_0x9b1e0f[_0x4cceec(0x1ff)],'dbName':_0x9b1e0f['dbName']};}catch{}throw CliErrors[_0x4cceec(0x1eb)](_0x4cceec(0x204)+_0x170a3d);}function resolveProvidedDbId(_0x30cd9a){const _0x4d10fe=a169_0x40ca45,_0x4c703a=_0x30cd9a[_0x4d10fe(0x1d5)](_0x4d10fe(0x205));if(typeof _0x4c703a===_0x4d10fe(0x1ea)&&Number[_0x4d10fe(0x20a)](_0x4c703a))return _0x4c703a;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a170_0x3b9ced=a170_0x1b72;function a170_0x3bc5(){const _0xc6a8bd=['sqlRoot','length','trashDir','trashedTo','\x20(local\x20file\x20moved\x20to\x20trash)','sqlRootDir','508392UzeVtz','remoteId','lastSync','/smartapi/custom/deleteUserCustomSql','POST','45052sYkilP','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','sql','str','appCode','2862880NQvomR','validation','fromEntries','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','Would\x20delete\x20SQL\x20','2303992txiCxu','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','sqls','lockFilePath','sqlcode','SQL\x20lock\x20file\x20not\x20found.','6341808zWStiM','toISOString','filter','delete','674270ZfEdwG','254356IMJzmq','high-risk-write','776rTyGDR'];a170_0x3bc5=function(){return _0xc6a8bd;};return a170_0x3bc5();}(function(_0x5c1a37,_0x346902){const _0x367417=a170_0x1b72,_0x189d63=_0x5c1a37();while(!![]){try{const _0x15e4a9=parseInt(_0x367417(0x87))/0x1+-parseInt(_0x367417(0x86))/0x2+parseInt(_0x367417(0x90))/0x3+-parseInt(_0x367417(0x7b))/0x4+-parseInt(_0x367417(0x76))/0x5+parseInt(_0x367417(0x82))/0x6+-parseInt(_0x367417(0x95))/0x7*(-parseInt(_0x367417(0x89))/0x8);if(_0x15e4a9===_0x346902)break;else _0x189d63['push'](_0x189d63['shift']());}catch(_0x88014d){_0x189d63['push'](_0x189d63['shift']());}}}(a170_0x3bc5,0x9736b));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a170_0x1b72(_0xd1aca,_0x558a9b){_0xd1aca=_0xd1aca-0x73;const _0x3bc589=a170_0x3bc5();let _0x1b72a0=_0x3bc589[_0xd1aca];return _0x1b72a0;}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a170_0x3b9ced(0x73),'command':a170_0x3b9ced(0x85),'description':a170_0x3b9ced(0x7d),'risk':a170_0x3b9ced(0x88),'flags':[SQLCODE_FLAG],async 'validate'(_0x311389){const _0x403a69=a170_0x3b9ced,_0x105af4=loadSqlProjectConfig(_0x311389['appCode']),_0x2a97ab=await readSqlLockFile(_0x105af4[_0x403a69(0x7f)]);if(!_0x2a97ab)throw CliErrors[_0x403a69(0x77)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x2a58a6){const _0x707a29=a170_0x3b9ced,_0x5a999f=loadSqlProjectConfig(_0x2a58a6[_0x707a29(0x75)]),_0x248a84=await readSqlLockFile(_0x5a999f[_0x707a29(0x7f)]);if(!_0x248a84)throw CliErrors[_0x707a29(0x77)](_0x707a29(0x79));const {appLock:_0x14f04f}=ensureSqlLockScope(_0x248a84,_0x2a58a6[_0x707a29(0x75)],_0x5a999f[_0x707a29(0x8a)],_0x707a29(0x85)),_0x77b0d2=_0x2a58a6[_0x707a29(0x74)](_0x707a29(0x80)),_0x1c9a0e=_0x14f04f['sqls'][_0x77b0d2];if(!_0x1c9a0e)throw CliErrors['validation'](_0x707a29(0x7c)+_0x77b0d2+'\x22.');return{'method':_0x707a29(0x94),'url':_0x707a29(0x93),'body':{'sqlCode':_0x77b0d2,'id':_0x1c9a0e[_0x707a29(0x91)],'localPath':resolveLocalSqlFilePath(_0x5a999f,_0x77b0d2,_0x1c9a0e)},'description':_0x707a29(0x7a)+_0x77b0d2+_0x707a29(0x96)+_0x5a999f[_0x707a29(0x8c)]};},async 'execute'(_0x19e225){const _0xf3b582=a170_0x3b9ced,_0x4491df=loadSqlProjectConfig(_0x19e225[_0xf3b582(0x75)]),_0x45d6d3=await readSqlLockFile(_0x4491df[_0xf3b582(0x7f)]);if(!_0x45d6d3)throw CliErrors['validation'](_0xf3b582(0x81));const {lockData:_0x56dcce,appLock:_0x2f3c89}=ensureSqlLockScope(_0x45d6d3,_0x19e225[_0xf3b582(0x75)],_0x4491df[_0xf3b582(0x8a)],'delete'),_0x48e78a=_0x19e225[_0xf3b582(0x74)](_0xf3b582(0x80)),_0x132882=_0x2f3c89[_0xf3b582(0x7e)][_0x48e78a];if(!_0x132882)throw CliErrors[_0xf3b582(0x77)](_0xf3b582(0x7c)+_0x48e78a+'\x22.');await deleteSqlQuery({'id':_0x132882[_0xf3b582(0x91)],'sqlCode':_0x48e78a}),_0x2f3c89[_0xf3b582(0x7e)]=Object[_0xf3b582(0x78)](Object['entries'](_0x2f3c89[_0xf3b582(0x7e)])[_0xf3b582(0x84)](([_0x4a4020])=>_0x4a4020!==_0x48e78a)),_0x2f3c89[_0xf3b582(0x92)]=new Date()[_0xf3b582(0x83)](),await writeSqlLockFile(_0x4491df['lockFilePath'],_0x56dcce);const _0xdbb5a0=resolveLocalSqlFilePath(_0x4491df,_0x48e78a,_0x132882);let _0x93377d;await fileExists(_0xdbb5a0)&&(_0x93377d=await moveToTrash(_0x4491df['projectRoot'],_0x4491df[_0xf3b582(0x8c)],_0xdbb5a0),await cleanupEmptyDirectories(dirname(_0xdbb5a0),_0x4491df[_0xf3b582(0x8f)]));const _0x56cd86={'deleted':_0x48e78a,'remoteId':_0x132882[_0xf3b582(0x91)]};if(_0x93377d)_0x56cd86[_0xf3b582(0x8d)]=_0x93377d;return{'ok':!![],'data':_0x56cd86,'message':'Deleted\x20'+_0x48e78a+(_0x93377d?_0xf3b582(0x8e):'')};}};async function moveToTrash(_0x3f6bbd,_0x503ed3,_0x2aa34f){const _0x4ecaf4=a170_0x3b9ced,_0x1ef5ab=new Date()[_0x4ecaf4(0x83)]()['replace'](/[:.]/g,'-'),_0x18975a=relative(_0x3f6bbd,_0x2aa34f),_0x544d=join(_0x503ed3,_0x1ef5ab,_0x18975a);return await mkdir(dirname(_0x544d),{'recursive':!![]}),await rename(_0x2aa34f,_0x544d),_0x544d;}async function cleanupEmptyDirectories(_0x41f5f0,_0x593249){const _0x41c428=a170_0x3b9ced;let _0x2f9d19=resolve(_0x41f5f0);const _0x1d95eb=resolve(_0x593249);while(_0x2f9d19['startsWith'](''+_0x1d95eb+sep)||_0x2f9d19===_0x1d95eb){if(_0x2f9d19===_0x1d95eb)return;try{const _0x4a9382=await readdir(_0x2f9d19);if(_0x4a9382[_0x41c428(0x8b)]>0x0)return;await rmdir(_0x2f9d19);}catch{return;}_0x2f9d19=dirname(_0x2f9d19);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a171_0x30be1a=a171_0x31e1;function a171_0xb4cf(){const _0x3e0fed=['sql','detail','3557961gnZFTr','15940prfcRh','read','verbose','appCode','boolean','272qSrWzl','sqlContent','sqlName','1481064RuuaDe','7oJZmMg','description','dbId','1891302ZcXULl','269262ioPgPo','bool','sqlcode','1092724eEWsuK','Return\x20full\x20raw\x20SQL\x20query\x20object','4390529wzSMrz','10eCaSYa','8KOpYsT'];a171_0xb4cf=function(){return _0x3e0fed;};return a171_0xb4cf();}(function(_0x29319a,_0x4e5682){const _0xf86ab9=a171_0x31e1,_0x485f53=_0x29319a();while(!![]){try{const _0x123769=-parseInt(_0xf86ab9(0xb3))/0x1+parseInt(_0xf86ab9(0xb6))/0x2+-parseInt(_0xf86ab9(0xae))/0x3+-parseInt(_0xf86ab9(0xab))/0x4*(-parseInt(_0xf86ab9(0xbe))/0x5)+parseInt(_0xf86ab9(0xb2))/0x6*(parseInt(_0xf86ab9(0xaf))/0x7)+-parseInt(_0xf86ab9(0xba))/0x8*(parseInt(_0xf86ab9(0xbd))/0x9)+parseInt(_0xf86ab9(0xb9))/0xa*(parseInt(_0xf86ab9(0xb8))/0xb);if(_0x123769===_0x4e5682)break;else _0x485f53['push'](_0x485f53['shift']());}catch(_0x1ae7cc){_0x485f53['push'](_0x485f53['shift']());}}}(a171_0xb4cf,0x4def7));function a171_0x31e1(_0x4d80ae,_0x592c9d){_0x4d80ae=_0x4d80ae-0xab;const _0xb4cf0b=a171_0xb4cf();let _0x31e152=_0xb4cf0b[_0x4d80ae];return _0x31e152;}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':a171_0x30be1a(0xbb),'command':a171_0x30be1a(0xbc),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a171_0x30be1a(0xbf),'flags':[SQLCODE_FLAG,{'name':a171_0x30be1a(0xc0),'type':a171_0x30be1a(0xc2),'description':a171_0x30be1a(0xb7)}],async 'execute'(_0x12e2bd){const _0x3b7967=a171_0x30be1a,_0x26d718=await getSqlQueryInfo(_0x12e2bd[_0x3b7967(0xc1)],_0x12e2bd['str'](_0x3b7967(0xb5))),_0x98cc5=_0x12e2bd[_0x3b7967(0xb4)](_0x3b7967(0xc0));if(_0x98cc5)return{'ok':!![],'data':_0x26d718};const _0x566d9a=_0x26d718[_0x3b7967(0xb1)]?await getDbName(_0x12e2bd[_0x3b7967(0xc1)],_0x26d718[_0x3b7967(0xb1)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x26d718['sqlCode'],'sqlName':_0x26d718[_0x3b7967(0xad)],'db':_0x566d9a?_0x566d9a+'\x20('+_0x26d718[_0x3b7967(0xb1)]+')':_0x26d718[_0x3b7967(0xb1)]??'','description':_0x26d718[_0x3b7967(0xb0)]??'','sqlContent':_0x26d718[_0x3b7967(0xac)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a172_0x2515f0=a172_0x34d2;(function(_0xa96769,_0x1ebe04){const _0x549f6d=a172_0x34d2,_0x1d79de=_0xa96769();while(!![]){try{const _0x51c4b1=-parseInt(_0x549f6d(0x126))/0x1*(parseInt(_0x549f6d(0x120))/0x2)+-parseInt(_0x549f6d(0x124))/0x3*(-parseInt(_0x549f6d(0x125))/0x4)+-parseInt(_0x549f6d(0x129))/0x5*(-parseInt(_0x549f6d(0x12c))/0x6)+parseInt(_0x549f6d(0x127))/0x7*(-parseInt(_0x549f6d(0x12d))/0x8)+parseInt(_0x549f6d(0x117))/0x9+-parseInt(_0x549f6d(0x12b))/0xa*(-parseInt(_0x549f6d(0x118))/0xb)+-parseInt(_0x549f6d(0x12a))/0xc;if(_0x51c4b1===_0x1ebe04)break;else _0x1d79de['push'](_0x1d79de['shift']());}catch(_0x2dc315){_0x1d79de['push'](_0x1d79de['shift']());}}}(a172_0x3ea1,0xd70d3));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a172_0x34d2(_0x5a900a,_0x3250c2){_0x5a900a=_0x5a900a-0x114;const _0x3ea102=a172_0x3ea1();let _0x34d2b9=_0x3ea102[_0x5a900a];return _0x34d2b9;}import{parseJsonParams}from'../../utils/params.js';function a172_0x3ea1(){const _0xeccf38=['1512156oiYaoB','13wCnvDV','511yQSaoN','sqlcode','6629390SaxmXw','25153752rLUYIo','14605720CbRJAQ','6ZQmVxw','40088IevzcE','length','read','\x20row(s)\x20in\x20','Returned\x20','execSuccess','str','2222442VyNMuN','11YdWBLU','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','params','exec','SQL\x20execution\x20failed','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','isArray','appCode','10558GOlktU','execResult','string','now','3YqjjxV'];a172_0x3ea1=function(){return _0xeccf38;};return a172_0x3ea1();}export const sqlExec={'service':'sql','command':a172_0x2515f0(0x11b),'description':a172_0x2515f0(0x11d),'risk':a172_0x2515f0(0x12f),'flags':[SQLCODE_FLAG,{'name':a172_0x2515f0(0x11a),'type':a172_0x2515f0(0x122),'description':a172_0x2515f0(0x119)}],async 'execute'(_0x14a9c6){const _0x58400d=a172_0x2515f0,_0x15204d=parseJsonParams(_0x14a9c6[_0x58400d(0x116)](_0x58400d(0x11a))),_0x348f7b=Date['now'](),_0xd9e31=await executeSql(_0x14a9c6[_0x58400d(0x11f)],_0x14a9c6[_0x58400d(0x116)](_0x58400d(0x128)),_0x15204d),_0x3cb84f=Date[_0x58400d(0x123)]()-_0x348f7b,_0x1136c7=_0xd9e31?.[_0x58400d(0x121)]??_0xd9e31,_0x2dd70c=_0xd9e31?.[_0x58400d(0x115)]??!![];if(!_0x2dd70c)return{'ok':![],'data':{'error':_0xd9e31?.['execError']||_0x58400d(0x11c),'elapsed':_0x3cb84f},'message':'SQL\x20execution\x20failed'};const _0x48854c=Array[_0x58400d(0x11e)](_0x1136c7)?_0x1136c7:[];return{'ok':!![],'data':{'rows':_0x48854c,'rowCount':_0x48854c[_0x58400d(0x12e)],'elapsed':_0x3cb84f},'message':_0x58400d(0x114)+_0x48854c[_0x58400d(0x12e)]+_0x58400d(0x130)+_0x3cb84f+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x344957,_0xca5409){const _0x51aab1=a173_0x4b19,_0x431082=_0x344957();while(!![]){try{const _0x86ea6f=parseInt(_0x51aab1(0x144))/0x1+parseInt(_0x51aab1(0x146))/0x2+parseInt(_0x51aab1(0x142))/0x3*(parseInt(_0x51aab1(0x145))/0x4)+parseInt(_0x51aab1(0x143))/0x5*(-parseInt(_0x51aab1(0x141))/0x6)+parseInt(_0x51aab1(0x149))/0x7+-parseInt(_0x51aab1(0x148))/0x8+parseInt(_0x51aab1(0x147))/0x9*(parseInt(_0x51aab1(0x14a))/0xa);if(_0x86ea6f===_0xca5409)break;else _0x431082['push'](_0x431082['shift']());}catch(_0x4689a8){_0x431082['push'](_0x431082['shift']());}}}(a173_0x47b8,0x76bcc));function a173_0x4b19(_0x948dd1,_0x378041){_0x948dd1=_0x948dd1-0x141;const _0x47b842=a173_0x47b8();let _0x4b19ed=_0x47b842[_0x948dd1];return _0x4b19ed;}import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a173_0x47b8(){const _0x28b891=['16BAnkLu','994978FnLnaG','9dLfUsr','6307824iStKYC','518525OBJPYO','3177740nlCClh','333588lEwHIb','394881LLeLOG','65iFGhOo','581754JcrUYQ'];a173_0x47b8=function(){return _0x28b891;};return a173_0x47b8();}import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a174_0x255824=a174_0xc803;function a174_0xc803(_0x4de91e,_0x121149){_0x4de91e=_0x4de91e-0xb1;const _0x420c48=a174_0x420c();let _0xc803ac=_0x420c48[_0x4de91e];return _0xc803ac;}(function(_0xe124a0,_0x5ce0a6){const _0xf2f34f=a174_0xc803,_0x81c9b7=_0xe124a0();while(!![]){try{const _0x1f8166=parseInt(_0xf2f34f(0xc8))/0x1*(-parseInt(_0xf2f34f(0xd1))/0x2)+-parseInt(_0xf2f34f(0xb2))/0x3*(-parseInt(_0xf2f34f(0xd2))/0x4)+-parseInt(_0xf2f34f(0xb5))/0x5+-parseInt(_0xf2f34f(0xcd))/0x6+parseInt(_0xf2f34f(0xc6))/0x7+-parseInt(_0xf2f34f(0xd3))/0x8+parseInt(_0xf2f34f(0xc4))/0x9*(parseInt(_0xf2f34f(0xb6))/0xa);if(_0x1f8166===_0x5ce0a6)break;else _0x81c9b7['push'](_0x81c9b7['shift']());}catch(_0x560610){_0x81c9b7['push'](_0x81c9b7['shift']());}}}(a174_0x420c,0x9e1e7));import{listSqlQueries}from'../../core/api-client.js';function a174_0x420c(){const _0x3fb3e1=['page','sql','list','boolean','bool','sqlCode','num','sqlName','dbId','2045646Paovxq','map','1744988dIzxZc','sqlcode','1gmfEKr','pagesize','\x20SQL\x20queries\x20(total:\x20','totalCount','appCode','3801120hDurIz','length','Page\x20size','Found\x20','336968XXaLgn','8oorqOP','9846104SrZCzK','verbose','read','648006sxYPyh','number','Filter\x20by\x20SQL\x20name','2505500ThkVxm','110sEXHEj','str','name','List\x20custom\x20SQL\x20queries','No\x20custom\x20SQL\x20queries\x20found.'];a174_0x420c=function(){return _0x3fb3e1;};return a174_0x420c();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a174_0x255824(0xbc),'command':a174_0x255824(0xbd),'description':a174_0x255824(0xb9),'risk':a174_0x255824(0xb1),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a174_0x255824(0xb8),'type':'string','description':a174_0x255824(0xb4)},{'name':a174_0x255824(0xbb),'type':a174_0x255824(0xb3),'description':'Page\x20number','default':0x1},{'name':a174_0x255824(0xc9),'type':'number','description':a174_0x255824(0xcf)},{'name':'verbose','type':a174_0x255824(0xbe),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x1a96f5){const _0x3dd87e=a174_0x255824,_0x212676=await listSqlQueries(_0x1a96f5[_0x3dd87e(0xcc)],{'sqlCode':_0x1a96f5['str'](_0x3dd87e(0xc7))||undefined,'sqlName':_0x1a96f5[_0x3dd87e(0xb7)]('name')||undefined,'currentPage':_0x1a96f5[_0x3dd87e(0xc1)](_0x3dd87e(0xbb)),'pageSize':_0x1a96f5['num'](_0x3dd87e(0xc9),0x32)}),_0x335e93=_0x1a96f5[_0x3dd87e(0xbf)](_0x3dd87e(0xd4)),_0x4187d3=_0x212676['tableData']??[],_0x330c19=_0x212676['paging']?.[_0x3dd87e(0xcb)]??_0x4187d3[_0x3dd87e(0xce)];let _0x4fc09f;return _0x335e93?_0x4fc09f=_0x4187d3:_0x4fc09f=await Promise['all'](_0x4187d3[_0x3dd87e(0xc5)](async _0xba6259=>{const _0x27e3d3=_0x3dd87e;let _0x3175bb;try{_0x3175bb=_0xba6259[_0x27e3d3(0xc3)]?await getDbName(_0x1a96f5[_0x27e3d3(0xcc)],_0xba6259[_0x27e3d3(0xc3)]):undefined;}catch{}return{'sqlCode':_0xba6259[_0x27e3d3(0xc0)],'sqlName':_0xba6259[_0x27e3d3(0xc2)],'description':_0xba6259['description']??'','db':_0x3175bb?_0x3175bb+'\x20('+_0xba6259['dbId']+')':_0xba6259[_0x27e3d3(0xc3)]??''};})),{'ok':!![],'data':_0x4fc09f,'message':_0x4187d3['length']===0x0?_0x3dd87e(0xba):_0x3dd87e(0xd0)+_0x4187d3['length']+_0x3dd87e(0xca)+_0x330c19+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a175_0x4b1b6a=a175_0x2fad;(function(_0x2dd301,_0x441267){const _0x5c68a1=a175_0x2fad,_0x7d2333=_0x2dd301();while(!![]){try{const _0x3726dc=parseInt(_0x5c68a1(0x11a))/0x1+-parseInt(_0x5c68a1(0x116))/0x2+parseInt(_0x5c68a1(0x13b))/0x3+-parseInt(_0x5c68a1(0x133))/0x4*(-parseInt(_0x5c68a1(0x109))/0x5)+parseInt(_0x5c68a1(0x131))/0x6+-parseInt(_0x5c68a1(0x13e))/0x7+-parseInt(_0x5c68a1(0x125))/0x8;if(_0x3726dc===_0x441267)break;else _0x7d2333['push'](_0x7d2333['shift']());}catch(_0x51661c){_0x7d2333['push'](_0x7d2333['shift']());}}}(a175_0x13a2,0xa1871));function a175_0x13a2(){const _0x27982e=['sqlRootDir','57249KsDKGM','length','lastSync','2469551mgkNUq','would_pull','utf8','sqls','\x20written,\x20','sqlCode','nonInteractive','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','conflict','555FcmtbL','name','local\x20differs\x20from\x20remote','push','test','trimStart','Force\x20pull\x20cancelled.','description','pull','replace','unchanged','sqlName','lockFilePath','425566ZmoBAW','force','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','Force\x20overwrite\x20local\x20unsynced\x20changes','529717JcvSUh','Would\x20pull\x20','appCode','boolean','message','path','sqlRoot','\x20skipped,\x20','catch','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','totalCount','10003568rSkQGN','No\x20remote\x20SQL\x20queries\x20matched.','str','write','string','split','apps','mybatisXml','\x20failed','paging','dbId','\x20SQL\x20file(s)\x20into\x20','6632646MAkJCO','toISOString','29672nRMzRE','bool','sqlContent','skipped','Pull\x20complete:\x20','filter','sql'];a175_0x13a2=function(){return _0x27982e;};return a175_0x13a2();}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';function a175_0x2fad(_0x3842b9,_0x2980ee){_0x3842b9=_0x3842b9-0x105;const _0x13a22d=a175_0x13a2();let _0x2fadf3=_0x13a22d[_0x3842b9];return _0x2fadf3;}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(_0x24ca78,_0x47cade){const _0x415f30=a175_0x2fad,_0x460e41=[];let _0x5d4b07=0x1;while(!![]){const _0x1e126a=await listSqlQueries(_0x24ca78,{'currentPage':_0x5d4b07,'pageSize':PAGE_SIZE,'sqlCode':_0x47cade[_0x415f30(0x105)],'sqlName':_0x47cade[_0x415f30(0x114)]}),_0x613d47=_0x1e126a['tableData']??[];_0x460e41[_0x415f30(0x10c)](..._0x613d47);if(_0x613d47[_0x415f30(0x13c)]===0x0)break;const _0x1a9f33=_0x1e126a[_0x415f30(0x12e)]?.[_0x415f30(0x124)];if(_0x1a9f33!=null?_0x460e41[_0x415f30(0x13c)]>=_0x1a9f33:_0x613d47['length']<PAGE_SIZE)break;_0x5d4b07++;}return _0x460e41;}async function ensureSqlContent(_0x38e19f){const _0x20f58b=a175_0x2fad;if(_0x38e19f[_0x20f58b(0x135)]!=null&&String(_0x38e19f['sqlContent'])['length']>0x0)return _0x38e19f;return getSqlQueryDetail(_0x38e19f[_0x20f58b(0x105)]);}export const sqlPull={'service':a175_0x4b1b6a(0x139),'command':a175_0x4b1b6a(0x111),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a175_0x4b1b6a(0x128),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a175_0x4b1b6a(0x10a),'type':a175_0x4b1b6a(0x129),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a175_0x4b1b6a(0x117),'type':a175_0x4b1b6a(0x11d),'description':a175_0x4b1b6a(0x119)}],async 'dryRun'(_0x384c92){const _0x3e7354=a175_0x4b1b6a,_0x2d9f8f=loadSqlProjectConfig(_0x384c92['appCode']),_0x50cab7=await readSqlLockFile(_0x2d9f8f['lockFilePath']),{appLock:_0x44dc6d}=ensureSqlLockScope(_0x50cab7??createEmptySqlLock(),_0x2d9f8f[_0x3e7354(0x11c)],_0x2d9f8f['sqlRoot'],_0x3e7354(0x111)),_0x268342=await fetchAllSqlQueries(_0x384c92[_0x3e7354(0x11c)],{'sqlCode':_0x384c92['str']('sqlcode')||undefined,'sqlName':_0x384c92['str'](_0x3e7354(0x10a))||undefined}),_0x27f8e3=[];for(const _0x6c6d20 of _0x268342){const _0x2d10da=await ensureSqlContent(_0x6c6d20),_0x5ac323=ensureRemoteSqlContent(_0x2d10da),_0x4bfca7=detectModeFromSql(_0x2d10da),_0x589f0b=_0x2d10da[_0x3e7354(0x12f)]?await getDbName(_0x384c92[_0x3e7354(0x11c)],Number(_0x2d10da[_0x3e7354(0x12f)]))['catch'](()=>undefined):undefined,_0x12592b=buildLocalSqlFileContent({'sqlCode':_0x2d10da[_0x3e7354(0x105)],'sqlName':_0x2d10da[_0x3e7354(0x114)],'dbId':_0x2d10da['dbId']},_0x5ac323,{'dbName':_0x589f0b,'mode':_0x4bfca7,'syncedAt':new Date()[_0x3e7354(0x132)](),'description':_0x2d10da[_0x3e7354(0x110)]}),_0x12baa3=buildSqlLockEntry(_0x2d10da,_0x5ac323,'',{'dbName':_0x589f0b}),_0xa8e450=resolveLocalSqlFilePath(_0x2d9f8f,_0x2d10da[_0x3e7354(0x105)],_0x12baa3);let _0x3c0483=_0x3e7354(0x13f),_0xc8c21c;if(await fileExists(_0xa8e450)){const _0x2dc655=await readFile(_0xa8e450,_0x3e7354(0x140));isEquivalentPulledSqlFile(_0x2dc655,_0x12592b,_0x4bfca7)?(_0x3c0483=_0x3e7354(0x136),_0xc8c21c='unchanged'):(_0x3c0483=_0x3e7354(0x108),_0xc8c21c=_0x3e7354(0x107));}_0x27f8e3['push']({'sqlCode':_0x2d10da[_0x3e7354(0x105)],'sqlName':_0x2d10da[_0x3e7354(0x114)],'filePath':_0xa8e450,'status':_0x3c0483,'reason':_0xc8c21c});}return{'method':'POST','url':_0x3e7354(0x118),'body':{'appCode':_0x384c92[_0x3e7354(0x11c)],'sqlCode':_0x384c92[_0x3e7354(0x127)]('sqlcode')||null,'sqlName':_0x384c92['str']('name')||null,'files':_0x27f8e3},'description':_0x3e7354(0x11b)+_0x27f8e3['length']+_0x3e7354(0x130)+_0x2d9f8f[_0x3e7354(0x13a)]};},async 'execute'(_0x250062){const _0x39e264=a175_0x4b1b6a,_0x2f42e7=loadSqlProjectConfig(_0x250062[_0x39e264(0x11c)]),_0x4e9a9f=await readSqlLockFile(_0x2f42e7[_0x39e264(0x115)]),{lockData:_0x44fb2b,appLock:_0x52ada0}=ensureSqlLockScope(_0x4e9a9f??createEmptySqlLock(),_0x2f42e7[_0x39e264(0x11c)],_0x2f42e7[_0x39e264(0x120)],'pull'),_0x469870=_0x250062[_0x39e264(0x134)]('force'),_0x230d85=await fetchAllSqlQueries(_0x250062[_0x39e264(0x11c)],{'sqlCode':_0x250062[_0x39e264(0x127)]('sqlcode')||undefined,'sqlName':_0x250062['str'](_0x39e264(0x10a))||undefined});if(_0x230d85[_0x39e264(0x13c)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x39e264(0x126)};const _0x355fd0=[],_0x460050=[];for(const _0x478eea of _0x230d85){try{_0x355fd0[_0x39e264(0x10c)](await ensureSqlContent(_0x478eea));}catch(_0x4690da){_0x460050[_0x39e264(0x10c)]({'sqlCode':_0x478eea['sqlCode'],'error':_0x4690da instanceof Error?_0x4690da[_0x39e264(0x11e)]:String(_0x4690da)});}}if(_0x469870&&!_0x250062[_0x39e264(0x106)]){let _0x4d81b7=![];for(const _0x5e7e43 of _0x355fd0){const _0x1f007a=detectModeFromSql(_0x5e7e43),_0x253285=_0x5e7e43['dbId']?await getDbName(_0x250062['appCode'],Number(_0x5e7e43['dbId']))[_0x39e264(0x122)](()=>undefined):undefined,_0xedb65a=buildLocalSqlFileContent({'sqlCode':_0x5e7e43['sqlCode'],'sqlName':_0x5e7e43[_0x39e264(0x114)],'dbId':_0x5e7e43['dbId']},ensureRemoteSqlContent(_0x5e7e43),{'dbName':_0x253285,'mode':_0x1f007a,'syncedAt':new Date()[_0x39e264(0x132)](),'description':_0x5e7e43[_0x39e264(0x110)]}),_0x6d90da=resolveLocalSqlFilePath(_0x2f42e7,_0x5e7e43['sqlCode'],buildSqlLockEntry(_0x5e7e43,ensureRemoteSqlContent(_0x5e7e43),'',{'dbName':_0x253285}));if(await fileExists(_0x6d90da)){const _0x151171=await readFile(_0x6d90da,'utf8');if(!isEquivalentPulledSqlFile(_0x151171,_0xedb65a,_0x1f007a)){_0x4d81b7=!![];break;}}}if(_0x4d81b7){const _0x126ab6=await confirmForceOverwrite(_0x39e264(0x123));if(!_0x126ab6)throw CliErrors['cancelled'](_0x39e264(0x10f));}}const _0x14787b=cloneSqlLockData(_0x44fb2b),_0x2e63be=_0x14787b[_0x39e264(0x12b)][_0x2f42e7[_0x39e264(0x11c)]],_0x143783=[],_0x34d45f=[];for(const _0x55b300 of _0x355fd0){const _0xb51e41=_0x2e63be[_0x39e264(0x141)][_0x55b300[_0x39e264(0x105)]],_0x3e5479=ensureRemoteSqlContent(_0x55b300),_0x16dfa7=detectModeFromSql(_0x55b300),_0x55cba9=_0x55b300[_0x39e264(0x12f)]?await getDbName(_0x250062['appCode'],Number(_0x55b300['dbId']))[_0x39e264(0x122)](()=>undefined):undefined,_0x5b61fa=buildLocalSqlFileContent({'sqlCode':_0x55b300['sqlCode'],'sqlName':_0x55b300[_0x39e264(0x114)],'dbId':_0x55b300[_0x39e264(0x12f)]},_0x3e5479,{'dbName':_0x55cba9,'mode':_0x16dfa7,'syncedAt':new Date()[_0x39e264(0x132)](),'description':_0x55b300[_0x39e264(0x110)]}),_0x4ee236=buildSqlLockEntry(_0x55b300,_0x3e5479,computeSqlContentHash(_0x5b61fa),{'dbName':_0x55cba9}),_0x20a82d=_0x4ee236[_0x39e264(0x11f)],_0x3ed7b1=join(_0x2f42e7[_0x39e264(0x13a)],_0x20a82d);try{if(await fileExists(_0x3ed7b1)){const _0x273525=await readFile(_0x3ed7b1,_0x39e264(0x140));if(isEquivalentPulledSqlFile(_0x273525,_0x5b61fa,_0x16dfa7)){_0x34d45f[_0x39e264(0x10c)]({'sqlCode':_0x55b300['sqlCode'],'reason':_0x39e264(0x113)}),_0x2e63be['sqls'][_0x55b300[_0x39e264(0x105)]]={..._0x4ee236,'hash':computeSqlContentHash(_0x273525),'path':_0x20a82d};continue;}if(!_0x469870){_0x34d45f[_0x39e264(0x10c)]({'sqlCode':_0x55b300[_0x39e264(0x105)],'reason':_0x39e264(0x10b)});continue;}}const _0x1598d9=_0xb51e41?.[_0x39e264(0x11f)]?join(_0x2f42e7[_0x39e264(0x13a)],_0xb51e41[_0x39e264(0x11f)]):undefined;_0x1598d9&&_0x1598d9!==_0x3ed7b1&&await fileExists(_0x1598d9)&&await rm(_0x1598d9,{'force':!![]}),await ensureParentDirectory(_0x3ed7b1),await writeFile(_0x3ed7b1,_0x5b61fa,_0x39e264(0x140)),_0x2e63be['sqls'][_0x55b300[_0x39e264(0x105)]]={..._0x4ee236,'path':_0x20a82d},_0x143783[_0x39e264(0x10c)]({'sqlCode':_0x55b300[_0x39e264(0x105)],'filePath':_0x3ed7b1});}catch(_0x28ec1a){_0x460050['push']({'sqlCode':_0x55b300[_0x39e264(0x105)],'error':_0x28ec1a instanceof Error?_0x28ec1a[_0x39e264(0x11e)]:String(_0x28ec1a)});}}return _0x2e63be[_0x39e264(0x13d)]=new Date()[_0x39e264(0x132)](),await writeSqlLockFile(_0x2f42e7[_0x39e264(0x115)],_0x14787b),{'ok':_0x460050[_0x39e264(0x13c)]===0x0,'data':{'pulled':_0x143783,'skipped':_0x34d45f,'failed':_0x460050},'message':_0x39e264(0x137)+_0x143783[_0x39e264(0x13c)]+_0x39e264(0x142)+_0x34d45f[_0x39e264(0x13c)]+_0x39e264(0x121)+_0x460050[_0x39e264(0x13c)]+_0x39e264(0x12d)};}};function detectModeFromSql(_0x30e265){const _0x2451ea=a175_0x4b1b6a,_0x19d82d=ensureRemoteSqlContent(_0x30e265),_0x1db0c4=stripLocalSqlMetadata(_0x19d82d,_0x2451ea(0x12c))[_0x2451ea(0x10e)]();if(/^<(select|insert|update|delete)\b/i[_0x2451ea(0x10d)](_0x1db0c4))return _0x2451ea(0x12c);return _0x2451ea(0x139);}function isEquivalentPulledSqlFile(_0xc9a2b7,_0x26800a,_0x590e45){return normalizePullComparableContent(_0xc9a2b7,_0x590e45)===normalizePullComparableContent(_0x26800a,_0x590e45);}function normalizePullComparableContent(_0x50531e,_0x17babd){const _0x305dc7=a175_0x4b1b6a,_0x4fb192=_0x50531e[_0x305dc7(0x112)](/\r\n/g,'\x0a')[_0x305dc7(0x12a)]('\x0a'),_0x260cee=_0x4fb192[_0x305dc7(0x138)](_0x525b60=>!isSyncedAtMetadataLine(_0x525b60,_0x17babd));return _0x260cee['join']('\x0a');}function isSyncedAtMetadataLine(_0x5be5b3,_0x5b636d){const _0x36754f=a175_0x4b1b6a;if(_0x5b636d==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x36754f(0x10d)](_0x5be5b3);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x36754f(0x10d)](_0x5be5b3);}
|
|
1
|
+
const a175_0x46eef8=a175_0x26d4;(function(_0x5cd3aa,_0x4ebd3f){const _0x3972c1=a175_0x26d4,_0x5ae150=_0x5cd3aa();while(!![]){try{const _0x3f1b99=parseInt(_0x3972c1(0x1ff))/0x1*(parseInt(_0x3972c1(0x1f7))/0x2)+parseInt(_0x3972c1(0x202))/0x3+-parseInt(_0x3972c1(0x223))/0x4*(-parseInt(_0x3972c1(0x1f2))/0x5)+parseInt(_0x3972c1(0x22e))/0x6+-parseInt(_0x3972c1(0x22c))/0x7*(-parseInt(_0x3972c1(0x1fe))/0x8)+parseInt(_0x3972c1(0x227))/0x9+-parseInt(_0x3972c1(0x229))/0xa;if(_0x3f1b99===_0x4ebd3f)break;else _0x5ae150['push'](_0x5ae150['shift']());}catch(_0x3fbd44){_0x5ae150['push'](_0x5ae150['shift']());}}}(a175_0x1003,0x73057));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(_0x10cd9a,_0x29afdd){const _0x9d9b6=a175_0x26d4,_0x193084=[];let _0x7e4b7e=0x1;while(!![]){const _0x49ba29=await listSqlQueries(_0x10cd9a,{'currentPage':_0x7e4b7e,'pageSize':PAGE_SIZE,'sqlCode':_0x29afdd[_0x9d9b6(0x211)],'sqlName':_0x29afdd[_0x9d9b6(0x1f3)]}),_0x5dd0c3=_0x49ba29[_0x9d9b6(0x208)]??[];_0x193084['push'](..._0x5dd0c3);if(_0x5dd0c3[_0x9d9b6(0x1fb)]===0x0)break;const _0x58f967=_0x49ba29[_0x9d9b6(0x224)]?.[_0x9d9b6(0x20d)];if(_0x58f967!=null?_0x193084[_0x9d9b6(0x1fb)]>=_0x58f967:_0x5dd0c3[_0x9d9b6(0x1fb)]<PAGE_SIZE)break;_0x7e4b7e++;}return _0x193084;}async function ensureSqlContent(_0x5ddd91){const _0x2415aa=a175_0x26d4;if(_0x5ddd91[_0x2415aa(0x218)]!=null&&String(_0x5ddd91[_0x2415aa(0x218)])['length']>0x0)return _0x5ddd91;return getSqlQueryDetail(_0x5ddd91['sqlCode']);}export const sqlPull={'service':a175_0x46eef8(0x1f5),'command':'pull','description':a175_0x46eef8(0x22f),'risk':a175_0x46eef8(0x206),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a175_0x46eef8(0x217),'type':a175_0x46eef8(0x222),'description':a175_0x46eef8(0x20b)},{'name':a175_0x46eef8(0x205),'type':a175_0x46eef8(0x21d),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x52a697){const _0xd70f81=a175_0x46eef8,_0x11dc18=loadSqlProjectConfig(_0x52a697[_0xd70f81(0x221)]),_0xeb9830=await readSqlLockFile(_0x11dc18[_0xd70f81(0x200)]),{appLock:_0x4777e0}=ensureSqlLockScope(_0xeb9830??createEmptySqlLock(),_0x11dc18['appCode'],_0x11dc18[_0xd70f81(0x204)],'pull'),_0x13c016=await fetchAllSqlQueries(_0x52a697[_0xd70f81(0x221)],{'sqlCode':_0x52a697[_0xd70f81(0x21e)]('sqlcode')||undefined,'sqlName':_0x52a697[_0xd70f81(0x21e)]('name')||undefined}),_0x27c97e=[];for(const _0x5d8308 of _0x13c016){const _0xba5457=await ensureSqlContent(_0x5d8308),_0x1e41e7=ensureRemoteSqlContent(_0xba5457),_0x3b26ad=detectModeFromSql(_0xba5457),_0x135b62=_0xba5457[_0xd70f81(0x1f8)]?await getDbName(_0x52a697[_0xd70f81(0x221)],Number(_0xba5457[_0xd70f81(0x1f8)]))[_0xd70f81(0x21c)](()=>undefined):undefined,_0x3a5ef8=buildLocalSqlFileContent({'sqlCode':_0xba5457[_0xd70f81(0x211)],'sqlName':_0xba5457[_0xd70f81(0x1f3)],'dbId':_0xba5457['dbId']},_0x1e41e7,{'dbName':_0x135b62,'mode':_0x3b26ad,'syncedAt':new Date()['toISOString'](),'description':_0xba5457['description']}),_0x468ca7=buildSqlLockEntry(_0xba5457,_0x1e41e7,'',{'dbName':_0x135b62}),_0x123de2=resolveLocalSqlFilePath(_0x11dc18,_0xba5457[_0xd70f81(0x211)],_0x468ca7);let _0x573870='would_pull',_0x57446b;if(await fileExists(_0x123de2)){const _0x3435e7=await readFile(_0x123de2,_0xd70f81(0x22b));isEquivalentPulledSqlFile(_0x3435e7,_0x3a5ef8,_0x3b26ad)?(_0x573870=_0xd70f81(0x230),_0x57446b=_0xd70f81(0x1fd)):(_0x573870=_0xd70f81(0x212),_0x57446b=_0xd70f81(0x210));}_0x27c97e[_0xd70f81(0x21b)]({'sqlCode':_0xba5457['sqlCode'],'sqlName':_0xba5457[_0xd70f81(0x1f3)],'filePath':_0x123de2,'status':_0x573870,'reason':_0x57446b});}return{'method':'POST','url':_0xd70f81(0x21f),'body':{'appCode':_0x52a697[_0xd70f81(0x221)],'sqlCode':_0x52a697[_0xd70f81(0x21e)](_0xd70f81(0x20a))||null,'sqlName':_0x52a697[_0xd70f81(0x21e)](_0xd70f81(0x217))||null,'files':_0x27c97e},'description':_0xd70f81(0x1f9)+_0x27c97e[_0xd70f81(0x1fb)]+'\x20SQL\x20file(s)\x20into\x20'+_0x11dc18[_0xd70f81(0x220)]};},async 'execute'(_0x4d2efa){const _0xe3e0e8=a175_0x46eef8,_0x4d08d0=loadSqlProjectConfig(_0x4d2efa[_0xe3e0e8(0x221)]),_0x51afe8=await readSqlLockFile(_0x4d08d0[_0xe3e0e8(0x200)]),{lockData:_0x58f94a,appLock:_0x4a4d5e}=ensureSqlLockScope(_0x51afe8??createEmptySqlLock(),_0x4d08d0[_0xe3e0e8(0x221)],_0x4d08d0[_0xe3e0e8(0x204)],'pull'),_0x19d822=_0x4d2efa[_0xe3e0e8(0x219)](_0xe3e0e8(0x205)),_0x3795bc=await fetchAllSqlQueries(_0x4d2efa[_0xe3e0e8(0x221)],{'sqlCode':_0x4d2efa[_0xe3e0e8(0x21e)](_0xe3e0e8(0x20a))||undefined,'sqlName':_0x4d2efa[_0xe3e0e8(0x21e)]('name')||undefined});if(_0x3795bc[_0xe3e0e8(0x1fb)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0xe3e0e8(0x226)};const _0x254f49=[],_0x34ae4a=[];for(const _0x59d323 of _0x3795bc){try{_0x254f49['push'](await ensureSqlContent(_0x59d323));}catch(_0x18a886){_0x34ae4a[_0xe3e0e8(0x21b)]({'sqlCode':_0x59d323['sqlCode'],'error':_0x18a886 instanceof Error?_0x18a886[_0xe3e0e8(0x213)]:String(_0x18a886)});}}if(_0x19d822&&!_0x4d2efa[_0xe3e0e8(0x20e)]){let _0x233abf=![];for(const _0x25e9b3 of _0x254f49){const _0x1c853e=detectModeFromSql(_0x25e9b3),_0x23ccc8=_0x25e9b3[_0xe3e0e8(0x1f8)]?await getDbName(_0x4d2efa['appCode'],Number(_0x25e9b3[_0xe3e0e8(0x1f8)]))[_0xe3e0e8(0x21c)](()=>undefined):undefined,_0x4084d5=buildLocalSqlFileContent({'sqlCode':_0x25e9b3[_0xe3e0e8(0x211)],'sqlName':_0x25e9b3[_0xe3e0e8(0x1f3)],'dbId':_0x25e9b3[_0xe3e0e8(0x1f8)]},ensureRemoteSqlContent(_0x25e9b3),{'dbName':_0x23ccc8,'mode':_0x1c853e,'syncedAt':new Date()['toISOString'](),'description':_0x25e9b3['description']}),_0x56c7c5=resolveLocalSqlFilePath(_0x4d08d0,_0x25e9b3['sqlCode'],buildSqlLockEntry(_0x25e9b3,ensureRemoteSqlContent(_0x25e9b3),'',{'dbName':_0x23ccc8}));if(await fileExists(_0x56c7c5)){const _0x2969c9=await readFile(_0x56c7c5,_0xe3e0e8(0x22b));if(!isEquivalentPulledSqlFile(_0x2969c9,_0x4084d5,_0x1c853e)){_0x233abf=!![];break;}}}if(_0x233abf){const _0x72ed3e=await confirmForceOverwrite(_0xe3e0e8(0x20f));if(!_0x72ed3e)throw CliErrors['cancelled'](_0xe3e0e8(0x214));}}const _0x49e663=cloneSqlLockData(_0x58f94a),_0x533b36=_0x49e663[_0xe3e0e8(0x22a)][_0x4d08d0[_0xe3e0e8(0x221)]],_0x871cb1=[],_0x4f506f=[];for(const _0x2d467a of _0x254f49){const _0xc8f1e4=_0x533b36[_0xe3e0e8(0x1fc)][_0x2d467a[_0xe3e0e8(0x211)]],_0x35a0e5=ensureRemoteSqlContent(_0x2d467a),_0x4b0970=detectModeFromSql(_0x2d467a),_0x50ffb8=_0x2d467a[_0xe3e0e8(0x1f8)]?await getDbName(_0x4d2efa[_0xe3e0e8(0x221)],Number(_0x2d467a[_0xe3e0e8(0x1f8)]))[_0xe3e0e8(0x21c)](()=>undefined):undefined,_0x5b95ac=buildLocalSqlFileContent({'sqlCode':_0x2d467a[_0xe3e0e8(0x211)],'sqlName':_0x2d467a['sqlName'],'dbId':_0x2d467a[_0xe3e0e8(0x1f8)]},_0x35a0e5,{'dbName':_0x50ffb8,'mode':_0x4b0970,'syncedAt':new Date()[_0xe3e0e8(0x1f4)](),'description':_0x2d467a[_0xe3e0e8(0x22d)]}),_0x557e12=buildSqlLockEntry(_0x2d467a,_0x35a0e5,computeSqlContentHash(_0x5b95ac),{'dbName':_0x50ffb8}),_0x477a2f=_0x557e12[_0xe3e0e8(0x21a)],_0x1d633e=join(_0x4d08d0[_0xe3e0e8(0x220)],_0x477a2f);try{if(await fileExists(_0x1d633e)){const _0x28827a=await readFile(_0x1d633e,_0xe3e0e8(0x22b));if(isEquivalentPulledSqlFile(_0x28827a,_0x5b95ac,_0x4b0970)){_0x4f506f[_0xe3e0e8(0x21b)]({'sqlCode':_0x2d467a['sqlCode'],'reason':'unchanged'}),_0x533b36[_0xe3e0e8(0x1fc)][_0x2d467a['sqlCode']]={..._0x557e12,'hash':computeSqlContentHash(_0x28827a),'path':_0x477a2f};continue;}if(!_0x19d822){_0x4f506f[_0xe3e0e8(0x21b)]({'sqlCode':_0x2d467a['sqlCode'],'reason':_0xe3e0e8(0x228)});continue;}}const _0x10741f=_0xc8f1e4?.[_0xe3e0e8(0x21a)]?join(_0x4d08d0[_0xe3e0e8(0x220)],_0xc8f1e4[_0xe3e0e8(0x21a)]):undefined;_0x10741f&&_0x10741f!==_0x1d633e&&await fileExists(_0x10741f)&&await rm(_0x10741f,{'force':!![]}),await ensureParentDirectory(_0x1d633e),await writeFile(_0x1d633e,_0x5b95ac,'utf8'),_0x533b36[_0xe3e0e8(0x1fc)][_0x2d467a[_0xe3e0e8(0x211)]]={..._0x557e12,'path':_0x477a2f},_0x871cb1[_0xe3e0e8(0x21b)]({'sqlCode':_0x2d467a[_0xe3e0e8(0x211)],'filePath':_0x1d633e});}catch(_0x264350){_0x34ae4a['push']({'sqlCode':_0x2d467a[_0xe3e0e8(0x211)],'error':_0x264350 instanceof Error?_0x264350[_0xe3e0e8(0x213)]:String(_0x264350)});}}return _0x533b36[_0xe3e0e8(0x1f6)]=new Date()['toISOString'](),await writeSqlLockFile(_0x4d08d0['lockFilePath'],_0x49e663),{'ok':_0x34ae4a[_0xe3e0e8(0x1fb)]===0x0,'data':{'pulled':_0x871cb1,'skipped':_0x4f506f,'failed':_0x34ae4a},'message':_0xe3e0e8(0x207)+_0x871cb1[_0xe3e0e8(0x1fb)]+'\x20written,\x20'+_0x4f506f[_0xe3e0e8(0x1fb)]+_0xe3e0e8(0x203)+_0x34ae4a[_0xe3e0e8(0x1fb)]+_0xe3e0e8(0x225)};}};function a175_0x1003(){const _0x34f150=['\x20skipped,\x20','sqlRoot','force','write','Pull\x20complete:\x20','tableData','replace','sqlcode','Filter\x20by\x20SQL\x20display\x20name','mybatisXml','totalCount','nonInteractive','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sqlCode','conflict','message','Force\x20pull\x20cancelled.','trimStart','split','name','sqlContent','bool','path','push','catch','boolean','str','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','sqlRootDir','appCode','string','28leFZUW','paging','\x20failed','No\x20remote\x20SQL\x20queries\x20matched.','791127wyLXUs','local\x20differs\x20from\x20remote','23513940bljjXB','apps','utf8','7qntdlA','description','5501316OmBqca','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','skipped','425775cedYri','sqlName','toISOString','sql','lastSync','424898bGTuga','dbId','Would\x20pull\x20','test','length','sqls','unchanged','5632072saHHOy','1HiQkuB','lockFilePath','join','915567zmXHPG'];a175_0x1003=function(){return _0x34f150;};return a175_0x1003();}function detectModeFromSql(_0x34dc18){const _0x35fc22=a175_0x46eef8,_0x5b941b=ensureRemoteSqlContent(_0x34dc18),_0x352373=stripLocalSqlMetadata(_0x5b941b,_0x35fc22(0x20c))[_0x35fc22(0x215)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x352373))return _0x35fc22(0x20c);return _0x35fc22(0x1f5);}function isEquivalentPulledSqlFile(_0x1e5186,_0x26f45f,_0x4f3c6b){return normalizePullComparableContent(_0x1e5186,_0x4f3c6b)===normalizePullComparableContent(_0x26f45f,_0x4f3c6b);}function a175_0x26d4(_0x1fbf0e,_0x3a2dd8){_0x1fbf0e=_0x1fbf0e-0x1f2;const _0x10035b=a175_0x1003();let _0x26d45a=_0x10035b[_0x1fbf0e];return _0x26d45a;}function normalizePullComparableContent(_0x35bcc,_0x4aeace){const _0x2c86cd=a175_0x46eef8,_0xcf6b78=_0x35bcc[_0x2c86cd(0x209)](/\r\n/g,'\x0a')[_0x2c86cd(0x216)]('\x0a'),_0x2375d8=_0xcf6b78['filter'](_0x1544ac=>!isSyncedAtMetadataLine(_0x1544ac,_0x4aeace));return _0x2375d8[_0x2c86cd(0x201)]('\x0a');}function isSyncedAtMetadataLine(_0xd5664f,_0x13b6c2){const _0x2ad93e=a175_0x46eef8;if(_0x13b6c2===_0x2ad93e(0x20c))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0xd5664f);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x2ad93e(0x1fa)](_0xd5664f);}
|