@lovrabet/rabetbase-cli 2.3.8 → 2.3.9-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/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/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/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/shared/compare-table.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/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/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/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/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-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/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
package/lib/commands/registry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a143_0x3b6e74=a143_0x89b1;(function(_0x4eb566,_0x3935ef){const _0x5d9abc=a143_0x89b1,_0x4c86c5=_0x4eb566();while(!![]){try{const _0x1c9df1=parseInt(_0x5d9abc(0xb5))/0x1+-parseInt(_0x5d9abc(0xab))/0x2*(parseInt(_0x5d9abc(0xb8))/0x3)+-parseInt(_0x5d9abc(0xd3))/0x4+parseInt(_0x5d9abc(0xc3))/0x5*(parseInt(_0x5d9abc(0x9b))/0x6)+-parseInt(_0x5d9abc(0xaf))/0x7*(parseInt(_0x5d9abc(0xa0))/0x8)+parseInt(_0x5d9abc(0xc0))/0x9*(parseInt(_0x5d9abc(0x96))/0xa)+parseInt(_0x5d9abc(0xb4))/0xb;if(_0x1c9df1===_0x3935ef)break;else _0x4c86c5['push'](_0x4c86c5['shift']());}catch(_0x139318){_0x4c86c5['push'](_0x4c86c5['shift']());}}}(a143_0x2a8c,0x9a7fd));import{apiDefinitions}from'../commands/api/index.js';import{bffDefinitions}from'../commands/bff/index.js';import{sqlDefinitions}from'../commands/sql/index.js';import{datasetDefinitions}from'../commands/dataset/index.js';function a143_0x89b1(_0x1d723d,_0x275695){_0x1d723d=_0x1d723d-0x91;const _0x2a8c2e=a143_0x2a8c();let _0x89b1fc=_0x2a8c2e[_0x1d723d];return _0x89b1fc;}import{pageDefinitions}from'../commands/page/index.js';import{dataDefinitions}from'../commands/data/index.js';import{dbDefinitions}from'../commands/db/index.js';import{codegenDefinitions}from'../commands/codegen/index.js';import{menuDefinitions}from'../commands/menu/index.js';import{roleDefinitions}from'../commands/role/index.js';import{permitDefinitions}from'../commands/permit/index.js';import{appDefinitions}from'../commands/app/index.js';import{appConfigDefinitions}from'../commands/app-config/index.js';import{notificationDefinitions}from'../commands/notification/index.js';import{workspaceDefinitions}from'../commands/workspace/index.js';import{configDefinitions}from'../commands/config/index.js';import{doctorDefinition}from'../commands/doctor.js';import{updateDefinition}from'../commands/cli-update.js';import{schemaDefinition}from'../commands/schema.js';import{issueDefinitions}from'../commands/issue/index.js';import{fileDefinitions}from'../commands/file/index.js';import{cliSkillDefinitions}from'../commands/cli-skill/index.js';import{authDefinitions}from'../commands/auth/index.js';import{logsDefinitions}from'../commands/logs/index.js';import{projectDefinitions}from'../commands/project/index.js';import{initDefinitions}from'../commands/init/index.js';import{runDefinition}from'../commands/run/index.js';export const serviceRegistry=[];const serviceByName=new Map();function a143_0x2a8c(){const _0x405217=['Menu','Roles','get','1190120zybxXz','`rabetbase\x20app\x20use`\x20has\x20been\x20removed.','Diagnostics','Dataset\x20&\x20Operations','CLI\x20Built-in\x20Skill','96306nDhVPh','Run\x20Scripts','auth','read','App\x20Management','1992UrNfiZ','remote','wildcardDef','hidden','values','start','skill','\x20\x20[high-risk-write]','project','filter','set','291464EPMgFz','Smart\x20List\x20Pages','Use\x20`rabetbase\x20app\x20list\x20--remote`\x20instead.','preview','917QTSJms','service','<script>','build','Code\x20Generation','12029611uvrzyU','477352YkVvFA','Configuration','run','15wBjuoy','write','Permissions','Runtime\x20App\x20Config\x20Management','`rabetbase\x20app\x20remote`\x20has\x20been\x20removed.','map','Platform\x20Issue','login','27OQugMb','app\x20use','has','145hXFNLd','Self\x20Update','risk','commands','\x20\x20[write]','skills','app','Schema','API\x20Development','description','skill\x20','Run\x20any\x20package.json\x20script','command','Workspace','`rabetbase\x20skills`\x20has\x20been\x20removed.','Instant\x20API','3997440EzvZgQ','Project','length','isSingleCommand','Use\x20`rabetbase\x20workspace\x20use\x20--app\x20<name>`\x20instead.','create'];a143_0x2a8c=function(){return _0x405217;};return a143_0x2a8c();}export const definitions=new Map();export const serviceGroups=new Map();function registerDefinitions(_0x50d747){const _0x41ff7e=a143_0x89b1;for(const _0x5ca7e2 of _0x50d747){definitions['set'](_0x5ca7e2['service']+':'+_0x5ca7e2[_0x41ff7e(0xcf)],_0x5ca7e2);let _0x4436d9=serviceGroups['get'](_0x5ca7e2[_0x41ff7e(0xb0)]);!_0x4436d9&&(_0x4436d9=[],serviceGroups[_0x41ff7e(0xaa)](_0x5ca7e2[_0x41ff7e(0xb0)],_0x4436d9)),_0x4436d9['push'](_0x5ca7e2);}}function registerDeclarativeService(_0x3817a2,_0x32f665,_0x1d0a4b){const _0x16fc9c=a143_0x89b1;registerDefinitions(_0x32f665);_0x1d0a4b?.[_0x16fc9c(0xa2)]&®isterDefinitions([_0x1d0a4b[_0x16fc9c(0xa2)]]);const _0x7907cc=_0x3ec791=>_0x3ec791===_0x16fc9c(0x9e)?'':_0x3ec791===_0x16fc9c(0xb9)?_0x16fc9c(0xc7):_0x16fc9c(0xa7),_0x4a3913={'service':_0x32f665[0x0][_0x16fc9c(0xb0)],'label':_0x3817a2,'commands':_0x32f665[_0x16fc9c(0xa9)](_0x54ac7d=>!_0x54ac7d[_0x16fc9c(0xa3)])[_0x16fc9c(0xbd)](_0x4cc11d=>({'command':_0x4cc11d[_0x16fc9c(0xcf)],'description':_0x4cc11d[_0x16fc9c(0xcc)],'tag':_0x7907cc(_0x4cc11d[_0x16fc9c(0xc5)])})),'declarative':!![],'defaultCommand':_0x1d0a4b?.['defaultCommand']??(_0x1d0a4b?.[_0x16fc9c(0xd6)]?_0x32f665[0x0][_0x16fc9c(0xcf)]:undefined),'wildcardDef':_0x1d0a4b?.[_0x16fc9c(0xa2)],'isSingleCommand':_0x1d0a4b?.[_0x16fc9c(0xd6)]};serviceRegistry['push'](_0x4a3913),serviceByName[_0x16fc9c(0xaa)](_0x4a3913[_0x16fc9c(0xb0)],_0x4a3913);}registerDeclarativeService('Quick\x20Start',initDefinitions,{'defaultCommand':'run','isSingleCommand':!![]}),registerDeclarativeService(a143_0x3b6e74(0xd4),projectDefinitions),registerDeclarativeService(a143_0x3b6e74(0xd0),workspaceDefinitions),registerDeclarativeService(a143_0x3b6e74(0x9f),appDefinitions),registerDeclarativeService('Authentication',authDefinitions,{'defaultCommand':a143_0x3b6e74(0xbf)}),registerDeclarativeService(a143_0x3b6e74(0x99),datasetDefinitions),registerDeclarativeService(a143_0x3b6e74(0xac),pageDefinitions),registerDeclarativeService(a143_0x3b6e74(0xcb),apiDefinitions),registerDeclarativeService(a143_0x3b6e74(0xd2),dataDefinitions),registerDeclarativeService('BFF\x20Scripts',bffDefinitions),registerDeclarativeService('Notification\x20Configuration',notificationDefinitions),registerDeclarativeService('SQL\x20Queries',sqlDefinitions),registerDeclarativeService('Database\x20Connections',dbDefinitions),registerDeclarativeService(a143_0x3b6e74(0x93),menuDefinitions),registerDeclarativeService(a143_0x3b6e74(0x94),roleDefinitions),registerDeclarativeService(a143_0x3b6e74(0xba),permitDefinitions),registerDeclarativeService(a143_0x3b6e74(0xbb),appConfigDefinitions),registerDeclarativeService(a143_0x3b6e74(0xbe),issueDefinitions),registerDeclarativeService('File',fileDefinitions),registerDeclarativeService(a143_0x3b6e74(0xb3),codegenDefinitions),registerDeclarativeService(a143_0x3b6e74(0xb6),configDefinitions),registerDeclarativeService(a143_0x3b6e74(0x98),[doctorDefinition],{'isSingleCommand':!![]}),registerDeclarativeService(a143_0x3b6e74(0xca),[schemaDefinition],{'isSingleCommand':!![]}),registerDeclarativeService(a143_0x3b6e74(0xc4),[updateDefinition],{'isSingleCommand':!![]}),registerDeclarativeService(a143_0x3b6e74(0x9a),cliSkillDefinitions,{'defaultCommand':'install'}),registerDeclarativeService('Logs',logsDefinitions,{'defaultCommand':'show'}),registerDeclarativeService(a143_0x3b6e74(0x9c),[runDefinition],{'wildcardDef':runDefinition});{const last=serviceRegistry[serviceRegistry[a143_0x3b6e74(0xd5)]-0x1];last[a143_0x3b6e74(0xc6)]=[{'command':a143_0x3b6e74(0xb1),'description':a143_0x3b6e74(0xce),'tag':''}];}export const deprecatedAliases={'create':{'service':a143_0x3b6e74(0xa8),'command':a143_0x3b6e74(0x92)},'start':{'service':'run','command':a143_0x3b6e74(0xa5)},'build':{'service':a143_0x3b6e74(0xb7),'command':a143_0x3b6e74(0xb2)},'preview':{'service':a143_0x3b6e74(0xb7),'command':a143_0x3b6e74(0xae)},'logout':{'service':a143_0x3b6e74(0x9d),'command':'logout'}};const CLI_SKILL_INSTALL_REMOVED_HINT='Use\x20`rabetbase\x20cli-skill\x20install`\x20to\x20refresh\x20the\x20Rabetbase\x20CLI\x20Built-in\x20Skill.\x20To\x20install\x20business\x20Skills,\x20use\x20`lovrabet\x20skill\x20install`.',APP_REMOTE_REMOVED_HINT=a143_0x3b6e74(0xad),APP_USE_REMOVED_HINT=a143_0x3b6e74(0x91);export function resolveRemovedCommand(_0x427417,_0x43c410){const _0x48b34a=a143_0x3b6e74;if(_0x427417===_0x48b34a(0xa6)){const _0x4bcefe=_0x43c410?_0x48b34a(0xcd)+_0x43c410:_0x48b34a(0xa6);return{'command':_0x4bcefe,'message':'`rabetbase\x20'+_0x4bcefe+'`\x20has\x20been\x20removed.','hint':CLI_SKILL_INSTALL_REMOVED_HINT};}if(_0x427417===_0x48b34a(0xc8))return{'command':_0x48b34a(0xc8),'message':_0x48b34a(0xd1),'hint':CLI_SKILL_INSTALL_REMOVED_HINT};if(_0x427417==='app'&&_0x43c410===_0x48b34a(0xa1))return{'command':'app\x20remote','message':_0x48b34a(0xbc),'hint':APP_REMOTE_REMOVED_HINT};if(_0x427417===_0x48b34a(0xc9)&&_0x43c410==='use')return{'command':_0x48b34a(0xc1),'message':_0x48b34a(0x97),'hint':APP_USE_REMOVED_HINT};return undefined;}export const deprecatedSubcommands={'bff':{'new':a143_0x3b6e74(0x92)},'sql':{'new':a143_0x3b6e74(0x92)}};export function resolveDeprecatedSubcommand(_0x25cac1,_0x43151f){return deprecatedSubcommands[_0x25cac1]?.[_0x43151f];}export function findDefinition(_0x508f6d,_0x3bb658){return definitions['get'](_0x508f6d+':'+_0x3bb658);}export function isKnownService(_0x40528c){const _0x16f794=a143_0x3b6e74;return serviceByName[_0x16f794(0xc2)](_0x40528c);}export function isDeclarativeService(_0x554653){const _0x60399=a143_0x3b6e74;return serviceGroups[_0x60399(0xc2)](_0x554653)||serviceByName[_0x60399(0x95)](_0x554653)?.[_0x60399(0xa2)]!==undefined;}export function getServiceEntry(_0x45312a){const _0x21619d=a143_0x3b6e74;return serviceByName[_0x21619d(0x95)](_0x45312a);}export function getLegacyHandler(_0x289d81,_0x53071c){return undefined;}export function getAllDefinitions(){const _0x2ed28d=a143_0x3b6e74;return Array['from'](definitions[_0x2ed28d(0xa4)]());}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a144_0x49c68e=a144_0x4e63;function a144_0x4e63(_0x471f69,_0x7b65b){_0x471f69=_0x471f69-0x1ae;const _0x443880=a144_0x4438();let _0x4e6357=_0x443880[_0x471f69];return _0x4e6357;}(function(_0x32230a,_0x46f06d){const _0xcf6159=a144_0x4e63,_0x438e93=_0x32230a();while(!![]){try{const _0x28e862=parseInt(_0xcf6159(0x1c5))/0x1*(parseInt(_0xcf6159(0x1c2))/0x2)+parseInt(_0xcf6159(0x1b8))/0x3*(parseInt(_0xcf6159(0x1c3))/0x4)+-parseInt(_0xcf6159(0x1ca))/0x5+-parseInt(_0xcf6159(0x1b5))/0x6*(-parseInt(_0xcf6159(0x1af))/0x7)+parseInt(_0xcf6159(0x1b7))/0x8*(-parseInt(_0xcf6159(0x1c4))/0x9)+-parseInt(_0xcf6159(0x1c1))/0xa+-parseInt(_0xcf6159(0x1bb))/0xb*(-parseInt(_0xcf6159(0x1c0))/0xc);if(_0x28e862===_0x46f06d)break;else _0x438e93['push'](_0x438e93['shift']());}catch(_0xa686d0){_0x438e93['push'](_0x438e93['shift']());}}}(a144_0x4438,0x6378b));import{createAppRole}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{NAME_FLAG,REMARK_FLAG,projectRole}from'../../commands/role/shared.js';const CREATE_PATH=a144_0x49c68e(0x1b9);function readName(_0x1056d6){const _0x35c8bb=a144_0x49c68e,_0x421cfd=_0x1056d6[_0x35c8bb(0x1c7)](_0x35c8bb(0x1b0))[_0x35c8bb(0x1bf)]();if(!_0x421cfd)throw CliErrors[_0x35c8bb(0x1b3)](_0x35c8bb(0x1b0),_0x35c8bb(0x1c9));if(_0x421cfd['length']>0x40)throw CliErrors[_0x35c8bb(0x1ae)](_0x35c8bb(0x1be));return _0x421cfd;}function a144_0x4438(){const _0x2d6433=['2017770uERqFr','CUSTOM','Create\x20a\x20CUSTOM\x20user\x20group\x20(role)','validation','1448153UBbzvV','name','appCode','roleName','flagMissing','Created\x20role\x20','6KTKTgS','POST','975048fxXkaZ','138UekOXM','/smartapi/permit/role/create','\x20(id=','646184YohNIn','remark','create','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','trim','132xijoQv','6538980pFmjog','156TBltuR','21820VvvFqV','18pWNfyf','7752IuAKym','role','str','write','Pass\x20--name\x20<roleName>.'];a144_0x4438=function(){return _0x2d6433;};return a144_0x4438();}export const roleCreate={'service':a144_0x49c68e(0x1c6),'command':a144_0x49c68e(0x1bd),'description':a144_0x49c68e(0x1cc),'risk':a144_0x49c68e(0x1c8),'flags':[NAME_FLAG,REMARK_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x54e55b){readName(_0x54e55b);},async 'dryRun'(_0x188135){const _0x29f99f=a144_0x49c68e,_0xb43faa=readName(_0x188135),_0x42ecbb=_0x188135[_0x29f99f(0x1c7)](_0x29f99f(0x1bc))[_0x29f99f(0x1bf)]()||undefined;return asDryRunResult({'operation':_0x29f99f(0x1bd),'selector':{'appCode':_0x188135[_0x29f99f(0x1b1)],'roleName':_0xb43faa},'before':null,'after':{'roleName':_0xb43faa,'roleType':_0x29f99f(0x1cb),'remark':_0x42ecbb},'dryRun':!![],'backend':{'method':'POST','path':CREATE_PATH},'warnings':[]},{'method':_0x29f99f(0x1b6),'url':CREATE_PATH});},async 'execute'(_0x3c9e08){const _0x1d2087=a144_0x49c68e,_0x3d01b3=readName(_0x3c9e08),_0x26ee2c=_0x3c9e08['str']('remark')[_0x1d2087(0x1bf)]()||undefined,_0x212247=await createAppRole({'appCode':_0x3c9e08[_0x1d2087(0x1b1)],'roleName':_0x3d01b3,..._0x26ee2c?{'remark':_0x26ee2c}:{}});return{'ok':!![],'data':{'operation':_0x1d2087(0x1bd),'selector':{'appCode':_0x3c9e08[_0x1d2087(0x1b1)],'roleId':_0x212247['id'],'roleName':_0x3d01b3},'before':null,'after':projectRole(_0x212247),'dryRun':![],'backend':{'method':_0x1d2087(0x1b6),'path':CREATE_PATH},'warnings':[]},'message':_0x1d2087(0x1b4)+_0x212247[_0x1d2087(0x1b2)]+_0x1d2087(0x1ba)+_0x212247['id']+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a145_0x525e(_0x33e120,_0x48ee3c){_0x33e120=_0x33e120-0x1a1;const _0x523f37=a145_0x523f();let _0x525ef6=_0x523f37[_0x33e120];return _0x525ef6;}const a145_0x30bd18=a145_0x525e;(function(_0x410289,_0x3f4bf5){const _0x56cb30=a145_0x525e,_0x2c5daf=_0x410289();while(!![]){try{const _0x513499=parseInt(_0x56cb30(0x1a4))/0x1+-parseInt(_0x56cb30(0x1b6))/0x2+-parseInt(_0x56cb30(0x1b5))/0x3*(parseInt(_0x56cb30(0x1a5))/0x4)+parseInt(_0x56cb30(0x1af))/0x5*(-parseInt(_0x56cb30(0x1aa))/0x6)+-parseInt(_0x56cb30(0x1a7))/0x7*(-parseInt(_0x56cb30(0x1b4))/0x8)+parseInt(_0x56cb30(0x1ae))/0x9+parseInt(_0x56cb30(0x1b1))/0xa;if(_0x513499===_0x3f4bf5)break;else _0x2c5daf['push'](_0x2c5daf['shift']());}catch(_0x5c4d2d){_0x2c5daf['push'](_0x2c5daf['shift']());}}}(a145_0x523f,0x729fc));import{deleteAppRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,ROLE_ID_FLAG}from'../../commands/role/shared.js';const DELETE_PATH=a145_0x30bd18(0x1ac);export const roleDelete={'service':a145_0x30bd18(0x1a2),'command':a145_0x30bd18(0x1a8),'description':a145_0x30bd18(0x1b0),'risk':a145_0x30bd18(0x1a6),'flags':[ROLE_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x59c14c){const _0x2c41fe=a145_0x30bd18,_0x56ba41=_0x59c14c[_0x2c41fe(0x1a1)]('id'),_0x2e8de0=await getRoleById(_0x59c14c[_0x2c41fe(0x1b3)],_0x56ba41);return assertCustomRole(_0x2e8de0,'delete'),asDryRunResult({'operation':_0x2c41fe(0x1a8),'selector':{'appCode':_0x59c14c['appCode'],'roleId':_0x56ba41,'roleName':_0x2e8de0['roleName']},'before':projectRole(_0x2e8de0),'after':null,'dryRun':!![],'backend':{'method':_0x2c41fe(0x1ad),'path':DELETE_PATH},'warnings':_0x2e8de0['userCount']>0x0?['Role\x20still\x20has\x20'+_0x2e8de0['userCount']+_0x2c41fe(0x1b2)]:[]},{'method':'POST','url':DELETE_PATH});},async 'execute'(_0x4e0bce){const _0x349fcc=a145_0x30bd18,_0x3c9d2d=_0x4e0bce[_0x349fcc(0x1a1)]('id'),_0x3a14af=await getRoleById(_0x4e0bce[_0x349fcc(0x1b3)],_0x3c9d2d);return assertCustomRole(_0x3a14af,_0x349fcc(0x1a8)),await deleteAppRole(_0x3c9d2d),{'ok':!![],'data':{'operation':_0x349fcc(0x1a8),'selector':{'appCode':_0x4e0bce[_0x349fcc(0x1b3)],'roleId':_0x3c9d2d,'roleName':_0x3a14af[_0x349fcc(0x1a9)]},'before':projectRole(_0x3a14af),'after':null,'dryRun':![],'backend':{'method':_0x349fcc(0x1ad),'path':DELETE_PATH},'warnings':[]},'message':_0x349fcc(0x1ab)+_0x3a14af['roleName']+_0x349fcc(0x1a3)+_0x3c9d2d+')'};}};function a145_0x523f(){const _0x412635=['147770XSPwGQ','Delete\x20a\x20CUSTOM\x20role\x20(DEV/ADMIN\x20rejected);\x20requires\x20--yes','2314760gChxGM','\x20member(s);\x20they\x20will\x20lose\x20this\x20group.','appCode','515048MkCrEy','21606IaPuOI','606700MVklCb','num','role','\x20(id=','645789UdAVFE','512mvmuJm','high-risk-write','21IFMswN','delete','roleName','42znnWyX','Deleted\x20role\x20','/smartapi/permit/role/delete','POST','7480584qtaNFm'];a145_0x523f=function(){return _0x412635;};return a145_0x523f();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a146_0x1d0166=a146_0xb643;function a146_0xccad(){const _0x12eb24=['roleType','7rIkdtv','586455tQVQWz','6EsuHxx','1803568YXlooc','Show\x20a\x20single\x20role\x27s\x20detail','6490930TbsbSJ','794836WfdCJA','1304296xZWADK','role','9zPxsza','4174fnmIMS','num','detail','909750qIGCCP'];a146_0xccad=function(){return _0x12eb24;};return a146_0xccad();}(function(_0x4ac759,_0x20e8cf){const _0x5437f1=a146_0xb643,_0x1a6e67=_0x4ac759();while(!![]){try{const _0x330576=-parseInt(_0x5437f1(0xe4))/0x1*(parseInt(_0x5437f1(0xee))/0x2)+parseInt(_0x5437f1(0xe2))/0x3+parseInt(_0x5437f1(0xeb))/0x4+parseInt(_0x5437f1(0xe5))/0x5+parseInt(_0x5437f1(0xe6))/0x6*(-parseInt(_0x5437f1(0xea))/0x7)+parseInt(_0x5437f1(0xe7))/0x8+parseInt(_0x5437f1(0xed))/0x9*(-parseInt(_0x5437f1(0xe9))/0xa);if(_0x330576===_0x20e8cf)break;else _0x1a6e67['push'](_0x1a6e67['shift']());}catch(_0xf37502){_0x1a6e67['push'](_0x1a6e67['shift']());}}}(a146_0xccad,0x2f8fb));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a146_0xb643(_0x53498d,_0x3d902d){_0x53498d=_0x53498d-0xe2;const _0xccad0=a146_0xccad();let _0xb64364=_0xccad0[_0x53498d];return _0xb64364;}import{getRoleById,projectRole,ROLE_ID_FLAG}from'../../commands/role/shared.js';export const roleDetail={'service':a146_0x1d0166(0xec),'command':a146_0x1d0166(0xf0),'description':a146_0x1d0166(0xe8),'risk':'read','flags':[ROLE_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'execute'(_0x150b5a){const _0x311175=a146_0x1d0166,_0xfe21f3=_0x150b5a[_0x311175(0xef)]('id'),_0xbb4ddf=await getRoleById(_0x150b5a['appCode'],_0xfe21f3);return{'ok':!![],'data':{'role':projectRole(_0xbb4ddf)},'message':'Role\x20'+_0xbb4ddf['roleName']+'\x20('+_0xbb4ddf[_0x311175(0xe3)]+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1d30e5,_0x113293){const _0x237b31=a147_0x4f78,_0x28ce54=_0x1d30e5();while(!![]){try{const _0x7c395d=parseInt(_0x237b31(0x92))/0x1*(-parseInt(_0x237b31(0x90))/0x2)+-parseInt(_0x237b31(0x8f))/0x3*(-parseInt(_0x237b31(0x93))/0x4)+parseInt(_0x237b31(0x8d))/0x5+parseInt(_0x237b31(0x8e))/0x6+parseInt(_0x237b31(0x96))/0x7*(-parseInt(_0x237b31(0x8b))/0x8)+-parseInt(_0x237b31(0x8c))/0x9*(-parseInt(_0x237b31(0x94))/0xa)+parseInt(_0x237b31(0x95))/0xb*(-parseInt(_0x237b31(0x91))/0xc);if(_0x7c395d===_0x113293)break;else _0x28ce54['push'](_0x28ce54['shift']());}catch(_0x2bfcbd){_0x28ce54['push'](_0x28ce54['shift']());}}}(a147_0x273c,0xccc79));import{roleList}from'../../commands/role/list.js';import{roleDetail}from'../../commands/role/detail.js';function a147_0x4f78(_0x63a097,_0xfff0c9){_0x63a097=_0x63a097-0x8b;const _0x273cdc=a147_0x273c();let _0x4f787c=_0x273cdc[_0x63a097];return _0x4f787c;}import{roleCreate}from'../../commands/role/create.js';import{roleUpdate}from'../../commands/role/update.js';import{roleDelete}from'../../commands/role/delete.js';function a147_0x273c(){const _0x4935b3=['36864dOveCU','39RwHGsZ','4078ekDoAH','12576IUkEDm','510eeQlxR','435308mSChWs','585990CKfCOx','15686OQaXdy','7isbFbS','767656vryoTy','81YKiAfF','7603930zuvpbN'];a147_0x273c=function(){return _0x4935b3;};return a147_0x273c();}import{roleUserResolve}from'../../commands/role/user-resolve.js';import{roleUserAdd}from'../../commands/role/user-add.js';import{roleUserRemove}from'../../commands/role/user-remove.js';export const roleDefinitions=[roleList,roleDetail,roleCreate,roleUpdate,roleDelete,roleUserResolve,roleUserAdd,roleUserRemove];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a148_0x3df825=a148_0x3069;(function(_0x4adbf6,_0x591fb3){const _0x2df8b8=a148_0x3069,_0x2de89a=_0x4adbf6();while(!![]){try{const _0x16f0dd=-parseInt(_0x2df8b8(0x160))/0x1+parseInt(_0x2df8b8(0x152))/0x2+parseInt(_0x2df8b8(0x156))/0x3+parseInt(_0x2df8b8(0x16d))/0x4*(parseInt(_0x2df8b8(0x164))/0x5)+-parseInt(_0x2df8b8(0x161))/0x6+parseInt(_0x2df8b8(0x163))/0x7+parseInt(_0x2df8b8(0x162))/0x8;if(_0x16f0dd===_0x591fb3)break;else _0x2de89a['push'](_0x2de89a['shift']());}catch(_0x3aa6f5){_0x2de89a['push'](_0x2de89a['shift']());}}}(a148_0x2e36,0x6cd44));import{listAppRoles}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{projectRole}from'../../commands/role/shared.js';const ROLE_TYPES=[a148_0x3df825(0x159),a148_0x3df825(0x15f),a148_0x3df825(0x167),'CUSTOM'];function a148_0x2e36(){const _0x4a3fd6=['ADMIN','--page\x20must\x20be\x20greater\x20than\x20or\x20equal\x20to\x201.','roleType','num','List\x20user\x20groups\x20(roles)\x20for\x20the\x20current\x20app','filter','DEV','42735LaXCoa','4342926uxjwLC','1659152ljNicq','215033BWuMZJ','2311945dTDLbf','str','Use\x20one\x20of:\x20','USER','type','join','page','role','number','4sJMJWb','Filter\x20by\x20role\x20type','toUpperCase','Invalid\x20--type\x20\x22','\x20role(s)','includes','Page\x20size\x20(1-100)','871412GIPkxH','validation','--pagesize\x20must\x20be\x20between\x201\x20and\x20100.','pagesize','228336KFoHOc','trim','Found\x20'];a148_0x2e36=function(){return _0x4a3fd6;};return a148_0x2e36();}function a148_0x3069(_0x187505,_0x1df30d){_0x187505=_0x187505-0x14d;const _0x2e36fb=a148_0x2e36();let _0x30695e=_0x2e36fb[_0x187505];return _0x30695e;}export const roleList={'service':a148_0x3df825(0x16b),'command':'list','description':a148_0x3df825(0x15d),'risk':'read','flags':[APPCODE_FLAG_OPTIONAL,{'name':a148_0x3df825(0x168),'type':'string','required':![],'description':a148_0x3df825(0x16e),'enum':ROLE_TYPES},{'name':a148_0x3df825(0x16a),'type':a148_0x3df825(0x16c),'description':'Page\x20index\x20(1-based)','default':0x1},{'name':a148_0x3df825(0x155),'type':a148_0x3df825(0x16c),'description':a148_0x3df825(0x151),'default':0x64}],async 'validate'(_0xff9e22){const _0x338864=a148_0x3df825,_0x1647e9=_0xff9e22[_0x338864(0x165)](_0x338864(0x168))[_0x338864(0x157)]();if(_0x1647e9&&!ROLE_TYPES[_0x338864(0x150)](_0x1647e9[_0x338864(0x14d)]()))throw CliErrors['validation'](_0x338864(0x14e)+_0x1647e9+'\x22.',_0x338864(0x166)+ROLE_TYPES[_0x338864(0x169)](',\x20')+'.');const _0xa2dc48=_0xff9e22[_0x338864(0x15c)]('page',0x1),_0x5dced0=_0xff9e22['num'](_0x338864(0x155),0x64);if(_0xa2dc48<0x1)throw CliErrors[_0x338864(0x153)](_0x338864(0x15a));if(_0x5dced0<0x1||_0x5dced0>0x64)throw CliErrors['validation'](_0x338864(0x154));},async 'execute'(_0x59e42a){const _0x392262=a148_0x3df825,_0x383fe8=_0x59e42a[_0x392262(0x15c)](_0x392262(0x16a),0x1)||0x1,_0x28995e=_0x59e42a[_0x392262(0x15c)](_0x392262(0x155),0x64)||0x64,_0x247c0a=_0x59e42a[_0x392262(0x165)](_0x392262(0x168))[_0x392262(0x157)]()[_0x392262(0x14d)](),{items:_0x3cba88,paging:_0x3175e2}=await listAppRoles(_0x59e42a['appCode'],{'currentPage':_0x383fe8,'pageSize':_0x28995e}),_0x3b28e9=_0x247c0a?_0x3cba88[_0x392262(0x15e)](_0x5cc5c7=>_0x5cc5c7[_0x392262(0x15b)]===_0x247c0a):_0x3cba88,_0x36d0f6=_0x3b28e9['map'](projectRole);return{'ok':!![],'data':{'roles':_0x36d0f6,'paging':_0x3175e2},'message':_0x392262(0x158)+_0x36d0f6['length']+_0x392262(0x14f)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a149_0x2c3fcd=a149_0x2591;(function(_0x38c0f7,_0x45824c){const _0xf64411=a149_0x2591,_0x230e77=_0x38c0f7();while(!![]){try{const _0x445b3c=-parseInt(_0xf64411(0x1e9))/0x1+parseInt(_0xf64411(0x1ce))/0x2+-parseInt(_0xf64411(0x1ec))/0x3*(-parseInt(_0xf64411(0x1c3))/0x4)+parseInt(_0xf64411(0x1b3))/0x5+-parseInt(_0xf64411(0x1b5))/0x6+parseInt(_0xf64411(0x1e4))/0x7+-parseInt(_0xf64411(0x1cf))/0x8;if(_0x445b3c===_0x45824c)break;else _0x230e77['push'](_0x230e77['shift']());}catch(_0x22c7a4){_0x230e77['push'](_0x230e77['shift']());}}}(a149_0x3f12,0x81d05));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':a149_0x2c3fcd(0x1ef),'required':!![],'description':'Role\x20id\x20(from\x20`role\x20list`)'};export const ROLE_REF_FLAG={'name':'role','type':'string','required':!![],'description':a149_0x2c3fcd(0x1b6)};export const USER_REF_FLAG={'name':a149_0x2c3fcd(0x1eb),'type':a149_0x2c3fcd(0x1aa),'required':!![],'description':a149_0x2c3fcd(0x1a6)};export const NAME_FLAG={'name':a149_0x2c3fcd(0x1bc),'type':a149_0x2c3fcd(0x1aa),'required':!![],'description':a149_0x2c3fcd(0x1c1)};export const USER_NAME_FLAG={'name':a149_0x2c3fcd(0x1bc),'type':a149_0x2c3fcd(0x1aa),'required':!![],'description':a149_0x2c3fcd(0x1cd)};export const REMARK_FLAG={'name':a149_0x2c3fcd(0x1d0),'type':a149_0x2c3fcd(0x1aa),'required':![],'description':a149_0x2c3fcd(0x1b7)};export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':'number','required':![],'description':a149_0x2c3fcd(0x1c5)};export const BUILTIN_ROLE_TYPES=['ADMIN',a149_0x2c3fcd(0x1c4),a149_0x2c3fcd(0x1d1)];function a149_0x2591(_0xd3379a,_0x279736){_0xd3379a=_0xd3379a-0x1a4;const _0x3f12e4=a149_0x3f12();let _0x2591ac=_0x3f12e4[_0xd3379a];return _0x2591ac;}export function isBuiltinRole(_0x4485e8){const _0x56099c=a149_0x2c3fcd;return BUILTIN_ROLE_TYPES[_0x56099c(0x1c7)](_0x4485e8);}export function assertCustomRole(_0x9a1556,_0x2f518b){const _0x1426ef=a149_0x2c3fcd;if(_0x9a1556[_0x1426ef(0x1c9)]!==_0x1426ef(0x1a9))throw CliErrors['validation'](_0x1426ef(0x1a5)+_0x2f518b+'\x20built-in\x20role\x20'+_0x9a1556[_0x1426ef(0x1b1)]+'\x20('+_0x9a1556[_0x1426ef(0x1c9)]+').','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.');}export function assertPermConfigurable(_0x581aa8){const _0x5f14c2=a149_0x2c3fcd;if(_0x581aa8[_0x5f14c2(0x1c9)]===_0x5f14c2(0x1c4)||_0x581aa8[_0x5f14c2(0x1c9)]===_0x5f14c2(0x1ba))throw CliErrors[_0x5f14c2(0x1d3)]('Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20'+_0x581aa8[_0x5f14c2(0x1b1)]+'\x20('+_0x581aa8[_0x5f14c2(0x1c9)]+').',_0x5f14c2(0x1ca));}export function projectRole(_0x532bb8){const _0xcfad0e=a149_0x2c3fcd;return{'id':_0x532bb8['id'],'roleName':_0x532bb8[_0xcfad0e(0x1b1)],'roleType':_0x532bb8['roleType'],'remark':_0x532bb8[_0xcfad0e(0x1d0)],'userCount':_0x532bb8['userCount'],'permitCount':_0x532bb8[_0xcfad0e(0x1de)],'builtin':isBuiltinRole(_0x532bb8[_0xcfad0e(0x1c9)])};}export async function resolveRoleRef(_0x1128a3,_0x37e476){const _0x44a27d=a149_0x2c3fcd,_0x4dc629=_0x37e476[_0x44a27d(0x1ed)]();if(!_0x4dc629)throw CliErrors['validation'](_0x44a27d(0x1ab),_0x44a27d(0x1b0));if(/^\d+$/[_0x44a27d(0x1ea)](_0x4dc629))return getRoleById(_0x1128a3,Number(_0x4dc629));const _0x41b554=await listAllAppRoles(_0x1128a3),_0x11f676=_0x41b554[_0x44a27d(0x1cb)](_0x510482=>_0x510482[_0x44a27d(0x1b1)]===_0x4dc629);if(_0x11f676[_0x44a27d(0x1bb)]===0x0)throw CliErrors[_0x44a27d(0x1d3)]('Role\x20name\x20\x22'+_0x4dc629+'\x22\x20not\x20found\x20in\x20app\x20'+_0x1128a3+'.',_0x44a27d(0x1e3));if(_0x11f676['length']>0x1){const _0x29aeb7=_0x11f676[_0x44a27d(0x1cc)](_0x28ee4c=>_0x28ee4c['id'])[_0x44a27d(0x1dd)](',\x20');throw CliErrors[_0x44a27d(0x1d3)](_0x44a27d(0x1db)+_0x4dc629+_0x44a27d(0x1c2)+_0x29aeb7+').',_0x44a27d(0x1e7));}return _0x11f676[0x0];}export async function getRoleById(_0x3627ba,_0x11757e){const _0xdbdbf5=a149_0x2c3fcd,_0x5dc1f7=await getAppRole(_0x11757e);if(!_0x5dc1f7)throw CliErrors[_0xdbdbf5(0x1d3)](_0xdbdbf5(0x1ad)+_0x11757e+_0xdbdbf5(0x1d6)+_0x3627ba+'.',_0xdbdbf5(0x1e5));return _0x5dc1f7;}async function listAllAppRoles(_0x107f0e){const _0x4b3ea8=a149_0x2c3fcd,_0x527fcf=0x64,_0x20eee7=[];for(let _0x277bf2=0x1;;_0x277bf2+=0x1){const {items:_0x62dde4,paging:_0x4f2b7c}=await listAppRoles(_0x107f0e,{'currentPage':_0x277bf2,'pageSize':_0x527fcf});_0x20eee7[_0x4b3ea8(0x1bf)](..._0x62dde4);if(_0x62dde4[_0x4b3ea8(0x1bb)]<_0x527fcf||_0x4f2b7c&&_0x20eee7[_0x4b3ea8(0x1bb)]>=_0x4f2b7c['totalCount'])return _0x20eee7;}}export async function resolveTenantCode(){const _0x40195a=a149_0x2c3fcd,_0x3f84c1=await getSessionUserInfo(),_0x4c9bf4=_0x3f84c1?.[_0x40195a(0x1eb)]?.['tenant']?.[_0x40195a(0x1d8)];if(!_0x4c9bf4)throw CliErrors[_0x40195a(0x1a8)](_0x40195a(0x1e2));return _0x4c9bf4;}function matchMember(_0x3e8a6f,_0x451d45){const _0x572059=a149_0x2c3fcd,_0x44667e=_0x451d45[_0x572059(0x1ed)]()['toLowerCase']();return(_0x3e8a6f[_0x572059(0x1b8)]??'')[_0x572059(0x1b4)]()===_0x44667e||(_0x3e8a6f[_0x572059(0x1d5)]??'')[_0x572059(0x1b4)]()===_0x44667e;}export async function resolveUserRef(_0x44b17b){const _0x319ba=a149_0x2c3fcd,_0x4a56de=_0x44b17b[_0x319ba(0x1ed)]();if(!_0x4a56de)throw CliErrors[_0x319ba(0x1d3)](_0x319ba(0x1c8),_0x319ba(0x1b9));const _0x24d2db=await resolveTenantCode(),_0x1a0b5d=await getTenantMembers(_0x24d2db);if(/^\d+$/['test'](_0x4a56de)){const _0xe7d63e=Number(_0x4a56de),_0x4287e4=_0x1a0b5d['find'](_0x292c98=>_0x292c98[_0x319ba(0x1d9)]===_0xe7d63e);return{'userId':_0xe7d63e,'username':_0x4287e4?.[_0x319ba(0x1d5)]??String(_0xe7d63e),'nickname':_0x4287e4?.[_0x319ba(0x1b8)],'matchedBy':'id'};}const _0x3fac7d=_0x1a0b5d['filter'](_0x1217bb=>matchMember(_0x1217bb,_0x4a56de));if(_0x3fac7d[_0x319ba(0x1bb)]===0x0)throw CliErrors[_0x319ba(0x1d3)](_0x319ba(0x1a7)+_0x4a56de+'\x22.','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.');if(_0x3fac7d[_0x319ba(0x1bb)]>0x1){const _0x20bb2c=_0x3fac7d[_0x319ba(0x1cc)](_0x4a17e6=>(_0x4a17e6[_0x319ba(0x1b8)]??_0x4a17e6[_0x319ba(0x1d5)]??'?')+'('+_0x4a17e6['userId']+')')[_0x319ba(0x1dd)](',\x20');throw CliErrors[_0x319ba(0x1d3)](_0x319ba(0x1d2)+_0x4a56de+_0x319ba(0x1be)+_0x20bb2c+'.',_0x319ba(0x1df));}const _0x5dd732=_0x3fac7d[0x0];return{'userId':_0x5dd732[_0x319ba(0x1d9)],'username':_0x5dd732[_0x319ba(0x1d5)]??String(_0x5dd732[_0x319ba(0x1d9)]),'nickname':_0x5dd732['nickname'],'matchedBy':_0x319ba(0x1bc)};}export const UPDATE_USER_LIST_PATH=a149_0x2c3fcd(0x1dc);function userIdsOf(_0x55014a){const _0x2551cd=a149_0x2c3fcd;return(_0x55014a?.[_0x2551cd(0x1c6)]??[])[_0x2551cd(0x1cc)](_0x19c360=>_0x19c360[_0x2551cd(0x1d9)]);}export function computeRoleUserMutation(_0x3d64f3){const _0x5abbd8=a149_0x2c3fcd,{operation:_0x308320,appCode:_0x59fdea,roleUsers:_0x54e7e6,targetRoleId:_0x5185f1,user:_0x423f62}=_0x3d64f3,_0x2bd183=_0x54e7e6[_0x5abbd8(0x1bd)](_0x479e0c=>_0x479e0c['id']===_0x5185f1);if(!_0x2bd183)throw CliErrors['validation'](_0x5abbd8(0x1ad)+_0x5185f1+'\x20not\x20found\x20in\x20the\x20user-role\x20list.',_0x5abbd8(0x1e5));const _0x4f8ddd=userIdsOf(_0x2bd183),_0x4d53e3=[];if(_0x3d64f3[_0x5abbd8(0x1e1)]!==undefined&&_0x3d64f3[_0x5abbd8(0x1e1)]!==_0x4f8ddd[_0x5abbd8(0x1bb)])throw CliErrors['validation'](_0x5abbd8(0x1e6)+_0x3d64f3[_0x5abbd8(0x1e1)]+'\x20member(s)\x20but\x20role\x20has\x20'+_0x4f8ddd[_0x5abbd8(0x1bb)]+'.',_0x5abbd8(0x1e0));const _0x1d2344=_0x4f8ddd[_0x5abbd8(0x1c7)](_0x423f62[_0x5abbd8(0x1d9)]);let _0x7385fc=![];const _0x2be81b=[..._0x2bd183[_0x5abbd8(0x1c6)]];if(_0x308320===_0x5abbd8(0x1a4))_0x1d2344?_0x4d53e3['push'](_0x5abbd8(0x1f1)+_0x423f62[_0x5abbd8(0x1d9)]+'\x20is\x20already\x20a\x20member\x20of\x20role\x20'+_0x2bd183[_0x5abbd8(0x1b1)]+_0x5abbd8(0x1b2)):(_0x2be81b[_0x5abbd8(0x1bf)]({'userId':_0x423f62['userId'],'username':_0x423f62['username'],..._0x423f62[_0x5abbd8(0x1b8)]?{'nickname':_0x423f62[_0x5abbd8(0x1b8)]}:{}}),_0x7385fc=!![]);else{if(!_0x1d2344)_0x4d53e3['push']('User\x20'+_0x423f62[_0x5abbd8(0x1d9)]+_0x5abbd8(0x1c0)+_0x2bd183[_0x5abbd8(0x1b1)]+_0x5abbd8(0x1b2));else{const _0x3c465f=_0x2be81b[_0x5abbd8(0x1af)](_0x45359e=>_0x45359e[_0x5abbd8(0x1d9)]===_0x423f62[_0x5abbd8(0x1d9)]);if(_0x3c465f>=0x0)_0x2be81b[_0x5abbd8(0x1ae)](_0x3c465f,0x1);_0x7385fc=!![];}}const _0x44d7aa=_0x54e7e6[_0x5abbd8(0x1cc)](_0x990bcf=>_0x990bcf['id']===_0x5185f1?{..._0x990bcf,'userList':_0x2be81b}:_0x990bcf),_0x349dd7=_0x2be81b[_0x5abbd8(0x1cc)](_0x1e47b0=>_0x1e47b0[_0x5abbd8(0x1d9)]),_0x1b858c={'operation':_0x308320,'selector':{'appCode':_0x59fdea,'roleId':_0x5185f1,'roleName':_0x2bd183[_0x5abbd8(0x1b1)],'userId':_0x423f62[_0x5abbd8(0x1d9)]},'before':{'userIds':_0x4f8ddd},'after':{'userIds':_0x349dd7},'dryRun':_0x3d64f3['dryRun'],'backend':{'method':_0x5abbd8(0x1d7),'path':UPDATE_USER_LIST_PATH},'warnings':_0x4d53e3};return{'roleList':_0x44d7aa,'mutation':_0x1b858c,'changed':_0x7385fc};}export async function loadRoleUsers(_0x3758c9){return listRoleUsers(_0x3758c9);}export function readRoleRef(_0x105c66){const _0x466456=a149_0x2c3fcd,_0xa9912a=_0x105c66[_0x466456(0x1ac)](_0x466456(0x1ee))[_0x466456(0x1ed)]();if(!_0xa9912a)throw CliErrors['flagMissing'](_0x466456(0x1ee),_0x466456(0x1b0));return _0xa9912a;}function a149_0x3f12(){const _0xb8553=['push','\x20is\x20not\x20a\x20member\x20of\x20role\x20','Role\x20name','\x22\x20is\x20ambiguous\x20(ids:\x20','269528MJvvhu','DEV','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','userList','includes','Missing\x20user\x20reference.','roleType','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','filter','map','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','354520iDVAZL','5668728SJQkWF','remark','USER','Multiple\x20tenant\x20members\x20match\x20\x22','validation','flag','username','\x20not\x20found\x20in\x20app\x20','POST','tenant_code','userId','expect-user-count','Role\x20name\x20\x22','/smartapi/permit/user-role/update-user-list','join','permitCount','Disambiguate\x20with\x20--user\x20<id>.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','expectUserCount','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','611401nozirT','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','Anti-drift\x20check\x20failed:\x20expected\x20','Disambiguate\x20with\x20--role\x20<id>.','appCode','116480NQSUCX','test','user','39aDmOoD','trim','role','number','flagMissing','User\x20','user-add','Cannot\x20','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','No\x20tenant\x20member\x20matches\x20\x22','authRequired','CUSTOM','string','Missing\x20role\x20reference.','str','Role\x20id\x20','splice','findIndex','Pass\x20--role\x20<id|name>.','roleName',';\x20no\x20change.','4270375xEMtOr','toLowerCase','3827136mcyAzp','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','Optional\x20role\x20remark/description','nickname','Pass\x20--user\x20<id|name>.','ADMIN','length','name','find','\x22:\x20'];a149_0x3f12=function(){return _0xb8553;};return a149_0x3f12();}export async function prepareUserMutation(_0x3b17c4,_0x1a643f,_0x41be41){const _0xd1fc1f=a149_0x2c3fcd,_0x1dc949=readRoleRef(_0x3b17c4),_0x59e5d2=_0x3b17c4['str']('user')[_0xd1fc1f(0x1ed)]();if(!_0x59e5d2)throw CliErrors[_0xd1fc1f(0x1f0)](_0xd1fc1f(0x1eb),_0xd1fc1f(0x1b9));const _0x2dcd36=_0x3b17c4[_0xd1fc1f(0x1d4)](_0xd1fc1f(0x1da)),_0x18c7f6=_0x2dcd36===undefined||_0x2dcd36===null?undefined:Number(_0x2dcd36),_0x24a025=await resolveRoleRef(_0x3b17c4[_0xd1fc1f(0x1e8)],_0x1dc949),_0x5ae7ff=await resolveUserRef(_0x59e5d2),_0x2711e4=await loadRoleUsers(_0x3b17c4[_0xd1fc1f(0x1e8)]);return computeRoleUserMutation({'operation':_0x1a643f,'appCode':_0x3b17c4[_0xd1fc1f(0x1e8)],'roleUsers':_0x2711e4,'targetRoleId':_0x24a025['id'],'user':{'userId':_0x5ae7ff['userId'],'username':_0x5ae7ff['username'],'nickname':_0x5ae7ff['nickname']},'dryRun':_0x41be41,..._0x18c7f6!==undefined?{'expectUserCount':_0x18c7f6}:{}});}
|
|
1
|
+
const a149_0x56823e=a149_0x5cb9;(function(_0x32ac1f,_0xdfd960){const _0x3ebbf6=a149_0x5cb9,_0x9b8e12=_0x32ac1f();while(!![]){try{const _0x1d31a3=parseInt(_0x3ebbf6(0xbb))/0x1+parseInt(_0x3ebbf6(0x87))/0x2+-parseInt(_0x3ebbf6(0xc2))/0x3*(-parseInt(_0x3ebbf6(0xbe))/0x4)+-parseInt(_0x3ebbf6(0x83))/0x5+parseInt(_0x3ebbf6(0x8c))/0x6*(parseInt(_0x3ebbf6(0x9a))/0x7)+parseInt(_0x3ebbf6(0xb0))/0x8+-parseInt(_0x3ebbf6(0xa4))/0x9*(parseInt(_0x3ebbf6(0xa3))/0xa);if(_0x1d31a3===_0xdfd960)break;else _0x9b8e12['push'](_0x9b8e12['shift']());}catch(_0x5ead9e){_0x9b8e12['push'](_0x9b8e12['shift']());}}}(a149_0x43b7,0x32f6f));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';function a149_0x43b7(){const _0x3db659=['role','ADMIN','No\x20tenant\x20member\x20matches\x20\x22','flagMissing','nickname','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','userList','Optional\x20role\x20remark/description','2038168DkJaXy','filter','Multiple\x20tenant\x20members\x20match\x20\x22','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','tenant','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20',';\x20no\x20change.','Cannot\x20','tenant_code','roleName','Role\x20name\x20\x22','405680ohasVj','\x20member(s)\x20but\x20role\x20has\x20','length','292156GStKhi','trim','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','Missing\x20user\x20reference.','3Scoaab','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','totalCount','\x22\x20not\x20found\x20in\x20app\x20','Pass\x20--role\x20<id|name>.','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','expectUserCount','map','\x20is\x20already\x20a\x20member\x20of\x20role\x20','Pass\x20--user\x20<id|name>.','dryRun','str','validation','User\x20','userId','appCode','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','toLowerCase','Disambiguate\x20with\x20--role\x20<id>.','857310mHLvxg','find','username','number','233692NHSCaX','string','Missing\x20role\x20reference.','Role\x20name','remark','18744RAoYHI','roleType','Anti-drift\x20check\x20failed:\x20expected\x20','DEV','CUSTOM','\x20is\x20not\x20a\x20member\x20of\x20role\x20','splice','Disambiguate\x20with\x20--user\x20<id>.','permitCount','user','includes','push','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','expect-user-count','91BtOUjD','test','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','join','name','user-add','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','\x20not\x20found\x20in\x20app\x20','findIndex','12930sTUIta','3555yMEDdn','Role\x20id\x20','flag','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.'];a149_0x43b7=function(){return _0x3db659;};return a149_0x43b7();}import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a149_0x56823e(0x86),'required':!![],'description':'Role\x20id\x20(from\x20`role\x20list`)'};export const ROLE_REF_FLAG={'name':a149_0x56823e(0xa8),'type':a149_0x56823e(0x88),'required':!![],'description':a149_0x56823e(0xc4)};export const USER_REF_FLAG={'name':a149_0x56823e(0x95),'type':a149_0x56823e(0x88),'required':!![],'description':a149_0x56823e(0xc8)};export const NAME_FLAG={'name':a149_0x56823e(0x9e),'type':a149_0x56823e(0x88),'required':!![],'description':a149_0x56823e(0x8a)};export const USER_NAME_FLAG={'name':'name','type':a149_0x56823e(0x88),'required':!![],'description':a149_0x56823e(0xa0)};function a149_0x5cb9(_0x5899be,_0x3682bb){_0x5899be=_0x5899be-0x76;const _0x43b77d=a149_0x43b7();let _0x5cb92e=_0x43b77d[_0x5899be];return _0x5cb92e;}export const REMARK_FLAG={'name':a149_0x56823e(0x8b),'type':'string','required':![],'description':a149_0x56823e(0xaf)};export const EXPECT_USER_COUNT_FLAG={'name':a149_0x56823e(0x99),'type':a149_0x56823e(0x86),'required':![],'description':a149_0x56823e(0x9c)};export const BUILTIN_ROLE_TYPES=[a149_0x56823e(0xa9),a149_0x56823e(0x8f),'USER'];export function isBuiltinRole(_0x914228){const _0x106040=a149_0x56823e;return BUILTIN_ROLE_TYPES[_0x106040(0x96)](_0x914228);}export function assertCustomRole(_0x5d1f48,_0x2aba0e){const _0x4681c3=a149_0x56823e;if(_0x5d1f48[_0x4681c3(0x8d)]!==_0x4681c3(0x90))throw CliErrors[_0x4681c3(0x7c)](_0x4681c3(0xb7)+_0x2aba0e+'\x20built-in\x20role\x20'+_0x5d1f48[_0x4681c3(0xb9)]+'\x20('+_0x5d1f48[_0x4681c3(0x8d)]+').',_0x4681c3(0xb3));}export function assertPermConfigurable(_0x454337){const _0x50f89a=a149_0x56823e;if(_0x454337[_0x50f89a(0x8d)]==='DEV'||_0x454337['roleType']===_0x50f89a(0xa9))throw CliErrors[_0x50f89a(0x7c)](_0x50f89a(0xb5)+_0x454337[_0x50f89a(0xb9)]+'\x20('+_0x454337['roleType']+').',_0x50f89a(0x80));}export function projectRole(_0x58c4f5){const _0x8d67aa=a149_0x56823e;return{'id':_0x58c4f5['id'],'roleName':_0x58c4f5[_0x8d67aa(0xb9)],'roleType':_0x58c4f5[_0x8d67aa(0x8d)],'remark':_0x58c4f5[_0x8d67aa(0x8b)],'userCount':_0x58c4f5['userCount'],'permitCount':_0x58c4f5[_0x8d67aa(0x94)],'builtin':isBuiltinRole(_0x58c4f5['roleType'])};}export async function resolveRoleRef(_0x50c435,_0x29b4ab){const _0x1b2be5=a149_0x56823e,_0x5d75b0=_0x29b4ab['trim']();if(!_0x5d75b0)throw CliErrors['validation'](_0x1b2be5(0x89),_0x1b2be5(0xc7));if(/^\d+$/[_0x1b2be5(0x9b)](_0x5d75b0))return getRoleById(_0x50c435,Number(_0x5d75b0));const _0x7fc139=await listAllAppRoles(_0x50c435),_0x204c9d=_0x7fc139[_0x1b2be5(0xb1)](_0x3c9c12=>_0x3c9c12['roleName']===_0x5d75b0);if(_0x204c9d['length']===0x0)throw CliErrors[_0x1b2be5(0x7c)](_0x1b2be5(0xba)+_0x5d75b0+_0x1b2be5(0xc6)+_0x50c435+'.',_0x1b2be5(0xc0));if(_0x204c9d[_0x1b2be5(0xbd)]>0x1){const _0x3dd51d=_0x204c9d[_0x1b2be5(0x77)](_0x52f090=>_0x52f090['id'])[_0x1b2be5(0x9d)](',\x20');throw CliErrors[_0x1b2be5(0x7c)]('Role\x20name\x20\x22'+_0x5d75b0+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x3dd51d+').',_0x1b2be5(0x82));}return _0x204c9d[0x0];}export async function getRoleById(_0x2ce308,_0xa2fc15){const _0x377ace=a149_0x56823e,_0x4f4be2=await getAppRole(_0xa2fc15);if(!_0x4f4be2)throw CliErrors[_0x377ace(0x7c)]('Role\x20id\x20'+_0xa2fc15+_0x377ace(0xa1)+_0x2ce308+'.',_0x377ace(0xc3));return _0x4f4be2;}async function listAllAppRoles(_0x371ba4){const _0x446953=a149_0x56823e,_0xb2fcb2=0x64,_0x5a9bd9=[];for(let _0x15dee6=0x1;;_0x15dee6+=0x1){const {items:_0x1c57da,paging:_0x38708c}=await listAppRoles(_0x371ba4,{'currentPage':_0x15dee6,'pageSize':_0xb2fcb2});_0x5a9bd9[_0x446953(0x97)](..._0x1c57da);if(_0x1c57da['length']<_0xb2fcb2||_0x38708c&&_0x5a9bd9[_0x446953(0xbd)]>=_0x38708c[_0x446953(0xc5)])return _0x5a9bd9;}}export async function resolveTenantCode(){const _0x1ff7e6=a149_0x56823e,_0x2bc483=await getSessionUserInfo(),_0x2f3d64=_0x2bc483?.[_0x1ff7e6(0x95)]?.[_0x1ff7e6(0xb4)]?.[_0x1ff7e6(0xb8)];if(!_0x2f3d64)throw CliErrors['authRequired'](_0x1ff7e6(0xad));return _0x2f3d64;}function matchMember(_0x522478,_0x25ee4e){const _0x5d90fd=a149_0x56823e,_0x51d4aa=_0x25ee4e[_0x5d90fd(0xbf)]()[_0x5d90fd(0x81)]();return(_0x522478[_0x5d90fd(0xac)]??'')[_0x5d90fd(0x81)]()===_0x51d4aa||(_0x522478['username']??'')['toLowerCase']()===_0x51d4aa;}export async function resolveUserRef(_0x72acea){const _0x567835=a149_0x56823e,_0x370d88=_0x72acea['trim']();if(!_0x370d88)throw CliErrors['validation'](_0x567835(0xc1),_0x567835(0x79));const _0x3a6a47=await resolveTenantCode(),_0x158cf7=await getTenantMembers(_0x3a6a47);if(/^\d+$/[_0x567835(0x9b)](_0x370d88)){const _0xa24d91=Number(_0x370d88),_0x3e6551=_0x158cf7[_0x567835(0x84)](_0x58a000=>_0x58a000[_0x567835(0x7e)]===_0xa24d91);return{'userId':_0xa24d91,'username':_0x3e6551?.[_0x567835(0x85)]??String(_0xa24d91),'nickname':_0x3e6551?.[_0x567835(0xac)],'matchedBy':'id'};}const _0x46c178=_0x158cf7[_0x567835(0xb1)](_0x233b05=>matchMember(_0x233b05,_0x370d88));if(_0x46c178[_0x567835(0xbd)]===0x0)throw CliErrors[_0x567835(0x7c)](_0x567835(0xaa)+_0x370d88+'\x22.',_0x567835(0x98));if(_0x46c178[_0x567835(0xbd)]>0x1){const _0x3e63f3=_0x46c178['map'](_0xeca1f5=>(_0xeca1f5[_0x567835(0xac)]??_0xeca1f5[_0x567835(0x85)]??'?')+'('+_0xeca1f5['userId']+')')[_0x567835(0x9d)](',\x20');throw CliErrors[_0x567835(0x7c)](_0x567835(0xb2)+_0x370d88+'\x22:\x20'+_0x3e63f3+'.',_0x567835(0x93));}const _0x525553=_0x46c178[0x0];return{'userId':_0x525553[_0x567835(0x7e)],'username':_0x525553[_0x567835(0x85)]??String(_0x525553[_0x567835(0x7e)]),'nickname':_0x525553['nickname'],'matchedBy':'name'};}export const UPDATE_USER_LIST_PATH='/smartapi/permit/user-role/update-user-list';function userIdsOf(_0x1b2ad6){const _0x29f3d3=a149_0x56823e;return(_0x1b2ad6?.[_0x29f3d3(0xae)]??[])[_0x29f3d3(0x77)](_0x3930f1=>_0x3930f1[_0x29f3d3(0x7e)]);}export function computeRoleUserMutation(_0x3c5c0c){const _0x4586c5=a149_0x56823e,{operation:_0x15fa89,appCode:_0x1bbf0a,roleUsers:_0x2b9f7c,targetRoleId:_0x21a8ed,user:_0x480f00}=_0x3c5c0c,_0x2b1f59=_0x2b9f7c['find'](_0x48970a=>_0x48970a['id']===_0x21a8ed);if(!_0x2b1f59)throw CliErrors[_0x4586c5(0x7c)](_0x4586c5(0xa5)+_0x21a8ed+'\x20not\x20found\x20in\x20the\x20user-role\x20list.',_0x4586c5(0xc3));const _0x1a993d=userIdsOf(_0x2b1f59),_0x43d09e=[];if(_0x3c5c0c[_0x4586c5(0x76)]!==undefined&&_0x3c5c0c['expectUserCount']!==_0x1a993d[_0x4586c5(0xbd)])throw CliErrors[_0x4586c5(0x7c)](_0x4586c5(0x8e)+_0x3c5c0c['expectUserCount']+_0x4586c5(0xbc)+_0x1a993d['length']+'.',_0x4586c5(0xa7));const _0x5a02ce=_0x1a993d[_0x4586c5(0x96)](_0x480f00[_0x4586c5(0x7e)]);let _0x7912ed=![];const _0x36214d=[..._0x2b1f59[_0x4586c5(0xae)]];if(_0x15fa89===_0x4586c5(0x9f))_0x5a02ce?_0x43d09e[_0x4586c5(0x97)](_0x4586c5(0x7d)+_0x480f00[_0x4586c5(0x7e)]+_0x4586c5(0x78)+_0x2b1f59[_0x4586c5(0xb9)]+';\x20no\x20change.'):(_0x36214d[_0x4586c5(0x97)]({'userId':_0x480f00[_0x4586c5(0x7e)],'username':_0x480f00[_0x4586c5(0x85)],..._0x480f00[_0x4586c5(0xac)]?{'nickname':_0x480f00[_0x4586c5(0xac)]}:{}}),_0x7912ed=!![]);else{if(!_0x5a02ce)_0x43d09e[_0x4586c5(0x97)](_0x4586c5(0x7d)+_0x480f00[_0x4586c5(0x7e)]+_0x4586c5(0x91)+_0x2b1f59[_0x4586c5(0xb9)]+_0x4586c5(0xb6));else{const _0x4fe55b=_0x36214d[_0x4586c5(0xa2)](_0x27cb05=>_0x27cb05['userId']===_0x480f00[_0x4586c5(0x7e)]);if(_0x4fe55b>=0x0)_0x36214d[_0x4586c5(0x92)](_0x4fe55b,0x1);_0x7912ed=!![];}}const _0x2793bd=_0x2b9f7c[_0x4586c5(0x77)](_0x19fac0=>_0x19fac0['id']===_0x21a8ed?{..._0x19fac0,'userList':_0x36214d}:_0x19fac0),_0x633a8c=_0x36214d[_0x4586c5(0x77)](_0x1c72e8=>_0x1c72e8[_0x4586c5(0x7e)]),_0x492648={'operation':_0x15fa89,'selector':{'appCode':_0x1bbf0a,'roleId':_0x21a8ed,'roleName':_0x2b1f59['roleName'],'userId':_0x480f00[_0x4586c5(0x7e)]},'before':{'userIds':_0x1a993d},'after':{'userIds':_0x633a8c},'dryRun':_0x3c5c0c[_0x4586c5(0x7a)],'backend':{'method':'POST','path':UPDATE_USER_LIST_PATH},'warnings':_0x43d09e};return{'roleList':_0x2793bd,'mutation':_0x492648,'changed':_0x7912ed};}export async function loadRoleUsers(_0x1916ff){return listRoleUsers(_0x1916ff);}export function readRoleRef(_0x553a3c){const _0x54dbdc=a149_0x56823e,_0x5a3b35=_0x553a3c[_0x54dbdc(0x7b)](_0x54dbdc(0xa8))[_0x54dbdc(0xbf)]();if(!_0x5a3b35)throw CliErrors[_0x54dbdc(0xab)](_0x54dbdc(0xa8),_0x54dbdc(0xc7));return _0x5a3b35;}export async function prepareUserMutation(_0x290216,_0x33241c,_0x4f6624){const _0x5f2677=a149_0x56823e,_0x59b876=readRoleRef(_0x290216),_0x52d6d3=_0x290216[_0x5f2677(0x7b)](_0x5f2677(0x95))[_0x5f2677(0xbf)]();if(!_0x52d6d3)throw CliErrors[_0x5f2677(0xab)](_0x5f2677(0x95),_0x5f2677(0x79));const _0x567118=_0x290216[_0x5f2677(0xa6)]('expect-user-count'),_0x27216b=_0x567118===undefined||_0x567118===null?undefined:Number(_0x567118),_0x1233af=await resolveRoleRef(_0x290216[_0x5f2677(0x7f)],_0x59b876),_0x4f60db=await resolveUserRef(_0x52d6d3),_0x1f36c7=await loadRoleUsers(_0x290216[_0x5f2677(0x7f)]);return computeRoleUserMutation({'operation':_0x33241c,'appCode':_0x290216[_0x5f2677(0x7f)],'roleUsers':_0x1f36c7,'targetRoleId':_0x1233af['id'],'user':{'userId':_0x4f60db[_0x5f2677(0x7e)],'username':_0x4f60db[_0x5f2677(0x85)],'nickname':_0x4f60db[_0x5f2677(0xac)]},'dryRun':_0x4f6624,..._0x27216b!==undefined?{'expectUserCount':_0x27216b}:{}});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a150_0x1d31(){const _0x3f279e=['123fVDkbt','1842KIQLKn','validation','POST','roleName','name','New\x20role\x20name','--name\x20cannot\x20be\x20empty.','flag','num','trim','580032nssQWz','1900XlHDbr','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','63821WNUcys','remark','length','update','466000KbwYEA','756518sIfLAs','6712bzowjl','70Jqufho','role','appCode','Nothing\x20to\x20update.','4urXGOR','165583KQLqOr','write','string'];a150_0x1d31=function(){return _0x3f279e;};return a150_0x1d31();}const a150_0xb326a3=a150_0x191b;(function(_0x491ab9,_0x172a7e){const _0x50886e=a150_0x191b,_0x3b1f59=_0x491ab9();while(!![]){try{const _0x2c54be=-parseInt(_0x50886e(0x1e9))/0x1*(parseInt(_0x50886e(0x1f4))/0x2)+parseInt(_0x50886e(0x1f8))/0x3*(parseInt(_0x50886e(0x1ef))/0x4)+-parseInt(_0x50886e(0x1e7))/0x5*(-parseInt(_0x50886e(0x1f9))/0x6)+-parseInt(_0x50886e(0x1ee))/0x7+parseInt(_0x50886e(0x1ed))/0x8+parseInt(_0x50886e(0x1e6))/0x9+parseInt(_0x50886e(0x1f0))/0xa*(parseInt(_0x50886e(0x1f5))/0xb);if(_0x2c54be===_0x172a7e)break;else _0x3b1f59['push'](_0x3b1f59['shift']());}catch(_0x371b50){_0x3b1f59['push'](_0x3b1f59['shift']());}}}(a150_0x1d31,0x2b693));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';function a150_0x191b(_0x401b8f,_0x193e6f){_0x401b8f=_0x401b8f-0x1df;const _0x1d31b1=a150_0x1d31();let _0x191b13=_0x1d31b1[_0x401b8f];return _0x191b13;}const UPDATE_PATH='/smartapi/permit/role/update';function readPatch(_0x1bc6f7){const _0x5b4e18=a150_0x191b,_0x323aa2=_0x1bc6f7[_0x5b4e18(0x1e3)](_0x5b4e18(0x1e0)),_0x391307=_0x1bc6f7[_0x5b4e18(0x1e3)]('remark'),_0x29e2e1={};if(_0x323aa2!==undefined&&_0x323aa2!==null){const _0x5aed4d=String(_0x323aa2)[_0x5b4e18(0x1e5)]();if(!_0x5aed4d)throw CliErrors[_0x5b4e18(0x1fa)](_0x5b4e18(0x1e2));if(_0x5aed4d[_0x5b4e18(0x1eb)]>0x40)throw CliErrors['validation']('Role\x20name\x20cannot\x20exceed\x2064\x20characters.');_0x29e2e1[_0x5b4e18(0x1df)]=_0x5aed4d;}_0x391307!==undefined&&_0x391307!==null&&(_0x29e2e1[_0x5b4e18(0x1ea)]=String(_0x391307));if(_0x29e2e1[_0x5b4e18(0x1df)]===undefined&&_0x29e2e1['remark']===undefined)throw CliErrors[_0x5b4e18(0x1fa)](_0x5b4e18(0x1f3),_0x5b4e18(0x1e8));return _0x29e2e1;}export const roleUpdate={'service':a150_0xb326a3(0x1f1),'command':a150_0xb326a3(0x1ec),'description':'Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','risk':a150_0xb326a3(0x1f6),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a150_0xb326a3(0x1e0),'type':a150_0xb326a3(0x1f7),'required':![],'description':a150_0xb326a3(0x1e1)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x456434){readPatch(_0x456434);},async 'dryRun'(_0x368d9d){const _0x2ca7f0=a150_0xb326a3,_0x160e06=_0x368d9d[_0x2ca7f0(0x1e4)]('id'),_0x1a7967=readPatch(_0x368d9d),_0x5e3e9c=await getRoleById(_0x368d9d[_0x2ca7f0(0x1f2)],_0x160e06);return assertCustomRole(_0x5e3e9c,'update'),asDryRunResult({'operation':_0x2ca7f0(0x1ec),'selector':{'appCode':_0x368d9d[_0x2ca7f0(0x1f2)],'roleId':_0x160e06,'roleName':_0x5e3e9c['roleName']},'before':projectRole(_0x5e3e9c),'after':projectRole({..._0x5e3e9c,..._0x1a7967[_0x2ca7f0(0x1df)]!==undefined?{'roleName':_0x1a7967[_0x2ca7f0(0x1df)]}:{},..._0x1a7967['remark']!==undefined?{'remark':_0x1a7967['remark']}:{}}),'dryRun':!![],'backend':{'method':_0x2ca7f0(0x1fb),'path':UPDATE_PATH},'warnings':[]},{'method':'POST','url':UPDATE_PATH});},async 'execute'(_0x54fa71){const _0x3d86d3=a150_0xb326a3,_0x1f5b2f=_0x54fa71[_0x3d86d3(0x1e4)]('id'),_0x53e486=readPatch(_0x54fa71),_0x2b9f39=await getRoleById(_0x54fa71['appCode'],_0x1f5b2f);assertCustomRole(_0x2b9f39,'update'),await updateAppRole({'id':_0x1f5b2f,'appCode':_0x54fa71[_0x3d86d3(0x1f2)],..._0x53e486[_0x3d86d3(0x1df)]!==undefined?{'roleName':_0x53e486['roleName']}:{},..._0x53e486[_0x3d86d3(0x1ea)]!==undefined?{'remark':_0x53e486[_0x3d86d3(0x1ea)]}:{}});const _0x28aa2a=await getRoleById(_0x54fa71[_0x3d86d3(0x1f2)],_0x1f5b2f);return{'ok':!![],'data':{'operation':_0x3d86d3(0x1ec),'selector':{'appCode':_0x54fa71[_0x3d86d3(0x1f2)],'roleId':_0x1f5b2f,'roleName':_0x28aa2a[_0x3d86d3(0x1df)]},'before':projectRole(_0x2b9f39),'after':projectRole(_0x28aa2a),'dryRun':![],'backend':{'method':_0x3d86d3(0x1fb),'path':UPDATE_PATH},'warnings':[]},'message':'Updated\x20role\x20'+_0x28aa2a[_0x3d86d3(0x1df)]+'\x20(id='+_0x1f5b2f+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a151_0x4b093e=a151_0x50ec;(function(_0x3353b7,_0x719949){const _0x3a2b07=a151_0x50ec,_0x26e8e5=_0x3353b7();while(!![]){try{const _0x189e37=-parseInt(_0x3a2b07(0x1f9))/0x1+parseInt(_0x3a2b07(0x1fd))/0x2+-parseInt(_0x3a2b07(0x1fb))/0x3+parseInt(_0x3a2b07(0x1f8))/0x4+parseInt(_0x3a2b07(0x1ff))/0x5+-parseInt(_0x3a2b07(0x1f7))/0x6*(parseInt(_0x3a2b07(0x201))/0x7)+parseInt(_0x3a2b07(0x202))/0x8;if(_0x189e37===_0x719949)break;else _0x26e8e5['push'](_0x26e8e5['shift']());}catch(_0x3c4792){_0x26e8e5['push'](_0x26e8e5['shift']());}}}(a151_0x3004,0xf3daa));import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a151_0x50ec(_0xb7ec54,_0x16f342){_0xb7ec54=_0xb7ec54-0x1f4;const _0x300445=a151_0x3004();let _0x50ec38=_0x300445[_0xb7ec54];return _0x50ec38;}function a151_0x3004(){const _0x221096=['No\x20change:\x20user\x20','Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','user-add','appCode','324wfHSQG','6700412kGWLuF','1291271jfjwGp','userId','4306515SavtXL','Added\x20user\x20','17252WKvdaz','selector','1828915zvZGko','high-risk-write','219933fcvDJr','26981728dflKri','\x20already\x20in\x20role\x20','roleName'];a151_0x3004=function(){return _0x221096;};return a151_0x3004();}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':'role','command':a151_0x4b093e(0x1f5),'description':a151_0x4b093e(0x1f4),'risk':a151_0x4b093e(0x200),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x34c313){const _0xcf4f67=a151_0x4b093e,{mutation:_0x57a10d}=await prepareUserMutation(_0x34c313,_0xcf4f67(0x1f5),!![]);return asDryRunResult(_0x57a10d,{'method':'POST','url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x255917){const _0x9643ef=a151_0x4b093e,{roleList:_0x4114c5,mutation:_0x10711d,changed:_0x39fff6}=await prepareUserMutation(_0x255917,'user-add',![]);return _0x39fff6&&await updateRoleUsers(_0x255917[_0x9643ef(0x1f6)],_0x4114c5),{'ok':!![],'data':_0x10711d,'message':_0x39fff6?_0x9643ef(0x1fc)+_0x10711d['selector'][_0x9643ef(0x1fa)]+'\x20to\x20role\x20'+_0x10711d['selector'][_0x9643ef(0x204)]:_0x9643ef(0x205)+_0x10711d[_0x9643ef(0x1fe)][_0x9643ef(0x1fa)]+_0x9643ef(0x203)+_0x10711d[_0x9643ef(0x1fe)]['roleName']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a152_0x4b5247=a152_0xdb35;(function(_0x4a3bed,_0xce1f8c){const _0xd2620c=a152_0xdb35,_0x9ae517=_0x4a3bed();while(!![]){try{const _0x32de95=-parseInt(_0xd2620c(0x183))/0x1+parseInt(_0xd2620c(0x18b))/0x2+parseInt(_0xd2620c(0x182))/0x3+-parseInt(_0xd2620c(0x189))/0x4*(parseInt(_0xd2620c(0x18c))/0x5)+-parseInt(_0xd2620c(0x187))/0x6*(parseInt(_0xd2620c(0x17c))/0x7)+parseInt(_0xd2620c(0x185))/0x8*(parseInt(_0xd2620c(0x188))/0x9)+parseInt(_0xd2620c(0x180))/0xa;if(_0x32de95===_0xce1f8c)break;else _0x9ae517['push'](_0x9ae517['shift']());}catch(_0x4fc1b9){_0x9ae517['push'](_0x9ae517['shift']());}}}(a152_0x364e,0x522e7));import{updateRoleUsers}from'../../core/api-client.js';function a152_0x364e(){const _0x1c19ff=['1119354PjNlRB','35DxRinu','user-remove','selector','high-risk-write','18452qmSPga','POST','No\x20change:\x20user\x20','role','4833370KTsTKV','userId','268563oRxBxK','489469VyXohU','roleName','512VSNsml','\x20not\x20in\x20role\x20','636HCynIp','31113KAJiyG','141876JJYvOa','Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes'];a152_0x364e=function(){return _0x1c19ff;};return a152_0x364e();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';function a152_0xdb35(_0x44fee4,_0xcbf06b){_0x44fee4=_0x44fee4-0x17b;const _0x364e45=a152_0x364e();let _0xdb350d=_0x364e45[_0x44fee4];return _0xdb350d;}export const roleUserRemove={'service':a152_0x4b5247(0x17f),'command':'user-remove','description':a152_0x4b5247(0x18a),'risk':a152_0x4b5247(0x17b),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0xc63b60){const _0x338d9e=a152_0x4b5247,{mutation:_0x5e2445}=await prepareUserMutation(_0xc63b60,_0x338d9e(0x18d),!![]);return asDryRunResult(_0x5e2445,{'method':_0x338d9e(0x17d),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x4fec6c){const _0x651b3=a152_0x4b5247,{roleList:_0x3b3311,mutation:_0x397afe,changed:_0x26a80d}=await prepareUserMutation(_0x4fec6c,_0x651b3(0x18d),![]);return _0x26a80d&&await updateRoleUsers(_0x4fec6c['appCode'],_0x3b3311),{'ok':!![],'data':_0x397afe,'message':_0x26a80d?'Removed\x20user\x20'+_0x397afe['selector'][_0x651b3(0x181)]+'\x20from\x20role\x20'+_0x397afe[_0x651b3(0x18e)]['roleName']:_0x651b3(0x17e)+_0x397afe[_0x651b3(0x18e)][_0x651b3(0x181)]+_0x651b3(0x186)+_0x397afe[_0x651b3(0x18e)][_0x651b3(0x184)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a153_0x21f146=a153_0x45ac;(function(_0x332701,_0x49754d){const _0x352349=a153_0x45ac,_0x5c553b=_0x332701();while(!![]){try{const _0x2e89f1=parseInt(_0x352349(0x1cd))/0x1+-parseInt(_0x352349(0x1c9))/0x2*(parseInt(_0x352349(0x1d2))/0x3)+parseInt(_0x352349(0x1d9))/0x4+-parseInt(_0x352349(0x1cf))/0x5*(-parseInt(_0x352349(0x1d1))/0x6)+parseInt(_0x352349(0x1da))/0x7+parseInt(_0x352349(0x1d0))/0x8*(-parseInt(_0x352349(0x1c7))/0x9)+parseInt(_0x352349(0x1d7))/0xa;if(_0x2e89f1===_0x49754d)break;else _0x5c553b['push'](_0x5c553b['shift']());}catch(_0x49edd3){_0x5c553b['push'](_0x5c553b['shift']());}}}(a153_0x3685,0x35094));function a153_0x3685(){const _0x4ce23e=['192437ZBpQHl','str','\x22\x20→\x20userId\x20','183798MtsZMo','nickname','11724ZGcZCW','flagMissing','user-resolve','role','256295OxGzRz','username','30gBYzka','56uPdqri','2238ruliPU','186ZkUANF','userId','name','trim','matchedBy','3746700oGlxVD','read','251760dxOQwz'];a153_0x3685=function(){return _0x4ce23e;};return a153_0x3685();}import{CliErrors}from'../../errors.js';function a153_0x45ac(_0x22d595,_0x2ddb4a){_0x22d595=_0x22d595-0x1c7;const _0x36850c=a153_0x3685();let _0x45ac1e=_0x36850c[_0x22d595];return _0x45ac1e;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a153_0x21f146(0x1cc),'command':a153_0x21f146(0x1cb),'description':'Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','risk':a153_0x21f146(0x1d8),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x34654f){const _0x813ac7=a153_0x21f146;if(!_0x34654f[_0x813ac7(0x1db)](_0x813ac7(0x1d4))[_0x813ac7(0x1d5)]())throw CliErrors[_0x813ac7(0x1ca)](_0x813ac7(0x1d4),'Pass\x20--name\x20<nickname|username>.');},async 'execute'(_0x19a4da){const _0x4e2e01=a153_0x21f146,_0x4c0aa6=_0x19a4da[_0x4e2e01(0x1db)](_0x4e2e01(0x1d4))[_0x4e2e01(0x1d5)](),_0x50882f=await resolveUserRef(_0x4c0aa6);return{'ok':!![],'data':{'user':{'userId':_0x50882f[_0x4e2e01(0x1d3)],'username':_0x50882f[_0x4e2e01(0x1ce)],'nickname':_0x50882f[_0x4e2e01(0x1c8)],'matchedBy':_0x50882f[_0x4e2e01(0x1d6)]}},'message':'Resolved\x20\x22'+_0x4c0aa6+_0x4e2e01(0x1dc)+_0x50882f[_0x4e2e01(0x1d3)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a154_0x49f937=a154_0x38b7;(function(_0x486d4b,_0x5e494a){const _0x3df7c5=a154_0x38b7,_0x5616b2=_0x486d4b();while(!![]){try{const _0x1be22f=-parseInt(_0x3df7c5(0x1aa))/0x1*(parseInt(_0x3df7c5(0x1b1))/0x2)+parseInt(_0x3df7c5(0x1d3))/0x3+-parseInt(_0x3df7c5(0x1d2))/0x4*(-parseInt(_0x3df7c5(0x1b5))/0x5)+-parseInt(_0x3df7c5(0x1b2))/0x6*(parseInt(_0x3df7c5(0x1d8))/0x7)+parseInt(_0x3df7c5(0x1b8))/0x8+-parseInt(_0x3df7c5(0x1c7))/0x9+-parseInt(_0x3df7c5(0x1bc))/0xa;if(_0x1be22f===_0x5e494a)break;else _0x5616b2['push'](_0x5616b2['shift']());}catch(_0x1c39d1){_0x5616b2['push'](_0x5616b2['shift']());}}}(a154_0x15a1,0x27bdd));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a154_0x49f937(0x1c6),a154_0x49f937(0x1b3)]);function readPackageScripts(_0x68a261){const _0x515200=a154_0x49f937,_0x4d5d06=resolve(_0x68a261,_0x515200(0x1e5));if(!existsSync(_0x4d5d06))return null;try{const _0x2a2f6f=JSON[_0x515200(0x1e0)](readFileSync(_0x4d5d06,_0x515200(0x1be)));return _0x2a2f6f[_0x515200(0x1bd)]??{};}catch{return null;}}function detectPackageManager(_0x4f8367){const _0x3fc8fd=a154_0x49f937;if(existsSync(resolve(_0x4f8367,'bun.lockb'))||existsSync(resolve(_0x4f8367,_0x3fc8fd(0x1e1))))return _0x3fc8fd(0x1d4);if(existsSync(resolve(_0x4f8367,_0x3fc8fd(0x1b6))))return _0x3fc8fd(0x1df);if(existsSync(resolve(_0x4f8367,'yarn.lock')))return _0x3fc8fd(0x1d7);return'npm';}async function versionCheck(_0x4762d1){const _0x30e29a=a154_0x49f937,_0x25981a=await checkCliVersion();(_0x25981a[_0x30e29a(0x1bb)]||_0x25981a['belowMinimum'])&&(printCliUpgradeWarning(_0x25981a),assertCliVersionSupported(_0x25981a));const _0x325729=await checkSdkVersion(_0x4762d1);if(_0x325729[_0x30e29a(0x1bb)])printSdkUpgradeWarning(_0x325729);}function spawnScript(_0x3970d0,_0x4bac04,_0x340dab,_0x56d501){return new Promise((_0xd63fd5,_0x41198f)=>{const _0x351cb2=a154_0x38b7,_0x384213=['run',_0x4bac04,..._0x340dab],_0x47a569=spawn(_0x3970d0,_0x384213,{'cwd':_0x56d501,'stdio':_0x351cb2(0x1e4),'shell':!![],'env':{...process.env,'PATH':''+join(_0x56d501,'node_modules',_0x351cb2(0x1d9))+delimiter+process.env.PATH}});_0x47a569['on'](_0x351cb2(0x1c5),_0xb25e1b=>{const _0x46edce=_0x351cb2;if(_0xb25e1b===0x0||_0xb25e1b===null)_0xd63fd5();else _0x41198f(new Error(_0x3970d0+'\x20run\x20'+_0x4bac04+_0x46edce(0x1ac)+_0xb25e1b));}),_0x47a569['on'](_0x351cb2(0x1a8),_0x41198f);});}function spawnViteBuildWatch(_0x17cc4d){return new Promise((_0x57bf6f,_0x226861)=>{const _0x522244=a154_0x38b7,_0x288b0d=spawn(_0x522244(0x1c9),['build',_0x522244(0x1d0)],{'cwd':_0x17cc4d,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x17cc4d,_0x522244(0x1d6),_0x522244(0x1d9))+delimiter+process.env.PATH}});_0x288b0d['on'](_0x522244(0x1c5),_0xb4d8c9=>{const _0x36a83d=_0x522244;if(_0xb4d8c9===0x0||_0xb4d8c9===null)_0x57bf6f();else _0x226861(new Error(_0x36a83d(0x1c1)+_0xb4d8c9));}),_0x288b0d['on'](_0x522244(0x1a8),_0x226861);});}function a154_0x38b7(_0x45e648,_0x364af9){_0x45e648=_0x45e648-0x1a8;const _0x15a183=a154_0x15a1();let _0x38b7ab=_0x15a183[_0x45e648];return _0x38b7ab;}function spawnVitePreview(_0x1479c8){return new Promise((_0x392b83,_0x5255b2)=>{const _0x141c74=a154_0x38b7,_0x20068b=spawn('vite',['preview'],{'cwd':_0x1479c8,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x1479c8,_0x141c74(0x1d6),_0x141c74(0x1d9))+delimiter+process.env.PATH}});_0x20068b['on'](_0x141c74(0x1c5),_0x4ad1d6=>{const _0x1239f5=_0x141c74;if(_0x4ad1d6===0x0||_0x4ad1d6===null)_0x392b83();else _0x5255b2(new Error(_0x1239f5(0x1af)+_0x4ad1d6));}),_0x20068b['on'](_0x141c74(0x1a8),_0x5255b2);});}function a154_0x15a1(){const _0x19837a=['bun','args','node_modules','yarn','954814WWyWbV','.bin','bool','cwd','push','Available:\x20','\x20\x20\x20\x20','pnpm','parse','bun.lock','all','run','inherit','package.json','error','script','29EnWSce','slice','\x20exited\x20with\x20code\x20','Script\x20\x22','\x0a\x20\x20Available\x20scripts:\x0a','vite\x20preview\x20exited\x20with\x20code\x20','\x20run\x20preview\x20--watch','2798DZEmyO','12GIGydd','dev','join','5LaZjrt','pnpm-lock.yaml','Script\x20name\x20defined\x20in\x20package.json','2404760CALrzn','\x20\x20EXAMPLES','\x22\x20not\x20found\x20in\x20package.json.','needsUpgrade','2382980eIMpem','scripts','utf-8','No\x20package.json\x20found\x20in\x20current\x20directory.','preview','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','\x20run\x20preview','watch','\x20run\x20build','close','start','325431hVHCAP','length','vite','log','validation','Enable\x20watch\x20mode\x20for\x20preview','No\x20scripts\x20defined\x20in\x20package.json.','(none)','boolean','--watch','\x20run\x20<script>\x0a','1006268mNDYxv','595353jslENO'];a154_0x15a1=function(){return _0x19837a;};return a154_0x15a1();}const runFlags=[{'name':a154_0x49f937(0x1c3),'type':a154_0x49f937(0x1cf),'description':a154_0x49f937(0x1cc),'default':![]}];export const runDefinition={'service':a154_0x49f937(0x1e3),'command':a154_0x49f937(0x1e3),'description':'Run\x20a\x20package.json\x20script','risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a154_0x49f937(0x1a9),'description':a154_0x49f937(0x1b7),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x3bbf20=a154_0x49f937,_0x38c052=[];return _0x38c052[_0x3bbf20(0x1dc)](_0x3bbf20(0x1b9)),_0x38c052['push'](_0x3bbf20(0x1de)+CLI_BIN_NAME+'\x20run\x20start'),_0x38c052['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x3bbf20(0x1c4)),_0x38c052[_0x3bbf20(0x1dc)](_0x3bbf20(0x1de)+CLI_BIN_NAME+_0x3bbf20(0x1c2)),_0x38c052[_0x3bbf20(0x1dc)](_0x3bbf20(0x1de)+CLI_BIN_NAME+_0x3bbf20(0x1b0)),_0x38c052[_0x3bbf20(0x1b4)]('\x0a');},async 'execute'(_0x16ffec){const _0x7a2b63=a154_0x49f937,_0x293bc6=process[_0x7a2b63(0x1db)](),_0x17dca9=_0x16ffec[_0x7a2b63(0x1d5)][0x0],_0x45f592=_0x16ffec[_0x7a2b63(0x1d5)][_0x7a2b63(0x1ab)](0x1),_0x19d234=readPackageScripts(_0x293bc6);if(!_0x19d234)throw CliErrors[_0x7a2b63(0x1cb)](_0x7a2b63(0x1bf));if(!_0x17dca9){const _0x5e2c23=Object['keys'](_0x19d234);if(_0x5e2c23[_0x7a2b63(0x1c8)]===0x0)console[_0x7a2b63(0x1ca)](_0x7a2b63(0x1cd));else{console['log'](_0x7a2b63(0x1ae));for(const _0x549c19 of _0x5e2c23){console[_0x7a2b63(0x1ca)](_0x7a2b63(0x1de)+_0x549c19);}console[_0x7a2b63(0x1ca)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+_0x7a2b63(0x1d1));}return{'ok':!![]};}if(!_0x19d234[_0x17dca9])throw CliErrors[_0x7a2b63(0x1cb)](_0x7a2b63(0x1ad)+_0x17dca9+_0x7a2b63(0x1ba),_0x7a2b63(0x1dd)+(Object['keys'](_0x19d234)['join'](',\x20')||_0x7a2b63(0x1ce)));const _0x57467a=detectPackageManager(_0x293bc6);VERSION_CHECK_SCRIPTS['has'](_0x17dca9)&&await versionCheck(_0x293bc6);if(_0x17dca9===_0x7a2b63(0x1c0)&&_0x16ffec[_0x7a2b63(0x1da)](_0x7a2b63(0x1c3)))return await Promise[_0x7a2b63(0x1e2)]([spawnViteBuildWatch(_0x293bc6),spawnVitePreview(_0x293bc6)]),{'ok':!![]};return await spawnScript(_0x57467a,_0x17dca9,_0x45f592,_0x293bc6),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a155_0x5c7721=a155_0x5b0a;(function(_0x4d326a,_0x542608){const _0x59c1a3=a155_0x5b0a,_0x4ea0cd=_0x4d326a();while(!![]){try{const _0x1d42f5=parseInt(_0x59c1a3(0x8a))/0x1+parseInt(_0x59c1a3(0x8f))/0x2+parseInt(_0x59c1a3(0x8b))/0x3+-parseInt(_0x59c1a3(0x8c))/0x4+-parseInt(_0x59c1a3(0x95))/0x5+parseInt(_0x59c1a3(0x92))/0x6*(-parseInt(_0x59c1a3(0x8d))/0x7)+-parseInt(_0x59c1a3(0x94))/0x8*(parseInt(_0x59c1a3(0x90))/0x9);if(_0x1d42f5===_0x542608)break;else _0x4ea0cd['push'](_0x4ea0cd['shift']());}catch(_0x463b75){_0x4ea0cd['push'](_0x4ea0cd['shift']());}}}(a155_0xfb6d,0xa2007));import{buildSchemaPayload}from'../framework/schema-export.js';function a155_0x5b0a(_0x29a19d,_0x5bb990){_0x29a19d=_0x29a19d-0x8a;const _0xfb6dc9=a155_0xfb6d();let _0x5b0aea=_0xfb6dc9[_0x29a19d];return _0x5b0aea;}function a155_0xfb6d(){const _0x27f35a=['1224267UlmYpb','3264165GcORpA','1887340PdKXou','66710qPOReN','export','2557320qUPMhu','18pvRQCH','schema','24KWdjqj','read','5471448pDVTZg','5248030pbaQlZ','json'];a155_0xfb6d=function(){return _0x27f35a;};return a155_0xfb6d();}async function execute(_0x42bd33){const _0x291894=await buildSchemaPayload();return{'ok':!![],'data':_0x291894};}export const schemaDefinition={'service':a155_0x5c7721(0x91),'command':a155_0x5c7721(0x8e),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a155_0x5c7721(0x93),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a155_0x5c7721(0x96),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a156_0x126934=a156_0xb299;(function(_0x265eb0,_0xe11e9b){const _0xf47180=a156_0xb299,_0x25eccb=_0x265eb0();while(!![]){try{const _0x378c51=-parseInt(_0xf47180(0x210))/0x1+-parseInt(_0xf47180(0x1fc))/0x2*(-parseInt(_0xf47180(0x1e1))/0x3)+parseInt(_0xf47180(0x1e9))/0x4*(parseInt(_0xf47180(0x20f))/0x5)+parseInt(_0xf47180(0x1e7))/0x6+-parseInt(_0xf47180(0x203))/0x7+-parseInt(_0xf47180(0x1eb))/0x8*(-parseInt(_0xf47180(0x21e))/0x9)+-parseInt(_0xf47180(0x1f7))/0xa*(-parseInt(_0xf47180(0x1ec))/0xb);if(_0x378c51===_0xe11e9b)break;else _0x25eccb['push'](_0x25eccb['shift']());}catch(_0x2be3ec){_0x25eccb['push'](_0x25eccb['shift']());}}}(a156_0xa852,0xea145));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';function a156_0xb299(_0x2ccf74,_0x41b4de){_0x2ccf74=_0x2ccf74-0x1df;const _0xa8522a=a156_0xa852();let _0xb2991=_0xa8522a[_0x2ccf74];return _0xb2991;}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 a156_0xa852(){const _0x151b6a=['utf8','✎\x20手动输入\x20dbId','3860088jqFvpg','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','24036eCNTJL','validation','155704LDNbYr','516527pHOjVE','number','sqlRootDir','SQL\x20query\x20display\x20name','name','dbId\x20不能为空','join','<server-generated-sqlCode>','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','dbName','sqlCode','150wLehNG','Target\x20database\x20ID','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','Local\x20SQL\x20file\x20mode','POST','2BXuUVr','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','普通\x20SQL(sql)','db-id','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','stringify','sqlRoot','5743038YbhxON','sqls','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','__manual__','SQL\x20名称不能为空','MyBatis\x20XML(mybatisXml)','Created\x20SQL\x20query\x20','lastSync','flag','appCode','sql','dbId\x20必须为正整数','1025kQrtFs','1606565WQqryv','lockFilePath','请选择目标数据库:','trim','请输入\x20SQL\x20名称:','high-risk-write','dbId','create','SELECT\x201\x20AS\x20id;','new','isInteger','mode','mybatisXml','parse','9NcwOpk','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','isFinite','description','catch','nonInteractive','string','length','sqlName','2360331JPpMqt','str','map','flagMissing'];a156_0xa852=function(){return _0x151b6a;};return a156_0xa852();}function generateSqlTemplate(_0x487975){const _0x380888=a156_0xb299;if(_0x487975===_0x380888(0x21c))return[_0x380888(0x205),'\x20\x20SELECT\x201\x20AS\x20id','</select>',''][_0x380888(0x1f2)]('\x0a');return[_0x380888(0x218),''][_0x380888(0x1f2)]('\x0a');}export const sqlCreate={'service':a156_0x126934(0x20d),'command':a156_0x126934(0x217),'description':a156_0x126934(0x1e8),'risk':a156_0x126934(0x215),'flags':[{'name':a156_0x126934(0x1f0),'type':a156_0x126934(0x224),'description':a156_0x126934(0x1ef)},{'name':a156_0x126934(0x1ff),'type':a156_0x126934(0x1ed),'description':a156_0x126934(0x1f8)},{'name':a156_0x126934(0x21b),'type':a156_0x126934(0x224),'enum':['sql',a156_0x126934(0x21c)],'description':a156_0x126934(0x1fa)}],async 'validate'(_0xe86012){const _0x49e3bd=a156_0x126934;if(!_0xe86012[_0x49e3bd(0x223)])return;if(!_0xe86012['str'](_0x49e3bd(0x1f0))['trim']())throw CliErrors[_0x49e3bd(0x1e4)](_0x49e3bd(0x1f0),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x1aa3e1=resolveProvidedDbId(_0xe86012);if(typeof _0x1aa3e1!==_0x49e3bd(0x1ed)||!Number[_0x49e3bd(0x220)](_0x1aa3e1)||_0x1aa3e1<=0x0)throw CliErrors[_0x49e3bd(0x1e4)](_0x49e3bd(0x1ff),_0x49e3bd(0x1fd));if(!_0xe86012['str'](_0x49e3bd(0x21b))[_0x49e3bd(0x213)]())throw CliErrors[_0x49e3bd(0x1e4)](_0x49e3bd(0x21b),_0x49e3bd(0x1f9));},async 'dryRun'(_0x2223ed){const _0x4de32a=a156_0x126934,_0x450d33=loadSqlProjectConfig(_0x2223ed[_0x4de32a(0x20c)]),{sqlName:_0x3f7029,dbId:_0x329031,dbName:_0x4c6074,mode:_0x4598bf}=await resolveSqlNewInputs(_0x2223ed),_0x4461e1=buildSqlRelativePath(_0x4de32a(0x1f3),_0x3f7029,_0x4c6074,_0x4598bf,_0x329031),_0x48370a=_0x450d33[_0x4de32a(0x1ee)]+'/'+_0x4461e1;return{'method':_0x4de32a(0x1fb),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x2223ed[_0x4de32a(0x20c)],'sqlName':_0x3f7029,'dbId':_0x329031,'mode':_0x4598bf,'localPath':_0x48370a},'description':_0x4de32a(0x21f)+_0x450d33['sqlRootDir']};},async 'execute'(_0x2a363d){const _0x399b65=a156_0x126934,_0x4e8fc1=loadSqlProjectConfig(_0x2a363d[_0x399b65(0x20c)]),{sqlName:_0x26f7b8,dbId:_0xbad78,dbName:_0x3a86d1,mode:_0x597344}=await resolveSqlNewInputs(_0x2a363d),_0x11b50e=generateSqlTemplate(_0x597344),_0xbe28d3=await createSqlQuery({'appCode':_0x2a363d['appCode'],'sqlName':_0x26f7b8,'dbId':_0xbad78,'sqlContent':_0x11b50e}),_0x3d3a94=ensureRemoteSqlContent(_0xbe28d3),_0x2a5005=_0x3a86d1||await getDbName(_0x2a363d[_0x399b65(0x20c)],_0xbad78)[_0x399b65(0x222)](()=>undefined),_0x28133d=buildSqlRelativePath(_0xbe28d3[_0x399b65(0x1f6)],_0xbe28d3['sqlName'],_0x2a5005,_0x597344,_0xbad78),_0x709b8d=_0x4e8fc1['sqlRootDir']+'/'+_0x28133d,_0x2d36d9=buildLocalSqlFileContent({'sqlCode':_0xbe28d3[_0x399b65(0x1f6)],'sqlName':_0xbe28d3[_0x399b65(0x1e0)],'dbId':_0xbe28d3['dbId']},_0x3d3a94,{'dbName':_0x2a5005,'mode':_0x597344,'syncedAt':new Date()['toISOString'](),'description':_0xbe28d3[_0x399b65(0x221)]});if(await fileExists(_0x709b8d))throw CliErrors['validation']('File\x20already\x20exists:\x20'+_0x709b8d);await ensureParentDirectory(_0x709b8d),await writeFile(_0x709b8d,_0x2d36d9,_0x399b65(0x1e5));const _0x4c96ef=await readSqlLockFile(_0x4e8fc1['lockFilePath']),{lockData:_0x3f2790,appLock:_0x533925}=ensureSqlLockScope(_0x4c96ef??createEmptySqlLock(),_0x4e8fc1[_0x399b65(0x20c)],_0x4e8fc1[_0x399b65(0x202)],_0x399b65(0x219));return _0x533925[_0x399b65(0x204)][_0xbe28d3[_0x399b65(0x1f6)]]={...buildSqlLockEntry(_0xbe28d3,_0x3d3a94,computeSqlContentHash(_0x2d36d9),{'dbName':_0x2a5005}),'path':_0x28133d,'mode':_0x597344},_0x533925[_0x399b65(0x20a)]=new Date()['toISOString'](),await writeSqlLockFile(_0x4e8fc1[_0x399b65(0x211)],_0x3f2790),{'ok':!![],'data':{'id':_0xbe28d3['id'],'sqlCode':_0xbe28d3[_0x399b65(0x1f6)],'sqlName':_0xbe28d3[_0x399b65(0x1e0)],'dbId':_0xbe28d3[_0x399b65(0x216)],'path':_0x709b8d,'mode':_0x597344},'message':_0x399b65(0x209)+_0xbe28d3[_0x399b65(0x1f6)]};}};async function resolveSqlNewInputs(_0x52efdc){const _0xb4f495=await resolveSqlNameInput(_0x52efdc),{dbId:_0x382c9c,dbName:_0x5805b7}=await resolveDbSelection(_0x52efdc),_0x1b926e=await resolveSqlModeInput(_0x52efdc);return{'sqlName':_0xb4f495,'dbId':_0x382c9c,'dbName':_0x5805b7,'mode':_0x1b926e};}async function resolveSqlNameInput(_0x38cafc){const _0x128abf=a156_0x126934,_0x3f264c=_0x38cafc['str'](_0x128abf(0x1f0))[_0x128abf(0x213)]();if(_0x3f264c)return _0x3f264c;if(_0x38cafc[_0x128abf(0x223)])throw CliErrors['flagMissing']('name',_0x128abf(0x1f4));return(await input({'message':_0x128abf(0x214),'validate':_0x4aeea6=>_0x4aeea6[_0x128abf(0x213)]()?!![]:_0x128abf(0x207)}))[_0x128abf(0x213)]();}async function resolveDbSelection(_0x25bb1e){const _0x1a35c5=a156_0x126934,_0xc6f185=resolveProvidedDbId(_0x25bb1e);if(typeof _0xc6f185==='number'&&Number[_0x1a35c5(0x220)](_0xc6f185)&&_0xc6f185>0x0)return{'dbId':_0xc6f185,'dbName':await getDbName(_0x25bb1e['appCode'],_0xc6f185)['catch'](()=>undefined)};if(_0x25bb1e[_0x1a35c5(0x223)])throw CliErrors['flagMissing'](_0x1a35c5(0x1ff),_0x1a35c5(0x1fd));const _0x27b6bc=await listDatabases(_0x25bb1e['appCode'])[_0x1a35c5(0x222)](()=>[]);if(_0x27b6bc[_0x1a35c5(0x1df)]===0x1)return{'dbId':_0x27b6bc[0x0][_0x1a35c5(0x216)],'dbName':_0x27b6bc[0x0][_0x1a35c5(0x1f5)]};if(_0x27b6bc[_0x1a35c5(0x1df)]>0x1){const _0xf33337=await select({'message':_0x1a35c5(0x212),'choices':[..._0x27b6bc[_0x1a35c5(0x1e3)](_0x1476f1=>({'name':_0x1476f1['dbName']+'\x20('+_0x1476f1[_0x1a35c5(0x216)]+')','value':serializeDbSelection(_0x1476f1)})),{'name':_0x1a35c5(0x1e6),'value':_0x1a35c5(0x206)}]});if(_0xf33337!==_0x1a35c5(0x206))return deserializeDbSelection(_0xf33337);}const _0xbfb197=await input({'message':'请输入目标数据库\x20dbId:','validate':_0x54ddbe=>{const _0x4b037c=_0x1a35c5,_0x36e95c=_0x54ddbe[_0x4b037c(0x213)]();if(!_0x36e95c)return _0x4b037c(0x1f1);const _0x32b88f=Number(_0x36e95c);if(!Number[_0x4b037c(0x21a)](_0x32b88f)||_0x32b88f<=0x0)return _0x4b037c(0x20e);return!![];}});return{'dbId':Number(_0xbfb197['trim']())};}async function resolveSqlModeInput(_0x23194d){const _0x3fdbe3=a156_0x126934,_0x2f146a=_0x23194d[_0x3fdbe3(0x1e2)]('mode')[_0x3fdbe3(0x213)]();if(_0x2f146a===_0x3fdbe3(0x20d)||_0x2f146a===_0x3fdbe3(0x21c))return _0x2f146a;if(_0x23194d[_0x3fdbe3(0x223)])throw CliErrors[_0x3fdbe3(0x1e4)](_0x3fdbe3(0x21b),_0x3fdbe3(0x1f9));return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':_0x3fdbe3(0x1fe),'value':_0x3fdbe3(0x20d),'description':_0x3fdbe3(0x200)},{'name':_0x3fdbe3(0x208),'value':_0x3fdbe3(0x21c),'description':'适合带动态标签的\x20MyBatis\x20XML\x20SQL'}]});}function serializeDbSelection(_0x271ce5){const _0x3fe400=a156_0x126934;return JSON[_0x3fe400(0x201)]({'dbId':_0x271ce5[_0x3fe400(0x216)],'dbName':_0x271ce5[_0x3fe400(0x1f5)]});}function deserializeDbSelection(_0x52b772){const _0x3e11d8=a156_0x126934;try{const _0x20043f=JSON[_0x3e11d8(0x21d)](_0x52b772);if(typeof _0x20043f[_0x3e11d8(0x216)]===_0x3e11d8(0x1ed)&&Number[_0x3e11d8(0x220)](_0x20043f['dbId']))return{'dbId':_0x20043f[_0x3e11d8(0x216)],'dbName':_0x20043f[_0x3e11d8(0x1f5)]};}catch{}throw CliErrors[_0x3e11d8(0x1ea)]('Invalid\x20database\x20selection\x20payload:\x20'+_0x52b772);}function resolveProvidedDbId(_0xecc950){const _0x1aad52=a156_0x126934,_0x345def=_0xecc950[_0x1aad52(0x20b)](_0x1aad52(0x1ff));if(typeof _0x345def===_0x1aad52(0x1ed)&&Number[_0x1aad52(0x220)](_0x345def))return _0x345def;return undefined;}
|
|
1
|
+
const a156_0x50e9e7=a156_0x42dd;(function(_0x142527,_0x4b75f1){const _0x3fd3ec=a156_0x42dd,_0x3f4cf4=_0x142527();while(!![]){try{const _0x5f3961=-parseInt(_0x3fd3ec(0x120))/0x1*(-parseInt(_0x3fd3ec(0x12a))/0x2)+-parseInt(_0x3fd3ec(0x145))/0x3*(parseInt(_0x3fd3ec(0x11b))/0x4)+-parseInt(_0x3fd3ec(0x11c))/0x5+-parseInt(_0x3fd3ec(0x146))/0x6+parseInt(_0x3fd3ec(0x114))/0x7*(-parseInt(_0x3fd3ec(0x117))/0x8)+parseInt(_0x3fd3ec(0x149))/0x9*(parseInt(_0x3fd3ec(0x108))/0xa)+parseInt(_0x3fd3ec(0x133))/0xb;if(_0x5f3961===_0x4b75f1)break;else _0x3f4cf4['push'](_0x3f4cf4['shift']());}catch(_0x3364d3){_0x3f4cf4['push'](_0x3f4cf4['shift']());}}}(a156_0x38f0,0xdf558));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';function a156_0x38f0(){const _0x96559b=['2AfXQNu','Local\x20SQL\x20file\x20mode','string','请输入目标数据库\x20dbId:','sql','dbId','flag','Created\x20SQL\x20query\x20','name','flagMissing','495346jVhHxB','dbId\x20必须为正整数','普通\x20SQL(sql)','mybatisXml','create','isInteger','map','✎\x20手动输入\x20dbId','isFinite','41112478fNZvqs','POST','请输入\x20SQL\x20名称:','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','请选择本地\x20SQL\x20模式:','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','/smartapi/custom/saveUserCustomSql','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','stringify','sqlCode','lockFilePath','<server-generated-sqlCode>','str','__manual__','length','catch','high-risk-write','db-id','148233jPHuPD','5039610GwSRbX','number','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','664695wRKirY','SELECT\x201\x20AS\x20id;','20bXNAIm','validation','toISOString','Invalid\x20database\x20selection\x20payload:\x20','utf8','parse','nonInteractive','sqls','trim','mode','\x20\x20SELECT\x201\x20AS\x20id','appCode','2261FXBxNo','Target\x20database\x20ID','dbName','25768AdsyyP','sqlName','join','dbId\x20不能为空','12rHqccH','7186135zDIFEG','SQL\x20query\x20display\x20name','new','sqlRootDir'];a156_0x38f0=function(){return _0x96559b;};return a156_0x38f0();}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(_0x271e4e){const _0x593dd2=a156_0x42dd;if(_0x271e4e===_0x593dd2(0x12d))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x593dd2(0x112),'</select>',''][_0x593dd2(0x119)]('\x0a');return[_0x593dd2(0x14a),''][_0x593dd2(0x119)]('\x0a');}function a156_0x42dd(_0x341641,_0x4b2f71){_0x341641=_0x341641-0x108;const _0x38f07c=a156_0x38f0();let _0x42dd95=_0x38f07c[_0x341641];return _0x42dd95;}export const sqlCreate={'service':a156_0x50e9e7(0x124),'command':a156_0x50e9e7(0x12e),'description':a156_0x50e9e7(0x148),'risk':a156_0x50e9e7(0x143),'flags':[{'name':a156_0x50e9e7(0x128),'type':'string','description':a156_0x50e9e7(0x11d)},{'name':a156_0x50e9e7(0x144),'type':a156_0x50e9e7(0x147),'description':a156_0x50e9e7(0x115)},{'name':'mode','type':a156_0x50e9e7(0x122),'enum':['sql','mybatisXml'],'description':a156_0x50e9e7(0x121)}],async 'validate'(_0x1286bf){const _0x363557=a156_0x50e9e7;if(!_0x1286bf[_0x363557(0x10e)])return;if(!_0x1286bf[_0x363557(0x13f)](_0x363557(0x128))[_0x363557(0x110)]())throw CliErrors[_0x363557(0x129)](_0x363557(0x128),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0xb0cd54=resolveProvidedDbId(_0x1286bf);if(typeof _0xb0cd54!==_0x363557(0x147)||!Number[_0x363557(0x132)](_0xb0cd54)||_0xb0cd54<=0x0)throw CliErrors[_0x363557(0x129)](_0x363557(0x144),_0x363557(0x138));if(!_0x1286bf[_0x363557(0x13f)](_0x363557(0x111))[_0x363557(0x110)]())throw CliErrors[_0x363557(0x129)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x53fd27){const _0x597f00=a156_0x50e9e7,_0x518407=loadSqlProjectConfig(_0x53fd27[_0x597f00(0x113)]),{sqlName:_0x28923b,dbId:_0x2ad01d,dbName:_0x1139ef,mode:_0x2b43a4}=await resolveSqlNewInputs(_0x53fd27),_0x46b088=buildSqlRelativePath(_0x597f00(0x13e),_0x28923b,_0x1139ef,_0x2b43a4,_0x2ad01d),_0x1e76c3=_0x518407['sqlRootDir']+'/'+_0x46b088;return{'method':_0x597f00(0x134),'url':_0x597f00(0x139),'body':{'appCode':_0x53fd27['appCode'],'sqlName':_0x28923b,'dbId':_0x2ad01d,'mode':_0x2b43a4,'localPath':_0x1e76c3},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x518407[_0x597f00(0x11f)]};},async 'execute'(_0x20711a){const _0x4dc13f=a156_0x50e9e7,_0x39b038=loadSqlProjectConfig(_0x20711a[_0x4dc13f(0x113)]),{sqlName:_0x32331b,dbId:_0x461a46,dbName:_0x1a7010,mode:_0x53274b}=await resolveSqlNewInputs(_0x20711a),_0x1f6924=generateSqlTemplate(_0x53274b),_0x273d13=await createSqlQuery({'appCode':_0x20711a[_0x4dc13f(0x113)],'sqlName':_0x32331b,'dbId':_0x461a46,'sqlContent':_0x1f6924}),_0x507f4f=ensureRemoteSqlContent(_0x273d13),_0x13765e=_0x1a7010||await getDbName(_0x20711a[_0x4dc13f(0x113)],_0x461a46)['catch'](()=>undefined),_0x3cb21d=buildSqlRelativePath(_0x273d13[_0x4dc13f(0x13c)],_0x273d13[_0x4dc13f(0x118)],_0x13765e,_0x53274b,_0x461a46),_0x3dc2a9=_0x39b038[_0x4dc13f(0x11f)]+'/'+_0x3cb21d,_0x45719d=buildLocalSqlFileContent({'sqlCode':_0x273d13[_0x4dc13f(0x13c)],'sqlName':_0x273d13[_0x4dc13f(0x118)],'dbId':_0x273d13[_0x4dc13f(0x125)]},_0x507f4f,{'dbName':_0x13765e,'mode':_0x53274b,'syncedAt':new Date()[_0x4dc13f(0x10a)](),'description':_0x273d13['description']});if(await fileExists(_0x3dc2a9))throw CliErrors[_0x4dc13f(0x109)]('File\x20already\x20exists:\x20'+_0x3dc2a9);await ensureParentDirectory(_0x3dc2a9),await writeFile(_0x3dc2a9,_0x45719d,_0x4dc13f(0x10c));const _0x562d9c=await readSqlLockFile(_0x39b038['lockFilePath']),{lockData:_0x1bc38b,appLock:_0x5d483a}=ensureSqlLockScope(_0x562d9c??createEmptySqlLock(),_0x39b038[_0x4dc13f(0x113)],_0x39b038['sqlRoot'],_0x4dc13f(0x11e));return _0x5d483a[_0x4dc13f(0x10f)][_0x273d13[_0x4dc13f(0x13c)]]={...buildSqlLockEntry(_0x273d13,_0x507f4f,computeSqlContentHash(_0x45719d),{'dbName':_0x13765e}),'path':_0x3cb21d,'mode':_0x53274b},_0x5d483a['lastSync']=new Date()[_0x4dc13f(0x10a)](),await writeSqlLockFile(_0x39b038[_0x4dc13f(0x13d)],_0x1bc38b),{'ok':!![],'data':{'id':_0x273d13['id'],'sqlCode':_0x273d13[_0x4dc13f(0x13c)],'sqlName':_0x273d13[_0x4dc13f(0x118)],'dbId':_0x273d13['dbId'],'path':_0x3dc2a9,'mode':_0x53274b},'message':_0x4dc13f(0x127)+_0x273d13[_0x4dc13f(0x13c)]};}};async function resolveSqlNewInputs(_0x12cc4d){const _0x48063d=await resolveSqlNameInput(_0x12cc4d),{dbId:_0x10631d,dbName:_0x2f6748}=await resolveDbSelection(_0x12cc4d),_0x608336=await resolveSqlModeInput(_0x12cc4d);return{'sqlName':_0x48063d,'dbId':_0x10631d,'dbName':_0x2f6748,'mode':_0x608336};}async function resolveSqlNameInput(_0x436dd9){const _0x41e461=a156_0x50e9e7,_0x764e1e=_0x436dd9[_0x41e461(0x13f)](_0x41e461(0x128))[_0x41e461(0x110)]();if(_0x764e1e)return _0x764e1e;if(_0x436dd9['nonInteractive'])throw CliErrors['flagMissing'](_0x41e461(0x128),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0x41e461(0x135),'validate':_0x51108a=>_0x51108a[_0x41e461(0x110)]()?!![]:'SQL\x20名称不能为空'}))['trim']();}async function resolveDbSelection(_0x92dd20){const _0xae0806=a156_0x50e9e7,_0x1f5d74=resolveProvidedDbId(_0x92dd20);if(typeof _0x1f5d74===_0xae0806(0x147)&&Number[_0xae0806(0x132)](_0x1f5d74)&&_0x1f5d74>0x0)return{'dbId':_0x1f5d74,'dbName':await getDbName(_0x92dd20[_0xae0806(0x113)],_0x1f5d74)[_0xae0806(0x142)](()=>undefined)};if(_0x92dd20[_0xae0806(0x10e)])throw CliErrors[_0xae0806(0x129)]('db-id',_0xae0806(0x138));const _0x1d3b1c=await listDatabases(_0x92dd20['appCode'])['catch'](()=>[]);if(_0x1d3b1c['length']===0x1)return{'dbId':_0x1d3b1c[0x0][_0xae0806(0x125)],'dbName':_0x1d3b1c[0x0]['dbName']};if(_0x1d3b1c[_0xae0806(0x141)]>0x1){const _0x58a634=await select({'message':'请选择目标数据库:','choices':[..._0x1d3b1c[_0xae0806(0x130)](_0x6837d2=>({'name':_0x6837d2[_0xae0806(0x116)]+'\x20('+_0x6837d2[_0xae0806(0x125)]+')','value':serializeDbSelection(_0x6837d2)})),{'name':_0xae0806(0x131),'value':'__manual__'}]});if(_0x58a634!==_0xae0806(0x140))return deserializeDbSelection(_0x58a634);}const _0x29e453=await input({'message':_0xae0806(0x123),'validate':_0x4f750a=>{const _0x3ff48d=_0xae0806,_0x616320=_0x4f750a[_0x3ff48d(0x110)]();if(!_0x616320)return _0x3ff48d(0x11a);const _0x4645d0=Number(_0x616320);if(!Number[_0x3ff48d(0x12f)](_0x4645d0)||_0x4645d0<=0x0)return _0x3ff48d(0x12b);return!![];}});return{'dbId':Number(_0x29e453[_0xae0806(0x110)]())};}async function resolveSqlModeInput(_0x32a7d7){const _0xd912f9=a156_0x50e9e7,_0x588c27=_0x32a7d7['str'](_0xd912f9(0x111))[_0xd912f9(0x110)]();if(_0x588c27==='sql'||_0x588c27===_0xd912f9(0x12d))return _0x588c27;if(_0x32a7d7[_0xd912f9(0x10e)])throw CliErrors[_0xd912f9(0x129)]('mode',_0xd912f9(0x13a));return await select({'message':_0xd912f9(0x137),'choices':[{'name':_0xd912f9(0x12c),'value':_0xd912f9(0x124),'description':_0xd912f9(0x136)},{'name':'MyBatis\x20XML(mybatisXml)','value':_0xd912f9(0x12d),'description':'适合带动态标签的\x20MyBatis\x20XML\x20SQL'}]});}function serializeDbSelection(_0x13c395){const _0x24e148=a156_0x50e9e7;return JSON[_0x24e148(0x13b)]({'dbId':_0x13c395['dbId'],'dbName':_0x13c395[_0x24e148(0x116)]});}function deserializeDbSelection(_0x548fb6){const _0x172485=a156_0x50e9e7;try{const _0x44fa51=JSON[_0x172485(0x10d)](_0x548fb6);if(typeof _0x44fa51['dbId']===_0x172485(0x147)&&Number[_0x172485(0x132)](_0x44fa51['dbId']))return{'dbId':_0x44fa51[_0x172485(0x125)],'dbName':_0x44fa51['dbName']};}catch{}throw CliErrors[_0x172485(0x109)](_0x172485(0x10b)+_0x548fb6);}function resolveProvidedDbId(_0x3ec298){const _0x34e2f3=a156_0x50e9e7,_0x3f6767=_0x3ec298[_0x34e2f3(0x126)](_0x34e2f3(0x144));if(typeof _0x3f6767===_0x34e2f3(0x147)&&Number[_0x34e2f3(0x132)](_0x3f6767))return _0x3f6767;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a157_0x1fa9(){const _0x3808c2=['3197552IdhVdL','trashedTo','str','replace','entries','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','POST','sqlcode','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','/smartapi/custom/deleteUserCustomSql','length','sqlRootDir','validation','high-risk-write','Deleted\x20','appCode','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','lockFilePath','10323131LqRlUM','trashDir','5275OzfOoQ','1757267OdSfMA','sqlRoot','sql','1190829RkvQGO','remoteId','2918876XIHoWh','projectRoot','SQL\x20lock\x20file\x20not\x20found.','3468XgpQqj','sqls','delete','189GWFieQ','7123344iTxmuH'];a157_0x1fa9=function(){return _0x3808c2;};return a157_0x1fa9();}const a157_0x46a1bf=a157_0x42c2;(function(_0x58c9ce,_0x14e916){const _0x42c543=a157_0x42c2,_0x2206ac=_0x58c9ce();while(!![]){try{const _0x41a70e=-parseInt(_0x42c543(0x1e7))/0x1+-parseInt(_0x42c543(0x1ec))/0x2+-parseInt(_0x42c543(0x1ea))/0x3+-parseInt(_0x42c543(0x1f3))/0x4+parseInt(_0x42c543(0x1e6))/0x5*(-parseInt(_0x42c543(0x1ef))/0x6)+-parseInt(_0x42c543(0x1e4))/0x7+parseInt(_0x42c543(0x1f4))/0x8*(parseInt(_0x42c543(0x1f2))/0x9);if(_0x41a70e===_0x14e916)break;else _0x2206ac['push'](_0x2206ac['shift']());}catch(_0x3e235a){_0x2206ac['push'](_0x2206ac['shift']());}}}(a157_0x1fa9,0xdf487));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a157_0x42c2(_0x51d5ac,_0x47ee1c){_0x51d5ac=_0x51d5ac-0x1d9;const _0x1fa927=a157_0x1fa9();let _0x42c2a5=_0x1fa927[_0x51d5ac];return _0x42c2a5;}import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a157_0x46a1bf(0x1e9),'command':a157_0x46a1bf(0x1f1),'description':a157_0x46a1bf(0x1f9),'risk':a157_0x46a1bf(0x1df),'flags':[SQLCODE_FLAG],async 'validate'(_0x2598a0){const _0x1d3609=a157_0x46a1bf,_0x274460=loadSqlProjectConfig(_0x2598a0['appCode']),_0xae9b2f=await readSqlLockFile(_0x274460['lockFilePath']);if(!_0xae9b2f)throw CliErrors[_0x1d3609(0x1de)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x3966e5){const _0x3ae789=a157_0x46a1bf,_0x5b1824=loadSqlProjectConfig(_0x3966e5[_0x3ae789(0x1e1)]),_0x5d4b48=await readSqlLockFile(_0x5b1824[_0x3ae789(0x1e3)]);if(!_0x5d4b48)throw CliErrors[_0x3ae789(0x1de)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x392951}=ensureSqlLockScope(_0x5d4b48,_0x3966e5[_0x3ae789(0x1e1)],_0x5b1824['sqlRoot'],_0x3ae789(0x1f1)),_0x278b6d=_0x3966e5['str'](_0x3ae789(0x1d9)),_0x1b57d9=_0x392951[_0x3ae789(0x1f0)][_0x278b6d];if(!_0x1b57d9)throw CliErrors[_0x3ae789(0x1de)](_0x3ae789(0x1da)+_0x278b6d+'\x22.');return{'method':_0x3ae789(0x1fa),'url':_0x3ae789(0x1db),'body':{'sqlCode':_0x278b6d,'id':_0x1b57d9[_0x3ae789(0x1eb)],'localPath':resolveLocalSqlFilePath(_0x5b1824,_0x278b6d,_0x1b57d9)},'description':'Would\x20delete\x20SQL\x20'+_0x278b6d+_0x3ae789(0x1e2)+_0x5b1824[_0x3ae789(0x1e5)]};},async 'execute'(_0x2a3352){const _0x382a36=a157_0x46a1bf,_0x557e1d=loadSqlProjectConfig(_0x2a3352['appCode']),_0x536b98=await readSqlLockFile(_0x557e1d[_0x382a36(0x1e3)]);if(!_0x536b98)throw CliErrors[_0x382a36(0x1de)](_0x382a36(0x1ee));const {lockData:_0x54eaba,appLock:_0x5ec5e2}=ensureSqlLockScope(_0x536b98,_0x2a3352[_0x382a36(0x1e1)],_0x557e1d[_0x382a36(0x1e8)],_0x382a36(0x1f1)),_0x137efa=_0x2a3352[_0x382a36(0x1f6)]('sqlcode'),_0x31deca=_0x5ec5e2[_0x382a36(0x1f0)][_0x137efa];if(!_0x31deca)throw CliErrors[_0x382a36(0x1de)](_0x382a36(0x1da)+_0x137efa+'\x22.');await deleteSqlQuery({'id':_0x31deca[_0x382a36(0x1eb)],'sqlCode':_0x137efa}),_0x5ec5e2['sqls']=Object['fromEntries'](Object[_0x382a36(0x1f8)](_0x5ec5e2[_0x382a36(0x1f0)])['filter'](([_0x2e758c])=>_0x2e758c!==_0x137efa)),_0x5ec5e2['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x557e1d['lockFilePath'],_0x54eaba);const _0x2ebf25=resolveLocalSqlFilePath(_0x557e1d,_0x137efa,_0x31deca);let _0x40ef47;await fileExists(_0x2ebf25)&&(_0x40ef47=await moveToTrash(_0x557e1d[_0x382a36(0x1ed)],_0x557e1d[_0x382a36(0x1e5)],_0x2ebf25),await cleanupEmptyDirectories(dirname(_0x2ebf25),_0x557e1d[_0x382a36(0x1dd)]));const _0x30c07a={'deleted':_0x137efa,'remoteId':_0x31deca['remoteId']};if(_0x40ef47)_0x30c07a[_0x382a36(0x1f5)]=_0x40ef47;return{'ok':!![],'data':_0x30c07a,'message':_0x382a36(0x1e0)+_0x137efa+(_0x40ef47?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x5d81c0,_0x125b1f,_0x1d9bee){const _0x41cb33=a157_0x46a1bf,_0x5f4de3=new Date()['toISOString']()[_0x41cb33(0x1f7)](/[:.]/g,'-'),_0x2bdb14=relative(_0x5d81c0,_0x1d9bee),_0x40e96f=join(_0x125b1f,_0x5f4de3,_0x2bdb14);return await mkdir(dirname(_0x40e96f),{'recursive':!![]}),await rename(_0x1d9bee,_0x40e96f),_0x40e96f;}async function cleanupEmptyDirectories(_0x5401e9,_0x5cd805){const _0x4bedfa=a157_0x46a1bf;let _0x3df264=resolve(_0x5401e9);const _0x222628=resolve(_0x5cd805);while(_0x3df264['startsWith'](''+_0x222628+sep)||_0x3df264===_0x222628){if(_0x3df264===_0x222628)return;try{const _0x4da142=await readdir(_0x3df264);if(_0x4da142[_0x4bedfa(0x1dc)]>0x0)return;await rmdir(_0x3df264);}catch{return;}_0x3df264=dirname(_0x3df264);}}
|