@lovrabet/rabetbase-cli 2.3.14-beta.1 → 2.3.14
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
|
-
|
|
1
|
+
function a161_0x4fef(){const _0x48f81b=['join','1431544juoxte','25740GHkmjC','validation','pagesize','num','read','6imDqOx','number','List\x20user\x20groups\x20(roles)\x20for\x20the\x20current\x20app','1243875WYzAdW','Found\x20','type','filter','map','role','Filter\x20by\x20role\x20type','includes','--pagesize\x20must\x20be\x20between\x201\x20and\x20100.','Page\x20size\x20(1-100)','USER','str','trim','\x20role(s)','1675888tuPFsE','toUpperCase','6Tpnmcv','111303SjQUED','1175419Bvolrc','1170HHCgkU','length','string','roleType','214784rrzHTe','page','Page\x20index\x20(1-based)'];a161_0x4fef=function(){return _0x48f81b;};return a161_0x4fef();}const a161_0x2162e9=a161_0x15af;(function(_0x3c4189,_0x179588){const _0x399d1d=a161_0x15af,_0x5ecc62=_0x3c4189();while(!![]){try{const _0xb49eea=-parseInt(_0x399d1d(0x19f))/0x1+parseInt(_0x399d1d(0x1a9))/0x2*(-parseInt(_0x399d1d(0x199))/0x3)+parseInt(_0x399d1d(0x196))/0x4+-parseInt(_0x399d1d(0x188))/0x5+-parseInt(_0x399d1d(0x198))/0x6*(-parseInt(_0x399d1d(0x19a))/0x7)+parseInt(_0x399d1d(0x1a3))/0x8+parseInt(_0x399d1d(0x1a4))/0x9*(parseInt(_0x399d1d(0x19b))/0xa);if(_0xb49eea===_0x179588)break;else _0x5ecc62['push'](_0x5ecc62['shift']());}catch(_0x2342c3){_0x5ecc62['push'](_0x5ecc62['shift']());}}}(a161_0x4fef,0x80516));import{listAppRoles}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a161_0x15af(_0x155e3c,_0x3821b1){_0x155e3c=_0x155e3c-0x186;const _0x4fefdc=a161_0x4fef();let _0x15af1b=_0x4fefdc[_0x155e3c];return _0x15af1b;}import{projectRole}from'../../commands/role/shared.js';const ROLE_TYPES=['ADMIN','DEV',a161_0x2162e9(0x192),'CUSTOM'];export const roleList={'service':a161_0x2162e9(0x18d),'command':'list','description':a161_0x2162e9(0x187),'risk':a161_0x2162e9(0x1a8),'flags':[APPCODE_FLAG_OPTIONAL,{'name':a161_0x2162e9(0x18a),'type':a161_0x2162e9(0x19d),'required':![],'description':a161_0x2162e9(0x18e),'enum':ROLE_TYPES},{'name':a161_0x2162e9(0x1a0),'type':a161_0x2162e9(0x186),'description':a161_0x2162e9(0x1a1),'default':0x1},{'name':a161_0x2162e9(0x1a6),'type':a161_0x2162e9(0x186),'description':a161_0x2162e9(0x191),'default':0x64}],async 'validate'(_0x3684b9){const _0x573236=a161_0x2162e9,_0x491c3d=_0x3684b9['str'](_0x573236(0x18a))[_0x573236(0x194)]();if(_0x491c3d&&!ROLE_TYPES[_0x573236(0x18f)](_0x491c3d['toUpperCase']()))throw CliErrors[_0x573236(0x1a5)]('Invalid\x20--type\x20\x22'+_0x491c3d+'\x22.','Use\x20one\x20of:\x20'+ROLE_TYPES[_0x573236(0x1a2)](',\x20')+'.');const _0x3e42bd=_0x3684b9[_0x573236(0x1a7)](_0x573236(0x1a0),0x1),_0x5b2d32=_0x3684b9[_0x573236(0x1a7)]('pagesize',0x64);if(_0x3e42bd<0x1)throw CliErrors[_0x573236(0x1a5)]('--page\x20must\x20be\x20greater\x20than\x20or\x20equal\x20to\x201.');if(_0x5b2d32<0x1||_0x5b2d32>0x64)throw CliErrors[_0x573236(0x1a5)](_0x573236(0x190));},async 'execute'(_0x4d2aaf){const _0x520c8d=a161_0x2162e9,_0x37bb94=_0x4d2aaf[_0x520c8d(0x1a7)](_0x520c8d(0x1a0),0x1)||0x1,_0x5c4b07=_0x4d2aaf[_0x520c8d(0x1a7)](_0x520c8d(0x1a6),0x64)||0x64,_0x22f8e7=_0x4d2aaf[_0x520c8d(0x193)](_0x520c8d(0x18a))['trim']()[_0x520c8d(0x197)](),{items:_0x33e38f,paging:_0x51a7d6}=await listAppRoles(_0x4d2aaf['appCode'],{'currentPage':_0x37bb94,'pageSize':_0x5c4b07}),_0x275353=_0x22f8e7?_0x33e38f[_0x520c8d(0x18b)](_0x379f34=>_0x379f34[_0x520c8d(0x19e)]===_0x22f8e7):_0x33e38f,_0x5c7c74=_0x275353[_0x520c8d(0x18c)](projectRole);return{'ok':!![],'data':{'roles':_0x5c7c74,'paging':_0x51a7d6},'message':_0x520c8d(0x189)+_0x5c7c74[_0x520c8d(0x19c)]+_0x520c8d(0x195)};}};
|
|
@@ -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_0x4c2c2c=a162_0x5da9;(function(_0x262741,_0x42914c){const _0x12aa88=a162_0x5da9,_0x1a357d=_0x262741();while(!![]){try{const _0x131ff1=-parseInt(_0x12aa88(0xa9))/0x1+-parseInt(_0x12aa88(0x7e))/0x2*(-parseInt(_0x12aa88(0x84))/0x3)+parseInt(_0x12aa88(0x91))/0x4*(-parseInt(_0x12aa88(0xa6))/0x5)+parseInt(_0x12aa88(0xa5))/0x6*(-parseInt(_0x12aa88(0xba))/0x7)+-parseInt(_0x12aa88(0xac))/0x8+parseInt(_0x12aa88(0xa1))/0x9+-parseInt(_0x12aa88(0x95))/0xa*(-parseInt(_0x12aa88(0xb6))/0xb);if(_0x131ff1===_0x42914c)break;else _0x1a357d['push'](_0x1a357d['shift']());}catch(_0x51ff50){_0x1a357d['push'](_0x1a357d['shift']());}}}(a162_0x50e1,0x9e5cd));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';function a162_0x5da9(_0x15db39,_0x13c01f){_0x15db39=_0x15db39-0x7b;const _0x50e151=a162_0x50e1();let _0x5da999=_0x50e151[_0x15db39];return _0x5da999;}import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a162_0x4c2c2c(0x8d),'required':!![],'description':a162_0x4c2c2c(0x9b)};export const ROLE_REF_FLAG={'name':a162_0x4c2c2c(0xb9),'type':a162_0x4c2c2c(0x92),'required':!![],'description':a162_0x4c2c2c(0x9c)};export const USER_REF_FLAG={'name':a162_0x4c2c2c(0xc2),'type':a162_0x4c2c2c(0x92),'required':!![],'description':'User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'};export const NAME_FLAG={'name':a162_0x4c2c2c(0x88),'type':'string','required':!![],'description':a162_0x4c2c2c(0x7c)};export const USER_NAME_FLAG={'name':a162_0x4c2c2c(0x88),'type':a162_0x4c2c2c(0x92),'required':!![],'description':a162_0x4c2c2c(0xc6)};export const REMARK_FLAG={'name':a162_0x4c2c2c(0x9f),'type':a162_0x4c2c2c(0x92),'required':![],'description':a162_0x4c2c2c(0x7d)};export const EXPECT_USER_COUNT_FLAG={'name':a162_0x4c2c2c(0xb4),'type':a162_0x4c2c2c(0x8d),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=[a162_0x4c2c2c(0x89),a162_0x4c2c2c(0xa7),'USER'];export function isBuiltinRole(_0x359df0){const _0x1f4e5e=a162_0x4c2c2c;return BUILTIN_ROLE_TYPES[_0x1f4e5e(0xc4)](_0x359df0);}export function assertCustomRole(_0x592255,_0x46bb49){const _0x9328dc=a162_0x4c2c2c;if(_0x592255[_0x9328dc(0x99)]!=='CUSTOM')throw CliErrors['validation'](_0x9328dc(0x9d)+_0x46bb49+'\x20built-in\x20role\x20'+_0x592255[_0x9328dc(0x9e)]+'\x20('+_0x592255[_0x9328dc(0x99)]+').',_0x9328dc(0xbd));}export function assertPermConfigurable(_0x4ebc4c){const _0x4e10ac=a162_0x4c2c2c;if(_0x4ebc4c['roleType']==='DEV'||_0x4ebc4c['roleType']===_0x4e10ac(0x89))throw CliErrors[_0x4e10ac(0x82)]('Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20'+_0x4ebc4c[_0x4e10ac(0x9e)]+'\x20('+_0x4ebc4c[_0x4e10ac(0x99)]+').','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.');}export function projectRole(_0x4d516b){const _0x1e4676=a162_0x4c2c2c;return{'id':_0x4d516b['id'],'roleName':_0x4d516b['roleName'],'roleType':_0x4d516b[_0x1e4676(0x99)],'remark':_0x4d516b[_0x1e4676(0x9f)],'userCount':_0x4d516b['userCount'],'permitCount':_0x4d516b[_0x1e4676(0xa3)],'builtin':isBuiltinRole(_0x4d516b[_0x1e4676(0x99)])};}export async function resolveRoleRef(_0x524f66,_0x19156a){const _0x21557f=a162_0x4c2c2c,_0x1e3b75=_0x19156a[_0x21557f(0xbc)]();if(!_0x1e3b75)throw CliErrors[_0x21557f(0x82)](_0x21557f(0x8a),_0x21557f(0x8b));if(/^\d+$/[_0x21557f(0x83)](_0x1e3b75))return getRoleById(_0x524f66,Number(_0x1e3b75));const _0x3ce3f6=await listAllAppRoles(_0x524f66),_0x5ed3f0=_0x3ce3f6[_0x21557f(0x9a)](_0x4cc7ef=>_0x4cc7ef[_0x21557f(0x9e)]===_0x1e3b75);if(_0x5ed3f0[_0x21557f(0xa4)]===0x0)throw CliErrors[_0x21557f(0x82)](_0x21557f(0xb5)+_0x1e3b75+'\x22\x20not\x20found\x20in\x20app\x20'+_0x524f66+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.');if(_0x5ed3f0[_0x21557f(0xa4)]>0x1){const _0x3ee3b0=_0x5ed3f0[_0x21557f(0xa0)](_0x4b1399=>_0x4b1399['id'])[_0x21557f(0xc3)](',\x20');throw CliErrors['validation']('Role\x20name\x20\x22'+_0x1e3b75+_0x21557f(0x8f)+_0x3ee3b0+').',_0x21557f(0xc5));}return _0x5ed3f0[0x0];}export async function getRoleById(_0x2b17d1,_0x13e731){const _0x5ef0fd=a162_0x4c2c2c,_0x151620=await getAppRole(_0x13e731);if(!_0x151620)throw CliErrors['validation'](_0x5ef0fd(0x8c)+_0x13e731+_0x5ef0fd(0xaf)+_0x2b17d1+'.',_0x5ef0fd(0xa8));return _0x151620;}async function listAllAppRoles(_0x167b6b){const _0x3821ee=a162_0x4c2c2c,_0x5502c3=0x64,_0x505d13=[];for(let _0x49f72d=0x1;;_0x49f72d+=0x1){const {items:_0x8dc50f,paging:_0x5d9dfb}=await listAppRoles(_0x167b6b,{'currentPage':_0x49f72d,'pageSize':_0x5502c3});_0x505d13[_0x3821ee(0x94)](..._0x8dc50f);if(_0x8dc50f[_0x3821ee(0xa4)]<_0x5502c3||_0x5d9dfb&&_0x505d13[_0x3821ee(0xa4)]>=_0x5d9dfb[_0x3821ee(0xab)])return _0x505d13;}}export async function resolveTenantCode(){const _0x213140=a162_0x4c2c2c,_0xd40d0b=await getSessionUserInfo(),_0x432046=_0xd40d0b?.[_0x213140(0xc2)]?.['tenant']?.[_0x213140(0xa2)];if(!_0x432046)throw CliErrors['authRequired'](_0x213140(0x96));return _0x432046;}function matchMember(_0x2f96b8,_0x82ecdd){const _0x356b4d=a162_0x4c2c2c,_0x4b067b=_0x82ecdd[_0x356b4d(0xbc)]()[_0x356b4d(0xb1)]();return(_0x2f96b8[_0x356b4d(0x86)]??'')['toLowerCase']()===_0x4b067b||(_0x2f96b8[_0x356b4d(0xb7)]??'')['toLowerCase']()===_0x4b067b;}export async function resolveUserRef(_0x5502a6){const _0x5a5a6e=a162_0x4c2c2c,_0x16daf2=_0x5502a6[_0x5a5a6e(0xbc)]();if(!_0x16daf2)throw CliErrors[_0x5a5a6e(0x82)](_0x5a5a6e(0x90),'Pass\x20--user\x20<id|name>.');const _0x5e75ca=await resolveTenantCode(),_0x168cff=await getTenantMembers(_0x5e75ca);if(/^\d+$/[_0x5a5a6e(0x83)](_0x16daf2)){const _0x5db51c=Number(_0x16daf2),_0x2a46b5=_0x168cff['find'](_0x5c23bf=>_0x5c23bf[_0x5a5a6e(0xaa)]===_0x5db51c);return{'userId':_0x5db51c,'username':_0x2a46b5?.[_0x5a5a6e(0xb7)]??String(_0x5db51c),'nickname':_0x2a46b5?.[_0x5a5a6e(0x86)],'matchedBy':'id'};}const _0x26dd26=_0x168cff[_0x5a5a6e(0x9a)](_0xb63de=>matchMember(_0xb63de,_0x16daf2));if(_0x26dd26['length']===0x0)throw CliErrors['validation'](_0x5a5a6e(0x85)+_0x16daf2+'\x22.',_0x5a5a6e(0xbb));if(_0x26dd26[_0x5a5a6e(0xa4)]>0x1){const _0xf97df8=_0x26dd26[_0x5a5a6e(0xa0)](_0x4f033e=>(_0x4f033e[_0x5a5a6e(0x86)]??_0x4f033e[_0x5a5a6e(0xb7)]??'?')+'('+_0x4f033e['userId']+')')[_0x5a5a6e(0xc3)](',\x20');throw CliErrors[_0x5a5a6e(0x82)](_0x5a5a6e(0x8e)+_0x16daf2+_0x5a5a6e(0xc7)+_0xf97df8+'.',_0x5a5a6e(0xb2));}const _0x45d382=_0x26dd26[0x0];return{'userId':_0x45d382[_0x5a5a6e(0xaa)],'username':_0x45d382['username']??String(_0x45d382[_0x5a5a6e(0xaa)]),'nickname':_0x45d382['nickname'],'matchedBy':_0x5a5a6e(0x88)};}export const UPDATE_USER_LIST_PATH=a162_0x4c2c2c(0x97);function userIdsOf(_0x1b3727){const _0x16c4c1=a162_0x4c2c2c;return(_0x1b3727?.[_0x16c4c1(0xb0)]??[])['map'](_0x5225f3=>_0x5225f3[_0x16c4c1(0xaa)]);}export function computeRoleUserMutation(_0x523d06){const _0x2cdeb2=a162_0x4c2c2c,{operation:_0x4eca12,appCode:_0x42f973,roleUsers:_0x35de4a,targetRoleId:_0x1d8d3c,user:_0x3fe58d}=_0x523d06,_0x3a489a=_0x35de4a['find'](_0x2d2cdc=>_0x2d2cdc['id']===_0x1d8d3c);if(!_0x3a489a)throw CliErrors['validation'](_0x2cdeb2(0x8c)+_0x1d8d3c+_0x2cdeb2(0x7b),'Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');const _0x47197b=userIdsOf(_0x3a489a),_0x31830e=[];if(_0x523d06[_0x2cdeb2(0x7f)]!==undefined&&_0x523d06[_0x2cdeb2(0x7f)]!==_0x47197b['length'])throw CliErrors[_0x2cdeb2(0x82)]('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x523d06['expectUserCount']+_0x2cdeb2(0xc1)+_0x47197b[_0x2cdeb2(0xa4)]+'.',_0x2cdeb2(0x98));const _0x38ce7b=_0x47197b[_0x2cdeb2(0xc4)](_0x3fe58d[_0x2cdeb2(0xaa)]);let _0x46a3e6=![];const _0x2a418d=[..._0x3a489a[_0x2cdeb2(0xb0)]];if(_0x4eca12==='user-add')_0x38ce7b?_0x31830e[_0x2cdeb2(0x94)](_0x2cdeb2(0xae)+_0x3fe58d[_0x2cdeb2(0xaa)]+_0x2cdeb2(0x87)+_0x3a489a[_0x2cdeb2(0x9e)]+_0x2cdeb2(0xb3)):(_0x2a418d['push']({'userId':_0x3fe58d['userId'],'username':_0x3fe58d[_0x2cdeb2(0xb7)],..._0x3fe58d[_0x2cdeb2(0x86)]?{'nickname':_0x3fe58d['nickname']}:{}}),_0x46a3e6=!![]);else{if(!_0x38ce7b)_0x31830e[_0x2cdeb2(0x94)](_0x2cdeb2(0xae)+_0x3fe58d[_0x2cdeb2(0xaa)]+_0x2cdeb2(0xbf)+_0x3a489a[_0x2cdeb2(0x9e)]+';\x20no\x20change.');else{const _0x48d710=_0x2a418d[_0x2cdeb2(0xad)](_0x1decdb=>_0x1decdb[_0x2cdeb2(0xaa)]===_0x3fe58d[_0x2cdeb2(0xaa)]);if(_0x48d710>=0x0)_0x2a418d[_0x2cdeb2(0xc0)](_0x48d710,0x1);_0x46a3e6=!![];}}const _0x54ce03=_0x35de4a['map'](_0x1936df=>_0x1936df['id']===_0x1d8d3c?{..._0x1936df,'userList':_0x2a418d}:_0x1936df),_0x3705cc=_0x2a418d[_0x2cdeb2(0xa0)](_0x2bd851=>_0x2bd851['userId']),_0x211839={'operation':_0x4eca12,'selector':{'appCode':_0x42f973,'roleId':_0x1d8d3c,'roleName':_0x3a489a[_0x2cdeb2(0x9e)],'userId':_0x3fe58d['userId']},'before':{'userIds':_0x47197b},'after':{'userIds':_0x3705cc},'dryRun':_0x523d06[_0x2cdeb2(0xb8)],'backend':{'method':'POST','path':UPDATE_USER_LIST_PATH},'warnings':_0x31830e};return{'roleList':_0x54ce03,'mutation':_0x211839,'changed':_0x46a3e6};}export async function loadRoleUsers(_0x2f8482){return listRoleUsers(_0x2f8482);}export function readRoleRef(_0x3ac224){const _0x547412=a162_0x4c2c2c,_0x40f671=_0x3ac224[_0x547412(0x80)]('role')['trim']();if(!_0x40f671)throw CliErrors['flagMissing']('role','Pass\x20--role\x20<id|name>.');return _0x40f671;}export async function prepareUserMutation(_0x5c26b8,_0x5b8627,_0x509bbb){const _0x117d17=a162_0x4c2c2c,_0x4e1e3a=readRoleRef(_0x5c26b8),_0x356f36=_0x5c26b8['str']('user')[_0x117d17(0xbc)]();if(!_0x356f36)throw CliErrors[_0x117d17(0x81)](_0x117d17(0xc2),_0x117d17(0xbe));const _0x7f2bcf=_0x5c26b8[_0x117d17(0x93)](_0x117d17(0xb4)),_0x55762a=_0x7f2bcf===undefined||_0x7f2bcf===null?undefined:Number(_0x7f2bcf),_0x4e4a73=await resolveRoleRef(_0x5c26b8[_0x117d17(0xc8)],_0x4e1e3a),_0x150a49=await resolveUserRef(_0x356f36),_0x1b7407=await loadRoleUsers(_0x5c26b8[_0x117d17(0xc8)]);return computeRoleUserMutation({'operation':_0x5b8627,'appCode':_0x5c26b8[_0x117d17(0xc8)],'roleUsers':_0x1b7407,'targetRoleId':_0x4e4a73['id'],'user':{'userId':_0x150a49[_0x117d17(0xaa)],'username':_0x150a49[_0x117d17(0xb7)],'nickname':_0x150a49[_0x117d17(0x86)]},'dryRun':_0x509bbb,..._0x55762a!==undefined?{'expectUserCount':_0x55762a}:{}});}function a162_0x50e1(){const _0x41c1fe=['trim','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','Pass\x20--user\x20<id|name>.','\x20is\x20not\x20a\x20member\x20of\x20role\x20','splice','\x20member(s)\x20but\x20role\x20has\x20','user','join','includes','Disambiguate\x20with\x20--role\x20<id>.','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','\x22:\x20','appCode','\x20not\x20found\x20in\x20the\x20user-role\x20list.','Role\x20name','Optional\x20role\x20remark/description','274996zMsRjL','expectUserCount','str','flagMissing','validation','test','21bGFBoJ','No\x20tenant\x20member\x20matches\x20\x22','nickname','\x20is\x20already\x20a\x20member\x20of\x20role\x20','name','ADMIN','Missing\x20role\x20reference.','Pass\x20--role\x20<id|name>.','Role\x20id\x20','number','Multiple\x20tenant\x20members\x20match\x20\x22','\x22\x20is\x20ambiguous\x20(ids:\x20','Missing\x20user\x20reference.','99296jSFQmK','string','flag','push','7760fKVfZl','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','/smartapi/permit/user-role/update-user-list','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','roleType','filter','Role\x20id\x20(from\x20`role\x20list`)','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','Cannot\x20','roleName','remark','map','7237827ehIatv','tenant_code','permitCount','length','438krrlpY','160YoNzlO','DEV','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','411990UlEqHT','userId','totalCount','8826360OudYFI','findIndex','User\x20','\x20not\x20found\x20in\x20app\x20','userList','toLowerCase','Disambiguate\x20with\x20--user\x20<id>.',';\x20no\x20change.','expect-user-count','Role\x20name\x20\x22','34573IzrQGH','username','dryRun','role','119609GUTBjg','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.'];a162_0x50e1=function(){return _0x41c1fe;};return a162_0x50e1();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a163_0x4f2279=a163_0x1f22;function a163_0x1f22(_0x1dcc01,_0x4e044e){_0x1dcc01=_0x1dcc01-0x83;const _0x16afef=a163_0x16af();let _0x1f228c=_0x16afef[_0x1dcc01];return _0x1f228c;}function a163_0x16af(){const _0x57ef76=['New\x20role\x20name','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','update','roleName','56ezoOgR','4926018FwKDGh','POST','5WuuYNl','/smartapi/permit/role/update','length','635117dxjEik','--name\x20cannot\x20be\x20empty.','217900HFIeIJ','10MyKykU','130143hKcTrf','143DZyoYb','flag','write','appCode','validation','Updated\x20role\x20','27TrIilI','5061468BNOVDI','1958HSgQzA','11ppyaFK','Nothing\x20to\x20update.','num','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','remark','966xzfpID','13066236wKpFKr','name'];a163_0x16af=function(){return _0x57ef76;};return a163_0x16af();}(function(_0x42ee09,_0x437168){const _0x3506e6=a163_0x1f22,_0x1b2c5d=_0x42ee09();while(!![]){try{const _0xe10028=-parseInt(_0x3506e6(0x8f))/0x1*(-parseInt(_0x3506e6(0x97))/0x2)+parseInt(_0x3506e6(0x95))/0x3*(-parseInt(_0x3506e6(0x8c))/0x4)+-parseInt(_0x3506e6(0x87))/0x5*(parseInt(_0x3506e6(0x85))/0x6)+parseInt(_0x3506e6(0x8a))/0x7*(-parseInt(_0x3506e6(0x84))/0x8)+-parseInt(_0x3506e6(0x9e))/0x9*(-parseInt(_0x3506e6(0x8d))/0xa)+-parseInt(_0x3506e6(0x98))/0xb*(-parseInt(_0x3506e6(0x96))/0xc)+-parseInt(_0x3506e6(0x8e))/0xd*(-parseInt(_0x3506e6(0x9d))/0xe);if(_0xe10028===_0x437168)break;else _0x1b2c5d['push'](_0x1b2c5d['shift']());}catch(_0x10b26c){_0x1b2c5d['push'](_0x1b2c5d['shift']());}}}(a163_0x16af,0xb90c2));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a163_0x4f2279(0x88);function readPatch(_0x5d68a8){const _0x2f06bf=a163_0x4f2279,_0x7fdbed=_0x5d68a8[_0x2f06bf(0x90)](_0x2f06bf(0x9f)),_0x4d78f6=_0x5d68a8['flag'](_0x2f06bf(0x9c)),_0x5382f6={};if(_0x7fdbed!==undefined&&_0x7fdbed!==null){const _0x4bb15d=String(_0x7fdbed)['trim']();if(!_0x4bb15d)throw CliErrors[_0x2f06bf(0x93)](_0x2f06bf(0x8b));if(_0x4bb15d[_0x2f06bf(0x89)]>0x40)throw CliErrors[_0x2f06bf(0x93)](_0x2f06bf(0x9b));_0x5382f6[_0x2f06bf(0x83)]=_0x4bb15d;}_0x4d78f6!==undefined&&_0x4d78f6!==null&&(_0x5382f6[_0x2f06bf(0x9c)]=String(_0x4d78f6));if(_0x5382f6[_0x2f06bf(0x83)]===undefined&&_0x5382f6[_0x2f06bf(0x9c)]===undefined)throw CliErrors[_0x2f06bf(0x93)](_0x2f06bf(0x99),_0x2f06bf(0xa1));return _0x5382f6;}export const roleUpdate={'service':'role','command':a163_0x4f2279(0xa2),'description':'Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','risk':a163_0x4f2279(0x91),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a163_0x4f2279(0x9f),'type':'string','required':![],'description':a163_0x4f2279(0xa0)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x515745){readPatch(_0x515745);},async 'dryRun'(_0x3a912f){const _0x4dadc8=a163_0x4f2279,_0x4f7c36=_0x3a912f[_0x4dadc8(0x9a)]('id'),_0x3b1db1=readPatch(_0x3a912f),_0x1053e1=await getRoleById(_0x3a912f[_0x4dadc8(0x92)],_0x4f7c36);return assertCustomRole(_0x1053e1,'update'),asDryRunResult({'operation':_0x4dadc8(0xa2),'selector':{'appCode':_0x3a912f['appCode'],'roleId':_0x4f7c36,'roleName':_0x1053e1[_0x4dadc8(0x83)]},'before':projectRole(_0x1053e1),'after':projectRole({..._0x1053e1,..._0x3b1db1[_0x4dadc8(0x83)]!==undefined?{'roleName':_0x3b1db1['roleName']}:{},..._0x3b1db1['remark']!==undefined?{'remark':_0x3b1db1[_0x4dadc8(0x9c)]}:{}}),'dryRun':!![],'backend':{'method':_0x4dadc8(0x86),'path':UPDATE_PATH},'warnings':[]},{'method':_0x4dadc8(0x86),'url':UPDATE_PATH});},async 'execute'(_0x421d83){const _0x4f3dd1=a163_0x4f2279,_0x18ec41=_0x421d83['num']('id'),_0x532fe4=readPatch(_0x421d83),_0x1fa291=await getRoleById(_0x421d83[_0x4f3dd1(0x92)],_0x18ec41);assertCustomRole(_0x1fa291,_0x4f3dd1(0xa2)),await updateAppRole({'id':_0x18ec41,'appCode':_0x421d83['appCode'],..._0x532fe4['roleName']!==undefined?{'roleName':_0x532fe4[_0x4f3dd1(0x83)]}:{},..._0x532fe4[_0x4f3dd1(0x9c)]!==undefined?{'remark':_0x532fe4[_0x4f3dd1(0x9c)]}:{}});const _0x4046e3=await getRoleById(_0x421d83[_0x4f3dd1(0x92)],_0x18ec41);return{'ok':!![],'data':{'operation':_0x4f3dd1(0xa2),'selector':{'appCode':_0x421d83[_0x4f3dd1(0x92)],'roleId':_0x18ec41,'roleName':_0x4046e3[_0x4f3dd1(0x83)]},'before':projectRole(_0x1fa291),'after':projectRole(_0x4046e3),'dryRun':![],'backend':{'method':_0x4f3dd1(0x86),'path':UPDATE_PATH},'warnings':[]},'message':_0x4f3dd1(0x94)+_0x4046e3[_0x4f3dd1(0x83)]+'\x20(id='+_0x18ec41+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a164_0x7db0(_0x1615a3,_0x274021){_0x1615a3=_0x1615a3-0x18f;const _0x2a2174=a164_0x2a21();let _0x7db0a4=_0x2a2174[_0x1615a3];return _0x7db0a4;}const a164_0x5e51e2=a164_0x7db0;function a164_0x2a21(){const _0x360465=['688194EuDyZE','roleName','selector','1650219xUMkOX','appCode','userId','1020652xzXVhQ','1122570JtDZJe','high-risk-write','Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','16migbmz','user-add','\x20already\x20in\x20role\x20','\x20to\x20role\x20','role','3547117vNBHib','151146wtpaUh','1708930YHmgJj','POST'];a164_0x2a21=function(){return _0x360465;};return a164_0x2a21();}(function(_0x8d1ada,_0x3bd675){const _0x3f1e56=a164_0x7db0,_0x3928fd=_0x8d1ada();while(!![]){try{const _0x4d509f=-parseInt(_0x3f1e56(0x195))/0x1+parseInt(_0x3f1e56(0x19f))/0x2+-parseInt(_0x3f1e56(0x19b))/0x3+-parseInt(_0x3f1e56(0x19e))/0x4+-parseInt(_0x3f1e56(0x196))/0x5+parseInt(_0x3f1e56(0x198))/0x6+parseInt(_0x3f1e56(0x194))/0x7*(parseInt(_0x3f1e56(0x18f))/0x8);if(_0x4d509f===_0x3bd675)break;else _0x3928fd['push'](_0x3928fd['shift']());}catch(_0x5f50c1){_0x3928fd['push'](_0x3928fd['shift']());}}}(a164_0x2a21,0x5f86e));import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a164_0x5e51e2(0x193),'command':a164_0x5e51e2(0x190),'description':a164_0x5e51e2(0x1a1),'risk':a164_0x5e51e2(0x1a0),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x1094b4){const _0x35f4fc=a164_0x5e51e2,{mutation:_0x55b9e5}=await prepareUserMutation(_0x1094b4,_0x35f4fc(0x190),!![]);return asDryRunResult(_0x55b9e5,{'method':_0x35f4fc(0x197),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x11ac69){const _0x47ff3c=a164_0x5e51e2,{roleList:_0x3f817a,mutation:_0x33dbdb,changed:_0x3367c9}=await prepareUserMutation(_0x11ac69,_0x47ff3c(0x190),![]);return _0x3367c9&&await updateRoleUsers(_0x11ac69[_0x47ff3c(0x19c)],_0x3f817a),{'ok':!![],'data':_0x33dbdb,'message':_0x3367c9?'Added\x20user\x20'+_0x33dbdb[_0x47ff3c(0x19a)][_0x47ff3c(0x19d)]+_0x47ff3c(0x192)+_0x33dbdb[_0x47ff3c(0x19a)][_0x47ff3c(0x199)]:'No\x20change:\x20user\x20'+_0x33dbdb[_0x47ff3c(0x19a)]['userId']+_0x47ff3c(0x191)+_0x33dbdb[_0x47ff3c(0x19a)][_0x47ff3c(0x199)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a165_0x5679a9=a165_0x16fa;(function(_0x3c5a66,_0x37e17e){const _0x4fbb5a=a165_0x16fa,_0x3b9b14=_0x3c5a66();while(!![]){try{const _0x3607b6=parseInt(_0x4fbb5a(0x1bc))/0x1*(parseInt(_0x4fbb5a(0x1bb))/0x2)+-parseInt(_0x4fbb5a(0x1cf))/0x3*(-parseInt(_0x4fbb5a(0x1c5))/0x4)+-parseInt(_0x4fbb5a(0x1cb))/0x5*(-parseInt(_0x4fbb5a(0x1ca))/0x6)+-parseInt(_0x4fbb5a(0x1bd))/0x7+parseInt(_0x4fbb5a(0x1b8))/0x8+parseInt(_0x4fbb5a(0x1c3))/0x9*(parseInt(_0x4fbb5a(0x1c1))/0xa)+-parseInt(_0x4fbb5a(0x1cc))/0xb;if(_0x3607b6===_0x37e17e)break;else _0x3b9b14['push'](_0x3b9b14['shift']());}catch(_0x39f262){_0x3b9b14['push'](_0x3b9b14['shift']());}}}(a165_0x5723,0x882ac));function a165_0x5723(){const _0x3f255f=['selector','45QPgUza','high-risk-write','204tpvyfY','\x20not\x20in\x20role\x20','\x20from\x20role\x20','POST','userId','246846suzdUT','85vXpMpe','8460111XlOZMf','Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','roleName','49641DEmCmG','407592rFXuTz','role','user-remove','495536ZYVdfF','1NyemdS','7610435HVUwVz','appCode','No\x20change:\x20user\x20','Removed\x20user\x20','1144070EmDMOM'];a165_0x5723=function(){return _0x3f255f;};return a165_0x5723();}function a165_0x16fa(_0x37f68e,_0x309fd0){_0x37f68e=_0x37f68e-0x1b8;const _0x572335=a165_0x5723();let _0x16fa03=_0x572335[_0x37f68e];return _0x16fa03;}import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':a165_0x5679a9(0x1b9),'command':a165_0x5679a9(0x1ba),'description':a165_0x5679a9(0x1cd),'risk':a165_0x5679a9(0x1c4),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x130f15){const _0x16b524=a165_0x5679a9,{mutation:_0x3b6060}=await prepareUserMutation(_0x130f15,_0x16b524(0x1ba),!![]);return asDryRunResult(_0x3b6060,{'method':_0x16b524(0x1c8),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x2b6eda){const _0x2619ef=a165_0x5679a9,{roleList:_0x439da9,mutation:_0x251800,changed:_0x555637}=await prepareUserMutation(_0x2b6eda,'user-remove',![]);return _0x555637&&await updateRoleUsers(_0x2b6eda[_0x2619ef(0x1be)],_0x439da9),{'ok':!![],'data':_0x251800,'message':_0x555637?_0x2619ef(0x1c0)+_0x251800[_0x2619ef(0x1c2)][_0x2619ef(0x1c9)]+_0x2619ef(0x1c7)+_0x251800[_0x2619ef(0x1c2)][_0x2619ef(0x1ce)]:_0x2619ef(0x1bf)+_0x251800['selector']['userId']+_0x2619ef(0x1c6)+_0x251800[_0x2619ef(0x1c2)][_0x2619ef(0x1ce)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a166_0x1ac13a=a166_0xd871;(function(_0x4e2284,_0x5793ff){const _0xab7c1e=a166_0xd871,_0xbcea41=_0x4e2284();while(!![]){try{const _0x36c426=-parseInt(_0xab7c1e(0x1f5))/0x1+-parseInt(_0xab7c1e(0x1ff))/0x2*(parseInt(_0xab7c1e(0x202))/0x3)+-parseInt(_0xab7c1e(0x1fe))/0x4+parseInt(_0xab7c1e(0x208))/0x5*(-parseInt(_0xab7c1e(0x1f6))/0x6)+parseInt(_0xab7c1e(0x203))/0x7+parseInt(_0xab7c1e(0x1f7))/0x8*(-parseInt(_0xab7c1e(0x1fa))/0x9)+parseInt(_0xab7c1e(0x1f3))/0xa;if(_0x36c426===_0x5793ff)break;else _0xbcea41['push'](_0xbcea41['shift']());}catch(_0x20330f){_0xbcea41['push'](_0xbcea41['shift']());}}}(a166_0x5e52,0x2ebfb));function a166_0x5e52(){const _0x2329db=['Resolved\x20\x22','316881qXeLRP','2353428hAPtcF','trim','\x22\x20→\x20userId\x20','userId','role','19835QKmLcA','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','8200370RGVBUJ','nickname','223931wvQssO','18NCdFAz','64Lqqnww','Pass\x20--name\x20<nickname|username>.','name','45189npoVwu','read','flagMissing','str','1487508SrLEwQ','6fiXjLN','username'];a166_0x5e52=function(){return _0x2329db;};return a166_0x5e52();}import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a166_0xd871(_0x3cbb30,_0x379101){_0x3cbb30=_0x3cbb30-0x1f2;const _0x5e5280=a166_0x5e52();let _0xd871dc=_0x5e5280[_0x3cbb30];return _0xd871dc;}import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a166_0x1ac13a(0x207),'command':'user-resolve','description':a166_0x1ac13a(0x1f2),'risk':a166_0x1ac13a(0x1fb),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x4c6e27){const _0xd268b9=a166_0x1ac13a;if(!_0x4c6e27[_0xd268b9(0x1fd)](_0xd268b9(0x1f9))[_0xd268b9(0x204)]())throw CliErrors[_0xd268b9(0x1fc)](_0xd268b9(0x1f9),_0xd268b9(0x1f8));},async 'execute'(_0x37e7e4){const _0x41356e=a166_0x1ac13a,_0x2b8d27=_0x37e7e4[_0x41356e(0x1fd)](_0x41356e(0x1f9))[_0x41356e(0x204)](),_0x5e42d3=await resolveUserRef(_0x2b8d27);return{'ok':!![],'data':{'user':{'userId':_0x5e42d3[_0x41356e(0x206)],'username':_0x5e42d3[_0x41356e(0x200)],'nickname':_0x5e42d3[_0x41356e(0x1f4)],'matchedBy':_0x5e42d3['matchedBy']}},'message':_0x41356e(0x201)+_0x2b8d27+_0x41356e(0x205)+_0x5e42d3[_0x41356e(0x206)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a167_0x5aee9b=a167_0x51ae;(function(_0x414db2,_0x2bdcfc){const _0x49f0b8=a167_0x51ae,_0x3dac4d=_0x414db2();while(!![]){try{const _0x30bee1=parseInt(_0x49f0b8(0xb3))/0x1*(parseInt(_0x49f0b8(0x9c))/0x2)+-parseInt(_0x49f0b8(0xc3))/0x3*(parseInt(_0x49f0b8(0x98))/0x4)+parseInt(_0x49f0b8(0x99))/0x5*(parseInt(_0x49f0b8(0xbc))/0x6)+parseInt(_0x49f0b8(0xbf))/0x7*(-parseInt(_0x49f0b8(0xd2))/0x8)+-parseInt(_0x49f0b8(0xb6))/0x9*(parseInt(_0x49f0b8(0xca))/0xa)+parseInt(_0x49f0b8(0xc7))/0xb*(parseInt(_0x49f0b8(0xae))/0xc)+parseInt(_0x49f0b8(0xb2))/0xd*(parseInt(_0x49f0b8(0xcc))/0xe);if(_0x30bee1===_0x2bdcfc)break;else _0x3dac4d['push'](_0x3dac4d['shift']());}catch(_0x260b76){_0x3dac4d['push'](_0x3dac4d['shift']());}}}(a167_0x1d3a,0x88a2e));function a167_0x1d3a(){const _0x15b742=['\x0a\x20\x20Usage:\x20','\x20\x20\x20\x20','pnpm','No\x20package.json\x20found\x20in\x20current\x20directory.','slice','length','run','utf-8','needsUpgrade','validation','inherit','close','24rYJHBX','node_modules','Script\x20name\x20defined\x20in\x20package.json','dev','26wxrKXO','1mGnHec','error','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','1272834YYbgII','preview','join','vite','yarn','bun','120iBzYiT','belowMinimum','pnpm-lock.yaml','161KnwGJq','npm','log','\x20run\x20preview\x20--watch','15VPnbTt','bool','\x0a\x20\x20Available\x20scripts:\x0a','bun.lock','5318456sVzDHD','Available:\x20','package.json','30GElBqv','watch','1670088uEvbdi','\x20run\x20start','scripts','all','Run\x20a\x20package.json\x20script','args','3776fBXptE','push','534836zzKhRJ','107435iMkQva','vite\x20preview\x20exited\x20with\x20code\x20','\x20run\x20preview','56050rNhCXb','parse','\x20run\x20<script>\x0a','.bin','(none)','\x20run\x20'];a167_0x1d3a=function(){return _0x15b742;};return a167_0x1d3a();}import{readFileSync,existsSync}from'node:fs';function a167_0x51ae(_0x2d09c9,_0x4f0374){_0x2d09c9=_0x2d09c9-0x97;const _0x1d3aea=a167_0x1d3a();let _0x51ae87=_0x1d3aea[_0x2d09c9];return _0x51ae87;}import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set(['start',a167_0x5aee9b(0xb1)]);function readPackageScripts(_0x27bf79){const _0x962354=a167_0x5aee9b,_0x110f8f=resolve(_0x27bf79,_0x962354(0xc9));if(!existsSync(_0x110f8f))return null;try{const _0x283d96=JSON[_0x962354(0x9d)](readFileSync(_0x110f8f,_0x962354(0xa9)));return _0x283d96[_0x962354(0xce)]??{};}catch{return null;}}function detectPackageManager(_0x4beb35){const _0x5b6e2c=a167_0x5aee9b;if(existsSync(resolve(_0x4beb35,'bun.lockb'))||existsSync(resolve(_0x4beb35,_0x5b6e2c(0xc6))))return _0x5b6e2c(0xbb);if(existsSync(resolve(_0x4beb35,_0x5b6e2c(0xbe))))return _0x5b6e2c(0xa4);if(existsSync(resolve(_0x4beb35,'yarn.lock')))return _0x5b6e2c(0xba);return _0x5b6e2c(0xc0);}async function versionCheck(_0x50aebe){const _0x1a08b3=a167_0x5aee9b,_0x29c1af=await checkCliVersion();(_0x29c1af['needsUpgrade']||_0x29c1af[_0x1a08b3(0xbd)])&&(printCliUpgradeWarning(_0x29c1af),assertCliVersionSupported(_0x29c1af));const _0x4b1433=await checkSdkVersion(_0x50aebe);if(_0x4b1433[_0x1a08b3(0xaa)])printSdkUpgradeWarning(_0x4b1433);}function spawnScript(_0x2f7d83,_0x10af36,_0x39e056,_0xc9f7c1){return new Promise((_0x2be44e,_0x5ea668)=>{const _0x363804=a167_0x51ae,_0x587313=['run',_0x10af36,..._0x39e056],_0x4d3bf6=spawn(_0x2f7d83,_0x587313,{'cwd':_0xc9f7c1,'stdio':_0x363804(0xac),'shell':!![],'env':{...process.env,'PATH':''+join(_0xc9f7c1,_0x363804(0xaf),_0x363804(0x9f))+delimiter+process.env.PATH}});_0x4d3bf6['on'](_0x363804(0xad),_0x157c34=>{const _0xa999a5=_0x363804;if(_0x157c34===0x0||_0x157c34===null)_0x2be44e();else _0x5ea668(new Error(_0x2f7d83+_0xa999a5(0xa1)+_0x10af36+'\x20exited\x20with\x20code\x20'+_0x157c34));}),_0x4d3bf6['on'](_0x363804(0xb4),_0x5ea668);});}function spawnViteBuildWatch(_0x40d711){return new Promise((_0x408f74,_0x25da6e)=>{const _0x3151c9=a167_0x51ae,_0x217d09=spawn(_0x3151c9(0xb9),['build','--watch'],{'cwd':_0x40d711,'stdio':_0x3151c9(0xac),'shell':!![],'env':{...process.env,'PATH':''+join(_0x40d711,_0x3151c9(0xaf),_0x3151c9(0x9f))+delimiter+process.env.PATH}});_0x217d09['on'](_0x3151c9(0xad),_0x4738c5=>{const _0x26eb2d=_0x3151c9;if(_0x4738c5===0x0||_0x4738c5===null)_0x408f74();else _0x25da6e(new Error(_0x26eb2d(0xb5)+_0x4738c5));}),_0x217d09['on'](_0x3151c9(0xb4),_0x25da6e);});}function spawnVitePreview(_0x2d54c0){return new Promise((_0x358d29,_0x22fe7f)=>{const _0x438039=a167_0x51ae,_0x513189=spawn(_0x438039(0xb9),[_0x438039(0xb7)],{'cwd':_0x2d54c0,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x2d54c0,'node_modules',_0x438039(0x9f))+delimiter+process.env.PATH}});_0x513189['on'](_0x438039(0xad),_0x35d758=>{const _0xcfec25=_0x438039;if(_0x35d758===0x0||_0x35d758===null)_0x358d29();else _0x22fe7f(new Error(_0xcfec25(0x9a)+_0x35d758));}),_0x513189['on'](_0x438039(0xb4),_0x22fe7f);});}const runFlags=[{'name':'watch','type':'boolean','description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a167_0x5aee9b(0xa8),'command':a167_0x5aee9b(0xa8),'description':a167_0x5aee9b(0xd0),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':a167_0x5aee9b(0xb0),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x3947e4=a167_0x5aee9b,_0x197100=[];return _0x197100[_0x3947e4(0x97)]('\x20\x20EXAMPLES'),_0x197100[_0x3947e4(0x97)](_0x3947e4(0xa3)+CLI_BIN_NAME+_0x3947e4(0xcd)),_0x197100[_0x3947e4(0x97)](_0x3947e4(0xa3)+CLI_BIN_NAME+'\x20run\x20build'),_0x197100[_0x3947e4(0x97)](_0x3947e4(0xa3)+CLI_BIN_NAME+_0x3947e4(0x9b)),_0x197100['push'](_0x3947e4(0xa3)+CLI_BIN_NAME+_0x3947e4(0xc2)),_0x197100[_0x3947e4(0xb8)]('\x0a');},async 'execute'(_0x2b99c6){const _0x50d515=a167_0x5aee9b,_0x56e02b=process['cwd'](),_0x85c9fa=_0x2b99c6[_0x50d515(0xd1)][0x0],_0x4015bb=_0x2b99c6[_0x50d515(0xd1)][_0x50d515(0xa6)](0x1),_0xe8bacc=readPackageScripts(_0x56e02b);if(!_0xe8bacc)throw CliErrors[_0x50d515(0xab)](_0x50d515(0xa5));if(!_0x85c9fa){const _0x2ada4d=Object['keys'](_0xe8bacc);if(_0x2ada4d[_0x50d515(0xa7)]===0x0)console['log']('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x50d515(0xc1)](_0x50d515(0xc5));for(const _0x27c1db of _0x2ada4d){console['log']('\x20\x20\x20\x20'+_0x27c1db);}console['log'](_0x50d515(0xa2)+CLI_BIN_NAME+_0x50d515(0x9e));}return{'ok':!![]};}if(!_0xe8bacc[_0x85c9fa])throw CliErrors[_0x50d515(0xab)]('Script\x20\x22'+_0x85c9fa+'\x22\x20not\x20found\x20in\x20package.json.',_0x50d515(0xc8)+(Object['keys'](_0xe8bacc)['join'](',\x20')||_0x50d515(0xa0)));const _0x12d47a=detectPackageManager(_0x56e02b);VERSION_CHECK_SCRIPTS['has'](_0x85c9fa)&&await versionCheck(_0x56e02b);if(_0x85c9fa===_0x50d515(0xb7)&&_0x2b99c6[_0x50d515(0xc4)](_0x50d515(0xcb)))return await Promise[_0x50d515(0xcf)]([spawnViteBuildWatch(_0x56e02b),spawnVitePreview(_0x56e02b)]),{'ok':!![]};return await spawnScript(_0x12d47a,_0x85c9fa,_0x4015bb,_0x56e02b),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a168_0x731889=a168_0x4ccf;(function(_0x1fd8f0,_0x373f06){const _0x624a45=a168_0x4ccf,_0x31d915=_0x1fd8f0();while(!![]){try{const _0x142909=-parseInt(_0x624a45(0x180))/0x1*(parseInt(_0x624a45(0x17e))/0x2)+parseInt(_0x624a45(0x187))/0x3+-parseInt(_0x624a45(0x184))/0x4+parseInt(_0x624a45(0x182))/0x5+-parseInt(_0x624a45(0x186))/0x6+-parseInt(_0x624a45(0x17f))/0x7*(-parseInt(_0x624a45(0x185))/0x8)+parseInt(_0x624a45(0x183))/0x9*(parseInt(_0x624a45(0x188))/0xa);if(_0x142909===_0x373f06)break;else _0x31d915['push'](_0x31d915['shift']());}catch(_0x132e82){_0x31d915['push'](_0x31d915['shift']());}}}(a168_0x8027,0x8804c));import{buildSchemaPayload}from'../framework/schema-export.js';function a168_0x4ccf(_0x3432bd,_0x1ddae4){_0x3432bd=_0x3432bd-0x17e;const _0x802770=a168_0x8027();let _0x4ccf76=_0x802770[_0x3432bd];return _0x4ccf76;}async function execute(_0x5b9578){const _0x1704a0=await buildSchemaPayload();return{'ok':!![],'data':_0x1704a0};}export const schemaDefinition={'service':'schema','command':a168_0x731889(0x181),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};function a168_0x8027(){const _0x1b97ef=['8RJIwSF','4029864LjYBMV','2325903GLOGAR','36370DJwSYl','12zDMkbp','2866892oMfMdR','162815BNBXgN','export','4761000YkhvDK','2718MjbmVC','4119060HjrvFz'];a168_0x8027=function(){return _0x1b97ef;};return a168_0x8027();}
|
|
@@ -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_0x16da62=a169_0x2ae2;(function(_0x36baea,_0x2b2741){const _0x378091=a169_0x2ae2,_0x4bac8e=_0x36baea();while(!![]){try{const _0x2ede99=-parseInt(_0x378091(0x166))/0x1*(parseInt(_0x378091(0x15e))/0x2)+-parseInt(_0x378091(0x150))/0x3+parseInt(_0x378091(0x138))/0x4*(-parseInt(_0x378091(0x14d))/0x5)+-parseInt(_0x378091(0x164))/0x6+parseInt(_0x378091(0x130))/0x7+-parseInt(_0x378091(0x13b))/0x8+-parseInt(_0x378091(0x13a))/0x9*(-parseInt(_0x378091(0x13f))/0xa);if(_0x2ede99===_0x2b2741)break;else _0x4bac8e['push'](_0x4bac8e['shift']());}catch(_0x51ed8c){_0x4bac8e['push'](_0x4bac8e['shift']());}}}(a169_0x4bb9,0x9ee93));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';function a169_0x4bb9(){const _0x2b8a2a=['--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','Invalid\x20database\x20selection\x20payload:\x20','map','sqlRootDir','256056JYHOOg','dbId','60071IHGPMX','sqlName','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','create','sqlCode','appCode','stringify','validation','</select>','适合带动态标签的\x20MyBatis\x20XML\x20SQL','str','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','5428710VKPSBA','new','flagMissing','SQL\x20名称不能为空','MyBatis\x20XML(mybatisXml)','name','catch','Target\x20database\x20ID','8SPqaSh','mybatisXml','22887cgeQcq','3659472NWfLZn','isInteger','普通\x20SQL(sql)','lockFilePath','3510bSpXGz','string','nonInteractive','__manual__','isFinite','utf8','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','请选择目标数据库:','\x20\x20SELECT\x201\x20AS\x20id','join','Created\x20SQL\x20query\x20','✎\x20手动输入\x20dbId','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','sqlRoot','157715zihFHl','db-id','trim','1181871RTtTOl','number','sql','toISOString','/smartapi/custom/saveUserCustomSql','POST','parse','mode','请选择本地\x20SQL\x20模式:','description','dbId\x20不能为空','<server-generated-sqlCode>','lastSync','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','2WnxrTK','File\x20already\x20exists:\x20'];a169_0x4bb9=function(){return _0x2b8a2a;};return a169_0x4bb9();}function a169_0x2ae2(_0x294d34,_0x1540a9){_0x294d34=_0x294d34-0x12f;const _0x4bb9c1=a169_0x4bb9();let _0x2ae2c9=_0x4bb9c1[_0x294d34];return _0x2ae2c9;}import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x2ae7a4){const _0x32f89f=a169_0x2ae2;if(_0x2ae7a4===_0x32f89f(0x139))return[_0x32f89f(0x12f),_0x32f89f(0x147),_0x32f89f(0x16e),''][_0x32f89f(0x148)]('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x32f89f(0x148)]('\x0a');}export const sqlCreate={'service':a169_0x16da62(0x152),'command':a169_0x16da62(0x169),'description':a169_0x16da62(0x145),'risk':'high-risk-write','flags':[{'name':a169_0x16da62(0x135),'type':'string','description':'SQL\x20query\x20display\x20name'},{'name':a169_0x16da62(0x14e),'type':a169_0x16da62(0x151),'description':a169_0x16da62(0x137)},{'name':'mode','type':a169_0x16da62(0x140),'enum':[a169_0x16da62(0x152),a169_0x16da62(0x139)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x12fd5c){const _0x2cfd07=a169_0x16da62;if(!_0x12fd5c[_0x2cfd07(0x141)])return;if(!_0x12fd5c[_0x2cfd07(0x170)](_0x2cfd07(0x135))['trim']())throw CliErrors[_0x2cfd07(0x132)](_0x2cfd07(0x135),_0x2cfd07(0x15d));const _0x16c098=resolveProvidedDbId(_0x12fd5c);if(typeof _0x16c098!=='number'||!Number[_0x2cfd07(0x143)](_0x16c098)||_0x16c098<=0x0)throw CliErrors[_0x2cfd07(0x132)](_0x2cfd07(0x14e),_0x2cfd07(0x160));if(!_0x12fd5c[_0x2cfd07(0x170)](_0x2cfd07(0x157))['trim']())throw CliErrors['flagMissing'](_0x2cfd07(0x157),_0x2cfd07(0x168));},async 'dryRun'(_0x404985){const _0x2ce1fb=a169_0x16da62,_0x5e096e=loadSqlProjectConfig(_0x404985[_0x2ce1fb(0x16b)]),{sqlName:_0x4200c2,dbId:_0x2779c1,dbName:_0x47cbc4,mode:_0x115270}=await resolveSqlNewInputs(_0x404985),_0x3fbd39=buildSqlRelativePath(_0x2ce1fb(0x15b),_0x4200c2,_0x47cbc4,_0x115270,_0x2779c1),_0x4bb7c8=_0x5e096e[_0x2ce1fb(0x163)]+'/'+_0x3fbd39;return{'method':_0x2ce1fb(0x155),'url':_0x2ce1fb(0x154),'body':{'appCode':_0x404985['appCode'],'sqlName':_0x4200c2,'dbId':_0x2779c1,'mode':_0x115270,'localPath':_0x4bb7c8},'description':_0x2ce1fb(0x14b)+_0x5e096e[_0x2ce1fb(0x163)]};},async 'execute'(_0x15a29d){const _0x5399d=a169_0x16da62,_0x33d7fa=loadSqlProjectConfig(_0x15a29d['appCode']),{sqlName:_0x34db18,dbId:_0x4aabf9,dbName:_0x59ae14,mode:_0xf8b4bc}=await resolveSqlNewInputs(_0x15a29d),_0x2ea9de=generateSqlTemplate(_0xf8b4bc),_0x4b970f=await createSqlQuery({'appCode':_0x15a29d['appCode'],'sqlName':_0x34db18,'dbId':_0x4aabf9,'sqlContent':_0x2ea9de}),_0x3fbce3=ensureRemoteSqlContent(_0x4b970f),_0x17ea4e=_0x59ae14||await getDbName(_0x15a29d[_0x5399d(0x16b)],_0x4aabf9)['catch'](()=>undefined),_0x45daaf=buildSqlRelativePath(_0x4b970f[_0x5399d(0x16a)],_0x4b970f[_0x5399d(0x167)],_0x17ea4e,_0xf8b4bc,_0x4aabf9),_0x2dab96=_0x33d7fa[_0x5399d(0x163)]+'/'+_0x45daaf,_0x5f088c=buildLocalSqlFileContent({'sqlCode':_0x4b970f[_0x5399d(0x16a)],'sqlName':_0x4b970f[_0x5399d(0x167)],'dbId':_0x4b970f[_0x5399d(0x165)]},_0x3fbce3,{'dbName':_0x17ea4e,'mode':_0xf8b4bc,'syncedAt':new Date()[_0x5399d(0x153)](),'description':_0x4b970f[_0x5399d(0x159)]});if(await fileExists(_0x2dab96))throw CliErrors[_0x5399d(0x16d)](_0x5399d(0x15f)+_0x2dab96);await ensureParentDirectory(_0x2dab96),await writeFile(_0x2dab96,_0x5f088c,_0x5399d(0x144));const _0x403a34=await readSqlLockFile(_0x33d7fa[_0x5399d(0x13e)]),{lockData:_0x205ac6,appLock:_0x4ca5f5}=ensureSqlLockScope(_0x403a34??createEmptySqlLock(),_0x33d7fa['appCode'],_0x33d7fa[_0x5399d(0x14c)],_0x5399d(0x131));return _0x4ca5f5['sqls'][_0x4b970f[_0x5399d(0x16a)]]={...buildSqlLockEntry(_0x4b970f,_0x3fbce3,computeSqlContentHash(_0x5f088c),{'dbName':_0x17ea4e}),'path':_0x45daaf,'mode':_0xf8b4bc},_0x4ca5f5[_0x5399d(0x15c)]=new Date()[_0x5399d(0x153)](),await writeSqlLockFile(_0x33d7fa[_0x5399d(0x13e)],_0x205ac6),{'ok':!![],'data':{'id':_0x4b970f['id'],'sqlCode':_0x4b970f[_0x5399d(0x16a)],'sqlName':_0x4b970f['sqlName'],'dbId':_0x4b970f[_0x5399d(0x165)],'path':_0x2dab96,'mode':_0xf8b4bc},'message':_0x5399d(0x149)+_0x4b970f['sqlCode']};}};async function resolveSqlNewInputs(_0x776f12){const _0x4a53d2=await resolveSqlNameInput(_0x776f12),{dbId:_0x29f1fe,dbName:_0xce2fc3}=await resolveDbSelection(_0x776f12),_0x3be3da=await resolveSqlModeInput(_0x776f12);return{'sqlName':_0x4a53d2,'dbId':_0x29f1fe,'dbName':_0xce2fc3,'mode':_0x3be3da};}async function resolveSqlNameInput(_0x1ed63d){const _0x19eae8=a169_0x16da62,_0x24bcc7=_0x1ed63d['str'](_0x19eae8(0x135))['trim']();if(_0x24bcc7)return _0x24bcc7;if(_0x1ed63d[_0x19eae8(0x141)])throw CliErrors['flagMissing']('name',_0x19eae8(0x15d));return(await input({'message':'请输入\x20SQL\x20名称:','validate':_0x22e57d=>_0x22e57d[_0x19eae8(0x14f)]()?!![]:_0x19eae8(0x133)}))[_0x19eae8(0x14f)]();}async function resolveDbSelection(_0x52801c){const _0x11a318=a169_0x16da62,_0x18bb5c=resolveProvidedDbId(_0x52801c);if(typeof _0x18bb5c===_0x11a318(0x151)&&Number['isFinite'](_0x18bb5c)&&_0x18bb5c>0x0)return{'dbId':_0x18bb5c,'dbName':await getDbName(_0x52801c[_0x11a318(0x16b)],_0x18bb5c)[_0x11a318(0x136)](()=>undefined)};if(_0x52801c[_0x11a318(0x141)])throw CliErrors[_0x11a318(0x132)]('db-id',_0x11a318(0x160));const _0x571c29=await listDatabases(_0x52801c[_0x11a318(0x16b)])[_0x11a318(0x136)](()=>[]);if(_0x571c29['length']===0x1)return{'dbId':_0x571c29[0x0][_0x11a318(0x165)],'dbName':_0x571c29[0x0]['dbName']};if(_0x571c29['length']>0x1){const _0x566cf7=await select({'message':_0x11a318(0x146),'choices':[..._0x571c29[_0x11a318(0x162)](_0x5f4e69=>({'name':_0x5f4e69['dbName']+'\x20('+_0x5f4e69['dbId']+')','value':serializeDbSelection(_0x5f4e69)})),{'name':_0x11a318(0x14a),'value':_0x11a318(0x142)}]});if(_0x566cf7!==_0x11a318(0x142))return deserializeDbSelection(_0x566cf7);}const _0x906d46=await input({'message':'请输入目标数据库\x20dbId:','validate':_0xbb9e9c=>{const _0x22f9c2=_0x11a318,_0x88fd70=_0xbb9e9c[_0x22f9c2(0x14f)]();if(!_0x88fd70)return _0x22f9c2(0x15a);const _0x3d2b47=Number(_0x88fd70);if(!Number[_0x22f9c2(0x13c)](_0x3d2b47)||_0x3d2b47<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x906d46[_0x11a318(0x14f)]())};}async function resolveSqlModeInput(_0x2a80b4){const _0x4d1bf9=a169_0x16da62,_0x3fc7d8=_0x2a80b4[_0x4d1bf9(0x170)](_0x4d1bf9(0x157))['trim']();if(_0x3fc7d8==='sql'||_0x3fc7d8===_0x4d1bf9(0x139))return _0x3fc7d8;if(_0x2a80b4[_0x4d1bf9(0x141)])throw CliErrors[_0x4d1bf9(0x132)]('mode',_0x4d1bf9(0x168));return await select({'message':_0x4d1bf9(0x158),'choices':[{'name':_0x4d1bf9(0x13d),'value':_0x4d1bf9(0x152),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0x4d1bf9(0x134),'value':_0x4d1bf9(0x139),'description':_0x4d1bf9(0x16f)}]});}function serializeDbSelection(_0x18d747){const _0x3239cb=a169_0x16da62;return JSON[_0x3239cb(0x16c)]({'dbId':_0x18d747[_0x3239cb(0x165)],'dbName':_0x18d747['dbName']});}function deserializeDbSelection(_0x19d581){const _0x191be4=a169_0x16da62;try{const _0x4979d8=JSON[_0x191be4(0x156)](_0x19d581);if(typeof _0x4979d8[_0x191be4(0x165)]===_0x191be4(0x151)&&Number[_0x191be4(0x143)](_0x4979d8[_0x191be4(0x165)]))return{'dbId':_0x4979d8[_0x191be4(0x165)],'dbName':_0x4979d8['dbName']};}catch{}throw CliErrors['validation'](_0x191be4(0x161)+_0x19d581);}function resolveProvidedDbId(_0x31ab73){const _0x3690ae=a169_0x16da62,_0x58f293=_0x31ab73['flag'](_0x3690ae(0x14e));if(typeof _0x58f293===_0x3690ae(0x151)&&Number[_0x3690ae(0x143)](_0x58f293))return _0x58f293;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a170_0x3b9a2c=a170_0x292b;(function(_0x2b3bc5,_0x23e2e6){const _0x170015=a170_0x292b,_0x4e1719=_0x2b3bc5();while(!![]){try{const _0x45a399=-parseInt(_0x170015(0x180))/0x1*(parseInt(_0x170015(0x15f))/0x2)+parseInt(_0x170015(0x164))/0x3+parseInt(_0x170015(0x161))/0x4+parseInt(_0x170015(0x165))/0x5*(-parseInt(_0x170015(0x170))/0x6)+parseInt(_0x170015(0x16c))/0x7+-parseInt(_0x170015(0x162))/0x8*(parseInt(_0x170015(0x181))/0x9)+parseInt(_0x170015(0x16d))/0xa*(parseInt(_0x170015(0x15d))/0xb);if(_0x45a399===_0x23e2e6)break;else _0x4e1719['push'](_0x4e1719['shift']());}catch(_0x791098){_0x4e1719['push'](_0x4e1719['shift']());}}}(a170_0x3951,0x230a5));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a170_0x292b(_0x460aaa,_0x5123ac){_0x460aaa=_0x460aaa-0x15a;const _0x395111=a170_0x3951();let _0x292b6f=_0x395111[_0x460aaa];return _0x292b6f;}import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a170_0x3b9a2c(0x17e),'command':'delete','description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a170_0x3b9a2c(0x17b),'flags':[SQLCODE_FLAG],async 'validate'(_0x3c2790){const _0xd0221d=a170_0x3b9a2c,_0x3b5cf0=loadSqlProjectConfig(_0x3c2790[_0xd0221d(0x178)]),_0x381a60=await readSqlLockFile(_0x3b5cf0[_0xd0221d(0x179)]);if(!_0x381a60)throw CliErrors[_0xd0221d(0x15c)](_0xd0221d(0x17f));},async 'dryRun'(_0x8248f){const _0x3d1cbd=a170_0x3b9a2c,_0x57b4b4=loadSqlProjectConfig(_0x8248f['appCode']),_0x27c4d4=await readSqlLockFile(_0x57b4b4[_0x3d1cbd(0x179)]);if(!_0x27c4d4)throw CliErrors[_0x3d1cbd(0x15c)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x316fd4}=ensureSqlLockScope(_0x27c4d4,_0x8248f['appCode'],_0x57b4b4['sqlRoot'],_0x3d1cbd(0x171)),_0x3b9a5a=_0x8248f[_0x3d1cbd(0x16f)]('sqlcode'),_0x1080c3=_0x316fd4[_0x3d1cbd(0x163)][_0x3b9a5a];if(!_0x1080c3)throw CliErrors[_0x3d1cbd(0x15c)](_0x3d1cbd(0x168)+_0x3b9a5a+'\x22.');return{'method':_0x3d1cbd(0x173),'url':_0x3d1cbd(0x176),'body':{'sqlCode':_0x3b9a5a,'id':_0x1080c3[_0x3d1cbd(0x17a)],'localPath':resolveLocalSqlFilePath(_0x57b4b4,_0x3b9a5a,_0x1080c3)},'description':_0x3d1cbd(0x15b)+_0x3b9a5a+_0x3d1cbd(0x174)+_0x57b4b4['trashDir']};},async 'execute'(_0x55bc0d){const _0x26f087=a170_0x3b9a2c,_0x570488=loadSqlProjectConfig(_0x55bc0d[_0x26f087(0x178)]),_0x4641df=await readSqlLockFile(_0x570488[_0x26f087(0x179)]);if(!_0x4641df)throw CliErrors[_0x26f087(0x15c)](_0x26f087(0x15e));const {lockData:_0x45e7eb,appLock:_0x28bed3}=ensureSqlLockScope(_0x4641df,_0x55bc0d[_0x26f087(0x178)],_0x570488[_0x26f087(0x15a)],_0x26f087(0x171)),_0x5d9a45=_0x55bc0d[_0x26f087(0x16f)](_0x26f087(0x166)),_0x589c0b=_0x28bed3[_0x26f087(0x163)][_0x5d9a45];if(!_0x589c0b)throw CliErrors['validation'](_0x26f087(0x168)+_0x5d9a45+'\x22.');await deleteSqlQuery({'id':_0x589c0b['remoteId'],'sqlCode':_0x5d9a45}),_0x28bed3[_0x26f087(0x163)]=Object[_0x26f087(0x172)](Object[_0x26f087(0x160)](_0x28bed3[_0x26f087(0x163)])[_0x26f087(0x169)](([_0x15cef4])=>_0x15cef4!==_0x5d9a45)),_0x28bed3[_0x26f087(0x16b)]=new Date()[_0x26f087(0x17d)](),await writeSqlLockFile(_0x570488[_0x26f087(0x179)],_0x45e7eb);const _0x4b1cc1=resolveLocalSqlFilePath(_0x570488,_0x5d9a45,_0x589c0b);let _0x4ef220;await fileExists(_0x4b1cc1)&&(_0x4ef220=await moveToTrash(_0x570488[_0x26f087(0x17c)],_0x570488['trashDir'],_0x4b1cc1),await cleanupEmptyDirectories(dirname(_0x4b1cc1),_0x570488[_0x26f087(0x177)]));const _0x53b023={'deleted':_0x5d9a45,'remoteId':_0x589c0b[_0x26f087(0x17a)]};if(_0x4ef220)_0x53b023[_0x26f087(0x16a)]=_0x4ef220;return{'ok':!![],'data':_0x53b023,'message':_0x26f087(0x16e)+_0x5d9a45+(_0x4ef220?_0x26f087(0x175):'')};}};async function moveToTrash(_0xa18c08,_0x1905a2,_0x4c9dd6){const _0x140fec=a170_0x3b9a2c,_0x1df598=new Date()[_0x140fec(0x17d)]()[_0x140fec(0x167)](/[:.]/g,'-'),_0x39eb9c=relative(_0xa18c08,_0x4c9dd6),_0x5b180a=join(_0x1905a2,_0x1df598,_0x39eb9c);return await mkdir(dirname(_0x5b180a),{'recursive':!![]}),await rename(_0x4c9dd6,_0x5b180a),_0x5b180a;}async function cleanupEmptyDirectories(_0x44fdcc,_0x38fc0d){let _0x3dea07=resolve(_0x44fdcc);const _0x295208=resolve(_0x38fc0d);while(_0x3dea07['startsWith'](''+_0x295208+sep)||_0x3dea07===_0x295208){if(_0x3dea07===_0x295208)return;try{const _0x5ecf1f=await readdir(_0x3dea07);if(_0x5ecf1f['length']>0x0)return;await rmdir(_0x3dea07);}catch{return;}_0x3dea07=dirname(_0x3dea07);}}function a170_0x3951(){const _0x3eaa51=['SQL\x20lock\x20file\x20not\x20found.','3934nuEENM','entries','230596ZYOZhx','16056tbFrRR','sqls','119793ajJJRN','527585ufmCjK','sqlcode','replace','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','filter','trashedTo','lastSync','1940876oSKvMX','3408790ivNuAL','Deleted\x20','str','6IheaeR','delete','fromEntries','POST','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','\x20(local\x20file\x20moved\x20to\x20trash)','/smartapi/custom/deleteUserCustomSql','sqlRootDir','appCode','lockFilePath','remoteId','high-risk-write','projectRoot','toISOString','sql','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','124sqzCDy','999VilElj','sqlRoot','Would\x20delete\x20SQL\x20','validation','11RnADct'];a170_0x3951=function(){return _0x3eaa51;};return a170_0x3951();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a171_0x1805f0=a171_0x3313;(function(_0x2f11c4,_0x50fa77){const _0x3b50e3=a171_0x3313,_0x4e0f23=_0x2f11c4();while(!![]){try{const _0x71a572=parseInt(_0x3b50e3(0x1c7))/0x1*(parseInt(_0x3b50e3(0x1c4))/0x2)+parseInt(_0x3b50e3(0x1bf))/0x3+parseInt(_0x3b50e3(0x1c3))/0x4+-parseInt(_0x3b50e3(0x1c1))/0x5*(-parseInt(_0x3b50e3(0x1ba))/0x6)+parseInt(_0x3b50e3(0x1bc))/0x7+parseInt(_0x3b50e3(0x1c2))/0x8+-parseInt(_0x3b50e3(0x1c5))/0x9;if(_0x71a572===_0x50fa77)break;else _0x4e0f23['push'](_0x4e0f23['shift']());}catch(_0x2f1174){_0x4e0f23['push'](_0x4e0f23['shift']());}}}(a171_0x590d,0xe68ad));function a171_0x590d(){const _0x447549=['appCode','Return\x20full\x20raw\x20SQL\x20query\x20object','452574oyyydJ','sql','2514099xwkpdp','verbose','str','4085337ZzAntq','read','5mdKtgy','5131312cDTeot','6357572Xtobhn','56plEfoT','40080987eBmeBg','sqlCode','48949PWJeLT','description','sqlContent','dbId','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','sqlName','bool'];a171_0x590d=function(){return _0x447549;};return a171_0x590d();}import{getSqlQueryInfo}from'../../core/api-client.js';function a171_0x3313(_0x31fd8a,_0x3544db){_0x31fd8a=_0x31fd8a-0x1b5;const _0x590df8=a171_0x590d();let _0x331369=_0x590df8[_0x31fd8a];return _0x331369;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a171_0x1805f0(0x1bb),'command':'detail','description':a171_0x1805f0(0x1b5),'risk':a171_0x1805f0(0x1c0),'flags':[SQLCODE_FLAG,{'name':a171_0x1805f0(0x1bd),'type':'boolean','description':a171_0x1805f0(0x1b9)}],async 'execute'(_0xab9d45){const _0x109598=a171_0x1805f0,_0x42c117=await getSqlQueryInfo(_0xab9d45[_0x109598(0x1b8)],_0xab9d45[_0x109598(0x1be)]('sqlcode')),_0x298bf4=_0xab9d45[_0x109598(0x1b7)](_0x109598(0x1bd));if(_0x298bf4)return{'ok':!![],'data':_0x42c117};const _0x387a04=_0x42c117[_0x109598(0x1ca)]?await getDbName(_0xab9d45['appCode'],_0x42c117[_0x109598(0x1ca)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x42c117[_0x109598(0x1c6)],'sqlName':_0x42c117[_0x109598(0x1b6)],'db':_0x387a04?_0x387a04+'\x20('+_0x42c117[_0x109598(0x1ca)]+')':_0x42c117['dbId']??'','description':_0x42c117[_0x109598(0x1c8)]??'','sqlContent':_0x42c117[_0x109598(0x1c9)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a172_0x38c5fb=a172_0x4b7a;(function(_0x30f750,_0x18c848){const _0xd3eed=a172_0x4b7a,_0xc2a186=_0x30f750();while(!![]){try{const _0x48bd50=-parseInt(_0xd3eed(0x135))/0x1+-parseInt(_0xd3eed(0x136))/0x2+-parseInt(_0xd3eed(0x139))/0x3*(parseInt(_0xd3eed(0x147))/0x4)+parseInt(_0xd3eed(0x149))/0x5*(parseInt(_0xd3eed(0x13b))/0x6)+-parseInt(_0xd3eed(0x148))/0x7+-parseInt(_0xd3eed(0x144))/0x8*(-parseInt(_0xd3eed(0x14b))/0x9)+parseInt(_0xd3eed(0x13d))/0xa*(parseInt(_0xd3eed(0x134))/0xb);if(_0x48bd50===_0x18c848)break;else _0xc2a186['push'](_0xc2a186['shift']());}catch(_0x39da58){_0xc2a186['push'](_0xc2a186['shift']());}}}(a172_0x4f4f,0xc1d9e));import{executeSql}from'../../core/api-client.js';function a172_0x4b7a(_0x2b201c,_0x307c0e){_0x2b201c=_0x2b201c-0x132;const _0x4f4f3b=a172_0x4f4f();let _0x4b7a7f=_0x4f4f3b[_0x2b201c];return _0x4b7a7f;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a172_0x4f4f(){const _0x5d80a2=['26644519oPTDbp','899805MCJLHQ','1596556TFXyVv','execError','sql','95022mHqSBY','SQL\x20execution\x20failed','6zlQNSf','read','10UmJKXk','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','str','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','now','execSuccess','string','3433448FRnxjo','sqlcode','\x20row(s)\x20in\x20','72xYGFSB','9442048GDqzPl','7798415ZlbyqU','length','9LSoAbT','appCode','execResult','params','Returned\x20'];a172_0x4f4f=function(){return _0x5d80a2;};return a172_0x4f4f();}export const sqlExec={'service':a172_0x38c5fb(0x138),'command':'exec','description':a172_0x38c5fb(0x13e),'risk':a172_0x38c5fb(0x13c),'flags':[SQLCODE_FLAG,{'name':a172_0x38c5fb(0x132),'type':a172_0x38c5fb(0x143),'description':a172_0x38c5fb(0x140)}],async 'execute'(_0x231c47){const _0x1e2284=a172_0x38c5fb,_0x1ae8e4=parseJsonParams(_0x231c47[_0x1e2284(0x13f)](_0x1e2284(0x132))),_0x5c56e7=Date[_0x1e2284(0x141)](),_0x3e42b6=await executeSql(_0x231c47[_0x1e2284(0x14c)],_0x231c47['str'](_0x1e2284(0x145)),_0x1ae8e4),_0x3fbd6e=Date[_0x1e2284(0x141)]()-_0x5c56e7,_0x520521=_0x3e42b6?.[_0x1e2284(0x14d)]??_0x3e42b6,_0x208dcf=_0x3e42b6?.[_0x1e2284(0x142)]??!![];if(!_0x208dcf)return{'ok':![],'data':{'error':_0x3e42b6?.[_0x1e2284(0x137)]||'SQL\x20execution\x20failed','elapsed':_0x3fbd6e},'message':_0x1e2284(0x13a)};const _0x45e733=Array['isArray'](_0x520521)?_0x520521:[];return{'ok':!![],'data':{'rows':_0x45e733,'rowCount':_0x45e733[_0x1e2284(0x14a)],'elapsed':_0x3fbd6e},'message':_0x1e2284(0x133)+_0x45e733[_0x1e2284(0x14a)]+_0x1e2284(0x146)+_0x3fbd6e+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x48f89b,_0x215389){const _0x3fe1b3=a173_0x457c,_0x5c3e09=_0x48f89b();while(!![]){try{const _0x39ae03=-parseInt(_0x3fe1b3(0x17f))/0x1*(-parseInt(_0x3fe1b3(0x17d))/0x2)+parseInt(_0x3fe1b3(0x17b))/0x3*(-parseInt(_0x3fe1b3(0x17e))/0x4)+parseInt(_0x3fe1b3(0x179))/0x5+parseInt(_0x3fe1b3(0x180))/0x6+parseInt(_0x3fe1b3(0x17c))/0x7*(parseInt(_0x3fe1b3(0x182))/0x8)+-parseInt(_0x3fe1b3(0x17a))/0x9+-parseInt(_0x3fe1b3(0x181))/0xa;if(_0x39ae03===_0x215389)break;else _0x5c3e09['push'](_0x5c3e09['shift']());}catch(_0x13f3f8){_0x5c3e09['push'](_0x5c3e09['shift']());}}}(a173_0x3781,0xd3582));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a173_0x3781(){const _0x17bf20=['6769953lMAvpQ','4038gTVvxQ','2758TIqGfI','9412vqxnYR','1244fZnIsr','305NqrOTb','76494nmelHz','8675020eogwjh','6592EcQobM','5656280dMYFVN'];a173_0x3781=function(){return _0x17bf20;};return a173_0x3781();}function a173_0x457c(_0x1bbf00,_0x4e7e09){_0x1bbf00=_0x1bbf00-0x179;const _0x378147=a173_0x3781();let _0x457cff=_0x378147[_0x1bbf00];return _0x457cff;}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
|
+
function a174_0x1022(){const _0x1fb5c1=['tableData','606677smepBE','appCode','745998NjLGaz','read','length','page','2051608tqtdya','boolean','4817029ZYQQsc','975955uhMLHh','string','2GLfjAk','bool','sqlName','num','description','dbId','sqlCode','paging','15279870nNrwZI','12GajyUX','str','4219956mehkTG','pagesize','List\x20custom\x20SQL\x20queries','all','sql','totalCount','Page\x20size','sqlcode','number','Filter\x20by\x20SQL\x20name','Page\x20number','6hBdpuq','name'];a174_0x1022=function(){return _0x1fb5c1;};return a174_0x1022();}const a174_0x301e5c=a174_0x32ba;function a174_0x32ba(_0x45aa9a,_0x1e0e1d){_0x45aa9a=_0x45aa9a-0x186;const _0x10226f=a174_0x1022();let _0x32baf8=_0x10226f[_0x45aa9a];return _0x32baf8;}(function(_0x1b9c3f,_0x451f60){const _0x993cd2=a174_0x32ba,_0x506b94=_0x1b9c3f();while(!![]){try{const _0x381900=-parseInt(_0x993cd2(0x186))/0x1+parseInt(_0x993cd2(0x191))/0x2*(-parseInt(_0x993cd2(0x188))/0x3)+-parseInt(_0x993cd2(0x19a))/0x4*(-parseInt(_0x993cd2(0x18f))/0x5)+parseInt(_0x993cd2(0x1a7))/0x6*(-parseInt(_0x993cd2(0x18e))/0x7)+parseInt(_0x993cd2(0x18c))/0x8+-parseInt(_0x993cd2(0x19c))/0x9+parseInt(_0x993cd2(0x199))/0xa;if(_0x381900===_0x451f60)break;else _0x506b94['push'](_0x506b94['shift']());}catch(_0x10a2fd){_0x506b94['push'](_0x506b94['shift']());}}}(a174_0x1022,0x57505));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a174_0x301e5c(0x1a0),'command':'list','description':a174_0x301e5c(0x19e),'risk':a174_0x301e5c(0x189),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a174_0x301e5c(0x1a8),'type':a174_0x301e5c(0x190),'description':a174_0x301e5c(0x1a5)},{'name':a174_0x301e5c(0x18b),'type':a174_0x301e5c(0x1a4),'description':a174_0x301e5c(0x1a6),'default':0x1},{'name':a174_0x301e5c(0x19d),'type':a174_0x301e5c(0x1a4),'description':a174_0x301e5c(0x1a2)},{'name':'verbose','type':a174_0x301e5c(0x18d),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x3f95fa){const _0x67e7a2=a174_0x301e5c,_0x25a3f8=await listSqlQueries(_0x3f95fa[_0x67e7a2(0x187)],{'sqlCode':_0x3f95fa[_0x67e7a2(0x19b)](_0x67e7a2(0x1a3))||undefined,'sqlName':_0x3f95fa['str']('name')||undefined,'currentPage':_0x3f95fa[_0x67e7a2(0x194)](_0x67e7a2(0x18b)),'pageSize':_0x3f95fa['num'](_0x67e7a2(0x19d),0x32)}),_0x2a741a=_0x3f95fa[_0x67e7a2(0x192)]('verbose'),_0x5d6e2c=_0x25a3f8[_0x67e7a2(0x1a9)]??[],_0x4ec37e=_0x25a3f8[_0x67e7a2(0x198)]?.[_0x67e7a2(0x1a1)]??_0x5d6e2c[_0x67e7a2(0x18a)];let _0x1fde1a;return _0x2a741a?_0x1fde1a=_0x5d6e2c:_0x1fde1a=await Promise[_0x67e7a2(0x19f)](_0x5d6e2c['map'](async _0x170f57=>{const _0x4c74b0=_0x67e7a2;let _0x2151fb;try{_0x2151fb=_0x170f57[_0x4c74b0(0x196)]?await getDbName(_0x3f95fa[_0x4c74b0(0x187)],_0x170f57[_0x4c74b0(0x196)]):undefined;}catch{}return{'sqlCode':_0x170f57[_0x4c74b0(0x197)],'sqlName':_0x170f57[_0x4c74b0(0x193)],'description':_0x170f57[_0x4c74b0(0x195)]??'','db':_0x2151fb?_0x2151fb+'\x20('+_0x170f57[_0x4c74b0(0x196)]+')':_0x170f57['dbId']??''};})),{'ok':!![],'data':_0x1fde1a,'message':_0x5d6e2c[_0x67e7a2(0x18a)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':'Found\x20'+_0x5d6e2c[_0x67e7a2(0x18a)]+'\x20SQL\x20queries\x20(total:\x20'+_0x4ec37e+').'};}};
|
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_0x5c0b10=a175_0x1283;(function(_0x5532e7,_0x84a1cd){const _0x526418=a175_0x1283,_0x324f7e=_0x5532e7();while(!![]){try{const _0x3df6e4=parseInt(_0x526418(0xf3))/0x1*(-parseInt(_0x526418(0x112))/0x2)+-parseInt(_0x526418(0xf7))/0x3+-parseInt(_0x526418(0x127))/0x4*(parseInt(_0x526418(0xeb))/0x5)+parseInt(_0x526418(0xf6))/0x6+parseInt(_0x526418(0x128))/0x7*(parseInt(_0x526418(0x122))/0x8)+parseInt(_0x526418(0x120))/0x9*(-parseInt(_0x526418(0xfd))/0xa)+parseInt(_0x526418(0x104))/0xb;if(_0x3df6e4===_0x84a1cd)break;else _0x324f7e['push'](_0x324f7e['shift']());}catch(_0x4719ca){_0x324f7e['push'](_0x324f7e['shift']());}}}(a175_0x338a,0x7bac1));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';function a175_0x1283(_0x20a4cb,_0xcab31b){_0x20a4cb=_0x20a4cb-0xeb;const _0x338a73=a175_0x338a();let _0x128365=_0x338a73[_0x20a4cb];return _0x128365;}function a175_0x338a(){const _0xb6d3cc=['description','length','Pull\x20complete:\x20','split','local\x20differs\x20from\x20remote','appCode','Filter\x20by\x20SQL\x20display\x20name','703146UzcyBD','boolean','paging','\x20SQL\x20file(s)\x20into\x20','apps','totalCount','conflict','sqls','filter','mybatisXml','force','sqlCode','sqlContent','utf8','99YBIwDl','test','8CdsCPj','str','No\x20remote\x20SQL\x20queries\x20matched.','nonInteractive','lastSync','320hkktEJ','2103423dfaRbw','28010WZWKRJ','skipped','dbId','Would\x20pull\x20','sqlRootDir','cancelled','\x20skipped,\x20','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','2boEOdt','message','toISOString','2132910tfTPzg','2552235uyqlxo','unchanged','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','\x20written,\x20','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','sql','255160zVkJrC','join','lockFilePath','push','catch','sqlcode','name','23466454oBdmbT','string','Force\x20pull\x20cancelled.','path','bool','tableData','sqlName'];a175_0x338a=function(){return _0xb6d3cc;};return a175_0x338a();}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(_0x4db385,_0x4ef990){const _0xd73da2=a175_0x1283,_0x3e0e6e=[];let _0x44f58a=0x1;while(!![]){const _0x5291b1=await listSqlQueries(_0x4db385,{'currentPage':_0x44f58a,'pageSize':PAGE_SIZE,'sqlCode':_0x4ef990[_0xd73da2(0x11d)],'sqlName':_0x4ef990[_0xd73da2(0x10a)]}),_0x2cddf3=_0x5291b1[_0xd73da2(0x109)]??[];_0x3e0e6e['push'](..._0x2cddf3);if(_0x2cddf3[_0xd73da2(0x10c)]===0x0)break;const _0x10ae12=_0x5291b1[_0xd73da2(0x114)]?.[_0xd73da2(0x117)];if(_0x10ae12!=null?_0x3e0e6e['length']>=_0x10ae12:_0x2cddf3[_0xd73da2(0x10c)]<PAGE_SIZE)break;_0x44f58a++;}return _0x3e0e6e;}async function ensureSqlContent(_0xe32b0b){const _0x162b70=a175_0x1283;if(_0xe32b0b[_0x162b70(0x11e)]!=null&&String(_0xe32b0b['sqlContent'])[_0x162b70(0x10c)]>0x0)return _0xe32b0b;return getSqlQueryDetail(_0xe32b0b[_0x162b70(0x11d)]);}export const sqlPull={'service':a175_0x5c0b10(0xfc),'command':'pull','description':a175_0x5c0b10(0xf2),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a175_0x5c0b10(0x103),'type':a175_0x5c0b10(0x105),'description':a175_0x5c0b10(0x111)},{'name':a175_0x5c0b10(0x11c),'type':a175_0x5c0b10(0x113),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0xeec843){const _0x40feed=a175_0x5c0b10,_0x1082d0=loadSqlProjectConfig(_0xeec843[_0x40feed(0x110)]),_0x19b0fe=await readSqlLockFile(_0x1082d0[_0x40feed(0xff)]),{appLock:_0x4312b3}=ensureSqlLockScope(_0x19b0fe??createEmptySqlLock(),_0x1082d0['appCode'],_0x1082d0['sqlRoot'],'pull'),_0x1183a1=await fetchAllSqlQueries(_0xeec843[_0x40feed(0x110)],{'sqlCode':_0xeec843[_0x40feed(0x123)](_0x40feed(0x102))||undefined,'sqlName':_0xeec843['str'](_0x40feed(0x103))||undefined}),_0x44887c=[];for(const _0x24dc82 of _0x1183a1){const _0x51a2f1=await ensureSqlContent(_0x24dc82),_0x44a1e4=ensureRemoteSqlContent(_0x51a2f1),_0x91f493=detectModeFromSql(_0x51a2f1),_0x793a7=_0x51a2f1[_0x40feed(0xed)]?await getDbName(_0xeec843[_0x40feed(0x110)],Number(_0x51a2f1[_0x40feed(0xed)]))[_0x40feed(0x101)](()=>undefined):undefined,_0x583803=buildLocalSqlFileContent({'sqlCode':_0x51a2f1['sqlCode'],'sqlName':_0x51a2f1[_0x40feed(0x10a)],'dbId':_0x51a2f1[_0x40feed(0xed)]},_0x44a1e4,{'dbName':_0x793a7,'mode':_0x91f493,'syncedAt':new Date()[_0x40feed(0xf5)](),'description':_0x51a2f1[_0x40feed(0x10b)]}),_0x281501=buildSqlLockEntry(_0x51a2f1,_0x44a1e4,'',{'dbName':_0x793a7}),_0x5be078=resolveLocalSqlFilePath(_0x1082d0,_0x51a2f1[_0x40feed(0x11d)],_0x281501);let _0x4c4a56='would_pull',_0x56bda4;if(await fileExists(_0x5be078)){const _0x1e8b44=await readFile(_0x5be078,'utf8');isEquivalentPulledSqlFile(_0x1e8b44,_0x583803,_0x91f493)?(_0x4c4a56=_0x40feed(0xec),_0x56bda4=_0x40feed(0xf8)):(_0x4c4a56=_0x40feed(0x118),_0x56bda4=_0x40feed(0xf9));}_0x44887c[_0x40feed(0x100)]({'sqlCode':_0x51a2f1['sqlCode'],'sqlName':_0x51a2f1[_0x40feed(0x10a)],'filePath':_0x5be078,'status':_0x4c4a56,'reason':_0x56bda4});}return{'method':'POST','url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0xeec843[_0x40feed(0x110)],'sqlCode':_0xeec843[_0x40feed(0x123)](_0x40feed(0x102))||null,'sqlName':_0xeec843[_0x40feed(0x123)](_0x40feed(0x103))||null,'files':_0x44887c},'description':_0x40feed(0xee)+_0x44887c['length']+_0x40feed(0x115)+_0x1082d0['sqlRootDir']};},async 'execute'(_0x1ff1d0){const _0x1bdd0c=a175_0x5c0b10,_0x15784c=loadSqlProjectConfig(_0x1ff1d0[_0x1bdd0c(0x110)]),_0x44c1af=await readSqlLockFile(_0x15784c[_0x1bdd0c(0xff)]),{lockData:_0x5b7790,appLock:_0x472984}=ensureSqlLockScope(_0x44c1af??createEmptySqlLock(),_0x15784c[_0x1bdd0c(0x110)],_0x15784c['sqlRoot'],'pull'),_0x23e534=_0x1ff1d0[_0x1bdd0c(0x108)](_0x1bdd0c(0x11c)),_0x2a3e28=await fetchAllSqlQueries(_0x1ff1d0[_0x1bdd0c(0x110)],{'sqlCode':_0x1ff1d0[_0x1bdd0c(0x123)](_0x1bdd0c(0x102))||undefined,'sqlName':_0x1ff1d0[_0x1bdd0c(0x123)](_0x1bdd0c(0x103))||undefined});if(_0x2a3e28[_0x1bdd0c(0x10c)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x1bdd0c(0x124)};const _0x3eec4e=[],_0xd5f6aa=[];for(const _0x3d5958 of _0x2a3e28){try{_0x3eec4e[_0x1bdd0c(0x100)](await ensureSqlContent(_0x3d5958));}catch(_0x106153){_0xd5f6aa[_0x1bdd0c(0x100)]({'sqlCode':_0x3d5958[_0x1bdd0c(0x11d)],'error':_0x106153 instanceof Error?_0x106153['message']:String(_0x106153)});}}if(_0x23e534&&!_0x1ff1d0[_0x1bdd0c(0x125)]){let _0x2fc35c=![];for(const _0x3db350 of _0x3eec4e){const _0x4a9449=detectModeFromSql(_0x3db350),_0x44c01c=_0x3db350[_0x1bdd0c(0xed)]?await getDbName(_0x1ff1d0[_0x1bdd0c(0x110)],Number(_0x3db350[_0x1bdd0c(0xed)]))[_0x1bdd0c(0x101)](()=>undefined):undefined,_0x23a0b7=buildLocalSqlFileContent({'sqlCode':_0x3db350[_0x1bdd0c(0x11d)],'sqlName':_0x3db350[_0x1bdd0c(0x10a)],'dbId':_0x3db350['dbId']},ensureRemoteSqlContent(_0x3db350),{'dbName':_0x44c01c,'mode':_0x4a9449,'syncedAt':new Date()[_0x1bdd0c(0xf5)](),'description':_0x3db350['description']}),_0x68e232=resolveLocalSqlFilePath(_0x15784c,_0x3db350['sqlCode'],buildSqlLockEntry(_0x3db350,ensureRemoteSqlContent(_0x3db350),'',{'dbName':_0x44c01c}));if(await fileExists(_0x68e232)){const _0x8810ec=await readFile(_0x68e232,_0x1bdd0c(0x11f));if(!isEquivalentPulledSqlFile(_0x8810ec,_0x23a0b7,_0x4a9449)){_0x2fc35c=!![];break;}}}if(_0x2fc35c){const _0x480994=await confirmForceOverwrite(_0x1bdd0c(0xfb));if(!_0x480994)throw CliErrors[_0x1bdd0c(0xf0)](_0x1bdd0c(0x106));}}const _0x5e83d2=cloneSqlLockData(_0x5b7790),_0x1be192=_0x5e83d2[_0x1bdd0c(0x116)][_0x15784c['appCode']],_0x2e35a8=[],_0x4842a1=[];for(const _0x51668a of _0x3eec4e){const _0x56701b=_0x1be192['sqls'][_0x51668a[_0x1bdd0c(0x11d)]],_0x26d4b8=ensureRemoteSqlContent(_0x51668a),_0x31439f=detectModeFromSql(_0x51668a),_0x4aa7a7=_0x51668a['dbId']?await getDbName(_0x1ff1d0[_0x1bdd0c(0x110)],Number(_0x51668a[_0x1bdd0c(0xed)]))[_0x1bdd0c(0x101)](()=>undefined):undefined,_0x5b8f83=buildLocalSqlFileContent({'sqlCode':_0x51668a[_0x1bdd0c(0x11d)],'sqlName':_0x51668a[_0x1bdd0c(0x10a)],'dbId':_0x51668a['dbId']},_0x26d4b8,{'dbName':_0x4aa7a7,'mode':_0x31439f,'syncedAt':new Date()['toISOString'](),'description':_0x51668a['description']}),_0x19a3da=buildSqlLockEntry(_0x51668a,_0x26d4b8,computeSqlContentHash(_0x5b8f83),{'dbName':_0x4aa7a7}),_0xa14dfe=_0x19a3da[_0x1bdd0c(0x107)],_0x21f153=join(_0x15784c[_0x1bdd0c(0xef)],_0xa14dfe);try{if(await fileExists(_0x21f153)){const _0x3a1e2d=await readFile(_0x21f153,'utf8');if(isEquivalentPulledSqlFile(_0x3a1e2d,_0x5b8f83,_0x31439f)){_0x4842a1[_0x1bdd0c(0x100)]({'sqlCode':_0x51668a['sqlCode'],'reason':'unchanged'}),_0x1be192[_0x1bdd0c(0x119)][_0x51668a[_0x1bdd0c(0x11d)]]={..._0x19a3da,'hash':computeSqlContentHash(_0x3a1e2d),'path':_0xa14dfe};continue;}if(!_0x23e534){_0x4842a1[_0x1bdd0c(0x100)]({'sqlCode':_0x51668a[_0x1bdd0c(0x11d)],'reason':_0x1bdd0c(0x10f)});continue;}}const _0x22adaa=_0x56701b?.[_0x1bdd0c(0x107)]?join(_0x15784c[_0x1bdd0c(0xef)],_0x56701b[_0x1bdd0c(0x107)]):undefined;_0x22adaa&&_0x22adaa!==_0x21f153&&await fileExists(_0x22adaa)&&await rm(_0x22adaa,{'force':!![]}),await ensureParentDirectory(_0x21f153),await writeFile(_0x21f153,_0x5b8f83,_0x1bdd0c(0x11f)),_0x1be192[_0x1bdd0c(0x119)][_0x51668a[_0x1bdd0c(0x11d)]]={..._0x19a3da,'path':_0xa14dfe},_0x2e35a8['push']({'sqlCode':_0x51668a['sqlCode'],'filePath':_0x21f153});}catch(_0x36d9de){_0xd5f6aa[_0x1bdd0c(0x100)]({'sqlCode':_0x51668a['sqlCode'],'error':_0x36d9de instanceof Error?_0x36d9de[_0x1bdd0c(0xf4)]:String(_0x36d9de)});}}return _0x1be192[_0x1bdd0c(0x126)]=new Date()['toISOString'](),await writeSqlLockFile(_0x15784c['lockFilePath'],_0x5e83d2),{'ok':_0xd5f6aa[_0x1bdd0c(0x10c)]===0x0,'data':{'pulled':_0x2e35a8,'skipped':_0x4842a1,'failed':_0xd5f6aa},'message':_0x1bdd0c(0x10d)+_0x2e35a8[_0x1bdd0c(0x10c)]+_0x1bdd0c(0xfa)+_0x4842a1[_0x1bdd0c(0x10c)]+_0x1bdd0c(0xf1)+_0xd5f6aa[_0x1bdd0c(0x10c)]+'\x20failed'};}};function detectModeFromSql(_0x2d0ffd){const _0x3dbc9f=a175_0x5c0b10,_0x136cbf=ensureRemoteSqlContent(_0x2d0ffd),_0x56fe60=stripLocalSqlMetadata(_0x136cbf,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x3dbc9f(0x121)](_0x56fe60))return _0x3dbc9f(0x11b);return _0x3dbc9f(0xfc);}function isEquivalentPulledSqlFile(_0x27bb11,_0x1ffcea,_0x47b95e){return normalizePullComparableContent(_0x27bb11,_0x47b95e)===normalizePullComparableContent(_0x1ffcea,_0x47b95e);}function normalizePullComparableContent(_0x27a438,_0x51de48){const _0x5eea73=a175_0x5c0b10,_0x125674=_0x27a438['replace'](/\r\n/g,'\x0a')[_0x5eea73(0x10e)]('\x0a'),_0x326207=_0x125674[_0x5eea73(0x11a)](_0x3b67dc=>!isSyncedAtMetadataLine(_0x3b67dc,_0x51de48));return _0x326207[_0x5eea73(0xfe)]('\x0a');}function isSyncedAtMetadataLine(_0x304878,_0xf38e1a){const _0x51e5a9=a175_0x5c0b10;if(_0xf38e1a===_0x51e5a9(0x11b))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x51e5a9(0x121)](_0x304878);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x51e5a9(0x121)](_0x304878);}
|